diff --git a/helpers/createProposal.sh b/helpers/createProposal.sh index aea0d42..0514ed2 100644 --- a/helpers/createProposal.sh +++ b/helpers/createProposal.sh @@ -179,6 +179,7 @@ function main { echo "Script failed" fi + # TODO if the test fails we should abort testContract="${script}Test" echo "" echo "Running test" diff --git a/scripts/proposals/borrow/PauseVaultManagers.s.sol b/scripts/proposals/borrow/PauseVaultManagers.s.sol deleted file mode 100644 index 6cb98b2..0000000 --- a/scripts/proposals/borrow/PauseVaultManagers.s.sol +++ /dev/null @@ -1,51 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity ^0.8.20; - -import { console } from "forge-std/console.sol"; -import { IVaultManagerFunctions } from "borrow/interfaces/IVaultManager.sol"; -import { IERC721Metadata } from "oz/token/ERC721/extensions/IERC721Metadata.sol"; -import { ITreasury, Wrapper } from "../Wrapper.s.sol"; -import "../../Constants.s.sol"; - -/** This script suppose that the state of all the vaultManager on the chain are identical (all paused or unpause) -/** Otherwise behaviour is chaotic -*/ -contract PauseVaultManagers is Wrapper { - SubCall[] private subCalls; - - function _pauseVaultManagers(uint256 chainId) private { - vm.selectFork(forkIdentifier[chainId]); - ITreasury treasury = ITreasury(_chainToContract(chainId, ContractType.TreasuryAgEUR)); - - uint256 i; - while (true) { - try treasury.vaultManagerList(i) returns (address vault) { - string memory name = IERC721Metadata(vault).name(); - console.log("Pausing %s", name); - { - subCalls.push(SubCall(chainId, vault, 0, abi.encode(IVaultManagerFunctions.togglePause.selector))); - } - i++; - } catch { - break; - } - } - } - - function run() external { - uint256[] memory chainIds = vm.envUint("CHAIN_IDS", ","); - string memory description = "Pause all vaults"; - - for (uint256 i = 0; i < chainIds.length; i++) { - _pauseVaultManagers(chainIds[i]); - } - - ( - address[] memory targets, - uint256[] memory values, - bytes[] memory calldatas, - uint256[] memory chainIds2 - ) = _wrap(subCalls); - _serializeJson(targets, values, calldatas, chainIds2, description); - } -} diff --git a/scripts/proposals/borrow/SetRateVaultManager.s.sol b/scripts/proposals/borrow/SetRateVaultManager.s.sol deleted file mode 100644 index d284043..0000000 --- a/scripts/proposals/borrow/SetRateVaultManager.s.sol +++ /dev/null @@ -1,62 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity ^0.8.20; - -import { console } from "forge-std/console.sol"; -import { IERC721Metadata } from "oz/token/ERC721/extensions/IERC721Metadata.sol"; -import { ITreasury, Wrapper } from "../Wrapper.s.sol"; -import { IVaultManagerGovernance } from "scripts/Interfaces.s.sol"; -import "../../Constants.s.sol"; - -contract SetRateVaultManager is Wrapper { - SubCall[] private subCalls; - - function _setRateVaultManager(uint256 chainId) internal { - vm.selectFork(forkIdentifier[chainId]); - ITreasury treasury = ITreasury(_chainToContract(chainId, ContractType.TreasuryAgEUR)); - - uint256 i; - while (true) { - try treasury.vaultManagerList(i) returns (address vault) { - uint64 rate; - /** TODO complete */ - // Non yield bearing vaults - if (i == 0 || i == 1 || i == 2) rate = twoPoint5Rate; - else rate = fourRate; - /** END complete */ - - string memory name = IERC721Metadata(vault).name(); - console.log("Setting rate %s", name); - { - subCalls.push( - SubCall( - chainId, - vault, - 0, - abi.encodeWithSelector(IVaultManagerGovernance.setUint64.selector, rate, "IR") - ) - ); - } - i++; - } catch { - break; - } - } - } - - function run() external { - uint256[] memory chainIds = vm.envUint("CHAIN_IDS", ","); - string memory description = "Set rate for all vaults"; - - for (uint256 i = 0; i < chainIds.length; i++) { - _setRateVaultManager(chainIds[i]); - } - - ( - address[] memory targets, - uint256[] memory values, - bytes[] memory calldatas, - uint256[] memory chainIds2 - ) = _wrap(subCalls); - _serializeJson(targets, values, calldatas, chainIds2, description); - } -} diff --git a/scripts/proposals/payload.json b/scripts/proposals/payload.json index 457432b..81a1e66 100644 --- a/scripts/proposals/payload.json +++ b/scripts/proposals/payload.json @@ -1,35 +1,19 @@ { "calldatas": { - "0": "0x01d5062a00000000000000000000000009d81464c7293c774203e46e3c921559c8e9d53f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000015180000000000000000000000000000000000000000000000000000000000000002464d623530000000000000000000000000000000000000000000000000000000000093a8000000000000000000000000000000000000000000000000000000000", - "1": "0xbb5a944f000000000000000000000000000000000000000000000000000000000000006e000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000003800000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000001000000000000000000000000169487a55de79476125a56b07c36ca8dbf37a3730000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000012401d5062a000000000000000000000000169487a55de79476125a56b07c36ca8dbf37a373000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000015180000000000000000000000000000000000000000000000000000000000000002464d623530000000000000000000000000000000000000000000000000000000000093a8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022000100000000000000000000000000000000000000000000000000000000000493e0000000000000000000000000000000000000000000000000000000000000", - "2": "0xbb5a944f000000000000000000000000000000000000000000000000000000000000006d000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000003800000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000c24766a56732b85eee5a383ed6614abd34fb6310000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000012401d5062a0000000000000000000000000c24766a56732b85eee5a383ed6614abd34fb631000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000015180000000000000000000000000000000000000000000000000000000000000002464d623530000000000000000000000000000000000000000000000000000000000093a8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022000100000000000000000000000000000000000000000000000000000000000493e0000000000000000000000000000000000000000000000000000000000000", - "3": "0xbb5a944f0000000000000000000000000000000000000000000000000000000000000091000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000003800000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000001000000000000000000000000b2ea590fcea142dcceaeb3912da4c1df721848ef0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000012401d5062a000000000000000000000000b2ea590fcea142dcceaeb3912da4c1df721848ef000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000015180000000000000000000000000000000000000000000000000000000000000002464d623530000000000000000000000000000000000000000000000000000000000093a8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022000100000000000000000000000000000000000000000000000000000000000493e0000000000000000000000000000000000000000000000000000000000000", - "4": "0xbb5a944f000000000000000000000000000000000000000000000000000000000000006a000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000003800000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000010000000000000000000000007f27082eabdddc9dc3cc6632c9f594d210b9d43c0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000012401d5062a0000000000000000000000007f27082eabdddc9dc3cc6632c9f594d210b9d43c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000015180000000000000000000000000000000000000000000000000000000000000002464d623530000000000000000000000000000000000000000000000000000000000093a8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022000100000000000000000000000000000000000000000000000000000000000493e0000000000000000000000000000000000000000000000000000000000000", - "5": "0xbb5a944f00000000000000000000000000000000000000000000000000000000000000b8000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000003800000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000001000000000000000000000000f868da244c17cf0e288ae4a92c8636f072a7bae30000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000012401d5062a000000000000000000000000f868da244c17cf0e288ae4a92c8636f072a7bae3000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000015180000000000000000000000000000000000000000000000000000000000000002464d623530000000000000000000000000000000000000000000000000000000000093a8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022000100000000000000000000000000000000000000000000000000000000000493e0000000000000000000000000000000000000000000000000000000000000" + "0": "0x01d5062a000000000000000000000000004626a008b1acdc4c74ab51644093b155e59a23000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000151800000000000000000000000000000000000000000000000000000000000000024763e90230000000000000000000000000000000000000000000000001286f118ca64800000000000000000000000000000000000000000000000000000000000", + "1": "0xbb5a944f000000000000000000000000000000000000000000000000000000000000006e000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000003800000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000001000000000000000000000000169487a55de79476125a56b07c36ca8dbf37a3730000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000012401d5062a000000000000000000000000004626a008b1acdc4c74ab51644093b155e59a23000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000151800000000000000000000000000000000000000000000000000000000000000024763e90230000000000000000000000000000000000000000000000001286f118ca64800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022000100000000000000000000000000000000000000000000000000000000000493e0000000000000000000000000000000000000000000000000000000000000" }, "chainIds": { "0": 1, - "1": 42161, - "2": 137, - "3": 100, - "4": 43114, - "5": 8453 + "1": 42161 }, - "description": "Set min delay for timelock", + "description": "Set rate for all savings", "targets": { "0": "0x09D81464c7293C774203E46E3C921559c8E9D53f", - "1": "0x896D64B4B7265273dDCD00808f3579563f9790A8", - "2": "0x896D64B4B7265273dDCD00808f3579563f9790A8", - "3": "0x896D64B4B7265273dDCD00808f3579563f9790A8", - "4": "0x896D64B4B7265273dDCD00808f3579563f9790A8", - "5": "0x896D64B4B7265273dDCD00808f3579563f9790A8" + "1": "0x896D64B4B7265273dDCD00808f3579563f9790A8" }, "values": { "0": 0, - "1": 100000000000000000, - "2": 100000000000000000, - "3": 100000000000000000, - "4": 100000000000000000, - "5": 100000000000000000 + "1": 100000000000000000 } } \ No newline at end of file diff --git a/scripts/proposals/savings/SavingsSetRate.s.sol b/scripts/proposals/savings/SavingsSetRate.s.sol index 0e3d2f9..f71c36b 100644 --- a/scripts/proposals/savings/SavingsSetRate.s.sol +++ b/scripts/proposals/savings/SavingsSetRate.s.sol @@ -2,9 +2,6 @@ pragma solidity ^0.8.20; import { console } from "forge-std/console.sol"; -import { IVaultManagerFunctions } from "borrow/interfaces/IVaultManager.sol"; -import { IERC721Metadata } from "oz/token/ERC721/extensions/IERC721Metadata.sol"; - import { Wrapper } from "../Wrapper.s.sol"; import "../../Constants.s.sol"; diff --git a/test/scripts/SavingsSetRateTest.t.sol b/test/scripts/SavingsSetRateTest.t.sol new file mode 100644 index 0000000..96cd476 --- /dev/null +++ b/test/scripts/SavingsSetRateTest.t.sol @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity ^0.8.19; + +import { stdJson } from "forge-std/StdJson.sol"; +import { console } from "forge-std/console.sol"; +import { ScriptHelpers } from "./ScriptHelpers.t.sol"; +import "../../scripts/Constants.s.sol"; +import { TimelockControllerWithCounter } from "contracts/TimelockControllerWithCounter.sol"; +import { ProposalSender } from "contracts/ProposalSender.sol"; + +contract SavingsSetRateTest is ScriptHelpers { + using stdJson for string; + + uint256 constant newRate = fourPoint3Rate; + + function setUp() public override { + super.setUp(); + } + + function testScript() external { + uint256[] memory chainIds = _executeProposal(); + + // Now test that everything is as expected + for (uint256 i; i < chainIds.length; i++) { + uint256 chainId = chainIds[i]; + ISavings stEUR = ISavings(payable(_chainToContract(chainId, ContractType.StEUR))); + vm.selectFork(forkIdentifier[chainId]); + uint256 rate = stEUR.rate(); + assertEq(rate, newRate); + } + } +} diff --git a/test/scripts/ScriptHelpers.t.sol b/test/scripts/ScriptHelpers.t.sol index 287f434..689e488 100644 --- a/test/scripts/ScriptHelpers.t.sol +++ b/test/scripts/ScriptHelpers.t.sol @@ -16,6 +16,37 @@ contract ScriptHelpers is Test, Utils { uint256 constant valueEther = 1 ether; + function setUp() public virtual override { + super.setUp(); + + // TODO remove when on chain tx are passed to connect chains + vm.selectFork(forkIdentifier[CHAIN_SOURCE]); + ProposalSender proposalSender = ProposalSender( + payable(_chainToContract(CHAIN_SOURCE, ContractType.ProposalSender)) + ); + uint256[] memory ALL_CHAINS = new uint256[](10); + ALL_CHAINS[0] = CHAIN_LINEA; + ALL_CHAINS[1] = CHAIN_POLYGON; + ALL_CHAINS[2] = CHAIN_ARBITRUM; + ALL_CHAINS[3] = CHAIN_AVALANCHE; + ALL_CHAINS[4] = CHAIN_OPTIMISM; + ALL_CHAINS[5] = CHAIN_GNOSIS; + ALL_CHAINS[6] = CHAIN_BNB; + ALL_CHAINS[7] = CHAIN_CELO; + ALL_CHAINS[8] = CHAIN_POLYGONZKEVM; + ALL_CHAINS[9] = CHAIN_BASE; + + vm.startPrank(_chainToContract(CHAIN_SOURCE, ContractType.Governor)); + for (uint256 i; i < ALL_CHAINS.length; i++) { + uint256 chainId = ALL_CHAINS[i]; + proposalSender.setTrustedRemoteAddress( + getLZChainId(chainId), + abi.encodePacked(_chainToContract(chainId, ContractType.ProposalReceiver)) + ); + } + vm.stopPrank(); + } + function _executeProposal() public returns (uint256[] memory) { ( bytes[] memory calldatas, diff --git a/test/scripts/SetMinDelayTimelockTest.t.sol b/test/scripts/SetMinDelayTimelockTest.t.sol index dfb5cbe..ef2b2a1 100644 --- a/test/scripts/SetMinDelayTimelockTest.t.sol +++ b/test/scripts/SetMinDelayTimelockTest.t.sol @@ -18,33 +18,6 @@ contract SetMinDelayTimelockTest is ScriptHelpers { } function testScript() external { - // TODO remove when on chain tx are passed to connect chains - vm.selectFork(forkIdentifier[CHAIN_SOURCE]); - ProposalSender proposalSender = ProposalSender( - payable(_chainToContract(CHAIN_SOURCE, ContractType.ProposalSender)) - ); - uint256[] memory ALL_CHAINS = new uint256[](10); - ALL_CHAINS[0] = CHAIN_LINEA; - ALL_CHAINS[1] = CHAIN_POLYGON; - ALL_CHAINS[2] = CHAIN_ARBITRUM; - ALL_CHAINS[3] = CHAIN_AVALANCHE; - ALL_CHAINS[4] = CHAIN_OPTIMISM; - ALL_CHAINS[5] = CHAIN_GNOSIS; - ALL_CHAINS[6] = CHAIN_BNB; - ALL_CHAINS[7] = CHAIN_CELO; - ALL_CHAINS[8] = CHAIN_POLYGONZKEVM; - ALL_CHAINS[9] = CHAIN_BASE; - - vm.startPrank(_chainToContract(CHAIN_SOURCE, ContractType.Governor)); - for (uint256 i; i < ALL_CHAINS.length; i++) { - uint256 chainId = ALL_CHAINS[i]; - proposalSender.setTrustedRemoteAddress( - getLZChainId(chainId), - abi.encodePacked(_chainToContract(chainId, ContractType.ProposalReceiver)) - ); - } - vm.stopPrank(); - uint256[] memory chainIds = _executeProposal(); // Now test that everything is as expected