From 33b69f7994bb2efa322dd8bc6f813946beccc8c9 Mon Sep 17 00:00:00 2001 From: gs8nrv <55771972+GuillaumeNervoXS@users.noreply.github.com> Date: Wed, 24 Jan 2024 11:37:39 +0100 Subject: [PATCH] feat: script to check roles on all contracts * ground work to check roles on all Angle contracts * first draft log roles * draft log roles * v1 Check roles working * almost complete full script testing access control * fix minor sidechains bugs * script final version and all chain in one call * feat: create test layerzero cross chain setup * chore: doublon contract name * fix: compilation * fix: @sogipec comment --- .gitmodules | 3 + helpers/common.sh | 83 +++ helpers/createProposal.sh | 90 +-- helpers/fork.sh | 44 +- helpers/runScript.sh | 108 ++++ lib/angle-router | 1 + package.json | 3 +- remappings.txt | 1 + scripts/Constants.s.sol | 43 +- scripts/Interfaces.s.sol | 73 ++- scripts/Simulate.s.sol | 11 +- scripts/Utils.s.sol | 52 +- scripts/interaction/CheckRoles.s.sol | 593 ++++++++++++++++++ scripts/proposals/Wrapper.s.sol | 41 +- scripts/proposals/payload.json | 66 +- .../timelock/SetMinDelayTimelock.s.sol | 4 +- .../timelock/SetMinDelayTimelockTest.t.sol | 2 +- test/unit/Simulate.t.sol | 2 +- utils/contractAddress.js | 53 +- utils/getAllContracts.js | 41 ++ 20 files changed, 1068 insertions(+), 246 deletions(-) create mode 100644 helpers/common.sh create mode 100644 helpers/runScript.sh create mode 160000 lib/angle-router create mode 100644 scripts/interaction/CheckRoles.s.sol create mode 100644 utils/getAllContracts.js diff --git a/.gitmodules b/.gitmodules index 6cc88ab..66a28e2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -23,6 +23,9 @@ [submodule "lib/borrow-contracts"] path = lib/borrow-contracts url = https://github.com/AngleProtocol/borrow-contracts +[submodule "lib/angle-router"] + path = lib/angle-router + url = https://github.com/AngleProtocol/angle-router [submodule "lib/new-oz"] path = lib/new-oz url = https://github.com/OpenZeppelin/openzeppelin-contracts diff --git a/helpers/common.sh b/helpers/common.sh new file mode 100644 index 0000000..7d28f4c --- /dev/null +++ b/helpers/common.sh @@ -0,0 +1,83 @@ +function chain_to_uri { + chain=$1 + + case $chain in + "1") + echo $ETH_NODE_URI_MAINNET + ;; + "2") + echo $ETH_NODE_URI_ARBITRUM + ;; + "3") + echo $ETH_NODE_URI_POLYGON + ;; + "4") + echo $ETH_NODE_URI_GNOSIS + ;; + "5") + echo $ETH_NODE_URI_AVALANCHE + ;; + "6") + echo $ETH_NODE_URI_BASE + ;; + "7") + echo $ETH_NODE_URI_BSC + ;; + "8") + echo $ETH_NODE_URI_CELO + ;; + "9") + echo $ETH_NODE_URI_POLYGON_ZKEVM + ;; + "10") + echo $ETH_NODE_URI_OPTIMISM + ;; + "11") + echo $ETH_NODE_URI_LINEA + ;; + *) + ;; + esac +} + +function chain_to_chainId { + chain=$1 + + case $chain in + "1") + echo "1" + ;; + "2") + echo "42161" + ;; + "3") + echo "137" + ;; + "4") + echo "100" + ;; + "5") + echo "43114" + ;; + "6") + echo "8453" + ;; + "7") + echo "56" + ;; + "8") + echo "42220" + ;; + "9") + echo "1101" + ;; + "10") + echo "10" + ;; + "11") + echo "59144" + ;; + *) + ;; + esac +} \ No newline at end of file diff --git a/helpers/createProposal.sh b/helpers/createProposal.sh index 81d2e27..861041b 100644 --- a/helpers/createProposal.sh +++ b/helpers/createProposal.sh @@ -1,88 +1,6 @@ #! /bin/bash -function chain_to_uri { - chain=$1 - - case $chain in - "1") - echo $ETH_NODE_URI_MAINNET - ;; - "2") - echo $ETH_NODE_URI_ARBITRUM - ;; - "3") - echo $ETH_NODE_URI_POLYGON - ;; - "4") - echo $ETH_NODE_URI_GNOSIS - ;; - "5") - echo $ETH_NODE_URI_AVALANCHE - ;; - "6") - echo $ETH_NODE_URI_BASE - ;; - "7") - echo $ETH_NODE_URI_BSC - ;; - "8") - echo $ETH_NODE_URI_CELO - ;; - "9") - echo $ETH_NODE_URI_POLYGON_ZKEVM - ;; - "10") - echo $ETH_NODE_URI_OPTIMISM - ;; - "11") - echo $ETH_NODE_URI_LINEA - ;; - *) - ;; - esac -} - -function chain_to_chainId { - chain=$1 - - case $chain in - "1") - echo "1" - ;; - "2") - echo "42161" - ;; - "3") - echo "137" - ;; - "4") - echo "100" - ;; - "5") - echo "43114" - ;; - "6") - echo "8453" - ;; - "7") - echo "56" - ;; - "8") - echo "42220" - ;; - "9") - echo "1101" - ;; - "10") - echo "10" - ;; - "11") - echo "59144" - ;; - *) - ;; - esac -} +source helpers/common.sh function usage { echo "bash createProposal.sh