nutsfinance / tapio-eth

MIT License
1.16k stars 30 forks source link

[RFC] Swap Cross Pools With ETH #39

Open Mars12-dev opened 1 year ago

Mars12-dev commented 1 year ago

Summary

The contract "StableAssetApplication" proposes a swap of token "x" to token "y cross pools by depositing token "x in pool "In" and withdrawing token "y" from pool "Out" using "tapETH".

The idea is to replace this process by swapping token "x" to ETH from the pool "In" and swapping ETH to token "y" from the pool "Out".

Motivation

Action plan

1) Change the function "swapCrossPool" in the contract "StableAssetApplication" to use the swap function instea of "mint" and "redeem" functions. 2) Update unit tests for this function.

Detailed design

1) Swap token "x" to "WETH" from the pool "In". 2) Swap "WETH" to token "y" from the pool "Out".

Implementation Timeline

2 days

ukby1234 commented 12 months ago

It doesn't make sense to me: we are doing mint/redeemSingle and I think it's better in our use case. we have a mint fee of 0 and the 2*swap fee > redeem fee. plus, using two swaps actually moves some eth around. if we use redeem single, we aren't moving any unrelated funds (i.e. eth).

tangdaniu commented 12 months ago

aren't moving unrelated funds is a good point, again, less influence of external arbitrage.

Mars12-dev commented 12 months ago

traders should pay the swap fee. The objectif is not to reduce fee and propose for traders a swap alternative with less fee. Moreover, the mint fee cannot be set to zero. Indeed, in this case a trader can mint tapETH for free and do a single side redeem to recieve a token different of his deposit token, so he do a swap with a fee less than the swap fee.