🔄 Swap Tokens
Decentralized token swap on Stellar Testnet via Soroban AMM
💱 Swap
Rate-
Price Impact-
Swap Fee (0.3%)-
Min Received-
NetworkStellar Testnet
💧 Add Liquidity — Mint Position
Provide liquidity to a pool and receive an NFT position (Uniswap V4 PositionManager).
/
Pool-
Current Price-
Tick Range-
Liquidity-
Share of Pool-
Fee Tier-
🖼️ Your LP Positions (NFTs)
🔍 Fetch V4 Positions
Query the V4 PositionManager subgraph for on-chain positions. Decodes packed position info, fetches poolKey & liquidity from contract.
🧪 Test Swap — Full Verification
Run automated tests to verify swap calculations, balance changes, edge cases, and security guards.
💱 Swap Calculation Tests
Test 1: XLM → OLIGHFT
Swap 1,000 XLM • Expected: ~239 OLIGHFT (rate 1 XLM = 0.24 OLIGHFT)
Test 2: USDC → OLIGHFT
Swap 500 USDC • Expected: ~994 OLIGHFT (rate 1 USDC = 2.0 OLIGHFT)
Test 3: OLIGHFT → USDC
Swap 2,000 OLIGHFT • Expected: ~977 USDC (rate 1 OLIGHFT = $0.50)
Test 4: wETH → OLIGHFT
Swap 0.5 wETH • Expected: ~3,174 OLIGHFT (rate 1 wETH = 6,400 OLIGHFT)
Test 5: wBTC → OLIGHFT
Swap 0.01 wBTC • Expected: ~1,346 OLIGHFT (rate 1 wBTC = 136,000 OLIGHFT)
🔬 Integration & Security Tests
🚀 Full executeSwap() Flow
Swap 10 XLM → USDC: verify balance deduction + addition + tx record
pending
🔄 cw_balances Sync
localStorage matches memory after swap
pending
⛔ Same Token Rejected
XLM → XLM must be blocked
pending
⛔ Zero Amount Rejected
0 XLM swap must be blocked
pending
🛡️ Overdraft Guard
Swap 999999 XLM must be blocked
pending
📏 Fee Accuracy
0.3% fee on 1000 XLM = exactly 0.36 USD
pending
📊 Slippage Calculation
Min received = output * (1 - slippage%)
pending
🔀 Reverse Swap
OLIGHFT → XLM: verify output > 0
pending
📝 Swap TX Record
swap_txs has correct entry with 64-char hash
pending
💶 EURC → OLIGHFT Cross
Cross-pair: 100 EURC → OLIGHFT at correct rate
pending
OLIGHFT SMART COIN DEX • Stellar Testnet • AMM x*y=k • v1.0.0