🏗️Pair creator
The following page is dedicated for reviewing and explaining the source code of the pair creator smart contract which creates trading pairs.
Pair creator contract allows the users to create their own PSP22/AZERO pairs (Later on PSP22/PSP22 trading pairs).
Pair creator source code:
Imports:
We are importing "TradingPairAzeroRef" (Trading pair azero contract reference) in order to reference a new trading pair azero contract and to initialize it and we import "TradingPairPsp22Ref" (Trading pair PSP22 contract reference) which will be used later on.
Contract's struct:
This contract has no struct
Functions:
New (constuctor)
Constructor function used to initialize and deploy the pair creator, we dont pass any argument to the contract.
create_azero_trading_pair
Function to create a new instance of trading pair AZERO and deploy it to the network. We pass "azero_trading_pair_hash" as the hash of the compiled trading pair azero contract, "version" as a unique identifier (different ID to create a new contract, existing ID to reference an already deployed contract), "psp22_addrr" as the address of the PSP22 one wished to create the pair with, "fee" as the liquidity pool fee precentage, "panx_contract" as the PANX token address, we use it to check if the user is eligible for reduced LP fee and lastly "vault_address" as the address of the wallet to allocate trader's fee into.
create_psp22_trading_pair
Function to create a new instance of trading pair AZERO and deploy it to the network. We pass "psp22_trading_pair_hash" as the hash of the compiled trading pair azero contract, "version" as a unique identifier (different ID to create a new contract, existing ID to reference an already deployed contract), "psp22_token1_addrr" as the address of the first PSP22 one wished to create the pair with,"psp22_token2_addrr" as the address of the second PSP22 one wished to create pair with , "fee" as the liquidity pool fee precentage, "panx_contract" as the PANX token address, we use it to check if the user is eligible for reduced LP fee and lastly "vault_address" as the address of the wallet to allocate trader's fee into.
Last updated