From 2a8d725e474bdf9ad9c30fe99a581b52d1a3bff5 Mon Sep 17 00:00:00 2001 From: efecarranza Date: Wed, 22 Jan 2025 12:23:17 -0500 Subject: [PATCH 1/4] feat: balancer claimer --- ...ncerToClaimMiningRewards_20250122_after.md | 5 ++ ...ncerToClaimMiningRewards_20250122_after.md | 5 ++ ...wBalancerToClaimMiningRewards_20250122.sol | 21 +++++ ...alancerToClaimMiningRewards_20250122.t.sol | 63 +++++++++++++ ...wBalancerToClaimMiningRewards_20250122.sol | 21 +++++ ...alancerToClaimMiningRewards_20250122.t.sol | 32 +++++++ .../AllowBalancerToClaimMiningRewards.md | 35 ++++++++ ...alancerToClaimMiningRewards_20250122.s.sol | 90 +++++++++++++++++++ .../config.ts | 19 ++++ 9 files changed, 291 insertions(+) create mode 100644 diffs/AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122_before_AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122_after.md create mode 100644 diffs/AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122_before_AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122_after.md create mode 100644 src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122.sol create mode 100644 src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122.t.sol create mode 100644 src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122.sol create mode 100644 src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122.t.sol create mode 100644 src/20250122_Multi_AllowBalancerToClaimMiningRewards/AllowBalancerToClaimMiningRewards.md create mode 100644 src/20250122_Multi_AllowBalancerToClaimMiningRewards/AllowBalancerToClaimMiningRewards_20250122.s.sol create mode 100644 src/20250122_Multi_AllowBalancerToClaimMiningRewards/config.ts diff --git a/diffs/AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122_before_AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122_after.md b/diffs/AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122_before_AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122_after.md new file mode 100644 index 000000000..c15d3e2bc --- /dev/null +++ b/diffs/AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122_before_AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122_after.md @@ -0,0 +1,5 @@ +## Raw diff + +```json +{} +``` \ No newline at end of file diff --git a/diffs/AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122_before_AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122_after.md b/diffs/AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122_before_AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122_after.md new file mode 100644 index 000000000..c15d3e2bc --- /dev/null +++ b/diffs/AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122_before_AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122_after.md @@ -0,0 +1,5 @@ +## Raw diff + +```json +{} +``` \ No newline at end of file diff --git a/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122.sol b/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122.sol new file mode 100644 index 000000000..c4186dd90 --- /dev/null +++ b/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122.sol @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {AaveV3Ethereum} from 'aave-address-book/AaveV3Ethereum.sol'; +import {IEmissionManager} from 'aave-v3-origin/contracts/rewards/interfaces/IEmissionManager.sol'; +import {IProposalGenericExecutor} from 'aave-helpers/src/interfaces/IProposalGenericExecutor.sol'; + +/** + * @title Allow Balancer To Claim Mining Rewards + * @author @TokenLogic, @BGDLabs + * - Snapshot: https://snapshot.org/#/s:aave.eth/proposal/0x054d40462303edd7e3a3c90b945a187e037cf412751631e9b01ba536acbdd40b + * - Discussion: https://governance.aave.com/t/arfc-whitelist-balancer-dao-to-claim-liquidity-mining-rewards/20653 + */ +contract AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122 is IProposalGenericExecutor { + address public immutable CLAIMER = 0x9ff471F9f98F42E5151C7855fD1b5aa906b1AF7e; + address public immutable BALANCER_VAULT = 0xbA1333333333a1BA1108E8412f11850A5C319bA9; + + function execute() external { + IEmissionManager(AaveV3Ethereum.EMISSION_MANAGER).setClaimer(BALANCER_VAULT, CLAIMER); + } +} diff --git a/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122.t.sol b/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122.t.sol new file mode 100644 index 000000000..6589eb8a7 --- /dev/null +++ b/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122.t.sol @@ -0,0 +1,63 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {AaveV3Ethereum, AaveV3EthereumAssets} from 'aave-address-book/AaveV3Ethereum.sol'; +import {AaveV3EthereumLidoAssets} from 'aave-address-book/AaveV3EthereumLido.sol'; +import {ProtocolV3TestBase, ReserveConfig} from 'aave-helpers/src/ProtocolV3TestBase.sol'; +import {IERC20AaveLM} from 'aave-v3-origin/contracts/extensions/stata-token/interfaces/IERC20AaveLM.sol'; + +import {AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122} from './AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122.sol'; + +/** + * @dev Test for AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122 + * command: FOUNDRY_PROFILE=mainnet forge test --match-path=src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122.t.sol -vv + */ +contract AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122_Test is ProtocolV3TestBase { + AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122 internal proposal; + + function setUp() public { + vm.createSelectFork(vm.rpcUrl('mainnet'), 21680887); + proposal = new AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122(); + } + + /** + * @dev executes the generic test suite including e2e and config snapshots + */ + function test_defaultProposalExecution() public { + defaultTest( + 'AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122', + AaveV3Ethereum.POOL, + address(proposal) + ); + + vm.startPrank(proposal.CLAIMER()); + address[] memory assets = new address[](1); + assets[0] = AaveV3EthereumLidoAssets.WETH_A_TOKEN; + IERC20AaveLM(AaveV3EthereumLidoAssets.WETH_STATA_TOKEN).claimRewardsOnBehalf( + proposal.BALANCER_VAULT(), + address(this), + assets + ); + + assets[0] = AaveV3EthereumLidoAssets.wstETH_A_TOKEN; + IERC20AaveLM(AaveV3EthereumLidoAssets.wstETH_STATA_TOKEN).claimRewardsOnBehalf( + proposal.BALANCER_VAULT(), + address(this), + assets + ); + + assets[0] = AaveV3EthereumAssets.USDS_A_TOKEN; + IERC20AaveLM(AaveV3EthereumAssets.USDS_STATA_TOKEN).claimRewardsOnBehalf( + proposal.BALANCER_VAULT(), + address(this), + assets + ); + + assets[0] = AaveV3EthereumAssets.USDS_A_TOKEN; + IERC20AaveLM(AaveV3EthereumAssets.USDS_STATA_TOKEN).claimRewardsOnBehalf( + proposal.BALANCER_VAULT(), + address(this), + assets + ); + } +} diff --git a/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122.sol b/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122.sol new file mode 100644 index 000000000..68decce3e --- /dev/null +++ b/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122.sol @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {AaveV3Gnosis} from 'aave-address-book/AaveV3Gnosis.sol'; +import {IEmissionManager} from 'aave-v3-origin/contracts/rewards/interfaces/IEmissionManager.sol'; +import {IProposalGenericExecutor} from 'aave-helpers/src/interfaces/IProposalGenericExecutor.sol'; + +/** + * @title Allow Balancer To Claim Mining Rewards + * @author @TokenLogic, @BGDLabs + * - Snapshot: https://snapshot.org/#/s:aave.eth/proposal/0x054d40462303edd7e3a3c90b945a187e037cf412751631e9b01ba536acbdd40b + * - Discussion: https://governance.aave.com/t/arfc-whitelist-balancer-dao-to-claim-liquidity-mining-rewards/20653 + */ +contract AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122 is IProposalGenericExecutor { + address public immutable CLAIMER = 0x9ff471F9f98F42E5151C7855fD1b5aa906b1AF7e; + address public immutable BALANCER_VAULT = 0xbA1333333333a1BA1108E8412f11850A5C319bA9; + + function execute() external { + IEmissionManager(AaveV3Gnosis.EMISSION_MANAGER).setClaimer(BALANCER_VAULT, CLAIMER); + } +} diff --git a/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122.t.sol b/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122.t.sol new file mode 100644 index 000000000..cd7503250 --- /dev/null +++ b/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122.t.sol @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {AaveV3Gnosis, AaveV3GnosisAssets} from 'aave-address-book/AaveV3Gnosis.sol'; +import {ProtocolV3TestBase, ReserveConfig} from 'aave-helpers/src/ProtocolV3TestBase.sol'; +import {IERC20AaveLM} from 'aave-v3-origin/contracts/extensions/stata-token/interfaces/IERC20AaveLM.sol'; + +import {AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122} from './AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122.sol'; + +/** + * @dev Test for AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122 + * command: FOUNDRY_PROFILE=gnosis forge test --match-path=src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122.t.sol -vv + */ +contract AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122_Test is ProtocolV3TestBase { + AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122 internal proposal; + + function setUp() public { + vm.createSelectFork(vm.rpcUrl('gnosis'), 38172377); + proposal = new AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122(); + } + + /** + * @dev executes the generic test suite including e2e and config snapshots + */ + function test_defaultProposalExecution() public { + defaultTest( + 'AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122', + AaveV3Gnosis.POOL, + address(proposal) + ); + } +} diff --git a/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AllowBalancerToClaimMiningRewards.md b/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AllowBalancerToClaimMiningRewards.md new file mode 100644 index 000000000..e9cba0a09 --- /dev/null +++ b/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AllowBalancerToClaimMiningRewards.md @@ -0,0 +1,35 @@ +--- +title: "Allow Balancer To Claim Mining Rewards" +author: "@TokenLogic, @BGDLabs" +discussions: "https://governance.aave.com/t/arfc-whitelist-balancer-dao-to-claim-liquidity-mining-rewards/20653" +snapshot: "https://snapshot.org/#/s:aave.eth/proposal/0x054d40462303edd7e3a3c90b945a187e037cf412751631e9b01ba536acbdd40b" +--- + +## Simple Summary + +This publication proposes allowing the Balancer DAO to claim liquidity mining rewards generated by Balancer v3 Boosted Pools through the Aave Protocol. + +## Motivation + +With the launch of Balancer v3, the new Boosted Pool type allocates some or all tokens to generate additional yield for liquidity providers, primarily through deposits into the Aave Protocol. Yield-bearing tokens can comprise 25% to 100% of a Boosted Pool's total liquidity. + +This proposal enables the Balancer DAO to retrieve liquidity mining rewards from Boosted Pools for redistribution to users and the DAO. + +To facilitate this, Aave Protocol’s claimOnBehalfOf function allows designated addresses to claim rewards on behalf of smart contracts. + +Without assigning a specific address as the contract owner, these rewards cannot be claimed, leaving them inaccessible. + +## Specification + +Set Balancer contract `0x9ff471F9f98F42E5151C7855fD1b5aa906b1AF7e` as the claimer (caller) on behalf of the Balancer v3 vault as the user `0xbA1333333333a1BA1108E8412f11850A5C319bA9`, on both Ethereum Core and Gnosis. + +## References + +- Implementation: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122.sol), [AaveV3Gnosis](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122.sol) +- Tests: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122.t.sol), [AaveV3Gnosis](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122.t.sol) +- [Snapshot](https://snapshot.org/#/s:aave.eth/proposal/0x054d40462303edd7e3a3c90b945a187e037cf412751631e9b01ba536acbdd40b) +- [Discussion](https://governance.aave.com/t/arfc-whitelist-balancer-dao-to-claim-liquidity-mining-rewards/20653) + +## Copyright + +Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). diff --git a/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AllowBalancerToClaimMiningRewards_20250122.s.sol b/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AllowBalancerToClaimMiningRewards_20250122.s.sol new file mode 100644 index 000000000..780f2d9ae --- /dev/null +++ b/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AllowBalancerToClaimMiningRewards_20250122.s.sol @@ -0,0 +1,90 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {GovV3Helpers, IPayloadsControllerCore, PayloadsControllerUtils} from 'aave-helpers/src/GovV3Helpers.sol'; +import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol'; +import {EthereumScript, GnosisScript} from 'solidity-utils/contracts/utils/ScriptUtils.sol'; +import {AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122} from './AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122.sol'; +import {AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122} from './AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122.sol'; + +/** + * @dev Deploy Ethereum + * deploy-command: make deploy-ledger contract=src/20250122_Multi_AllowBalancerToClaimMiningRewards/AllowBalancerToClaimMiningRewards_20250122.s.sol:DeployEthereum chain=mainnet + * verify-command: FOUNDRY_PROFILE=mainnet npx catapulta-verify -b broadcast/AllowBalancerToClaimMiningRewards_20250122.s.sol/1/run-latest.json + */ +contract DeployEthereum is EthereumScript { + function run() external broadcast { + // deploy payloads + address payload0 = GovV3Helpers.deployDeterministic( + type(AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122).creationCode + ); + + // compose action + IPayloadsControllerCore.ExecutionAction[] + memory actions = new IPayloadsControllerCore.ExecutionAction[](1); + actions[0] = GovV3Helpers.buildAction(payload0); + + // register action at payloadsController + GovV3Helpers.createPayload(actions); + } +} + +/** + * @dev Deploy Gnosis + * deploy-command: make deploy-ledger contract=src/20250122_Multi_AllowBalancerToClaimMiningRewards/AllowBalancerToClaimMiningRewards_20250122.s.sol:DeployGnosis chain=gnosis + * verify-command: FOUNDRY_PROFILE=gnosis npx catapulta-verify -b broadcast/AllowBalancerToClaimMiningRewards_20250122.s.sol/100/run-latest.json + */ +contract DeployGnosis is GnosisScript { + function run() external broadcast { + // deploy payloads + address payload0 = GovV3Helpers.deployDeterministic( + type(AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122).creationCode + ); + + // compose action + IPayloadsControllerCore.ExecutionAction[] + memory actions = new IPayloadsControllerCore.ExecutionAction[](1); + actions[0] = GovV3Helpers.buildAction(payload0); + + // register action at payloadsController + GovV3Helpers.createPayload(actions); + } +} + +/** + * @dev Create Proposal + * command: make deploy-ledger contract=src/20250122_Multi_AllowBalancerToClaimMiningRewards/AllowBalancerToClaimMiningRewards_20250122.s.sol:CreateProposal chain=mainnet + */ +contract CreateProposal is EthereumScript { + function run() external { + // create payloads + PayloadsControllerUtils.Payload[] memory payloads = new PayloadsControllerUtils.Payload[](2); + + // compose actions for validation + IPayloadsControllerCore.ExecutionAction[] + memory actionsEthereum = new IPayloadsControllerCore.ExecutionAction[](1); + actionsEthereum[0] = GovV3Helpers.buildAction( + type(AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122).creationCode + ); + payloads[0] = GovV3Helpers.buildMainnetPayload(vm, actionsEthereum); + + IPayloadsControllerCore.ExecutionAction[] + memory actionsGnosis = new IPayloadsControllerCore.ExecutionAction[](1); + actionsGnosis[0] = GovV3Helpers.buildAction( + type(AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122).creationCode + ); + payloads[1] = GovV3Helpers.buildGnosisPayload(vm, actionsGnosis); + + // create proposal + vm.startBroadcast(); + GovV3Helpers.createProposal( + vm, + payloads, + GovernanceV3Ethereum.VOTING_PORTAL_ETH_POL, + GovV3Helpers.ipfsHashFile( + vm, + 'src/20250122_Multi_AllowBalancerToClaimMiningRewards/AllowBalancerToClaimMiningRewards.md' + ) + ); + } +} diff --git a/src/20250122_Multi_AllowBalancerToClaimMiningRewards/config.ts b/src/20250122_Multi_AllowBalancerToClaimMiningRewards/config.ts new file mode 100644 index 000000000..065ccb58d --- /dev/null +++ b/src/20250122_Multi_AllowBalancerToClaimMiningRewards/config.ts @@ -0,0 +1,19 @@ +import {ConfigFile} from '../../generator/types'; +export const config: ConfigFile = { + rootOptions: { + pools: ['AaveV3Ethereum', 'AaveV3Gnosis'], + title: 'Allow Balancer To Claim Mining Rewards', + shortName: 'AllowBalancerToClaimMiningRewards', + date: '20250122', + author: '@TokenLogic, @BGDLabs', + discussion: + 'https://governance.aave.com/t/arfc-whitelist-balancer-dao-to-claim-liquidity-mining-rewards/20653', + snapshot: + 'https://snapshot.org/#/s:aave.eth/proposal/0x054d40462303edd7e3a3c90b945a187e037cf412751631e9b01ba536acbdd40b', + votingNetwork: 'POLYGON', + }, + poolOptions: { + AaveV3Ethereum: {configs: {OTHERS: {}}, cache: {blockNumber: 21680887}}, + AaveV3Gnosis: {configs: {OTHERS: {}}, cache: {blockNumber: 38172377}}, + }, +}; From a2e30273ea2b91a6e92c6a31a77995dc7e37b5e5 Mon Sep 17 00:00:00 2001 From: efecarranza Date: Thu, 23 Jan 2025 10:34:19 -0500 Subject: [PATCH 2/4] feat: add assertion to tests about controller --- ...ereum_AllowBalancerToClaimMiningRewards_20250122.t.sol | 8 ++++++++ ...nosis_AllowBalancerToClaimMiningRewards_20250122.t.sol | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122.t.sol b/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122.t.sol index 6589eb8a7..ee3b92d82 100644 --- a/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122.t.sol +++ b/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122.t.sol @@ -5,6 +5,7 @@ import {AaveV3Ethereum, AaveV3EthereumAssets} from 'aave-address-book/AaveV3Ethe import {AaveV3EthereumLidoAssets} from 'aave-address-book/AaveV3EthereumLido.sol'; import {ProtocolV3TestBase, ReserveConfig} from 'aave-helpers/src/ProtocolV3TestBase.sol'; import {IERC20AaveLM} from 'aave-v3-origin/contracts/extensions/stata-token/interfaces/IERC20AaveLM.sol'; +import {IRewardsController} from 'aave-v3-origin/contracts/rewards/interfaces/IRewardsController.sol'; import {AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122} from './AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122.sol'; @@ -30,6 +31,13 @@ contract AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122_Test is Proto address(proposal) ); + assertEq( + IRewardsController(AaveV3Ethereum.DEFAULT_INCENTIVES_CONTROLLER).getClaimer( + proposal.BALANCER_VAULT() + ), + proposal.CLAIMER() + ); + vm.startPrank(proposal.CLAIMER()); address[] memory assets = new address[](1); assets[0] = AaveV3EthereumLidoAssets.WETH_A_TOKEN; diff --git a/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122.t.sol b/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122.t.sol index cd7503250..c75ebaf37 100644 --- a/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122.t.sol +++ b/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122.t.sol @@ -4,6 +4,7 @@ pragma solidity ^0.8.0; import {AaveV3Gnosis, AaveV3GnosisAssets} from 'aave-address-book/AaveV3Gnosis.sol'; import {ProtocolV3TestBase, ReserveConfig} from 'aave-helpers/src/ProtocolV3TestBase.sol'; import {IERC20AaveLM} from 'aave-v3-origin/contracts/extensions/stata-token/interfaces/IERC20AaveLM.sol'; +import {IRewardsController} from 'aave-v3-origin/contracts/rewards/interfaces/IRewardsController.sol'; import {AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122} from './AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122.sol'; @@ -28,5 +29,12 @@ contract AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122_Test is Protoco AaveV3Gnosis.POOL, address(proposal) ); + + assertEq( + IRewardsController(AaveV3Gnosis.DEFAULT_INCENTIVES_CONTROLLER).getClaimer( + proposal.BALANCER_VAULT() + ), + proposal.CLAIMER() + ); } } From 1e1ded324b7c2bec918a9cc5711b03fcc956ac87 Mon Sep 17 00:00:00 2001 From: efecarranza Date: Wed, 29 Jan 2025 09:38:15 -0500 Subject: [PATCH 3/4] feat: use single payload with immutables --- ...wBalancerToClaimMiningRewards_20250122.sol | 21 --------------- ...alancerToClaimMiningRewards_20250122.t.sol | 13 +++++++--- ...alancerToClaimMiningRewards_20250122.t.sol | 13 +++++++--- ...BalancerToClaimMiningRewards_20250122.sol} | 16 ++++++++---- ...alancerToClaimMiningRewards_20250122.s.sol | 26 ++++++++++++++----- 5 files changed, 51 insertions(+), 38 deletions(-) delete mode 100644 src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122.sol rename src/20250122_Multi_AllowBalancerToClaimMiningRewards/{AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122.sol => AaveV3Multi_AllowBalancerToClaimMiningRewards_20250122.sol} (58%) diff --git a/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122.sol b/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122.sol deleted file mode 100644 index c4186dd90..000000000 --- a/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122.sol +++ /dev/null @@ -1,21 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -import {AaveV3Ethereum} from 'aave-address-book/AaveV3Ethereum.sol'; -import {IEmissionManager} from 'aave-v3-origin/contracts/rewards/interfaces/IEmissionManager.sol'; -import {IProposalGenericExecutor} from 'aave-helpers/src/interfaces/IProposalGenericExecutor.sol'; - -/** - * @title Allow Balancer To Claim Mining Rewards - * @author @TokenLogic, @BGDLabs - * - Snapshot: https://snapshot.org/#/s:aave.eth/proposal/0x054d40462303edd7e3a3c90b945a187e037cf412751631e9b01ba536acbdd40b - * - Discussion: https://governance.aave.com/t/arfc-whitelist-balancer-dao-to-claim-liquidity-mining-rewards/20653 - */ -contract AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122 is IProposalGenericExecutor { - address public immutable CLAIMER = 0x9ff471F9f98F42E5151C7855fD1b5aa906b1AF7e; - address public immutable BALANCER_VAULT = 0xbA1333333333a1BA1108E8412f11850A5C319bA9; - - function execute() external { - IEmissionManager(AaveV3Ethereum.EMISSION_MANAGER).setClaimer(BALANCER_VAULT, CLAIMER); - } -} diff --git a/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122.t.sol b/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122.t.sol index ee3b92d82..68d82b571 100644 --- a/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122.t.sol +++ b/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122.t.sol @@ -7,18 +7,25 @@ import {ProtocolV3TestBase, ReserveConfig} from 'aave-helpers/src/ProtocolV3Test import {IERC20AaveLM} from 'aave-v3-origin/contracts/extensions/stata-token/interfaces/IERC20AaveLM.sol'; import {IRewardsController} from 'aave-v3-origin/contracts/rewards/interfaces/IRewardsController.sol'; -import {AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122} from './AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122.sol'; +import {AaveV3Multi_AllowBalancerToClaimMiningRewards_20250122} from './AaveV3Multi_AllowBalancerToClaimMiningRewards_20250122.sol'; /** * @dev Test for AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122 * command: FOUNDRY_PROFILE=mainnet forge test --match-path=src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122.t.sol -vv */ contract AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122_Test is ProtocolV3TestBase { - AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122 internal proposal; + AaveV3Multi_AllowBalancerToClaimMiningRewards_20250122 internal proposal; + + address public constant CLAIMER = 0x9ff471F9f98F42E5151C7855fD1b5aa906b1AF7e; + address public constant BALANCER_VAULT = 0xbA1333333333a1BA1108E8412f11850A5C319bA9; function setUp() public { vm.createSelectFork(vm.rpcUrl('mainnet'), 21680887); - proposal = new AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122(); + proposal = new AaveV3Multi_AllowBalancerToClaimMiningRewards_20250122( + CLAIMER, + BALANCER_VAULT, + AaveV3Ethereum.EMISSION_MANAGER + ); } /** diff --git a/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122.t.sol b/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122.t.sol index c75ebaf37..12842ddf1 100644 --- a/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122.t.sol +++ b/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122.t.sol @@ -6,18 +6,25 @@ import {ProtocolV3TestBase, ReserveConfig} from 'aave-helpers/src/ProtocolV3Test import {IERC20AaveLM} from 'aave-v3-origin/contracts/extensions/stata-token/interfaces/IERC20AaveLM.sol'; import {IRewardsController} from 'aave-v3-origin/contracts/rewards/interfaces/IRewardsController.sol'; -import {AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122} from './AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122.sol'; +import {AaveV3Multi_AllowBalancerToClaimMiningRewards_20250122} from './AaveV3Multi_AllowBalancerToClaimMiningRewards_20250122.sol'; /** * @dev Test for AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122 * command: FOUNDRY_PROFILE=gnosis forge test --match-path=src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122.t.sol -vv */ contract AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122_Test is ProtocolV3TestBase { - AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122 internal proposal; + AaveV3Multi_AllowBalancerToClaimMiningRewards_20250122 internal proposal; + + address public constant CLAIMER = 0x9ff471F9f98F42E5151C7855fD1b5aa906b1AF7e; + address public constant BALANCER_VAULT = 0xbA1333333333a1BA1108E8412f11850A5C319bA9; function setUp() public { vm.createSelectFork(vm.rpcUrl('gnosis'), 38172377); - proposal = new AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122(); + proposal = new AaveV3Multi_AllowBalancerToClaimMiningRewards_20250122( + CLAIMER, + BALANCER_VAULT, + AaveV3Gnosis.EMISSION_MANAGER + ); } /** diff --git a/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122.sol b/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Multi_AllowBalancerToClaimMiningRewards_20250122.sol similarity index 58% rename from src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122.sol rename to src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Multi_AllowBalancerToClaimMiningRewards_20250122.sol index 68decce3e..4a09cd68c 100644 --- a/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122.sol +++ b/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Multi_AllowBalancerToClaimMiningRewards_20250122.sol @@ -1,7 +1,6 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {AaveV3Gnosis} from 'aave-address-book/AaveV3Gnosis.sol'; import {IEmissionManager} from 'aave-v3-origin/contracts/rewards/interfaces/IEmissionManager.sol'; import {IProposalGenericExecutor} from 'aave-helpers/src/interfaces/IProposalGenericExecutor.sol'; @@ -11,11 +10,18 @@ import {IProposalGenericExecutor} from 'aave-helpers/src/interfaces/IProposalGen * - Snapshot: https://snapshot.org/#/s:aave.eth/proposal/0x054d40462303edd7e3a3c90b945a187e037cf412751631e9b01ba536acbdd40b * - Discussion: https://governance.aave.com/t/arfc-whitelist-balancer-dao-to-claim-liquidity-mining-rewards/20653 */ -contract AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122 is IProposalGenericExecutor { - address public immutable CLAIMER = 0x9ff471F9f98F42E5151C7855fD1b5aa906b1AF7e; - address public immutable BALANCER_VAULT = 0xbA1333333333a1BA1108E8412f11850A5C319bA9; +contract AaveV3Multi_AllowBalancerToClaimMiningRewards_20250122 is IProposalGenericExecutor { + address public immutable CLAIMER; + address public immutable BALANCER_VAULT; + address public immutable EMISSION_MANAGER; + + constructor(address claimer, address vault, address manager) { + CLAIMER = claimer; + BALANCER_VAULT = vault; + EMISSION_MANAGER = manager; + } function execute() external { - IEmissionManager(AaveV3Gnosis.EMISSION_MANAGER).setClaimer(BALANCER_VAULT, CLAIMER); + IEmissionManager(EMISSION_MANAGER).setClaimer(BALANCER_VAULT, CLAIMER); } } diff --git a/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AllowBalancerToClaimMiningRewards_20250122.s.sol b/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AllowBalancerToClaimMiningRewards_20250122.s.sol index 780f2d9ae..0544acb98 100644 --- a/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AllowBalancerToClaimMiningRewards_20250122.s.sol +++ b/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AllowBalancerToClaimMiningRewards_20250122.s.sol @@ -1,11 +1,12 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; +import {AaveV3Ethereum} from 'aave-address-book/AaveV3Ethereum.sol'; +import {AaveV3Gnosis} from 'aave-address-book/AaveV3Gnosis.sol'; import {GovV3Helpers, IPayloadsControllerCore, PayloadsControllerUtils} from 'aave-helpers/src/GovV3Helpers.sol'; import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol'; import {EthereumScript, GnosisScript} from 'solidity-utils/contracts/utils/ScriptUtils.sol'; -import {AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122} from './AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122.sol'; -import {AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122} from './AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122.sol'; +import {AaveV3Multi_AllowBalancerToClaimMiningRewards_20250122} from './AaveV3Multi_AllowBalancerToClaimMiningRewards_20250122.sol'; /** * @dev Deploy Ethereum @@ -13,10 +14,14 @@ import {AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122} from './AaveV3G * verify-command: FOUNDRY_PROFILE=mainnet npx catapulta-verify -b broadcast/AllowBalancerToClaimMiningRewards_20250122.s.sol/1/run-latest.json */ contract DeployEthereum is EthereumScript { + address public constant CLAIMER = 0x9ff471F9f98F42E5151C7855fD1b5aa906b1AF7e; + address public constant BALANCER_VAULT = 0xbA1333333333a1BA1108E8412f11850A5C319bA9; + function run() external broadcast { // deploy payloads address payload0 = GovV3Helpers.deployDeterministic( - type(AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122).creationCode + type(AaveV3Multi_AllowBalancerToClaimMiningRewards_20250122).creationCode, + abi.encode(CLAIMER, BALANCER_VAULT, AaveV3Ethereum.EMISSION_MANAGER) ); // compose action @@ -35,10 +40,14 @@ contract DeployEthereum is EthereumScript { * verify-command: FOUNDRY_PROFILE=gnosis npx catapulta-verify -b broadcast/AllowBalancerToClaimMiningRewards_20250122.s.sol/100/run-latest.json */ contract DeployGnosis is GnosisScript { + address public constant CLAIMER = 0x9ff471F9f98F42E5151C7855fD1b5aa906b1AF7e; + address public constant BALANCER_VAULT = 0xbA1333333333a1BA1108E8412f11850A5C319bA9; + function run() external broadcast { // deploy payloads address payload0 = GovV3Helpers.deployDeterministic( - type(AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122).creationCode + type(AaveV3Multi_AllowBalancerToClaimMiningRewards_20250122).creationCode, + abi.encode(CLAIMER, BALANCER_VAULT, AaveV3Gnosis.EMISSION_MANAGER) ); // compose action @@ -56,6 +65,9 @@ contract DeployGnosis is GnosisScript { * command: make deploy-ledger contract=src/20250122_Multi_AllowBalancerToClaimMiningRewards/AllowBalancerToClaimMiningRewards_20250122.s.sol:CreateProposal chain=mainnet */ contract CreateProposal is EthereumScript { + address public constant CLAIMER = 0x9ff471F9f98F42E5151C7855fD1b5aa906b1AF7e; + address public constant BALANCER_VAULT = 0xbA1333333333a1BA1108E8412f11850A5C319bA9; + function run() external { // create payloads PayloadsControllerUtils.Payload[] memory payloads = new PayloadsControllerUtils.Payload[](2); @@ -64,14 +76,16 @@ contract CreateProposal is EthereumScript { IPayloadsControllerCore.ExecutionAction[] memory actionsEthereum = new IPayloadsControllerCore.ExecutionAction[](1); actionsEthereum[0] = GovV3Helpers.buildAction( - type(AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122).creationCode + type(AaveV3Multi_AllowBalancerToClaimMiningRewards_20250122).creationCode, + abi.encode(CLAIMER, BALANCER_VAULT, AaveV3Ethereum.EMISSION_MANAGER) ); payloads[0] = GovV3Helpers.buildMainnetPayload(vm, actionsEthereum); IPayloadsControllerCore.ExecutionAction[] memory actionsGnosis = new IPayloadsControllerCore.ExecutionAction[](1); actionsGnosis[0] = GovV3Helpers.buildAction( - type(AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122).creationCode + type(AaveV3Multi_AllowBalancerToClaimMiningRewards_20250122).creationCode, + abi.encode(CLAIMER, BALANCER_VAULT, AaveV3Gnosis.EMISSION_MANAGER) ); payloads[1] = GovV3Helpers.buildGnosisPayload(vm, actionsGnosis); From 3a5b2572487c38afc260719bda1c9d36ef6b183b Mon Sep 17 00:00:00 2001 From: Fermin 'Piscu' Carranza Date: Thu, 30 Jan 2025 12:38:40 -0500 Subject: [PATCH 4/4] Update src/20250122_Multi_AllowBalancerToClaimMiningRewards/AllowBalancerToClaimMiningRewards.md Co-authored-by: Ian Flexa <85500650+ianflexa@users.noreply.github.com> --- .../AllowBalancerToClaimMiningRewards.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AllowBalancerToClaimMiningRewards.md b/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AllowBalancerToClaimMiningRewards.md index e9cba0a09..8ebcd208f 100644 --- a/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AllowBalancerToClaimMiningRewards.md +++ b/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AllowBalancerToClaimMiningRewards.md @@ -25,7 +25,7 @@ Set Balancer contract `0x9ff471F9f98F42E5151C7855fD1b5aa906b1AF7e` as the claime ## References -- Implementation: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122.sol), [AaveV3Gnosis](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122.sol) +- Implementation: [AaveV3Multi](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Multi_AllowBalancerToClaimMiningRewards_20250122.sol) - Tests: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Ethereum_AllowBalancerToClaimMiningRewards_20250122.t.sol), [AaveV3Gnosis](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20250122_Multi_AllowBalancerToClaimMiningRewards/AaveV3Gnosis_AllowBalancerToClaimMiningRewards_20250122.t.sol) - [Snapshot](https://snapshot.org/#/s:aave.eth/proposal/0x054d40462303edd7e3a3c90b945a187e037cf412751631e9b01ba536acbdd40b) - [Discussion](https://governance.aave.com/t/arfc-whitelist-balancer-dao-to-claim-liquidity-mining-rewards/20653)