Ordiswap
  • The Ordiswap Protocol
  • Protocol Concepts
    • osAMM Overview
      • Modular Implementation
    • Off-Chain Balance States
    • osAPI
  • How to use Ordiswap
    • Swapping BRC-20 Tokens
    • Swapping Rune Tokens
    • Liquidity Provision
    • Fee Structure
    • Asset Custody
    • Ordiswap Cross-Chain Swaps
    • Native L1 Pools
    • Protocol Liquidity Vault
  • ordiswap off-chain engine
    • Protocol Structure
      • Module Functions & Pool Specific Logic
      • Database Initialization and Mempool Integration
      • Token Indexing & Retrieval
      • Cross-Chain Swap API Handling
      • Cross-Chain Swap Logic
      • Liquidity Pool Management
      • Bitcoin Transaction Creation Functions
    • Roadmap of Research
    • Combatting Centralization
    • Audit Review
  • Ordiswap Token
    • ORDS Token
      • veORDS
      • Gauges
      • Bribe System
  • Roadmap
    • Roadmap
  • Community
    • Links
Powered by GitBook
On this page
  1. ordiswap off-chain engine
  2. Protocol Structure

Liquidity Pool Management

Code Analysis: Liquidity Pool Management

The provided summary is relevent for managing liquidity pools, including operations such as creating pools, deploying and minting LP (Liquidity Provider) tokens, and confirming the creation of a pool.


Constants:

SWAP_VAULT, BALANCE_TYPE_VAULT, BTC_TOKEN, and FIND_OPTIONS are imported from the Ordiswap configuration file.


Wallet Operations:

Wallet operations are handled by functions getWalletBalance, getTransactionList, and createWalletAddress from the lib/ord-wallet.js module.


Pool Retrieval Functions:

Functions getPoolByAddress, getPoolByLpToken, getPoolByTokenPair, and getPoolList retrieve pool information from DB based on different criteria.


Pool Creation Steps:

createPoolAddress: Creates a wallet address for a new liquidity pool.

deployLpToken: Deploys a new LP token if it doesn't exist already.

mintLpToken: Mints the LP token if it has not been minted before.

confirmCreatePool: Confirms the creation of a new liquidity pool and updates collections accordingly.


Error Handling:

Ordiswap implements error handling for various scenarios, logging errors for further analysis.


Pool Creation Process Flow:

Users initiate the creation of a new pool.

A new pool address is created (createPoolAddress).

An LP token is deployed (deployLpToken).

The LP token is minted (mintLpToken).

The pool creation is confirmed, and relevant collections are updated.


Last updated 1 year ago