Submitted by broccoli
TridentRouter is easy to fail when trying to provide liquidity to an index pool.
Users would not get extra lp if they are not providing lp at the pools spot price. Its the same design as uniswap v2. However, uniswaps v2 handles the dirty part.
Users would not lose tokens if they use the router (UniswapV2Router02.sol L61-L76).
However, the router wouldnt stop users from transferring extra tokens (TridentRouter.sol L168-L190).
Second, the price would possibly change when the transaction is confirmed. This would be reverted in the index pool.
Users would either transfer extra tokens or fail. I consider this is a medium-risk issue.
TridentRouter.sol#L168-L190
A possible scenario:
Theres a BTC/USD pool. BTC = 50000 USD.
Please refer to the uniswap v2 router in UniswapV2Router02.sol L61-L76
The router should calculate the optimal parameters for users.
maxsam4 (Sushi) confirmed
