I'm trying to optimize the gas cost for a swap smart contract. The goal is to make a swap using assembly however the issue is that it doesn't work. The code is from this repository:
If you try running the code on remix it won't execute properly. I'm trying to figure out how the transfer and swap functions are done in assembly as you can see in lines 86 and lines 119.
I'm looking for someone to explain how they work and fix it. the calldata you must use to execute the fallback() function is this:
The smart contract will then extract the different parameters from it using assembly. Check it out and let me know.
Remember the goal is to understand how the lines 86 and 119 work so I can optimize them properly and fix it. The contract is simply executing a simple swap() from uniswap v2 contracts