Skip to content

Add bets.rs slippage guard max_fee_bps_at_bet to protect bettors from mid-bet fee changes #676

Description

@greatest0fallt1me

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

  1. Fork the repo and create a branch
    git checkout -b feature/bet-slippage-guard
  2. Implement changes
    • contracts/predictify-hybrid/src/bets.rs
    • contracts/predictify-hybrid/src/lib.rs
    • contracts/predictify-hybrid/src/bet_tests.rs
  3. 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

  • None preserves prior behaviour for compatibility
  • Live fee above max_fee_bps causes revert
  • Test covers exact-equal threshold

Guidelines

  • No unwrap() in production paths
  • Clear documentation and inline comments
  • Timeframe: 96 hours

Metadata

Metadata

Labels

GRANTFOX OSSGrantFox open-source campaign taskOFFICIAL CAMPAIGNOfficial GrantFox campaign issueStellar WaveIssues in the Stellar wave programenhancementNew feature or improvementrustRust implementationsecuritySecurity hardeningsmart-contractSoroban smart-contract worksorobanSoroban SDK / Stellar

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions