Skip to content

Commit

Permalink
Merge pull request #14 from bgd-labs/feat/granular-guardian
Browse files Browse the repository at this point in the history
feat: Granular Guardian Script
  • Loading branch information
sendra authored Jul 17, 2024
2 parents e333182 + d69a4d4 commit 71a623a
Show file tree
Hide file tree
Showing 17 changed files with 795 additions and 14 deletions.
1 change: 0 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[submodule "lib/aave-delivery-infrastructure"]
path = lib/aave-delivery-infrastructure
url = https://github.com/bgd-labs/aave-delivery-infrastructure
branch = feat/phase-3
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ BASE_KEY = --private-key ${PRIVATE_KEY}



#custom_ethereum := --with-gas-price 2000000000 # 53 gwei
#custom_ethereum := --with-gas-price 15000000000 # 53 gwei
#custom_polygon := --with-gas-price 190000000000 # 560 gwei
#custom_avalanche := --with-gas-price 27000000000 # 27 gwei
#custom_metis-testnet := --legacy --verifier-url https://goerli.explorer.metisdevops.link/api/
Expand Down Expand Up @@ -253,7 +253,7 @@ send-message-via-adapter:
$(call deploy_fn,helpers/Send_Message_Via_Adapter,ethereum)

deploy_ccc_granular_guardian:
$(call deploy_fn,helpers/Send_Message_Via_Adapter,avalanche, polygon, binance, gnosis)
$(call deploy_fn,access_control/DeployGranularGuardian,ethereum avalanche polygon binance gnosis metis scroll optimism arbitrum base)

deploy-ccc-revision-and-update:
$(call deploy_fn,CCC/UpdateCCC,ethereum)
Expand Down
2 changes: 1 addition & 1 deletion deployments/arbitrum.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"crossChainControllerImpl": "0x6e633269af45F37c44659D98f382dd0DD524E5Df",
"emergencyRegistry": "0x0000000000000000000000000000000000000000",
"gnosisAdapter": "0x0000000000000000000000000000000000000000",
"granularCCCGuardian": "0x0000000000000000000000000000000000000000",
"granularCCCGuardian": "0x4922093c476CfbCF903C7C4082d2D64bAE8A37cE",
"guardian": "0xEAF6183bAb3eFD3bF856Ac5C058431C8592394d6",
"hlAdapter": "0x0000000000000000000000000000000000000000",
"lzAdapter": "0x0000000000000000000000000000000000000000",
Expand Down
2 changes: 1 addition & 1 deletion deployments/avalanche.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"crossChainControllerImpl": "0x5Ef80c5eB6CF65Dab8cD1C0ee258a6D2bD38Bd22",
"emergencyRegistry": "0x0000000000000000000000000000000000000000",
"gnosisAdapter": "0x0000000000000000000000000000000000000000",
"granularCCCGuardian": "0x0000000000000000000000000000000000000000",
"granularCCCGuardian": "0xc1162BCb2E5E3ca4725512008c7522dF8C8B7B65",
"guardian": "0xEAF6183bAb3eFD3bF856Ac5C058431C8592394d6",
"hlAdapter": "0x617332a777780F546261247F621051d0b98975Eb",
"lzAdapter": "0x10f02995a399C0dC0FaF29914220E9C1bCdE8640",
Expand Down
2 changes: 1 addition & 1 deletion deployments/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"crossChainControllerImpl": "0x9b6f5ef589A3DD08670Dd146C11C4Fb33E04494F",
"emergencyRegistry": "0x0000000000000000000000000000000000000000",
"gnosisAdapter": "0x0000000000000000000000000000000000000000",
"granularCCCGuardian": "0x0000000000000000000000000000000000000000",
"granularCCCGuardian": "0xa1c6aF35E0205f42256382C05243C543FEDBf4bB",
"guardian": "0xEAF6183bAb3eFD3bF856Ac5C058431C8592394d6",
"hlAdapter": "0x0000000000000000000000000000000000000000",
"lzAdapter": "0x0000000000000000000000000000000000000000",
Expand Down
2 changes: 1 addition & 1 deletion deployments/binance.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"crossChainControllerImpl": "0xf41193E25408F652AF878c47E4401A01B5E4B682",
"emergencyRegistry": "0x0000000000000000000000000000000000000000",
"gnosisAdapter": "0x0000000000000000000000000000000000000000",
"granularCCCGuardian": "0x0000000000000000000000000000000000000000",
"granularCCCGuardian": "0xe4FB5e3F506BE0095f38004f993D16fdA8224383",
"guardian": "0xEAF6183bAb3eFD3bF856Ac5C058431C8592394d6",
"hlAdapter": "0x3F006299eC88985c18E6e885EeA29A49eC579882",
"lzAdapter": "0xa5cc218513305221201f196760E9e64e9D49d98A",
Expand Down
2 changes: 1 addition & 1 deletion deployments/ethereum.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"crossChainControllerImpl": "0x28559c2F4B038b1E836fA419DCcDe7454d8Fe215",
"emergencyRegistry": "0x0000000000000000000000000000000000000000",
"gnosisAdapter": "0x7238d75fD75bb936E83b75854c653F104Ce9c9d8",
"granularCCCGuardian": "0x0000000000000000000000000000000000000000",
"granularCCCGuardian": "0x4457cA11E90f416Cc1D3a8E1cA41C0cdEcC251d4",
"guardian": "0xEAF6183bAb3eFD3bF856Ac5C058431C8592394d6",
"hlAdapter": "0x01dcb90Cf13b82Cde4A0BAcC655585a83Af3cCC1",
"lzAdapter": "0x8410d9BD353b420ebA8C48ff1B0518426C280FCC",
Expand Down
2 changes: 1 addition & 1 deletion deployments/gnosis.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"crossChainControllerImpl": "0x5e06b10B3b9c3E1c0996D2544A35B9839Be02922",
"emergencyRegistry": "0x0000000000000000000000000000000000000000",
"gnosisAdapter": "0x3C06dce358add17aAf230f2234bCCC4afd50d090",
"granularCCCGuardian": "0x0000000000000000000000000000000000000000",
"granularCCCGuardian": "0x4A9F571E3C1f2F13567bb59e38988e74d7d72602",
"guardian": "0xEAF6183bAb3eFD3bF856Ac5C058431C8592394d6",
"hlAdapter": "0xA806DA549FcB2B4912a7dFFE4c1aA7A1ed0Bd5C9",
"lzAdapter": "0x9b6f5ef589A3DD08670Dd146C11C4Fb33E04494F",
Expand Down
2 changes: 1 addition & 1 deletion deployments/metis.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"crossChainControllerImpl": "0xa198Fac58E02A5C5F8F7e877895d50cFa9ad1E04",
"emergencyRegistry": "0x0000000000000000000000000000000000000000",
"gnosisAdapter": "0x0000000000000000000000000000000000000000",
"granularCCCGuardian": "0x0000000000000000000000000000000000000000",
"granularCCCGuardian": "0x61BE97d3a0550549f67CA7421725fA73Fa2036B5",
"guardian": "0xEAF6183bAb3eFD3bF856Ac5C058431C8592394d6",
"hlAdapter": "0x0000000000000000000000000000000000000000",
"lzAdapter": "0x0000000000000000000000000000000000000000",
Expand Down
2 changes: 1 addition & 1 deletion deployments/optimism.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"crossChainControllerImpl": "0xa5cc218513305221201f196760E9e64e9D49d98A",
"emergencyRegistry": "0x0000000000000000000000000000000000000000",
"gnosisAdapter": "0x0000000000000000000000000000000000000000",
"granularCCCGuardian": "0x0000000000000000000000000000000000000000",
"granularCCCGuardian": "0x6c5264C380C7022e54f585c4E354ffb6f221a03b",
"guardian": "0xEAF6183bAb3eFD3bF856Ac5C058431C8592394d6",
"hlAdapter": "0x0000000000000000000000000000000000000000",
"lzAdapter": "0x0000000000000000000000000000000000000000",
Expand Down
2 changes: 1 addition & 1 deletion deployments/polygon.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"crossChainControllerImpl": "0x87a95917DE670088d81B9a8B30E3B36704Ba3043",
"emergencyRegistry": "0x0000000000000000000000000000000000000000",
"gnosisAdapter": "0x0000000000000000000000000000000000000000",
"granularCCCGuardian": "0x0000000000000000000000000000000000000000",
"granularCCCGuardian": "0x0D2CccD3dD420dC6DE2f24DB44aA22fADE290a02",
"guardian": "0xEAF6183bAb3eFD3bF856Ac5C058431C8592394d6",
"hlAdapter": "0x3e72665008dC237bdd91C04C10782Ed1987a4019",
"lzAdapter": "0x7FAE7765abB4c8f778d57337bB720d0BC53057e3",
Expand Down
2 changes: 1 addition & 1 deletion deployments/scroll.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"crossChainControllerImpl": "0x5e06b10B3b9c3E1c0996D2544A35B9839Be02922",
"emergencyRegistry": "0x0000000000000000000000000000000000000000",
"gnosisAdapter": "0x0000000000000000000000000000000000000000",
"granularCCCGuardian": "0x0000000000000000000000000000000000000000",
"granularCCCGuardian": "0xa835707d28e6C37C49d661742f2Fb5987367cEd4",
"guardian": "0xEAF6183bAb3eFD3bF856Ac5C058431C8592394d6",
"hlAdapter": "0x0000000000000000000000000000000000000000",
"lzAdapter": "0x0000000000000000000000000000000000000000",
Expand Down
12 changes: 12 additions & 0 deletions scripts/access_control/DeployGranularGuardian.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

import 'adi/access_control/GranularGuardianAccessControl.sol';
import 'adi-scripts/access_control/Deploy_Granular_CCC_Guardian.sol';
import '../BaseDeployerScript.sol';

abstract contract DeployGranularGuardian is BaseDeployerScript, BaseDeployGranularGuardian {
function _execute(Addresses memory addresses) internal override {
addresses.granularCCCGuardian = _deployGranularGuardian(addresses.crossChainController);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol';
import {GovernanceV3Polygon} from 'aave-address-book/GovernanceV3Polygon.sol';
import {GovernanceV3Avalanche} from 'aave-address-book/GovernanceV3Avalanche.sol';
import {GovernanceV3Binance} from 'aave-address-book/GovernanceV3Binance.sol';
import {GovernanceV3Gnosis} from 'aave-address-book/GovernanceV3Gnosis.sol';
import {GovernanceV3Arbitrum} from 'aave-address-book/GovernanceV3Arbitrum.sol';
import {GovernanceV3Optimism} from 'aave-address-book/GovernanceV3Optimism.sol';
import {GovernanceV3Base} from 'aave-address-book/GovernanceV3Base.sol';
import {GovernanceV3Scroll} from 'aave-address-book/GovernanceV3Scroll.sol';
import {GovernanceV3Metis} from 'aave-address-book/GovernanceV3Metis.sol';
import {MiscPolygon} from 'aave-address-book/MiscPolygon.sol';
import {MiscAvalanche} from 'aave-address-book/MiscAvalanche.sol';
import {MiscBNB} from 'aave-address-book/MiscBNB.sol';
import {MiscGnosis} from 'aave-address-book/MiscGnosis.sol';
import {MiscEthereum} from 'aave-address-book/MiscEthereum.sol';
import {MiscArbitrum} from 'aave-address-book/MiscArbitrum.sol';
import {MiscOptimism} from 'aave-address-book/MiscOptimism.sol';
import {MiscBase} from 'aave-address-book/MiscBase.sol';
import {MiscScroll} from 'aave-address-book/MiscScroll.sol';
import {MiscMetis} from 'aave-address-book/MiscMetis.sol';
import '../DeployGranularGuardian.s.sol';

contract Ethereum is DeployGranularGuardian {
function TRANSACTION_NETWORK() internal pure override returns (uint256) {
return ChainIds.ETHEREUM;
}

function DEFAULT_ADMIN() internal pure override returns (address) {
return GovernanceV3Ethereum.EXECUTOR_LVL_1;
}

function RETRY_GUARDIAN() internal pure override returns (address) {
return 0xb812d0944f8F581DfAA3a93Dda0d22EcEf51A9CF; // bgd guardian
}

function SOLVE_EMERGENCY_GUARDIAN() internal pure override returns (address) {
return 0xCe52ab41C40575B072A18C9700091Ccbe4A06710;
}
}

contract Avalanche is DeployGranularGuardian {
function DEFAULT_ADMIN() internal pure override returns (address) {
return GovernanceV3Avalanche.EXECUTOR_LVL_1;
}

function RETRY_GUARDIAN() internal pure override returns (address) {
return 0x3DBA1c4094BC0eE4772A05180B7E0c2F1cFD9c36; // bgd guardian
}

function SOLVE_EMERGENCY_GUARDIAN() internal pure override returns (address) {
return 0x360c0a69Ed2912351227a0b745f890CB2eBDbcFe;
}

function TRANSACTION_NETWORK() internal pure override returns (uint256) {
return ChainIds.AVALANCHE;
}
}

contract Polygon is DeployGranularGuardian {
function DEFAULT_ADMIN() internal pure override returns (address) {
return GovernanceV3Polygon.EXECUTOR_LVL_1;
}

function RETRY_GUARDIAN() internal pure override returns (address) {
return 0xbCEB4f363f2666E2E8E430806F37e97C405c130b; // bgd guardian
}

function SOLVE_EMERGENCY_GUARDIAN() internal pure override returns (address) {
return 0x1A0581dd5C7C3DA4Ba1CDa7e0BcA7286afc4973b;
}

function TRANSACTION_NETWORK() internal pure override returns (uint256) {
return ChainIds.POLYGON;
}
}

contract Binance is DeployGranularGuardian {
function DEFAULT_ADMIN() internal pure override returns (address) {
return GovernanceV3Binance.EXECUTOR_LVL_1;
}

function RETRY_GUARDIAN() internal pure override returns (address) {
return 0xE8C5ab722d0b1B7316Cc4034f2BE91A5B1d29964; // bgd guardian
}

function SOLVE_EMERGENCY_GUARDIAN() internal pure override returns (address) {
return 0x1A0581dd5C7C3DA4Ba1CDa7e0BcA7286afc4973b;
}

function TRANSACTION_NETWORK() internal pure override returns (uint256) {
return ChainIds.BNB;
}
}

contract Gnosis is DeployGranularGuardian {
function DEFAULT_ADMIN() internal pure override returns (address) {
return GovernanceV3Gnosis.EXECUTOR_LVL_1;
}

function RETRY_GUARDIAN() internal pure override returns (address) {
return 0xcb8a3E864D12190eD2b03cbA0833b15f2c314Ed8; // bgd guardian
}

function SOLVE_EMERGENCY_GUARDIAN() internal pure override returns (address) {
return 0x1A0581dd5C7C3DA4Ba1CDa7e0BcA7286afc4973b;
}

function TRANSACTION_NETWORK() internal pure override returns (uint256) {
return ChainIds.GNOSIS;
}
}

contract Metis is DeployGranularGuardian {
function DEFAULT_ADMIN() internal pure override returns (address) {
return GovernanceV3Metis.EXECUTOR_LVL_1;
}

function RETRY_GUARDIAN() internal pure override returns (address) {
return 0x9853589F951D724D9f7c6724E0fD63F9d888C429; // bgd guardian
}

function SOLVE_EMERGENCY_GUARDIAN() internal pure override returns (address) {
return 0x360c0a69Ed2912351227a0b745f890CB2eBDbcFe;
}

function TRANSACTION_NETWORK() internal pure override returns (uint256) {
return ChainIds.METIS;
}
}

contract Scroll is DeployGranularGuardian {
function DEFAULT_ADMIN() internal pure override returns (address) {
return GovernanceV3Scroll.EXECUTOR_LVL_1;
}

function RETRY_GUARDIAN() internal pure override returns (address) {
return 0x4aAa03F0A61cf93eA252e987b585453578108358; // bgd guardian
}

function SOLVE_EMERGENCY_GUARDIAN() internal pure override returns (address) {
return 0x1A0581dd5C7C3DA4Ba1CDa7e0BcA7286afc4973b;
}

function TRANSACTION_NETWORK() internal pure override returns (uint256) {
return ChainIds.SCROLL;
}
}

contract Optimism is DeployGranularGuardian {
function DEFAULT_ADMIN() internal pure override returns (address) {
return GovernanceV3Optimism.EXECUTOR_LVL_1;
}

function RETRY_GUARDIAN() internal pure override returns (address) {
return 0x3A800fbDeAC82a4d9c68A9FA0a315e095129CDBF; // bgd guardian
}

function SOLVE_EMERGENCY_GUARDIAN() internal pure override returns (address) {
return 0x360c0a69Ed2912351227a0b745f890CB2eBDbcFe;
}

function TRANSACTION_NETWORK() internal pure override returns (uint256) {
return ChainIds.OPTIMISM;
}
}

contract Arbitrum is DeployGranularGuardian {
function DEFAULT_ADMIN() internal pure override returns (address) {
return GovernanceV3Arbitrum.EXECUTOR_LVL_1;
}

function RETRY_GUARDIAN() internal pure override returns (address) {
return 0x1Fcd437D8a9a6ea68da858b78b6cf10E8E0bF959; // bgd guardian
}

function SOLVE_EMERGENCY_GUARDIAN() internal pure override returns (address) {
return 0x1A0581dd5C7C3DA4Ba1CDa7e0BcA7286afc4973b;
}

function TRANSACTION_NETWORK() internal pure override returns (uint256) {
return ChainIds.ARBITRUM;
}
}

contract Base is DeployGranularGuardian {
function DEFAULT_ADMIN() internal pure override returns (address) {
return GovernanceV3Base.EXECUTOR_LVL_1;
}

function RETRY_GUARDIAN() internal pure override returns (address) {
return 0x7FDA7C3528ad8f05e62148a700D456898b55f8d2; // bgd guardian
}

function SOLVE_EMERGENCY_GUARDIAN() internal pure override returns (address) {
return 0x360c0a69Ed2912351227a0b745f890CB2eBDbcFe;
}

function TRANSACTION_NETWORK() internal pure override returns (uint256) {
return ChainIds.BASE;
}
}
30 changes: 30 additions & 0 deletions tests/BaseTest.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

import 'forge-std/Test.sol';

contract BaseTest is Test {
bytes internal constant MESSAGE = bytes('this is the message to send');

modifier executeAs(address executor) {
vm.startPrank(executor);
_;
vm.stopPrank();
}

modifier filterAddress(address addressToFilter) {
_filterAddress(addressToFilter);
_;
}

function _filterAddress(address addressToFilter) internal pure {
vm.assume(
addressToFilter != address(0) &&
addressToFilter != 0xCe71065D4017F316EC606Fe4422e11eB2c47c246 && // FuzzerDict
addressToFilter != 0x4e59b44847b379578588920cA78FbF26c0B4956C && // CREATE2 Factory (?)
addressToFilter != 0xb4c79daB8f259C7Aee6E5b2Aa729821864227e84 && // address(this)
addressToFilter != 0x185a4dc360CE69bDCceE33b3784B0282f7961aea && // ???
addressToFilter != 0x7109709ECfa91a80626fF3989D68f67F5b1DD12D // cheat codes
);
}
}
Loading

0 comments on commit 71a623a

Please sign in to comment.