PRIV ProtocolPRIV Docs
Contracts

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.

PropertyValue
ContractTreasuryManager
Address (Base Sepolia)0x2b9777e611E412Cf911dB4024BB6E42c64cD84cb
Default PRIV Target50% of treasury value
Default USDC Target30% of treasury value
Rebalance Tolerance5% (configurable)
Rebalance Interval1 day minimum
Emergency Threshold80% price drop (configurable, 50--95%)
NetworkBase (Chain ID: 8453)

Action Priority

The manager evaluates conditions in priority order:

  1. EmergencyPause -- Price has dropped beyond the emergency threshold (default 80%). Pauses the manager and activates emergency mode.
  2. PriceIntervention -- Price has dropped beyond the treasury's deployment threshold. Triggers the Treasury contract's automated deployment (PRIV burn).
  3. Rebalance -- Portfolio composition has drifted beyond tolerance from target allocations. At least 1 day must have elapsed since the last rebalance.

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) external

Key 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

FunctionDescription
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: performUpkeep is 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.

Source Code

View on GitHub