Price oracle
Deposits are valued with a guarded on-chain price. Bounds, rate limits and a staleness check make a bad price hard to post and impossible to use for long.
Why an admin-set oracle
A new token has shallow liquidity, and a DEX time-weighted average price on shallow liquidity can be moved cheaply. Cerebra therefore starts with a price posted by a keeper and constrained on-chain. Because the USD value of a deposit is fixed at deposit time, a wrong price can mis-credit a deposit but cannot touch existing balances.
Safeguards
| Guard | Default | Effect |
|---|---|---|
| Absolute bounds | Set at deploy | The price must stay between a minimum and a maximum. |
| Per-update deviation | 20% | A keeper cannot move the price more than this in one update. |
| Update interval | 10 minutes | At most one keeper update per interval. |
| Force price | Admin only | The admin (a Safe) can set a price outside the limits in an emergency. It emits an event. |
| Decimals | 8 | Prices use eight decimals. Billing converts to six-decimal USD. |
Staleness
Billing stores how old the price is and refuses deposits when it exceeds maxPriceAge (6 hours by default). If the keeper stops, deposits stop. Existing balances, spending and staking are unaffected.
Reading the price
Billing.currentPrice() returns the price and the time it was last updated. The Deposit page shows both.Upgrading the price source
Billing reads the price through a text-sm interface, so the admin can later point it at a decentralized source once liquidity supports it. Changing the source is admin-only and emits an event.