Skip to content

Commit

Permalink
fix: re added create2 methods
Browse files Browse the repository at this point in the history
  • Loading branch information
sendra committed Jul 29, 2024
1 parent 5a9a33a commit 78bd3b6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/solidity-utils
14 changes: 8 additions & 6 deletions scripts/BaseScript.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@
pragma solidity ^0.8.0;

import {ChainIds, TestNetChainIds} from 'solidity-utils/contracts/utils/ChainHelpers.sol';
import {Create2Utils} from 'solidity-utils/contracts/utils/ScriptUtils.sol';

abstract contract BaseScript {
function TRANSACTION_NETWORK() internal view virtual returns (uint256);

// Should only implement as:
// return Create2Utils.create2Deploy(keccak256(abi.encode(salt)), byteCode);
function _deployByteCode(
bytes memory byteCode,
string memory salt
) internal virtual returns (address);
) internal virtual returns (address) {
return Create2Utils.create2Deploy(keccak256(abi.encode(salt)), byteCode);
}

// Should only implement as:
// return Create2Utils.computeCreate2Address(salt, adapterCode);
function _computeByteCodeAddress(
bytes memory byteCode,
string memory salt
) internal virtual returns (address);
) internal virtual returns (address) {
bytes32 encodedSalt = keccak256(abi.encode(salt));
return Create2Utils.computeCreate2Address(salt, byteCode);
}
}

0 comments on commit 78bd3b6

Please sign in to comment.