Skip to main content

Pools & Swaps

warning

The SKNK protocol does not support non-standard ERC20 tokens (i.e. deflationary & fee-on-transfer tokens).
Use at your own risk.


SKNK Liquidity Pools are automated market maker (AMM) contracts similar to those used extensively within DeFi platforms. Traders swap against pooled reserves rather than matching with a counterparty, and prices adjust automatically based on the pool's reserve ratio. In constant product AMMs, the product of reserves must satisfy (x * y = k), so buying one asset pushes its price up while selling pushes it down. Liquidity providers (LPs) deposit both assets to begin earning fees via games and swaps.

What's the same

  • Pools can be deployed using the SLPFactory contract.
  • Pool AMM logic is based on the constant product formula of Uniswap V2 (x * y = k).
  • Each pair consists of two ERC20 tokens.
  • Price of a pair is determined by the ratio of token reserves.
  • Currently, a 0.3% fee is applied to all trades.
  • LP positions are ERC20 tokens which track pro-rata ownership of the pair balance.

What's different

Active & Inactive funds

An SLP pair has 5 distinct pots in which funds are tracked to ensure proper liability tracking for LPs.

  • Reserves: Active funds available for swaps and games.
  • Stake: Tracks player stakes while tickets are resolved.
  • Ringfenced: Funds sidelined to pay out winning tickets against the pair.
  • Pending: Queues funds to return to reserves once full settlement is achieved.
  • Exit: Outgoing funds for exiting LPs.
info

Only reserves are considered active and used in price calculations and swap logic.

Privileged Hub Access

The SLPHub contract which orchestrates tickets and settlement against the pairs is required to have access to the ticket_ hooks within the pair contract. These functions allow for the pair contracts to move funds between the internal pots and manage pending allocations for tickets.

Two-Step Withdrawals

A withdrawal from a SLP pair can be broken down into 2 stages.

1. Active Withdrawal

  • Funds owned from the reserves are paid directly to the LP.
  • LP tokens are burned and an exit request is created on the pair.
  • Exit request tracks tickets currently open which the underlying funds are currently being used against.

2. Inactive Withdrawal

  • Once pending tickets against the exit have been processed, the withdrawal can be finalised.
  • Depending on the outcome of these tickets, a final balance will be available to withdraw (no LP tokens required).

note

The Liability Tracking guide has more information on this.