Skip to content

Protocol modules

Liquidity ladders

Rung-by-rung pools and user-owned vaults re-centred by a restricted operator.

Liquidity ladders are AevumFi's own market for tokens that have no oracle price — launched tokens, WETH against USDG, and any pair the owner lists. Liquidity sits on rungs: price bins on a geometric grid. Each rung trades at exactly one price, so liquidity you put on a rung fills at that rung's price, like a limit order that stays in the market.

Ladder pools#

A pool prices a base token in USDG or WETH. Bin ii quotes

Pi=Pc⋅(1+s10 000)i−cP_i = P_c \cdot \left(1 + \frac{s}{10\,000}\right)^{i - c}

where PcP_c is the pool's centre price, cc its centre bin and ss the bin step in basis points — 0.25% on WETH/USDG, 2% on launched tokens.

  • Asks and bids. Bins above the active bin hold only the base token (asks); bins below hold only the quote token (bids). The active bin can hold both.
  • Swaps walk the ladder. A buy takes the base token from the active bin at its price, then moves up to the next rung with liquidity; a sell does the same downward. Every rung a swap crosses fills at that rung's price.
  • Fees. Every fill pays the pool fee in the quote token — on top of the quote a buyer pays, out of a seller's proceeds — to the liquidity providers of that rung, pro rata to their shares.
  • Positions. Adding to a rung mints shares of its reserves. Removing burns them and pays the pro-rata mix the rung holds now: a filled ask pays out quote, a filled bid pays out the base token.

Each pool also keeps two on-chain gauges that automation reads:

  • an EMA of the active bin over 10 minutes. A price pushed around within one block leaves the EMA where it was, so the deviation between the active bin and its EMA reads large;
  • a volatility accumulator. Every swap adds the bins it moved, and the sum halves after an hour without movement. At or above the pool's threshold — 20 bins on WETH/USDG, about 5% — the pool is in the elevated regime.

Ladder vaults#

A ladder vault is a contract owned by one account that keeps a ladder of rungs around the price. Its owner chooses:

SettingWhat it does
Quote-side rungsBids below the price, holding the quote token (0–20).
Token-side rungsAsks above the price, holding the base token (0–20).
Volatility modeConservative or aggressive — how far apart the rungs sit (below).
OperatorThe one address allowed to re-centre the ladder: the AevumFi keeper by default.
Daily gas allowanceThe most ETH the operator may be reimbursed per UTC day.
Operator limitsEMA deviation guard, minimum drift before re-centring, and a cooldown.

Rungs are spaced by bins, following the pool's own volatility regime:

ModeCalmElevated
Conservative2 bins6 bins
Aggressive1 bin3 bins

Each side's tokens are split equally over its rungs; the rung nearest the price takes the remainder.

The restricted operator#

The operator can call one function, rebalance, which takes the rungs off and places them again around the current price. It can do so only while the strategy runs, after its cooldown, once the price has drifted at least the minimum number of bins from the ladder's centre, and only while the active bin sits within the deviation guard of its EMA. It cannot withdraw, change the strategy, or send funds anywhere but the pool.

The owner can re-centre at any time (the deviation guard still applies), pause the strategy, and revoke the operator in one transaction: setOperator(0x0) is the kill switch.

Gas reserve#

The owner can deposit ETH into the vault. After each operator rebalance the vault reimburses the gas it measured, plus a fixed allowance for the transaction's intrinsic cost, priced at no more than twice the block's base fee — within the remaining daily allowance and the reserve. The keeper only operates vaults whose remaining allowance covers the transaction.

Fees into the Omni-Vault#

harvest collects every rung's fees and deposits them into the Omni-Vault for the owner as afUSD (Omni-USD). WETH fees are first sold for USDG in the WETH/USDG ladder pool, for no less than the minimum the owner passes. Fees collected when the ladder is re-centred wait in the vault for the next harvest; they are never placed back on the rungs.

Guarantees and limits#

  • Non-custodial. Only the owner can withdraw, close the vault or change its settings. Closing takes every rung off and returns all tokens, fees and the gas reserve.
  • Inventory risk. Rungs fill as the price moves: asks sell your tokens as it rises, bids buy as it falls. Re-centring keeps what filled.
  • Unsupported tokens. Fee-on-transfer and rebasing tokens are rejected — pools check that exactly the stated amount arrived.
  • Capacity. At most 256 bins per add, remove or collect call, and 256 rungs crossed by one swap.

Interface#

LadderPool.sol (excerpt)
function addLiquidity(uint256[] calldata ids, uint256[] calldata baseAmounts, uint256[] calldata quoteAmounts, address to) external returns (uint256[] memory minted);
function removeLiquidity(uint256[] calldata ids, uint256[] calldata shares, address to) external returns (uint256 baseOut, uint256 quoteOut);
function collectFees(uint256[] calldata ids, address to) external returns (uint256 amount);
function swap(bool buyBase, uint256 amountIn, uint256 minOut, address to) external returns (uint256 amountOut);
function quoteSwap(bool buyBase, uint256 amountIn) external view returns (uint256 amountOut, uint256 fee, uint256 endId);
function deviation() external view returns (uint256); // bins, scaled 1e6
function isVolatile() external view returns (bool);
LadderVault.sol (excerpt)
function rebalance() external; // the owner, or the operator within its limits
function setOperator(address operator) external; // setOperator(address(0)) revokes it
function setPaused(bool paused) external;
function setStrategy(Strategy calldata strategy) external;
function setMaxDailyGas(uint256 maxDailyGasWei) external;
function harvest(uint256 minUsdgOut) external returns (uint256 afUsdShares);
function close() external;