Stake pools
Description
The stake-pool bond system turns SOL staked into a stake pool into a bond. The deposited funds are segregated into principal and yield. The exact amount each PT and YT will redeem for is determined at the first redemption of a bond. The PTs and YTs can be used to redeem for LSTs, which in turn can be redeemed for SOL.
Invariants
The amount of tokens minted should be correctly related to the amount deposited.
The amount of PTs in circulation should not exceed the value in SOL deposited.
Test coverage
Cases covered
Initializing a bond from a stake pool
Depositing SOL into a bond generated from a stake pool
Depositing LST into a bond generated from a stake pool
Depositing mSOL into an mSOL bond
Cases not covered
Redeeming PTs from a stake-pool bond
Redeeming YTs from a stake-pool bond
Redeeming PTs from an mSOL bond
Redeeming YTs from an mSOL bond
Changing in the value of LSTs before the first redemption and after bond maturity
Trying to redeem before bond maturity
Depositing multiple times from different accounts
Depositing after bond maturity
Attack surface
Depositing a custom LST coin type. A transfer will be attempted to an account that is enforced to be the correct coin type, which will fail in the case the incorrect type of coin account is given.
Passing in a fake fee wallet to capture the fee. The fee-wallet authority is checked, which in turn is part of the global settings, which is a PDA with a specific seed.
Using the PT/YT token mint for another, more valuable bond, causing the wrong PTs/YTs to be minted. The token mint is checked against the bond's data.
Redeeming early. There is a check for the current time on Solana.