depositLimit/borrowLimit ceiling.
The two caps
Each reserve has twoWithdrawalCaps structs:
| Cap | Throttles |
|---|---|
depositWithdrawalCap | Net deposit / withdrawal flow on the reserve’s collateral side |
debtWithdrawalCap | Net borrow / repay flow on the debt side |
Field semantics
| Field | What it stores |
|---|---|
configCapacity | Maximum net flow allowed within the interval. The cap counts both directions: deposits add to the running total, withdrawals subtract. The same applies for borrow / repay on the debt cap. |
configIntervalLengthSeconds | Length of the rolling interval, in seconds. 86400 = 24 hours. |
currentTotal | The current net flow within the active interval. Maintained on-chain; you don’t set it manually. |
lastIntervalStartTimestamp | Unix timestamp when the active interval started. Maintained on-chain. |
now > lastIntervalStartTimestamp + configIntervalLengthSeconds), currentTotal resets to zero on the next operation.
Setting configCapacity to disable
configCapacity = 0 disables the cap (the program treats 0 as no limit). To enable a cap, set a positive value.
To temporarily lock down a reserve, set configCapacity to a small positive value during a config update — the next operation that would push net flow above the cap will revert. Avoid 0, which disables the cap entirely.
Worked example
A new reserve for a long-tail asset listed withdepositLimit = 10M tokens. The curator wants to limit per-day inflows to 1M tokens during the first month to keep TVL growth proportionate to the asset’s available on-chain liquidity.
configCapacity to scale with comfort.
Common configurations
| Reserve type | depositWithdrawalCap | debtWithdrawalCap |
|---|---|---|
| Newly-listed asset | Cap to ~10% of depositLimit per day | Cap to ~10% of borrowLimit per day |
| Established stable | Disabled (0) | Disabled (0) |
| Tokenized off-chain asset | Cap aligned with off-chain redemption capacity | Often disabled if not borrowable |
| Regulated token (Token-2022) | Cap aligned with regulator-imposed flow constraints | Same |
| Reserve with a vault on top | Disabled or very generous; vault-side rate limits handle UX | Same |
Updating caps
Edit the reserve config, runupdate-reserve-config:
currentTotal and lastIntervalStartTimestamp are not reset by a config update — the interval continues running with the new capacity.
Caps vs. utilization-based blocking
Two related fields throttle different things:| Mechanism | What it does |
|---|---|
depositWithdrawalCap / debtWithdrawalCap | Limit total net flow per interval, regardless of utilization |
utilizationLimitBlockBorrowingAbovePct | Block new borrows when utilization is currently above the threshold, regardless of historical flow |
Reading current cap state
download-reserve-config returns currentTotal and lastIntervalStartTimestamp along with the configured fields. Use it to inspect how much of the current interval’s capacity has been consumed.
Reference
- Reserve config reference —
depositWithdrawalCapanddebtWithdrawalCapfields - Risk parameters —
depositLimit,borrowLimit,utilizationLimitBlockBorrowingAbovePct