Skip to content

Rounding and billing fix#90

Draft
RuoHan-Chen wants to merge 6 commits into
mainfrom
roundingAndBillingFix-contract-only
Draft

Rounding and billing fix#90
RuoHan-Chen wants to merge 6 commits into
mainfrom
roundingAndBillingFix-contract-only

Conversation

@RuoHan-Chen

@RuoHan-Chen RuoHan-Chen commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Replace feeBps with absolute feeAmount on capture() and charge(). Payer-approved minFeeBps/maxFeeBps still bound the fee as [amount × min / 10_000, amount × max / 10_000], so operators can pass cent-aligned fees off-chain without on-chain BPS truncation.
https://docs.google.com/document/d/1RCIXH0Q46XcwyYcu3027g9bKXHljrEX-y_ciBIdGNIQ/edit?tab=t.0#heading=h.onqsqfymwwr8
Implementation based on pps

@cb-heimdall

cb-heimdall commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 1
Sum 2

@ilikesymmetry ilikesymmetry left a comment

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.

Did not review tests, but looks like a relatively simple modification. Good principle learned: prefer custom net-amount args as calldata with math + checks against constraints versus passing in fields that derive the net-amount and restrict rounding preferences.

Comment thread src/AuthCaptureEscrow.sol Outdated
Comment thread src/interfaces/IMulticall3.sol Outdated

// Pull tokens into this contract
IERC3009(token).receiveWithAuthorization({
IERC3009(token)

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.

are you on the latest version of foundry? wonder if there's a way to remove some of this lint thrashing... not blocking

Comment thread src/AuthCaptureEscrow.sol
/// @param feeAmount Absolute fee in token units (must fall within payer-approved bounds)
/// @param feeReceiver Address to receive fees (should match the paymentInfo.feeReceiver unless that is 0 in which case it can be any address)
function capture(PaymentInfo calldata paymentInfo, uint256 amount, uint16 feeBps, address feeReceiver)
function capture(PaymentInfo calldata paymentInfo, uint256 amount, uint256 feeAmount, address feeReceiver)

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.

one thing that came up in our original call was the question as to whether the new version of the AuthCaptureEscrow should retain its old interface too. I.e. should have have a net-new version of capture that offers the feeAmount while also offering a version with feeBps in case we want to migrate existing integrations to flow through the same AuthCaptureEscrow. A question for Fab and team. Given that we can run multiple authcaptureescrows in parallel, we would never be blocked on this, but might be good to consider one more time

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.

4 participants