Skip to content

Commit

Permalink
test: start of an integration test for pod + timelock
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-waite committed Mar 30, 2022
1 parent b9787f5 commit b000470
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
4 changes: 2 additions & 2 deletions contracts/test/integration/fixtures/Gnosis.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function createGnosisTx(
bytes memory txData,
uint256 ownerPrivateKey,
Vm vm
) {
) returns (bool) {
{
bytes memory gnosisDataToSign = IGnosisSafe(safe).encodeTransactionData(
txTarget,
Expand Down Expand Up @@ -45,6 +45,6 @@ function createGnosisTx(
payable(address(0)), // refundReceiver
signatures // Packed signatures
);
require(success, "Gnosis Tx failed");
return success;
}
}
30 changes: 26 additions & 4 deletions contracts/test/integration/governance/PodFactory.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,35 @@ contract PodFactoryIntegrationTest is DSTest {

/// @notice Valdiate that can create a transaction in the pod and that it progresses to the timelock
function testCreateTxInOptimisticPod() public {
// 1. Deploy pod
IPodFactory.PodConfig memory podConfig = getPodParams(podAdmin);
// 1. Deploy Dummy contract to perform a transaction on
DummyStorage dummyContract = new DummyStorage();
assertEq(dummyContract.getVariable(), 5);

// 2. Deploy pod
(
IPodFactory.PodConfig memory podConfig,
uint256 ownerPrivateKey
) = getPodParams(podAdmin);
vm.prank(feiDAOTimelock);
(uint256 podId, address podTimelock, address safe) = factory
.createChildOptimisticPod(podConfig);

// 2. Create transaction on the pod's Gnosis Safe
// IGnosisSafe()
// 3. Create and execute transaction on the pod's Gnosis Safe. Transaction sets a storage variable on a mock contract
uint256 newDummyContractVar = 10;
bytes memory data = abi.encodePacked(
bytes4(keccak256(bytes("setVariable(uint256)"))),
newDummyContractVar
);

bool txExecutedStatus = createGnosisTx(
safe,
address(dummyContract),
data,
ownerPrivateKey,
vm
);
assertTrue(txExecutedStatus);

// TODO
}
}

0 comments on commit b000470

Please sign in to comment.