Hot Path Swap Migration

As of February 26 2024, integrations previously utilizing the swap() method on Ethereum and Scroll network will find that callpath reverts on all transactions.

The core swap callpath has been upgraded from the base deployment on Ethereum and Scroll. Therefore calls made directly to swap() will fail, since that that callpath uses deprecated swap code. Swap calls made to swap() instead of userCmd() will now universally revert.

Any external integrators or bots will need to migrate how their swap calls are made. Any external smart contracts routing swaps will need to migrate the swap call.

Users of the Ambient frontend or the latest version Crocswap SDK do not need to take any action. Swap logic in the frontend and SDK will automatically use the updated callpath. No other transaction types are affected.

Transitioning existing integrations should be simple and straightforward. The below options describe three possible options, and users are free to use whichever they prefer.

Option 1: Direct call to CrocSwapDex

The most gas efficient way to swap is to directly call the main dex contract with userCmd(), but the upgraded swap path requires a different slightly different format to encode arguments. The Cold Path section of the Swaps documents how to call swaps using this logic. Migration specific example is provided in the below page:

Directly Calling CrocSwapDex

Option 2: External Router

This is the simplest and easiest migration option. Callers will simply need to call the same ABI compatible swap()function on a new contract address. However it is the highest gas cost. More details are provided in the below page:

External Swap Router

Future Deployments and Upgrades

This migration requirement will not affect future deployments, and swap() callpath will still be available on future networks such as Blast mainnet.

Any future upgrades to swap callpath will use the same proxy callpath, so any of the above migration options will remain available and open in perpetuity.

Last updated