FeeReserve
Admin-controlled reserve for subsidizing fees during the bootstrapping phase.
Source
packages/contracts/FeeReserve.compact
Ledgers
| Ledger | Type | Description |
|---|---|---|
reserve_balance | Counter | Current reserve balance |
total_deposited | Counter | Lifetime deposits |
total_withdrawn | Counter | Lifetime withdrawals |
config | Map<Bytes, Counter> | Configuration (key 0x02 = warning threshold) |
admin | Map<Bytes, Bytes> | Admin identity (key 0x01) |
Circuits
initialize(admin_id: Bytes, warning_threshold: Counter)
Sets the admin identity and the balance warning threshold. Only the admin can deposit and withdraw.
deposit(caller: Bytes, amount: Counter)
Adds funds to the reserve. Fails if caller is not the admin.
withdraw(caller: Bytes, amount: Counter)
Withdraws funds from the reserve. Fails if:
calleris not the adminamountexceedsreserve_balance
getReserveBalance(): Counter
Returns the current reserve balance.
getWarningThreshold(): Counter
Returns the configured warning threshold. When the balance drops below this value, the admin should be notified (off-chain monitoring).
getTotalDeposited(): Counter
Returns the lifetime total of deposits.
getTotalWithdrawn(): Counter
Returns the lifetime total of withdrawals.
Purpose
The FeeReserve funds the FeePool during bootstrapping when user deposits may not cover the normalization gap. As the user base grows and the pool becomes self-sustaining, the reserve can be drawn down.
Admin deposits → FeeReserve → subsidizes → FeePool
↑
User deposits