Skip to content

Reference

Contracts & interfaces

Addresses, function signatures and how to deploy.

Addresses#

ModuleContractAddress
Price oracleAevumFiOracle.sol0x0EF2E5311ae84299c10cbbC7a498a39388E0cB14
Omni-Vault (afUSD)OmniVault.sol0x4b922ACa1FFCe2F87D1c2AF200CF67f109983b44
Index perps enginePerpEngine.sol0xf73Ec07B6493C2fB1356A3741C9193A7E8a8Deb5
Dark poolDarkPool.sol0xc4d3c85c69f6A9c35C34CBE37AE1Aa1202383e7E
Ladder pool factoryLadderFactory.sol0x1FCeae36426b7B4268819AF0A067b701B5e5b60E
Ladder vault factoryLadderVaultFactory.sol0x8E384F1FB37e405C6d989296d32779F41F29Dc77
Launchpad (Aevum Engine)AevumLaunchpad.sol0x9Cb8Fb7960De0270861c67288240386882C10C8a
NFT floor bookFloorBook.sol0xD48c6A09523A6ceB95ce6d8F7B0C9BB7927b2171
Settlement assetAddress
USDG — Global Dollar (6 decimals)0xd3d0928bce4A818B10204d5C3f1F2Ae9a1955b8F
WETH (18 decimals)0xadCf25E396Eec7BB68B71eE38a21b782213e49DB

The Terminal reads these from NEXT_PUBLIC_* variables, so a deployment goes live without a code change.

Deploying#

The contracts are a Foundry project in contracts/.

cd contracts
forge test                                  # unit, fuzz and invariant tests
ORACLE_SIGNERS=0xSigner KEEPER_ADDRESS=0xKeeper ETH_PRICE_USD=<ETH price, whole dollars> OWNER=0xOwner TREASURY=0xTreasury \
  forge script script/Deploy.s.sol --rpc-url <rpc> --private-key <deployer key> --broadcast
cd .. && node scripts/deployment-env.mjs <chainId>   # prints the app's env for the deployment

The script deploys the oracle, vault, engine and dark pool, lists all 34 markets, adds the liquidity ladders and the launchpad, and writes contracts/deployments/<chainId>.json. KEEPER_ADDRESS is suggested to ladder vaults as their operator, and ETH_PRICE_USD centres the WETH/USDG ladder pool. On Robinhood Chain (4663) it uses the published USDG and WETH; on any other chain without USDG_ADDRESS / WETH_ADDRESS it deploys its own USDG and WETH contracts and an NFT collection, and seeds the WETH/USDG ladder. When OWNER differs from the deployer, ownership is transferred and must be accepted (acceptOwnership()) on each contract. ABIs for the app are regenerated with node scripts/export-abis.mjs.

To add the ladders and the launchpad to an existing deployment, run script/DeployLadder.s.sol the same way with KEEPER_ADDRESS set; it reads the deployment file, centres WETH/USDG on the oracle's last ETH price, and adds the new addresses to the file.

Interfaces#

AevumFiOracle.sol
function submit(PriceBatch calldata batch, bytes[] calldata signatures) external;
function verify(PriceBatch calldata batch, bytes[] calldata signatures) external view;
function getPrice(bytes32 id) external view returns (uint256 price, uint256 sourceTime, uint256 publishTime);
PerpEngine.sol
function increasePosition(bytes32 market, bool isLong, uint256 margin, uint256 sizeUsd, uint256 acceptablePrice, PriceBatch calldata batch, bytes[] calldata signatures) external;
function decreasePosition(bytes32 market, uint256 sizeDelta, uint256 acceptablePrice, PriceBatch calldata batch, bytes[] calldata signatures) external;
function addMargin(bytes32 market, uint256 amount) external;
function removeMargin(bytes32 market, uint256 amount, PriceBatch calldata batch, bytes[] calldata signatures) external;
function liquidate(address trader, bytes32 market, PriceBatch calldata batch, bytes[] calldata signatures) external;
function placeOrder(bytes32 market, bool isLong, bool isStop, uint256 margin, uint256 sizeUsd, uint256 triggerPrice, uint256 acceptablePrice) external returns (uint256 id);
function cancelOrder(uint256 id) external;
function executeOrder(uint256 id, PriceBatch calldata batch, bytes[] calldata signatures) external;
function getPosition(address trader, bytes32 market) external view returns (PositionView memory);
function vaultLiabilities() external view returns (int256 claim, uint256 reserve, bool fresh);

The Omni-Vault, dark pool, liquidity ladder and launchpad interfaces are on their pages. Market ids are the lower-case tickers as right-padded bytes32 (bytes32("spx")); sizes and prices are 1e18-scaled, USDG amounts use its 6 decimals.