program: param-update-for-summary-stats-update-pool-balances#2008
Open
program: param-update-for-summary-stats-update-pool-balances#2008
Conversation
moosecat2
reviewed
Nov 2, 2025
| // 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) |
moosecat2
reviewed
Nov 2, 2025
Comment on lines
+2585
to
+2592
| 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" | ||
| )?; | ||
|
|
Member
There was a problem hiding this comment.
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
moosecat2
reviewed
Nov 2, 2025
| market.amm.total_fee_withdrawn = market | ||
| .amm | ||
| .total_fee_withdrawn | ||
| .saturating_sub(revenue_pool_transfer.unsigned_abs()); |
Member
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.