Skip to content

Pools ​

A commitment pool is a SwapPool. It holds vouchers and swaps one for another at the price its quoter gives, minus fees. It issues no shares.

What makes up a pool ​

A pool points at four contracts that do the work, plus a shared protocol fee controller.

ContractPool settingWhat it does
TokenUniqueSymbolIndextokenRegistryLists the vouchers the pool accepts, one per symbol. Deposits and swaps of other tokens revert.
LimitertokenLimiterCaps the pool's balance of each voucher. A deposit or swap that would go over the cap reverts.
FeePolicyfeePolicyDefault fee and per-pair fees, in parts per million (PPM).
QuoterquoterPrices one voucher against another. See Quoters.
ProtocolFeeControllerprotocolFeeControllerProtocol fee rate and recipient. Shared by every CLC pool, and set only at initialization.

The pool also has a feeAddress, which receives collected fees, and feesDecoupled, which reserves accrued fees so swaps and liquidity withdrawals cannot spend them.

Create a pool ​

CLC deploys a new pool as ERC-1967 proxies, all owned by the pool owner, in this order:

  1. TokenUniqueSymbolIndex
  2. Limiter
  3. FeePolicy, with the default fee
  4. RelativeQuoter or OracleQuoter. A pool with equal-value pricing uses the shared DecimalQuoter instead.
  5. SwapPool, initialized with the addresses above

The CLC app asks for a name, symbol, pricing type, default fee, and fee address. It uses 6 decimals.

Add a voucher ​

The owner sends one batch:

  1. registry.add(voucher)
  2. limiter.setLimitFor(voucher, pool, cap). The cap is the most of that voucher the pool will hold. The CLC app calls it the credit limit.
  3. Set the price on the quoter: setPriceIndexValue(voucher, index) on a RelativeQuoter, or setOracle(voucher, feed) on an OracleQuoter. A DecimalQuoter needs nothing.

A voucher with no cap cannot be deposited. registry.remove(voucher) takes the voucher out and leaves its cap and price.

Liquidity and fees ​

  • Anyone can approve the pool and call deposit(voucher, amount). The deposit counts toward the cap.
  • Anyone can swap with withdraw. See Quote and settle swaps.
  • The owner can take any voucher out with withdrawLiquidity(token, to, amount).
  • The owner sends accrued fees to feeAddress with withdraw(token) or withdraw(token, amount).

Seal settings ​

seal(bits) permanently locks the address a setting points to:

BitSetting
1feePolicy
2feeAddress
4quoter
8tokenRegistry
16tokenLimiter

31 locks all five. Sealing does not lock the contents of those contracts: their owner can still change fees, caps, prices and the voucher list. Check who owns each one, and who can upgrade the pool proxy.