generated from ScopeLift/foundry-template
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
12039aa
commit 7997644
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |