Skip to content

[Bug]: Predict with any token uses incorrect quote when placing bet #28413

@caieu

Description

@caieu

Describe the bug

When placing a bet on Predict using the "Pay with Any Token" flow, the deposit amount sent to the quote is calculated before the order preview fees have fully loaded. This causes the system to request a swap quote for only the raw bet amount (e.g. $1.00) instead of the correct total that includes preview fees (e.g. $1.04 = $1.00 bet + $0.04 in provider/MetaMask fees).

This means the user could end up swapping fewer tokens than actually needed to cover the full bet + fees, potentially causing the deposit transaction to underperform or fail silently on the protocol side.

Expected behavior

The deposit amount should only be calculated and forwarded to the quote engine after the order preview (including fees) has fully loaded. The total amount passed to the "Pay with Any Token" swap quote should be:
depositAmount = betAmount + providerFee + metamaskFee - predictBalance (rounded up to 2 decimal places)
For example, for a $1.00 bet with $0.03 provider fee and $0.01 MetaMask fee, and $0.00 predict balance, the deposit amount should be $1.04, not $1.00.

Screenshots/Recordings

No response

Steps to reproduce

  1. Create or use a fresh account with no USDC predict balance but with an ERC-20 token balance (e.g. WETH, USDT on a supported chain)
  2. Navigate to a Predict market and open the bet placement screen
  3. Select "Pay with Any Token" and choose the ERC-20 token
  4. Type $1 (or the minimum bet amount) quickly and immediately tap the "Place Bet" / confirm button — do not wait for the fee breakdown to fully populate
  5. Observe the swap quote amount in the transaction confirmation — it will show a quote for ~$1.00 instead of ~$1.04 (bet + fees)

Error messages or log output

Where was this bug found?

Live version (from official store)

Version

7.73.0

Build number

4275

Build type

None

Device

Iphone 16

Operating system

iOS

Additional context

No response

Severity

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triageIssue needs to be triagedregression-prod-7.73.0Regression bug that was found in production in release 7.73.0release-7.74.0Issue or pull request that will be included in release 7.74.0type-bugSomething isn't working

    Type

    No fields configured for Bug.

    Projects

    Status
    To be triaged

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions