Skip to content

Commit

Permalink
feat do a test for setting the rate on the savings contract
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeNervoXS committed Jan 15, 2024
1 parent 59656d4 commit 3af5b78
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 165 deletions.
1 change: 1 addition & 0 deletions helpers/createProposal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
51 changes: 0 additions & 51 deletions scripts/proposals/borrow/PauseVaultManagers.s.sol

This file was deleted.

62 changes: 0 additions & 62 deletions scripts/proposals/borrow/SetRateVaultManager.s.sol

This file was deleted.

28 changes: 6 additions & 22 deletions scripts/proposals/payload.json
Original file line number Diff line number Diff line change
@@ -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
}
}
3 changes: 0 additions & 3 deletions scripts/proposals/savings/SavingsSetRate.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
32 changes: 32 additions & 0 deletions test/scripts/SavingsSetRateTest.t.sol
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
Loading

0 comments on commit 3af5b78

Please sign in to comment.