Following the Solana convention, this module contains the processing logic of the on-chain program.
This is the function that initializes the state of Solido.
This function completes a number of checks:
- confirms the Solido account is rent exempt
- confirms the reserve account is rent exempt
- checks that the size of the Solido data is the same as expected given the constraints of
Once those checks are complete the function then finds the bump seeds associated with the
DEPOSIT_AUTHORITY for the defined constants, constructs the fee spec, checks that the
developer_account are valid stSOL accounts and finally then builds and serializes the state of Solido.
This function is responsible for taking SOL deposits and minting the equivalent stSOL to the depositors receiving account.
The recipient account must be capable of holding stSOL. The deposit is transferred from the users account to the reserve account and, after checking the correct amount of equivalent stSOL, these are minted to the recipient account. The total stSOL shares is updated and the new Solido state is serialized.
The process stake deposit function is responsible for creating validator stake account and delegating reserve funds to those accounts.
This function is gated so that only those in a maintainer role can run it successfully. The function must check that the following are true:
- the amount being staked is greater than the minimum stake balance
- the amount being staked is less then the available reserve balance
Once those checks have been passed the function will try to find a stake address associated to the given validator and confirm that the account is uninitialized. The account is then allocated, assigned, the given amount is transferred to the account from the reserve. The account is then initialized and the amount is then delegated to the validator. Finally the validator stake amount is updated in the Solido state and the state is then serialized.
This function processes a withdrawal.
Note: Withdrawals are currently not supported in Solido; they will be added in a subsequent version.
This is the main process function that is called from the entrypoint.
The function simply parses the instruction passed and calls the appropriate processing logic.