From db4267762284d86c3d5a9ebc5a0a3fa552804466 Mon Sep 17 00:00:00 2001 From: eboado Date: Thu, 25 Jan 2024 05:01:04 +0100 Subject: [PATCH] aip: proposal for Immunefi January 2024 payout --- ...estForBountyPayoutJanuary2024_20240125.sol | 51 +++++++++++++++ ...tForBountyPayoutJanuary2024_20240125.t.sol | 63 +++++++++++++++++++ .../RequestForBountyPayoutJanuary2024.md | 37 +++++++++++ ...tForBountyPayoutJanuary2024_20240125.s.sol | 58 +++++++++++++++++ .../config.ts | 13 ++++ 5 files changed, 222 insertions(+) create mode 100644 src/20240125_AaveV3Ethereum_RequestForBountyPayoutJanuary2024/AaveV3Ethereum_RequestForBountyPayoutJanuary2024_20240125.sol create mode 100644 src/20240125_AaveV3Ethereum_RequestForBountyPayoutJanuary2024/AaveV3Ethereum_RequestForBountyPayoutJanuary2024_20240125.t.sol create mode 100644 src/20240125_AaveV3Ethereum_RequestForBountyPayoutJanuary2024/RequestForBountyPayoutJanuary2024.md create mode 100644 src/20240125_AaveV3Ethereum_RequestForBountyPayoutJanuary2024/RequestForBountyPayoutJanuary2024_20240125.s.sol create mode 100644 src/20240125_AaveV3Ethereum_RequestForBountyPayoutJanuary2024/config.ts diff --git a/src/20240125_AaveV3Ethereum_RequestForBountyPayoutJanuary2024/AaveV3Ethereum_RequestForBountyPayoutJanuary2024_20240125.sol b/src/20240125_AaveV3Ethereum_RequestForBountyPayoutJanuary2024/AaveV3Ethereum_RequestForBountyPayoutJanuary2024_20240125.sol new file mode 100644 index 000000000..c5f28f0eb --- /dev/null +++ b/src/20240125_AaveV3Ethereum_RequestForBountyPayoutJanuary2024/AaveV3Ethereum_RequestForBountyPayoutJanuary2024_20240125.sol @@ -0,0 +1,51 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol'; +import {AaveV2Ethereum, AaveV2EthereumAssets} from 'aave-address-book/AaveV2Ethereum.sol'; + +/** + * @title Request for Bounty Payout - January 2024 + * @author BGD Labs @bgdlabs + * - Snapshot: N/A + * - Discussion: https://governance.aave.com/t/bgd-request-for-bounty-payout-january-2024/16378 + */ +contract AaveV3Ethereum_RequestForBountyPayoutJanuary2024_20240125 is IProposalGenericExecutor { + // Used for both bounties and Immunefi fees + struct Bounty { + address asset; + address recipient; + uint256 amount; + } + + function execute() external { + Bounty[3] memory bounties = getBounties(); + for (uint256 i = 0; i < bounties.length; i++) { + AaveV2Ethereum.COLLECTOR.transfer( + bounties[i].asset, + bounties[i].recipient, + bounties[i].amount + ); + } + } + + function getBounties() public pure returns (Bounty[3] memory) { + return [ + Bounty({ + asset: AaveV2EthereumAssets.USDC_A_TOKEN, + recipient: 0x8689e84af34A18Bc461928aa554a71C649beED89, + amount: 5_000e6 + }), + Bounty({ + asset: AaveV2EthereumAssets.USDC_A_TOKEN, + recipient: 0xD122c282499Cb6A76197db2D6ba5170D81C4895f, + amount: 10_000e6 + }), + Bounty({ + asset: AaveV2EthereumAssets.USDC_A_TOKEN, + recipient: 0x2BC5fFc5De1a83a9e4cDDfA138bAEd516D70414b, + amount: 1_000e6 + }) + ]; + } +} diff --git a/src/20240125_AaveV3Ethereum_RequestForBountyPayoutJanuary2024/AaveV3Ethereum_RequestForBountyPayoutJanuary2024_20240125.t.sol b/src/20240125_AaveV3Ethereum_RequestForBountyPayoutJanuary2024/AaveV3Ethereum_RequestForBountyPayoutJanuary2024_20240125.t.sol new file mode 100644 index 000000000..fe541bd79 --- /dev/null +++ b/src/20240125_AaveV3Ethereum_RequestForBountyPayoutJanuary2024/AaveV3Ethereum_RequestForBountyPayoutJanuary2024_20240125.t.sol @@ -0,0 +1,63 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import 'forge-std/Test.sol'; +import {IERC20} from 'solidity-utils/contracts/oz-common/interfaces/IERC20.sol'; +import {AaveV2Ethereum, AaveV2EthereumAssets} from 'aave-address-book/AaveV2Ethereum.sol'; +import {CommonTestBase} from 'aave-helpers/CommonTestBase.sol'; +import {AaveV3Ethereum_RequestForBountyPayoutJanuary2024_20240125} from './AaveV3Ethereum_RequestForBountyPayoutJanuary2024_20240125.sol'; + +/** + * @dev Test for AaveV3Ethereum_RequestForBountyPayoutJanuary2024_20240125 + * command: make test-contract filter=AaveV3Ethereum_RequestForBountyPayoutJanuary2024_20240125 + */ +contract AaveV3Ethereum_RequestForBountyPayoutJanuary2024_20240125_Test is CommonTestBase { + AaveV3Ethereum_RequestForBountyPayoutJanuary2024_20240125 internal proposal; + + uint256 TOTAL_AMOUNT = 16_000e6; + + function setUp() public { + vm.createSelectFork(vm.rpcUrl('mainnet'), 19081060); + proposal = new AaveV3Ethereum_RequestForBountyPayoutJanuary2024_20240125(); + } + + /** + * @dev Checking: + * - Balances post-transfer are correct + * - Collector has enough funds + */ + function test_consistentBalances() public { + AaveV3Ethereum_RequestForBountyPayoutJanuary2024_20240125.Bounty[3] memory bounties = proposal + .getBounties(); + + uint256[] memory balancesRecipientsBefore = new uint256[](3); + uint256 balanceCollectorBefore = IERC20(AaveV2EthereumAssets.USDC_A_TOKEN).balanceOf( + address(AaveV2Ethereum.COLLECTOR) + ); + + // Validate the Collector has enough aUSDC v2 + assertGe(balanceCollectorBefore, TOTAL_AMOUNT); + + for (uint256 i = 0; i < bounties.length; i++) { + balancesRecipientsBefore[i] = IERC20(AaveV2EthereumAssets.USDC_A_TOKEN).balanceOf( + bounties[i].recipient + ); + } + + executePayload(vm, address(proposal)); + + for (uint256 i = 0; i < bounties.length; i++) { + assertApproxEqAbs( + IERC20(AaveV2EthereumAssets.USDC_A_TOKEN).balanceOf(bounties[i].recipient), + balancesRecipientsBefore[i] + bounties[i].amount, + 1 + ); + } + + uint256 balanceCollectorAfter = IERC20(AaveV2EthereumAssets.USDC_A_TOKEN).balanceOf( + address(AaveV2Ethereum.COLLECTOR) + ); + // Checking worst case scenario of 3 wei imprecision, but probabilistically pretty rare + assertApproxEqAbs(balanceCollectorAfter, balanceCollectorBefore - TOTAL_AMOUNT, 3); + } +} diff --git a/src/20240125_AaveV3Ethereum_RequestForBountyPayoutJanuary2024/RequestForBountyPayoutJanuary2024.md b/src/20240125_AaveV3Ethereum_RequestForBountyPayoutJanuary2024/RequestForBountyPayoutJanuary2024.md new file mode 100644 index 000000000..bcaf7757a --- /dev/null +++ b/src/20240125_AaveV3Ethereum_RequestForBountyPayoutJanuary2024/RequestForBountyPayoutJanuary2024.md @@ -0,0 +1,37 @@ +--- +title: "Request for Bounty Payout - January 2024" +author: "BGD Labs @bgdlabs" +discussions: "https://governance.aave.com/t/bgd-request-for-bounty-payout-january-2024/16378" +--- + +## Simple Summary + +Proposal to release a grand total of 16’000 USDC, for periodic Aave <> Immunefi bounty payouts and Immunefi fee. + +## Motivation + +As disclosed in [this post](https://governance.aave.com/t/bgd-aave-immunefi-request-for-bounty-payouts/15751), we think it is appropriate to split bug bounty payouts from disclosure and fix stages, for Low, Medium and High reports. +The objectives are not creating unnecessary interdependencies, and keep a healthy and frequent payment schedule for white-hats participating securing Aave. + +## Specification + +This proposal, will release the following funds to white-hat addresses and the Immunefi platform, from the Aave Ethereum Collector: + +- $5’000 to `0x8689e84af34A18Bc461928aa554a71C649beED89`. + +- $10’000 to `0xD122c282499Cb6A76197db2D6ba5170D81C4895f`. + +- $1'000 to `0x2BC5fFc5De1a83a9e4cDDfA138bAEd516D70414b` (immunefi.eth). This is the fee corresponding to the 10% of the previous bounty only, as the extra $500 for the first one have already been paid in the round of December 2023. + +After checking with a financial contributor to the DAO (TokenLogic & Karpatkey), _the asset used for the transfers is aUSDC v2 Ethereum_. + +## References + +- Implementation: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240125_AaveV3Ethereum_RequestForBountyPayoutJanuary2024/AaveV3Ethereum_RequestForBountyPayoutJanuary2024_20240125.sol) +- Tests: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240125_AaveV3Ethereum_RequestForBountyPayoutJanuary2024/AaveV3Ethereum_RequestForBountyPayoutJanuary2024_20240125.t.sol) +- [Snapshot](N/A) +- [Discussion](https://governance.aave.com/t/bgd-request-for-bounty-payout-january-2024/16378) + +## Copyright + +Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). diff --git a/src/20240125_AaveV3Ethereum_RequestForBountyPayoutJanuary2024/RequestForBountyPayoutJanuary2024_20240125.s.sol b/src/20240125_AaveV3Ethereum_RequestForBountyPayoutJanuary2024/RequestForBountyPayoutJanuary2024_20240125.s.sol new file mode 100644 index 000000000..ea9c49bb7 --- /dev/null +++ b/src/20240125_AaveV3Ethereum_RequestForBountyPayoutJanuary2024/RequestForBountyPayoutJanuary2024_20240125.s.sol @@ -0,0 +1,58 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {GovV3Helpers, IPayloadsControllerCore, PayloadsControllerUtils} from 'aave-helpers/GovV3Helpers.sol'; +import {EthereumScript} from 'aave-helpers/ScriptUtils.sol'; +import {AaveV3Ethereum_RequestForBountyPayoutJanuary2024_20240125} from './AaveV3Ethereum_RequestForBountyPayoutJanuary2024_20240125.sol'; + +/** + * @dev Deploy Ethereum + * deploy-command: make deploy-ledger contract=src/20240125_AaveV3Ethereum_RequestForBountyPayoutJanuary2024/RequestForBountyPayoutJanuary2024_20240125.s.sol:DeployEthereum chain=mainnet + * verify-command: npx catapulta-verify -b broadcast/RequestForBountyPayoutJanuary2024_20240125.s.sol/1/run-latest.json + */ +contract DeployEthereum is EthereumScript { + function run() external broadcast { + // deploy payloads + address payload0 = GovV3Helpers.deployDeterministic( + type(AaveV3Ethereum_RequestForBountyPayoutJanuary2024_20240125).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/20240125_AaveV3Ethereum_RequestForBountyPayoutJanuary2024/RequestForBountyPayoutJanuary2024_20240125.s.sol:CreateProposal chain=mainnet + */ +contract CreateProposal is EthereumScript { + function run() external { + // create payloads + PayloadsControllerUtils.Payload[] memory payloads = new PayloadsControllerUtils.Payload[](1); + + // compose actions for validation + IPayloadsControllerCore.ExecutionAction[] + memory actionsEthereum = new IPayloadsControllerCore.ExecutionAction[](1); + actionsEthereum[0] = GovV3Helpers.buildAction( + type(AaveV3Ethereum_RequestForBountyPayoutJanuary2024_20240125).creationCode + ); + payloads[0] = GovV3Helpers.buildMainnetPayload(vm, actionsEthereum); + + // create proposal + vm.startBroadcast(); + GovV3Helpers.createProposal( + vm, + payloads, + GovV3Helpers.ipfsHashFile( + vm, + 'src/20240125_AaveV3Ethereum_RequestForBountyPayoutJanuary2024/RequestForBountyPayoutJanuary2024.md' + ) + ); + } +} diff --git a/src/20240125_AaveV3Ethereum_RequestForBountyPayoutJanuary2024/config.ts b/src/20240125_AaveV3Ethereum_RequestForBountyPayoutJanuary2024/config.ts new file mode 100644 index 000000000..2c87ebe26 --- /dev/null +++ b/src/20240125_AaveV3Ethereum_RequestForBountyPayoutJanuary2024/config.ts @@ -0,0 +1,13 @@ +import {ConfigFile} from '../../generator/types'; +export const config: ConfigFile = { + rootOptions: { + pools: ['AaveV3Ethereum'], + title: 'Request for Bounty Payout - January 2024', + shortName: 'RequestForBountyPayoutJanuary2024', + date: '20240125', + author: 'BGD Labs @bgdlabs', + discussion: 'https://governance.aave.com/t/bgd-request-for-bounty-payout-january-2024/16378', + snapshot: 'N/A', + }, + poolOptions: {AaveV3Ethereum: {configs: {OTHERS: {}}, cache: {blockNumber: 19080922}}}, +};