mirror of
https://github.com/0xbow-io/privacy-pools-core.git
synced 2026-01-10 09:58:00 -05:00
fix: entrypoint impl deterministic address
This commit is contained in:
@@ -106,15 +106,16 @@ abstract contract DeployProtocol is Script {
|
||||
}
|
||||
|
||||
function _deployEntrypoint() private {
|
||||
// Deploy implementation at any address
|
||||
address _impl = address(new Entrypoint());
|
||||
// Deploy Entrypoint implementation
|
||||
address _impl =
|
||||
CreateX.deployCreate2(DeployLib.salt(deployer, DeployLib.ENTRYPOINT_IMPL_SALT), type(Entrypoint).creationCode);
|
||||
|
||||
// Encode `initialize` call data
|
||||
bytes memory _intializationData = abi.encodeCall(Entrypoint.initialize, (owner, postman));
|
||||
|
||||
// Deploy proxy and initialize
|
||||
address _entrypoint = CreateX.deployCreate2(
|
||||
DeployLib.salt(deployer, DeployLib.ENTRYPOINT_SALT),
|
||||
DeployLib.salt(deployer, DeployLib.ENTRYPOINT_PROXY_SALT),
|
||||
abi.encodePacked(type(ERC1967Proxy).creationCode, abi.encode(_impl, _intializationData))
|
||||
);
|
||||
|
||||
|
||||
@@ -20,11 +20,12 @@ library DeployLib {
|
||||
* @dev Predefined salt values for each contract type
|
||||
* @notice These values ensure deterministic addresses across deployments
|
||||
*/
|
||||
bytes11 internal constant ENTRYPOINT_SALT = bytes11(keccak256('Entrypoint1'));
|
||||
bytes11 internal constant SIMPLE_POOL_SALT = bytes11(keccak256(abi.encodePacked('PrivacyPoolSimple1')));
|
||||
bytes11 internal constant COMPLEX_POOL_SALT = bytes11(keccak256(abi.encodePacked('PrivacyPoolComplex1')));
|
||||
bytes11 internal constant WITHDRAWAL_VERIFIER_SALT = bytes11(keccak256(abi.encodePacked('WithdrawalVerifier1')));
|
||||
bytes11 internal constant RAGEQUIT_VERIFIER_SALT = bytes11(keccak256(abi.encodePacked('RagequitVerifier1')));
|
||||
bytes11 internal constant ENTRYPOINT_IMPL_SALT = bytes11(keccak256('EntrypointImplementation_1'));
|
||||
bytes11 internal constant ENTRYPOINT_PROXY_SALT = bytes11(keccak256('EntrypointProxy_1'));
|
||||
bytes11 internal constant SIMPLE_POOL_SALT = bytes11(keccak256(abi.encodePacked('PrivacyPoolSimple_1')));
|
||||
bytes11 internal constant COMPLEX_POOL_SALT = bytes11(keccak256(abi.encodePacked('PrivacyPoolComplex_1')));
|
||||
bytes11 internal constant WITHDRAWAL_VERIFIER_SALT = bytes11(keccak256(abi.encodePacked('WithdrawalVerifier_1')));
|
||||
bytes11 internal constant RAGEQUIT_VERIFIER_SALT = bytes11(keccak256(abi.encodePacked('RagequitVerifier_1')));
|
||||
|
||||
/**
|
||||
* @dev Creates a custom salt for deterministic deployments
|
||||
|
||||
Reference in New Issue
Block a user