Skip to content

Commit

Permalink
feat: balancer claimer
Browse files Browse the repository at this point in the history
  • Loading branch information
efecarranza committed Jan 22, 2025
1 parent e925716 commit 2a8d725
Show file tree
Hide file tree
Showing 9 changed files with 291 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Raw diff

```json
{}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Raw diff

```json
{}
```
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -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
);
}
}
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -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)
);
}
}
Original file line number Diff line number Diff line change
@@ -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/).
Original file line number Diff line number Diff line change
@@ -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'
)
);
}
}
19 changes: 19 additions & 0 deletions src/20250122_Multi_AllowBalancerToClaimMiningRewards/config.ts
Original file line number Diff line number Diff line change
@@ -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}},
},
};

0 comments on commit 2a8d725

Please sign in to comment.