# 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.&#x20;

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](/users/swaps.md) documents how to call swaps using this logic. Migration specific example is provided in the below page:

[Directly Calling CrocSwapDex](/developers/dex-contract-interface/swaps/hot-path-swap-migration/directly-calling-crocswapdex.md)

## 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](/developers/dex-contract-interface/swaps/hot-path-swap-migration/external-swap-router.md)

## 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ambient.finance/developers/dex-contract-interface/swaps/hot-path-swap-migration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
