Skip to content
Request an audit

Which side of a swap the fee is taken on, and whether it gets taken twice

We continued the Mento V3 contest on Cantina.

Lesson Summary:

  • expectedAmountIn comes from amountOut. If the fee is 1% and I want to get 100, I should get 99. But here I think I should just return 101(fee included);
  • protocol fee is also applied to amountIn, so it looks good for now;
  • newReserveValue already removed protocol fee (_swapCheck), because the protocol fee was transferred out and the reserves were updated before checking the swap;
  • In the check, why are both fees taken when the protocol fee was already taken and the reserves reset?
  • Should the fees be taken on the amount in, or on the amount out?
  • Make sure totalFeeInToken1 is correct.
Watch the session on YouTube ↗
Message on Telegram All 62 posts