Was this helpful?
The Fee AMM converts transaction fees between stablecoins when users pay in a different token than the validator prefers. This guide shows you how to add and remove liquidity to enable fee conversions.
The Fee AMM also supports multihop routing (TIP-1033): one fee conversion can route through two pools when a direct pair between the user's fee token and the validator's payout token doesn't exist or has insufficient liquidity. The pool mechanics for adding and removing liquidity are the same either way, but a single conversion may reserve and consume liquidity from two pools you provide to instead of one.
Browse current pool reserves and route availability in the FeeAMM explorer view.
Track fee swap activity to understand pool utilization and revenue.
You can rebalance pools by swapping validator tokens for accumulated user tokens at a fixed rate. Rebalancing restores validator token reserves and enables continued fee conversions. Learn more here.
Regularly check pool reserves to ensure sufficient liquidity for fee conversions. Low reserves can prevent transactions from being processed.
Add liquidity when:
userTokenAs an issuer, keep sufficient validator token reserves to handle expected transaction volume. Consider your anticipated fee conversion volume when determining reserve levels.
For new token pairs, provide the entire initial amount in the validator token. The pool naturally accumulates user tokens as fees are paid.
Focus liquidity on pools with:
Before adding liquidity, check the current pool reserves to understand the pool state.
import { } from 'wagmi/tempo'
import { } from 'viem'
const = '0x20c0000000000000000000000000000000000002' // BetaUSD
const = '0x20c0000000000000000000000000000000000001' // AlphaUSD
function () {
const { : } = ..
,
,
})
return (
<>
<>User token reserves: {(?. ?? 0n, 6)
<>Validator token reserves: {(?. ?? 0n, 6)
</>
)
}import { } from 'viem/chains'
import { , }
Add validator token to the pool to receive LP tokens representing your share. The first liquidity provider to a new pool must burn 1,000 units of liquidity. This costs approximately 0.002 USD and prevents attacks on pool reserves. Learn more in the Fee AMM specification.
import * as React from 'react'
import { } from 'wagmi/tempo'
import { } from 'viem'
const = '0x20c0000000000000000000000000000000000002' // BetaUSD
const = '0x20c0000000000000000000000000000000000001' // AlphaUSD
function () {
const [, ] = React.<any[]>([])
..useWatchFeeSwap({
,
,
() {
for (const of ) {
(() => [..., {
: (.args.amountIn, 6),
: (.args.amountOut, 6),
: (.args.amountIn * 30n / 10000n, 6),
}])
}
},
})
return (
<>
{.((, ) => (
< ={}>
Swap: {.amountIn} → {.amountOut} (LP revenue: {.revenue})
</>
))}
</>
)
}import { } from 'viem/chains'
import { , }
import { } from 'wagmi/tempo'
import { , } from 'viem'
import { } from 'wagmi'
const = '0x20c0000000000000000000000000000000000002' // BetaUSD
const = '0x20c0000000000000000000000000000000000001' // AlphaUSD
function () {
const { } = ()
const { : } = ..
,
,
})
const = ..()
return (
<>
<>User token reserves: {(?. ?? 0n, 6)
<>Validator token reserves: {(?. ?? 0n, 6)
< ="button" ={() => {
if (! || !) return
// Swap validator token for user token at 0.9985 rate
.({
,
,
: ., // Amount of user token to receive
: ,
})
}}>
Rebalance
</>
</>
)
}import { } from 'viem/chains'
import { , }
import { } from 'wagmi/tempo'
import { , } from 'viem'
import { } from 'wagmi'
const = '0x20c0000000000000000000000000000000000002' // BetaUSD
const = '0x20c0000000000000000000000000000000000001' // AlphaUSD
function () {
const { } = ()
const { : } = ..
,
,
})
const = ..()
return (
<>
<>User token reserves: {(?. ?? 0n, 6)
<>Validator token reserves: {(?. ?? 0n, 6)
< ="button" ={() => {
if (!) return
.({
: ,
: ,
: ('100', 6),
: ,
: ,
})
}}>
Add Liquidity
</>
</>
)
}import { } from 'viem/chains'
import { , }
import { } from 'wagmi/tempo'
import { , } from 'viem'
import { } from 'wagmi'
const = '0x20c0000000000000000000000000000000000002' // BetaUSD
const = '0x20c0000000000000000000000000000000000001' // AlphaUSD
function () {
const { } = ()
const { : } = ..
,
,
})
const { : } = ..
,
,
,
})
const = ..()
return (
<>
<>LP token balance: {( ?? 0n, 6)}</>
<>User token reserves: {(?. ?? 0n, 6)
<>Validator token reserves: {(?. ?? 0n, 6)
< ="button" ={() => {
if (!) return
.({
: ,
: ,
: ('100', 6),
: ,
: ,
})
}}>
Add Liquidity
</>
</>
)
}import { } from 'viem/chains'
import { , }
import { } from 'wagmi/tempo'
import { , } from 'viem'
import { } from 'wagmi'
const = '0x20c0000000000000000000000000000000000002' // BetaUSD
const = '0x20c0000000000000000000000000000000000001' // AlphaUSD
function () {
const { } = ()
const { : } = ..
,
,
})
const { : } = ..
,
,
,
})
const = ..()
const = ..()
return (
<>
<>LP token balance: {( ?? 0n, 6)}</>
<>User token reserves: {(?. ?? 0n, 6)
<>Validator token reserves: {(?. ?? 0n, 6)
< ="button" ={() => {
if (!) return
.({
: ,
: ,
: ('100', 6),
: ,
: ,
})
}}>
Add Liquidity
</>
< ="button" ={() => {
if (!) return
.({
,
,
: ('10', 6), // Burn 10 LP tokens
: ,
})
}}>
Remove Liquidity
</>
</>
)
}import { } from 'viem/chains'
import { , }