generated from bgd-labs/bgd-forge-template
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
aip: proposal for Immunefi January 2024 payout
- Loading branch information
Showing
5 changed files
with
222 additions
and
0 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
...tForBountyPayoutJanuary2024/AaveV3Ethereum_RequestForBountyPayoutJanuary2024_20240125.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
}) | ||
]; | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
...orBountyPayoutJanuary2024/AaveV3Ethereum_RequestForBountyPayoutJanuary2024_20240125.t.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...Ethereum_RequestForBountyPayoutJanuary2024/RequestForBountyPayoutJanuary2024.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/). |
58 changes: 58 additions & 0 deletions
58
...hereum_RequestForBountyPayoutJanuary2024/RequestForBountyPayoutJanuary2024_20240125.s.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' | ||
) | ||
); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/20240125_AaveV3Ethereum_RequestForBountyPayoutJanuary2024/config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}}}, | ||
}; |