Skip to content

Commit

Permalink
Merge pull request #597 from sablier-labs/refactor/stringify-create2-…
Browse files Browse the repository at this point in the history
…salts

refactor: stringify create2 salts
  • Loading branch information
PaulRBerg authored Jul 2, 2023
2 parents eb5014d + 175d9c2 commit e6b705b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
4 changes: 2 additions & 2 deletions script/DeployDeterministicComptroller.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ contract DeployDeterministicComptroller is BaseScript {
/// @dev The presence of the salt instructs Forge to deploy contracts via this deterministic CREATE2 factory:
/// https://github.com/Arachnid/deterministic-deployment-proxy
function run(
uint256 create2Salt,
string memory create2Salt,
address initialAdmin
)
public
virtual
broadcaster
returns (SablierV2Comptroller comptroller)
{
comptroller = new SablierV2Comptroller{ salt: bytes32(create2Salt) }(initialAdmin);
comptroller = new SablierV2Comptroller{ salt: bytes32(abi.encodePacked(create2Salt)) }(initialAdmin);
}
}
11 changes: 6 additions & 5 deletions script/DeployDeterministicCore.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ contract DeployDeterministicCore is BaseScript {
/// @dev The presence of the salt instructs Forge to deploy the contract via a deterministic CREATE2 factory.
/// https://github.com/Arachnid/deterministic-deployment-proxy
function run(
uint256 create2Salt,
string memory create2Salt,
address initialAdmin,
uint256 maxSegmentCount
)
Expand All @@ -34,15 +34,16 @@ contract DeployDeterministicCore is BaseScript {
SablierV2NFTDescriptor nftDescriptor
)
{
comptroller = new SablierV2Comptroller{ salt: bytes32(create2Salt)}(initialAdmin);
nftDescriptor = new SablierV2NFTDescriptor{ salt: bytes32(create2Salt)}();
bytes32 salt = bytes32(abi.encodePacked(create2Salt));
comptroller = new SablierV2Comptroller{ salt: salt}(initialAdmin);
nftDescriptor = new SablierV2NFTDescriptor{ salt: salt}();
// forgefmt: disable-next-line
lockupDynamic = new SablierV2LockupDynamic{ salt: bytes32(create2Salt)}(
lockupDynamic = new SablierV2LockupDynamic{ salt: salt}(
initialAdmin,
comptroller,
nftDescriptor,
maxSegmentCount
);
lockupLinear = new SablierV2LockupLinear{ salt: bytes32(create2Salt)}(initialAdmin, comptroller, nftDescriptor);
lockupLinear = new SablierV2LockupLinear{ salt: salt}(initialAdmin, comptroller, nftDescriptor);
}
}
4 changes: 2 additions & 2 deletions script/DeployDeterministicLockupDynamic.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ contract DeployDeterministicLockupDynamic is BaseScript {
/// @dev The presence of the salt instructs Forge to deploy contracts via this deterministic CREATE2 factory:
/// https://github.com/Arachnid/deterministic-deployment-proxy
function run(
uint256 create2Salt,
string memory create2Salt,
address initialAdmin,
ISablierV2Comptroller initialComptroller,
ISablierV2NFTDescriptor initialNFTDescriptor,
Expand All @@ -24,7 +24,7 @@ contract DeployDeterministicLockupDynamic is BaseScript {
broadcaster
returns (SablierV2LockupDynamic lockupDynamic)
{
lockupDynamic = new SablierV2LockupDynamic{ salt: bytes32(create2Salt) }(
lockupDynamic = new SablierV2LockupDynamic{ salt: bytes32(abi.encodePacked(create2Salt)) }(
initialAdmin,
initialComptroller,
initialNFTDescriptor,
Expand Down
4 changes: 2 additions & 2 deletions script/DeployDeterministicLockupLinear.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ contract DeployDeterministicLockupLinear is BaseScript {
/// @dev The presence of the salt instructs Forge to deploy contracts via this deterministic CREATE2 factory:
/// https://github.com/Arachnid/deterministic-deployment-proxy
function run(
uint256 create2Salt,
string memory create2Salt,
address initialAdmin,
ISablierV2Comptroller initialComptroller,
ISablierV2NFTDescriptor initialNFTDescriptor
Expand All @@ -23,7 +23,7 @@ contract DeployDeterministicLockupLinear is BaseScript {
broadcaster
returns (SablierV2LockupLinear lockupLinear)
{
lockupLinear = new SablierV2LockupLinear{ salt: bytes32(create2Salt) }(
lockupLinear = new SablierV2LockupLinear{ salt: bytes32(abi.encodePacked(create2Salt)) }(
initialAdmin,
initialComptroller,
initialNFTDescriptor
Expand Down
4 changes: 2 additions & 2 deletions script/DeployDeterministicNFTDescriptor.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { BaseScript } from "./Base.s.sol";
contract DeployDeterministicNFTDescriptor is BaseScript {
/// @dev The presence of the salt instructs Forge to deploy contracts via this deterministic CREATE2 factory:
/// https://github.com/Arachnid/deterministic-deployment-proxy
function run(uint256 create2Salt) public virtual broadcaster returns (SablierV2NFTDescriptor nftDescriptor) {
nftDescriptor = new SablierV2NFTDescriptor{ salt: bytes32(create2Salt) }();
function run(string memory create2Salt) public virtual broadcaster returns (SablierV2NFTDescriptor nftDescriptor) {
nftDescriptor = new SablierV2NFTDescriptor{ salt: bytes32(abi.encodePacked(create2Salt)) }();
}
}

0 comments on commit e6b705b

Please sign in to comment.