-
Notifications
You must be signed in to change notification settings - Fork 214
program: param-update-for-summary-stats-update-pool-balances #2008
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
base: master
Are you sure you want to change the base?
Conversation
| // Calculates the revenue pool transfer amount for a given market state (positive = send to revenue pool, negative = pull from revenue pool) | ||
| // If the AMM budget is above `FEE_POOL_TO_REVENUE_POOL_THRESHOLD` (in surplus), settle fees collected to the revenue pool depending on the health of the AMM state | ||
| // Otherwise, spull from the revenue pool (up to a constraint amount) | ||
| // Otherwise, pull from the revenue pool (up to a constraint amount) |
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.
nice one
| let spot_market = &mut load_mut!(ctx.accounts.quote_spot_market)?; | ||
|
|
||
| validate!( | ||
| spot_market.market_index == QUOTE_SPOT_MARKET_INDEX, | ||
| ErrorCode::DefaultError, | ||
| "invalid spot market" | ||
| )?; | ||
|
|
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.
did you run this through a bankrun test yet? quote market is not marked as mutable in the context struct so i think it would throw. can also through this validate in the context struct as well as a constraint
| market.amm.total_fee_withdrawn = market | ||
| .amm | ||
| .total_fee_withdrawn | ||
| .saturating_sub(revenue_pool_transfer.unsigned_abs()); |
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.
saturating sub or safe sub? should it throw if it wants to take the value negative instead of sending to 0?
above there's safe_add as well
No description provided.