im pretty new to solidity, and i was wondering how you can 1 ERC token by another across different liquidity pools.
Example:
I have 1 DAI and I change it for eth in the ETH-DAI Uniswap pool
then I swap ETH by SUSHI in the SUHSI-ETH Sushiswap pool
so the tx looks like this
swap 1 dai for x eth
swap x eth for y sushi
I guess you cant do it directly and you need to deploy a smart contract that interacts with both contracts (Uniswap ETH-DAI and Sushiswap SUSHI-ETH) and then you interact with your deployed smart contract.
Does this have a particular name? I saw that it exist something called atomic swaps but I guess its not the same
Best Answer
Here you can find an example of such a smart contract. https://blog.infura.io/build-a-flash-loan-arbitrage-bot-on-infura-part-ii/
Nothing unusual here. Just do a call to different smart contracts in a single transaction.