Pangea Swap
English
English
  • Introduction
  • Protocol Overview
  • Disclaimer
    • Risk & Security
    • Terms of Use
  • Updates
  • Audit
  • concentrated liquidity
    • Weakness of V2 DEXs: Low Liquidity utilization rate
    • Solution by V3 DEXs: Concentrated Liquidity
    • Concentrated Liquidity FAQ
  • Connectivity
    • Customizable Pool
  • Governance
    • STONE
      • STONE Distribution Plan
      • Tokenomics (Before)
      • Tokenomics (After)
      • Growth Fund History
    • Contribution Point NFT
  • Guide
    • SWAP
    • Add Liquidity
      • Add liquidity (Preset)
      • Add liquidity (Custom)
    • STONE Staking
    • Revenue Sharing
    • FAQ
  • Growth Partnership
    • Swapscanner
    • ISKRA
  • event
    • Promotion
  • Developers
    • Concept Overview
      • Problem : Lazy Liquidity
      • Liquidity Concentration
      • Position & Risk
      • Price Tick
      • Position NFT
      • Fees
      • Flash Loan
    • Contracts
      • Core Contracts
        • MasterDeployer
        • ConcentratedLiquidityPoolFactory
        • ConcentratedLiquidityPool
        • ConcentratedLiquidityPoolManager
        • PoolRouter
        • PoolLogger
        • AirdropDistributor
      • Contribution Point NFT
      • Price Oracle
    • Interacting with the Protocol
      • Setting up Local Test Environment
        • Test env. commands
      • Getting Pangea Pool Info
      • Creating Pangea Pool
      • Mint Position (add liquidity)
      • Burn Position (remove liquidity)
      • Claim Fee
      • Swap
  • Community
    • Website
    • Discord
    • Telegram
    • Medium
    • Twitter
    • Opensea - Position NFT
    • Opensea - CP NFT
    • GitHub
    • Testnet
    • E-mail
Powered by GitBook
On this page
  1. Developers
  2. Interacting with the Protocol

Getting Pangea Pool Info

Getting every deployed pool info

/// MasterDeployer address
const masterDeployerAddress = "0x..."; 

///Getting every pool address

async function readAllPools() {  
  /// MasterDeployer__factory is a typechain object under types/
  /// You can interact via typechain and ethers.js in JavaScript env.

  const masterDeployer = await MasterDeployer__factory.connect(
    masterDeployerAddress, provider);
  
  /// number of deployed pools in Pangea
  const totalPools = (await masterDeployer.totalPoolsCount()).toNumber();

  for (let i = 0; i < totalPools; i++) {
    /// Getting pool address
    const poolAddress = await masterDeployer.getPoolAddress(i);
    const pool = await ConcentratedLiquidityPool__factory.connect(
      poolAddress, provider);
  
    /// Token0 address
    const token0 = await pool.token0();
    /// Token1 address
    const token1 = await pool.token1();
    /// Swap Fee Rate
    const swapFee = (await pool.swapFee()) / 1e6;
    /// Pool Price. price = √(token1/token0) * 2 ^ 96. Price changes when swap occurs
    const price = (await pool.price()).toString();
    /// Pool token reserve
    const reserves = await pool.getReserves();
  
    console.log(`${poolAddress} | ${token0} | ${token1} | ${swapFee} | ${price} | ${reserves._reserve0} | ${reserves._reserve1}`);
  }
}
PreviousTest env. commandsNextCreating Pangea Pool

Last updated 2 years ago