Contract Overview
Balance:
0 MATIC
My Name Tag:
Not Available
TokenTracker:
[ Download CSV Export ]
Latest 25 internal transaction
[ Download CSV Export ]
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
NativasToken
Compiler Version
v0.8.13+commit.abaa5c0e
Contract Source Code (Solidity Standard Json-Input format)
/// SPDX-License-Identifier: MIT /// @by: Nativas BCorp /// @author: Juan Pablo Crespi pragma solidity ^0.8.0; import "ERC1155Mintable.sol"; import "ERC1155Burnable.sol"; import "ERC1155Pausable.sol"; import "ERC1155Offsettable.sol"; import "ERC1155URIStorable.sol"; import "ERC1155ERC20.sol"; /** * @dev ERC1155 preset */ contract NativasToken is ERC1155Mintable, ERC1155Burnable, ERC1155Pausable, ERC1155Offsettable, ERC1155URIStorable, ERC1155ERC20 { constructor(string memory uri_, address template_) ERC1155URIStorable(uri_) ERC1155ERC20(template_) {} /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1155Accessible, ERC1155URIStorable) returns (bool success) { return super.supportsInterface(interfaceId); } /** * @dev Indicates whether any token exist with a given id, or not. */ function exists(uint256 tokenId) public view virtual override(ERC1155ERC20, ERC1155URIStorable) returns (bool) { return ERC1155URIStorable.exists(tokenId); } /** * */ function setMetadata( uint256 id, string memory name, string memory symbol, uint8 decimals, string memory uri, bool offsettable ) public virtual { putAdapter(id, name, symbol, decimals); setOffsettable(id, offsettable); setURI(id, uri); } /** * */ function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual override(ERC1155, ERC1155Pausable, ERC1155Supply) { super._beforeTokenTransfer(operator, from, to, ids, amounts, data); } }
/// SPDX-License-Identifier: MIT /// @by: Nativas BCorp /// @author: Juan Pablo Crespi pragma solidity ^0.8.0; import "MintRole.sol"; import "ERC1155Accessible.sol"; /** * @dev Mint implementation */ contract ERC1155Mintable is MintRole, ERC1155Accessible { /** * @dev Grants `MINTER_ROLE` to the account that deploys the contract. */ constructor() { _grantRole(MINTER_ROLE, _msgSender()); } /** * @dev See {ERC1155Accessible-_mint}. * * Requirements: * * - the caller must have the `MINTER_ROLE`. */ function mint( address to, uint256 id, uint256 amount, bytes memory data ) public virtual { require( hasRole(MINTER_ROLE, _msgSender()), "ERC1155: sender does not have role" ); _mint(to, id, amount, data); } /** * @dev See {ERC1155Accessible-_mintBatch}. * * Requirements: * * - the caller must have the `MINTER_ROLE`. */ function mintBatch( address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) public virtual { require( hasRole(MINTER_ROLE, _msgSender()), "ERC1155: sender does not have role" ); _mintBatch(to, ids, amounts, data); } }
/// SPDX-License-Identifier: MIT /// @by: Nativas BCorp /// @author: Juan Pablo Crespi pragma solidity ^0.8.0; import "Context.sol"; /** * @dev MINTER_ROLE role to mint token supply */ contract MintRole is Context { bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
/// SPDX-License-Identifier: MIT /// @by: Nativas BCorp /// @author: Juan Pablo Crespi pragma solidity ^0.8.0; import "AccessControlEnumerable.sol"; import "ERC1155.sol"; /** * ERC1155 and AccessControl implementation */ contract ERC1155Accessible is AccessControlEnumerable, ERC1155 { /** * @dev Grants `DEFAULT_ADMIN_ROLE` to the account that * deploys the contract. */ constructor() { _grantRole(DEFAULT_ADMIN_ROLE, _msgSender()); } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(AccessControlEnumerable, ERC1155) returns (bool success) { return super.supportsInterface(interfaceId); } /** * @dev Destroys `amount` tokens of token type `id` from `from` * * Emits a {TransferSingle} event. * * Requirements: * * - `from` cannot be the zero address. * - `from` must have at least `amount` tokens of token type `id`. */ function _burn( address from, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(from != address(0), "ERC1155: burn from the zero address"); address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _asSingletonArray(amount); _beforeTokenTransfer(operator, from, address(0), ids, amounts, data); uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: burn amount exceeds balance"); unchecked { _balances[id][from] = fromBalance - amount; } emit TransferSingle(operator, from, address(0), id, amount); _afterTokenTransfer(operator, from, address(0), ids, amounts, data); } /** * @dev Destroys `amounts` tokens of token type `ids` from `from` * * emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - `from` must have at least `amounts` tokens of token type `ids`. */ function _burnBatch( address from, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(from != address(0), "ERC1155: burn from the zero address"); require( ids.length == amounts.length, "ERC1155: ids and amounts length mismatch" ); address operator = _msgSender(); _beforeTokenTransfer(operator, from, address(0), ids, amounts, data); for (uint256 i = 0; i < ids.length; i++) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 fromBalance = _balances[id][from]; require( fromBalance >= amount, "ERC1155: burn amount exceeds balance" ); unchecked { _balances[id][from] = fromBalance - amount; } } emit TransferBatch(operator, from, address(0), ids, amounts); _afterTokenTransfer(operator, from, address(0), ids, amounts, data); } /** * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If `to` refers to a smart contract, it must implement * {IERC1155Receiver-onERC1155Received} and return the acceptance magic value. */ function _mint( address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _asSingletonArray(amount); _beforeTokenTransfer(operator, address(0), to, ids, amounts, data); _balances[id][to] += amount; emit TransferSingle(operator, address(0), to, id, amount); _afterTokenTransfer(operator, address(0), to, ids, amounts, data); _doSafeTransferAcceptanceCheck( operator, address(0), to, id, amount, data ); } /** * @dev Creates `amounts` tokens of token type `ids`, and assigns them to `to`. * * emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement * {IERC1155Receiver-onERC1155BatchReceived} and return the acceptance magic value. */ function _mintBatch( address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); require( ids.length == amounts.length, "ERC1155: ids and amounts length mismatch" ); address operator = _msgSender(); _beforeTokenTransfer(operator, address(0), to, ids, amounts, data); for (uint256 i = 0; i < ids.length; i++) { _balances[ids[i]][to] += amounts[i]; } emit TransferBatch(operator, address(0), to, ids, amounts); _afterTokenTransfer(operator, address(0), to, ids, amounts, data); _doSafeBatchTransferAcceptanceCheck( operator, address(0), to, ids, amounts, data ); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol) pragma solidity ^0.8.0; import "IAccessControlEnumerable.sol"; import "AccessControl.sol"; import "EnumerableSet.sol"; /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl { using EnumerableSet for EnumerableSet.AddressSet; mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) { return _roleMembers[role].at(index); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) { return _roleMembers[role].length(); } /** * @dev Overload {_grantRole} to track enumerable memberships */ function _grantRole(bytes32 role, address account) internal virtual override { super._grantRole(role, account); _roleMembers[role].add(account); } /** * @dev Overload {_revokeRole} to track enumerable memberships */ function _revokeRole(bytes32 role, address account) internal virtual override { super._revokeRole(role, account); _roleMembers[role].remove(account); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol) pragma solidity ^0.8.0; import "IAccessControl.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerable is IAccessControl { /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) external view returns (address); /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "IAccessControl.sol"; import "Context.sol"; import "Strings.sol"; import "ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role, _msgSender()); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(uint160(account), 20), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @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] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// 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 v4.4.1 (utils/structs/EnumerableSet.sol) pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; assembly { result := store } return result; } }
/// SPDX-License-Identifier: MIT /// @by: Nativas BCorp /// @author: Juan Pablo Crespi /// @dev https://eips.ethereum.org/EIPS/eip-1155 pragma solidity ^0.8.0; import "Context.sol"; import "ERC165.sol"; import "IERC1155.sol"; import "ERC1155Common.sol"; /** * @dev Implementation of the basic standard multi-token. */ contract ERC1155 is Context, ERC165, ERC1155Common, IERC1155 { // Mapping from token ID to account balances mapping(uint256 => mapping(address => uint256)) internal _balances; // Mapping from account to operator approvals mapping(address => mapping(address => bool)) internal _operatorApprovals; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool success) { return interfaceId == type(IERC1155).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC1155-balanceOf}. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) public view virtual override returns (uint256) { require( account != address(0), "ERC1155: address zero is not a valid owner" ); return _balances[id][account]; } /** * @dev See {IERC1155-balanceOfBatch}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] memory accounts, uint256[] memory ids) public view virtual override returns (uint256[] memory) { require( accounts.length == ids.length, "ERC1155: accounts and ids length mismatch" ); uint256[] memory batchBalances = new uint256[](accounts.length); for (uint256 i = 0; i < accounts.length; ++i) { batchBalances[i] = balanceOf(accounts[i], ids[i]); } return batchBalances; } /** * @dev See {IERC1155-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC1155-isApprovedForAll}. */ function isApprovedForAll(address account, address operator) public view virtual override returns (bool) { return _operatorApprovals[account][operator]; } /** * @dev See {IERC1155-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) public virtual override { require( _isOwnerOrApproved(from), "ERC1155: caller is not owner nor approved" ); _safeTransferFrom(from, to, id, amount, data); } /** * @dev See {IERC1155-safeBatchTransferFrom}. */ function safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) public virtual override { require( _isOwnerOrApproved(from), "ERC1155: transfer caller is not owner nor approved" ); _safeBatchTransferFrom(from, to, ids, amounts, data); } /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: transfer to the zero address"); address operator = _msgSender(); _transferFrom(operator, from, to, id, amount, data); _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function _safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require( ids.length == amounts.length, "ERC1155: ids and amounts length mismatch" ); require(to != address(0), "ERC1155: transfer to the zero address"); address operator = _msgSender(); _batchTransferFrom(operator, from, to, ids, amounts, data); _doSafeBatchTransferAcceptanceCheck( operator, from, to, ids, amounts, data ); } /** * */ function _transferFrom( address operator, address from, address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _asSingletonArray(amount); _beforeTokenTransfer(operator, from, to, ids, amounts, data); _transfer(from, to, id, amount); emit TransferSingle(operator, from, to, id, amount); _afterTokenTransfer(operator, from, to, ids, amounts, data); } /** * */ function _batchTransferFrom( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { _beforeTokenTransfer(operator, from, to, ids, amounts, data); for (uint256 i = 0; i < ids.length; ++i) { _transfer(from, to, ids[i], amounts[i]); } emit TransferBatch(operator, from, to, ids, amounts); _afterTokenTransfer(operator, from, to, ids, amounts, data); } /** * */ function _transfer( address from, address to, uint256 id, uint256 amount ) internal virtual { uint256 fromBalance = _balances[id][from]; require( fromBalance >= amount, "ERC1155: insufficient balance for transfer" ); unchecked { _balances[id][from] = fromBalance - amount; } _balances[id][to] += amount; } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isOwnerOrApproved(address from) internal view virtual returns (bool) { return from == _msgSender() || isApprovedForAll(from, _msgSender()); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC1155: setting approval status for self"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Hook that is called before any token transfer. This includes minting * and burning, as well as batched variants. * * The same hook is called on both single and batched variants. For single * transfers, the length of the `id` and `amount` arrays will be 1. * * Calling conditions (for each `id` and `amount` pair): * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * - `ids` and `amounts` have the same, non-zero length. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual {} /** * @dev Hook that is called after any token transfer. This includes minting * and burning, as well as batched variants. * * The same hook is called on both single and batched variants. For single * transfers, the length of the `id` and `amount` arrays will be 1. * * Calling conditions (for each `id` and `amount` pair): * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * - `ids` and `amounts` have the same, non-zero length. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual {} }
/// SPDX-License-Identifier: MIT /// @by: Nativas BCorp /// @author: Juan Pablo Crespi /// @dev: https://eips.ethereum.org/EIPS/eip-1155 pragma solidity ^0.8.0; /** * @title ERC-1155 Multi Token Standard * Note: The ERC-165 identifier for this interface is 0xd9b67a26. */ interface IERC1155 { /** * @dev Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including * zero value transfers as well as minting or burning (see "Safe Transfer Rules" section of the standard). * The @param operator argument MUST be the address of an account/contract that is approved to make the transfer * (SHOULD be msg.sender). * The @param from argument MUST be the address of the holder whose balance is decreased. * The @param to argument MUST be the address of the recipient whose balance is increased. * The @param id argument MUST be the token type being transferred. * The @param value argument MUST be the number of tokens the holder balance is decreased by and match what the * recipient balance is increased by. * When minting/creating tokens, the `from` argument MUST be set to `0x0` (i.e. zero address). * When burning/destroying tokens, the `to` argument MUST be set to `0x0` (i.e. zero address). */ event TransferSingle( address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value ); /** * @dev Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including zero value * transfers as well as minting or burning (see "Safe Transfer Rules" section of the standard). * The @param operator argument MUST be the address of an account/contract that is approved to make the transfer * (SHOULD be msg.sender). * The @param from argument MUST be the address of the holder whose balance is decreased. * The @param to argument MUST be the address of the recipient whose balance is increased. * The @param ids argument MUST be the list of tokens being transferred. * The @param values argument MUST be the list of number of tokens (matching the list and order of tokens * specified in _ids) the holder balance is decreased by and match what the recipient balance is increased by. * When minting/creating tokens, the `from` argument MUST be set to `0x0` (i.e. zero address). * When burning/destroying tokens, the `to` argument MUST be set to `0x0` (i.e. zero address). */ event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values ); /** * @dev MUST emit when approval for a second party/operator address to manage all tokens for an owner address is * enabled or disabled (absence of an event assumes disabled). */ event ApprovalForAll( address indexed owner, address indexed operator, bool approved ); /** * @dev MUST emit when the URI is updated for a token ID. * URIs are defined in RFC 3986. * The URI MUST point to a JSON file that conforms to the "ERC-1155 Metadata URI JSON Schema". */ event URI(string value, uint256 indexed id); /** * @notice Transfers `value` amount of an `id` from the `from` address to the `to` address specified * (with safety call). * @dev Caller must be approved to manage the tokens being transferred out of the `from` account * (see "Approval" section of the standard). * MUST revert if `to` is the zero address. * MUST revert if balance of holder for token `id` is lower than the `value` sent. * MUST revert on any other error. * MUST emit the `TransferSingle` event to reflect the balance change (see "Safe Transfer Rules" section * of the standard). * After the above conditions are met, this function MUST check if `to` is a smart contract (e.g. code size > 0). * If so, it MUST call `onERC1155Received` on `to` and act appropriately (see "Safe Transfer Rules" section of * the standard). * @param from Source address * @param to Target address * @param id ID of the token type * @param value Transfer amount * @param data Additional data with no specified format, MUST be sent unaltered in call * to `onERC1155Received` on `to` */ function safeTransferFrom( address from, address to, uint256 id, uint256 value, bytes calldata data ) external; /** * @notice Transfers `values` amount(s) of `ids` from the `from` address to the `to` address specified * (with safety call). * @dev Caller must be approved to manage the tokens being transferred out of the `from` account * (see "Approval" section of the standard). * MUST revert if `to` is the zero address. * MUST revert if length of `ids` is not the same as length of `values`. * MUST revert if any of the balance(s) of the holder(s) for token(s) in `ids` is lower than the respective * amount(s) in `values` sent to the recipient. * MUST revert on any other error. * MUST emit `TransferSingle` or `TransferBatch` event(s) such that all the balance changes are reflected * (see "Safe Transfer Rules" section of the standard). * Balance changes and events MUST follow the ordering of * the arrays (ids[0]/values[0] before ids[1]/values[1], etc). * After the above conditions for the transfer(s) in the batch are met, this function MUST check if `to` * is a smart contract (e.g. code size > 0). If so, it MUST call the relevant `ERC1155TokenReceiver` hook(s) * on `to` and act appropriately (see "Safe Transfer Rules" section of the standard). * @param from Source address * @param to Target address * @param ids IDs of each token type (order and length must match values array) * @param values Transfer amounts per token type (order and length must match ids array) * @param data Additional data with no specified format, MUST be sent unaltered in call * to the `ERC1155TokenReceiver` hook(s) on `to` */ function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external; /** * @notice Get the balance of an account's tokens. * @param owner The address of the token holder * @param id ID of the token * @return balance owner's balance of the token type requested */ function balanceOf(address owner, uint256 id) external view returns (uint256 balance); /** * @notice Get the balance of multiple account/token pairs * @param owners The addresses of the token holders * @param ids ID of the tokens * @return balances owner's balance of the token types requested (i.e. balance for each (owner, id) pair) */ function balanceOfBatch(address[] calldata owners, uint256[] calldata ids) external view returns (uint256[] memory balances); /** * @notice Enable or disable approval for a third party ("operator") to manage all of the caller's tokens. * @dev MUST emit the ApprovalForAll event on success. * @param operator Address to add to the set of authorized operators * @param approved True if the operator is approved, false to revoke approval */ function setApprovalForAll(address operator, bool approved) external; /** * @notice Queries the approval status of an operator for a given owner. * @param owner The owner of the tokens * @param operator Address of authorized operator * @return success True if the operator is approved, false if not */ function isApprovedForAll(address owner, address operator) external view returns (bool success); }
/// SPDX-License-Identifier: MIT /// @by: Nativas BCorp /// @author: Juan Pablo Crespi pragma solidity ^0.8.0; import "Address.sol"; import "IERC1155TokenReceiver.sol"; /** * @dev Common function for ERC1155 standar. */ contract ERC1155Common { using Address for address; /** * @dev helper function to create an array from an element. */ function _asSingletonArray(uint256 element) internal pure returns (uint256[] memory) { uint256[] memory array = new uint256[](1); array[0] = element; return array; } /** * @dev transfer acceptance check. */ function _doSafeTransferAcceptanceCheck( address operator, address from, address to, uint256 id, uint256 amount, bytes memory data ) internal { if (to.isContract()) { bytes4 response = IERC1155TokenReceiver(to).onERC1155Received( operator, from, id, amount, data ); require( response == IERC1155TokenReceiver.onERC1155Received.selector, "ERC1155: ERC1155Receiver rejected tokens" ); } } /** * @dev batch transfer acceptance check. */ function _doSafeBatchTransferAcceptanceCheck( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal { if (to.isContract()) { bytes4 response = IERC1155TokenReceiver(to).onERC1155BatchReceived( operator, from, ids, amounts, data ); require( response == IERC1155TokenReceiver.onERC1155Received.selector, "ERC1155: ERC1155Receiver rejected tokens" ); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.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 functionCall(target, data, "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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(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) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(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) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason 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 { // 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/// SPDX-License-Identifier: MIT /// @by: Nativas BCorp /// @author: Juan Pablo Crespi /// @dev: https://eips.ethereum.org/EIPS/eip-1155 pragma solidity ^0.8.0; /** * @title ERC1155TokenReceiver interface to accept transfers * Note: The ERC-165 identifier for this interface is 0x4e2312e0. */ interface IERC1155TokenReceiver { /** * @notice Handle the receipt of a single ERC1155 token type. * @dev An ERC1155-compliant smart contract MUST call this function on the token recipient contract, at the end * of a `safeTransferFrom` after the balance has been updated. * This function MUST return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` * (i.e. 0xf23a6e61) if it accepts the transfer. * This function MUST revert if it rejects the transfer. * Return of any other value than the prescribed keccak256 generated value MUST result in the transaction being * reverted by the caller. * @param operator The address which initiated the transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param id The ID of the token being transferred * @param value The amount of tokens being transferred * @param data Additional data with no specified format * @return result `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` */ function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns (bytes4 result); /** * @notice Handle the receipt of multiple ERC1155 token types. * @dev An ERC1155-compliant smart contract MUST call this function on the token recipient contract, at the end * of a `safeBatchTransferFrom` after the balances have been updated. * This function MUST return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` * (i.e. 0xbc197c81) if it accepts the transfer(s). * This function MUST revert if it rejects the transfer(s). * Return of any other value than the prescribed keccak256 generated value MUST result in the transaction being * reverted by the caller. * @param operator The address which initiated the batch transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param ids An array containing ids of each token being transferred (order and length must match _values array) * @param values 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 result `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` */ function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns (bytes4 result); }
/// SPDX-License-Identifier: MIT /// @by: Nativas BCorp /// @author: Juan Pablo Crespi pragma solidity ^0.8.0; import "BurnRole.sol"; import "ERC1155Accessible.sol"; /** * @dev Burn implementation */ contract ERC1155Burnable is BurnRole, ERC1155Accessible { /** * @dev Grants `BURNER_ROLE` to the account that deploys the contract. */ constructor() { _grantRole(BURNER_ROLE, _msgSender()); } /** * @dev See {ERC1155Accessible-_burn}. * * Requirements: * * - the caller must have the `BURNER_ROLE`. * - the caller must be the owner or approved. */ function burn( address account, uint256 id, uint256 value, bytes memory data ) public virtual { require( hasRole(BURNER_ROLE, _msgSender()), "ERC1155: sender does not have role" ); require( _isOwnerOrApproved(account), "ERC1155: caller is not owner nor approved" ); _burn(account, id, value, data); } /** * @dev See {ERC1155Accessible-_burnBatch}. * * Requirements: * * - the caller must have the `BURNER_ROLE`. * - the caller must be the owner or approved. */ function burnBatch( address account, uint256[] memory ids, uint256[] memory values, bytes memory data ) public virtual { require( hasRole(BURNER_ROLE, _msgSender()), "ERC1155: sender does not have role" ); require( _isOwnerOrApproved(account), "ERC1155: caller is not owner nor approved" ); _burnBatch(account, ids, values, data); } }
/// SPDX-License-Identifier: MIT /// @by: Nativas BCorp /// @author: Juan Pablo Crespi pragma solidity ^0.8.0; import "Context.sol"; /** * @dev BURNER_ROLE role to burn token supply */ contract BurnRole is Context { bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE"); }
/// SPDX-License-Identifier: MIT /// @by: Nativas BCorp /// @author: Juan Pablo Crespi pragma solidity ^0.8.0; import "Pausable.sol"; import "PauseRole.sol"; import "ERC1155Accessible.sol"; /** * @dev ERC1155 pause implementation */ contract ERC1155Pausable is PauseRole, Pausable, ERC1155Accessible { /** * @dev Grants `PAUSER_ROLE` to the account that deploys the contract. */ constructor() { _grantRole(PAUSER_ROLE, _msgSender()); } /** * @dev Pauses all token transfers. * * See {Pausable-_pause}. * * Requirements: * * - the caller must have the `PAUSER_ROLE`. */ function pause() public virtual { require( hasRole(PAUSER_ROLE, _msgSender()), "ERC1155: sender does not have role" ); _pause(); } /** * @dev Unpauses all token transfers. * * See {Pausable-_unpause}. * * Requirements: * * - the caller must have the `PAUSER_ROLE`. */ function unpause() public virtual { require( hasRole(PAUSER_ROLE, _msgSender()), "ERC1155: sender does not have role" ); _unpause(); } /** * @dev See {ERC1155-_beforeTokenTransfer}. * * Requirements: * * - the contract must not be paused. */ function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual override { super._beforeTokenTransfer(operator, from, to, ids, amounts, data); require( paused() == false, "ERC1155Pausable: token transfer while paused" ); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/Pausable.sol) pragma solidity ^0.8.0; import "Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
/// SPDX-License-Identifier: MIT /// @by: Nativas BCorp /// @author: Juan Pablo Crespi pragma solidity ^0.8.0; import "Context.sol"; /** * @dev PAUSER_ROLE role to pause token contract */ contract PauseRole is Context { bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); }
/// SPDX-License-Identifier: MIT /// @by: Nativas BCorp /// @author: Juan Pablo Crespi pragma solidity ^0.8.0; import "Strings.sol"; import "ERC1155Accessible.sol"; import "EditRole.sol"; /** * @dev Offset Implementation */ contract ERC1155Offsettable is EditRole, ERC1155Accessible { /** * @dev Offset model */ struct Offset { uint256 tokenId; uint256 value; uint256 date; } // offset data mapping(address => Offset[]) private _offsets; mapping(address => uint256) private _offsetCount; mapping(uint256 => bool) private _offsettable; /** * @dev Grants `EDITOR_ROLE` to the account that deploys the contract. */ constructor() { _grantRole(EDITOR_ROLE, _msgSender()); } /** * @dev */ function offset( address account, uint256 tokenId, uint256 value, bytes memory data ) public virtual { require( _isOwnerOrApproved(account), "ERC1155: caller is not owner nor approved" ); _burn(account, tokenId, value, data); _offset(account, tokenId, value); } /** * @dev */ function offsetBatch( address account, uint256[] memory tokenIds, uint256[] memory values, bytes memory data ) public virtual { require( _isOwnerOrApproved(account), "ERC1155: caller is not owner nor approved" ); _burnBatch(account, tokenIds, values, data); for (uint256 i = 0; i < tokenIds.length; i++) { _offset(account, tokenIds[i], values[i]); } } /** * @dev */ function getOffsetValue(address account, uint256 index) public view virtual returns ( uint256 tokenId, uint256 value, uint256 date ) { Offset memory data = _offsets[account][index]; return (data.tokenId, data.value, data.date); } /** * @dev */ function getOffsetCount(address account) public view virtual returns (uint256) { return _offsetCount[account]; } /** * @dev */ function _offset( address account, uint256 tokenId, uint256 value ) internal virtual { require( _offsettable[tokenId], "ERC1155Offsettable: token is not offsettable" ); _offsetCount[account]++; _offsets[account].push(Offset(tokenId, value, block.timestamp)); } /** * @dev */ function offsettable(uint256 tokenId) public view virtual returns (bool) { return _offsettable[tokenId]; } /** * @dev * * Requeriments: * * - the caller must have the `EDITOR_ROLE`. */ function setOffsettable(uint256 tokenId, bool enabled) public virtual { require( hasRole(EDITOR_ROLE, _msgSender()), "ERC1155Offsettable: sender does not have role" ); _setOffsettable(tokenId, enabled); } /** * @dev */ function _setOffsettable(uint256 tokenId, bool enabled) public virtual { _offsettable[tokenId] = enabled; } }
/// SPDX-License-Identifier: MIT /// @by: Nativas BCorp /// @author: Juan Pablo Crespi pragma solidity ^0.8.0; import "Context.sol"; /** * @dev EDITOR_ROLE role to edit token data */ contract EditRole is Context { bytes32 public constant EDITOR_ROLE = keccak256("EDITOR_ROLE"); }
/// SPDX-License-Identifier: MIT /// @by: Nativas BCorp /// @author: Juan Pablo Crespi pragma solidity ^0.8.0; import "Strings.sol"; import "IERC1155MetadataURI.sol"; import "EditRole.sol"; import "ERC1155Accessible.sol"; /** * @dev ERC1155 token with storage based token URI management. */ contract ERC1155URIStorable is EditRole, ERC1155Accessible, IERC1155MetadataURI { using Strings for uint256; // Used as the URI for all token types by relying on ID substitution. string internal _uri; // Mapping for token URIs mapping(uint256 => string) private _tokenURIs; /** * @dev Grants `EDITOR_ROLE` to the account that deploys the contract. */ constructor(string memory uri_) { _setBaseURI(uri_); _grantRole(EDITOR_ROLE, _msgSender()); } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool success) { return interfaceId == type(IERC1155MetadataURI).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC1155MetadataURI-uri}. * * This implementation returns the concatenation of the `_uri` * and the token-specific uri if the latter is set */ function uri(uint256 tokenId) public view virtual override returns (string memory) { string memory tokenURI = _tokenURIs[tokenId]; if (bytes(tokenURI).length > 0) { return string(abi.encodePacked(_uri, tokenURI)); } else { return string(abi.encodePacked(_uri, tokenId.toString())); } } /** * @dev Indicates whether any token exist with a given id, or not. */ function exists(uint256 tokenId) public view virtual returns (bool) { return bytes(_tokenURIs[tokenId]).length > 0; } /** * @dev See {ERC1155URIStorable-_setBaseURI} * * Requeriments: * * - the caller must have the `EDITOR_ROLE`. */ function setBaseURI(string memory baseURI) public virtual { require( hasRole(EDITOR_ROLE, _msgSender()), "ERC1155: sender does not have role" ); _setBaseURI(baseURI); } /** * @dev See {ERC1155URIStorable-_setURI} * * Requeriments: * * - the caller must have the `EDITOR_ROLE`. */ function setURI(uint256 tokenId, string memory tokenURI) public virtual { require( hasRole(EDITOR_ROLE, _msgSender()), "ERC1155: sender does not have role" ); _setURI(tokenId, tokenURI); } /** * @dev Sets `baseURI` as the `_uri` for all tokens */ function _setBaseURI(string memory baseURI) internal virtual { _uri = baseURI; } /** * @dev Sets `tokenURI` as the tokenURI of `tokenId`. */ function _setURI(uint256 tokenId, string memory tokenURI) internal virtual { _tokenURIs[tokenId] = tokenURI; emit URI(tokenURI, tokenId); } }
/// SPDX-License-Identifier: MIT /// @by: Nativas BCorp /// @author: Juan Pablo Crespi /// @dev https://eips.ethereum.org/EIPS/eip-1155 pragma solidity ^0.8.0; /** * @title Interface of the optional ERC1155MetadataExtension interface * Note: The ERC-165 identifier for this interface is 0x0e89341c. */ interface IERC1155MetadataURI { /** * @notice A distinct Uniform Resource Identifier (URI) for a given token. * @dev URIs are defined in RFC 3986. * The URI MUST point to a JSON file that conforms to the "ERC-1155 Metadata URI JSON Schema". * @return uri string */ function uri(uint256 id) external view returns (string memory uri); }
/// SPDX-License-Identifier: MIT /// @by: Nativas BCorp /// @author: Juan Pablo Crespi pragma solidity ^0.8.0; import "Clones.sol"; import "IERC1155ERC20.sol"; import "EditRole.sol"; import "NativasAdapter.sol"; import "ERC1155Supply.sol"; /** * */ contract ERC1155ERC20 is EditRole, ERC1155Supply, IERC1155ERC20 { using Clones for address; // NativasAdapter template address internal _template; // Mapping token id to adapter address mapping(uint256 => address) internal _adapters; /** * @dev MUST trigger when a new adapter is created. */ event AdapterCreated(uint256 indexed id, address indexed adapter); /** * @dev Grants `EDITOR_ROLE` to the account that deploys the contract. * Set NativasAdapter contract template */ constructor(address template_) { _grantRole(EDITOR_ROLE, _msgSender()); _template = template_; } /** * @dev Get NativasAdapter contract template */ function template() public view virtual returns (address) { return _template; } /** * @dev See {ERC1155ERC20-_putAdapter} * * Requirements: * * - the caller must have the `EDITOR_ROLE`. */ function putAdapter( uint256 id, string memory name, string memory symbol, uint8 decimals ) public virtual returns (address) { require( hasRole(EDITOR_ROLE, _msgSender()), "ERC1155: caller is not the token adapter" ); return _putAdapter(id, name, symbol, decimals); } /** * @dev Get adpter contract address for token id. */ function getAdapter(uint256 id) public view virtual returns (address) { return _adapters[id]; } /** * @dev Perform tranfer from adapter contract. * * Requirements: * * - the caller MUST be the token adapter. */ function safeAdapterTransferFrom( address operator, address from, address to, uint256 id, uint256 amount, bytes memory data ) public virtual override { require( _msgSender() == _adapters[id], "ERC1155: caller is not the token adapter" ); _safeAdapterTransferFrom(operator, from, to, id, amount, data); } /** * @dev Indicates whether any token exist with a given id, or not. */ function exists(uint256 tokenId) public view virtual override returns (bool) { return _adapters[tokenId] != address(0); } /** * @dev Create new adapter contract por token id */ function _putAdapter( uint256 id, string memory name, string memory symbol, uint8 decimals ) internal virtual returns (address) { address adapter = _template.clone(); NativasAdapter(adapter).init(id, name, symbol, decimals); _adapters[id] = adapter; emit AdapterCreated(id, adapter); return adapter; } /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement * {IERC1155Receiver-onERC1155Received} and return the acceptance magic value. */ function _safeAdapterTransferFrom( address operator, address from, address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: transfer to the zero address"); _transferFrom(operator, from, to, id, amount, data); _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/Clones.sol) pragma solidity ^0.8.0; /** * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for * deploying minimal proxy contracts, also known as "clones". * * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies * > a minimal bytecode implementation that delegates all calls to a known, fixed address. * * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2` * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the * deterministic method. * * _Available since v3.4._ */ library Clones { /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create opcode, which should never revert. */ function clone(address implementation) internal returns (address instance) { assembly { let ptr := mload(0x40) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(ptr, 0x14), shl(0x60, implementation)) mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000) instance := create(0, ptr, 0x37) } require(instance != address(0), "ERC1167: create failed"); } /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create2 opcode and a `salt` to deterministically deploy * the clone. Using the same `implementation` and `salt` multiple time will revert, since * the clones cannot be deployed twice at the same address. */ function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) { assembly { let ptr := mload(0x40) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(ptr, 0x14), shl(0x60, implementation)) mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000) instance := create2(0, ptr, 0x37, salt) } require(instance != address(0), "ERC1167: create2 failed"); } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress( address implementation, bytes32 salt, address deployer ) internal pure returns (address predicted) { assembly { let ptr := mload(0x40) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(ptr, 0x14), shl(0x60, implementation)) mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf3ff00000000000000000000000000000000) mstore(add(ptr, 0x38), shl(0x60, deployer)) mstore(add(ptr, 0x4c), salt) mstore(add(ptr, 0x6c), keccak256(ptr, 0x37)) predicted := keccak256(add(ptr, 0x37), 0x55) } } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress(address implementation, bytes32 salt) internal view returns (address predicted) { return predictDeterministicAddress(implementation, salt, address(this)); } }
/// SPDX-License-Identifier: MIT /// @by: Nativas BCorp /// @author: Juan Pablo Crespi pragma solidity ^0.8.0; import "IERC1155.sol"; import "IERC1155Supply.sol"; /** * @title Extension of ERC1155 that adds backward compatibility */ interface IERC1155ERC20 is IERC1155, IERC1155Supply { /** * @dev See {IERC1155-safeTransferFrom}. */ function safeAdapterTransferFrom( address operator, address from, address to, uint256 id, uint256 amount, bytes memory data ) external; }
/// SPDX-License-Identifier: MIT /// @by: Nativas BCorp /// @author: Juan Pablo Crespi pragma solidity ^0.8.0; /** * @title Extension of ERC1155 that adds tracking of total supply per id. */ interface IERC1155Supply { /** * Useful for scenarios where Fungible and Non-fungible tokens have to be * clearly identified. Note: While a totalSupply of 1 might mean the * corresponding is an NFT, there is no guarantees that no other token with the * same id are not going to be minted. */ function totalSupply(uint256 id) external view returns (uint256 totalSupply); }
/// SPDX-License-Identifier: MIT /// @by: Nativas BCorp /// @author: Juan Pablo Crespi pragma solidity ^0.8.0; import "Context.sol"; import "ERC165.sol"; import "Initializable.sol"; import "IERC1155ERC20.sol"; import "IERC20.sol"; import "IERC20Metadata.sol"; import "IERC20Approve.sol"; /** * @title ERC20 inplementation that adds backward compatibility */ contract NativasAdapter is Context, Initializable, ERC165, IERC20, IERC20Metadata, IERC20Approve { // IERC1155ERC20 address internal _entity; uint256 internal _id; // IERC20Metadata string internal _name; string internal _symbol; uint8 internal _decimals; // IERC20Approve mapping(address => mapping(address => uint256)) internal _allowances; /** * @dev Initialize template */ constructor( uint256 id_, string memory name_, string memory symbol_, uint8 decimals_) { init(id_, name_, symbol_, decimals_); } /** * @dev Initialize contract */ function init( uint256 id_, string memory name_, string memory symbol_, uint8 decimals_ ) public initializer { _entity = _msgSender(); _id = id_; _name = name_; _symbol = symbol_; _decimals = decimals_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC20).interfaceId || interfaceId == type(IERC20Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev ERC1155 token address. */ function entity() public view virtual returns (address) { return _entity; } /** * @dev ERC1155 token id. */ function id() public view virtual returns (uint256) { return _id; } /** * @dev See {IERC20-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC20-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC20-decimals}. */ function decimals() public view virtual override returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return IERC1155ERC20(_entity).totalSupply(_id); } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return IERC1155ERC20(_entity).balanceOf(account, _id); } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20Approve-increaseAllowance}. */ function increaseAllowance(address spender, uint256 addedValue) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev See {IERC20Approve-decreaseAllowance}. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual override returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require( currentAllowance >= subtractedValue, "NativasAdapter: decreased allowance below zero" ); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev See {IERC20-transfer}. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, owner, to, amount); return true; } /** * @dev See {IERC20-transferFrom}. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(spender, from, to, amount); return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address operator, address from, address to, uint256 amount ) internal virtual { IERC1155ERC20(_entity).safeAdapterTransferFrom( operator, from, to, _id, amount, "" ); emit Transfer(from, to, amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require( owner != address(0), "NativasAdapter: approve from the zero address" ); require( spender != address(0), "NativasAdapter: approve to the zero address" ); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner`s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Emits an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); require( currentAllowance != type(uint256).max, "NativasAdapter: invalid allowance" ); require( currentAllowance >= amount, "NativasAdapter: insufficient allowance" ); unchecked { _approve(owner, spender, currentAllowance - amount); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.0; import "Address.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() initializer {} * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { // If the contract is initializing we ignore whether _initialized is set in order to support multiple // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the // contract may have been reentered. require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} modifier, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } function _isConstructor() private view returns (bool) { return !Address.isContract(address(this)); } }
/// SPDX-License-Identifier: MIT /// @by: Nativas BCorp /// @author: Juan Pablo Crespi /// @dev https://eips.ethereum.org/EIPS/eip-20 pragma solidity ^0.8.0; /** * @title ERC-20: Token Standard */ interface IERC20 { /** * @dev MUST trigger when tokens are transferred, including zero value transfers. * * A token contract which creates new tokens SHOULD trigger a Transfer event * with the from address set to 0x0 when tokens are created. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev MUST trigger on any successful call to approve(address _spender, uint256 _value). */ event Approval( address indexed owner, address indexed spender, uint256 value ); /** * @return totalSupply the total token supply. */ function totalSupply() external view returns (uint256 totalSupply); /** * @return balance the account balance of another account with address owner. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @return remaining the amount which spender is still allowed to withdraw from owner. */ function allowance(address owner, address spender) external view returns (uint256 remaining); /** * @dev Transfers value amount of tokens to address to, and MUST fire the * Transfer event. The function SHOULD throw if the message caller’s account * balance does not have enough tokens to spend. * * Note Transfers of 0 values MUST be treated as normal transfers and fire * the Transfer event. */ function transfer(address to, uint256 value) external returns (bool success); /** * @dev Transfers value amount of tokens from address from to address to, * and MUST fire the Transfer event. * * The transferFrom method is used for a withdraw workflow, allowing contracts * to transfer tokens on your behalf. This can be used for example to allow a * contract to transfer tokens on your behalf and/or to charge fees in sub-currencies. * The function SHOULD throw unless the from account has deliberately authorized * the sender of the message via some mechanism. * * Note Transfers of 0 values MUST be treated as normal transfers and fire * the Transfer event. */ function transferFrom( address from, address to, uint256 value ) external returns (bool success); /** * @dev Allows spender to withdraw from your account multiple times, up to the value * amount. If this function is called again it overwrites the current allowance with value. * * Note To prevent attack vectors like the one described here and discussed here, * clients SHOULD make sure to create user interfaces in such a way that they set * the allowance first to 0 before setting it to another value for the same spender. * THOUGH The contract itself shouldn’t enforce it, to allow backwards compatibility with * contracts deployed before */ function approve(address spender, uint256 value) external returns (bool success); }
/// SPDX-License-Identifier: MIT /// @by: Nativas BCorp /// @author: Juan Pablo Crespi /// @dev: https://eips.ethereum.org/EIPS/eip-20 pragma solidity ^0.8.0; /** * @title Interface for the optional metadata functions from the ERC20 standard. */ interface IERC20Metadata { /** * @return name the name of the token. */ function name() external view returns (string memory name); /** * @return symbol the symbol of the token. */ function symbol() external view returns (string memory symbol); /** * @return decimals the number of decimals the token uses */ function decimals() external view returns (uint8 decimals); }
/// SPDX-License-Identifier: MIT /// @by: Nativas BCorp /// @author: Juan Pablo Crespi pragma solidity ^0.8.0; /** * @dev Interface for the optional metadata functions from the ERC20 standard. */ interface IERC20Approve { /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * Emits an {Approval} event indicating the updated allowance. */ function increaseAllowance(address spender, uint256 addedValue) external returns (bool success); /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * Emits an {Approval} event indicating the updated allowance. */ function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool success); }
/// SPDX-License-Identifier: MIT /// @by: Nativas BCorp /// @author: Juan Pablo Crespi pragma solidity ^0.8.0; import "IERC1155Supply.sol"; import "ERC1155Accessible.sol"; /** * @dev Extension of ERC1155 that adds tracking of total supply per id. */ contract ERC1155Supply is ERC1155Accessible, IERC1155Supply { // total supply mapping(uint256 => uint256) internal _totalSupply; /** * @dev Total amount of tokens in with a given id. */ function totalSupply(uint256 id) public view virtual override returns (uint256 supply) { return _totalSupply[id]; } /** * @dev Indicates whether any token exist with a given id, or not. */ function exists(uint256 id) public view virtual returns (bool) { return totalSupply(id) > 0; } /** * @dev See {ERC1155-_beforeTokenTransfer}. */ function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual override { super._beforeTokenTransfer(operator, from, to, ids, amounts, data); //Mint if (from == address(0)) { for (uint256 i = 0; i < ids.length; ++i) { _totalSupply[ids[i]] += amounts[i]; } } // Burn if (to == address(0)) { for (uint256 i = 0; i < ids.length; ++i) { uint256 id = ids[i]; uint256 amount = amounts[i]; require( _totalSupply[id] >= amount, "ERC1155: burn amount exceeds totalSupply" ); unchecked { _totalSupply[id] -= amount; } } } } }
{ "evmVersion": "istanbul", "optimizer": { "enabled": true, "runs": 200 }, "libraries": { "NativasToken.sol": {} }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
[{"inputs":[{"internalType":"string","name":"uri_","type":"string"},{"internalType":"address","name":"template_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"adapter","type":"address"}],"name":"AdapterCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"TransferBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"TransferSingle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"value","type":"string"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"URI","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"BURNER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EDITOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAUSER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bool","name":"enabled","type":"bool"}],"name":"_setOffsettable","outputs":[],"stateMutability":"nonpayable","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":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"balanceOfBatch","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"burnBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"exists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getAdapter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getOffsetCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getOffsetValue","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"date","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"mintBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"offset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"offsetBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"offsettable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"name":"putAdapter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeAdapterTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeBatchTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"baseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"string","name":"uri","type":"string"},{"internalType":"bool","name":"offsettable","type":"bool"}],"name":"setMetadata","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bool","name":"enabled","type":"bool"}],"name":"setOffsettable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"tokenURI","type":"string"}],"name":"setURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"template","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"supply","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b5060405162003ba738038062003ba7833981016040819052620000349162000387565b6000805460ff19168155819083906200004e903362000158565b6200007a7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a63362000158565b620000a67f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a8483362000158565b620000d27f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a3362000158565b620000ed60008051602062003b878339815191523362000158565b620000f8816200019b565b6200011360008051602062003b878339815191523362000158565b506200012f60008051602062003b878339815191523362000158565b600b80546001600160a01b0319166001600160a01b039290921691909117905550620004b49050565b6200016f8282620001b460201b620010cd1760201c565b600082815260026020908152604090912062000196918390620011386200023c821b17901c565b505050565b8051620001b0906008906020840190620002ae565b5050565b60008281526001602090815260408083206001600160a01b038516845290915290205460ff16620001b05760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b600062000253836001600160a01b0384166200025c565b90505b92915050565b6000818152600183016020526040812054620002a55750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000256565b50600062000256565b828054620002bc9062000478565b90600052602060002090601f016020900481019282620002e057600085556200032b565b82601f10620002fb57805160ff19168380011785556200032b565b828001600101855582156200032b579182015b828111156200032b5782518255916020019190600101906200030e565b50620003399291506200033d565b5090565b5b808211156200033957600081556001016200033e565b634e487b7160e01b600052604160045260246000fd5b80516001600160a01b03811681146200038257600080fd5b919050565b600080604083850312156200039b57600080fd5b82516001600160401b0380821115620003b357600080fd5b818501915085601f830112620003c857600080fd5b815181811115620003dd57620003dd62000354565b604051601f8201601f19908116603f0116810190838211818310171562000408576200040862000354565b816040528281526020935088848487010111156200042557600080fd5b600091505b828210156200044957848201840151818301850152908301906200042a565b828211156200045b5760008484830101525b95506200046d9150508582016200036a565b925050509250929050565b600181811c908216806200048d57607f821691505b602082108103620004ae57634e487b7160e01b600052602260045260246000fd5b50919050565b6136c380620004c46000396000f3fe608060405234801561001057600080fd5b50600436106102685760003560e01c8063862440e211610151578063c59e3d4b116100c3578063ddeadbb611610087578063ddeadbb6146105e8578063e63ab1e914610611578063e985e9c514610638578063ec064fdd14610674578063f0a84e7f14610697578063f242432a146106aa57600080fd5b8063c59e3d4b1461055a578063ca15c8731461056d578063d539139314610580578063d547741f146105a7578063d5626b06146105ba57600080fd5b8063a217fddf11610115578063a217fddf146104c9578063a22cb465146104d1578063a853211a146104e4578063b1be64c7146104f9578063b29c1fad14610527578063bd85b0391461053a57600080fd5b8063862440e21461046a5780638a94b05f1461047d5780639010d07c1461049057806390aa5a58146104a357806391d14854146104b657600080fd5b80633f4ba83a116101ea57806355f804b3116101ae57806355f804b3146103e35780635c975abb146103f65780636f2ddd9314610401578063731133e91461042657806375413c48146104395780638456cb591461046257600080fd5b80633f4ba83a146103825780634e1273f41461038a5780634f558e79146103aa578063503cbad8146103bd5780635473422e146103d057600080fd5b8063282c51f311610231578063282c51f31461030f5780632a6d5ef7146103365780632eb2c2d6146103495780632f2ff15d1461035c57806336568abe1461036f57600080fd5b8062fdd58e1461026d57806301ffc9a7146102935780630e89341c146102b65780631f7fdffa146102d6578063248a9ca3146102eb575b600080fd5b61028061027b366004612877565b6106bd565b6040519081526020015b60405180910390f35b6102a66102a13660046128b7565b610758565b604051901515815260200161028a565b6102c96102c43660046128d4565b610763565b60405161028a9190612945565b6102e96102e4366004612a9b565b610858565b005b6102806102f93660046128d4565b6000908152600160208190526040909120015490565b6102807f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84881565b6102e9610344366004612b33565b6108b0565b6102e9610357366004612b87565b6108ec565b6102e961036a366004612c30565b610970565b6102e961037d366004612c30565b61099c565b6102e9610a1a565b61039d610398366004612c5c565b610a6a565b60405161028a9190612d56565b6102a66103b83660046128d4565b610b93565b6102e96103cb366004612d79565b610b9e565b6102e96103de366004612a9b565b610c36565b6102e96103f1366004612d9c565b610cad565b60005460ff166102a6565b600b546001600160a01b03165b6040516001600160a01b03909116815260200161028a565b6102e9610434366004612b33565b610ced565b610280610447366004612dd0565b6001600160a01b031660009081526006602052604090205490565b6102e9610d3f565b6102e9610478366004612deb565b610d8d565b6102e961048b366004612b33565b610dcb565b61040e61049e366004612e27565b610e42565b6102e96104b1366004612e5a565b610e61565b6102a66104c4366004612c30565b610e8a565b610280600081565b6102e96104df366004612f0b565b610eb5565b61028060008051602061366e83398151915281565b61050c610507366004612877565b610ec0565b6040805193845260208401929092529082015260600161028a565b6102e9610535366004612a9b565b610f39565b6102806105483660046128d4565b6000908152600a602052604090205490565b6102e9610568366004612f35565b610fc5565b61028061057b3660046128d4565b611012565b6102807f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b6102e96105b5366004612c30565b611029565b6102e96105c8366004612d79565b600091825260076020526040909120805460ff1916911515919091179055565b61040e6105f63660046128d4565b6000908152600c60205260409020546001600160a01b031690565b6102807f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b6102a6610646366004612fb5565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205460ff1690565b6102a66106823660046128d4565b60009081526007602052604090205460ff1690565b61040e6106a5366004612fdf565b611050565b6102e96106b836600461305c565b61109b565b60006001600160a01b03831661072d5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a2061646472657373207a65726f206973206e6f742061207660448201526930b634b21037bbb732b960b11b60648201526084015b60405180910390fd5b5060008181526003602090815260408083206001600160a01b03861684529091529020545b92915050565b60006107528261114d565b600081815260096020526040812080546060929190610781906130c0565b80601f01602080910402602001604051908101604052809291908181526020018280546107ad906130c0565b80156107fa5780601f106107cf576101008083540402835291602001916107fa565b820191906000526020600020905b8154815290600101906020018083116107dd57829003601f168201915b505050505090506000815111156108365760088160405160200161081f929190613110565b604051602081830303815290604052915050919050565b600861084184611172565b60405160200161081f929190613110565b50919050565b6108827f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a633610e8a565b61089e5760405162461bcd60e51b8152600401610724906131ad565b6108aa8484848461127a565b50505050565b6108b9846113d5565b6108d55760405162461bcd60e51b8152600401610724906131ef565b6108e1848484846113f3565b6108aa8484846114f7565b6108f5856113d5565b61095c5760405162461bcd60e51b815260206004820152603260248201527f455243313135353a207472616e736665722063616c6c6572206973206e6f74206044820152711bdddb995c881b9bdc88185c1c1c9bdd995960721b6064820152608401610724565b61096985858585856115f3565b5050505050565b6000828152600160208190526040909120015461098d8133611657565b61099783836116bb565b505050565b6001600160a01b0381163314610a0c5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610724565b610a1682826116dd565b5050565b610a447f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a33610e8a565b610a605760405162461bcd60e51b8152600401610724906131ad565b610a686116ff565b565b60608151835114610acf5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e677468604482015268040dad2e6dac2e8c6d60bb1b6064820152608401610724565b600083516001600160401b03811115610aea57610aea612958565b604051908082528060200260200182016040528015610b13578160200160208202803683370190505b50905060005b8451811015610b8b57610b5e858281518110610b3757610b37613238565b6020026020010151858381518110610b5157610b51613238565b60200260200101516106bd565b828281518110610b7057610b70613238565b6020908102919091010152610b8481613264565b9050610b19565b509392505050565b600061075282611792565b610bb660008051602061366e83398151915233610e8a565b610c185760405162461bcd60e51b815260206004820152602d60248201527f455243313135354f66667365747461626c653a2073656e64657220646f65732060448201526c6e6f74206861766520726f6c6560981b6064820152608401610724565b6000828152600760205260409020805460ff19168215151790555050565b610c607f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84833610e8a565b610c7c5760405162461bcd60e51b8152600401610724906131ad565b610c85846113d5565b610ca15760405162461bcd60e51b8152600401610724906131ef565b6108aa848484846117b8565b610cc560008051602061366e83398151915233610e8a565b610ce15760405162461bcd60e51b8152600401610724906131ad565b610cea81611935565b50565b610d177f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a633610e8a565b610d335760405162461bcd60e51b8152600401610724906131ad565b6108aa84848484611948565b610d697f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a33610e8a565b610d855760405162461bcd60e51b8152600401610724906131ad565b610a68611a33565b610da560008051602061366e83398151915233610e8a565b610dc15760405162461bcd60e51b8152600401610724906131ad565b610a168282611aae565b610df57f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84833610e8a565b610e115760405162461bcd60e51b8152600401610724906131ad565b610e1a846113d5565b610e365760405162461bcd60e51b8152600401610724906131ef565b6108aa848484846113f3565b6000828152600260205260408120610e5a9083611b0a565b9392505050565b610e6d86868686611050565b50610e788682610b9e565b610e828683610d8d565b505050505050565b60009182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b610a16338383611b16565b6001600160a01b038216600090815260056020526040812080548291829182919086908110610ef157610ef1613238565b60009182526020918290206040805160608101825260039390930290910180548084526001820154948401859052600290910154929091018290529891975095509350505050565b610f42846113d5565b610f5e5760405162461bcd60e51b8152600401610724906131ef565b610f6a848484846117b8565b60005b835181101561096957610fb385858381518110610f8c57610f8c613238565b6020026020010151858481518110610fa657610fa6613238565b60200260200101516114f7565b80610fbd81613264565b915050610f6d565b6000838152600c60205260409020546001600160a01b0316336001600160a01b0316146110045760405162461bcd60e51b81526004016107249061327d565b610e82868686868686611bf6565b600081815260026020526040812061075290611c38565b600082815260016020819052604090912001546110468133611657565b61099783836116dd565b600061106a60008051602061366e83398151915233610e8a565b6110865760405162461bcd60e51b81526004016107249061327d565b61109285858585611c42565b95945050505050565b6110a4856113d5565b6110c05760405162461bcd60e51b8152600401610724906131ef565b6109698585858585611d20565b6110d78282610e8a565b610a165760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b6000610e5a836001600160a01b038416611d63565b60006001600160e01b031982166303a24d0760e21b1480610752575061075282611db2565b6060816000036111995750506040805180820190915260018152600360fc1b602082015290565b8160005b81156111c357806111ad81613264565b91506111bc9050600a836132db565b915061119d565b6000816001600160401b038111156111dd576111dd612958565b6040519080825280601f01601f191660200182016040528015611207576020820181803683370190505b5090505b84156112725761121c6001836132ef565b9150611229600a86613306565b61123490603061331a565b60f81b81838151811061124957611249613238565b60200101906001600160f81b031916908160001a90535061126b600a866132db565b945061120b565b949350505050565b6001600160a01b0384166112a05760405162461bcd60e51b815260040161072490613332565b81518351146112c15760405162461bcd60e51b815260040161072490613373565b336112d181600087878787611dbd565b60005b845181101561136d578381815181106112ef576112ef613238565b60200260200101516003600087848151811061130d5761130d613238565b602002602001015181526020019081526020016000206000886001600160a01b03166001600160a01b031681526020019081526020016000206000828254611355919061331a565b9091555081905061136581613264565b9150506112d4565b50846001600160a01b031660006001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb87876040516113be9291906133bb565b60405180910390a461096981600087878787611dcb565b60006001600160a01b03821633148061075257506107528233610646565b6001600160a01b0384166114195760405162461bcd60e51b8152600401610724906133e0565b33600061142585611ec8565b9050600061143285611ec8565b905061144383886000858589611dbd565b60008681526003602090815260408083206001600160a01b038b168452909152902054858110156114865760405162461bcd60e51b815260040161072490613423565b60008781526003602090815260408083206001600160a01b038c81168086529184528285208b8703905582518c81529384018b90529092908816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a45b5050505050505050565b60008281526007602052604090205460ff1661156a5760405162461bcd60e51b815260206004820152602c60248201527f455243313135354f66667365747461626c653a20746f6b656e206973206e6f7460448201526b206f66667365747461626c6560a01b6064820152608401610724565b6001600160a01b038316600090815260066020526040812080549161158e83613264565b90915550506001600160a01b039092166000908152600560209081526040808320815160608101835294855284830195865242918501918252805460018181018355918552929093209351600390920290930190815592519083015551600290910155565b81518351146116145760405162461bcd60e51b815260040161072490613373565b6001600160a01b03841661163a5760405162461bcd60e51b815260040161072490613467565b33611649818787878787611f13565b610e82818787878787611dcb565b6116618282610e8a565b610a1657611679816001600160a01b03166014611fd8565b611684836020611fd8565b6040516020016116959291906134ac565b60408051601f198184030181529082905262461bcd60e51b825261072491600401612945565b6116c582826110cd565b60008281526002602052604090206109979082611138565b6116e78282612173565b600082815260026020526040902061099790826121da565b60005460ff166117485760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610724565b6000805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600081815260096020526040812080548291906117ae906130c0565b9050119050919050565b6001600160a01b0384166117de5760405162461bcd60e51b8152600401610724906133e0565b81518351146117ff5760405162461bcd60e51b815260040161072490613373565b3361180f81866000878787611dbd565b60005b84518110156118d757600085828151811061182f5761182f613238565b60200260200101519050600085838151811061184d5761184d613238565b60209081029190910181015160008481526003835260408082206001600160a01b038d16835290935291909120549091508181101561189e5760405162461bcd60e51b815260040161072490613423565b60009283526003602090815260408085206001600160a01b038c16865290915290922091039055806118cf81613264565b915050611812565b5060006001600160a01b0316856001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb87876040516119289291906133bb565b60405180910390a4610969565b8051610a169060089060208401906127c7565b6001600160a01b03841661196e5760405162461bcd60e51b815260040161072490613332565b33600061197a85611ec8565b9050600061198785611ec8565b905061199883600089858589611dbd565b60008681526003602090815260408083206001600160a01b038b168452909152812080548792906119ca90849061331a565b909155505060408051878152602081018790526001600160a01b03808a1692600092918716917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4611a2a836000898989896121ef565b50505050505050565b60005460ff1615611a795760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610724565b6000805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586117753390565b60008281526009602090815260409091208251611acd928401906127c7565b50817f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b82604051611afe9190612945565b60405180910390a25050565b6000610e5a8383612236565b816001600160a01b0316836001600160a01b031603611b895760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c20737461747573604482015268103337b91039b2b63360b91b6064820152608401610724565b6001600160a01b03838116600081815260046020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b038416611c1c5760405162461bcd60e51b815260040161072490613467565b611c2a868686868686612260565b610e828686868686866121ef565b6000610752825490565b600b546000908190611c5c906001600160a01b03166122f9565b6040516315194a9f60e01b81529091506001600160a01b038216906315194a9f90611c91908990899089908990600401613521565b600060405180830381600087803b158015611cab57600080fd5b505af1158015611cbf573d6000803e3d6000fd5b5050506000878152600c602052604080822080546001600160a01b0319166001600160a01b038616908117909155905190925088917f61c2c9c06042f8bc363b6e5a8f27423430ca63f44ecb4a7e79df6737352ea8c291a395945050505050565b6001600160a01b038416611d465760405162461bcd60e51b815260040161072490613467565b33611d55818787878787612260565b610e828187878787876121ef565b6000818152600183016020526040812054611daa57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610752565b506000610752565b600061075282612396565b610e828686868686866123bb565b6001600160a01b0384163b15610e825760405163bc197c8160e01b81526000906001600160a01b0386169063bc197c8190611e12908a908a90899089908990600401613561565b6020604051808303816000875af1158015611e31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e5591906135bf565b90506001600160e01b0319811663f23a6e6160e01b14611a2a5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a656374656044820152676420746f6b656e7360c01b6064820152608401610724565b60408051600180825281830190925260609160009190602080830190803683370190505090508281600081518110611f0257611f02613238565b602090810291909101015292915050565b611f21868686868686611dbd565b60005b8351811015611f7b57611f6b8686868481518110611f4457611f44613238565b6020026020010151868581518110611f5e57611f5e613238565b6020026020010151612541565b611f7481613264565b9050611f24565b50836001600160a01b0316856001600160a01b0316876001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8686604051611fcb9291906133bb565b60405180910390a4610e82565b60606000611fe78360026135dc565b611ff290600261331a565b6001600160401b0381111561200957612009612958565b6040519080825280601f01601f191660200182016040528015612033576020820181803683370190505b509050600360fc1b8160008151811061204e5761204e613238565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061207d5761207d613238565b60200101906001600160f81b031916908160001a90535060006120a18460026135dc565b6120ac90600161331a565b90505b6001811115612124576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106120e0576120e0613238565b1a60f81b8282815181106120f6576120f6613238565b60200101906001600160f81b031916908160001a90535060049490941c9361211d816135fb565b90506120af565b508315610e5a5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610724565b61217d8282610e8a565b15610a165760008281526001602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000610e5a836001600160a01b038416612612565b6001600160a01b0384163b15610e825760405163f23a6e6160e01b81526000906001600160a01b0386169063f23a6e6190611e12908a908a90899089908990600401613612565b600082600001828154811061224d5761224d613238565b9060005260206000200154905092915050565b600061226b84611ec8565b9050600061227884611ec8565b9050612288888888858588611dbd565b61229487878787612541565b856001600160a01b0316876001600160a01b0316896001600160a01b03167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6288886040516122ec929190918252602082015260400190565b60405180910390a46114ed565b6000604051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b81528260601b60148201526e5af43d82803e903d91602b57fd5bf360881b60288201526037816000f09150506001600160a01b0381166123915760405162461bcd60e51b8152602060048201526016602482015275115490cc4c4d8dce8818dc99585d194819985a5b195960521b6044820152606401610724565b919050565b60006001600160e01b03198216636cdb3d1360e11b1480610752575061075282612705565b6123c986868686868661272a565b6001600160a01b0385166124505760005b835181101561244e578281815181106123f5576123f5613238565b6020026020010151600a600086848151811061241357612413613238565b602002602001015181526020019081526020016000206000828254612438919061331a565b90915550612447905081613264565b90506123da565b505b6001600160a01b038416610e825760005b8351811015611a2a57600084828151811061247e5761247e613238565b60200260200101519050600084838151811061249c5761249c613238565b6020026020010151905080600a600084815260200190815260200160002054101561251a5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a206275726e20616d6f756e74206578636565647320746f74604482015267616c537570706c7960c01b6064820152608401610724565b6000918252600a6020526040909120805491909103905561253a81613264565b9050612461565b60008281526003602090815260408083206001600160a01b0388168452909152902054818110156125c75760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b6064820152608401610724565b60008381526003602090815260408083206001600160a01b0389811685529252808320858503905590861682528120805484929061260690849061331a565b90915550505050505050565b600081815260018301602052604081205480156126fb5760006126366001836132ef565b855490915060009061264a906001906132ef565b90508181146126af57600086600001828154811061266a5761266a613238565b906000526020600020015490508087600001848154811061268d5761268d613238565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806126c0576126c0613657565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610752565b6000915050610752565b60006001600160e01b03198216635a05180f60e01b1480610752575061075282612792565b60005460ff1615610e825760405162461bcd60e51b815260206004820152602c60248201527f455243313135355061757361626c653a20746f6b656e207472616e736665722060448201526b1dda1a5b19481c185d5cd95960a21b6064820152608401610724565b60006001600160e01b03198216637965db0b60e01b148061075257506301ffc9a760e01b6001600160e01b0319831614610752565b8280546127d3906130c0565b90600052602060002090601f0160209004810192826127f5576000855561283b565b82601f1061280e57805160ff191683800117855561283b565b8280016001018555821561283b579182015b8281111561283b578251825591602001919060010190612820565b5061284792915061284b565b5090565b5b80821115612847576000815560010161284c565b80356001600160a01b038116811461239157600080fd5b6000806040838503121561288a57600080fd5b61289383612860565b946020939093013593505050565b6001600160e01b031981168114610cea57600080fd5b6000602082840312156128c957600080fd5b8135610e5a816128a1565b6000602082840312156128e657600080fd5b5035919050565b60005b838110156129085781810151838201526020016128f0565b838111156108aa5750506000910152565b600081518084526129318160208601602086016128ed565b601f01601f19169290920160200192915050565b602081526000610e5a6020830184612919565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561299657612996612958565b604052919050565b60006001600160401b038211156129b7576129b7612958565b5060051b60200190565b600082601f8301126129d257600080fd5b813560206129e76129e28361299e565b61296e565b82815260059290921b84018101918181019086841115612a0657600080fd5b8286015b84811015612a215780358352918301918301612a0a565b509695505050505050565b600082601f830112612a3d57600080fd5b81356001600160401b03811115612a5657612a56612958565b612a69601f8201601f191660200161296e565b818152846020838601011115612a7e57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215612ab157600080fd5b612aba85612860565b935060208501356001600160401b0380821115612ad657600080fd5b612ae2888389016129c1565b94506040870135915080821115612af857600080fd5b612b04888389016129c1565b93506060870135915080821115612b1a57600080fd5b50612b2787828801612a2c565b91505092959194509250565b60008060008060808587031215612b4957600080fd5b612b5285612860565b9350602085013592506040850135915060608501356001600160401b03811115612b7b57600080fd5b612b2787828801612a2c565b600080600080600060a08688031215612b9f57600080fd5b612ba886612860565b9450612bb660208701612860565b935060408601356001600160401b0380821115612bd257600080fd5b612bde89838a016129c1565b94506060880135915080821115612bf457600080fd5b612c0089838a016129c1565b93506080880135915080821115612c1657600080fd5b50612c2388828901612a2c565b9150509295509295909350565b60008060408385031215612c4357600080fd5b82359150612c5360208401612860565b90509250929050565b60008060408385031215612c6f57600080fd5b82356001600160401b0380821115612c8657600080fd5b818501915085601f830112612c9a57600080fd5b81356020612caa6129e28361299e565b82815260059290921b84018101918181019089841115612cc957600080fd5b948201945b83861015612cee57612cdf86612860565b82529482019490820190612cce565b96505086013592505080821115612d0457600080fd5b50612d11858286016129c1565b9150509250929050565b600081518084526020808501945080840160005b83811015612d4b57815187529582019590820190600101612d2f565b509495945050505050565b602081526000610e5a6020830184612d1b565b8035801515811461239157600080fd5b60008060408385031215612d8c57600080fd5b82359150612c5360208401612d69565b600060208284031215612dae57600080fd5b81356001600160401b03811115612dc457600080fd5b61127284828501612a2c565b600060208284031215612de257600080fd5b610e5a82612860565b60008060408385031215612dfe57600080fd5b8235915060208301356001600160401b03811115612e1b57600080fd5b612d1185828601612a2c565b60008060408385031215612e3a57600080fd5b50508035926020909101359150565b803560ff8116811461239157600080fd5b60008060008060008060c08789031215612e7357600080fd5b8635955060208701356001600160401b0380821115612e9157600080fd5b612e9d8a838b01612a2c565b96506040890135915080821115612eb357600080fd5b612ebf8a838b01612a2c565b9550612ecd60608a01612e49565b94506080890135915080821115612ee357600080fd5b50612ef089828a01612a2c565b925050612eff60a08801612d69565b90509295509295509295565b60008060408385031215612f1e57600080fd5b612f2783612860565b9150612c5360208401612d69565b60008060008060008060c08789031215612f4e57600080fd5b612f5787612860565b9550612f6560208801612860565b9450612f7360408801612860565b9350606087013592506080870135915060a08701356001600160401b03811115612f9c57600080fd5b612fa889828a01612a2c565b9150509295509295509295565b60008060408385031215612fc857600080fd5b612fd183612860565b9150612c5360208401612860565b60008060008060808587031215612ff557600080fd5b8435935060208501356001600160401b038082111561301357600080fd5b61301f88838901612a2c565b9450604087013591508082111561303557600080fd5b5061304287828801612a2c565b92505061305160608601612e49565b905092959194509250565b600080600080600060a0868803121561307457600080fd5b61307d86612860565b945061308b60208701612860565b9350604086013592506060860135915060808601356001600160401b038111156130b457600080fd5b612c2388828901612a2c565b600181811c908216806130d457607f821691505b60208210810361085257634e487b7160e01b600052602260045260246000fd5b600081516131068185602086016128ed565b9290920192915050565b600080845481600182811c91508083168061312c57607f831692505b6020808410820361314b57634e487b7160e01b86526022600452602486fd5b81801561315f57600181146131705761319d565b60ff1986168952848901965061319d565b60008b81526020902060005b868110156131955781548b82015290850190830161317c565b505084890196505b50505050505061109281856130f4565b60208082526022908201527f455243313135353a2073656e64657220646f6573206e6f74206861766520726f6040820152616c6560f01b606082015260800190565b60208082526029908201527f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260408201526808185c1c1c9bdd995960ba1b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016132765761327661324e565b5060010190565b60208082526028908201527f455243313135353a2063616c6c6572206973206e6f742074686520746f6b656e6040820152671030b230b83a32b960c11b606082015260800190565b634e487b7160e01b600052601260045260246000fd5b6000826132ea576132ea6132c5565b500490565b6000828210156133015761330161324e565b500390565b600082613315576133156132c5565b500690565b6000821982111561332d5761332d61324e565b500190565b60208082526021908201527f455243313135353a206d696e7420746f20746865207a65726f206164647265736040820152607360f81b606082015260800190565b60208082526028908201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206040820152670dad2e6dac2e8c6d60c31b606082015260800190565b6040815260006133ce6040830185612d1b565b82810360208401526110928185612d1b565b60208082526023908201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526024908201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c604082015263616e636560e01b606082015260800190565b60208082526025908201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604082015264647265737360d81b606082015260800190565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516134e48160178501602088016128ed565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516135158160288401602088016128ed565b01602801949350505050565b84815260806020820152600061353a6080830186612919565b828103604084015261354c8186612919565b91505060ff8316606083015295945050505050565b6001600160a01b0386811682528516602082015260a06040820181905260009061358d90830186612d1b565b828103606084015261359f8186612d1b565b905082810360808401526135b38185612919565b98975050505050505050565b6000602082840312156135d157600080fd5b8151610e5a816128a1565b60008160001904831182151516156135f6576135f661324e565b500290565b60008161360a5761360a61324e565b506000190190565b6001600160a01b03868116825285166020820152604081018490526060810183905260a06080820181905260009061364c90830184612919565b979650505050505050565b634e487b7160e01b600052603160045260246000fdfe21d1167972f621f75904fb065136bc8b53c7ba1c60ccd3a7758fbee465851e9ca2646970667358221220768458c71a6db4617ef203a009d30f066ed985bd88c0ba16cf61b95b7c9a044364736f6c634300080d003321d1167972f621f75904fb065136bc8b53c7ba1c60ccd3a7758fbee465851e9c00000000000000000000000000000000000000000000000000000000000000400000000000000000000000008790fe0090ad3eab6c57a227e649b4fc7d2524200000000000000000000000000000000000000000000000000000000000000007697066733a2f2f00000000000000000000000000000000000000000000000000
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000000400000000000000000000000008790fe0090ad3eab6c57a227e649b4fc7d2524200000000000000000000000000000000000000000000000000000000000000007697066733a2f2f00000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : uri_ (string): ipfs://
Arg [1] : template_ (address): 0x8790fe0090ad3eab6c57a227e649b4fc7d252420
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [1] : 0000000000000000000000008790fe0090ad3eab6c57a227e649b4fc7d252420
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000007
Arg [3] : 697066733a2f2f00000000000000000000000000000000000000000000000000
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|