Source Code
Overview
ETH Balance
0 ETH
More Info
ContractCreator
Multichain Info
N/A
Latest 7 from a total of 7 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Create Email App... | 20450120 | 108 days ago | IN | 0 ETH | 0.000000277116 | ||||
Create Email App... | 17940107 | 166 days ago | IN | 0 ETH | 0.000004354558 | ||||
Create Email App... | 16900334 | 190 days ago | IN | 0 ETH | 0.000080605092 | ||||
Create Email App... | 16866963 | 191 days ago | IN | 0 ETH | 0.000091422932 | ||||
Create Email App... | 16297713 | 204 days ago | IN | 0 ETH | 0.000013467902 | ||||
Create Email App... | 16296023 | 204 days ago | IN | 0 ETH | 0.000012954481 | ||||
Create Email App... | 16205603 | 206 days ago | IN | 0 ETH | 0.000000300608 |
Latest 8 internal transactions
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
20450120 | 108 days ago | Contract Creation | 0 ETH | |||
17940107 | 166 days ago | Contract Creation | 0 ETH | |||
16900334 | 190 days ago | Contract Creation | 0 ETH | |||
16866963 | 191 days ago | Contract Creation | 0 ETH | |||
16297713 | 204 days ago | Contract Creation | 0 ETH | |||
16296023 | 204 days ago | Contract Creation | 0 ETH | |||
16205603 | 206 days ago | Contract Creation | 0 ETH | |||
16205256 | 206 days ago | Contract Creation | 0 ETH |
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Source Code Verified (Exact Match)
Contract Name:
EmailApproverFactory
Compiler Version
v0.8.23+commit.f704f362
Optimization Enabled:
Yes with 100000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.20; import "@openzeppelin/contracts/utils/Create2.sol"; contract EmailApproverFactory { address public immutable _APPROVERIMPL; event EmailApproverCreation(address indexed proxy); constructor(address _approverImpl) { _APPROVERIMPL = _approverImpl; } function proxyCode() external view returns (bytes memory) { return _proxyCode(_APPROVERIMPL); } /** * @notice using solay ERC1967 https://github.com/Vectorized/solady/blob/5eff720c27746987dc95e5e2b720615d3d96f7ee/src/utils/LibClone.sol#L774C18-L774C18 */ function _proxyCode(address implementation) private pure returns (bytes memory deploymentData) { deploymentData = abi.encodePacked( hex"603d3d8160223d3973", implementation, hex"60095155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3" ); } function createEmailApprover(bytes32 _senderCommitment, bytes32 _salt) external returns (address proxy) { address addr = getEmailApproverAddress(_senderCommitment, _salt); uint256 codeSize = addr.code.length; if (codeSize > 0) { return addr; } bytes memory _initializer = abi.encodeWithSignature("initialize(bytes32)", _senderCommitment); bytes memory deploymentData = _proxyCode(_APPROVERIMPL); bytes32 salt = _calcSalt(_initializer, _salt); assembly ("memory-safe") { proxy := create2(0x0, add(deploymentData, 0x20), mload(deploymentData), salt) } if (proxy == address(0)) { revert(); } assembly ("memory-safe") { let succ := call(gas(), proxy, 0, add(_initializer, 0x20), mload(_initializer), 0, 0) if eq(succ, 0) { revert(0, 0) } } emit EmailApproverCreation(proxy); } function getEmailApproverAddress(bytes32 _senderCommitment, bytes32 _salt) public view returns (address proxy) { bytes memory _initializer = abi.encodeWithSignature("initialize(bytes32)", _senderCommitment); bytes memory deploymentData = _proxyCode(_APPROVERIMPL); bytes32 salt = _calcSalt(_initializer, _salt); proxy = Create2.computeAddress(salt, keccak256(deploymentData)); } function _calcSalt(bytes memory _initializer, bytes32 _salt) private pure returns (bytes32 salt) { return keccak256(abi.encodePacked(keccak256(_initializer), _salt)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Create2.sol) pragma solidity ^0.8.20; /** * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer. * `CREATE2` can be used to compute in advance the address where a smart * contract will be deployed, which allows for interesting new mechanisms known * as 'counterfactual interactions'. * * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more * information. */ library Create2 { /** * @dev Not enough balance for performing a CREATE2 deploy. */ error Create2InsufficientBalance(uint256 balance, uint256 needed); /** * @dev There's no code to deploy. */ error Create2EmptyBytecode(); /** * @dev The deployment failed. */ error Create2FailedDeployment(); /** * @dev Deploys a contract using `CREATE2`. The address where the contract * will be deployed can be known in advance via {computeAddress}. * * The bytecode for a contract can be obtained from Solidity with * `type(contractName).creationCode`. * * Requirements: * * - `bytecode` must not be empty. * - `salt` must have not been used for `bytecode` already. * - the factory must have a balance of at least `amount`. * - if `amount` is non-zero, `bytecode` must have a `payable` constructor. */ function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) { if (address(this).balance < amount) { revert Create2InsufficientBalance(address(this).balance, amount); } if (bytecode.length == 0) { revert Create2EmptyBytecode(); } /// @solidity memory-safe-assembly assembly { addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt) } if (addr == address(0)) { revert Create2FailedDeployment(); } } /** * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the * `bytecodeHash` or `salt` will result in a new destination address. */ function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) { return computeAddress(salt, bytecodeHash, address(this)); } /** * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}. */ function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) // Get free memory pointer // | | ↓ ptr ... ↓ ptr + 0x0B (start) ... ↓ ptr + 0x20 ... ↓ ptr + 0x40 ... | // |-------------------|---------------------------------------------------------------------------| // | bytecodeHash | CCCCCCCCCCCCC...CC | // | salt | BBBBBBBBBBBBB...BB | // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA | // | 0xFF | FF | // |-------------------|---------------------------------------------------------------------------| // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC | // | keccak(start, 85) | ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ | mstore(add(ptr, 0x40), bytecodeHash) mstore(add(ptr, 0x20), salt) mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff mstore8(start, 0xff) addr := keccak256(start, 85) } } }
{ "remappings": [ "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", "@solady/=lib/solady/", "@zk-email/contracts/=node_modules/@zk-email/contracts/", "@source/=src/", "ds-test/=lib/openzeppelin-contracts-upgradeable/lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "solady/=lib/solady/src/" ], "optimizer": { "enabled": true, "runs": 100000 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "viaIR": true, "libraries": {} }
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_approverImpl","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"proxy","type":"address"}],"name":"EmailApproverCreation","type":"event"},{"inputs":[],"name":"_APPROVERIMPL","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_senderCommitment","type":"bytes32"},{"internalType":"bytes32","name":"_salt","type":"bytes32"}],"name":"createEmailApprover","outputs":[{"internalType":"address","name":"proxy","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_senderCommitment","type":"bytes32"},{"internalType":"bytes32","name":"_salt","type":"bytes32"}],"name":"getEmailApproverAddress","outputs":[{"internalType":"address","name":"proxy","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxyCode","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60a03461007e57601f6105ce38819003918201601f19168301916001600160401b038311848410176100835780849260209460405283398101031261007e57516001600160a01b038116810361007e57608052604051610534908161009a8239608051818181609401528181610158015281816102b201526103580152f35b600080fd5b634e487b7160e01b600052604160045260246000fdfe604060808152600436101561001357600080fd5b600090813560e01c80636fa59bbc146101245780637aa4b301146100f4578063ad963790146100bc5763c7826fd91461004b57600080fd5b346100b857817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100b8576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b5080fd5b50346100b85760209073ffffffffffffffffffffffffffffffffffffffff6100ec6100e6366101e4565b906102ff565b915191168152f35b50346100b85760209073ffffffffffffffffffffffffffffffffffffffff6100ec61011e366101e4565b90610268565b50346100b857817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100b85761017c7f00000000000000000000000000000000000000000000000000000000000000006103ed565b9181519283916020808452825192836020860152825b8481106101ce57505050828201840152601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168101030190f35b8181018301518882018801528795508201610192565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc6040910112610218576004359060243590565b600080fd5b6060810190811067ffffffffffffffff82111761023957604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600b906102dc605593604051927f9498bd710000000000000000000000000000000000000000000000000000000060208501526024840152602483526102ad8361021d565b6102d67f00000000000000000000000000000000000000000000000000000000000000006103ed565b926104d3565b90602081519101209060405191604083015260208201523081520160ff81532090565b919061030b8184610268565b803b6103e857506040519060208201937f9498bd710000000000000000000000000000000000000000000000000000000085526024830152602482526103508261021d565b61038361037c7f00000000000000000000000000000000000000000000000000000000000000006103ed565b91836104d3565b815160206000930183f59373ffffffffffffffffffffffffffffffffffffffff85169283156103e45782918291519082885af1156103e157807f94cfecbc2fad08bf23cace228254d471d407215ecee7dae6b4fd12b8c1e3d23891a2565b80fd5b8280fd5b925050565b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000604051917f603d3d8160223d39730000000000000000000000000000000000000000000000602084015260601b1660298201527f60095155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e603d8201527f2076cc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d60605d8201527ef3000000000000000000000000000000000000000000000000000000000000607d820152605f81526080810181811067ffffffffffffffff8211176102395760405290565b602081519101209060405190602082019283526040820152604081526104f88161021d565b5190209056fea26469706673582212209cc0a575f74f4920b426f51e13e3aa014935c880b9c83269ac70ee4a159b584064736f6c63430008170033000000000000000000000000d7d99f54a4297c51fedf805fd9dcbd93e5fc884d
Deployed Bytecode
0x604060808152600436101561001357600080fd5b600090813560e01c80636fa59bbc146101245780637aa4b301146100f4578063ad963790146100bc5763c7826fd91461004b57600080fd5b346100b857817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100b8576020905173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000d7d99f54a4297c51fedf805fd9dcbd93e5fc884d168152f35b5080fd5b50346100b85760209073ffffffffffffffffffffffffffffffffffffffff6100ec6100e6366101e4565b906102ff565b915191168152f35b50346100b85760209073ffffffffffffffffffffffffffffffffffffffff6100ec61011e366101e4565b90610268565b50346100b857817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100b85761017c7f000000000000000000000000d7d99f54a4297c51fedf805fd9dcbd93e5fc884d6103ed565b9181519283916020808452825192836020860152825b8481106101ce57505050828201840152601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168101030190f35b8181018301518882018801528795508201610192565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc6040910112610218576004359060243590565b600080fd5b6060810190811067ffffffffffffffff82111761023957604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600b906102dc605593604051927f9498bd710000000000000000000000000000000000000000000000000000000060208501526024840152602483526102ad8361021d565b6102d67f000000000000000000000000d7d99f54a4297c51fedf805fd9dcbd93e5fc884d6103ed565b926104d3565b90602081519101209060405191604083015260208201523081520160ff81532090565b919061030b8184610268565b803b6103e857506040519060208201937f9498bd710000000000000000000000000000000000000000000000000000000085526024830152602482526103508261021d565b61038361037c7f000000000000000000000000d7d99f54a4297c51fedf805fd9dcbd93e5fc884d6103ed565b91836104d3565b815160206000930183f59373ffffffffffffffffffffffffffffffffffffffff85169283156103e45782918291519082885af1156103e157807f94cfecbc2fad08bf23cace228254d471d407215ecee7dae6b4fd12b8c1e3d23891a2565b80fd5b8280fd5b925050565b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000604051917f603d3d8160223d39730000000000000000000000000000000000000000000000602084015260601b1660298201527f60095155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e603d8201527f2076cc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d60605d8201527ef3000000000000000000000000000000000000000000000000000000000000607d820152605f81526080810181811067ffffffffffffffff8211176102395760405290565b602081519101209060405190602082019283526040820152604081526104f88161021d565b5190209056fea26469706673582212209cc0a575f74f4920b426f51e13e3aa014935c880b9c83269ac70ee4a159b584064736f6c63430008170033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000d7d99f54a4297c51fedf805fd9dcbd93e5fc884d
-----Decoded View---------------
Arg [0] : _approverImpl (address): 0xd7D99f54A4297C51FEdF805Fd9dCBd93E5fc884d
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000d7d99f54a4297c51fedf805fd9dcbd93e5fc884d
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.