Open SushantChandla opened 1 month ago
The swap base output function returns the source_amount_swapped, which already includes the fees. https://github.com/raydium-io/raydium-cp-swap/blob/87685cf221e7d0b06419c6c750bd963b6780dca9/programs/cp-swap/src/curve/calculator.rs#L150C13-L150C34
source_amount_swapped
see: https://github.com/raydium-io/raydium-cp-swap/blob/87685cf221e7d0b06419c6c750bd963b6780dca9/programs/cp-swap/src/curve/calculator.rs#L140
We are adding correct fee here:
https://github.com/blockworks-foundation/autobahn/blob/f9e8f8bf7cbdb886c23b72fb9ba67d700bd6f91f/lib/dex-raydium-cp/src/edge.rs#L260
It is important to note that it does not include transfer_fee in the case of 2022 tokens, so we should add it to the amount. It is currently missing.
transfer_fee
The swap base output function returns the
source_amount_swapped
, which already includes the fees. https://github.com/raydium-io/raydium-cp-swap/blob/87685cf221e7d0b06419c6c750bd963b6780dca9/programs/cp-swap/src/curve/calculator.rs#L150C13-L150C34see: https://github.com/raydium-io/raydium-cp-swap/blob/87685cf221e7d0b06419c6c750bd963b6780dca9/programs/cp-swap/src/curve/calculator.rs#L140
We are adding correct fee here:
https://github.com/blockworks-foundation/autobahn/blob/f9e8f8bf7cbdb886c23b72fb9ba67d700bd6f91f/lib/dex-raydium-cp/src/edge.rs#L260