-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
Line 69 in 657068d
| if let Ok(proxy) = unsafe { RawDeploy::new().salt(salt).deploy(creation_code, value) } { |
pub fn deploy(salt: B256, creation_code: &[u8], value: U256) -> Result<Address> {
if let Ok(proxy) = unsafe { RawDeploy::new().salt(salt).deploy(creation_code, value) } {
let deployed = Self::get_deployed(salt)?;
RawCall::new_static()
.gas(evm::gas_left())
.call(proxy, creation_code)
.map(|ret| sol_data::Address::decode_single(ret.as_slice(), false).unwrap())
.map_err(|_| CREATE3Error::InitilizationFailed(InitilizationFailed {}))?;
Ok(deployed)
} else {
Err(CREATE3Error::DeploymentFailed(DeploymentFailed {}))
}
}Your code uses creation_code for the proxy. I believe that you should deploy the proxy code in the first call. Here Solmate's implementation
bytes internal constant PROXY_BYTECODE = hex"67_36_3d_3d_37_36_3d_34_f0_3d_52_60_08_60_18_f3";
bytes32 internal constant PROXY_BYTECODE_HASH = keccak256(PROXY_BYTECODE);
function deploy(
bytes32 salt,
bytes memory creationCode,
uint256 value
) internal returns (address deployed) {
bytes memory proxyChildBytecode = PROXY_BYTECODE;
address proxy;
assembly {
// Deploy a new contract with our pre-made bytecode via CREATE2.
// We start 32 bytes into the code to avoid copying the byte length.
proxy := create2(0, add(proxyChildBytecode, 32), mload(proxyChildBytecode), salt)
}
require(proxy != address(0), "DEPLOYMENT_FAILED");
deployed = getDeployed(salt);
(bool success, ) = proxy.call{value: value}(creationCode);
require(success && deployed.code.length != 0, "INITIALIZATION_FAILED");
}Metadata
Metadata
Assignees
Labels
No labels