TreasuryManager
Automated treasury operations with Chainlink Automation compatibility, portfolio rebalancing, and emergency circuit breakers.
Overview
TreasuryManager automates treasury operations by monitoring price conditions and portfolio composition. It integrates with Chainlink Automation (or Gelato) via the standard checkUpkeep / performUpkeep interface. Three automated action types are supported: price intervention, rebalancing, and emergency pause.
| Property | Value |
|---|---|
| Contract | TreasuryManager |
| Address (Base Sepolia) | 0x2b9777e611E412Cf911dB4024BB6E42c64cD84cb |
| Default PRIV Target | 50% of treasury value |
| Default USDC Target | 30% of treasury value |
| Rebalance Tolerance | 5% (configurable) |
| Rebalance Interval | 1 day minimum |
| Emergency Threshold | 80% price drop (configurable, 50--95%) |
| Network | Base (Chain ID: 8453) |
Action Priority
The manager evaluates conditions in priority order:
- EmergencyPause -- Price has dropped beyond the emergency threshold (default 80%). Pauses the manager and activates emergency mode.
- PriceIntervention -- Price has dropped beyond the treasury's deployment threshold. Triggers the Treasury contract's automated deployment (PRIV burn).
- Rebalance -- Portfolio composition has drifted beyond tolerance from target allocations. At least 1 day must have elapsed since the last rebalance.
Chainlink Automation Interface
checkUpkeep
Called off-chain by the Chainlink Automation network. Returns whether an action is needed and which action to perform.
function checkUpkeep(bytes calldata) external view returns (bool upkeepNeeded, bytes memory performData)performUpkeep
Executes the action identified by checkUpkeep. Only callable by the authorized keeper or the contract owner.
function performUpkeep(bytes calldata performData) externalKey View Functions
getTreasuryComposition
Returns current PRIV and USDC balances with their percentage of total treasury value.
function getTreasuryComposition()
external view returns (uint256 privBalance, uint256 usdcBalance, uint256 privPercent, uint256 usdcPercent)needsRebalance
Checks whether portfolio has drifted beyond tolerance and reports the delta for each asset.
function needsRebalance() external view returns (bool needed, int256 privDelta, int256 usdcDelta)needsPriceIntervention
Checks whether the current price drop warrants a deflationary intervention.
function needsPriceIntervention() external view returns (bool needed, uint256 dropPercent)Admin Functions
| Function | Description |
|---|---|
setKeeper(address) | Authorize a Chainlink Automation registry or Gelato executor |
setRebalanceTargets(uint256, uint256) | Set target PRIV and USDC allocations (bps, must sum to 10000 or less) |
setRebalanceTolerance(uint256) | How far from target before rebalancing triggers (max 20%) |
setEmergencyThreshold(uint256) | Price drop threshold for emergency pause (50--95%) |
updatePrice30DayAvg(uint256) | Update 30-day average price reference (keeper-callable) |
exitEmergencyMode() | Manually exit emergency mode after resolution |
pause() / unpause() | Circuit breaker |
Security
- Keeper-restricted execution:
performUpkeepis restricted to the authorized keeper address or the owner. - Rebalance cooldown: Minimum 1-day interval between rebalance actions prevents excessive trading.
- Emergency auto-pause: Extreme price drops automatically pause the manager to prevent further automated actions.
- Reentrancy protection: All mutative functions use
nonReentrant. - Bounded thresholds: Emergency threshold (50--95%) and rebalance tolerance (up to 20%) are range-checked.