Description
A bettor calling place_bet today implicitly accepts whatever fee config is current. Add an optional max_fee_bps parameter that the contract checks against the live FeeConfig, reverting if the actual fee exceeds the bettor's tolerance. This mirrors EVM slippage protection.
Requirements and Context
- Parameter is
Option<u32>; None preserves existing behaviour
- Revert with
Error::FeeAboveAcceptable
- Add to batch path too
- Must be secure, tested, and documented
- Should be efficient and easy to review
Suggested Execution
- Fork the repo and create a branch
git checkout -b feature/bet-slippage-guard
- Implement changes
contracts/predictify-hybrid/src/bets.rs
contracts/predictify-hybrid/src/lib.rs
contracts/predictify-hybrid/src/bet_tests.rs
- Test and commit
cargo test -p predictify-hybrid bet_slippage
- Cover edge cases
- Include test output and notes in the PR
Example commit message
feat: add max_fee_bps slippage guard to place_bet
Acceptance Criteria
Guidelines
- No
unwrap() in production paths
- Clear documentation and inline comments
- Timeframe: 96 hours
Description
A bettor calling
place_bettoday implicitly accepts whatever fee config is current. Add an optionalmax_fee_bpsparameter that the contract checks against the liveFeeConfig, reverting if the actual fee exceeds the bettor's tolerance. This mirrors EVM slippage protection.Requirements and Context
Option<u32>;Nonepreserves existing behaviourError::FeeAboveAcceptableSuggested Execution
contracts/predictify-hybrid/src/bets.rscontracts/predictify-hybrid/src/lib.rscontracts/predictify-hybrid/src/bet_tests.rscargo test -p predictify-hybrid bet_slippageExample commit message
Acceptance Criteria
Nonepreserves prior behaviour for compatibilitymax_fee_bpscauses revertGuidelines
unwrap()in production paths