🔬
InterSwap Docs
  • Welcome
  • Protocol Level
    • Liquidity Pools
      • Weighted Pools
      • Stable Pools
      • Dynamic Weights
      • Gas Tokens Index(GTI)
    • Add/Remove Liquidity
      • New Pool Creation
      • Add Liquidity
      • Remove Liquidity
    • Swap
  • Integration Level
    • You Integrate us
    • We Integrate you
    • Cross-Chain Smart Routing
  • Supported networks
  • How To
    • Setting Up a Wallet
      • Creating a New Wallet
      • Adding Networks to Metamask
      • Connecting Your Wallet
    • Swap
    • Add Liquidity
    • Remove Liquidity
  • Security
    • Audits
    • Bug Bounty
    • Deployed Contracts
  • TOKENOMICS & GOVERNANCE
    • Allocation & Lockups
    • Token Value Accrual
    • Fees
    • Governance Model
    • Proposals & Voting
  • Information
    • FAQ
Powered by GitBook
On this page
  1. Protocol Level
  2. Add/Remove Liquidity

Add Liquidity

PreviousNew Pool CreationNextRemove Liquidity

Last updated 2 years ago

Adding liquidity occurs in one asset. Let's have an example of (all native assets of each supported chain) with the following weights:

Asset
Weight Points
Share

BNB

1000

0,1428 %

AVAX

1000

0,1428 %

ETH

1000

0,1428 %

MATIC

1000

0,1428 %

FTM

1000

0,1428 %

ETH (arbitrum)

1000

0,1428 %

ETH (optimism)

1000

0,1428 %

Total Weight = 1000 * 7 = 7000

To become a Liquidity Provider one needs to choose one of the assets to be used for deposit. In this example we choose ETH. 1. Liquidity Provider calls addLiquidity() method on ChildCommunicator.sol on Ethereum network.

2. It will lock a certain amount of ETH native tokens in Lock.sol contract on Ethereum network

3. And it sends a LayerZero (L0) message to MasterCommunicator.sol on Avalanche network (considering as masterchain) with the following payload:

{ 
    uint8 method, // ADD_LIQUIDITY_TYPE = 2
    uint256 poolId, // id of the pool, genesis pool = 0
    address token, // token for adding liquidity
    uint256 amount, // amount of token
    address from, // address of sender
    address to, // address of receiver, LP tokens will be sended who
    bytes memory data // arbitrary data for post-action integrations
}

Let's take that ETH weight was increased for 50 points. After adding liquidity we can see such a picture of pool structure:

Asset
Weight Points
Share

BNB

1000

0,1418 %

AVAX

1000

0,1418 %

ETH

1050

0,1489 %

MATIC

1000

0,1418 %

FTM

1000

0,1418 %

ETH (arbitrum)

1000

0,1418 %

ETH (optimism)

1000

0,1418 %

Total Weight = 7050

4. MasterCommunicator.sol will get a Pool contract using poolID, then call addLiquidity() function in the InterswapPool.sol contract, which will: - Increase the reserves of ETH in pool state - Increase the weight of the ETH in the pool using formula in - Mint LPs on to address on masterchain

Gas Token Index Pool
Dynamic Weights