Skip to content

Commit

Permalink
Add deploy script test
Browse files Browse the repository at this point in the history
  • Loading branch information
garyghayrat committed Jan 5, 2024
1 parent 12039aa commit 7997644
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions test/Deploy.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.23;

import {Deploy} from "script/Deploy.s.sol";
import {Test} from "forge-std/Test.sol";
import {ERC5564Announcer} from "src/ERC5564Announcer.sol";
import {ERC6538Registry} from "src/ERC6538Registry.sol";

contract DeployTest is Test, Deploy {
bytes announcerContractCode;
ERC5564Announcer announcerTestDeployment;

function setUp() public {
announcerTestDeployment = new ERC5564Announcer();
announcerContractCode = address(announcerTestDeployment).code;
}

function test_Deploy() external {
bytes memory erc5564CreationCode = abi.encodePacked(type(ERC5564Announcer).creationCode);
bytes memory erc6538CreationCode = abi.encodePacked(type(ERC6538Registry).creationCode);

address erc5564ComputedAddress =
computeCreate2Address(salt, keccak256(erc5564CreationCode), deployer);
address erc6538ComputedAddress =
computeCreate2Address(salt, keccak256(erc6538CreationCode), deployer);

require(erc5564ComputedAddress.code.length == 0);
require(erc6538ComputedAddress.code.length == 0);

/// Run deploy script
Deploy.run();

assertTrue(erc5564ComputedAddress.code.length > 0);
assertTrue(erc6538ComputedAddress.code.length > 0);
assertEq(erc5564ComputedAddress.code, announcerContractCode);
}
}

0 comments on commit 7997644

Please sign in to comment.