My Name Tag:
Not Available, login to update
[ Download CSV Export ]
Contract Name:
MintingManagerForwarder
Compiler Version
v0.8.0+commit.c7dfd78e
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// @author Unstoppable Domains, Inc. // @date August 23th, 2021 pragma solidity ^0.8.0; import './IForwarder.sol'; import './BaseForwarder.sol'; contract MintingManagerForwarder is BaseForwarder { address private _mintingManager; mapping(uint256 => uint256) private _nonces; constructor(address mintingManager) { _mintingManager = mintingManager; } function nonceOf(uint256 tokenId) external view override returns (uint256) { return _nonces[tokenId]; } function verify(ForwardRequest calldata req, bytes calldata signature) public view override returns (bool) { return _verify(req, _mintingManager, signature); } function execute(ForwardRequest calldata req, bytes calldata signature) external override returns (bytes memory) { uint256 gas = gasleft(); require(verify(req, signature), 'MintingManagerForwarder: SIGNATURE_INVALID'); return _execute(req.from, _mintingManager, req.tokenId, gas, req.data, signature); } function _invalidateNonce(uint256 tokenId) internal override { _nonces[tokenId] = _nonces[tokenId] + 1; } }
// @author Unstoppable Domains, Inc. // @date August 11th, 2021 pragma solidity ^0.8.0; interface IForwarder { struct ForwardRequest { address from; uint256 nonce; uint256 tokenId; bytes data; } function nonceOf(uint256 tokenId) external view returns (uint256); function verify(ForwardRequest calldata req, bytes calldata signature) external view returns (bool); function execute(ForwardRequest calldata req, bytes calldata signature) external returns (bytes memory); }
// @author Unstoppable Domains, Inc. // @date August 12th, 2021 pragma solidity ^0.8.0; import '@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol'; import './IForwarder.sol'; abstract contract BaseForwarder is IForwarder { using ECDSAUpgradeable for bytes32; function _verify( ForwardRequest memory req, address target, bytes memory signature ) internal view virtual returns (bool) { uint256 nonce = this.nonceOf(req.tokenId); address signer = _recover(keccak256(req.data), target, nonce, signature); return nonce == req.nonce && signer == req.from; } function _recover( bytes32 digest, address target, uint256 nonce, bytes memory signature ) internal pure virtual returns (address signer) { return keccak256(abi.encodePacked(digest, target, nonce)).toEthSignedMessageHash().recover(signature); } function _execute( address from, address to, uint256 tokenId, uint256 gas, bytes memory data, bytes memory signature ) internal virtual returns (bytes memory) { _invalidateNonce(tokenId); (bool success, bytes memory returndata) = to.call{gas: gas}(_buildData(from, tokenId, data, signature)); // Validate that the relayer has sent enough gas for the call. // See https://ronan.eth.link/blog/ethereum-gas-dangers/ assert(gasleft() > gas / 63); return _verifyCallResult(success, returndata, 'BaseForwarder: CALL_FAILED'); } function _invalidateNonce( uint256 /* tokenId */ ) internal virtual {} function _buildData( address from, uint256 tokenId, bytes memory data, bytes memory /* signature */ ) internal view virtual returns (bytes memory) { return abi.encodePacked(data, from, tokenId); } function _verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) private pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly //solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSAUpgradeable { /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { // Divide the signature in r, s and v variables bytes32 r; bytes32 s; uint8 v; // Check the signature length // - case 65: r,s,v signature (standard) // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._ if (signature.length == 65) { // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. // solhint-disable-next-line no-inline-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } } else if (signature.length == 64) { // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. // solhint-disable-next-line no-inline-assembly assembly { let vs := mload(add(signature, 0x40)) r := mload(add(signature, 0x20)) s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) v := add(shr(255, vs), 27) } } else { revert("ECDSA: invalid signature length"); } return recover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. require(uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0, "ECDSA: invalid signature 's' value"); require(v == 27 || v == 28, "ECDSA: invalid signature 'v' value"); // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); require(signer != address(0), "ECDSA: invalid signature"); return signer; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
{ "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "bytecodeHash": "none" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"mintingManager","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"components":[{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct IForwarder.ForwardRequest","name":"req","type":"tuple"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"execute","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"nonceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct IForwarder.ForwardRequest","name":"req","type":"tuple"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"verify","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50604051610bd4380380610bd483398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b610b43806100916000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80631bf7e13e146100465780636ccbae5f1461006f578063a42474001461008f575b600080fd5b610059610054366004610656565b6100af565b6040516100669190610827565b60405180910390f35b61008261007d3660046106ee565b61018e565b6040516100669190610976565b6100a261009d366004610656565b6101a3565b60405161006691906107fe565b606060005a90506100c18585856101a3565b6100e65760405162461bcd60e51b81526004016100dd906108ea565b60405180910390fd5b6101836100f6602087018761063c565b6000546001600160a01b031660408801358461011560608b018b61097f565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8e018190048102820181019092528c815292508c91508b908190840183828082843760009201919091525061020292505050565b9150505b9392505050565b6000818152600160205260409020545b919050565b60006101fa6101b185610a0f565b600054604080516020601f88018190048102820181019092528681526001600160a01b03909216919087908790819084018382808284376000920191909152506102f192505050565b949350505050565b606061020d856103b3565b600080876001600160a01b0316866102278b8a89896103e0565b6040516102349190610772565b60006040518083038160008787f1925050503d8060008114610272576040519150601f19603f3d011682016040523d82523d6000602084013e610277565b606091505b509092509050610288603f876109ef565b5a116102a457634e487b7160e01b600052600160045260246000fd5b6102e482826040518060400160405280601a81526020017f42617365466f727761726465723a2043414c4c5f4641494c4544000000000000815250610410565b9998505050505050505050565b6040808401519051636ccbae5f60e01b815260009182913091636ccbae5f9161031d9190600401610976565b60206040518083038186803b15801561033557600080fd5b505afa158015610349573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061036d9190610706565b90506000610388866060015180519060200120868487610449565b90508560200151821480156103a9575085516001600160a01b038281169116145b9695505050505050565b6000818152600160208190526040909120546103ce916109cb565b60009182526001602052604090912055565b60608285856040516020016103f79392919061078e565b6040516020818303038152906040529050949350505050565b6060831561041f575081610187565b82511561042f5782518084602001fd5b8160405162461bcd60e51b81526004016100dd9190610827565b6000610488826104828787876040516020016104679392919061074a565b60405160208183030381529060405280519060200120610491565b906104c1565b95945050505050565b6000816040516020016104a491906107cd565b604051602081830303815290604052805190602001209050919050565b6000806000808451604114156104eb5750505060208201516040830151606084015160001a610531565b8451604014156105195750505060408201516020830151906001600160ff1b0381169060ff1c601b01610531565b60405162461bcd60e51b81526004016100dd90610871565b6103a98682858560007f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a082111561057a5760405162461bcd60e51b81526004016100dd906108a8565b8360ff16601b148061058f57508360ff16601c145b6105ab5760405162461bcd60e51b81526004016100dd90610934565b6000600186868686604051600081526020016040526040516105d09493929190610809565b6020604051602081039080840390855afa1580156105f2573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166104885760405162461bcd60e51b81526004016100dd9061083a565b80356001600160a01b038116811461019e57600080fd5b60006020828403121561064d578081fd5b61018782610625565b60008060006040848603121561066a578182fd5b833567ffffffffffffffff80821115610681578384fd5b9085019060808288031215610694578384fd5b909350602085013590808211156106a9578384fd5b818601915086601f8301126106bc578384fd5b8135818111156106ca578485fd5b8760208285010111156106db578485fd5b6020830194508093505050509250925092565b6000602082840312156106ff578081fd5b5035919050565b600060208284031215610717578081fd5b5051919050565b60008151808452610736816020860160208601610af0565b601f01601f19169290920160200192915050565b92835260609190911b6bffffffffffffffffffffffff19166020830152603482015260540190565b60008251610784818460208701610af0565b9190910192915050565b600084516107a0818460208901610af0565b60609490941b6bffffffffffffffffffffffff191691909301908152601481019190915260340192915050565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b901515815260200190565b93845260ff9290921660208401526040830152606082015260800190565b600060208252610187602083018461071e565b60208082526018908201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604082015260600190565b6020808252601f908201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604082015260600190565b60208082526022908201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604082015261756560f01b606082015260800190565b6020808252602a908201527f4d696e74696e674d616e61676572466f727761726465723a205349474e415455604082015269149157d253959053125160b21b606082015260800190565b60208082526022908201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604082015261756560f01b606082015260800190565b90815260200190565b6000808335601e19843603018112610995578283fd5b83018035915067ffffffffffffffff8211156109af578283fd5b6020019150368190038213156109c457600080fd5b9250929050565b600082198211156109ea57634e487b7160e01b81526011600452602481fd5b500190565b600082610a0a57634e487b7160e01b81526012600452602481fd5b500490565b600060808236031215610a20578081fd5b604080516080810167ffffffffffffffff8282108183111715610a4557610a45610b20565b818452610a5186610625565b83526020915081860135828401528386013584840152606086013581811115610a78578586fd5b860136601f820112610a88578586fd5b803582811115610a9a57610a9a610b20565b8551601f8201601f1916810185018481118282101715610abc57610abc610b20565b87528181523683830186011115610ad1578788fd5b8185840186830137908101909301959095525060608201529392505050565b60005b83811015610b0b578181015183820152602001610af3565b83811115610b1a576000848401525b50505050565b634e487b7160e01b600052604160045260246000fdfea164736f6c6343000800000a0000000000000000000000007be83293beedc9eba1bd76c66a65f10f3efaec26
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000007be83293beedc9eba1bd76c66a65f10f3efaec26
-----Decoded View---------------
Arg [0] : mintingManager (address): 0x7be83293beedc9eba1bd76c66a65f10f3efaec26
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000007be83293beedc9eba1bd76c66a65f10f3efaec26
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.