Smart Contracts

Agora Stable Swap is a collection of smart contracts, consisting of a singleton factory and many pairs. These have been audited, providing safety guarantees for all participants interacting with the system. All contracts within the Agora’s Stable swap ecosystem are deployed following an upgradeable proxy pattern.


Factory – AgoraStableSwapFactory

The Factory is the deployment contract:

  • Deploys new pairs to deterministic CREATE3 addresses derived from token0 and token1
  • Holds the canonical implementation address (stableSwapImplementation) used by every pair proxy.
  • View helpers & data registry

Only wallets with the APPROVED_DEPLOYER role can create new pairs; the Factory owner can curate that list.


Pair – AgoraStableSwapPair

Each Pair proxy represents a dual-token pool (e.g., AUSD / USDT) and implements the familiar Uniswap-V2 swap surface, plus oracle-driven pricing:

  • Core functionality
  • Oracle helpers
  • Role-based management
    • Fee Setter adjusts per-side purchase fees within bounds.
    • Price Setter pushes base price and interest rate.
    • Token Remover collects fees or withdraws idle inventory to the treasury.
    • Pauser can halt swaps in an emergency.
    • All role membership is controlled by the Admin role.
  • Upgradeable storage follows the EIP-1967 + ERC-7201 unstructured pattern used across Agora contracts.

Source code and ABIs for both the Factory and Pairs live in the contracts/ directory of this repository.