Swaps
Swaps are executed directly against liquidity pools without order books or intermediaries.
All swap rules, including fees and minimum trade size, are enforced on-chain by the smart contract to guarantee fairness and prevent manipulation.
How Swaps Work
Step-by-Step Process
- Approve token spending - Grant the contract permission to access your tokens
- Send swap transaction - Submit your swap request on-chain
- Contract validates trade - Smart contract verifies minimum swap value and applies dynamic fees
- Contract calculates output - Output amount is computed based on pool reserves and fee tier
- Tokens exchanged - Atomic swap executes instantly on-chain
All swaps happen in a single transaction with guaranteed execution or revert.
Swap Properties
All swaps are:
✅ Non-custodial - You never lose custody of your assets
✅ Transparent - All pricing and fee logic is enforced on-chain
✅ Immutable - Contract logic cannot be changed after deployment
✅ Gas-efficient - Optimized for low transaction costs
✅ Instant - Settle in a single blockchain transaction
✅ Bot-resistant - Minimum swap and dynamic fees validated directly in the contract
Pricing Calculation
Price is determined by the constant product formula:
amountOut = (amountIn × reserveOut) / (reserveIn + amountIn)
Example:
Pool has 1000 Token A and 10 Token B:
- You swap 100 Token A
- You receive: (100 × 10) / (1000 + 100) = 0.909 Token B
- New reserves: 1100 Token A, 9.091 Token B
The formula is applied after deducting the dynamic trading fee.
Minimum Swap Rule
To prevent spam transactions and ensure economic efficiency, GO Swap enforces a minimum swap value directly in the smart contract.
- Swaps below the minimum threshold will revert
- This rule cannot be bypassed by bots or direct contract calls
- The minimum value is calculated using on-chain price references
This guarantees fair usage of liquidity pools and protects the protocol from micro-trade abuse.
Slippage
Slippage is the difference between expected and executed price.
Causes:
- Large trades relative to pool size
- Other trades executing before yours
- Network congestion delaying execution
Protection:
Set a maximum slippage tolerance:
- 0.5% - Low slippage, may fail in volatile markets
- 1-3% - Balanced for most trades
- 5%+ - High tolerance, useful for illiquid pairs
If the price moves beyond your tolerance, the transaction reverts to protect you.
Dynamic Trading Fees
GO Swap uses a progressive fee model enforced on-chain, meaning the fee is automatically calculated by the smart contract based on the USD value of each swap.
This prevents fee bypassing by bots and ensures fair contribution from all traders.
Fee Tiers
| Swap Value (USD) | Fee |
|---|---|
| $10 – $60 | 0.20% |
| $60 – $100 | 0.15% |
| $100 – $1,000 | 0.09% |
| $1,000 – $10,000 | 0.05% |
| $10,000+ | 0.04% |
How Fees Are Applied
- The contract calculates the swap value in USD
- The correct fee tier is selected automatically
- Fee is deducted from the input amount
- Remaining tokens are used in the swap calculation
This ensures:
- Fair pricing for all users
- Higher fees for micro trades
- Lower fees for large volume traders
- Full on-chain transparency
Fee Distribution
Collected fees are split between:
- Liquidity providers (LP rewards)
- Protocol treasury (ecosystem growth)
The distribution ratio is defined in the core protocol and applied automatically during each swap.
Advanced Features
Multi-hop Swaps (Future)
Route through multiple pools for better prices:
Token A → Token B → Token C
The router automatically finds the optimal path for your swap.
Deadline Protection
Set a deadline for your swap:
- If execution takes longer than deadline, transaction reverts
- Protects against stuck transactions in mempool
- Prevents execution at stale prices
Minimum Output
Specify minimum output amount:
- Transaction reverts if output is less than minimum
- Protects against excessive slippage
- Useful in volatile market conditions
Anti-Bot and Fair Usage Model
To maintain a healthy ecosystem:
- Minimum swap enforced on-chain
- Progressive fee tiers validated by the contract
- No reliance on frontend restrictions
- Direct contract calls must obey the same rules
This design ensures that:
- Bots cannot bypass fee logic
- All users are treated equally
- Economic sustainability of the protocol is preserved
Swap Interface
Connect your wallet and swap directly through the GO Swap interface:
- Connect Wallet - MetaMask, WalletConnect, etc.
- Select Tokens - Choose input and output tokens
- Enter Amount - Specify how much to swap
- Review Details - Check price, dynamic fees, slippage
- Confirm Swap - Approve transaction in wallet
- Done - Tokens arrive instantly
For developers, integrate swaps programmatically via smart contract calls or REST API.