AgentTresor

The AgentTresor contract is the central banking primitive of the protocol. It manages the USDC reserves, handles the issuance and redemption of agtrUSD, and executes the "Cycle" logic to capture ecosystem revenue.

Contract Address:0xE4437e5e5D2BE0B916808d4115cC707B2D8C33f8[View on Basescan]

State Variables

TypeNameDescription
addressusdcThe USDC contract address (Collateral).
addressagtrUsdThe agtrUSD contract address (Liability).
addresscollectorAddress where protocol fees accumulate before sweeping.
uint256totalInvestedAmount of USDC currently deployed into Yield Strategies.

Functions

executeCycle

function executeCycle(uint256 amountOutMin) external onlyOwner

Triggers the core "Growth Cycle" of the protocol. This function effectively "harvests" the accumulated revenue in the Collector, converts it to USDC, and mints new agtrUSD backed by this revenue.

Logic Flow

  1. Checks the Treasury's current liquidity to determine the "Sweep Ratio" (Low/Medium/High).
  2. Withdraws accrued AGTR taxes from the Collector.
  3. Burns 20% of the AGTR (deflation).
  4. Swaps the remainder to WETH and then to USDC.
  5. Withdraws accrued ETH fees from the Collector and swaps to USDC.
  6. Mints new agtrUSD against the received USDC (1:1 backing).

depositFor

function depositFor(address user, uint256 amount) external

Allows a user (or contract) to mint agtrUSD by depositing USDC.

Parameters

  • user: The address to receive the minted agtrUSD.
  • amount: The amount of USDC (6 decimals) to deposit.

redeem

function redeem(uint256 amount) external

Allows a user to burn agtrUSD to retrieve the underlying USDC collateral 1:1.

Parameters

  • amount: The amount of agtrUSD (18 decimals) to burn.

defendPeg

function defendPeg(uint256 usdcAmount, uint256 minAgtrUsdOut, bytes calldata path) external onlyOwner

Emergency function callable only by the AI Treasurer. Uses Treasury reserves to buy back and burn agtrUSD from the open market (Aerodrome) if the peg breaks downwards.

Events

  • CycleExecuted(uint256 ethSwept, uint256 agtrSwept, uint256 usdcReceived, uint256 agtrUsdMinted)
  • PegDefended(uint256 usdcSpent, uint256 agtrUsdBurnt)
  • YieldHarvested(uint256 yieldUsdc, uint256 agtrUsdDistributed)