This folder contains comprehensive scripts for managing pi network liquidity pools with MEME tokens on the Pi Testnet. note that this tokens are already created so its best you change the config.json files credentials and use the tokenization repo to create your own set of tokens
Check for existing liquidity pools across all accounts.
node checkPools.jsFeatures:
- ✅ Scans all configured accounts for pool shares
- ✅ Shows pool details (reserves, fees, total shares)
- ✅ Identifies pools involving MEME tokens
- ✅ Displays global pool statistics
Trade against the existing MEME-Test-π liquidity pool.
# Buy MEME tokens with Test-π
node poolTrade.js buy 10
# Sell MEME tokens for Test-π
node poolTrade.js sell 5Features:
- ✅ Buy MEME tokens using Test-π
- ✅ Sell MEME tokens for Test-π
- ✅ Real-time price checking
- ✅ Automatic slippage protection
- ✅ Balance updates after trades
Get comprehensive statistics and trading history for pools.
# Get full pool statistics
node poolStats.js
# Get trading analytics only
node poolStats.js analyticsFeatures:
- ✅ Current pool reserves and prices
- ✅ Total Value Locked (TVL) calculations
- ✅ Trading history and volume analytics
- ✅ Pool effects and operations history
- ✅ Participant share percentages
Add or remove liquidity from existing pools.
# Add liquidity (Test-π + MEME)
node poolLiquidity.js add 10 100
# Add liquidity using buyer account
node poolLiquidity.js add 5 50 buyer
# Remove liquidity (shares)
node poolLiquidity.js remove 50Features:
- ✅ Add liquidity with optimal ratio calculations
- ✅ Remove liquidity by burning shares
- ✅ Support for multiple accounts
- ✅ Automatic trustline establishment
- ✅ Balance validation and updates
Create new liquidity pools with custom parameters.
# Create predefined pools
node createPool.js predefined
# Create custom pool
node createPool.js custom MEME USPI 30 100 100
# Create high-fee pool
node createPool.js custom Test-π MEME 500 20 200 buyerFeatures:
- ✅ Create pools with custom fee structures
- ✅ Support for different asset pairs
- ✅ Predefined pool configurations
- ✅ Initial liquidity deposits
- ✅ Multiple account support
Pool ID: 2ec65214cd58c6322cb1937e8f1305592040ae30f0132b3d30832d2428b93fa8
Current Reserves:
- Test-π: 90.0000000
- MEME: 900.0000000
- Total Shares: 284.6049894
- Fee: 30 basis points (0.3%)
Current Price: 1 MEME = 0.1 Test-π
All scripts use the configuration from ../config.json:
- Network: Pi Testnet (
https://api.testnet.minepi.com) - Token: MEME (issued by
GCVLDIHANOSGP2WMQXIEOEXQ7BW3TUB3ZVOCFQGO3AMFSRTJS7S63YAJ) - Accounts: Issuer, Distributor, Buyer
# 1. Check existing pools
node checkPools.js
# 2. View pool statistics
node poolStats.js
# 3. Trade against pool
node poolTrade.js buy 5
# 4. Add more liquidity
node poolLiquidity.js add 20 200
# 5. Check updated statistics
node poolStats.js
# 6. Create additional pools
node createPool.js predefined# Check current prices before trading
node poolTrade.js buy 0 # Shows prices without trading
# Trade with specific amounts
node poolTrade.js buy 10
node poolTrade.js sell 5# Add liquidity maintaining current ratio
node poolLiquidity.js add 10 100
# Remove liquidity
node poolLiquidity.js remove 25
# Use different account
node poolLiquidity.js add 5 50 buyer- Account Balances: Ensure accounts have sufficient balances before operations
- Trustlines: Scripts automatically establish required trustlines
- Fees: All operations include network fees (typically 0.00001 XLM)
- Slippage: Pool trades may experience slippage based on pool size
- Minimum Balances: Accounts must maintain minimum balances for operations
- "tx_bad_auth" errors: Account authentication issues
- "op_no_trust" errors: Missing trustlines (auto-handled by scripts)
- Insufficient balance: Check account balances before operations
- Pool not found: Verify pool ID is correct
# Check account balances
node ../balances.js
# Verify pool exists
node checkPools.js
# Test account authentication
node ../testBuyerAccount.js- Standard Pool: 30 basis points (0.3%)
- High Fee Pool: 500 basis points (5%)
- Custom Pools: Configurable fees
- Earn fees from trades proportional to share ownership
- Automatic compound growth through pool operations
- Withdraw rewards by removing liquidity
- Larger trades have higher price impact
- Pool depth affects slippage
- Optimal trading sizes depend on pool reserves
Happy Pool Trading! 🏊♂️