This byte specifies the version of the Solido state.
This defines the size of the header of the Solido state.
The header size should be equivalent to the following:
- the size of the version byte
- the size of the manager and st_sol_mint public keys
- the size of the st_sol_total_shares which is an stLamports struct
- the size of the sol_reserve_authority_bump_seed and the deposit_authority_bump_seed
This defines the size of the fee section of the Lido state.
This should be equivalent to the following:
- the size of the FeeDistribution struct
- the size of the FeeRecipients struct
This is the main structure for maintaining the Solido state.
This function calculates the size of the Solido state if it had the maximum number of validators and maintainers.
This function calculates the correct amount of pool tokens, stSOL, for a given stake deposit in SOL.
Checks if the instance of Solido has already been initialized.
Confirms that the passed mint account is indeed Solido's expected stSOL mint.
Confirms that the given account is an SPL token account with our stSOL mint as mint.
Checks if the passed manager is the same as the one stored in the state
Checks if the passed maintainer belong to the list of maintainers
This function returns the address of the reserve account, i.e. the account where SOL gets deposited to.
Confirms that the reserve authority passed does in fact belong to this Solido instance.
The validator struct maintains the data regarding each validator that is required to generate staking accounts and maintain the fees due.
This function finds a stake account associated with a given validator vote account.
This function wraps the Solana
Pubkey::find_program_address. That function tries to find a valid program address and its corresponding bump seed which must be passed as an additional seed when calling
invoke_signed. The processes of finding a valid program address is by trial and error,and even though it is deterministic given a set of inputs it can take a variable amount of time to succeed across different inputs. This means that when called from an on-chain program it may incur a variable amount of the program's compute budget. Programs that are meant to be very performant may not want to use this function because it could take a considerable amount of time. Also, programs that area already at risk of exceeding their compute budget should also call this with care since there is a chance that the program's budget may be occasionally exceeded.
Additional Note: The underlying Solana program function will panic in the very unlikely event that the additional seed could not be found.
The FeeDistribution struct simply maintains the ratios of distribution between the treasury, developer (Chorus One), and the validators.
The FeeRecipients struct is another simple struct that holds the Pubkey addresses of the treasury and developer (Chorus One) accounts that will receive fees.