Feature Tip: Add private address tag to any address under My Name Tag !
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 3 internal transactions
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
19170505 | 290 days ago | Contract Creation | 0 ETH | |||
19151356 | 293 days ago | Contract Creation | 0 ETH | |||
19142047 | 294 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 Name:
TrustedForwarderFactory
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 1000000 runs
Other Settings:
paris EvmVersion
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", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "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
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.