Skip to content

feat: Improve Predict Across deposits for proxy setup and direct transfer flows#8208

Open
pedronfigueiredo wants to merge 4 commits intomainfrom
codex/improve-predict-deposit-flow
Open

feat: Improve Predict Across deposits for proxy setup and direct transfer flows#8208
pedronfigueiredo wants to merge 4 commits intomainfrom
codex/improve-predict-deposit-flow

Conversation

@pedronfigueiredo
Copy link
Contributor

@pedronfigueiredo pedronfigueiredo commented Mar 16, 2026

Explanation

This PR updates predictDeposit Across quote handling to distinguish between initial proxy setup deposits and subsequent transfer-only deposits. When the destination calldata is empty or represents a single ERC-20 transfer, the quote now skips post-swap actions and relays directly to the transfer recipient to avoid unnecessary gas and fees. When calldata is present for proxy creation and setup, the destination transactions are decoded into ordered Across post-swap actions so the proxy initialization, Safe execution, and approval flow can still run after bridging. The change preserves existing non-Predict behavior, adds focused test coverage for both Predict flows and unsupported calldata cases, and keeps the original changelog entry while adding a separate follow-up note for this improvement.

References

https://consensyssoftware.atlassian.net/browse/CONF-1043?atlOrigin=eyJpIjoiOWRmOThmZWRjZjZkNDljYTgyMTE4NTNjYWU5MzgwNDEiLCJwIjoiaiJ9

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Changes how Across quotes derive recipient and actions by decoding destination calldata (including nested batches), which can alter bridged fund recipients and post-swap execution. Risk is mitigated by extensive new unit coverage but impacts a critical transaction flow.

Overview
Across quote destination handling is overhauled to derive recipient and actions from destination calldata (preferring nestedTransactions), instead of treating predictDeposit transfers as post-swap actions.

Transfer-only destinations now send directly to the transfer recipient with no actions, while supported setup calls (e.g., createProxy, execTransaction) are decoded into ordered post-swap actions; unsupported selectors or missing required target now throw clearer errors.

Adds a new across-actions module with focused tests, expands across-quotes tests to cover transfer-only vs setup flows, batching behavior (first transfer sets recipient, later transfers become actions), and additional failure cases, and documents the behavior change in the changelog.

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

@pedronfigueiredo pedronfigueiredo self-assigned this Mar 16, 2026
@pedronfigueiredo pedronfigueiredo requested review from a team as code owners March 16, 2026 15:01
@pedronfigueiredo pedronfigueiredo force-pushed the codex/improve-predict-deposit-flow branch from 43eb402 to c770afa Compare March 16, 2026 16:57
: undefined,
getTarget: (call, request) => call.target ?? request.targetTokenAddress,
interface: TOKEN_TRANSFER_INTERFACE,
methodName: 'transfer',
Copy link
Member

Choose a reason for hiding this comment

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

Can we not extract this from the signature dynamically?


function getTransferData(transaction: TransactionMeta): Hex | undefined {
const { nestedTransactions, txParams } = transaction;
function getDestinationCalls(
Copy link
Member

Choose a reason for hiding this comment

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

Should this be encapsulated inside across-actions too, as it's the main entrypoint?

Get me actions for this TransactionMeta?

@pedronfigueiredo pedronfigueiredo force-pushed the codex/improve-predict-deposit-flow branch from 47d87a1 to 7a8d479 Compare March 19, 2026 12:07
return normalizeHexString(String(parsedCall.args[0])) as Hex;
}

export function getAcrossDestination(
Copy link
Member

Choose a reason for hiding this comment

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

Minor, is this the only thing that needs exporting? So ideally we only unit test this? And at the top of the file for readability?

return normalizeHexString(String(parsedCall.args[0])) as Hex;
}

export function getAcrossDestination(
Copy link
Member

Choose a reason for hiding this comment

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

Minor, I was assuming separate functions but this works too, but maybe just getAcrossActions?

const selector = getDestinationSelector(data);

return selector
? `${UNSUPPORTED_DESTINATION_ERROR}. Destination selector: ${selector}`
Copy link
Member

Choose a reason for hiding this comment

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

Minor, what do we mean by "destination", these are just calls / functions right?

So maybe just Function not supported by Across: ${selector}?

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.

2 participants