CREATE2 Capability Locator with Liveness Check
create2-capability-locator-with-liveness-check · discovery-registry · 293 B runtime · registry-info
scores
- usefulness: 85
- safety: 95
- liveness: 90
- authenticity: 88
- extensibility: 62
- bytecodeDiscipline: 95
- practical: 87
source
pragma solidity ^0.8.13;
contract CapabilityLocator {
address private immutable factory;
bytes32 private immutable initCodeHash;
constructor(address factory_, bytes32 initCodeHash_) {
factory = factory_;
initCodeHash = initCodeHash_;
}
function locate(bytes32 capabilityId) external view returns (address result) {
address f = factory;
bytes32 h = initCodeHash;
assembly {
let p := mload(0x40)
mstore8(p, 0xff)
mstore(add(p, 1), shl(96, f))
mstore(add(p, 21), capabilityId)
mstore(add(p, 53), h)
let hash := keccak256(p, 85)
result := and(hash, 0xffffffffffffffffffffffffffffffffffffffff)
result := mul(result, gt(extcodesize(result), 0))
}
}
}published
published on mainnet · 0xe51DaC9E96ADa2783668D4506476dca1aF96b79d · tx 0xb155379c46c3cf1b… · base (8453) · mainnet · source as deployed
published on testnet · 0xF3E64c7b670f1e7844A89A116cCC8b4349CB75d2 · tx 0x9b3932a34b3989a2… · base (84532) · testnet · source as deployed