UnitFlow LogoUnitFlow Docs

How It Works

UnitFlow is a client-side application that communicates directly with smart contracts on Arc Testnet. There is no centralized backend for trading; all smart contracts operation, all swaps, liquidity operations, and token deployments are on-chain transactions signed by the user's wallet.

System Architecture

The platform is composed of three layers:

  1. Landing Page — handles community onboarding, Discord/X OAuth verification, NFT minting, and the ranking system.
  2. DEX Application — the main trading interface. Handles swaps, liquidity, pools, bridge, token factory, analytics and more!
  3. Smart Contracts — deployed on Arc Testnet. Include the AMM factory, routers, NFT contract, token factory, CCTP bridge contracts, etc

User Journey

1

Visit the Landing Page

Users land on unitflow.finance and learn about the project.

2

Complete Onboarding

Verify Discord membership and follow @unitflowFinance on X via OAuth2 flows.

3

Mint Genesis NFT

After both verifications, mint the Genesis Pass NFT on Arc Testnet.

4

Earn Activity NFTs

Post on X mentioning UnitFlow, verify the post, and mint Activity NFTs daily.

5

Access the DEX

Connect wallet to the DEX. The NFT gating system checks for ≥1 Genesis NFT and ≥60 Activity NFTs.

6

Trade & Provide Liquidity

Swap tokens, add liquidity, explore pools, bridge USDC, or deploy tokens.

Swap Flow

When a user initiates a swap:

  1. The UI checks whether a direct pool exists between the two tokens.
  2. If no direct pool exists, the multi-hop router builds a graph of all available pairs and finds the best route (up to 3 hops).
  3. The estimated output amount is fetched from the on-chain quoter contract.
  4. The user approves the input token (ERC-20 approval) if not already approved.
  5. The swap transaction is submitted to the Swap Router contract.
  6. The UI waits for the transaction receipt and shows the result.

Liquidity Flow

  1. User selects two tokens and enters amounts.
  2. If the pool does not exist, it must be created first via the Factory contract.
  3. The UI calculates the optimal ratio based on current pool reserves.
  4. Both tokens are approved, then the Liquidity Router mints LP tokens to the user.
  5. LP token balances are tracked and displayed in the "My Pools" view.

Data Sources

Pool data, TVL, and volume statistics are fetched from multiple sources depending on the protocol version:

VersionData Source
v2.5Envio indexer / HyperRPC / direct RPC calls
V3GraphQL subgraph
V4GraphQL subgraph
💡
Pool data is cached globally in a React context (PoolDataContext) to avoid redundant RPC calls across components.