Swap and LP

CubixSwap provides users with a seamless and decentralized trading experience through its Swap and Liquidity Providing features. This documentation aims to guide users through the mechanics of swaps and liquidity provision on the platform.
Initiating a Swap
Users can swap one cryptocurrency for another on CubixSwap using the Swap feature. The formula for calculating the output amount (O
) after a swap is initiated is as follows:
Where:
is the output amount.
is the input amount.
is the reserve of the output token.
is the fee percentage (dynamic and subject to adjustments)
Slippage Protection
To protect users from excessive slippage, CubixSwap implements a slippage tolerance parameter. The actual output amount may vary within the specified slippage range, ensuring fair and transparent trading.
Adding Liquidity
Users can provide liquidity to CubixSwap pools by adding an equivalent value of both tokens to a liquidity pool. The formula for calculating the number of liquidity pool tokens received (L
) is as follows:
Where:
is the number of liquidity pool tokens
is the input amount of the first token
is the reserve of the first token
is the reserve of the second token
Removing Liquidity
When removing liquidity, users receive a proportionate share of the total liquidity pool. The formula for calculating the share of the liquidity pool tokens to be removed (S
) is as follows:
Where:
is the share of liquidity pool tokens to be removed
is the reserve of the first token
is the reserve of the second token
is the number of liquidity pool tokens
CubixSwap charges a fixed fee on swaps, a percentage of which contributes to the liquidity providers.
Last updated