Add premium-budget Predict mint#1076
Open
emmazzz wants to merge 4 commits into
Open
Conversation
a041d41 to
0451b79
Compare
a1ff82c to
880b806
Compare
pei-mysten
reviewed
Jun 18, 2026
|
|
||
| let entry_value = math::mul(entry_probability, quantity); | ||
| let net_premium = math::div(entry_value, leverage); | ||
| let net_premium = mint_net_premium(entry_value, leverage); |
Collaborator
There was a problem hiding this comment.
any specific reason why we want to extract this div as a function?
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.
Summary
mint_with_premiumto size a Predict mint from a fixed net-premium budget and return the largest lot-rounded quantity that fits.min_quantityslippage protection for the premium-budget path.mintcaps all-in spend viamax_cost, whilemint_with_premiumbudgets only net premium and pays fees on top.Key decisions
emma/predict-mint-max-costso the existing-mint all-in max-cost cap remains a separate review.mint_with_premiumpassesstd::u64::max_value!()to the fixed-quantity mint path for the all-in cap; its slippage guard is received quantity viamin_quantity.max_quantity_for_net_premiuminverse rather than binary search over lots.position_lot_sizelots.Test plan
sui move test --path packages/predict max_quantity_for_net_premium --gas-limit 100000000000sui move test --path packages/predict mint_slippage --gas-limit 100000000000sui move build --path packages/predict --warnings-are-errorssui move test --path packages/predict --gas-limit 100000000000