Velvet-Capital / Velvet-v4

V4 (thena+venus) on top of v3
Other
0 stars 0 forks source link

Thena oracle integration #27

Closed langnavina97 closed 1 month ago

langnavina97 commented 1 month ago

Added our Chainlink oracle to verify the swap when fees are being swapped to reinvest into the external position

Havoc19 commented 1 month ago

I have one question, 1Are we only adding enable tokens checks, because if we are adding price oracle token, I though there will be some price check or something, to tackle any ,manipulation

Havoc19 commented 1 month ago

Here in this function - https://github.com/Velvet-Capital/Velvet-v4/blob/414b8e6e94a68f765bd6a9c1b1aac653ad8ae33b/contracts/wrappers/algebra/PositionManagerAlgebraAbstract.sol#L349

We will be always passing the value - _params._amountIn > 0, then it will never move in else condition

if (_params._amountIn > 0) {
      (balance0, balance1) = _swapTokenToToken(_params);
}

also we have -

ISwapRouter.ExactInputSingleParams memory params = ISwapRouter
      .ExactInputSingleParams({
        tokenIn: _params._tokenIn,
        tokenOut: _params._tokenOut,
        recipient: address(this),
        deadline: block.timestamp,
        amountIn: _params._amountIn,
        amountOutMinimum: 0, // @todo add slippage control
        limitSqrtPrice: 0
      });

This will be just for one token to other, right?

langnavina97 commented 1 month ago

I have one question, 1Are we only adding enable tokens checks, because if we are adding price oracle token, I though there will be some price check or something, to tackle any ,manipulation

Only enabled tokens can be added to make sure there is a price oracle.. verifySwap will verify the swap

langnavina97 commented 1 month ago

if (_params._amountIn > 0) {

If the swap amount is zero it means the fees were returned in the correct ratio, then we only verify if the ratio is correct.. then no swap is required