Meshswap
  • Introduction
  • What is MESH?
    • MESH Allocation
    • MESH Tokenomics
    • MESH Redistribution Policy
  • Get started
    • Create a Wallet
    • Add Polygon Network & Tokens
    • How to move your assets to wallet
      • Transferring MATIC
        • [Binance, Kucoin, Gate.io] How to move MATIC from CEX to Wallet 1
        • [Coinbase, OKX, Upbit, Bithumb, Coinone] How to move MATIC to Wallet 2
        • [Polygon Bridge] How to move MATIC to Wallet 3
      • How to get WETH, MATIC, USDC, USDT, DAI
      • How to get oETH, oMATIC, oUSDC, oUSDT, oDAI
      • XRP: The Quickest and easiest way to transfer your asset
      • How to get oXRP in your KuCoin wallet and deposit in Meshswap
      • How to transfer BUSD from Binance to the Polygon network
      • Transferring TON
        • Create Wallets supporting TON network
        • How to transfer TON from wallet to Meshswap
        • How to transfer TON from Huobi to the Polygon network
  • More
    • Risk & Security
    • Privacy Policy
    • Contract & Audit
    • Contact & Team
    • Events
      • Early-bird MESH Airdrop Events(End)
      • Meshswap x Kucoin Partnership Giveaway Event(End)
  • PRODUCTS
    • Swaps
    • Lend
      • How to deposit your assets on Lending pools
      • The Detailed Policy of Lending Pool Deposit
    • Yield Farm
      • How to deposit your assets on Yield Farming pools
    • Leveraged Yield Farm
      • How to deposit your assets on Leveraged Yield Farming pools
      • Detailed Policy of Leverage Farm
    • Long/Short Margin Trading
      • Open and Close Long/Short Positions
        • Open Long Positions
        • Open Short Positions
        • Close Long Positions
        • Close Short Positions
      • Long/Short Margin Trading Details Policy
    • Interest rate
    • Stake
      • How to stake MESH
      • Staking Policy
    • Pool Voting
      • How to participate in Pool Voting with vMESH
    • Ecopot
    • Drops
    • Pool Airdrop
    • Governance
      • Governance Voting Policy
  • DEVELOPERS
    • Contract
      • MESH
      • MESHswapRouter
      • MESHSwapView
      • Factory
      • Exchange
      • PoolVoting
      • VotingMESH
      • Treasury
      • Distribution
      • Governor
      • SinglePool
      • SinglePool Factory
      • PlusPool
      • PlusPool Factory
      • EcoPotVoting
      • EcoPot
    • Airdrop
      • Set Airdrop Operator
      • Start Airdop
    • EcoPot
      • Set EcoPot
      • Start EcoPot
  • Meshswap Protocol
  • Orbit Bridge
Powered by GitBook
On this page
  • Address
  • Events, Read-Only Functions, and State-Changing Functions
  1. DEVELOPERS
  2. Contract

Factory

PreviousMESHSwapViewNextExchange

Last updated 2 years ago

The Factory smart contract oversees the full functionality of token pair registration and transactions in MESHswap.

Address

  • Polygon Mainnet :

Events, Read-Only Functions, and State-Changing Functions

Events

ChangeCreateFee

event ChangeCreateFee(uint _createFee);
  • An event to change the Pool Contract Creation Fee when adding a new liquidity pool pair

CreatePool

event CreatePool(address token0, uint amount0, address token1, uint amount1, uint fee, address exchange, uint exid);
  • Event to create new liquidity pool

  • parameters

    • token0 : token0 address in pair

    • amount0 : token0 amount in pool

    • token1 : token1 address in pair

    • amount1 : token1 amount in pool

    • fee : pool fee rate

    • exchange : exchange contract address of this pool

    • exid : exchange id

Read-Only Functions

WETH

  • WETH contract address.

mesh

  • MESH contract address

allPairsLength

  • Returns the total number of pairs created through the factory so far.

getPoolCount

  • Returns the total number of pairs created through the factory so far.

createFee

  • The amount of MESH that must be paired to create a new liquidity pool pair

owner

  • Factory Contract Address

nextOwner

  • The next Governance Contract Address set in advance.

pools

  • List of liquidity pool pairings

  • Each item saves the smart contract address of the liquidity pool

poolExist

  • Returns if the contract for the given liquidiy pool pair exists

tokenToPool

  • The contract address corresponding to the token0, token1 pair

  • When the addresses of token0 and token1 are inputted, this returns the contract address of the corresponding pairing

  • Returns the same contract address regardless of the order of the liquidity pool pairing tokens:

    tokenToPool[token0][token1] == tokenToPool[token1][token0]

allPairs

function allPairs(uint) external view returns (address pair);
  • Returns the address of the nth pair (0-indexed) created through the factory

getPair

function getPair(address token0, address token1) external view returns (address pair);
  • Returns the address of the pair for token0 and token1, if it has been created, else address(0) (0x0000000000000000000000000000000000000000).

getPoolAddress

function getPoolAddress(uint idx) public view returns (address)
  • Returns the address of the nth pair (0-indexed) created through the factory

State-Changing Functions

createETHPool

function createETHPool(address token, uint amount, uint fee) public payable 
  • A method called to add a liquidity pair with one side as MATIC

  • The wallet that calls this must have MESH greater than or equal to createFee

  • Token for when the WMATIC / ERC-20 pair to be registered has never been registered before

  • Parameters

    • token : ERC-20 token address to add liquidity

    • amount : the amount of tokens (ERC-20) to be provided for the initial liquidity

    • fee : Sets the initial fee value for liquidity pairs

      • A value between 0 and 100

      • Meaning: 0 -> 0%, 100 -> 1%

    • msg.value : MATIC quantity to initially supply liquidity

      • Delivers the transaction value without specifying otherwise

createTokenPool

 function createTokenPool(address token0, uint amount0, address token1, uint amount1, uint fee) public
  • Method called to add liquidity pair in case of ERC-20 token pair

  • The wallet calling the MESH above createFee must have it.

  • parameter

    • token0 : The address of the first token

    • amount0 : The quantity of the first token that supplies the initial liquidity

    • token1 : The address of the second token

    • amount1 : The quantity of the second token that supplies the initial liquidity

    • fee : Sets the initial fee value for liquidity pairs

0x9f3044f7f9fc8bc9ed615d54845b4577b833282d