Skip to content

Add premium-budget Predict mint#1076

Open
emmazzz wants to merge 4 commits into
emma/predict-mint-max-costfrom
emma/predict-mint-fixed-cost
Open

Add premium-budget Predict mint#1076
emmazzz wants to merge 4 commits into
emma/predict-mint-max-costfrom
emma/predict-mint-fixed-cost

Conversation

@emmazzz

@emmazzz emmazzz commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add mint_with_premium to size a Predict mint from a fixed net-premium budget and return the largest lot-rounded quantity that fits.
  • Add min_quantity slippage protection for the premium-budget path.
  • Keep the two mint slippage models distinct: mint caps all-in spend via max_cost, while mint_with_premium budgets only net premium and pays fees on top.

Key decisions

  • Stack this PR on emma/predict-mint-max-cost so the existing-mint all-in max-cost cap remains a separate review.
  • mint_with_premium passes std::u64::max_value!() to the fixed-quantity mint path for the all-in cap; its slippage guard is received quantity via min_quantity.
  • Use the closed-form max_quantity_for_net_premium inverse rather than binary search over lots.
  • Leave unspent premium dust in the manager because minted quantity must align to position_lot_size lots.

Test plan

  • sui move test --path packages/predict max_quantity_for_net_premium --gas-limit 100000000000
  • sui move test --path packages/predict mint_slippage --gas-limit 100000000000
  • sui move build --path packages/predict --warnings-are-errors
  • sui move test --path packages/predict --gas-limit 100000000000

@emmazzz emmazzz force-pushed the emma/predict-mint-fixed-cost branch 4 times, most recently from a041d41 to 0451b79 Compare June 17, 2026 22:34
@emmazzz emmazzz force-pushed the emma/predict-mint-fixed-cost branch from a1ff82c to 880b806 Compare June 17, 2026 23:24
@emmazzz emmazzz changed the title Add fixed cost Predict mint Add premium-budget Predict mint Jun 17, 2026
@emmazzz emmazzz marked this pull request as ready for review June 17, 2026 23:59

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);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any specific reason why we want to extract this div as a function?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants