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.
State Variables
| Type | Name | Description |
|---|---|---|
| address | usdc | The USDC contract address (Collateral). |
| address | agtrUsd | The agtrUSD contract address (Liability). |
| address | collector | Address where protocol fees accumulate before sweeping. |
| uint256 | totalInvested | Amount 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
- Checks the Treasury's current liquidity to determine the "Sweep Ratio" (Low/Medium/High).
- Withdraws accrued AGTR taxes from the Collector.
- Burns 20% of the AGTR (deflation).
- Swaps the remainder to WETH and then to USDC.
- Withdraws accrued ETH fees from the Collector and swaps to USDC.
- Mints new
agtrUSDagainst 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)
