Aqua Agent
Dual-pathway execution agent for non-custodial and vault-backed risk mitigation.
The Aqua Agent is Aquarius's on-chain execution layer. When the Risk Intelligence Engine determines that a position requires intervention, the Aqua Agent executes the selected mitigation action through one of two pathways:
Both pathways are permission-bounded, policy-enforced, and auditable.
In the non-custodial pathway, the user maintains full custody of their assets. The Aqua Agent can only execute actions that the user has explicitly pre-approved.
MitigationExecutor.sol verifies the user's approval and spending limitPolicyGuard.sol enforces per-action size limits and daily frequency caps| Action | Contract Method | Description |
|---|---|---|
| Partial Repay | repayOnBehalf() | Repays a portion of the user's debt to improve health factor |
| Collateral Top-Up | supplyOnBehalf() | Adds collateral to the user's position |
| Asset Rebalance | repayOnBehalf() + supplyOnBehalf() | Restructures the position for better risk profile |
// MitigationExecutor.sol — bounded spending
mapping(address => mapping(address => uint256)) public approvedLimits;
function repayOnBehalf(address user, address asset, uint256 amount)
external onlyAgent
{
require(amount <= approvedLimits[user][asset], "Exceeds approved limit");
policyGuard.checkPolicy(user, amount);
// Execute repay...
}Key security properties:
The AquaAgentPolicyGuard contract enforces two hard limits:
uint256 public maxSingleActionUsd; // e.g., $10,000
uint256 public maxDailyActionsPerUser; // e.g., 5 per 24hDaily counters automatically reset after 24 hours. Both limits are owner-configurable and emit PolicyUpdated events on change.
Confidential Compute
Non-custodial execution leverages Chainlink Confidential Compute to ensure that user approvals and spending limits are verified in a trusted execution environment.
The BufferVault pathway provides institutional-grade pooled protection. Users deposit assets into the Aquarius Vault, which maintains a reserve of mitigation capital that the Aqua Agent can draw from when risk is detected.
BufferVault.sol and receive proportional aqSharesBufferVault.sol calls injectLiquidity() — repaying debt on behalf of the at-risk position from pooled reserves// BufferVault.sol — core operations
function deposit(uint256 amount) external returns (uint256 shares) {
shares = (totalShares == 0)
? amount
: (amount * totalShares) / totalAssets();
aqShares[msg.sender] += shares;
// Transfer assets into vault...
}
function injectLiquidity(
address beneficiary,
address debtAsset,
uint256 amount
) external onlyAgent {
// Repay debt from pooled reserves
POOL.repay(debtAsset, amount, 2, beneficiary);
}| Benefit | Description |
|---|---|
| Automatic protection | No manual intervention required when risk is detected |
| No gas scramble | Mitigation capital is pre-positioned in the vault |
| Institutional usability | Funds-of-funds and treasury managers can deposit once and rely on automated protection |
| Yield-bearing | Vault shares represent claims on the underlying pool, which can accrue yield |
| Proportional risk sharing | Losses and protections are distributed proportionally across vault depositors |
Agent-Only Execution
Only the registered Aqua Agent can call injectLiquidity(). Direct vault-to-pool transfers by depositors are not permitted.
The AquaAgent.sol contract is the on-chain router that directs mitigation actions to the appropriate executor:
function executeAction(
string calldata actionType,
address target,
bytes calldata params
) external onlyOwner {
require(approvedActions[keccak256(bytes(actionType))], "Unapproved action");
if (equals(actionType, "partialRepay")) {
mitigationExecutor.repayOnBehalf(/* decoded params */);
} else if (equals(actionType, "vaultInject")) {
bufferVault.injectLiquidity(/* decoded params */);
} else if (equals(actionType, "addCollateral")) {
mitigationExecutor.supplyOnBehalf(/* decoded params */);
}
emit ActionExecuted(actionType, target, block.timestamp);
}The router maintains a registry of approved action types using keccak256 hashes, ensuring that only explicitly whitelisted actions can be dispatched.
The complete decision flow from risk detection to on-chain execution:
OK, OBSERVE_ONLY, or ESCALATEESCALATE: select optimal mitigation (repay vs. top-up vs. vault inject)