diff --git a/foundry.toml b/foundry.toml index c31c935..e3a0c73 100644 --- a/foundry.toml +++ b/foundry.toml @@ -10,7 +10,7 @@ via_ir = true sizes = true optimizer = true optimizer_runs = 1000 -solc_version = "0.8.20" +solc_version = "0.8.23" ffi = true [fuzz] @@ -29,9 +29,11 @@ polygon = "${ETH_NODE_URI_POLYGON}" fork = "${ETH_NODE_URI_FORK}" avalanche = "${ETH_NODE_URI_AVALANCHE}" celo = "${ETH_NODE_URI_CELO}" -polygonzkevm = "${ETH_NODE_URI_POLYGONZKEVM}" +polygonzkevm = "${ETH_NODE_URI_POLYGON_ZKEVM}" bsc = "${ETH_NODE_URI_BSC}" base = "${ETH_NODE_URI_BASE}" +linea = "${ETH_NODE_URI_LINEA}" + [etherscan] arbitrum = { key = "${ARBITRUM_ETHERSCAN_API_KEY}" } @@ -41,8 +43,11 @@ optimism = { key = "${OPTIMISM_ETHERSCAN_API_KEY}" } polygon = { key = "${POLYGON_ETHERSCAN_API_KEY}" } avalanche = { key = "${AVALANCHE_ETHERSCAN_API_KEY}" } celo = { key = "${CELO_ETHERSCAN_API_KEY}", url = "https://api.celoscan.io/api" } -polygonzkevm = { key = "${POLYGONZKEVM_ETHERSCAN_API_KEY}", url = "https://api-zkevm.polygonscan.com/api" } +polygon-zkevm = { key = "${POLYGONZKEVM_ETHERSCAN_API_KEY}", url = "https://api-zkevm.polygonscan.com/api" } bsc = { key = "${BSC_ETHERSCAN_API_KEY}"} +base = { key = "${BASE_ETHERSCAN_API_KEY}", url = "https://api.basescan.org/api" } +linea = { key = "${LINEA_ETHERSCAN_API_KEY}" } + [profile.dev] optimizer = true diff --git a/helpers/fork.sh b/helpers/fork.sh index b686d16..4adf53a 100644 --- a/helpers/fork.sh +++ b/helpers/fork.sh @@ -34,6 +34,9 @@ function option_to_uri { "10") echo $ETH_NODE_URI_OPTIMISM ;; + "11") + echo $ETH_NODE_URI_LINEA + ;; *) ;; esac @@ -57,6 +60,7 @@ function main { echo "- 8: Celo" echo "- 9: Polygon ZkEvm" echo "- 10: Optimism" + echo "- 11: Linea" read option diff --git a/package.json b/package.json index cfc6feb..76fc7fd 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,8 @@ "coverage": "FOUNDRY_PROFILE=dev forge coverage --report lcov && yarn lcov:clean && yarn lcov:generate-html", "compile": "forge build", "compile:dev": "FOUNDRY_PROFILE=dev forge build", - "deploy": "forge script --skip test --broadcast --verify --slow -vvvv --rpc-url polygon scripts/interaction/TimelockExecute.s.sol", - "deploy:test": "FOUNDRY_PROFILE=dev forge script --skip test --broadcast --verify --slow -vvvv --rpc-url gnosis scripts/DeployOnChainGovernance.s.sol", - "deploy:fork": "FOUNDRY_PROFILE=dev forge script --skip test --slow --fork-url fork --broadcast scripts/interaction/TimelockExecute.s.sol -vvvv", + "deploy": "forge script --skip test --broadcast --verify --slow -vvvv --rpc-url linea scripts/DeploySideChainGovernance.s.sol", + "deploy:fork": "forge script --skip test --slow --fork-url fork --broadcast scripts/DeploySideChainGovernance.s.sol -vvvv", "gas": "yarn test --gas-report", "fork": "bash helpers/fork.sh", "run": "docker run -it --rm -v $(pwd):/app -w /app ghcr.io/foundry-rs/foundry sh", @@ -27,8 +26,10 @@ "lint": "yarn lint:check --fix", "lint:check": "solhint --max-warnings 20 \"**/*.sol\"", "verify": "forge verify-contract --chain-id 100 --watch --constructor-args $(cast abi-encode 'constructor(address,address,uint48,uint32,uint256,uint48,uint256,uint256,uint256)' '0xD622c71aba9060F393FEC67D3e2B9335292bf23B' '0x769A713bF0589d495008e5a7c78fABafb9C35F39' 300 3600 100000000000000000000000 60 20 75 60) 0x882dD02d7F2F06B7e968ECb97B1B62Bf51B3af4a AngleGovernor", - "verify:governor": "forge verify-contract --chain-id 100 --watch --constructor-args 0xbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fd0553476bf02ef2726e8ce5ced78d63e26e602e4a2257b1f559418e24b4633997dd2b8b2d874e19a344cba53b9fb534ea748ef117ed4b75c67569a79486454193000000000000000000000000d622c71aba9060f393fec67d3e2b9335292bf23b000000000000000000000000769a713bf0589d495008e5a7c78fabafb9c35f39000000000000000000000000000000000000000000000000000000000000012c0000000000000000000000000000000000000000000000000000000000000e1000000000000000000000000000000000000000000000152d02c7e14af6800000000000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000004b000000000000000000000000000000000000000000000000000000000000003c 0x882dD02d7F2F06B7e968ECb97B1B62Bf51B3af4a AngleGovernor", - "verify:sender": "forge verify-contract --chain-id 100 --watch --constructor-args $(cast abi-encode 'constructor(address)' '0x9740FF91F1985D8d2B71494aE1A2f723bb3Ed9E4') 0xdE8e46cc73d9D1C94f9b99cE518Cf69A7a7615A3 ProposalSender" + "verify:governor": "forge verify-contract --chain-id 1 --watch --show-standard-json-input > etherscan.json --solc-input --optimizer-runs=1000 --constructor-args 0x0000000000000000000000000c462dbb9ec8cd1630f1728b2cfd2769d09f0dd500000000000000000000000027000546a968aac25e9a709c098f1254e333b1930000000000000000000000000000000000000000000000000000000000015180000000000000000000000000000000000000000000000000000000000005460000000000000000000000000000000000000000000000152d02c7e14af68000000000000000000000000000000000000000000000000000000000000000002a300000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000001c20 0xcaAa0114CB9Fe229643B8193375b21f695e6593C AngleGovernor", + "verify:sender": "forge verify-contract --chain-id 1 --watch --constructor-args $(cast abi-encode 'constructor(address)' '0x66a71dcef29a0ffbdbe3c6a460a3b5bc225cd675') 0x71D670A690eF3E0dbD819F63168ce58EE5587f49 ProposalSender", + "verify:timelock": "forge verify-contract --chain-id 59144 --watch --constructor-args $(cast abi-encode 'constructor(uint256,address[],address[],address)' 86400 [] ['0x007475b60d88b02663d6f975927b70bb4335e4b3'] '0xfdA462548Ce04282f4B6D6619823a7C64Fdc0185') 0xd23B51d6F2cB3eC7ca9599D4332a2F10C3CFDF85 TimelockControllerWithCounter", + "verify:receiver": "forge verify-contract --chain-id 59144 --watch --constructor-args $(cast abi-encode 'constructor(address)' '0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7') 0x4A44f77978Daa3E92Eb3D97210bd11645cF935Ab ProposalReceiver" }, "keywords": [], "author": "Angle Core Team", diff --git a/scripts/Constants.s.sol b/scripts/Constants.s.sol index 4b3ec09..c35e414 100644 --- a/scripts/Constants.s.sol +++ b/scripts/Constants.s.sol @@ -5,37 +5,50 @@ pragma solidity ^0.8.9; import { ILayerZeroEndpoint } from "lz/lzApp/interfaces/ILayerZeroEndpoint.sol"; import { IVotes } from "oz/governance/extensions/GovernorVotes.sol"; -/* +enum ContractType { + Timelock, + ProposalSender, + Governor, + ProposalReceiver, + TreasuryAgEUR, + StEUR, + TransmuterAgEUR, + CoreBorrow, + GovernorMultisig, + GuardianMultisig, + ProxyAdmin, + Angle, + veANGLE, + SmartWalletWhitelist, + veBoostProxy, + GaugeController, + AngleDistributor, + AngleMiddleman, + FeeDistributor +} + uint256 constant timelockDelay = 1 days; uint48 constant initialVotingDelay = 1 days; uint256 constant initialVotingDelayBlocks = 1 days / 12; uint32 constant initialVotingPeriod = 4 days; uint256 constant initialProposalThreshold = 100_000e18; uint48 constant initialVoteExtension = 3 hours; -*/ - -uint256 constant timelockDelayTest = 300; -uint48 constant initialVotingDelayTest = 300; -uint256 constant initialVotingDelayBlocksTest = 60; -uint32 constant initialVotingPeriodTest = 3600; -uint256 constant initialProposalThresholdTest = 100_000e18; -uint48 constant initialVoteExtensionTest = 60; -// TODO: update so we deploy with small values and later increase back up -uint256 constant initialQuorumNumerator = 20; -uint256 constant initialShortCircuitNumerator = 75; +// TODO: increase quorum numbers back up +uint256 constant initialQuorumNumerator = 5; +uint256 constant initialShortCircuitNumerator = 10; bytes constant nullBytes = hex""; -address constant SAFE_MAINNET = 0xdC4e6DFe07EFCa50a197DF15D9200883eF4Eb1c8; -// This is the guardian for testing purposes -address constant SAFE_GNOSIS = 0xf0A31faec2B4fC6396c65B1aF1F6A71E653f11F0; -address constant SAFE_POLYGON = 0x3b9D32D0822A6351F415BeaB05251c1457FF6f8D; - -uint256 constant CHAIN_GNOSIS = 100; -uint256 constant CHAIN_POLYGON = 137; +uint256 constant CHAIN_ETHEREUM = 1; +uint256 constant CHAIN_ARBITRUM = 42161; +uint256 constant CHAIN_AVALANCHE = 43114; uint256 constant CHAIN_OPTIMISM = 10; - -// TODO update when deployed -// address constant proposalSender = address(0x499C86959a330Eb860FdFFf6e87896d4298a4F4E); -address constant proposalReceiverPolygon = address(0x060246eD061999F7e128Fd8355d84467d6726b71); -address constant timelockPolygon = address(0x0d17B69fF7D30F7EC13A9447d1E5624b601a730b); +uint256 constant CHAIN_POLYGON = 137; +uint256 constant CHAIN_GNOSIS = 100; +uint256 constant CHAIN_BNB = 56; +uint256 constant CHAIN_CELO = 42220; +uint256 constant CHAIN_ZKEVMPOLYGON = 1101; +uint256 constant CHAIN_BASE = 8453; +uint256 constant CHAIN_LINEA = 59144; +uint256 constant CHAIN_MANTLE = 5000; +uint256 constant CHAIN_AURORA = 1313161554; diff --git a/scripts/DeployOnChainGovernance.s.sol b/scripts/DeployOnChainGovernance.s.sol index 7c4b7fa..d359c2a 100644 --- a/scripts/DeployOnChainGovernance.s.sol +++ b/scripts/DeployOnChainGovernance.s.sol @@ -36,51 +36,35 @@ contract DeployOnChainGovernance is Utils { function run() external { // TODO can be modified to deploy on any chain - uint256 srcChainId = CHAIN_GNOSIS; - address safeMultiSig = SAFE_GNOSIS; + uint256 srcChainId = CHAIN_ETHEREUM; // END - uint256 deployerPrivateKey = vm.deriveKey(vm.envString("MNEMONIC_GNOSIS"), "m/44'/60'/0'/0/", 0); + uint256 deployerPrivateKey = vm.deriveKey(vm.envString("MNEMONIC_MAINNET"), "m/44'/60'/0'/0/", 0); vm.startBroadcast(deployerPrivateKey); address deployer = vm.addr(deployerPrivateKey); vm.label(deployer, "Deployer"); - /* - // If not already - deploy the voting tokens - vyperDeployer = new VyperDeployer(); - vm.allowCheatcodes(address(vyperDeployer)); - (address _mockANGLE, , ) = deployMockANGLE(); - ANGLE = ERC20(_mockANGLE); - - (address _mockVeANGLE, , ) = deployVeANGLE(vyperDeployer, _mockANGLE, safeMultiSig); - veANGLE = IveANGLE(_mockVeANGLE); - - // Deploy Governance source chain + address safeMultiSig = _chainToContract(srcChainId, ContractType.GuardianMultisig); + veANGLE = IveANGLE(_chainToContract(srcChainId, ContractType.veANGLE)); token = new VeANGLEVotingDelegation(address(veANGLE), "veANGLE Delegation", "1"); - */ - token = VeANGLEVotingDelegation(0xD622c71aba9060F393FEC67D3e2B9335292bf23B); - address[] memory proposers = new address[](2); + address[] memory proposers = new address[](0); address[] memory executors = new address[](1); - executors[0] = address(0); // Means everyone can execute - proposers[0] = 0xfdA462548Ce04282f4B6D6619823a7C64Fdc0185; - proposers[1] = 0x9d159aEb0b2482D09666A5479A2e426Cb8B5D091; - timelock = new TimelockControllerWithCounter(timelockDelayTest, proposers, executors, address(deployer)); + executors[0] = safeMultiSig; // Means everyone can execute + timelock = new TimelockControllerWithCounter(timelockDelay, proposers, executors, address(deployer)); angleGovernor = new AngleGovernor( token, address(timelock), - initialVotingDelayTest, - initialVotingPeriodTest, - initialProposalThresholdTest, - initialVoteExtensionTest, + initialVotingDelay, + initialVotingPeriod, + initialProposalThreshold, + initialVoteExtension, initialQuorumNumerator, initialShortCircuitNumerator, - initialVotingDelayBlocksTest + initialVotingDelayBlocks ); timelock.grantRole(timelock.PROPOSER_ROLE(), address(angleGovernor)); timelock.grantRole(timelock.CANCELLER_ROLE(), safeMultiSig); - timelock.grantRole(timelock.CANCELLER_ROLE(), 0xfdA462548Ce04282f4B6D6619823a7C64Fdc0185); - timelock.grantRole(timelock.CANCELLER_ROLE(), 0x9d159aEb0b2482D09666A5479A2e426Cb8B5D091); timelock.renounceRole(timelock.DEFAULT_ADMIN_ROLE(), address(deployer)); proposalSenderDeployed = new ProposalSender(lzEndPoint(srcChainId)); proposalSenderDeployed.transferOwnership(address(angleGovernor)); diff --git a/scripts/DeploySideChainGovernance.s.sol b/scripts/DeploySideChainGovernance.s.sol index 36256f4..0b434f3 100644 --- a/scripts/DeploySideChainGovernance.s.sol +++ b/scripts/DeploySideChainGovernance.s.sol @@ -29,25 +29,26 @@ contract DeploySideChainGovernance is Utils { vm.label(deployer, "Deployer"); // TODO can be modified to deploy on any chain - uint256 srcChainId = CHAIN_GNOSIS; - uint256 destChainId = CHAIN_POLYGON; - address destSafeMultiSig = SAFE_POLYGON; + uint256 srcChainId = CHAIN_ETHEREUM; + uint256 destChainId = CHAIN_LINEA; // END + address destSafeMultiSig = _chainToContract(destChainId, ContractType.GuardianMultisig); + ProposalSender proposalSender = ProposalSender(_chainToContract(srcChainId, ContractType.ProposalSender)); // Deploy relayer receiver and Timelock on end chain - address[] memory proposers = new address[](2); + address[] memory proposers = new address[](0); address[] memory executors = new address[](1); - executors[0] = address(0); // Means everyone can execute - proposers[0] = 0xfdA462548Ce04282f4B6D6619823a7C64Fdc0185; - proposers[1] = 0x9d159aEb0b2482D09666A5479A2e426Cb8B5D091; + executors[0] = destSafeMultiSig; // Means everyone can execute - timelock = new TimelockControllerWithCounter(timelockDelayTest, proposers, executors, deployer); - proposalReceiver = new ProposalReceiver(address(lzEndPoint(destChainId))); + // timelock = new TimelockControllerWithCounter(timelockDelay, proposers, executors, deployer); + // proposalReceiver = new ProposalReceiver(address(lzEndPoint(destChainId))); + timelock = TimelockControllerWithCounter(payable(0xd23B51d6F2cB3eC7ca9599D4332a2F10C3CFDF85)); + proposalReceiver = ProposalReceiver(payable(0x4A44f77978Daa3E92Eb3D97210bd11645cF935Ab)); timelock.grantRole(timelock.PROPOSER_ROLE(), address(proposalReceiver)); timelock.grantRole(timelock.CANCELLER_ROLE(), destSafeMultiSig); timelock.renounceRole(timelock.DEFAULT_ADMIN_ROLE(), deployer); - proposalReceiver.setTrustedRemoteAddress(getLZChainId(srcChainId), abi.encodePacked(proposalSender())); + proposalReceiver.setTrustedRemoteAddress(getLZChainId(srcChainId), abi.encodePacked(proposalSender)); proposalReceiver.transferOwnership(address(timelock)); vm.stopBroadcast(); diff --git a/scripts/Utils.s.sol b/scripts/Utils.s.sol index e6299f3..3e0396b 100644 --- a/scripts/Utils.s.sol +++ b/scripts/Utils.s.sol @@ -21,70 +21,61 @@ contract Utils is Script { return address(new TransparentUpgradeableProxy(implementation, PROXY_ADMIN, data)); } - function timelock(uint256 chainId) public returns (TimelockControllerWithCounter) { - string[] memory cmd = new string[](4); - cmd[0] = "node"; - cmd[1] = "utils/contractAddress.js"; - cmd[2] = vm.toString(chainId); - cmd[3] = "timelock"; - - bytes memory res = vm.ffi(cmd); - if (res.length == 0) revert("Chain not supported"); - return TimelockControllerWithCounter(payable(address(bytes20(res)))); - } + function lzEndPoint(uint256 chainId) public returns (ILayerZeroEndpoint) { + // TODO temporary check if LZ updated their sdk + if (chainId == CHAIN_GNOSIS) { + return ILayerZeroEndpoint(0x9740FF91F1985D8d2B71494aE1A2f723bb3Ed9E4); + } else if (chainId == CHAIN_ZKEVMPOLYGON) { + return ILayerZeroEndpoint(0x9740FF91F1985D8d2B71494aE1A2f723bb3Ed9E4); + } else if (chainId == CHAIN_BASE) { + return ILayerZeroEndpoint(0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7); + } else if (chainId == CHAIN_CELO) { + return ILayerZeroEndpoint(0x3A73033C0b1407574C76BdBAc67f126f6b4a9AA9); + } else if (chainId == CHAIN_LINEA) { + return ILayerZeroEndpoint(0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7); + } - function proposalReceiver(uint256 chainId) public returns (ProposalReceiver) { - string[] memory cmd = new string[](4); + string[] memory cmd = new string[](3); cmd[0] = "node"; - cmd[1] = "utils/contractAddress.js"; + cmd[1] = "utils/layerZeroEndpoint.js"; cmd[2] = vm.toString(chainId); - cmd[3] = "proposalReceiver"; bytes memory res = vm.ffi(cmd); if (res.length == 0) revert("Chain not supported"); - return ProposalReceiver(payable(address(bytes20(res)))); - } - - /// TODO Replace with prod chain - function proposalSender() public returns (ProposalSender) { - string[] memory cmd = new string[](4); - cmd[0] = "node"; - cmd[1] = "utils/contractAddress.js"; - cmd[2] = vm.toString(CHAIN_GNOSIS); - cmd[3] = "proposalSender"; - - bytes memory res = vm.ffi(cmd); - if (res.length == 0) revert("Chain not supported"); - return ProposalSender(payable(address(bytes20(res)))); + return ILayerZeroEndpoint(address(bytes20(res))); } - /// TODO Replace with prod chain - function governor() public returns (AngleGovernor) { + function _chainToContract(uint256 chainId, ContractType name) internal returns (address) { string[] memory cmd = new string[](4); cmd[0] = "node"; cmd[1] = "utils/contractAddress.js"; - cmd[2] = vm.toString(CHAIN_GNOSIS); - cmd[3] = "governor"; - - bytes memory res = vm.ffi(cmd); - if (res.length == 0) revert("Chain not supported"); - return AngleGovernor(payable(address(bytes20(res)))); - } - - function lzEndPoint(uint256 chainId) public returns (ILayerZeroEndpoint) { - // TODO temporary check if LZ updated their sdk - if (chainId == CHAIN_GNOSIS) { - return ILayerZeroEndpoint(0x9740FF91F1985D8d2B71494aE1A2f723bb3Ed9E4); - } - - string[] memory cmd = new string[](3); - cmd[0] = "node"; - cmd[1] = "utils/layerZeroEndpoint.js"; cmd[2] = vm.toString(chainId); + if (name == ContractType.Timelock) cmd[3] = "timelock"; + else if (name == ContractType.ProposalReceiver) cmd[3] = "proposalReceiver"; + else if (name == ContractType.ProposalSender) cmd[3] = "proposalSender"; + else if (name == ContractType.Governor) cmd[3] = "governor"; + else if (name == ContractType.GuardianMultisig) cmd[3] = "guardian"; + else if (name == ContractType.TreasuryAgEUR) cmd[3] = "treasury"; + else if (name == ContractType.StEUR) cmd[3] = "stEUR"; + else if (name == ContractType.TransmuterAgEUR) cmd[3] = "transmuterAgEUR"; + else if (name == ContractType.CoreBorrow) cmd[3] = "coreBorrow"; + else if (name == ContractType.GovernorMultisig) cmd[3] = "governorMultisig"; + else if (name == ContractType.ProxyAdmin) cmd[3] = "proxyAdmin"; + else if (name == ContractType.Angle) cmd[3] = "angle"; + else if (name == ContractType.veANGLE) cmd[3] = "veANGLE"; + else if (name == ContractType.SmartWalletWhitelist) cmd[3] = "smartWalletWhitelist"; + else if (name == ContractType.veBoostProxy) cmd[3] = "veBoostProxy"; + else if (name == ContractType.GaugeController) cmd[3] = "gaugeController"; + else if (name == ContractType.AngleDistributor) cmd[3] = "angleDistributor"; + else if (name == ContractType.AngleMiddleman) cmd[3] = "angleMiddleman"; + else if (name == ContractType.FeeDistributor) cmd[3] = "feeDistributor"; + else revert("contract not supported"); + bytes memory res = vm.ffi(cmd); + // When process exit code is 1, it will return an empty bytes "0x" if (res.length == 0) revert("Chain not supported"); - return ILayerZeroEndpoint(address(bytes20(res))); + return address(bytes20(res)); } function stringToUint(string memory s) public pure returns (uint) { diff --git a/scripts/interaction/CrossChainProposal.s.sol b/scripts/interaction/CrossChainProposal.s.sol index b7a182a..fead025 100644 --- a/scripts/interaction/CrossChainProposal.s.sol +++ b/scripts/interaction/CrossChainProposal.s.sol @@ -10,6 +10,7 @@ import { ProposalSender } from "contracts/ProposalSender.sol"; contract CrossChainProposal is Utils { function run() external { // TODO can be modified to deploy on any chain + uint256 srcChainId = CHAIN_ETHEREUM; uint256 destChainId = CHAIN_POLYGON; // END @@ -18,7 +19,11 @@ contract CrossChainProposal is Utils { address deployer = vm.addr(deployerPrivateKey); vm.label(deployer, "Deployer"); - TimelockControllerWithCounter timelockDestChain = TimelockControllerWithCounter(payable(timelock(destChainId))); + AngleGovernor governor = AngleGovernor(payable(_chainToContract(destChainId, ContractType.Governor))); + ProposalSender sender = ProposalSender(payable(_chainToContract(srcChainId, ContractType.ProposalSender))); + TimelockControllerWithCounter timelockDestChain = TimelockControllerWithCounter( + payable(_chainToContract(destChainId, ContractType.Timelock)) + ); address[] memory timelockTargets = new address[](1); uint256[] memory timelockValues = new uint256[](1); @@ -50,7 +55,7 @@ contract CrossChainProposal is Utils { batchCalldatas, bytes32(0), bytes32(0), - timelockDelayTest + timelockDelay ); } @@ -60,7 +65,6 @@ contract CrossChainProposal is Utils { string memory description = "Test Cross chain proposals (redue updateDelay to 200 + remove executor role) higher fee"; - ProposalSender sender = proposalSender(); uint256 feeLZ = 1 ether; targets[0] = address(sender); values[0] = feeLZ; @@ -71,10 +75,10 @@ contract CrossChainProposal is Utils { abi.encodePacked(uint16(1), uint256(300000)) ); - // uint256 proposalId = governor().propose(targets, values, calldatas, description); + // uint256 proposalId = governor.propose(targets, values, calldatas, description); uint256 proposalId = 0x7f3a7bfba6ab7cdc0f85cfaa8bc2b03178c4d28dabbf53a1908604d2cb2d6891; - governor().castVote(proposalId, 1); + governor.castVote(proposalId, 1); - governor().execute{ value: feeLZ }(targets, values, calldatas, keccak256(bytes(description))); + governor.execute{ value: feeLZ }(targets, values, calldatas, keccak256(bytes(description))); } } diff --git a/scripts/interaction/ProposalReceiverConnect.s.sol b/scripts/interaction/ProposalReceiverConnect.s.sol index 13ec7c5..e8a065a 100644 --- a/scripts/interaction/ProposalReceiverConnect.s.sol +++ b/scripts/interaction/ProposalReceiverConnect.s.sol @@ -10,6 +10,7 @@ import { ProposalSender } from "contracts/ProposalSender.sol"; contract ProposalReceiverConnect is Utils { function run() external { // TODO can be modified to deploy on any chain + uint256 srcChainId = CHAIN_ETHEREUM; uint256 destChainId = CHAIN_POLYGON; // END @@ -18,25 +19,30 @@ contract ProposalReceiverConnect is Utils { address deployer = vm.addr(deployerPrivateKey); vm.label(deployer, "Deployer"); + AngleGovernor governor = AngleGovernor(payable(_chainToContract(destChainId, ContractType.Governor))); + ProposalSender sender = ProposalSender(payable(_chainToContract(srcChainId, ContractType.ProposalSender))); + ProposalReceiver receiver = ProposalReceiver( + payable(_chainToContract(destChainId, ContractType.ProposalReceiver)) + ); + address[] memory targets = new address[](1); uint256[] memory values = new uint256[](1); bytes[] memory calldatas = new bytes[](1); string memory description = "Add new proposal Receiver on Polygon"; - ProposalSender sender = proposalSender(); targets[0] = address(sender); values[0] = 0; calldatas[0] = abi.encodeWithSelector( sender.setTrustedRemoteAddress.selector, getLZChainId(destChainId), - abi.encodePacked(proposalReceiver(destChainId)) + abi.encodePacked(receiver) ); - // uint256 proposalId = governor().propose(targets, values, calldatas, description); + // uint256 proposalId = governor.propose(targets, values, calldatas, description); uint256 proposalId = 0x5af180d896738e85d65edfa0f75944289b65485e86ee38fd0776e140a89634d4; - governor().castVote(proposalId, 1); + governor.castVote(proposalId, 1); - governor().execute(targets, values, calldatas, keccak256(bytes(description))); + governor.execute(targets, values, calldatas, keccak256(bytes(description))); } } diff --git a/scripts/interaction/ProposalSenderRetry.s.sol b/scripts/interaction/ProposalSenderRetry.s.sol index 7f40605..013a3ed 100644 --- a/scripts/interaction/ProposalSenderRetry.s.sol +++ b/scripts/interaction/ProposalSenderRetry.s.sol @@ -10,6 +10,7 @@ import { ProposalSender } from "contracts/ProposalSender.sol"; contract ProposalSenderRetry is Utils { function run() external { // TODO can be modified to deploy on any chain + uint256 srcChainId = CHAIN_ETHEREUM; uint256 destChainId = CHAIN_POLYGON; // END @@ -18,7 +19,7 @@ contract ProposalSenderRetry is Utils { address deployer = vm.addr(deployerPrivateKey); vm.label(deployer, "Deployer"); - ProposalSender sender = proposalSender(); + ProposalSender sender = ProposalSender(payable(_chainToContract(srcChainId, ContractType.ProposalSender))); bytes memory payload = hex"000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000010000000000000000000000001305d45d583378d38fa614bbd9b45d6a0704690d000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000002c48f2a0bb000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012c00000000000000000000000000000000000000000000000000000000000000020000000000000000000000001305d45d583378d38fa614bbd9b45d6a0704690d0000000000000000000000001305d45d583378d38fa614bbd9b45d6a0704690d0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002464d6235300000000000000000000000000000000000000000000000000000000000000fa0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000442f2ff15dd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e63000000000000000000000000fda462548ce04282f4b6d6619823a7c64fdc01850000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; diff --git a/scripts/interaction/TimelockExecute.s.sol b/scripts/interaction/TimelockExecute.s.sol index 89dc943..2bbb31c 100644 --- a/scripts/interaction/TimelockExecute.s.sol +++ b/scripts/interaction/TimelockExecute.s.sol @@ -18,7 +18,9 @@ contract TimelockExecute is Utils { address deployer = vm.addr(deployerPrivateKey); vm.label(deployer, "Deployer"); - TimelockControllerWithCounter timelockDestChain = TimelockControllerWithCounter(payable(timelock(chainId))); + TimelockControllerWithCounter timelockDestChain = TimelockControllerWithCounter( + payable(_chainToContract(chainId, ContractType.Timelock)) + ); address[] memory targets = new address[](2); uint256[] memory values = new uint256[](2); diff --git a/test/unit/ProposalLayerZeroRelayer.t.sol b/test/unit/ProposalLayerZeroRelayer.t.sol index 45ef3bb..d82d8c8 100644 --- a/test/unit/ProposalLayerZeroRelayer.t.sol +++ b/test/unit/ProposalLayerZeroRelayer.t.sol @@ -1033,22 +1033,22 @@ contract ProposalLayerZeroRelayer is SimulationSetup { value: 0, data: abi.encodeWithSelector(timelock(destChain).updateDelay.selector, newDelay) }); - string memory description = "Updating delay on Optimism"; - _crossChainProposal(destChain, p, description, 0.1 ether, hex"", address(0)); - assertEq(timelock(destChain).getMinDelay() == newDelay, true); - - p[0].data = abi.encodeWithSelector(timelock(destChain).updateDelay.selector, oldDelay); - vm.selectFork(forkIdentifier[1]); - // Making the call revert to force replay - assertEq(uint256(proposalSender().lastStoredPayloadNonce()), 0); - _dummyProposal(1, p, description, 0.1 ether, hex""); - assertEq(uint256(proposalSender().lastStoredPayloadNonce()), 0); + { + string memory description = "Updating delay on Optimism"; + _crossChainProposal(destChain, p, description, 0.1 ether, hex"", address(0)); + assertEq(timelock(destChain).getMinDelay() == newDelay, true); + + p[0].data = abi.encodeWithSelector(timelock(destChain).updateDelay.selector, oldDelay); + vm.selectFork(forkIdentifier[1]); + // Making the call revert to force replay + assertEq(uint256(proposalSender().lastStoredPayloadNonce()), 0); + _dummyProposal(1, p, description, 0.1 ether, hex""); + assertEq(uint256(proposalSender().lastStoredPayloadNonce()), 0); + } vm.selectFork(forkIdentifier[destChain]); bytes memory payload = hex"000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000001000000000000000000000000a0cb889707d426a7a386870a03bc70d1b06975980000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000012401d5062a000000000000000000000000a0cb889707d426a7a386870a03bc70d1b0697598000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000015180000000000000000000000000000000000000000000000000000000000000002464d6235300000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; - bytes memory adapterParams = abi.encodePacked(uint16(1), uint256(300000)); - bytes memory execution = abi.encode(getLZChainId(destChain), payload, adapterParams, 0.1 ether); vm.mockCallRevert( address(timelock(destChain)), abi.encodeWithSelector(timelock(destChain).schedule.selector), diff --git a/utils/contractAddress.js b/utils/contractAddress.js index 6191950..1ca6422 100644 --- a/utils/contractAddress.js +++ b/utils/contractAddress.js @@ -24,6 +24,21 @@ if(contracTtype == "governor") contract = registry(parsedInput)?.AngleGovernor; else if(contracTtype == "proposalReceiver") contract = registry(parsedInput)?.ProposalReceiver; else if(contracTtype == "timelock") contract = registry(parsedInput)?.Timelock; else if(contracTtype == "proposalSender") contract = registry(parsedInput)?.ProposalSender; +else if(contracTtype == "guardian") contract = registry(parsedInput)?.Guardian; +else if(contracTtype == "treasury") contract = registry(parsedInput)?.agEUR?.Treasury; +else if(contracTtype == "stEUR") contract = registry(parsedInput)?.agEUR?.Savings; +else if(contracTtype == "transmuterAgEUR") contract = registry(parsedInput)?.agEUR?.Transmuter; +else if(contracTtype == "coreBorrow") contract = registry(parsedInput)?.CoreBorrow; +else if(contracTtype == "governorMultisig") contract = registry(parsedInput)?.Governor; +else if(contracTtype == "proxyAdmin") contract = registry(parsedInput)?.ProxyAdmin; +else if(contracTtype == "angle") contract = registry(parsedInput)?.ANGLE; +else if(contracTtype == "veANGLE") contract = registry(parsedInput)?.veANGLE; +else if(contracTtype == "smartWalletWhitelist") contract = registry(parsedInput)?.SmartWalletWhitelist; +else if(contracTtype == "veBoostProxy") contract = registry(parsedInput)?.veBoostProxy; +else if(contracTtype == "gaugeController") contract = registry(parsedInput)?.GaugeController; +else if(contracTtype == "angleDistributor") contract = registry(parsedInput)?.AngleDistributor; +else if(contracTtype == "angleMiddleman") contract = registry(parsedInput)?.Middleman; +else if(contracTtype == "feeDistributor") contract = registry(parsedInput)?.FeeDistributor_sanUSDC_EUR; if(!contract) process.exit(1); // Call the function with the input