Skip to content

Commit

Permalink
remove unnecessary creator check, since it's a part of address creati…
Browse files Browse the repository at this point in the history
…on under CREATE2
  • Loading branch information
mdtanrikulu committed Nov 21, 2024
1 parent 195f151 commit b7d1d1c
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/VerifiableFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ interface IProxy {
function salt() external view returns (uint256);

function owner() external view returns (address);

function creator() external view returns (address);
}

contract VerifiableFactory {
Expand Down Expand Up @@ -73,21 +71,14 @@ contract VerifiableFactory {
}
try IProxy(proxy).salt() returns (uint256 salt) {
try IProxy(proxy).owner() returns (address owner) {
try IProxy(proxy).creator() returns (address creator) {
return _verifyContract(proxy, creator, owner, salt);
} catch {}
return _verifyContract(proxy, owner, salt);
} catch {}
} catch {}

return false;
}

function _verifyContract(address proxy, address creator, address owner, uint256 salt) private view returns (bool) {
// verify the creator matches this factory
if (address(this) != creator) {
return false;
}

function _verifyContract(address proxy, address owner, uint256 salt) private view returns (bool) {
// reconstruct the address using CREATE2 and verify it matches
bytes32 outerSalt = keccak256(abi.encode(owner, salt));

Expand Down

0 comments on commit b7d1d1c

Please sign in to comment.