Skip to content

Commit f1f6570

Browse files
feat: chaos agent migration (#912)
* feat: chaos agent migration * docs: update md * feat: add new payload and reimbursement for LINK * feat: new payloads
1 parent 97e097b commit f1f6570

6 files changed

+520
-0
lines changed
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
## Reserve changes
2+
3+
### Reserves altered
4+
5+
#### LINK ([0x514910771AF9Ca656af840dff83E8264EcF986CA](https://etherscan.io/address/0x514910771AF9Ca656af840dff83E8264EcF986CA))
6+
7+
| description | value before | value after |
8+
| --- | --- | --- |
9+
| aTokenUnderlyingBalance | 13,215,405.4600 LINK [13215405460038135315590910] | 13,215,285.4600 LINK [13215285460038135315590910] |
10+
| virtualBalance | 13,215,404.4588 LINK [13215404458845723782627922] | 13,215,284.4588 LINK [13215284458845723782627922] |
11+
12+
13+
## Raw diff
14+
15+
```json
16+
{
17+
"reserves": {
18+
"0x514910771AF9Ca656af840dff83E8264EcF986CA": {
19+
"aTokenUnderlyingBalance": {
20+
"from": "13215405460038135315590910",
21+
"to": "13215285460038135315590910"
22+
},
23+
"virtualBalance": {
24+
"from": "13215404458845723782627922",
25+
"to": "13215284458845723782627922"
26+
}
27+
}
28+
},
29+
"raw": {
30+
"0x514910771af9ca656af840dff83e8264ecf986ca": {
31+
"label": "AaveV2Ethereum.ASSETS.LINK.UNDERLYING, AaveV3Ethereum.ASSETS.LINK.UNDERLYING",
32+
"contract": null,
33+
"balanceDiff": null,
34+
"nonceDiff": null,
35+
"stateDiff": {
36+
"0x60bef50ce3efaeb19891bb06dcb8bea2ccb99c07904720f28a513b12869cb727": {
37+
"previousValue": "0x0000000000000000000000000000000000000000000000537bf8deb827c0b8ad",
38+
"newValue": "0x000000000000000000000000000000000000000000000059fd4e82ee9ea0b8ad"
39+
},
40+
"0xdae4082b17861c7d82e21b4a4c7bb9fa7ad9df1c0133f315d870700d9f955f7e": {
41+
"previousValue": "0x0000000000000000000000000000000000000000000aee7890c4c5b61d326efe",
42+
"newValue": "0x0000000000000000000000000000000000000000000aee720f6f217fa6526efe"
43+
}
44+
}
45+
},
46+
"0x5e8c8a7243651db1384c0ddfdbe39761e8e7e51a": {
47+
"label": "AaveV3Ethereum.ASSETS.LINK.A_TOKEN",
48+
"contract": "lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/proxy/transparent/TransparentUpgradeableProxy.sol:TransparentUpgradeableProxy",
49+
"balanceDiff": null,
50+
"nonceDiff": null,
51+
"stateDiff": {
52+
"0x0000000000000000000000000000000000000000000000000000000000000036": {
53+
"previousValue": "0x0000000000000000000000000000000000000000000b79f1ee0a061261e1b385",
54+
"newValue": "0x0000000000000000000000000000000000000000000b79eb6e17a24bfda8e839"
55+
},
56+
"0x14a553e31736f19e3e380cf55bfb2f82dfd6d880cd07235affb68d8d3e0cac4d": {
57+
"previousValue": "0x00000000033bdec1fa3225bbdfcf7a10000000000000098c4022e35bc1b4f628",
58+
"newValue": "0x00000000033bded6e368920fd5fe7e390000000000000985c0307f955d7c2adc"
59+
},
60+
"0x7a79d58a6c2c4214189d78e4be4ba21513d55fd0a4b2ac0c119b9394eb289d20": {
61+
"previousValue": "0x00000000033bd97abc22834a5d93f32c00000000000000000000000000000000",
62+
"newValue": "0x00000000033bded6e368920fd5fe7e3900000000000000000000000000000000"
63+
}
64+
}
65+
},
66+
"0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2": {
67+
"label": "AaveV3Ethereum.POOL",
68+
"contract": "lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/proxy/transparent/TransparentUpgradeableProxy.sol:TransparentUpgradeableProxy",
69+
"balanceDiff": null,
70+
"nonceDiff": null,
71+
"stateDiff": {
72+
"0x171656ac53fe6b4f4afb5485494f9f0ac15c89bb5b5e4dc8918a7e575ea6701e": {
73+
"previousValue": "0x0000000000003d6557d042dac9c53bca00000000033bded6a4951b34bd762902",
74+
"newValue": "0x0000000000003d659e41a02a943d28e500000000033bded6e368920fd5fe7e39"
75+
},
76+
"0x171656ac53fe6b4f4afb5485494f9f0ac15c89bb5b5e4dc8918a7e575ea6701f": {
77+
"previousValue": "0x00000000000635f70916b60348f08aef0000000003442db7ba77f10953c82ce6",
78+
"newValue": "0x00000000000635fa99362a0e6a7781470000000003442dbe25cc5875b7c20ded"
79+
},
80+
"0x171656ac53fe6b4f4afb5485494f9f0ac15c89bb5b5e4dc8918a7e575ea67020": {
81+
"previousValue": "0x000000000000000000000500693adacb00000000000000002cf6b739ecb2a3e6",
82+
"newValue": "0x000000000000000000000500693adcb700000000000000002cf6b739ecb2a3e6"
83+
},
84+
"0x171656ac53fe6b4f4afb5485494f9f0ac15c89bb5b5e4dc8918a7e575ea67025": {
85+
"previousValue": "0x00000000000aee7882dfd28483f5425200000000000000011234f2cae94130c2",
86+
"newValue": "0x00000000000aee72018a2e4e0d1542520000000000000001126cb00e192cfc0f"
87+
},
88+
"0xf9829112cce780d4a61051cb8a0049abd16e5ef129bad968336a15bba07c032d": {
89+
"previousValue": "0x0000000000000000000000000000000000000000000000000000000000020082",
90+
"newValue": "0x0000000000000000000000000000000000000000000000000000000000020082"
91+
}
92+
}
93+
},
94+
"0xdabad81af85554e9ae636395611c58f7ec1aaec5": {
95+
"label": "GovernanceV3Ethereum.PAYLOADS_CONTROLLER",
96+
"contract": "lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/proxy/transparent/TransparentUpgradeableProxy.sol:TransparentUpgradeableProxy",
97+
"balanceDiff": null,
98+
"nonceDiff": null,
99+
"stateDiff": {
100+
"0xf29a47cc56db769417bfe11e85c712aa9920cdd341de96305d778b58202ad754": {
101+
"previousValue": "0x00693adcb6000000000002000000000000000000000000000000000000000000",
102+
"newValue": "0x00693adcb6000000000003000000000000000000000000000000000000000000"
103+
},
104+
"0xf29a47cc56db769417bfe11e85c712aa9920cdd341de96305d778b58202ad755": {
105+
"previousValue": "0x000000000000000000093a800000000000006969013700000000000000000000",
106+
"newValue": "0x000000000000000000093a8000000000000069690137000000000000693adcb7"
107+
}
108+
}
109+
}
110+
}
111+
}
112+
```
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity ^0.8.0;
3+
4+
import {IProposalGenericExecutor} from 'aave-helpers/src/interfaces/IProposalGenericExecutor.sol';
5+
import {AaveV3Ethereum, AaveV3EthereumAssets} from 'aave-address-book/AaveV3Ethereum.sol';
6+
import {CollectorUtils, ICollector} from 'aave-helpers/src/CollectorUtils.sol';
7+
8+
/**
9+
* @title Migrate automated risk update infra to chaos agents
10+
* @author BGD Labs (@bgdlabs)
11+
* - Snapshot: https://snapshot.org/#/s:aavedao.eth/proposal/0x9795f1b7057d2780b3382b9f67f309fbfead98e7357a88df4c309dbbfefcbeb7
12+
* - Discussion: https://governance.aave.com/t/arfc-chaos-risk-agents/23401
13+
*/
14+
contract AaveV3Ethereum_ReimburseLinkForRobot_20251201 is IProposalGenericExecutor {
15+
using CollectorUtils for ICollector;
16+
17+
uint256 public constant LINK_AMOUNT = 120 ether;
18+
address public constant BGD_RECEIVER = 0xb812d0944f8F581DfAA3a93Dda0d22EcEf51A9CF;
19+
20+
function execute() external {
21+
AaveV3Ethereum.COLLECTOR.withdrawFromV3(
22+
CollectorUtils.IOInput({
23+
pool: address(AaveV3Ethereum.POOL),
24+
underlying: AaveV3EthereumAssets.LINK_UNDERLYING,
25+
amount: LINK_AMOUNT
26+
}),
27+
BGD_RECEIVER
28+
);
29+
}
30+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity ^0.8.0;
3+
4+
import {GovV3Helpers} from 'aave-helpers/src/GovV3Helpers.sol';
5+
import {AaveV3Ethereum, AaveV3EthereumAssets} from 'aave-address-book/AaveV3Ethereum.sol';
6+
import {IERC20} from 'openzeppelin-contracts/contracts/token/ERC20/IERC20.sol';
7+
import {ProtocolV3TestBase} from 'aave-helpers/src/ProtocolV3TestBase.sol';
8+
import {AaveV3Ethereum_ReimburseLinkForRobot_20251201} from './AaveV3Ethereum_ReimburseLinkForRobot_20251201.sol';
9+
10+
/**
11+
* @dev Test for AaveV3Ethereum_ReimburseLinkForRobot_20251201
12+
* command: FOUNDRY_PROFILE=test forge test --match-path=src/20251201_Multi_MigrateAutomatedRiskUpdateInfraToChaosAgents/AaveV3Ethereum_ReimburseLinkForRobot_20251201.t.sol -vv
13+
*/
14+
contract AaveV3Ethereum_ReimburseLinkForRobot_20251201_Test is ProtocolV3TestBase {
15+
AaveV3Ethereum_ReimburseLinkForRobot_20251201 internal proposal;
16+
17+
function setUp() public {
18+
vm.createSelectFork(vm.rpcUrl('mainnet'), 23990197);
19+
proposal = new AaveV3Ethereum_ReimburseLinkForRobot_20251201();
20+
}
21+
22+
/**
23+
* @dev executes the generic test suite including e2e and config snapshots
24+
*/
25+
function test_defaultProposalExecution() public {
26+
defaultTest(
27+
'AaveV3Ethereum_ReimburseLinkForRobot_20251201',
28+
AaveV3Ethereum.POOL,
29+
address(proposal)
30+
);
31+
}
32+
33+
function test_BgdReceivedLinkToken() public {
34+
uint256 balanceBefore = IERC20(AaveV3EthereumAssets.LINK_UNDERLYING).balanceOf(
35+
proposal.BGD_RECEIVER()
36+
);
37+
GovV3Helpers.executePayload(vm, address(proposal));
38+
uint256 balanceAfter = IERC20(AaveV3EthereumAssets.LINK_UNDERLYING).balanceOf(
39+
proposal.BGD_RECEIVER()
40+
);
41+
42+
assertEq(balanceAfter - balanceBefore, 120 ether);
43+
}
44+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
title: "Migrate automated risk update infra to chaos agents"
3+
author: "BGD Labs (@bgdlabs)"
4+
discussions: "https://governance.aave.com/t/arfc-chaos-risk-agents/23401"
5+
snapshot: "https://snapshot.org/#/s:aavedao.eth/proposal/0x9795f1b7057d2780b3382b9f67f309fbfead98e7357a88df4c309dbbfefcbeb7"
6+
---
7+
8+
## Simple Summary
9+
10+
This proposal migrates all existing injector middleware infra used to perform automated risk updates to the new chaos agents system.
11+
12+
## Motivation
13+
14+
Currently, the AGRS in conjunction with the injector system is responsible for processing risk recommendations for a range of parameters including supply and borrow caps, interest rates, pendle pt e-mode collateral params and CAPO values across multiple assets and Aave instances. These updates are executed through the injector middleware which consume updates from the chaos risk oracles and inject updates onto the Aave protocol in real-time.
15+
16+
While the existing system has served Aave more than well, several limitations exist:
17+
18+
- Limited generalization: Almost every Risk Stewards activation requires ad-hoc replication of the entire architecture. This results in meaningful overhead for Aave SPs (e.g., ACI, Chaos Labs, BGD Labs).
19+
- Limited infrastructure visibility: Tracking all active Risk Stewards, as well as their covered assets and constraints, can be challenging at times.
20+
21+
The Chaos Risk Agents framework generalizes and modularizes the process of ingesting Risk Oracle data within Aave. It eliminates redundant deployments, centralizes validation logic, and improves visibility across all risk automation layers. The result is a cleaner, more maintainable architecture that allows Aave to expand real-time risk management capabilities, ensuring consistent, verifiable execution of parameter updates.
22+
23+
## Specification
24+
25+
All the current automated risk param updates will be migrated from the old injector infra to the chaos-agent system including the following:
26+
27+
| Risk Param | Network Instance |
28+
| --------------------------------------------- | --------------------------------------------------------- |
29+
| Supply and Borrow Caps | Arbitrum, Avalanche, Base, BNB, Gnosis, Optimism, Polygon |
30+
| Pendle EMode Collateral Param | EthereumCore, Plasma |
31+
| Pendle Discount Rate | EthereumCore, Plasma |
32+
| Interest Rate: Base, Slope1, Slope2, uOptimal | EthereumPrime |
33+
| Interest Rate: Slope2 | EthereumCore, Linea |
34+
35+
The chaos agent contracts have not been pre-configured during deployment and all operations including the following will be done on the payload:
36+
37+
- Register new agents on the AgentHub contract by calling `registerAgent()`
38+
- Configure constrained ranges on the `RangeValidationModule` to strictly bound the risk param update from the Chaos Risk Oracle.
39+
- Give `RISK_ADMIN` role to the AgentContract which will be called by the Chaos Agent system to inject updates onto the Aave protocol.
40+
- Revoke `RISK_ADMIN` role from the previous injector contracts as this system will be unused.
41+
- Cancel previous injector automation and register new one's on the AgentHub Automation wrapper contract. This is done only on networks were we use chainlink automation, on Linea, Gnosis and Plasma networks this will be done off-chain using the DAO account on Gelato automation.
42+
- Reimburse BGD Labs with 120 LINK by withdrawing aLINK from Collector on Ethereum, which was used to fund chainlink automation on BNB, Base networks as Collector did not have LINK on those networks.
43+
44+
All configurations used on the proposal payload could be found on the [AgentConfigLib](https://github.com/bgd-labs/chaos-agents-migration/blob/88bb6f3c4e043960f8cb42741ebe13c46c73b944/src/contracts/AgentConfigLib.sol).
45+
46+
More detailed specification can be found on the [chaos-agents-migration](https://github.com/bgd-labs/chaos-agents-migration) repo.
47+
48+
## References
49+
50+
- Implementation: [BaseMigrationPayload](https://github.com/bgd-labs/chaos-agents-migration/blob/88bb6f3c4e043960f8cb42741ebe13c46c73b944/src/contracts/BaseMigrationPayload.sol), [AaveV3Ethereum](https://github.com/bgd-labs/chaos-agents-migration/blob/88bb6f3c4e043960f8cb42741ebe13c46c73b944/src/contracts/payloads/EthereumCoreMigrationPayload.sol), [AaveV3EthereumPrime](https://github.com/bgd-labs/chaos-agents-migration/blob/88bb6f3c4e043960f8cb42741ebe13c46c73b944/src/contracts/payloads/EthereumPrimeMigrationPayload.sol), [AaveV3Ethereum_ReimburseLinkForRobot](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20251201_Multi_MigrateAutomatedRiskUpdateInfraToChaosAgents/AaveV3Ethereum_ReimburseLinkForRobot_20251201.sol), [AaveV3Polygon](https://github.com/bgd-labs/chaos-agents-migration/blob/88bb6f3c4e043960f8cb42741ebe13c46c73b944/src/contracts/payloads/PolygonMigrationPayload.sol), [AaveV3Avalanche](https://github.com/bgd-labs/chaos-agents-migration/blob/88bb6f3c4e043960f8cb42741ebe13c46c73b944/src/contracts/payloads/AvalancheMigrationPayload.sol), [AaveV3Optimism](https://github.com/bgd-labs/chaos-agents-migration/blob/88bb6f3c4e043960f8cb42741ebe13c46c73b944/src/contracts/payloads/OptimismMigrationPayload.sol), [AaveV3Arbitrum](https://github.com/bgd-labs/chaos-agents-migration/blob/88bb6f3c4e043960f8cb42741ebe13c46c73b944/src/contracts/payloads/ArbitrumMigrationPayload.sol), [AaveV3Base](https://github.com/bgd-labs/chaos-agents-migration/blob/88bb6f3c4e043960f8cb42741ebe13c46c73b944/src/contracts/payloads/BaseNetworkMigrationPayload.sol), [AaveV3Gnosis](https://github.com/bgd-labs/chaos-agents-migration/blob/88bb6f3c4e043960f8cb42741ebe13c46c73b944/src/contracts/payloads/GnosisMigrationPayload.sol), [AaveV3BNB](https://github.com/bgd-labs/chaos-agents-migration/blob/88bb6f3c4e043960f8cb42741ebe13c46c73b944/src/contracts/payloads/BNBMigrationPayload.sol), [AaveV3Linea](https://github.com/bgd-labs/chaos-agents-migration/blob/88bb6f3c4e043960f8cb42741ebe13c46c73b944/src/contracts/payloads/LineaMigrationPayload.sol), [AaveV3Plasma](https://github.com/bgd-labs/chaos-agents-migration/blob/88bb6f3c4e043960f8cb42741ebe13c46c73b944/src/contracts/payloads/PlasmaMigrationPayload.sol)
51+
- Tests: [BaseMigrationTest](https://github.com/bgd-labs/chaos-agents-migration/blob/88bb6f3c4e043960f8cb42741ebe13c46c73b944/tests/BaseMigrationPayload.t.sol), [AaveV3Ethereum](https://github.com/bgd-labs/chaos-agents-migration/blob/88bb6f3c4e043960f8cb42741ebe13c46c73b944/tests/payloads/EthereumCoreMigrationPayload.t.sol), [AaveV3EthereumPrime](https://github.com/bgd-labs/chaos-agents-migration/blob/88bb6f3c4e043960f8cb42741ebe13c46c73b944/tests/payloads/EthereumPrimeMigrationPayload.t.sol), [AaveV3Ethereum_ReimburseLinkForRobot](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20251201_Multi_MigrateAutomatedRiskUpdateInfraToChaosAgents/AaveV3Ethereum_ReimburseLinkForRobot_20251201.t.sol), [AaveV3Polygon](https://github.com/bgd-labs/chaos-agents-migration/blob/88bb6f3c4e043960f8cb42741ebe13c46c73b944/tests/payloads/PolygonMigrationPayload.t.sol), [AaveV3Avalanche](https://github.com/bgd-labs/chaos-agents-migration/blob/88bb6f3c4e043960f8cb42741ebe13c46c73b944/tests/payloads/AvalancheMigrationPayload.t.sol), [AaveV3Optimism](https://github.com/bgd-labs/chaos-agents-migration/blob/88bb6f3c4e043960f8cb42741ebe13c46c73b944/tests/payloads/OptimismMigrationPayload.t.sol), [AaveV3Arbitrum](https://github.com/bgd-labs/chaos-agents-migration/blob/88bb6f3c4e043960f8cb42741ebe13c46c73b944/tests/payloads/ArbitrumMigrationPayload.t.sol), [AaveV3Base](https://github.com/bgd-labs/chaos-agents-migration/blob/88bb6f3c4e043960f8cb42741ebe13c46c73b944/tests/payloads/BNBMigrationPayload.t.sol), [AaveV3Gnosis](https://github.com/bgd-labs/chaos-agents-migration/blob/88bb6f3c4e043960f8cb42741ebe13c46c73b944/tests/payloads/GnosisMigrationPayload.t.sol), [AaveV3BNB](https://github.com/bgd-labs/chaos-agents-migration/blob/88bb6f3c4e043960f8cb42741ebe13c46c73b944/tests/payloads/BNBMigrationPayload.t.sol), [AaveV3Linea](https://github.com/bgd-labs/chaos-agents-migration/blob/88bb6f3c4e043960f8cb42741ebe13c46c73b944/tests/payloads/LineaMigrationPayload.t.sol), [AaveV3Plasma](https://github.com/bgd-labs/chaos-agents-migration/blob/88bb6f3c4e043960f8cb42741ebe13c46c73b944/tests/payloads/PlasmaMigrationPayload.t.sol)
52+
- [Snapshot](https://snapshot.org/#/s:aavedao.eth/proposal/0x9795f1b7057d2780b3382b9f67f309fbfead98e7357a88df4c309dbbfefcbeb7)
53+
- [Discussion](https://governance.aave.com/t/arfc-chaos-risk-agents/23401)
54+
- Github: [Chaos Agents](https://github.com/ChaosLabsInc/chaos-agents)
55+
56+
## Copyright
57+
58+
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).

0 commit comments

Comments
 (0)