Skip to content

chore(runway): cherry-pick fix(predict): fix fee amount calculation cp-7.69.0#27234

Merged
chloeYue merged 1 commit into
release/7.69.0from
runway-cherry-pick-7.69.0-1773100500
Mar 10, 2026
Merged

chore(runway): cherry-pick fix(predict): fix fee amount calculation cp-7.69.0#27234
chloeYue merged 1 commit into
release/7.69.0from
runway-cherry-pick-7.69.0-1773100500

Conversation

@runway-github

@runway-github runway-github Bot commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

Description

Fix the Predict fee calculation to match the backend order relay
calculation. Previously, individual fee components (metamaskFee,
providerFee) were rounded to 3 decimal places before summing, and
previewOrder was passing size instead of makerAmount as the fee
basis. This caused rounding discrepancies that led to order failures on
certain amounts (e.g., $6.12 yielding a $0.244 fee instead of $0.2448).

Changes:

  • Remove per-component rounding of metamaskFee and providerFee
    keep full precision
  • Round only totalFee to 6 decimal places (matching backend precision)
  • Use makerAmount instead of size as the userBetAmount in
    previewOrder, aligning with the backend order relay

Changelog

CHANGELOG entry: null

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/PRED-740

Manual testing steps

Feature: Predict fee calculation accuracy

  Scenario: user places a bet with an amount that previously caused rounding errors
    Given the user is on the Predict market detail screen

    When user enters a bet amount of $6.12
    Then the displayed fee should be $0.2448 (not $0.244)
    And the order should succeed without a fee mismatch error

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the
    app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described
    in the ticket it closes and includes the necessary testing evidence such
    as recordings and or screenshots.

Note

Medium Risk
Updates fee math used for order previews/relaying; incorrect rounding
or amount basis could still cause fee mismatches and failed orders, but
the change is localized to fee computation.

Overview
Adjusts Predict’s Polymarket fee calculation to stop rounding
metamaskFee/providerFee individually
and instead round only
totalFee to 6 decimals
, matching backend precision.

Updates previewOrder (BUY) to compute fees from the rounded
makerAmount rather than the raw input size, reducing client/backend
fee discrepancies that can cause order submission failures.

Written by Cursor
Bugbot
for commit
06004e3. This will update automatically
on new commits. Configure
here.

[dbf2c8f](https://github.com/MetaMask/metamask-mobile/commit/dbf2c8ffe1c87904cb0b203036dfb1775d303776)

…p-7.69.0 (#27232)

## **Description**

Fix the Predict fee calculation to match the backend order relay
calculation. Previously, individual fee components (`metamaskFee`,
`providerFee`) were rounded to 3 decimal places before summing, and
`previewOrder` was passing `size` instead of `makerAmount` as the fee
basis. This caused rounding discrepancies that led to order failures on
certain amounts (e.g., $6.12 yielding a $0.244 fee instead of $0.2448).

**Changes:**
- Remove per-component rounding of `metamaskFee` and `providerFee` —
keep full precision
- Round only `totalFee` to 6 decimal places (matching backend precision)
- Use `makerAmount` instead of `size` as the `userBetAmount` in
`previewOrder`, aligning with the backend order relay

## **Changelog**

CHANGELOG entry: null

## **Related issues**

Fixes: https://consensyssoftware.atlassian.net/browse/PRED-740

## **Manual testing steps**

```gherkin
Feature: Predict fee calculation accuracy

  Scenario: user places a bet with an amount that previously caused rounding errors
    Given the user is on the Predict market detail screen

    When user enters a bet amount of $6.12
    Then the displayed fee should be $0.2448 (not $0.244)
    And the order should succeed without a fee mismatch error
```

## **Screenshots/Recordings**

<!-- Not applicable — logic-only change with no UI modifications -->

### **Before**

<!-- N/A -->

### **After**

<!-- N/A -->

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [ ] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Updates fee math used for order previews/relaying; incorrect rounding
or amount basis could still cause fee mismatches and failed orders, but
the change is localized to fee computation.
> 
> **Overview**
> Adjusts Predict’s Polymarket fee calculation to **stop rounding
`metamaskFee`/`providerFee` individually** and instead **round only
`totalFee` to 6 decimals**, matching backend precision.
> 
> Updates `previewOrder` (BUY) to compute fees from the rounded
`makerAmount` rather than the raw input `size`, reducing client/backend
fee discrepancies that can cause order submission failures.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
06004e3. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@runway-github runway-github Bot requested a review from a team as a code owner March 9, 2026 23:55
@github-actions

github-actions Bot commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot metamaskbot added the team-bots Bot team (for MetaMask Bot, Runway Bot, etc.) label Mar 9, 2026
@github-actions

github-actions Bot commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

⏭️ Smart E2E selection skipped - base branch is not main (base: release/7.69.0)

All E2E tests pre-selected.

View GitHub Actions results

@github-actions github-actions Bot added the size-S label Mar 9, 2026
@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ E2E Fixture Validation — Structural changes detected

Category Count
New keys 68
Missing keys 11
Type mismatches 0
Value mismatches 6 (informational)

The committed fixture schema is out of date. To update, comment:

@metamaskbot update-mobile-fixture

View full details | Download diff report

@chloeYue chloeYue left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@chloeYue chloeYue merged commit b468300 into release/7.69.0 Mar 10, 2026
106 checks passed
@chloeYue chloeYue deleted the runway-cherry-pick-7.69.0-1773100500 branch March 10, 2026 13:43
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 10, 2026
@metamaskbot metamaskbot added the release-7.69.0 Issue or pull request that will be included in release 7.69.0 label Mar 11, 2026
@metamaskbot

Copy link
Copy Markdown
Collaborator

No release label on PR. Adding release label release-7.69.0 on PR, as PR was cherry-picked in branch 7.69.0.

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

Labels

release-7.69.0 Issue or pull request that will be included in release 7.69.0 size-S team-bots Bot team (for MetaMask Bot, Runway Bot, etc.)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants