Overview
APE Balance
0 APE
APE Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 internal transaction
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
4620270 | 20 hrs ago | Contract Creation | 0 APE |
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 Name:
TrustedForwarderFactory
Compiler Version
v0.8.19+commit.7dd6d404
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/proxy/Clones.sol"; contract TrustedForwarderFactory { error TrustedForwarderFactory__TrustedForwarderInitFailed(address admin, address appSigner); event TrustedForwarderCreated(address indexed creator, address indexed trustedForwarder); // keccak256("__TrustedForwarder_init(address,address)") bytes4 constant private INIT_SELECTOR = 0x81ab13d7; address immutable public trustedForwarderImplementation; mapping(address => bool) public forwarders; constructor(address trustedForwarderImplementation_) { trustedForwarderImplementation = trustedForwarderImplementation_; } /** * @notice Returns true if the sender is a trusted forwarder, false otherwise. * @notice Addresses are added to the `forwarders` mapping when they are cloned via the `cloneTrustedForwarder` function. * * @dev This function allows for the TrustedForwarder contracts to be used as trusted forwarders within the TrustedForwarderERC2771Context mixin. * * @param sender The address to check. * @return True if the sender is a trusted forwarder, false otherwise. */ function isTrustedForwarder(address sender) external view returns (bool) { return forwarders[sender]; } /** * @notice Clones the TrustedForwarder implementation and initializes it. * * @dev To prevent hostile deployments, we hash the sender's address with the salt to create the final salt. * @dev This prevents the mining of specific contract addresses for deterministic deployments, but still allows for * @dev a canonical address to be created for each sender. * * @param admin The address to assign the admin role to. * @param appSigner The address to assign the app signer role to. This will be ignored if `enableAppSigner` is false. * @param salt The salt to use for the deterministic deployment. This is hashed with the sender's address to create the final salt. * * @return trustedForwarder The address of the newly created TrustedForwarder contract. */ function cloneTrustedForwarder(address admin, address appSigner, bytes32 salt) external returns (address trustedForwarder) { trustedForwarder = Clones.cloneDeterministic(trustedForwarderImplementation, keccak256(abi.encode(msg.sender, salt))); (bool success, ) = trustedForwarder.call(abi.encodeWithSelector(INIT_SELECTOR, admin, appSigner)); if (!success) { revert TrustedForwarderFactory__TrustedForwarderInitFailed(admin, appSigner); } forwarders[trustedForwarder] = true; emit TrustedForwarderCreated(msg.sender, trustedForwarder); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (proxy/Clones.sol) pragma solidity ^0.8.0; /** * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for * deploying minimal proxy contracts, also known as "clones". * * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies * > a minimal bytecode implementation that delegates all calls to a known, fixed address. * * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2` * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the * deterministic method. * * _Available since v3.4._ */ library Clones { /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create opcode, which should never revert. */ function clone(address implementation) internal returns (address instance) { /// @solidity memory-safe-assembly assembly { // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes // of the `implementation` address with the bytecode before the address. mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000)) // Packs the remaining 17 bytes of `implementation` with the bytecode after the address. mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3)) instance := create(0, 0x09, 0x37) } require(instance != address(0), "ERC1167: create failed"); } /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create2 opcode and a `salt` to deterministically deploy * the clone. Using the same `implementation` and `salt` multiple time will revert, since * the clones cannot be deployed twice at the same address. */ function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) { /// @solidity memory-safe-assembly assembly { // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes // of the `implementation` address with the bytecode before the address. mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000)) // Packs the remaining 17 bytes of `implementation` with the bytecode after the address. mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3)) instance := create2(0, 0x09, 0x37, salt) } require(instance != address(0), "ERC1167: create2 failed"); } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress( address implementation, bytes32 salt, address deployer ) internal pure returns (address predicted) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(add(ptr, 0x38), deployer) mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff) mstore(add(ptr, 0x14), implementation) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73) mstore(add(ptr, 0x58), salt) mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37)) predicted := keccak256(add(ptr, 0x43), 0x55) } } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress( address implementation, bytes32 salt ) internal view returns (address predicted) { return predictDeterministicAddress(implementation, salt, address(this)); } }
{ "remappings": [ "forge-std/=lib/forge-std/src/", "@openzeppelin/=lib/openzeppelin-contracts/", "ds-test/=lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "openzeppelin/=lib/openzeppelin-contracts/contracts/" ], "optimizer": { "enabled": true, "runs": 1000000 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } }, "evmVersion": "paris", "viaIR": false, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"trustedForwarderImplementation_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"address","name":"appSigner","type":"address"}],"name":"TrustedForwarderFactory__TrustedForwarderInitFailed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"creator","type":"address"},{"indexed":true,"internalType":"address","name":"trustedForwarder","type":"address"}],"name":"TrustedForwarderCreated","type":"event"},{"inputs":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"address","name":"appSigner","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"}],"name":"cloneTrustedForwarder","outputs":[{"internalType":"address","name":"trustedForwarder","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"forwarders","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"isTrustedForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"trustedForwarderImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60a060405234801561001057600080fd5b5060405161057a38038061057a83398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b6080516104e9610091600039600081816056015261013a01526104e96000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80630f99ab9814610051578063572b6c05146100a257806376101c0a146100eb578063f46d57c3146100fe575b600080fd5b6100787f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6100db6100b0366004610426565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205460ff1690565b6040519015158152602001610099565b6100786100f9366004610448565b610121565b6100db61010c366004610426565b60006020819052908152604090205460ff1681565b60408051336020820152908101829052600090610178907f00000000000000000000000000000000000000000000000000000000000000009060600160405160208183030381529060405280519060200120610333565b6040805173ffffffffffffffffffffffffffffffffffffffff878116602483015286811660448084019190915283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f81ab13d7000000000000000000000000000000000000000000000000000000001790529151929350600092918416916102149190610484565b6000604051808303816000865af19150503d8060008114610251576040519150601f19603f3d011682016040523d82523d6000602084013e610256565b606091505b50509050806102b6576040517fc1d4a79100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8087166004830152851660248201526044015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff821660008181526020819052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555133917fa853f409d7f35adcac6fe80e553b39788513690b76400aca5a478ecc51bdba3691a3509392505050565b6000763d602d80600a3d3981f3363d3d373d3d3d363d730000008360601b60e81c176000526e5af43d82803e903d91602b57fd5bf38360781b1760205281603760096000f5905073ffffffffffffffffffffffffffffffffffffffff81166103f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f455243313136373a2063726561746532206661696c656400000000000000000060448201526064016102ad565b92915050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461042157600080fd5b919050565b60006020828403121561043857600080fd5b610441826103fd565b9392505050565b60008060006060848603121561045d57600080fd5b610466846103fd565b9250610474602085016103fd565b9150604084013590509250925092565b6000825160005b818110156104a5576020818601810151858301520161048b565b50600092019182525091905056fea264697066735822122040f722c54e2b473f3601c678616f6d13c61f4f3ca085d95514f28035ba9f9eb964736f6c63430008130033000000000000000000000000ff000047abea9064c699c0727148776e4e17771c
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061004c5760003560e01c80630f99ab9814610051578063572b6c05146100a257806376101c0a146100eb578063f46d57c3146100fe575b600080fd5b6100787f000000000000000000000000ff000047abea9064c699c0727148776e4e17771c81565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6100db6100b0366004610426565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205460ff1690565b6040519015158152602001610099565b6100786100f9366004610448565b610121565b6100db61010c366004610426565b60006020819052908152604090205460ff1681565b60408051336020820152908101829052600090610178907f000000000000000000000000ff000047abea9064c699c0727148776e4e17771c9060600160405160208183030381529060405280519060200120610333565b6040805173ffffffffffffffffffffffffffffffffffffffff878116602483015286811660448084019190915283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f81ab13d7000000000000000000000000000000000000000000000000000000001790529151929350600092918416916102149190610484565b6000604051808303816000865af19150503d8060008114610251576040519150601f19603f3d011682016040523d82523d6000602084013e610256565b606091505b50509050806102b6576040517fc1d4a79100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8087166004830152851660248201526044015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff821660008181526020819052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555133917fa853f409d7f35adcac6fe80e553b39788513690b76400aca5a478ecc51bdba3691a3509392505050565b6000763d602d80600a3d3981f3363d3d373d3d3d363d730000008360601b60e81c176000526e5af43d82803e903d91602b57fd5bf38360781b1760205281603760096000f5905073ffffffffffffffffffffffffffffffffffffffff81166103f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f455243313136373a2063726561746532206661696c656400000000000000000060448201526064016102ad565b92915050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461042157600080fd5b919050565b60006020828403121561043857600080fd5b610441826103fd565b9392505050565b60008060006060848603121561045d57600080fd5b610466846103fd565b9250610474602085016103fd565b9150604084013590509250925092565b6000825160005b818110156104a5576020818601810151858301520161048b565b50600092019182525091905056fea264697066735822122040f722c54e2b473f3601c678616f6d13c61f4f3ca085d95514f28035ba9f9eb964736f6c63430008130033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000ff000047abea9064c699c0727148776e4e17771c
-----Decoded View---------------
Arg [0] : trustedForwarderImplementation_ (address): 0xFF000047aBEA9064C699c0727148776e4E17771C
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000ff000047abea9064c699c0727148776e4e17771c
Deployed Bytecode Sourcemap
109:2703:1:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;459:55;;;;;;;;190:42:2;178:55;;;160:74;;148:2;133:18;459:55:1;;;;;;;;1221:115;;;;;;:::i;:::-;1311:18;;1288:4;1311:18;;;;;;;;;;;;;;1221:115;;;;802:14:2;;795:22;777:41;;765:2;750:18;1221:115:1;637:187:2;2207:603:1;;;;;;:::i;:::-;;:::i;521:42::-;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;2207:603;2427:28;;;2438:10;2427:28;;;1336:74:2;1426:18;;;1419:34;;;2304:24:1;;2359:98;;2385:30;;1309:18:2;;2427:28:1;;;;;;;;;;;;2417:39;;;;;;2359:25;:98::i;:::-;2509:55;;;2487:21;1717:15:2;;;2509:55:1;;;1699:34:2;1769:15;;;1749:18;;;;1742:43;;;;2509:55:1;;;;;;;;;;1611:18:2;;;;2509:55:1;;;;;;;;;2532:13;2509:55;;;2487:78;;2340:117;;-1:-1:-1;;;2487:21:1;;;;:78;;2509:55;2487:78;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2468:97;;;2580:7;2575:115;;2610:69;;;;;1648:42:2;1717:15;;;2610:69:1;;;1699:34:2;1769:15;;1749:18;;;1742:43;1611:18;;2610:69:1;;;;;;;;2575:115;2699:28;;;:10;:28;;;;;;;;;;;:35;;;;2730:4;2699:35;;;2750:53;2774:10;;2750:53;;;2330:480;2207:603;;;;;:::o;2107:794:0:-;2191:16;2523:48;2505:14;2499:4;2495:25;2489:4;2485:36;2482:90;2476:4;2469:104;2730:32;2713:14;2707:4;2703:25;2700:63;2694:4;2687:77;2812:4;2806;2800;2797:1;2789:28;2777:40;-1:-1:-1;2844:22:0;;;2836:58;;;;;;;2415:2:2;2836:58:0;;;2397:21:2;2454:2;2434:18;;;2427:30;2493:25;2473:18;;;2466:53;2536:18;;2836:58:0;2213:347:2;2836:58:0;2107:794;;;;:::o;245:196:2:-;313:20;;373:42;362:54;;352:65;;342:93;;431:1;428;421:12;342:93;245:196;;;:::o;446:186::-;505:6;558:2;546:9;537:7;533:23;529:32;526:52;;;574:1;571;564:12;526:52;597:29;616:9;597:29;:::i;:::-;587:39;446:186;-1:-1:-1;;;446:186:2:o;829:328::-;906:6;914;922;975:2;963:9;954:7;950:23;946:32;943:52;;;991:1;988;981:12;943:52;1014:29;1033:9;1014:29;:::i;:::-;1004:39;;1062:38;1096:2;1085:9;1081:18;1062:38;:::i;:::-;1052:48;;1147:2;1136:9;1132:18;1119:32;1109:42;;829:328;;;;;:::o;1796:412::-;1925:3;1963:6;1957:13;1988:1;1998:129;2012:6;2009:1;2006:13;1998:129;;;2110:4;2094:14;;;2090:25;;2084:32;2071:11;;;2064:53;2027:12;1998:129;;;-1:-1:-1;2182:1:2;2146:16;;2171:13;;;-1:-1:-1;2146:16:2;1796:412;-1:-1:-1;1796:412:2:o
Swarm Source
ipfs://40f722c54e2b473f3601c678616f6d13c61f4f3ca085d95514f28035ba9f9eb9
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ 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.