Liquidity pool smart contract with x*y=k
AMM
addInitialLiquidity
addLiquidity
addLiquiditySingle
configureLiqProvidersFees
configurePlatformFees
enableMintBurn
estimateAddLiquiditySingle
estimateAmountIn
estimateAmountOut
estimateRemoveLiquidity
estimateRemoveLiquiditySingle
getAnalyticsForLastEpochs
getFirstToken
getLiqProvidersFees
getPlatformFees
getPlatformFeesReceiver
getSecondToken
getStatus
init
isPaused
issueLpToken
pause
removeLiquidity
removeLiquiditySingle
swapTokensFixedInput
swapTokensFixedOutput
unpause
Deploy the smart contract
Prepare snippets shell file in interaction folder.
And run:
xxx.snippets.sh deploy
Check results in the explorer.
Issue LP token
xxx.snippets.sh issueLpToken
Check results in the explorer.
Enable LP token mint/burn
The smart contract needs to be able to mint and burn LP tokens.
To do so, run:
xxx.snippets.sh enableMintBurn
Check results in the explorer.
Configure fees
Configure fees for liquidity providers and platform fees.
xxx.snippets.sh configureLiqProvidersFees
xxx.snippets.sh configurePlatformFees
Note: 100 = 1%, 20 = 0.2%
Add initial liquidity
Adding initial liquidity will determine the initial exchange rate of tokens and the value of 1 LP token.
For example, adding 10,000 JEX and 1 wEGLD:
- initial exchange rate will be 1 wEGLD = 10,000 JEX (1 JEX = 0.0001 wEGLD)
- 1 LP token will be worth (1 wEGLD + 10,000 JEX)
xxx.snippets.sh addInitialLiquidity
Check results in the explorer.