ref-finance / ref-contracts

Smart contracts for Ref Finance
MIT License
96 stars 54 forks source link

Feature request: recipient field for swaps #76

Open secretshardul opened 2 years ago

secretshardul commented 2 years ago

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

function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data)

Ref should implement this. Suppose we have a proxy contract for swaps-

  1. In EVM, we can set the the to field as the signer's address. This way the tokens directly go to the user.
  2. 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.