Skip to content

Commit

Permalink
Take into account dao in deployments test
Browse files Browse the repository at this point in the history
  • Loading branch information
ashhanai committed Feb 13, 2024
1 parent 3349a1f commit 594f996
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 10 deletions.
17 changes: 15 additions & 2 deletions deployments.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
"deployedChains": [1, 5, 10, 25, 56, 137, 338, 5000, 5001, 8453, 42161, 84531, 11155111],
"chains": {
"1": {
"productTimelock": "0x2cDf99aD1115Ea0E943E56dd26459E3e57788C12",
"protocolTimelock": "0x9b1ec4bc634db130ab7310d4e585338888030623",
"dao": "0x1B8383D2726E7e18189205337424a2631A2102F4",
"productTimelock": "0xd57e72A328AB1deC6b374c2babe2dc489819B5Ea",
"protocolTimelock": "0xd8dbdDf1c0FDdf9b5eCFA5C067C38DB66739FBAB",
"protocolSafe": "0x61a77B19b7F4dB82222625D7a969698894d77473",
"daoSafe": "0xd56635c0E91D31F88B89F195D3993a9e34516e59",
"feeCollector": "0xd56635c0E91D31F88B89F195D3993a9e34516e59",
Expand All @@ -21,6 +22,7 @@
"simpleLoanSimpleRequest": "0x9Cb87eC6448299aBc326F32d60E191Ef32Ab225D"
},
"5": {
"dao": "0x0000000000000000000000000000000000000000",
"productTimelock": "0x0000000000000000000000000000000000000000",
"protocolTimelock": "0x0000000000000000000000000000000000000000",
"protocolSafe": "0x61a77B19b7F4dB82222625D7a969698894d77473",
Expand All @@ -40,6 +42,7 @@
"simpleLoanSimpleRequest": "0x9Cb87eC6448299aBc326F32d60E191Ef32Ab225D"
},
"10": {
"dao": "0x0000000000000000000000000000000000000000",
"productTimelock": "0x60a0F7594793e3DC31DfE1cC930dF65B54e95B39",
"protocolTimelock": "0x744B83343a86F87Ed05a5f3A92939D6d81520F27",
"protocolSafe": "0xa7106a1C2498EaeF4AC1B594a6544c841623B327",
Expand All @@ -59,6 +62,7 @@
"simpleLoanSimpleRequest": "0x9Cb87eC6448299aBc326F32d60E191Ef32Ab225D"
},
"25": {
"dao": "0x0000000000000000000000000000000000000000",
"productTimelock": "0x60a0F7594793e3DC31DfE1cC930dF65B54e95B39",
"protocolTimelock": "0x744B83343a86F87Ed05a5f3A92939D6d81520F27",
"protocolSafe": "0xa7106a1C2498EaeF4AC1B594a6544c841623B327",
Expand All @@ -78,6 +82,7 @@
"simpleLoanSimpleRequest": "0x9Cb87eC6448299aBc326F32d60E191Ef32Ab225D"
},
"56": {
"dao": "0x0000000000000000000000000000000000000000",
"productTimelock": "0xd57e72A328AB1deC6b374c2babe2dc489819B5Ea",
"protocolTimelock": "0xd8dbdDf1c0FDdf9b5eCFA5C067C38DB66739FBAB",
"protocolSafe": "0x61a77B19b7F4dB82222625D7a969698894d77473",
Expand All @@ -97,6 +102,7 @@
"simpleLoanSimpleRequest": "0x9Cb87eC6448299aBc326F32d60E191Ef32Ab225D"
},
"137": {
"dao": "0x0000000000000000000000000000000000000000",
"productTimelock": "0x2cDf99aD1115Ea0E943E56dd26459E3e57788C12",
"protocolTimelock": "0x9b1ec4bc634db130ab7310d4e585338888030623",
"protocolSafe": "0x61a77B19b7F4dB82222625D7a969698894d77473",
Expand All @@ -116,6 +122,7 @@
"simpleLoanSimpleRequest": "0x9Cb87eC6448299aBc326F32d60E191Ef32Ab225D"
},
"338": {
"dao": "0x0000000000000000000000000000000000000000",
"productTimelock": "0x0000000000000000000000000000000000000000",
"protocolTimelock": "0x0000000000000000000000000000000000000000",
"protocolSafe": "0xa7106a1C2498EaeF4AC1B594a6544c841623B327",
Expand All @@ -135,6 +142,7 @@
"simpleLoanSimpleRequest": "0x9Cb87eC6448299aBc326F32d60E191Ef32Ab225D"
},
"5000": {
"dao": "0x0000000000000000000000000000000000000000",
"productTimelock": "0x60a0F7594793e3DC31DfE1cC930dF65B54e95B39",
"protocolTimelock": "0x744B83343a86F87Ed05a5f3A92939D6d81520F27",
"protocolSafe": "0xa7106a1C2498EaeF4AC1B594a6544c841623B327",
Expand All @@ -154,6 +162,7 @@
"simpleLoanSimpleRequest": "0x9Cb87eC6448299aBc326F32d60E191Ef32Ab225D"
},
"5001": {
"dao": "0x0000000000000000000000000000000000000000",
"productTimelock": "0x0000000000000000000000000000000000000000",
"protocolTimelock": "0x0000000000000000000000000000000000000000",
"protocolSafe": "0xa7106a1C2498EaeF4AC1B594a6544c841623B327",
Expand All @@ -173,6 +182,7 @@
"simpleLoanSimpleRequest": "0x9Cb87eC6448299aBc326F32d60E191Ef32Ab225D"
},
"8453": {
"dao": "0x0000000000000000000000000000000000000000",
"productTimelock": "0x60a0F7594793e3DC31DfE1cC930dF65B54e95B39",
"protocolTimelock": "0x744B83343a86F87Ed05a5f3A92939D6d81520F27",
"protocolSafe": "0xa7106a1C2498EaeF4AC1B594a6544c841623B327",
Expand All @@ -192,6 +202,7 @@
"simpleLoanSimpleRequest": "0x9Cb87eC6448299aBc326F32d60E191Ef32Ab225D"
},
"42161": {
"dao": "0x0000000000000000000000000000000000000000",
"productTimelock": "0x2cDf99aD1115Ea0E943E56dd26459E3e57788C12",
"protocolTimelock": "0x9b1ec4bc634db130ab7310d4e585338888030623",
"protocolSafe": "0x61a77B19b7F4dB82222625D7a969698894d77473",
Expand All @@ -211,6 +222,7 @@
"simpleLoanSimpleRequest": "0x9Cb87eC6448299aBc326F32d60E191Ef32Ab225D"
},
"84531": {
"dao": "0x0000000000000000000000000000000000000000",
"productTimelock": "0x0000000000000000000000000000000000000000",
"protocolTimelock": "0x0000000000000000000000000000000000000000",
"protocolSafe": "0xa7106a1C2498EaeF4AC1B594a6544c841623B327",
Expand All @@ -230,6 +242,7 @@
"simpleLoanSimpleRequest": "0x9Cb87eC6448299aBc326F32d60E191Ef32Ab225D"
},
"11155111": {
"dao": "0x0000000000000000000000000000000000000000",
"productTimelock": "0x0000000000000000000000000000000000000000",
"protocolTimelock": "0x0000000000000000000000000000000000000000",
"protocolSafe": "0xa7106a1C2498EaeF4AC1B594a6544c841623B327",
Expand Down
4 changes: 4 additions & 0 deletions src/Deployments.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ abstract contract Deployments is CommonBase {
struct Deployment {
PWNConfig config;
PWNConfig configSingleton;
address dao;
address daoSafe;
IPWNDeployer deployer;
address deployerSafe;
Expand All @@ -46,6 +47,8 @@ abstract contract Deployments is CommonBase {
PWNSimpleLoanSimpleRequest simpleLoanSimpleRequest;
}

address dao;

address productTimelock;
address protocolTimelock;

Expand Down Expand Up @@ -78,6 +81,7 @@ abstract contract Deployments is CommonBase {
bytes memory rawDeployment = json.parseRaw(string.concat(".chains.", block.chainid.toString()));
deployment = abi.decode(rawDeployment, (Deployment));

dao = deployment.dao;
productTimelock = deployment.productTimelock;
protocolTimelock = deployment.protocolTimelock;
deployerSafe = deployment.deployerSafe;
Expand Down
18 changes: 10 additions & 8 deletions test/integration/deployed/DeployedProtocol.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,33 @@ contract DeployedProtocolTest is DeploymentTest {
}

// TIMELOCK CONTROLLERS
bool hasTimelock = protocolTimelock != address(0) && productTimelock != address(0);
if (hasTimelock) {
bool haveTimelocks = protocolTimelock != address(0) && productTimelock != address(0);
if (haveTimelocks) {
address protocolTimelockOwner = dao == address(0) ? protocolSafe : dao;
TimelockController protocolTimelockController = TimelockController(payable(protocolTimelock));
// - protocol timelock has min delay of 14 days
assertEq(protocolTimelockController.getMinDelay(), 345_600);
// - protocol safe has PROPOSER role in protocol timelock
assertTrue(protocolTimelockController.hasRole(PROPOSER_ROLE, protocolSafe));
assertTrue(protocolTimelockController.hasRole(PROPOSER_ROLE, protocolTimelockOwner));
// - protocol safe has CANCELLER role in protocol timelock
assertTrue(protocolTimelockController.hasRole(CANCELLER_ROLE, protocolSafe));
assertTrue(protocolTimelockController.hasRole(CANCELLER_ROLE, protocolTimelockOwner));
// - everybody has EXECUTOR role in protocol timelock
assertTrue(protocolTimelockController.hasRole(EXECUTOR_ROLE, address(0)));

address productTimelockOwner = dao == address(0) ? daoSafe : dao;
TimelockController productTimelockController = TimelockController(payable(productTimelock));
// - product timelock has min delay of 4 days
assertEq(productTimelockController.getMinDelay(), 345_600);
// - dao safe has PROPOSER role in product timelock
assertTrue(productTimelockController.hasRole(PROPOSER_ROLE, daoSafe));
assertTrue(productTimelockController.hasRole(PROPOSER_ROLE, productTimelockOwner));
// - dao safe has CANCELLER role in product timelock
assertTrue(productTimelockController.hasRole(CANCELLER_ROLE, daoSafe));
assertTrue(productTimelockController.hasRole(CANCELLER_ROLE, productTimelockOwner));
// - everybody has EXECUTOR role in product timelock
assertTrue(productTimelockController.hasRole(EXECUTOR_ROLE, address(0)));
}

// CONFIG
if (hasTimelock) {
if (haveTimelocks) {
// - admin is protocol timelock
assertEq(vm.load(address(config), PROXY_ADMIN_SLOT), bytes32(uint256(uint160(protocolTimelock))));
// - owner is product timelock
Expand All @@ -71,7 +73,7 @@ contract DeployedProtocolTest is DeploymentTest {
assertEq(vm.load(configImplementation, bytes32(uint256(1))) << 88 >> 248, bytes32(uint256(1)));

// HUB
if (hasTimelock) {
if (haveTimelocks) {
// - owner is protocol timelock
assertEq(hub.owner(), protocolTimelock);
} else {
Expand Down

0 comments on commit 594f996

Please sign in to comment.