Deposit CEREBRA
Deposits convert CEREBRA into API balance. The USD value is fixed at the moment you deposit and protected by a minimum you choose.
In the app
Open Deposit, enter an amount of CEREBRA and review the quote. If the CEREBRA token supports EIP-2612 permits, approval and deposit happen in a single transaction with one signature. The app detects this automatically; if the token has no permit, it asks for a normal approval first and then the deposit.
The deposit succeeds only if the contract can credit at least the quoted amount, minus a text-sm slippage allowance. If the price moves against you in between, the transaction reverts and nothing is spent.
Quotes and slippage
The Billing contract multiplies your CEREBRA by the oracle price to get the USD value, expressed with six decimals. Every deposit function takes a minUsdValue. If the value at execution time is lower, the call reverts with SlippageExceeded.
| Condition | Result |
|---|---|
| Value is below the minimum deposit | DepositTooSmall. The default minimum is $1. |
| Value is below your minUsdValue | SlippageExceeded. Nothing is transferred. |
| Oracle price is older than the maximum age | StalePrice. Deposits pause until the price is refreshed. |
| Contract is paused | Deposits revert. Staking withdrawals and claims keep working. |
Depositing for another wallet
depositFor credits the balance of a different address. Use it to top up a teammate, or to fund an autonomous agent that holds its own API key without holding CEREBRA. The payer sends CEREBRA and the beneficiary receives the USD balance.
Contract interface
function deposit(uint256 amount, uint256 minUsdValue) returns (uint256 id, uint256 usdValue)
function depositFor(address beneficiary, uint256 amount, uint256 minUsdValue) returns (uint256 id, uint256 usdValue)
function depositWithPermit(address beneficiary, uint256 amount, uint256 minUsdValue,
uint256 deadline, uint8 v, bytes32 r, bytes32 s) returns (uint256 id, uint256 usdValue)
function quote(uint256 amount) view returns (uint256 usdValue, uint256 price)Events
Each deposit emits Deposited(id, payer, beneficiary, amount, usdValue, price) and Distributed(id, toStakers, burned, toTreasury). The gateway credits the beneficiary from the Deposited event, so the on-chain log is the source of truth for every balance.
Fixed value