-
-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Staked collateral #248
Staked collateral #248
Conversation
…ngle with regular ones
…e TBD as part of this process
programs/marginfi/src/instructions/marginfi_group/configure_bank.rs
Outdated
Show resolved
Hide resolved
/// Because the mint (and thus corresponding stake pool) of a staked collateral bank cannot | ||
/// update after inception, this function validates just the oracle, ignoring the lst mint and | ||
/// sol pool. This function works only for banks configured as StakedWithPythPush, and otherwise | ||
/// errors | ||
pub fn validate_staked_oracle_setup(&self, ais: &[AccountInfo]) -> MarginfiResult { | ||
OraclePriceFeedAdapter::validate_staked_bank_config_light(self, ais)?; | ||
Ok(()) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the idea here that we don't have to pass 2 extra accounts when configuring a stake collateral bank?
Also the oracle setup should be validated only when the oracle is update which shouldn't happen unless we expect the underlying pyth oracle to change?
I would maybe think that saving on code complexity (additional code) is worth more than saving 2 extra accounts when calling an admin instruction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's for config. The underlying pyth oracle can still update, so we still want to validate it, but the stake mint and pool accounts cannot update after bank inception, so checking them is not necessary after initial add pool.
We could recycle the existing validate_oracle_setup if you prefer but I thought splitting it was cleaner, having it branch within the function will be a slightly larger code change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consolidated validation into one large function
Staked collat fixes
Single Pool
program (https://github.com/solana-labs/solana-program-library/tree/master/single-pool) to create an "LST" that uses that just that validator (unlike a traditional LST which will have several validators). After a bank for this LST is created, the LST can be deposited as collateral in the main pool. Only SOL can be borrowed against this kind of asset.Running the test suite:
anchor build -p marginfi -- --no-default-features
(repeat for other programs as needed)anchor test --skip-build
Extras:
Notes for launch:
asset_tag
field inbank.config
asset_tag
toASSET_TAG_SOL
ASSET_TAG_DEFAULT
instead ofASSET_TAG_SOL
, so they will not be able to be used with STAKED accounts. However, this is probably a good thing: we want users to make a new account for this feature.