-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #280 from sablier-labs/feat/util-for-salt
feat: add a util function to construct the create2 salt
- Loading branch information
Showing
5 changed files
with
57 additions
and
7 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
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
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
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
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,23 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
pragma solidity >=0.8.19 <0.9.0; | ||
|
||
import { Strings } from "@openzeppelin/contracts/utils/Strings.sol"; | ||
import { PRBTest } from "@prb/test/src/PRBTest.sol"; | ||
|
||
import { BaseScript } from "script/Base.s.sol"; | ||
|
||
contract BaseScript_Test is PRBTest { | ||
using Strings for uint256; | ||
|
||
BaseScript internal baseScript = new BaseScript(); | ||
|
||
function test_ConstructCreate2Salt() public { | ||
string memory chainId = block.chainid.toString(); | ||
string memory version = "1.1.1"; | ||
string memory salt = string.concat("ChainID ", chainId, ", Version ", version); | ||
|
||
bytes32 actualSalt = baseScript.constructCreate2Salt(); | ||
bytes32 expectedSalt = bytes32(abi.encodePacked(salt)); | ||
assertEq(actualSalt, expectedSalt, "CREATE2 salt mismatch"); | ||
} | ||
} |