Comment on page
This smart contract is used for creating and deploying dex vault’s liquidity pool token and it’s wallets so it can change its state from pending.
Smart contract responsible for creating and deploying dex vault’s liquidity pool token and it’s wallets so it can change its state from pending.
Derives following classes and interfaces: ITokenRootDeployedCallback, ITransferTokenRootOwnershipCallbac
constructor(address token_factory_, uint128 value_, address send_gas_to_) public onlyVault
Based on parameters such as token factory address, deploy value and
send_gas_toaddress fills the right and left root symbol data and deploys pending dex vault’s liquidity pool token smart contract.
function terminate() public view
Terminates deploy of the pending liquidity pool token and calls _onLiquidityTokenNotDeployed function
function onSymbol(string symbol) public onlyExpectedToken
Receives token symbol as a parameter, decrements pending messages and whether the sender is right or left root fills the root data with received symbol value and calls createLpTokenAndWallets. If the sender is not right/left root calls
function onTokenRootDeployed(uint32 /*answer_id*/, address token_root) override public onlyTokenFactory
Receives answerId and token root address through parameters, fills liquidity pool token root with token root value, deploys empty wallet using the token root and vault address, fills the callback params and transfers ownership to the new liquidity pair address calling the transferOwnership function from the
function onTransferTokenRootOwnership( address oldOwner, address newOwner, address, TvmCell) external override
Gets old owner address and new owner address through parameters and if the old owner is address of the
DexVaultLpTokenPendingsmart contract and the new owner is dex pair address then token root ownership is delegated to the new owner address and deployed token root data (token root wallets, reserved initial balance, pair data configured…) is configured by calling DexVault’s
onLiquidityTokenDeployedif not calls
function createLpTokenAndWallets() private
lpTokenSymbolgets the name of the symbol based on the right and left root symbol, deploys lp token calling
deployLpToken, deploys wallets for left and right root and their vaults by calling
function deployLpToken(bytes symbol, uint8 decimals) private
Takes symbol and number of decimals and deploys token calling createToken function of the
TokenFactorybased on the function (
function deployEmptyWallet(address token_root, address wallet_owner) private
wallet_owneraddresses as parameters and based on those addresses deploys wallet calling TokenRoot’s
function lpTokenSymbol(string left_symbol, string right_symbol) private view returns (string)
Creates liquidity pool token symbol based on the name of the left and right roots’ symbols and returns name of the lp token symbol.