githubEdit

๐Ÿ”„Swapping

Integrate Ekubo protocol to provide better prices to swappers or to perform arbitrage

Routing

It is your responsibility to find the best list of pools for executing a trade. This is equivalent to finding the best route for arbitrage.

Executing swaps on chain

To swap on Ekubo, you must called ICore#lock. Ekubo's core contract will call back into your contract with the data you pass, via IYourContract#locked. In your lock callback, you execute the swap(s), pay the input, and withdraw the output tokens in no particular order.

Note you typically call swap multiple times in a single locked callback so you only have to pay the differences.

See the Routers on Starknetarrow-up-right and EVMarrow-up-right for examples of how to execute swaps on-chain.

Last updated

Was this helpful?