LP Token Economics and Pool Shares | AMMs on XRPL | XRP Academy - XRP Academy
3 free lessons remaining this month

Free preview access resets monthly

Upgrade for Unlimited
Skip to main content
beginner50 min

LP Token Economics and Pool Shares

Learning Objectives

Explain how LP tokens are minted and burned during deposits and withdrawals

Calculate your pool share at any point and track changes over time

Understand how fees accrue to LP token holders without explicit distribution

Track LP token value versus underlying assets and initial deposit

Handle LP tokens in portfolio tracking and tax calculations

When you deposit to a pool, you don't "own" specific tokens in that pool. Instead, you own a proportional share of the entire pool, represented by LP tokens. As the pool grows from fees or shrinks from IL, your LP tokens represent a changing quantity of underlying assets.

Think of it like shares in a mutual fund. You don't own specific stocks—you own shares that represent a portion of the fund. If the fund grows, your shares are worth more. If it shrinks, they're worth less.

This lesson explains exactly how LP tokens work on XRPL, where they differ from Ethereum LP tokens, and how to track your position accurately.


When a pool is first created, the initial depositor sets the exchange rate between the two tokens by their deposit ratio.

INITIAL POOL CREATION

Scenario: Create XRP/RLUSD pool

First deposit:
├── 100,000 XRP
├── 250,000 RLUSD
├── Implied price: 250,000/100,000 = 2.50 RLUSD/XRP
└── Creates the initial k value

LP tokens minted:
├── Formula: √(x × y) = √(100,000 × 250,000)
├── = √25,000,000,000 = 158,113.88 LP tokens
├── All go to initial depositor
└── Total LP supply: 158,113.88

Why √(x × y)?
├── Geometric mean of the two quantities
├── Gives LP tokens "neutral" value
├── Not biased toward either token
├── Standard approach across AMMs
└── XRPL follows this convention
```

After the pool exists, new depositors must deposit at the current pool ratio to receive LP tokens.

SUBSEQUENT DEPOSIT MECHANICS

Current pool state:
├── 100,000 XRP
├── 250,000 RLUSD
├── LP supply: 158,113.88
├── k = 25,000,000,000
└── Price: 2.50 RLUSD/XRP

New depositor wants to add liquidity:
├── Must deposit at current ratio (2.50:1)
├── Deposits: 10,000 XRP + 25,000 RLUSD
├── This is 10% of each token in pool
└── Should receive 10% of LP supply

LP tokens minted:
├── Method 1: Proportional to contribution
├── Share of pool = min(Δx/x, Δy/y)
├── = min(10,000/100,000, 25,000/250,000)
├── = min(0.10, 0.10) = 10%
├── LP tokens = 158,113.88 × 0.10 = 15,811.39

After deposit:
├── Pool: 110,000 XRP + 275,000 RLUSD
├── LP supply: 158,113.88 + 15,811.39 = 173,925.27
├── Original depositor: 158,113.88 tokens = 90.9%
├── New depositor: 15,811.39 tokens = 9.1%
└── k = 110,000 × 275,000 = 30,250,000,000 (increased)
```

What happens if someone tries to deposit at the wrong ratio?

IMBALANCED DEPOSIT HANDLING

Pool state: 100,000 XRP, 250,000 RLUSD (ratio 2.5:1)

Attempted deposit: 10,000 XRP + 30,000 RLUSD (ratio 3:1)

Options:
├── Option 1: Reject (require exact ratio)
├── Option 2: Accept partial (use only what fits ratio)
├── Option 3: Swap excess, then deposit
└── Different protocols handle differently

XRPL approach:
├── Can accept single-sided or imbalanced deposits
├── Single-sided deposit is equivalent to swap + deposit
├── Results in some slippage/IL from the swap portion
├── Convenience feature but not optimal

Best practice:
├── Calculate correct ratio before depositing
├── Deposit in exact proportion
├── Avoid single-sided deposits for large amounts
├── Saves unnecessary slippage
└── Better price on your LP entry
```

LP TOKEN SUPPLY CALCULATION

General formula for LP tokens minted:
├── If depositing Δx and Δy to pool with x, y, L (LP supply)
├── LP minted = L × min(Δx/x, Δy/y)
└── Min function ensures you don't get credit for excess

Verification:
├── After deposit: New LP share = minted / (L + minted)
├── This should equal Δx / (x + Δx) ≈ Δy / (y + Δy)
└── Maintains proportional ownership

Why this matters:
├── LP tokens precisely track your pool share
├── No dilution possible (new deposits mint proportionally)
├── Fee accrual doesn't change LP supply
├── Clean accounting model
└── Easy to verify your ownership percentage
```


Unlike some yield products that distribute fees periodically, AMM fees accrue directly to the pool—making LP tokens worth more over time.

FEE ACCRUAL MECHANICS

When a trade occurs (0.3% fee example):
├── Trader swaps 10,000 RLUSD for XRP
├── Fee: 10,000 × 0.003 = 30 RLUSD
├── This fee stays in the pool
├── Pool has 30 more RLUSD than before
└── LP tokens now represent more assets

Important: LP supply doesn't change
├── No new LP tokens minted for fees
├── Existing LP tokens are worth more
├── Each LP token = (pool assets / LP supply)
├── As pool grows, token value grows
└── Compounding without explicit reinvestment

Example over time:
├── Day 1: Pool = $100,000, LP supply = 1,000
├── Each LP token = $100
├── Month of trading: Pool earns $3,000 in fees
├── Day 30: Pool = $103,000, LP supply = 1,000
├── Each LP token = $103
└── 3% return accrued automatically
```

COMPOUNDING EFFECT

Because fees stay in pool:
├── Larger pool attracts more volume (potentially)
├── More volume generates more fees
├── More fees increase pool size
├── Theoretical compounding effect

Reality check:
├── Volume doesn't automatically increase with pool size
├── Compounding depends on sustained volume
├── IL can offset fee gains
├── Not guaranteed exponential growth
└── More like savings account than compound interest

Tracking your accrued fees:
├── Method 1: (Current LP value) - (Deposit value adjusted for IL)
├── Method 2: Track pool fee accumulation × your share
├── Method 3: Use pool analytics tools
└── XRPL explorers may show fee metrics
```

XRPL LP TOKEN SIMPLICITY

On Ethereum (some protocols):
├── Fees may need to be "claimed"
├── Rewards tokens may be separate
├── Multiple transactions required
├── Gas costs to harvest
└── Adds complexity

On XRPL:
├── Fees automatically increase pool assets
├── Your LP tokens just become more valuable
├── No claiming, no harvesting
├── Withdraw whenever to realize gains
└── Much simpler model

Auction proceeds (XRPL-specific):
├── Continuous auction payments also accrue to pool
├── If auction is active, additional revenue to LPs
├── Works same way as trading fees
├── Increases pool assets without minting LP tokens
└── LP tokens become more valuable
```


When you withdraw, you burn LP tokens and receive your proportional share of pool assets.

WITHDRAWAL PROCESS

Pool state:
├── 95,000 XRP + 285,000 RLUSD
├── LP supply: 158,113.88
├── You hold: 15,811.39 LP tokens (10% of pool)

Withdrawal:
├── Burn: 15,811.39 LP tokens (your full position)
├── Receive: 10% of pool assets
├── = 9,500 XRP + 28,500 RLUSD

After withdrawal:
├── Pool: 85,500 XRP + 256,500 RLUSD
├── LP supply: 142,302.49
├── k = 85,500 × 256,500 = 21,930,750,000
└── Remaining LPs unaffected (same share of smaller pool)

Note: You receive current ratio, not deposit ratio
├── If price moved, your XRP/RLUSD ratio differs
├── This is where IL is "realized"
├── Withdrawal crystallizes gains/losses
└── Can't un-withdraw to reverse IL
```

PARTIAL WITHDRAWAL

You don't have to withdraw everything:
├── Can burn portion of LP tokens
├── Receive proportional assets
├── Remaining LP tokens keep working
└── Flexibility in position management

Example:
├── You hold 15,811.39 LP tokens (10% of pool)
├── Want to withdraw half your position
├── Burn: 7,905.70 LP tokens
├── Receive: 5% of pool assets
├── Remaining: 7,905.69 LP tokens (5% of pool)

When to partially withdraw:
├── Need some liquidity but want exposure
├── Rebalancing overall portfolio
├── Taking profits while staying invested
├── Managing tax implications
└── Dollar-cost-averaging out of position
```

SINGLE-SIDED WITHDRAWAL

Some protocols allow withdrawing only one asset:
├── Withdraw only XRP (not RLUSD)
├── Mathematically: Withdraw both, swap one internally
├── Results in additional slippage/IL
└── Convenience vs. efficiency trade-off

XRPL capability:
├── Can specify single-asset withdrawal
├── Useful if you only want one token
├── But: You pay effective swap fee + slippage
├── Usually better to withdraw both, swap externally
└── Check actual rates before deciding

Example:
├── Your 10% pool share = 9,500 XRP + 28,500 RLUSD
├── Single-sided XRP withdrawal:
├── Get less than 9,500 + (28,500/2.50) XRP
├── Because swap has slippage
├── Math same as doing swap in same pool
└── Just bundled into one transaction
```


LP TOKEN VALUE BREAKDOWN

LP token value = Pool assets / LP supply

Pool assets consist of:
├── Token A quantity × Token A price
├── Token B quantity × Token B price
├── = Total pool value in reference currency

Changes in LP token value come from:
├── + Fee accumulation (always positive)
├── + Auction proceeds (XRPL, always positive)
├── ± Price movements (can be + or -)
├── - Impermanent loss (always negative vs hold)
└── Net change = Sum of all factors

Important distinction:
├── LP token value can rise while you have IL
├── IL is underperformance vs holding
├── Not absolute loss
├── Track both for complete picture
└── Report value and IL separately
```

POSITION VALUATION

Step 1: Get current pool state
├── Token A balance: x
├── Token B balance: y
├── Total LP supply: L
├── Your LP tokens: l

Step 2: Calculate your share
├── Share = l / L
├── Your Token A = x × share
├── Your Token B = y × share

Step 3: Value in reference currency
├── Value = (Your A × Price of A) + (Your B × Price of B)
├── If B is stablecoin: Value = (Your A × Price of A) + Your B

Step 4: Compare to deposit
├── Initial deposit value
├── Current value
├── Absolute return = Current - Initial
├── Percentage return = (Current - Initial) / Initial

Step 5: Calculate IL (if desired)
├── What if you'd held instead?
├── Hold value = (Initial A × Current A price) + (Initial B × Current B price)
├── IL = Hold value - Current value
└── IL% = IL / Hold value
```

LP POSITION TRACKING TEMPLATE

Record at entry:
├── Date
├── Pool name
├── Token A deposited and price
├── Token B deposited and price
├── Total deposit value
├── LP tokens received
├── Pool share percentage
├── Pool total LP supply

Record periodically:
├── Date
├── Token A pool balance
├── Token B pool balance
├── Token A current price
├── Token B current price
├── Your LP tokens (should be unchanged unless you transacted)
├── Current position value
├── Cumulative fees earned (if trackable)
├── Current IL percentage

Record at exit:
├── Date
├── LP tokens burned
├── Token A received
├── Token B received
├── Exit value
├── Total return ($ and %)
├── Fees earned estimate
├── Realized IL
└── Net profit/loss
```


XRPL LP TOKEN IMPLEMENTATION

On XRPL, LP tokens are issued currencies:
├── Issued by the AMM account
├── Require trust line to hold
├── Same mechanics as other issued tokens
├── Can be transferred (theoretically)
└── Visible in standard XRPL tools

AMM Account:
├── Special account created for each pool
├── Holds pool assets
├── Issues LP tokens
├── Has unique account identifier
├── No private key (controlled by protocol)

Trust Line requirement:
├── Before receiving LP tokens
├── Must set trust line to AMM account
├── For the LP token currency
├── Same as any issued currency on XRPL
└── Usually handled automatically by wallets

LP Token identification:
├── Currency code based on pool assets
├── Issuer is the AMM account
├── Unique for each pool
├── Can look up on XRPL explorer
└── Standard issued currency format
```

CAN YOU TRANSFER LP TOKENS?

Technically yes:
├── LP tokens are issued currencies
├── Can set up payment to transfer
├── Recipient needs trust line
├── Standard XRPL payment mechanics
└── Functionally possible

Practical use cases:
├── Moving between your own wallets
├── OTC sale of LP position
├── Collateralizing LP position (theoretically)
├── Estate planning / transfers
└── Limited practical demand currently

Considerations:
├── Recipient inherits your entry basis (for IL calculation)
├── Tax implications of transfer
├── Liquidity of LP token market (likely zero)
├── Most people just withdraw instead
└── Transfer feature exists but rarely used
```

GETTING LP TOKEN DATA FROM XRPL

Using XRPL APIs:
├── amm_info: Get AMM pool details
├── account_lines: Get your LP token balance
├── ledger_entry: Get specific AMM state
└── Standard XRPL query methods

Key data points:
├── Pool balances (Token A, Token B)
├── LP token supply
├── Trading fee
├── Auction slot information
├── Your LP token balance
└── Calculate value from these

Example amm_info response:
├── "amount": { XRP balance }
├── "amount2": { Token B balance }
├── "lp_token": { Supply of LP tokens }
├── "trading_fee": 500 (0.5% in basis points)
├── "auction_slot": { Current auction details }
└── All needed for calculations
```


LP TAX CONSIDERATIONS (GENERAL GUIDANCE)

Disclaimer: Not tax advice. Consult professional.

Potential tax events:
├── Deposit to pool: May or may not be taxable
│ └── Depends on jurisdiction, "like-kind" interpretation
├── Fee accrual: Potentially ongoing income
│ └── Even though not "received" until withdrawal
├── Withdrawal: Likely taxable event
│ └── Gain/loss on position
└── Transfer of LP tokens: Potentially taxable

Complexity:
├── You receive different ratios than deposited
├── Is the rebalancing taxable?
├── When do fee earnings "occur"?
├── How to calculate cost basis?
└── Varies significantly by jurisdiction

Common approaches:
├── Treat as proportional ownership (mutual fund model)
├── Calculate gain on entire position at exit
├── Use FIFO or specific identification for cost basis
├── Track carefully, document methodology
└── Consistent approach is important
```

COST BASIS CALCULATION

Simple approach:
├── Initial deposit value = Cost basis
├── Exit value = Proceeds
├── Gain/loss = Proceeds - Cost basis
├── Ignores fee accrual timing
└── Easiest to implement

More complex approach:
├── Track fee accrual as income when earned
├── Add accrued fees to cost basis
├── Exit gain/loss is just asset value change
├── More accurate but complex
└── May be required in some jurisdictions

Example (simple):
├── Deposit: 1,000 XRP at $2.50 + 2,500 RLUSD = $5,000
├── Withdraw after 1 year: 850 XRP at $3.50 + 3,100 RLUSD
├── Exit value: 850 × $3.50 + $3,100 = $6,075
├── Gain: $6,075 - $5,000 = $1,075
├── Character: Likely capital gain
└── Duration: Long-term (held >1 year)
```

LP RECORD KEEPING

Essential records:
├── Deposit transaction hash/ID
├── Date and time of deposit
├── Amounts of each token deposited
├── Prices at time of deposit
├── LP tokens received
├── Pool share percentage
├── Withdrawal transaction hash/ID
├── Amounts received at withdrawal
├── Prices at withdrawal
└── Screenshot of pool state at key moments

Recommended additional records:
├── Periodic position valuations
├── Fee income estimates
├── IL calculations
├── Pool analytics data
├── Any transfers of LP tokens
└── Market price documentation

Tools:
├── XRPL explorers for transaction history
├── Portfolio trackers with DeFi support
├── Spreadsheet templates (manual tracking)
├── Crypto tax software (varying XRPL support)
└── Professional accountant for significant positions
```


LP tokens accurately represent pool share. The mathematical relationship between LP tokens and underlying assets is deterministic and verifiable.

Fee accrual increases LP token value. This is observable by comparing pool assets to LP supply over time.

Withdrawal returns exact proportional share. No slippage or loss at withdrawal (ignoring IL which is relative to holding).

⚠️ Tax treatment in most jurisdictions. LP tax guidance is evolving and varies by country.

⚠️ LP token transferability utility. Technically possible but market and use cases unclear.

⚠️ Best practices for accounting. Multiple valid approaches exist.

📌 Not tracking cost basis from deposit. Makes tax reporting difficult or impossible later.

📌 Confusing LP token value with profit. LP value can rise while you underperform holding.

📌 Ignoring fee accrual in return calculations. Fees are real return, must be counted.

LP tokens are a clean, mathematical representation of pool ownership. Understanding how they're minted, how they accrue value, and how to track them is essential for anyone providing liquidity. The mechanics are elegant; the accounting and tax implications require careful attention.


Assignment: Create a comprehensive LP token tracking spreadsheet for position management.

Requirements:

  • Pool identifier

  • Entry date

  • Token A deposited (amount and price)

  • Token B deposited (amount and price)

  • LP tokens received

  • Total LP supply at entry

  • Your initial pool share

  • Current Token A pool balance

  • Current Token B pool balance

  • Current Token A price

  • Current Token B price

  • Total current LP supply

  • Your current pool share (should be same if no additional deposits)

  • Your current Token A holding (pool balance × your share)

  • Your current Token B holding (pool balance × your share)

  • Current position value in USD

  • Initial deposit value in USD

  • Absolute return ($ and %)

  • Hold value (what you'd have if you didn't LP)

  • Impermanent loss ($ and %)

  • Implied fee income = Current value - (Entry value - IL)

  • Or: Difference between current and entry that isn't explained by IL

  • Fee income as percentage of entry value

  • Annualized fee return if position held >0 days

  • Position value at different Token A prices (0.5×, 0.75×, 1×, 1.25×, 1.5×, 2×)

  • IL at each price point

  • Required fee income to break even at each price

  • Overall profitability assessment

  • Calculation accuracy (30%)

  • Model completeness (25%)

  • Usability and clarity (20%)

  • Scenario analysis quality (25%)

Time Investment: 2-3 hours


Knowledge Check

Question 1 of 3

A pool has 50,000 XRP and 100,000 RLUSD with 70,711 LP tokens outstanding. You deposit 5,000 XRP and 10,000 RLUSD. How many LP tokens do you receive?

  • XRPL AMM documentation (xrpl.org)
  • XLS-30 specification
  • XRPL API reference for AMM queries
  • CPA-authored crypto LP guidance
  • Jurisdiction-specific tax guidance
  • DeFi accounting best practices
  • XRPL explorers with AMM support
  • Portfolio trackers
  • Spreadsheet templates for LP tracking

For Next Lesson:
Lesson 5 examines fee structures in depth—how different fee tiers affect trading volume, LP returns, and pool competitiveness. We'll analyze when higher or lower fees are optimal and how XRPL's configurable fees create strategic choices.


End of Lesson 4

Total words: ~5,200
Estimated completion time: 50 minutes reading + 2-3 hours for deliverable

Key Takeaways

1

LP tokens = proportional pool ownership.

Your LP tokens divided by total LP supply equals your share of every asset in the pool.

2

Fees accrue automatically.

No claiming needed—trading fees and auction proceeds increase pool assets, making each LP token worth more.

3

LP supply only changes with deposits/withdrawals.

Fee income doesn't mint new tokens; it just makes existing tokens more valuable.

4

Track entry carefully.

Record deposit amounts, prices, and LP tokens received. You'll need this for performance tracking and taxes.

5

Withdrawal returns current ratio.

You receive assets at current pool composition, not your original deposit ratio. This is when IL becomes "realized." ---