Skip to content

Commit

Permalink
Merge branch 'bgd-labs:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
marczeller authored Apr 17, 2024
2 parents ed69689 + de4decd commit 8268dd8
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 143 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ contract AaveV3Scroll_AaveV3ScrollActivation_20240122_Test is ProtocolV3TestBase
address constant NULL_ADDRESS = 0x000000000000000000000000000000000000dEaD;

function setUp() public {
vm.createSelectFork(vm.rpcUrl('scroll'), 2675703);
vm.createSelectFork(vm.rpcUrl('scroll'), 3196632);
proposal = new AaveV3Scroll_AaveV3ScrollActivation_20240122();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,20 @@ pragma solidity ^0.8.0;

import {AaveV2Ethereum, AaveV2EthereumAssets} from 'aave-address-book/AaveV2Ethereum.sol';
import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol';
import {IERC20} from 'solidity-utils/contracts/oz-common/interfaces/IERC20.sol';
import {SafeCast} from 'solidity-utils/contracts/oz-common/SafeCast.sol';
import {SafeERC20} from 'solidity-utils/contracts/oz-common/SafeERC20.sol';
import {IAaveCLRobotOperator} from './interfaces/IAaveCLRobotOperator.sol';

/**
* @title Security Budget Request Dec 23 and Robot Refill
* @title Security Budget Request December 2023
* @author BGD Labs @bgdlabs
* - Snapshot: https://snapshot.org/#/aave.eth/proposal/0xf95bc210e3e93c2112c694cb158db22c93504155b48c03d9358e4c41c33ee782
* - Discussion: https://governance.aave.com/t/arfc-bgd-security-budget-request-december-2023/15783
*/
contract AaveV3Ethereum_SecurityBudgetRequestDec23AndRobotRefill_20240411 is
IProposalGenericExecutor
{
using SafeERC20 for IERC20;
using SafeCast for uint256;

address public constant BGD_RECIPIENT = 0xb812d0944f8F581DfAA3a93Dda0d22EcEf51A9CF;
uint256 public constant USDC_AMOUNT_REIMBURSEMENT = 42_000e6;
uint256 public constant USDT_AMOUNT_REIMBURSEMENT = 109_200e6;
uint256 public constant LINK_AMOUNT_REIMBURSEMENT = 1640 ether;
uint256 public constant LINK_AMOUNT_ROBOT_1_REFILL = 500 ether; // ROBOT_1: Execution Chain Aave Robot
uint256 public constant LINK_AMOUNT_ROBOT_2_REFILL = 500 ether; // ROBOT_2: Governance Chain Aave Robot

address public constant ROBOT_OPERATOR = 0x020E452b463568f55BAc6Dc5aFC8F0B62Ea5f0f3;
uint256 public constant ROBOT_1_ID =
103962992988872542945147446194468190544109628047207929929141163121857186570465; // Chainlink Automation Id of Execution Chain Aave Robot
uint256 public constant ROBOT_2_ID =
2651260633509968244842245718659958660539758109819220392919944208741153930322; // Chainlink Automation Id of Governance Chain Aave Robot

function execute() external {
AaveV2Ethereum.COLLECTOR.transfer(
Expand All @@ -49,29 +34,5 @@ contract AaveV3Ethereum_SecurityBudgetRequestDec23AndRobotRefill_20240411 is
BGD_RECIPIENT,
LINK_AMOUNT_REIMBURSEMENT
);

// refill aave robot
AaveV2Ethereum.COLLECTOR.transfer(
AaveV2EthereumAssets.LINK_A_TOKEN,
address(this),
LINK_AMOUNT_ROBOT_1_REFILL + LINK_AMOUNT_ROBOT_2_REFILL
);
AaveV2Ethereum.POOL.withdraw(
AaveV2EthereumAssets.LINK_UNDERLYING,
type(uint256).max,
address(this)
);

uint256 linkBalance = IERC20(AaveV2EthereumAssets.LINK_UNDERLYING).balanceOf(address(this));
IERC20(AaveV2EthereumAssets.LINK_UNDERLYING).forceApprove(ROBOT_OPERATOR, linkBalance);

IAaveCLRobotOperator(ROBOT_OPERATOR).refillKeeper(
ROBOT_1_ID,
(LINK_AMOUNT_ROBOT_1_REFILL).toUint96()
);
IAaveCLRobotOperator(ROBOT_OPERATOR).refillKeeper(
ROBOT_2_ID,
(linkBalance - LINK_AMOUNT_ROBOT_1_REFILL).toUint96()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ pragma solidity ^0.8.0;

import {AaveV3Ethereum} from 'aave-address-book/AaveV3Ethereum.sol';
import {AaveV2EthereumAssets} from 'aave-address-book/AaveV2Ethereum.sol';
import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol';

import {ProtocolV3TestBase} from 'aave-helpers/ProtocolV3TestBase.sol';
import {AaveV3Ethereum_SecurityBudgetRequestDec23AndRobotRefill_20240411} from './AaveV3Ethereum_SecurityBudgetRequestDec23AndRobotRefill_20240411.sol';
Expand All @@ -18,8 +17,6 @@ contract AaveV3Ethereum_SecurityBudgetRequestDec23AndRobotRefill_20240411_Test i
{
AaveV3Ethereum_SecurityBudgetRequestDec23AndRobotRefill_20240411 internal proposal;

event KeeperRefilled(uint256 indexed id, address indexed from, uint96 indexed amount);

function setUp() public {
vm.createSelectFork(vm.rpcUrl('mainnet'), 19631594);
proposal = new AaveV3Ethereum_SecurityBudgetRequestDec23AndRobotRefill_20240411();
Expand Down Expand Up @@ -47,20 +44,6 @@ contract AaveV3Ethereum_SecurityBudgetRequestDec23AndRobotRefill_20240411_Test i
address(AaveV3Ethereum.COLLECTOR)
);

// Validate the Collector has enough aUSDC v2
assertGe(collectorAUsdcBalanceBefore, proposal.USDC_AMOUNT_REIMBURSEMENT());

// Validate the Collector has enough aUSDT v2
assertGe(collectorAUsdtBalanceBefore, proposal.USDT_AMOUNT_REIMBURSEMENT());

// Validate the Collector has enough aLINK v2
assertGe(
collectorALinkBalanceBefore,
proposal.LINK_AMOUNT_ROBOT_1_REFILL() +
proposal.LINK_AMOUNT_ROBOT_2_REFILL() +
proposal.LINK_AMOUNT_REIMBURSEMENT()
);

uint256 recipientAUsdcBalanceBefore = IERC20(AaveV2EthereumAssets.USDC_A_TOKEN).balanceOf(
proposal.BGD_RECIPIENT()
);
Expand Down Expand Up @@ -119,33 +102,11 @@ contract AaveV3Ethereum_SecurityBudgetRequestDec23AndRobotRefill_20240411_Test i
collectorAUsdtBalanceBefore - proposal.USDT_AMOUNT_REIMBURSEMENT(),
3
);

// high delta is because when withdrawing LINK from collector on aave v2, the state update causes claiming rewards to treasury
assertApproxEqAbs(
collectorALinkBalanceAfter,
collectorALinkBalanceBefore -
(proposal.LINK_AMOUNT_REIMBURSEMENT() +
proposal.LINK_AMOUNT_ROBOT_1_REFILL() +
proposal.LINK_AMOUNT_ROBOT_2_REFILL()),
collectorALinkBalanceBefore - proposal.LINK_AMOUNT_REIMBURSEMENT(),
0.3 ether
);
}

function test_robot_refilled() public {
vm.expectEmit();
emit KeeperRefilled(
proposal.ROBOT_1_ID(),
GovernanceV3Ethereum.EXECUTOR_LVL_1,
uint96(proposal.LINK_AMOUNT_ROBOT_1_REFILL())
);

vm.expectEmit();
emit KeeperRefilled(
proposal.ROBOT_2_ID(),
GovernanceV3Ethereum.EXECUTOR_LVL_1,
uint96(proposal.LINK_AMOUNT_ROBOT_2_REFILL())
);

executePayload(vm, address(proposal));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,18 @@ import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGeneric
import {AaveV2Polygon, AaveV2PolygonAssets} from 'aave-address-book/AaveV2Polygon.sol';

/**
* @title Security Budget Request Dec 23 and Robot Refill
* @title Security Budget Request December 2023
* @author BGD Labs @bgdlabs
* - Snapshot: https://snapshot.org/#/aave.eth/proposal/0xf95bc210e3e93c2112c694cb158db22c93504155b48c03d9358e4c41c33ee782
* - Discussion: https://governance.aave.com/t/arfc-bgd-security-budget-request-december-2023/15783
*/
contract AaveV3Polygon_SecurityBudgetRequestDec23AndRobotRefill_20240411 is
IProposalGenericExecutor
{
uint256 public constant WMATIC_AMOUNT_REIMBURSEMENT = 3500 ether;
uint256 public constant A_WMATIC_AMOUNT_REIMBURSEMENT = 500 ether;
uint256 public constant A_WMATIC_AMOUNT_REIMBURSEMENT = 4000 ether;
address public constant BGD_RECIPIENT = 0xbCEB4f363f2666E2E8E430806F37e97C405c130b;

function execute() external {
AaveV2Polygon.COLLECTOR.transfer(
AaveV2PolygonAssets.WMATIC_UNDERLYING,
BGD_RECIPIENT,
WMATIC_AMOUNT_REIMBURSEMENT
);
AaveV2Polygon.COLLECTOR.transfer(
AaveV2PolygonAssets.WMATIC_A_TOKEN,
BGD_RECIPIENT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ contract AaveV3Polygon_SecurityBudgetRequestDec23AndRobotRefill_20240411_Test is
AaveV3Polygon_SecurityBudgetRequestDec23AndRobotRefill_20240411 internal proposal;

function setUp() public {
vm.createSelectFork(vm.rpcUrl('polygon'), 55697469);
vm.createSelectFork(vm.rpcUrl('polygon'), 55891985);
proposal = new AaveV3Polygon_SecurityBudgetRequestDec23AndRobotRefill_20240411();
}

Expand All @@ -37,59 +37,29 @@ contract AaveV3Polygon_SecurityBudgetRequestDec23AndRobotRefill_20240411_Test is
uint256 collectorAWmaticBalanceBefore = IERC20(AaveV2PolygonAssets.WMATIC_A_TOKEN).balanceOf(
address(AaveV3Polygon.COLLECTOR)
);
uint256 collectorWmaticBalanceBefore = IERC20(AaveV2PolygonAssets.WMATIC_UNDERLYING).balanceOf(
address(AaveV3Polygon.COLLECTOR)
);

// Validate the Collector has enough aWMatic v2
assertGe(collectorAWmaticBalanceBefore, proposal.A_WMATIC_AMOUNT_REIMBURSEMENT());

// Validate the Collector has enough WMATIC
assertGe(collectorWmaticBalanceBefore, proposal.WMATIC_AMOUNT_REIMBURSEMENT());

uint256 recipientAWmaticBalanceBefore = IERC20(AaveV2PolygonAssets.WMATIC_A_TOKEN).balanceOf(
proposal.BGD_RECIPIENT()
);
uint256 recipientWmaticBalanceBefore = IERC20(AaveV2PolygonAssets.WMATIC_UNDERLYING).balanceOf(
proposal.BGD_RECIPIENT()
);

executePayload(vm, address(proposal));

uint256 recipientAWmaticBalanceAfter = IERC20(AaveV2PolygonAssets.WMATIC_A_TOKEN).balanceOf(
proposal.BGD_RECIPIENT()
);
uint256 recipientWmaticBalanceAfter = IERC20(AaveV2PolygonAssets.WMATIC_UNDERLYING).balanceOf(
proposal.BGD_RECIPIENT()
uint256 collectorAWmaticBalanceAfter = IERC20(AaveV2PolygonAssets.WMATIC_A_TOKEN).balanceOf(
address(AaveV3Polygon.COLLECTOR)
);

assertApproxEqAbs(
recipientAWmaticBalanceAfter,
recipientAWmaticBalanceBefore + proposal.A_WMATIC_AMOUNT_REIMBURSEMENT(),
1
);
assertApproxEqAbs(
recipientWmaticBalanceAfter,
recipientWmaticBalanceBefore + proposal.WMATIC_AMOUNT_REIMBURSEMENT(),
1
);

uint256 collectorAWmaticBalanceAfter = IERC20(AaveV2PolygonAssets.WMATIC_A_TOKEN).balanceOf(
address(AaveV3Polygon.COLLECTOR)
);
uint256 collectorWmaticBalanceAfter = IERC20(AaveV2PolygonAssets.WMATIC_UNDERLYING).balanceOf(
address(AaveV3Polygon.COLLECTOR)
);

assertApproxEqAbs(
collectorAWmaticBalanceAfter,
collectorAWmaticBalanceBefore - proposal.A_WMATIC_AMOUNT_REIMBURSEMENT(),
3
);
assertApproxEqAbs(
collectorWmaticBalanceAfter,
collectorWmaticBalanceBefore - proposal.WMATIC_AMOUNT_REIMBURSEMENT(),
3
);
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
title: "Security Budget Request Dec 23 and Robot Refill"
title: "Security Budget Request December 2023"
author: "BGD Labs @bgdlabs"
discussions: "https://governance.aave.com/t/arfc-bgd-security-budget-request-december-2023/15783"
snapshot: "https://snapshot.org/#/aave.eth/proposal/0xf95bc210e3e93c2112c694cb158db22c93504155b48c03d9358e4c41c33ee782"
---

## Simple Summary

Proposal to release $151’200 to reimburse BGD Labs for the costs paid towards external security reviews, and 1640 LINK and 4000 MATIC towards the refill of Aave Robot and Aave Delivery Infrastructure. The proposal also refills the Aave Robots with 1000 LINK for future usages.
Proposal to release $151’200 to reimburse BGD Labs for the costs paid towards external security reviews, and 1640 LINK and 4000 MATIC towards the refill of Aave Robot and Aave Delivery Infrastructure.

## Motivation

Expand All @@ -29,26 +29,21 @@ Considering all the above amounts already paid by BGD, we request the following

- Compensation regarding past refills on Aave Robot: 1640 LINK, 4000 MATIC

In addition, the Aave Robots will be refilled with 1000 LINK for future usage.

## Specification

This proposal, will release the following, from the Aave Ethereum Collector to BGD Labs:

- Transfer 42'000 aUSDC v2 Ethereum to `0xb812d0944f8F581DfAA3a93Dda0d22EcEf51A9CF`.
- Transfer 109'200 aUSDT v2 Ethereum to `0xb812d0944f8F581DfAA3a93Dda0d22EcEf51A9CF`.
- Transfer 1640 aLINK v2 Ethereum to `0xb812d0944f8F581DfAA3a93Dda0d22EcEf51A9CF`.
- Transfer 3500 WMATIC Polygon to `0xbCEB4f363f2666E2E8E430806F37e97C405c130b`.
- Transfer 500 aMATIC v2 Polygon to `0xbCEB4f363f2666E2E8E430806F37e97C405c130b`.

In addition, the proposal will refill [Aave Execution Chain Robot](https://etherscan.io/address/0x365d47ceD3D7Eb6a9bdB3814aA23cc06B2D33Ef8) and [Aave Governance Chain Robot](https://etherscan.io/address/0x011824f238AEE05329213d5Ae029e899e5412343) with 500 LINK each by calling the `refill()` method on the [robot operator contract](https://etherscan.io/address/0x020e452b463568f55bac6dc5afc8f0b62ea5f0f3).
- Transfer 4000 aMATIC v2 Polygon to `0xbCEB4f363f2666E2E8E430806F37e97C405c130b`.

_Note: The assets used for transfer has been recommended by the financial contributor to the DAO (TokenLogic & Karpatkey)_

## References

- Implementation: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/e84c244182da9767d794628272c46c730920778e/src/20240411_Multi_SecurityBudgetRequestDec23AndRobotRefill/AaveV3Ethereum_SecurityBudgetRequestDec23AndRobotRefill_20240411.sol), [AaveV3Polygon](https://github.com/bgd-labs/aave-proposals-v3/blob/e84c244182da9767d794628272c46c730920778e/src/20240411_Multi_SecurityBudgetRequestDec23AndRobotRefill/AaveV3Polygon_SecurityBudgetRequestDec23AndRobotRefill_20240411.sol)
- Tests: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/e84c244182da9767d794628272c46c730920778e/src/20240411_Multi_SecurityBudgetRequestDec23AndRobotRefill/AaveV3Ethereum_SecurityBudgetRequestDec23AndRobotRefill_20240411.t.sol), [AaveV3Polygon](https://github.com/bgd-labs/aave-proposals-v3/blob/e84c244182da9767d794628272c46c730920778e/src/20240411_Multi_SecurityBudgetRequestDec23AndRobotRefill/AaveV3Polygon_SecurityBudgetRequestDec23AndRobotRefill_20240411.t.sol)
- Implementation: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/be94106008b0e3e1f3fb9679dc7f589855d3cb60/src/20240411_Multi_SecurityBudgetRequestDec23AndRobotRefill/AaveV3Ethereum_SecurityBudgetRequestDec23AndRobotRefill_20240411.sol), [AaveV3Polygon](https://github.com/bgd-labs/aave-proposals-v3/blob/be94106008b0e3e1f3fb9679dc7f589855d3cb60/src/20240411_Multi_SecurityBudgetRequestDec23AndRobotRefill/AaveV3Polygon_SecurityBudgetRequestDec23AndRobotRefill_20240411.sol)
- Tests: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/be94106008b0e3e1f3fb9679dc7f589855d3cb60/src/20240411_Multi_SecurityBudgetRequestDec23AndRobotRefill/AaveV3Ethereum_SecurityBudgetRequestDec23AndRobotRefill_20240411.t.sol), [AaveV3Polygon](https://github.com/bgd-labs/aave-proposals-v3/blob/be94106008b0e3e1f3fb9679dc7f589855d3cb60/src/20240411_Multi_SecurityBudgetRequestDec23AndRobotRefill/AaveV3Polygon_SecurityBudgetRequestDec23AndRobotRefill_20240411.t.sol)
- [Snapshot](https://snapshot.org/#/aave.eth/proposal/0xf95bc210e3e93c2112c694cb158db22c93504155b48c03d9358e4c41c33ee782)
- [Discussion](https://governance.aave.com/t/arfc-bgd-security-budget-request-december-2023/15783)

Expand Down

This file was deleted.

0 comments on commit 8268dd8

Please sign in to comment.