Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 15 from a total of 15 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Mint | 18260923 | 290 days ago | IN | 0 ETH | 0.00211091 | ||||
Mint | 18259439 | 290 days ago | IN | 0 ETH | 0.00187752 | ||||
Mint | 18259242 | 290 days ago | IN | 0 ETH | 0.00191958 | ||||
Mint | 18257944 | 290 days ago | IN | 0 ETH | 0.00184867 | ||||
Mint | 18252050 | 291 days ago | IN | 0 ETH | 0.00175337 | ||||
Mint | 18198655 | 298 days ago | IN | 0 ETH | 0.00198896 | ||||
Mint | 18198643 | 298 days ago | IN | 0 ETH | 0.0019554 | ||||
Mint | 18192593 | 299 days ago | IN | 0 ETH | 0.00278526 | ||||
Mint | 18190281 | 300 days ago | IN | 0 ETH | 0.00230898 | ||||
Mint | 18190258 | 300 days ago | IN | 0 ETH | 0.00231554 | ||||
Mint | 18176317 | 301 days ago | IN | 0 ETH | 0.00293526 | ||||
Mint | 18162772 | 303 days ago | IN | 0 ETH | 0.00221456 | ||||
Mint | 18162030 | 303 days ago | IN | 0 ETH | 0.00281018 | ||||
Set Signed Addre... | 18162005 | 303 days ago | IN | 0 ETH | 0.00046544 | ||||
0x60806040 | 18161732 | 304 days ago | IN | Create: RepSBT | 0 ETH | 0.01302023 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
RepSBT
Compiler Version
v0.8.10+commit.fc410830
Optimization Enabled:
Yes with 10 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./ERC1238/extensions/ERC1238URIStorage.sol"; import "@openzeppelin/contracts/utils/Address.sol"; contract RepSBT is ERC1238, ERC1238URIStorage { using Address for address; address public owner; mapping(address => uint256) private _addressToIds; uint256 private _num = 0; address private _signer; constructor(address owner_, string memory baseURI_) ERC1238(baseURI_) { owner = owner_; } modifier onlyOwner() { require(msg.sender == owner, "Unauthorized: sender is not the owner"); _; } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1238, ERC1238URIStorage) returns (bool) { return super.supportsInterface(interfaceId); } function mint( uint64 _point, string memory _uri, bytes memory _signedData, bytes calldata data ) external { require (_balances[_addressToIds[msg.sender]][msg.sender] == 0, "Not allowed users to get more than 1 NFTs"); bytes32 hashData = keccak256(abi.encodePacked(_uri)); bytes32 sigHash = keccak256(abi.encodePacked(hashData, _point)); require (verifySignature(sigHash, _signedData, _signer) == true, 'signed permit test error'); _num = _num + 1; _mint(msg.sender, _num, 1, data); _setTokenURI(_num, _uri); _addressToIds [msg.sender] = _num; } function burn() external { _burnAndDeleteURI(msg.sender, _addressToIds [msg.sender], 1); } function setTokenURI(uint64 _point, string memory _uri, bytes memory _signedData) external { bytes32 hashData = keccak256(abi.encodePacked(_uri)); bytes32 sigHash = keccak256(abi.encodePacked(hashData, _point)); require (verifySignature(sigHash, _signedData, _signer) == true, 'signed permit test error'); _setTokenURI (_addressToIds[msg.sender], _uri); } function getTokenURI(address _account) external view returns (string memory) { return tokenURI(_addressToIds[_account]); } function getTokenId(address _account) external view returns (uint256) { return _addressToIds[_account]; } function setSignedAddress(address signer_) external onlyOwner { _signer = signer_; } /** * @dev Destroys `amount` of tokens with id `id` owned by `from` and deletes the associated URI. * * Requirements: * - A token URI must be set. * - All tokens of this type must have been burned. */ function _burnAndDeleteURI( address from, uint256 id, uint256 amount ) internal virtual { super._burn(from, id, amount); _deleteTokenURI(id); } function verifySignature(bytes32 hash, bytes memory signature, address signer) internal pure returns (bool) { require(signature.length == 65, "Require correct length"); bytes32 r; bytes32 s; uint8 v; // Divide the signature in r, s and v variables assembly { r := mload(add(signature, 32)) s := mload(add(signature, 64)) v := byte(0, mload(add(signature, 96))) } // Version of signature should be 27 or 28, but 0 and 1 are also possible versions if (v < 27) { v += 27; } require(v == 27 || v == 28, "Signature version not match"); bytes memory prefix = "\x19Ethereum Signed Message:\n32"; bytes32 prefixedHash = keccak256(abi.encodePacked(prefix, hash)); address addr = ecrecover(prefixedHash, v, r, s); return addr == signer; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // 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 /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @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 ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. 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. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @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) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // 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 (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): 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. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @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) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @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 Message, created from `s`. 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(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @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)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC1238.sol"; import "./ERC1238Approval.sol"; import "./IERC1238Receiver.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; /** * @dev Implementation proposal for non-transferable (Badge) tokens * See https://github.com/ethereum/EIPs/issues/1238 */ contract ERC1238 is ERC165, IERC1238, ERC1238Approval { using Address for address; // Mapping from token ID to account balances mapping(uint256 => mapping(address => uint256)) internal _balances; // Used as the URI by default for all token types by relying on ID substitution, // e.g. https://token-cdn-domain/{id}.json string private baseURI; /** * @dev Initializes the contract by setting a `baseURI`. * See {_setBaseURI} */ constructor(string memory baseURI_) { _setBaseURI(baseURI_); } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC1238).interfaceId || super.supportsInterface(interfaceId); } /** * @dev This implementation returns the same URI for *all* token types. It relies * on the token type ID substitution mechanism as in EIP-1155: * https://eips.ethereum.org/EIPS/eip-1155#metadata * * Clients calling this function must replace the `\{id\}` substring with the * actual token type ID. */ function _baseURI() internal view virtual returns (string memory) { return baseURI; } /** * @dev See {IERC1238-balanceOf}. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) public view virtual override returns (uint256) { require(account != address(0), "ERC1238: balance query for the zero address"); return _balances[id][account]; } /** * @dev See {IERC1238-balanceOfBatch}. * */ function balanceOfBatch(address account, uint256[] memory ids) public view virtual override returns (uint256[] memory) { uint256 idsLength = ids.length; uint256[] memory batchBalances = new uint256[](idsLength); for (uint256 i = 0; i < idsLength; ++i) { batchBalances[i] = balanceOf(account, ids[i]); } return batchBalances; } /** * @dev See {IERC1238-balanceOfBundle}. * */ function balanceOfBundle(address[] memory accounts, uint256[][] memory ids) public view virtual override returns (uint256[][] memory) { uint256 accountsLength = accounts.length; uint256[][] memory bundleBalances = new uint256[][](accountsLength); for (uint256 i = 0; i < accountsLength; ++i) { bundleBalances[i] = balanceOfBatch(accounts[i], ids[i]); } return bundleBalances; } /** * @dev Sets a new URI for all token types, by relying on the token type ID * substitution mechanism as in EIP-1155 * https://eips.ethereum.org/EIPS/eip-1155#metadata * * By this mechanism, any occurrence of the `\{id\}` substring in either the * URI or any of the amounts in the JSON file at said URI will be replaced by * clients with the token type ID. * * For example, the `https://token-cdn-domain/\{id\}.json` URI would be * interpreted by clients as * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json` * for token type ID 0x4cce0. * * * Because these URIs cannot be meaningfully represented by the {URI} event, * this function emits no events. */ function _setBaseURI(string memory newBaseURI) internal virtual { baseURI = newBaseURI; } /** * @dev Creates `amount` tokens of token type `id`, and assigns them to a smart contract (to). * * * Requirements: * - `to` must be a smart contract and must implement {IERC1238Receiver-onERC1238BatchMint} and return the * acceptance magic value. * * Emits a {MintSingle} event. */ function _mintToContract( address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to.isContract(), "ERC1238: Recipient is not a contract"); _mint(to, id, amount, data); _doSafeMintAcceptanceCheck(msg.sender, to, id, amount, data); } /** * @dev Creates `amount` tokens of token type `id`, and assigns them to the * Externally Owned Account (to). * * Requirements: * * - `v`, `r` and `s` must be a EIP712 signature from `to` as defined by ERC1238Approval to * approve the minting transaction. * - `approvalExpiry`, which is part of the signed data, cannot be in the past. * * Emits a {MintSingle} event. */ function _mintToEOA( address to, uint256 id, uint256 amount, uint8 v, bytes32 r, bytes32 s, uint256 approvalExpiry, bytes memory data ) internal virtual { require(approvalExpiry >= block.timestamp, "ERC1238: provided approval expiry time cannot be in the past"); bytes32 messageHash = _getMintApprovalMessageHash(to, id, amount, approvalExpiry); _verifyMintingApproval(to, messageHash, v, r, s); _mint(to, id, amount, data); } /** * @dev [Batched] version of {_mintToContract}. A batch specifies an array of token `id` and * the amount of tokens for each. * * Requirements: * - `to` must be a smart contract and must implement {IERC1238Receiver-onERC1238BatchMint} and return the * acceptance magic value. * - `ids` and `amounts` must have the same length. * * Emits a {MintBatch} event. */ function _mintBatchToContract( address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(to.isContract(), "ERC1238: Recipient is not a contract"); _mintBatch(to, ids, amounts, data); _doSafeBatchMintAcceptanceCheck(msg.sender, to, ids, amounts, data); } /** * @dev [Batched] version of {_mintToEOA}. A batch specifies an array of token `id` and * the amount of tokens for each. * * Requirements: * - `v`, `r` and `s` must be a EIP712 signature from `to` as defined by ERC1238Approval to * approve the batch minting transaction. * - `approvalExpiry`, which is part of the signed data, cannot be in the past. * * Emits a {MintBatch} event. */ function _mintBatchToEOA( address to, uint256[] memory ids, uint256[] memory amounts, uint8 v, bytes32 r, bytes32 s, uint256 approvalExpiry, bytes memory data ) internal virtual { require(approvalExpiry >= block.timestamp, "ERC1238: provided approval expiry time cannot be in the past"); bytes32 messageHash = _getMintBatchApprovalMessageHash(to, ids, amounts, approvalExpiry); _verifyMintingApproval(to, messageHash, v, r, s); _mintBatch(to, ids, amounts, data); } /** * @dev Mints a bundle, which can be viewed as minting several batches * to an array of addresses in one transaction. * * Requirements: * - `to` can be a combination of smart contract addresses and EOAs. * - If `to` is not a contract, an EIP712 signature from `to` as defined by ERC1238Approval * must be passed at the right index in `data`. * * Emits multiple {MintBatch} events. */ function _mintBundle( address[] calldata to, uint256[][] calldata ids, uint256[][] calldata amounts, MintApprovalSignature[] calldata mintApprovalSignatures, bytes[] calldata data ) internal virtual { uint256 toLength = to.length; for (uint256 i = 0; i < toLength; i++) { if (to[i].isContract()) { _mintBatchToContract(to[i], ids[i], amounts[i], data[i]); } else { MintApprovalSignature calldata signature = mintApprovalSignatures[i]; _mintBatchToEOA( to[i], ids[i], amounts[i], signature.v, signature.r, signature.s, signature.approvalExpiry, data[i] ); } } } /** * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`. * * Emits a {MintSingle} event. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC1238Receiver-onERC1238Mint} and return the * acceptance magic value. * * Emits a {MintSingle} event. */ function _mint( address to, uint256 id, uint256 amount, bytes memory data ) internal { address minter = msg.sender; _beforeMint(minter, to, id, amount, data); _balances[id][to] += amount; emit MintSingle(minter, to, id, amount); } /** * @dev [Batched] version of {_mint}. * * Requirements: * * - `ids` and `amounts` must have the same length. * * Emits a {MintBatch} event. */ function _mintBatch( address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) private { uint256 idsLength = ids.length; require(idsLength == amounts.length, "ERC1238: ids and amounts length mismatch"); address minter = msg.sender; for (uint256 i = 0; i < idsLength; i++) { _beforeMint(minter, to, ids[i], amounts[i], data); _balances[ids[i]][to] += amounts[i]; } emit MintBatch(minter, to, ids, amounts); } /** * @dev Destroys `amount` tokens of token type `id` from `from` * * Requirements: * * - `from` cannot be the zero address. * - `from` must have at least `amount` tokens of token type `id`. * * Emits a {BurnSingle} event. */ function _burn( address from, uint256 id, uint256 amount ) internal virtual { require(from != address(0), "ERC1238: burn from the zero address"); address burner = msg.sender; _beforeBurn(burner, from, id, amount); uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1238: burn amount exceeds balance"); unchecked { _balances[id][from] = fromBalance - amount; } emit BurnSingle(burner, from, id, amount); } /** * @dev [Batched] version of {_burn}. * * Requirements: * * - `ids` and `amounts` must have the same length. * * Emits a {BurnBatch} event. */ function _burnBatch( address from, uint256[] memory ids, uint256[] memory amounts ) internal virtual { require(from != address(0), "ERC1238: burn from the zero address"); uint256 idsLength = ids.length; require(idsLength == amounts.length, "ERC1238: ids and amounts length mismatch"); address burner = msg.sender; for (uint256 i = 0; i < idsLength; i++) { uint256 id = ids[i]; uint256 amount = amounts[i]; _beforeBurn(burner, from, id, amount); uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1238: burn amount exceeds balance"); unchecked { _balances[id][from] = fromBalance - amount; } } emit BurnBatch(burner, from, ids, amounts); } /** * @dev Hook that is called before an `amount` of tokens are minted. * * Calling conditions: * - `minter` and `to` cannot be the zero address * */ function _beforeMint( address minter, address to, uint256 id, uint256 amount, bytes memory data ) internal virtual {} /** * @dev Hook that is called before an `amount` of tokens are burned. * * Calling conditions: * - `burner` and `from` cannot be the zero address * */ function _beforeBurn( address burner, address from, uint256 id, uint256 amount ) internal virtual {} function _doSafeMintAcceptanceCheck( address minter, address to, uint256 id, uint256 amount, bytes memory data ) internal { try IERC1238Receiver(to).onERC1238Mint(minter, id, amount, data) returns (bytes4 response) { if (response != IERC1238Receiver.onERC1238Mint.selector) { revert("ERC1238: ERC1238Receiver rejected tokens"); } } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1238: transfer to non ERC1238Receiver implementer"); } } function _doSafeBatchMintAcceptanceCheck( address minter, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal { try IERC1238Receiver(to).onERC1238BatchMint(minter, ids, amounts, data) returns (bytes4 response) { if (response != IERC1238Receiver.onERC1238BatchMint.selector) { revert("ERC1238: ERC1238Receiver rejected tokens"); } } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1238: transfer to non ERC1238Receiver implementer"); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; struct EIP712Domain { string name; string version; uint256 chainId; address verifyingContract; } // Typed data of a Mint Batch transaction // needing to be approved by `recipient`. struct MintBatchApproval { address recipient; uint256[] ids; uint256[] amounts; uint256 approvalExpiry; } // Typed data of a Mint transaction // needing to be approved by `recipient`. struct MintApproval { address recipient; uint256 id; uint256 amount; uint256 approvalExpiry; } struct MintApprovalSignature { uint8 v; bytes32 r; bytes32 s; uint256 approvalExpiry; } /** * ERC1238 tokens can only be minted to an EOA by providing a message signed by the recipient to * approve the minting, or batch minting, of tokens. * * This contract contains the logic around generating and verifiying these signed messages. * * @dev The implementation is based on EIP-712, a standard for typed structured data hashing and signing. * The standard defines the `hashtruct` function where structs are encoded with their typeHash * (a constant defining their type) and hashed. * See https://eips.ethereum.org/EIPS/eip-712 * */ contract ERC1238Approval { bytes32 private constant EIP712DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); bytes32 private constant MINT_APPROVAL_TYPEHASH = keccak256("MintApproval(address recipient,uint256 id,uint256 amount,uint256 approvalExpiry)"); bytes32 private constant MINT_BATCH_APPROVAL_TYPEHASH = keccak256("MintBatchApproval(address recipient,uint256[] ids,uint256[] amounts,uint256 approvalExpiry)"); // Domain Separator, as defined by EIP-712 (`hashstruct(eip712Domain)`) bytes32 public DOMAIN_SEPARATOR; mapping(bytes32 => bool) private hasApprovalHashBeenUsed; constructor() { // The EIP712Domain shares the same name for all ERC128Approval contracts // but the unique address of this contract as `verifiyingContract` EIP712Domain memory eip712Domain = EIP712Domain({ name: "ERC1238 Mint Approval", version: "1", chainId: block.chainid, verifyingContract: address(this) }); DOMAIN_SEPARATOR = keccak256( abi.encode( EIP712DOMAIN_TYPEHASH, keccak256(bytes(eip712Domain.name)), keccak256(bytes(eip712Domain.version)), eip712Domain.chainId, eip712Domain.verifyingContract ) ); } /** * @dev Returns a MintApprovalMessageHash which is the result of `hashstruct(MintApproval)`. * To verify that `recipient` approved a mint transaction, the hash returned * must be passed to _verifyMintingApproval as `mintApprovalHash`. * */ function _getMintApprovalMessageHash( address recipient, uint256 id, uint256 amount, uint256 approvalExpiry ) internal pure returns (bytes32) { MintApproval memory mintApproval = MintApproval({ recipient: recipient, id: id, amount: amount, approvalExpiry: approvalExpiry }); return keccak256( abi.encode( MINT_APPROVAL_TYPEHASH, mintApproval.recipient, mintApproval.id, mintApproval.amount, mintApproval.approvalExpiry ) ); } /** * @dev Returns a MintBatchApprovalMessageHash which is the result of `hashstruct(MintBatchApproval)`. * To verify that `recipient` approved a mint batch transaction, the hash returned * must be passed to _verifyMintingApproval as `mintApprovalHash`. * */ function _getMintBatchApprovalMessageHash( address recipient, uint256[] memory ids, uint256[] memory amounts, uint256 approvalExpiry ) internal pure returns (bytes32) { MintBatchApproval memory mintBatchApproval = MintBatchApproval({ recipient: recipient, ids: ids, amounts: amounts, approvalExpiry: approvalExpiry }); return keccak256( abi.encode( MINT_BATCH_APPROVAL_TYPEHASH, mintBatchApproval.recipient, keccak256(abi.encodePacked(mintBatchApproval.ids)), keccak256(abi.encodePacked(mintBatchApproval.amounts)), mintBatchApproval.approvalExpiry ) ); } /** * @dev Given a mintApprovalHash (either MintApprovalMessageHash or MintBatchApprovalMessageHash), * this function verifies if the signature (v, r, and s) was signed by `recipient` based on the * EIP712Domain of this contract, and otherwise reverts. */ function _verifyMintingApproval( address recipient, bytes32 mintApprovalHash, uint8 v, bytes32 r, bytes32 s ) internal { // Prevent signatures from being replayed require(!hasApprovalHashBeenUsed[mintApprovalHash], "ERC1238: Approval hash already used"); bytes32 digest = ECDSA.toTypedDataHash(DOMAIN_SEPARATOR, mintApprovalHash); require(ECDSA.recover(digest, v, r, s) == recipient, "ERC1238: Approval verification failed"); hasApprovalHashBeenUsed[mintApprovalHash] = true; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC1238.sol"; import "./IERC1238URIStorage.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; /** * @dev Proposal for ERC1238 token with storage based token URI management. */ abstract contract ERC1238URIStorage is ERC165, IERC1238URIStorage, ERC1238 { // Optional mapping for token URIs mapping(uint256 => string) private _tokenURIs; function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1238, ERC165, IERC165) returns (bool) { return interfaceId == type(IERC1238URIStorage).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC1238URIStorage-tokenURI}. */ function tokenURI(uint256 id) public view virtual override returns (string memory) { string memory _tokenURI = _tokenURIs[id]; // Returns the token URI if there is a specific one set that overrides the base URI if (_isTokenURISet(id)) { return _tokenURI; } string memory base = _baseURI(); return base; } /** * @dev Sets `_tokenURI` as the token URI for the tokens of type `id`. * */ function _setTokenURI(uint256 id, string memory _tokenURI) internal virtual { _tokenURIs[id] = _tokenURI; emit URI(id, _tokenURI); } /** * @dev [Batched] version of {_setTokenURI}. * */ function _setBatchTokenURI(uint256[] memory ids, string[] memory tokenURIs) internal { uint256 idsLength = ids.length; require(idsLength == tokenURIs.length, "ERC1238Storage: ids and token URIs length mismatch"); for (uint256 i = 0; i < idsLength; i++) { _setTokenURI(ids[i], tokenURIs[i]); } } /** * @dev Deletes the tokenURI for the tokens of type `id`. * * Requirements: * - A token URI must be set. * * Possible improvement: * - The URI can only be deleted if all tokens of type `id` have been burned. */ function _deleteTokenURI(uint256 id) internal virtual { if (_isTokenURISet(id)) { delete _tokenURIs[id]; } } /** * @dev Returns whether a tokenURI is set or not for a specific `id` token type. * */ function _isTokenURISet(uint256 id) private view returns (bool) { return bytes(_tokenURIs[id]).length > 0; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC1238.sol"; import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; /** * @dev Proposal of an interface for ERC1238 token with storage based token URI management. */ interface IERC1238URIStorage is IERC1238 { /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * */ event URI(uint256 indexed id, string value); /** * @dev Returns the Uniform Resource Identifier (URI) for `id` token. */ function tokenURI(uint256 id) external view returns (string memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; /** * @dev Interface proposal for Badge tokens * See https://github.com/ethereum/EIPs/issues/1238 */ interface IERC1238 is IERC165 { /** * @dev Emitted when `amount` tokens of token type `id` are minted to `to` by `minter`. */ event MintSingle(address indexed minter, address indexed to, uint256 indexed id, uint256 amount); /** * @dev Equivalent to multiple {MintSingle} events, where `minter` and `to` is the same for all token types */ event MintBatch(address indexed minter, address indexed to, uint256[] ids, uint256[] amounts); /** * @dev Emitted when `amount` tokens of token type `id` owned by `owner` are burned by `burner`. */ event BurnSingle(address indexed burner, address indexed owner, uint256 indexed id, uint256 amount); /** * @dev Equivalent to multiple {BurnSingle} events, where `owner` and `burner` is the same for all token types */ event BurnBatch(address indexed burner, address indexed owner, uint256[] ids, uint256[] amounts); /** * @dev Returns the amount of tokens of token type `id` owned by `account`. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev Returns the balance of `account` for a batch of token `ids` * */ function balanceOfBatch(address account, uint256[] calldata ids) external view returns (uint256[] memory); /** * @dev Returns the balance of multiple `accounts` for a batch of token `ids`. * This is equivalent to calling {balanceOfBatch} for several accounts in just one call. * * Reuirements: * - `accounts` and `ids` must have the same length. * */ function balanceOfBundle(address[] calldata accounts, uint256[][] calldata ids) external view returns (uint256[][] memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; /** * Interface for smart contracts wishing to receive ownership of ERC1238 tokens. */ interface IERC1238Receiver is IERC165 { /** * @dev Handles the receipt of a single ERC1238 token type. * * NOTE: To accept the transfer, this must return * `bytes4(keccak256("onERC1238Mint(address,address,uint256,uint256,bytes)"))` * * @param minter The address which initiated minting (i.e. msg.sender) * @param id The ID of the token being transferred * @param amount The amount of tokens being transferred * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1238Mint(address,uint256,uint256,bytes)"))` if minting is allowed */ function onERC1238Mint( address minter, uint256 id, uint256 amount, bytes calldata data ) external returns (bytes4); /** * @dev Handles the receipt of multiple ERC1238 token types. * * NOTE: To accept the transfer(s), this must return * `bytes4(keccak256("onERC1238BatchMint(address,address,uint256[],uint256[],bytes)"))` * * @param minter The address which initiated minting (i.e. msg.sender) * @param ids An array containing ids of each token being transferred (order and length must match values array) * @param amounts An array containing amounts of each token being transferred (order and length must match ids array) * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1238BatchMint(address,uint256[],uint256[],bytes)"))` if minting is allowed */ function onERC1238BatchMint( address minter, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data ) external returns (bytes4); }
{ "optimizer": { "enabled": true, "runs": 10 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"owner_","type":"address"},{"internalType":"string","name":"baseURI_","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"burner","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"BurnBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"burner","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BurnSingle","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"minter","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"MintBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"minter","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"MintSingle","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"string","name":"value","type":"string"}],"name":"URI","type":"event"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"balanceOfBatch","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[][]","name":"ids","type":"uint256[][]"}],"name":"balanceOfBundle","outputs":[{"internalType":"uint256[][]","name":"","type":"uint256[][]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"getTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"getTokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"_point","type":"uint64"},{"internalType":"string","name":"_uri","type":"string"},{"internalType":"bytes","name":"_signedData","type":"bytes"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"signer_","type":"address"}],"name":"setSignedAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_point","type":"uint64"},{"internalType":"string","name":"_uri","type":"string"},{"internalType":"bytes","name":"_signedData","type":"bytes"}],"name":"setTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405260006007553480156200001657600080fd5b50604051620018ec380380620018ec833981016040819052620000399162000231565b6040805160c0810182526015608082019081527f45524331323338204d696e7420417070726f76616c000000000000000000000060a083015281528151808301835260018152603160f81b602082810191825280840183905246848601819052306060860181905285518051908401209451909320955187966200010d957f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f9590949193929091019485526020850193909352604084019190915260608301526001600160a01b0316608082015260a00190565b60408051601f1981840301815291905280516020909101206000555062000134816200015c565b5050600580546001600160a01b0319166001600160a01b03929092169190911790556200036e565b80516200017190600390602084019062000175565b5050565b828054620001839062000331565b90600052602060002090601f016020900481019282620001a75760008555620001f2565b82601f10620001c257805160ff1916838001178555620001f2565b82800160010185558215620001f2579182015b82811115620001f2578251825591602001919060010190620001d5565b506200020092915062000204565b5090565b5b8082111562000200576000815560010162000205565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156200024557600080fd5b82516001600160a01b03811681146200025d57600080fd5b602084810151919350906001600160401b03808211156200027d57600080fd5b818601915086601f8301126200029257600080fd5b815181811115620002a757620002a76200021b565b604051601f8201601f19908116603f01168101908382118183101715620002d257620002d26200021b565b816040528281528986848701011115620002eb57600080fd5b600093505b828410156200030f5784840186015181850187015292850192620002f0565b82841115620003215760008684830101525b8096505050505050509250929050565b600181811c908216806200034657607f821691505b602082108114156200036857634e487b7160e01b600052602260045260246000fd5b50919050565b61156e806200037e6000396000f3fe608060405234801561001057600080fd5b50600436106100ae5760003560e01c8062fdd58e146100b357806301ffc9a7146100d95780633644e515146100fc5780633f1730e71461010557806344df8e701461011a57806361c028e7146101225780636d94f791146101425780638da5cb5b14610155578063afd6908614610180578063b36e4e55146101a0578063c87b56dd146101b3578063dbee1524146101c6578063f1537686146101e6575b600080fd5b6100c66100c1366004610e39565b61020f565b6040519081526020015b60405180910390f35b6100ec6100e7366004610e63565b6102a8565b60405190151581526020016100d0565b6100c660005481565b610118610113366004610f60565b6102b9565b005b610118610452565b610135610130366004611029565b610470565b6040516100d09190611070565b6101186101503660046110a3565b610495565b600554610168906001600160a01b031681565b6040516001600160a01b0390911681526020016100d0565b61019361018e3660046111a4565b61054b565b6040516100d0919061122c565b6101186101ae366004611029565b6105fa565b6101356101c136600461123f565b610684565b6101d96101d43660046112d7565b610748565b6040516100d0919061138c565b6100c66101f4366004611029565b6001600160a01b031660009081526006602052604090205490565b60006001600160a01b0383166102805760405162461bcd60e51b815260206004820152602b60248201527f455243313233383a2062616c616e636520717565727920666f7220746865207a60448201526a65726f206164647265737360a81b60648201526084015b60405180910390fd5b5060009081526002602090815260408083206001600160a01b03949094168352929052205490565b60006102b382610812565b92915050565b3360008181526006602090815260408083205483526002825280832093835292905220541561033c5760405162461bcd60e51b815260206004820152602960248201527f4e6f7420616c6c6f77656420757365727320746f20676574206d6f7265207468604482015268616e2031204e46547360b81b6064820152608401610277565b60008460405160200161034f91906113ee565b6040516020818303038152906040528051906020012090506000818760405160200161037c92919061140a565b60408051601f1981840301815291905280516020909101206008549091506103b090829087906001600160a01b0316610837565b15156001146103d15760405162461bcd60e51b815260040161027790611425565b6007546103df90600161146d565b60078190555061042a33600754600187878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506109ed92505050565b61043660075487610a7c565b5050600754336000908152600660205260409020555050505050565b3360008181526006602052604090205461046e91906001610ad8565b565b6001600160a01b0381166000908152600660205260409020546060906102b390610684565b6000826040516020016104a891906113ee565b604051602081830303815290604052805190602001209050600081856040516020016104d592919061140a565b60408051601f19818403018152919052805160209091012060085490915061050990829085906001600160a01b0316610837565b151560011461052a5760405162461bcd60e51b815260040161027790611425565b336000908152600660205260409020546105449085610a7c565b5050505050565b80516060906000816001600160401b0381111561056a5761056a610eab565b604051908082528060200260200182016040528015610593578160200160208202803683370190505b50905060005b828110156105f1576105c4868683815181106105b7576105b7611485565b602002602001015161020f565b8282815181106105d6576105d6611485565b60209081029190910101526105ea8161149b565b9050610599565b50949350505050565b6005546001600160a01b031633146106625760405162461bcd60e51b815260206004820152602560248201527f556e617574686f72697a65643a2073656e646572206973206e6f74207468652060448201526437bbb732b960d91b6064820152608401610277565b600880546001600160a01b0319166001600160a01b0392909216919091179055565b6000818152600460205260408120805460609291906106a2906114b6565b80601f01602080910402602001604051908101604052809291908181526020018280546106ce906114b6565b801561071b5780601f106106f05761010080835404028352916020019161071b565b820191906000526020600020905b8154815290600101906020018083116106fe57829003601f168201915b5050505050905061072b83610af1565b156107365792915050565b6000610740610b17565b949350505050565b81516060906000816001600160401b0381111561076757610767610eab565b60405190808252806020026020018201604052801561079a57816020015b60608152602001906001900390816107855790505b50905060005b828110156105f1576107e48682815181106107bd576107bd611485565b60200260200101518683815181106107d7576107d7611485565b602002602001015161054b565b8282815181106107f6576107f6611485565b60200260200101819052508061080b9061149b565b90506107a0565b60006001600160e01b0319821663c87b56dd60e01b14806102b357506102b382610ba9565b600082516041146108835760405162461bcd60e51b81526020600482015260166024820152750a4cae2ead2e4ca40c6dee4e4cac6e840d8cadccee8d60531b6044820152606401610277565b60208301516040840151606085015160001a601b8110156108ac576108a9601b826114f1565b90505b8060ff16601b14806108c157508060ff16601c145b61090b5760405162461bcd60e51b815260206004820152601b60248201527a0a6d2cedcc2e8eae4ca40eccae4e6d2dedc40dcdee840dac2e8c6d602b1b6044820152606401610277565b60006040518060400160405280601c81526020017b0ca2ba3432b932bab69029b4b3b732b21026b2b9b9b0b3b29d05199960211b815250905060008189604051602001610959929190611516565b60408051601f198184030181528282528051602091820120600080855291840180845281905260ff87169284019290925260608301889052608083018790529092509060019060a0016020604051602081039080840390855afa1580156109c4573d6000803e3d6000fd5b5050604051601f1901516001600160a01b03908116908a16149750505050505050509392505050565b3360008481526002602090815260408083206001600160a01b038916845290915281208054859290610a2090849061146d565b9250508190555083856001600160a01b0316826001600160a01b03167f17facb1ae55b1a0fe54049767ddeb027123cb5d0379a5a1c6f5c954287d88fb386604051610a6d91815260200190565b60405180910390a45050505050565b60008281526004602090815260409091208251610a9b92840190610d4e565b50817f369737eac2f50072db0001f8a5c3f225ab50d5ab38d8cbdbabf885abf2ab722a82604051610acc9190611070565b60405180910390a25050565b610ae3838383610bde565b610aec82610d20565b505050565b60008181526004602052604081208054829190610b0d906114b6565b9050119050919050565b606060038054610b26906114b6565b80601f0160208091040260200160405190810160405280929190818152602001828054610b52906114b6565b8015610b9f5780601f10610b7457610100808354040283529160200191610b9f565b820191906000526020600020905b815481529060010190602001808311610b8257829003601f168201915b5050505050905090565b60006001600160e01b03198216631d31540b60e21b14806102b357506301ffc9a760e01b6001600160e01b03198316146102b3565b6001600160a01b038316610c405760405162461bcd60e51b815260206004820152602360248201527f455243313233383a206275726e2066726f6d20746865207a65726f206164647260448201526265737360e81b6064820152608401610277565b3360008381526002602090815260408083206001600160a01b038816845290915290205482811015610cc05760405162461bcd60e51b8152602060048201526024808201527f455243313233383a206275726e20616d6f756e7420657863656564732062616c604482015263616e636560e01b6064820152608401610277565b60008481526002602090815260408083206001600160a01b03898116808652918452938290208786039055905186815287939192918616917f995c922928fc04a31c6446db7f51f402ddb95ac41fa3dca51c98ff1fe73005319101610a6d565b610d2981610af1565b15610d45576000818152600460205260408120610d4591610dd2565b50565b50505050565b828054610d5a906114b6565b90600052602060002090601f016020900481019282610d7c5760008555610dc2565b82601f10610d9557805160ff1916838001178555610dc2565b82800160010185558215610dc2579182015b82811115610dc2578251825591602001919060010190610da7565b50610dce929150610e08565b5090565b508054610dde906114b6565b6000825580601f10610dee575050565b601f016020900490600052602060002090810190610d4591905b5b80821115610dce5760008155600101610e09565b80356001600160a01b0381168114610e3457600080fd5b919050565b60008060408385031215610e4c57600080fd5b610e5583610e1d565b946020939093013593505050565b600060208284031215610e7557600080fd5b81356001600160e01b031981168114610e8d57600080fd5b9392505050565b80356001600160401b0381168114610e3457600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715610ee957610ee9610eab565b604052919050565b600082601f830112610f0257600080fd5b81356001600160401b03811115610f1b57610f1b610eab565b610f2e601f8201601f1916602001610ec1565b818152846020838601011115610f4357600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060808688031215610f7857600080fd5b610f8186610e94565b945060208601356001600160401b0380821115610f9d57600080fd5b610fa989838a01610ef1565b95506040880135915080821115610fbf57600080fd5b610fcb89838a01610ef1565b94506060880135915080821115610fe157600080fd5b818801915088601f830112610ff557600080fd5b81358181111561100457600080fd5b89602082850101111561101657600080fd5b9699959850939650602001949392505050565b60006020828403121561103b57600080fd5b610e8d82610e1d565b60005b8381101561105f578181015183820152602001611047565b83811115610d485750506000910152565b602081526000825180602084015261108f816040850160208701611044565b601f01601f19169190910160400192915050565b6000806000606084860312156110b857600080fd5b6110c184610e94565b925060208401356001600160401b03808211156110dd57600080fd5b6110e987838801610ef1565b935060408601359150808211156110ff57600080fd5b5061110c86828701610ef1565b9150509250925092565b60006001600160401b0382111561112f5761112f610eab565b5060051b60200190565b600082601f83011261114a57600080fd5b8135602061115f61115a83611116565b610ec1565b82815260059290921b8401810191818101908684111561117e57600080fd5b8286015b848110156111995780358352918301918301611182565b509695505050505050565b600080604083850312156111b757600080fd5b6111c083610e1d565b915060208301356001600160401b038111156111db57600080fd5b6111e785828601611139565b9150509250929050565b600081518084526020808501945080840160005b8381101561122157815187529582019590820190600101611205565b509495945050505050565b602081526000610e8d60208301846111f1565b60006020828403121561125157600080fd5b5035919050565b600082601f83011261126957600080fd5b8135602061127961115a83611116565b82815260059290921b8401810191818101908684111561129857600080fd5b8286015b848110156111995780356001600160401b038111156112bb5760008081fd5b6112c98986838b0101611139565b84525091830191830161129c565b600080604083850312156112ea57600080fd5b82356001600160401b038082111561130157600080fd5b818501915085601f83011261131557600080fd5b8135602061132561115a83611116565b82815260059290921b8401810191818101908984111561134457600080fd5b948201945b838610156113695761135a86610e1d565b82529482019490820190611349565b9650508601359250508082111561137f57600080fd5b506111e785828601611258565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156113e157603f198886030184526113cf8583516111f1565b945092850192908501906001016113b3565b5092979650505050505050565b60008251611400818460208701611044565b9190910192915050565b91825260c01b6001600160c01b031916602082015260280190565b60208082526018908201527739b4b3b732b2103832b936b4ba103a32b9ba1032b93937b960411b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000821982111561148057611480611457565b500190565b634e487b7160e01b600052603260045260246000fd5b60006000198214156114af576114af611457565b5060010190565b600181811c908216806114ca57607f821691505b602082108114156114eb57634e487b7160e01b600052602260045260246000fd5b50919050565b600060ff821660ff84168060ff0382111561150e5761150e611457565b019392505050565b60008351611528818460208801611044565b919091019182525060200191905056fea2646970667358221220eeecab3f9d3df5afd56bafab3052f1c0a5cf6bc6b23213d51ef5d6bd287e83dd64736f6c634300080a0033000000000000000000000000566454ef325a5ea22a831ebb4ff236f74e1372cd00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100ae5760003560e01c8062fdd58e146100b357806301ffc9a7146100d95780633644e515146100fc5780633f1730e71461010557806344df8e701461011a57806361c028e7146101225780636d94f791146101425780638da5cb5b14610155578063afd6908614610180578063b36e4e55146101a0578063c87b56dd146101b3578063dbee1524146101c6578063f1537686146101e6575b600080fd5b6100c66100c1366004610e39565b61020f565b6040519081526020015b60405180910390f35b6100ec6100e7366004610e63565b6102a8565b60405190151581526020016100d0565b6100c660005481565b610118610113366004610f60565b6102b9565b005b610118610452565b610135610130366004611029565b610470565b6040516100d09190611070565b6101186101503660046110a3565b610495565b600554610168906001600160a01b031681565b6040516001600160a01b0390911681526020016100d0565b61019361018e3660046111a4565b61054b565b6040516100d0919061122c565b6101186101ae366004611029565b6105fa565b6101356101c136600461123f565b610684565b6101d96101d43660046112d7565b610748565b6040516100d0919061138c565b6100c66101f4366004611029565b6001600160a01b031660009081526006602052604090205490565b60006001600160a01b0383166102805760405162461bcd60e51b815260206004820152602b60248201527f455243313233383a2062616c616e636520717565727920666f7220746865207a60448201526a65726f206164647265737360a81b60648201526084015b60405180910390fd5b5060009081526002602090815260408083206001600160a01b03949094168352929052205490565b60006102b382610812565b92915050565b3360008181526006602090815260408083205483526002825280832093835292905220541561033c5760405162461bcd60e51b815260206004820152602960248201527f4e6f7420616c6c6f77656420757365727320746f20676574206d6f7265207468604482015268616e2031204e46547360b81b6064820152608401610277565b60008460405160200161034f91906113ee565b6040516020818303038152906040528051906020012090506000818760405160200161037c92919061140a565b60408051601f1981840301815291905280516020909101206008549091506103b090829087906001600160a01b0316610837565b15156001146103d15760405162461bcd60e51b815260040161027790611425565b6007546103df90600161146d565b60078190555061042a33600754600187878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506109ed92505050565b61043660075487610a7c565b5050600754336000908152600660205260409020555050505050565b3360008181526006602052604090205461046e91906001610ad8565b565b6001600160a01b0381166000908152600660205260409020546060906102b390610684565b6000826040516020016104a891906113ee565b604051602081830303815290604052805190602001209050600081856040516020016104d592919061140a565b60408051601f19818403018152919052805160209091012060085490915061050990829085906001600160a01b0316610837565b151560011461052a5760405162461bcd60e51b815260040161027790611425565b336000908152600660205260409020546105449085610a7c565b5050505050565b80516060906000816001600160401b0381111561056a5761056a610eab565b604051908082528060200260200182016040528015610593578160200160208202803683370190505b50905060005b828110156105f1576105c4868683815181106105b7576105b7611485565b602002602001015161020f565b8282815181106105d6576105d6611485565b60209081029190910101526105ea8161149b565b9050610599565b50949350505050565b6005546001600160a01b031633146106625760405162461bcd60e51b815260206004820152602560248201527f556e617574686f72697a65643a2073656e646572206973206e6f74207468652060448201526437bbb732b960d91b6064820152608401610277565b600880546001600160a01b0319166001600160a01b0392909216919091179055565b6000818152600460205260408120805460609291906106a2906114b6565b80601f01602080910402602001604051908101604052809291908181526020018280546106ce906114b6565b801561071b5780601f106106f05761010080835404028352916020019161071b565b820191906000526020600020905b8154815290600101906020018083116106fe57829003601f168201915b5050505050905061072b83610af1565b156107365792915050565b6000610740610b17565b949350505050565b81516060906000816001600160401b0381111561076757610767610eab565b60405190808252806020026020018201604052801561079a57816020015b60608152602001906001900390816107855790505b50905060005b828110156105f1576107e48682815181106107bd576107bd611485565b60200260200101518683815181106107d7576107d7611485565b602002602001015161054b565b8282815181106107f6576107f6611485565b60200260200101819052508061080b9061149b565b90506107a0565b60006001600160e01b0319821663c87b56dd60e01b14806102b357506102b382610ba9565b600082516041146108835760405162461bcd60e51b81526020600482015260166024820152750a4cae2ead2e4ca40c6dee4e4cac6e840d8cadccee8d60531b6044820152606401610277565b60208301516040840151606085015160001a601b8110156108ac576108a9601b826114f1565b90505b8060ff16601b14806108c157508060ff16601c145b61090b5760405162461bcd60e51b815260206004820152601b60248201527a0a6d2cedcc2e8eae4ca40eccae4e6d2dedc40dcdee840dac2e8c6d602b1b6044820152606401610277565b60006040518060400160405280601c81526020017b0ca2ba3432b932bab69029b4b3b732b21026b2b9b9b0b3b29d05199960211b815250905060008189604051602001610959929190611516565b60408051601f198184030181528282528051602091820120600080855291840180845281905260ff87169284019290925260608301889052608083018790529092509060019060a0016020604051602081039080840390855afa1580156109c4573d6000803e3d6000fd5b5050604051601f1901516001600160a01b03908116908a16149750505050505050509392505050565b3360008481526002602090815260408083206001600160a01b038916845290915281208054859290610a2090849061146d565b9250508190555083856001600160a01b0316826001600160a01b03167f17facb1ae55b1a0fe54049767ddeb027123cb5d0379a5a1c6f5c954287d88fb386604051610a6d91815260200190565b60405180910390a45050505050565b60008281526004602090815260409091208251610a9b92840190610d4e565b50817f369737eac2f50072db0001f8a5c3f225ab50d5ab38d8cbdbabf885abf2ab722a82604051610acc9190611070565b60405180910390a25050565b610ae3838383610bde565b610aec82610d20565b505050565b60008181526004602052604081208054829190610b0d906114b6565b9050119050919050565b606060038054610b26906114b6565b80601f0160208091040260200160405190810160405280929190818152602001828054610b52906114b6565b8015610b9f5780601f10610b7457610100808354040283529160200191610b9f565b820191906000526020600020905b815481529060010190602001808311610b8257829003601f168201915b5050505050905090565b60006001600160e01b03198216631d31540b60e21b14806102b357506301ffc9a760e01b6001600160e01b03198316146102b3565b6001600160a01b038316610c405760405162461bcd60e51b815260206004820152602360248201527f455243313233383a206275726e2066726f6d20746865207a65726f206164647260448201526265737360e81b6064820152608401610277565b3360008381526002602090815260408083206001600160a01b038816845290915290205482811015610cc05760405162461bcd60e51b8152602060048201526024808201527f455243313233383a206275726e20616d6f756e7420657863656564732062616c604482015263616e636560e01b6064820152608401610277565b60008481526002602090815260408083206001600160a01b03898116808652918452938290208786039055905186815287939192918616917f995c922928fc04a31c6446db7f51f402ddb95ac41fa3dca51c98ff1fe73005319101610a6d565b610d2981610af1565b15610d45576000818152600460205260408120610d4591610dd2565b50565b50505050565b828054610d5a906114b6565b90600052602060002090601f016020900481019282610d7c5760008555610dc2565b82601f10610d9557805160ff1916838001178555610dc2565b82800160010185558215610dc2579182015b82811115610dc2578251825591602001919060010190610da7565b50610dce929150610e08565b5090565b508054610dde906114b6565b6000825580601f10610dee575050565b601f016020900490600052602060002090810190610d4591905b5b80821115610dce5760008155600101610e09565b80356001600160a01b0381168114610e3457600080fd5b919050565b60008060408385031215610e4c57600080fd5b610e5583610e1d565b946020939093013593505050565b600060208284031215610e7557600080fd5b81356001600160e01b031981168114610e8d57600080fd5b9392505050565b80356001600160401b0381168114610e3457600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715610ee957610ee9610eab565b604052919050565b600082601f830112610f0257600080fd5b81356001600160401b03811115610f1b57610f1b610eab565b610f2e601f8201601f1916602001610ec1565b818152846020838601011115610f4357600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060808688031215610f7857600080fd5b610f8186610e94565b945060208601356001600160401b0380821115610f9d57600080fd5b610fa989838a01610ef1565b95506040880135915080821115610fbf57600080fd5b610fcb89838a01610ef1565b94506060880135915080821115610fe157600080fd5b818801915088601f830112610ff557600080fd5b81358181111561100457600080fd5b89602082850101111561101657600080fd5b9699959850939650602001949392505050565b60006020828403121561103b57600080fd5b610e8d82610e1d565b60005b8381101561105f578181015183820152602001611047565b83811115610d485750506000910152565b602081526000825180602084015261108f816040850160208701611044565b601f01601f19169190910160400192915050565b6000806000606084860312156110b857600080fd5b6110c184610e94565b925060208401356001600160401b03808211156110dd57600080fd5b6110e987838801610ef1565b935060408601359150808211156110ff57600080fd5b5061110c86828701610ef1565b9150509250925092565b60006001600160401b0382111561112f5761112f610eab565b5060051b60200190565b600082601f83011261114a57600080fd5b8135602061115f61115a83611116565b610ec1565b82815260059290921b8401810191818101908684111561117e57600080fd5b8286015b848110156111995780358352918301918301611182565b509695505050505050565b600080604083850312156111b757600080fd5b6111c083610e1d565b915060208301356001600160401b038111156111db57600080fd5b6111e785828601611139565b9150509250929050565b600081518084526020808501945080840160005b8381101561122157815187529582019590820190600101611205565b509495945050505050565b602081526000610e8d60208301846111f1565b60006020828403121561125157600080fd5b5035919050565b600082601f83011261126957600080fd5b8135602061127961115a83611116565b82815260059290921b8401810191818101908684111561129857600080fd5b8286015b848110156111995780356001600160401b038111156112bb5760008081fd5b6112c98986838b0101611139565b84525091830191830161129c565b600080604083850312156112ea57600080fd5b82356001600160401b038082111561130157600080fd5b818501915085601f83011261131557600080fd5b8135602061132561115a83611116565b82815260059290921b8401810191818101908984111561134457600080fd5b948201945b838610156113695761135a86610e1d565b82529482019490820190611349565b9650508601359250508082111561137f57600080fd5b506111e785828601611258565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156113e157603f198886030184526113cf8583516111f1565b945092850192908501906001016113b3565b5092979650505050505050565b60008251611400818460208701611044565b9190910192915050565b91825260c01b6001600160c01b031916602082015260280190565b60208082526018908201527739b4b3b732b2103832b936b4ba103a32b9ba1032b93937b960411b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000821982111561148057611480611457565b500190565b634e487b7160e01b600052603260045260246000fd5b60006000198214156114af576114af611457565b5060010190565b600181811c908216806114ca57607f821691505b602082108114156114eb57634e487b7160e01b600052602260045260246000fd5b50919050565b600060ff821660ff84168060ff0382111561150e5761150e611457565b019392505050565b60008351611528818460208801611044565b919091019182525060200191905056fea2646970667358221220eeecab3f9d3df5afd56bafab3052f1c0a5cf6bc6b23213d51ef5d6bd287e83dd64736f6c634300080a0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000566454ef325a5ea22a831ebb4ff236f74e1372cd00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : owner_ (address): 0x566454eF325a5eA22a831eBb4fF236F74E1372CD
Arg [1] : baseURI_ (string):
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000566454ef325a5ea22a831ebb4ff236f74e1372cd
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ 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.