Add comments
This commit is contained in:
parent
9475d9545c
commit
9fb16f3906
|
@ -57,6 +57,11 @@ pub struct Serum3SettleFunds<'info> {
|
|||
pub token_program: Program<'info, Token>,
|
||||
}
|
||||
|
||||
/// Settling means moving free funds from the serum3 open orders account
|
||||
/// back into the mango account wallet.
|
||||
///
|
||||
/// There will be free funds on open_orders when an order was triggered.
|
||||
///
|
||||
pub fn serum3_settle_funds(ctx: Context<Serum3SettleFunds>) -> Result<()> {
|
||||
//
|
||||
// Validation
|
||||
|
@ -141,7 +146,8 @@ pub fn serum3_settle_funds(ctx: Context<Serum3SettleFunds>) -> Result<()> {
|
|||
let account = ctx.accounts.account.load()?;
|
||||
let health = compute_health(&account, &ctx.remaining_accounts)?;
|
||||
msg!("health: {}", health);
|
||||
require!(health >= 0, MangoError::SomeError);
|
||||
// TODO: settle_funds should always succeed - check here if the health impact
|
||||
// brings a user back over the liquidation threshold?
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@ use crate::state::*;
|
|||
// more perp markets open at the same time etc
|
||||
// In particular if perp markets don't require the base token to be active on the account,
|
||||
// we could probably support 1 token (quote currency) + 15 active perp markets at the same time
|
||||
// It's a tradeoff between allowing users to trade on many markets with one account,
|
||||
// MangoAccount size and health compute needs.
|
||||
const MAX_INDEXED_POSITIONS: usize = 16;
|
||||
const MAX_SERUM_OPEN_ORDERS: usize = 8;
|
||||
|
||||
|
|
Loading…
Reference in New Issue