function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data)
Ref should implement this. Suppose we have a proxy contract for swaps-
In EVM, we can set the the to field as the signer's address. This way the tokens directly go to the user.
With Ref, the proxy contract will get the output tokens. Sending the tokens to the user will require another transfer. This more more code and higher gas fee.
Uniswap has a
to
field allowing the output tokens to be sent to an address other than the signer.https://github.com/Uniswap/v2-core/blob/4dd59067c76dea4a0e8e4bfdda41877a6b16dedc/contracts/UniswapV2Pair.sol#L159
Ref should implement this. Suppose we have a proxy contract for swaps-
to
field as the signer's address. This way the tokens directly go to the user.