Skip to content

fix(transaction-pay-controller): account override fixes#8724

Merged
jpuri merged 13 commits intomainfrom
poc/pay-money-account-deposit-fixes
May 8, 2026
Merged

fix(transaction-pay-controller): account override fixes#8724
jpuri merged 13 commits intomainfrom
poc/pay-money-account-deposit-fixes

Conversation

@matthewwalsh0
Copy link
Copy Markdown
Member

@matthewwalsh0 matthewwalsh0 commented May 6, 2026

Summary

Fixes in transaction-pay-controller's Relay strategy that together unblock Money Account deposits via MetaMask Pay (and any other delegation-based deposit flow targeting Arbitrum USDC).

  1. Funding-leg recipient should be transaction.txParams.from, not request.from
  2. Arbitrum-USDC → Hypercore rewrite must be gated on perpsDeposit

Ref: https://consensyssoftware.atlassian.net/browse/CONF-1324


Note

Medium Risk
Adjusts Relay quote transaction construction and chain/token rewrite behavior for Arbitrum USDC deposits; mistakes here could misroute funds or produce incorrect quotes for delegation-based flows.

Overview
Fixes Relay quoting for delegation-based flows when accountOverride causes request.from to differ from the executing delegator.

Relay now funds the delegator address (transaction.txParams.from) when building the initial token-transfer leg (falling back to request.from if unset), and the Arbitrum-USDC → Hypercore (Hyperliquid) quote rewrite is now only applied for TransactionType.perpsDeposit (not for other transaction types or post-quote flows). Tests and the changelog are updated to cover these cases.

Reviewed by Cursor Bugbot for commit 882ea79. Bugbot is set up for automated code reviews on this repo. Configure here.

…iquid gating

- Deliver the Relay-acquired token to transaction.txParams.from (the
  delegator that executes the inner delegation), not request.from. When
  accountOverride causes the two to differ, the previous behaviour funded
  the override while the inner transferFrom(msg.sender, ...) pulled from
  the delegator, reverting with 'ERC20: transfer amount exceeds balance'.
- Gate the Arbitrum-USDC -> Hypercore quote rewrite on
  transaction.type === TransactionType.perpsDeposit. Without the gate,
  every Arbitrum-USDC quote was silently rewritten to a direct Hypercore
  deposit, which is only valid for Perps and breaks Money Account
  deposits and any other flow targeting Arbitrum USDC.
@jpuri jpuri changed the title [PoC] fix(transaction-pay-controller): Money Account deposit / Pay funding-leg fixes fix(transaction-pay-controller): Money Account deposit / Pay funding-leg fixes May 6, 2026
@jpuri jpuri marked this pull request as ready for review May 6, 2026 15:01
@jpuri jpuri requested review from a team as code owners May 6, 2026 15:01
@jpuri jpuri enabled auto-merge May 6, 2026 15:01
@matthewwalsh0 matthewwalsh0 changed the title fix(transaction-pay-controller): Money Account deposit / Pay funding-leg fixes fix(transaction-pay-controller): account override fixes May 7, 2026
Comment thread packages/transaction-pay-controller/CHANGELOG.md Outdated
Comment thread packages/transaction-pay-controller/CHANGELOG.md Outdated
Comment thread packages/transaction-pay-controller/src/strategy/relay/relay-quotes.ts Outdated
Comment thread packages/transaction-pay-controller/src/strategy/relay/relay-quotes.ts Outdated
@jpuri jpuri self-requested a review May 8, 2026 09:45
@jpuri jpuri added this pull request to the merge queue May 8, 2026
Merged via the queue into main with commit cbf1bcf May 8, 2026
366 checks passed
@jpuri jpuri deleted the poc/pay-money-account-deposit-fixes branch May 8, 2026 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants