@@ -17,25 +17,25 @@ library UUPSProxyDeployer {
1717 Vm private constant vm = StdConstants.VM;
1818
1919 /**
20- * Deploys a UUPS proxy contract and its implementation using the CreateX Factory
20+ * Deploys a UUPS proxy contract and its implementation in create2 mode using CreateX Factory.
2121 * @param contractName The name of the contract to deploy (used to fetch creation code)
2222 * @param constructorData The constructor arguments for the implementation contract
2323 * @param initializeData The initialization data for the proxy contract
24- * @param createXFactory The address of the CreateX factory
25- * @param salt The salt for deterministic deployment
24+ * @param createxFactory The address of the CreateX factory
25+ * @param createxSalt The salt for deterministic deployment
2626 * @return The address of the deployed proxy
2727 */
28- function deployUUPSProxyWithCreateX (
28+ function deployUsingCreateX (
2929 string memory contractName ,
3030 bytes memory constructorData ,
3131 bytes memory initializeData ,
32- address createXFactory ,
33- bytes32 salt
32+ address createxFactory ,
33+ bytes32 createxSalt
3434 ) internal returns (address ) {
35- ICreateX createX = ICreateX (createXFactory);
36- address implementation = deployImplementation (contractName, constructorData, createX );
37- address proxy = createX .deployCreate2AndInit (
38- salt ,
35+ address implementation =
36+ deployImplementationUsingCreateX (contractName, constructorData, createxFactory, createxSalt );
37+ address proxy = ICreateX (createxFactory) .deployCreate2AndInit (
38+ createxSalt ,
3939 abi.encodePacked (type (ERC1967Proxy ).creationCode, abi.encode (implementation, "" )), // initCode
4040 initializeData,
4141 ICreateX.Values ({constructorAmount: 0 , initCallAmount: 0 }) // values for CreateX
@@ -45,18 +45,22 @@ library UUPSProxyDeployer {
4545 }
4646
4747 /**
48- * Deploys the implementation contract using tradition `create` .
48+ * Deploys the implementation contract in create2 mode using CreateX factory .
4949 * @param contractName The name of the contract to deploy (used to fetch creation code)
5050 * @param constructorData The constructor arguments for the implementation contract
5151 * @param createxFactory The address of the CreateX factory
52+ * @param createxSalt The salt for deterministic deployment
5253 * @return The address of the deployed implementation contract
5354 */
54- function deployImplementation (string memory contractName , bytes memory constructorData , ICreateX createxFactory )
55- internal
56- returns (address )
57- {
55+ function deployImplementationUsingCreateX (
56+ string memory contractName ,
57+ bytes memory constructorData ,
58+ address createxFactory ,
59+ bytes32 createxSalt
60+ ) internal returns (address ) {
5861 bytes memory creationCode = vm.getCode (contractName);
59- address implementation = createxFactory.deployCreate (abi.encodePacked (creationCode, constructorData));
62+ address implementation =
63+ ICreateX (createxFactory).deployCreate2 (createxSalt, abi.encodePacked (creationCode, constructorData));
6064 console.log ("Implementation deployed at: " , implementation);
6165 return implementation;
6266 }
0 commit comments