Skip to main content

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​

  1. Approve token spending - Grant the contract permission to access your tokens
  2. Send swap transaction - Submit your swap request on-chain
  3. Contract validates trade - Smart contract verifies minimum swap value and applies dynamic fees
  4. Contract calculates output - Output amount is computed based on pool reserves and fee tier
  5. 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 – $600.20%
$60 – $1000.15%
$100 – $1,0000.09%
$1,000 – $10,0000.05%
$10,000+0.04%

How Fees Are Applied​

  1. The contract calculates the swap value in USD
  2. The correct fee tier is selected automatically
  3. Fee is deducted from the input amount
  4. 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:

  1. Connect Wallet - MetaMask, WalletConnect, etc.
  2. Select Tokens - Choose input and output tokens
  3. Enter Amount - Specify how much to swap
  4. Review Details - Check price, dynamic fees, slippage
  5. Confirm Swap - Approve transaction in wallet
  6. Done - Tokens arrive instantly

For developers, integrate swaps programmatically via smart contract calls or REST API.