Token
Overview ERC-1155
Total Supply:
0 N/A
Holders:
257 addresses
Transfers:
-
Contract:
[ Download CSV Export ]
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Source Code Verified (Exact Match)
Contract Name:
REVVMotorsportVouchers
Compiler Version
v0.8.17+commit.8df45f5f
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; import {AccessControlBase} from "./base/AccessControlBase.sol"; import {ContractOwnership} from "./ContractOwnership.sol"; /// @title Access control via roles management (immutable version). /// @dev This contract is to be used via inheritance in an immutable (non-proxied) implementation. abstract contract AccessControl is AccessControlBase, ContractOwnership { }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; import {ContractOwnershipStorage} from "./libraries/ContractOwnershipStorage.sol"; import {ContractOwnershipBase} from "./base/ContractOwnershipBase.sol"; import {InterfaceDetection} from "./../introspection/InterfaceDetection.sol"; /// @title ERC173 Contract Ownership Standard (immutable version). /// @dev See https://eips.ethereum.org/EIPS/eip-173 /// @dev This contract is to be used via inheritance in an immutable (non-proxied) implementation. abstract contract ContractOwnership is ContractOwnershipBase, InterfaceDetection { using ContractOwnershipStorage for ContractOwnershipStorage.Layout; /// @notice Initializes the storage with an initial contract owner. /// @notice Marks the following ERC165 interface(s) as supported: ERC173. /// @dev Emits an {OwnershipTransferred} if `initialOwner` is not the zero address. /// @param initialOwner the initial contract owner. constructor(address initialOwner) { ContractOwnershipStorage.layout().constructorInit(initialOwner); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; import {AccessControlStorage} from "./../libraries/AccessControlStorage.sol"; import {ContractOwnershipStorage} from "./../libraries/ContractOwnershipStorage.sol"; import {Context} from "@openzeppelin/contracts/utils/Context.sol"; /// @title Access control via roles management (proxiable version). /// @dev This contract is to be used via inheritance in a proxied implementation. /// @dev Note: This contract requires ERC173 (Contract Ownership standard). abstract contract AccessControlBase is Context { using AccessControlStorage for AccessControlStorage.Layout; using ContractOwnershipStorage for ContractOwnershipStorage.Layout; /// @notice Emitted when a role is granted. /// @param role the granted role. /// @param account the account granted with the role. /// @param operator the initiator of the grant. event RoleGranted(bytes32 role, address account, address operator); /// @notice Emitted when a role is revoked or renounced. /// @param role the revoked or renounced role. /// @param account the account losing the role. /// @param operator the initiator of the revocation, or identical to `account` for a renouncement. event RoleRevoked(bytes32 role, address account, address operator); /// @notice Grants a role to an account. /// @dev Reverts if the sender is not the contract owner. /// @dev Emits a {RoleGranted} event if the account did not previously have the role. /// @param role The role to grant. /// @param account The account to grant the role to. function grantRole(bytes32 role, address account) external { address operator = _msgSender(); ContractOwnershipStorage.layout().enforceIsContractOwner(operator); AccessControlStorage.layout().grantRole(role, account, operator); } /// @notice Revokes a role from an account. /// @dev Reverts if the sender is not the contract owner. /// @dev Emits a {RoleRevoked} event if the account previously had the role. /// @param role The role to revoke. /// @param account The account to revoke the role from. function revokeRole(bytes32 role, address account) external { address operator = _msgSender(); ContractOwnershipStorage.layout().enforceIsContractOwner(operator); AccessControlStorage.layout().revokeRole(role, account, operator); } /// @notice Renounces a role by the sender. /// @dev Reverts if the sender does not have `role`. /// @dev Emits a {RoleRevoked} event. /// @param role The role to renounce. function renounceRole(bytes32 role) external { AccessControlStorage.layout().renounceRole(_msgSender(), role); } /// @notice Retrieves whether an account has a role. /// @param role The role. /// @param account The account. /// @return whether `account` has `role`. function hasRole(bytes32 role, address account) external view returns (bool) { return AccessControlStorage.layout().hasRole(role, account); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; import {IERC173} from "./../interfaces/IERC173.sol"; import {ContractOwnershipStorage} from "./../libraries/ContractOwnershipStorage.sol"; import {Context} from "@openzeppelin/contracts/utils/Context.sol"; /// @title ERC173 Contract Ownership Standard (proxiable version). /// @dev See https://eips.ethereum.org/EIPS/eip-173 /// @dev This contract is to be used via inheritance in a proxied implementation. /// @dev Note: This contract requires ERC165 (Interface Detection Standard). abstract contract ContractOwnershipBase is Context, IERC173 { using ContractOwnershipStorage for ContractOwnershipStorage.Layout; /// @inheritdoc IERC173 function owner() public view virtual override returns (address) { return ContractOwnershipStorage.layout().owner(); } /// @inheritdoc IERC173 function transferOwnership(address newOwner) public virtual override { ContractOwnershipStorage.layout().transferOwnership(_msgSender(), newOwner); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; /// @title ERC-173 Contract Ownership Standard /// @dev See https://eips.ethereum.org/EIPS/eip-173 /// @dev Note: the ERC-165 identifier for this interface is 0x7f5828d0 interface IERC173 { /// @notice Emitted when the contract ownership changes. /// @param previousOwner the previous contract owner. /// @param newOwner the new contract owner. event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /// @notice Sets the address of the new contract owner. /// @dev Reverts if the sender is not the contract owner. /// @dev Emits an {OwnershipTransferred} event if `newOwner` is different from the current contract owner. /// @param newOwner The address of the new contract owner. Using the zero address means renouncing ownership. function transferOwnership(address newOwner) external; /// @notice Gets the address of the contract owner. /// @return contractOwner The address of the contract owner. function owner() external view returns (address contractOwner); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; import {Bytes32} from "./../../utils/libraries/Bytes32.sol"; library AccessControlStorage { using Bytes32 for bytes32; using AccessControlStorage for AccessControlStorage.Layout; struct Layout { mapping(bytes32 => mapping(address => bool)) roles; } bytes32 internal constant LAYOUT_STORAGE_SLOT = bytes32(uint256(keccak256("animoca.core.access.AccessControl.storage")) - 1); event RoleGranted(bytes32 role, address account, address operator); event RoleRevoked(bytes32 role, address account, address operator); /// @notice Grants a role to an account. /// @dev Note: Call to this function should be properly access controlled. /// @dev Emits a {RoleGranted} event if the account did not previously have the role. /// @param role The role to grant. /// @param account The account to grant the role to. /// @param operator The account requesting the role change. function grantRole(Layout storage s, bytes32 role, address account, address operator) internal { if (!s.hasRole(role, account)) { s.roles[role][account] = true; emit RoleGranted(role, account, operator); } } /// @notice Revokes a role from an account. /// @dev Note: Call to this function should be properly access controlled. /// @dev Emits a {RoleRevoked} event if the account previously had the role. /// @param role The role to revoke. /// @param account The account to revoke the role from. /// @param operator The account requesting the role change. function revokeRole(Layout storage s, bytes32 role, address account, address operator) internal { if (s.hasRole(role, account)) { s.roles[role][account] = false; emit RoleRevoked(role, account, operator); } } /// @notice Renounces a role by the sender. /// @dev Reverts if `sender` does not have `role`. /// @dev Emits a {RoleRevoked} event. /// @param sender The message sender. /// @param role The role to renounce. function renounceRole(Layout storage s, address sender, bytes32 role) internal { s.enforceHasRole(role, sender); s.roles[role][sender] = false; emit RoleRevoked(role, sender, sender); } /// @notice Retrieves whether an account has a role. /// @param role The role. /// @param account The account. /// @return whether `account` has `role`. function hasRole(Layout storage s, bytes32 role, address account) internal view returns (bool) { return s.roles[role][account]; } /// @notice Ensures that an account has a role. /// @dev Reverts if `account` does not have `role`. /// @param role The role. /// @param account The account. function enforceHasRole(Layout storage s, bytes32 role, address account) internal view { if (!s.hasRole(role, account)) { revert(string(abi.encodePacked("AccessControl: missing '", role.toASCIIString(), "' role"))); } } function layout() internal pure returns (Layout storage s) { bytes32 position = LAYOUT_STORAGE_SLOT; assembly { s.slot := position } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; import {IERC173} from "./../interfaces/IERC173.sol"; import {ProxyInitialization} from "./../../proxy/libraries/ProxyInitialization.sol"; import {InterfaceDetectionStorage} from "./../../introspection/libraries/InterfaceDetectionStorage.sol"; library ContractOwnershipStorage { using ContractOwnershipStorage for ContractOwnershipStorage.Layout; using InterfaceDetectionStorage for InterfaceDetectionStorage.Layout; struct Layout { address contractOwner; } bytes32 internal constant LAYOUT_STORAGE_SLOT = bytes32(uint256(keccak256("animoca.core.access.ContractOwnership.storage")) - 1); bytes32 internal constant PROXY_INIT_PHASE_SLOT = bytes32(uint256(keccak256("animoca.core.access.ContractOwnership.phase")) - 1); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /// @notice Initializes the storage with an initial contract owner (immutable version). /// @notice Marks the following ERC165 interface(s) as supported: ERC173. /// @dev Note: This function should be called ONLY in the constructor of an immutable (non-proxied) contract. /// @dev Emits an {OwnershipTransferred} if `initialOwner` is not the zero address. /// @param initialOwner The initial contract owner. function constructorInit(Layout storage s, address initialOwner) internal { if (initialOwner != address(0)) { s.contractOwner = initialOwner; emit OwnershipTransferred(address(0), initialOwner); } InterfaceDetectionStorage.layout().setSupportedInterface(type(IERC173).interfaceId, true); } /// @notice Initializes the storage with an initial contract owner (proxied version). /// @notice Sets the proxy initialization phase to `1`. /// @notice Marks the following ERC165 interface(s) as supported: ERC173. /// @dev Note: This function should be called ONLY in the init function of a proxied contract. /// @dev Reverts if the proxy initialization phase is set to `1` or above. /// @dev Emits an {OwnershipTransferred} if `initialOwner` is not the zero address. /// @param initialOwner The initial contract owner. function proxyInit(Layout storage s, address initialOwner) internal { ProxyInitialization.setPhase(PROXY_INIT_PHASE_SLOT, 1); s.constructorInit(initialOwner); } /// @notice Sets the address of the new contract owner. /// @dev Reverts if `sender` is not the contract owner. /// @dev Emits an {OwnershipTransferred} event if `newOwner` is different from the current contract owner. /// @param newOwner The address of the new contract owner. Using the zero address means renouncing ownership. function transferOwnership(Layout storage s, address sender, address newOwner) internal { address previousOwner = s.contractOwner; require(sender == previousOwner, "Ownership: not the owner"); if (previousOwner != newOwner) { s.contractOwner = newOwner; emit OwnershipTransferred(previousOwner, newOwner); } } /// @notice Gets the address of the contract owner. /// @return contractOwner The address of the contract owner. function owner(Layout storage s) internal view returns (address contractOwner) { return s.contractOwner; } /// @notice Ensures that an account is the contract owner. /// @dev Reverts if `account` is not the contract owner. /// @param account The account. function enforceIsContractOwner(Layout storage s, address account) internal view { require(account == s.contractOwner, "Ownership: not the owner"); } function layout() internal pure returns (Layout storage s) { bytes32 position = LAYOUT_STORAGE_SLOT; assembly { s.slot := position } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; import {IERC165} from "./interfaces/IERC165.sol"; import {InterfaceDetectionStorage} from "./libraries/InterfaceDetectionStorage.sol"; /// @title ERC165 Interface Detection Standard (immutable or proxiable version). /// @dev This contract is to be used via inheritance in an immutable (non-proxied) or proxied implementation. abstract contract InterfaceDetection is IERC165 { using InterfaceDetectionStorage for InterfaceDetectionStorage.Layout; /// @inheritdoc IERC165 function supportsInterface(bytes4 interfaceId) external view override returns (bool) { return InterfaceDetectionStorage.layout().supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; /// @title ERC165 Interface Detection Standard. /// @dev See https://eips.ethereum.org/EIPS/eip-165. /// @dev Note: The ERC-165 identifier for this interface is 0x01ffc9a7. interface IERC165 { /// @notice Returns whether this contract implements a given interface. /// @dev Note: This function call must use less than 30 000 gas. /// @param interfaceId the interface identifier to test. /// @return supported True if the interface is supported, false if `interfaceId` is `0xffffffff` or if the interface is not supported. function supportsInterface(bytes4 interfaceId) external view returns (bool supported); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; import {IERC165} from "./../interfaces/IERC165.sol"; library InterfaceDetectionStorage { struct Layout { mapping(bytes4 => bool) supportedInterfaces; } bytes32 internal constant LAYOUT_STORAGE_SLOT = bytes32(uint256(keccak256("animoca.core.introspection.InterfaceDetection.storage")) - 1); bytes4 internal constant ILLEGAL_INTERFACE_ID = 0xffffffff; /// @notice Sets or unsets an ERC165 interface. /// @dev Reverts if `interfaceId` is `0xffffffff`. /// @param interfaceId the interface identifier. /// @param supported True to set the interface, false to unset it. function setSupportedInterface(Layout storage s, bytes4 interfaceId, bool supported) internal { require(interfaceId != ILLEGAL_INTERFACE_ID, "InterfaceDetection: wrong value"); s.supportedInterfaces[interfaceId] = supported; } /// @notice Returns whether this contract implements a given interface. /// @dev Note: This function call must use less than 30 000 gas. /// @param interfaceId The interface identifier to test. /// @return supported True if the interface is supported, false if `interfaceId` is `0xffffffff` or if the interface is not supported. function supportsInterface(Layout storage s, bytes4 interfaceId) internal view returns (bool supported) { if (interfaceId == ILLEGAL_INTERFACE_ID) { return false; } if (interfaceId == type(IERC165).interfaceId) { return true; } return s.supportedInterfaces[interfaceId]; } function layout() internal pure returns (Layout storage s) { bytes32 position = LAYOUT_STORAGE_SLOT; assembly { s.slot := position } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; import {IForwarderRegistry} from "./interfaces/IForwarderRegistry.sol"; import {IERC2771} from "./interfaces/IERC2771.sol"; import {ForwarderRegistryContextBase} from "./base/ForwarderRegistryContextBase.sol"; /// @title Meta-Transactions Forwarder Registry Context (immutable version). /// @dev This contract is to be used via inheritance in an immutable (non-proxied) implementation. /// @dev Derived from https://github.com/wighawag/universal-forwarder (MIT licence) abstract contract ForwarderRegistryContext is ForwarderRegistryContextBase, IERC2771 { constructor(IForwarderRegistry forwarderRegistry_) ForwarderRegistryContextBase(forwarderRegistry_) {} function forwarderRegistry() external view returns (IForwarderRegistry) { return _forwarderRegistry; } /// @inheritdoc IERC2771 function isTrustedForwarder(address forwarder) external view virtual override returns (bool) { return forwarder == address(_forwarderRegistry); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; import {IForwarderRegistry} from "./../interfaces/IForwarderRegistry.sol"; import {ERC2771Calldata} from "./../libraries/ERC2771Calldata.sol"; /// @title Meta-Transactions Forwarder Registry Context (proxiable version). /// @dev This contract is to be used via inheritance in a proxied implementation. /// @dev Derived from https://github.com/wighawag/universal-forwarder (MIT licence) abstract contract ForwarderRegistryContextBase { IForwarderRegistry internal immutable _forwarderRegistry; constructor(IForwarderRegistry forwarderRegistry) { _forwarderRegistry = forwarderRegistry; } /// @notice Returns the message sender depending on the ForwarderRegistry-based meta-transaction context. function _msgSender() internal view virtual returns (address) { // Optimised path in case of an EOA-initiated direct tx to the contract or a call from a contract not complying with EIP-2771 // solhint-disable-next-line avoid-tx-origin if (msg.sender == tx.origin || msg.data.length < 24) { return msg.sender; } address sender = ERC2771Calldata.msgSender(); // Return the EIP-2771 calldata-appended sender address if the message was forwarded by the ForwarderRegistry or an approved forwarder if (msg.sender == address(_forwarderRegistry) || _forwarderRegistry.isApprovedForwarder(sender, msg.sender)) { return sender; } return msg.sender; } /// @notice Returns the message data depending on the ForwarderRegistry-based meta-transaction context. function _msgData() internal view virtual returns (bytes calldata) { // Optimised path in case of an EOA-initiated direct tx to the contract or a call from a contract not complying with EIP-2771 // solhint-disable-next-line avoid-tx-origin if (msg.sender == tx.origin || msg.data.length < 24) { return msg.data; } // Return the EIP-2771 calldata (minus the appended sender) if the message was forwarded by the ForwarderRegistry or an approved forwarder if (msg.sender == address(_forwarderRegistry) || _forwarderRegistry.isApprovedForwarder(ERC2771Calldata.msgSender(), msg.sender)) { return ERC2771Calldata.msgData(); } return msg.data; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; /// @title Secure Protocol for Native Meta Transactions. /// @dev See https://eips.ethereum.org/EIPS/eip-2771 interface IERC2771 { /// @notice Checks whether a forwarder is trusted. /// @param forwarder The forwarder to check. /// @return isTrusted True if `forwarder` is trusted, false if not. function isTrustedForwarder(address forwarder) external view returns (bool isTrusted); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; /// @title Universal Meta-Transactions Forwarder Registry. /// @dev Derived from https://github.com/wighawag/universal-forwarder (MIT licence) interface IForwarderRegistry { /// @notice Checks whether an account is as an approved meta-transaction forwarder for a sender account. /// @param sender The sender account. /// @param forwarder The forwarder account. /// @return isApproved True if `forwarder` is an approved meta-transaction forwarder for `sender`, false otherwise. function isApprovedForwarder(address sender, address forwarder) external view returns (bool isApproved); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; /// @dev Derived from https://github.com/OpenZeppelin/openzeppelin-contracts (MIT licence) /// @dev See https://eips.ethereum.org/EIPS/eip-2771 library ERC2771Calldata { /// @notice Returns the sender address appended at the end of the calldata, as specified in EIP-2771. function msgSender() internal pure returns (address sender) { assembly { sender := shr(96, calldataload(sub(calldatasize(), 20))) } } /// @notice Returns the calldata while omitting the appended sender address, as specified in EIP-2771. function msgData() internal pure returns (bytes calldata data) { unchecked { return msg.data[:msg.data.length - 20]; } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; import {StorageSlot} from "@openzeppelin/contracts/utils/StorageSlot.sol"; /// @notice Multiple calls protection for storage-modifying proxy initialization functions. library ProxyInitialization { /// @notice Sets the initialization phase during a storage-modifying proxy initialization function. /// @dev Reverts if `phase` has been reached already. /// @param storageSlot the storage slot where `phase` is stored. /// @param phase the initialization phase. function setPhase(bytes32 storageSlot, uint256 phase) internal { StorageSlot.Uint256Slot storage currentVersion = StorageSlot.getUint256Slot(storageSlot); require(currentVersion.value < phase, "Storage: phase reached"); currentVersion.value = phase; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; import {TokenRecoveryBase} from "./base/TokenRecoveryBase.sol"; import {ContractOwnership} from "./../access/ContractOwnership.sol"; /// @title Recovery mechanism for ETH/ERC20/ERC721 tokens accidentally sent to this contract (immutable version). /// @dev This contract is to be used via inheritance in an immutable (non-proxied) implementation. abstract contract TokenRecovery is TokenRecoveryBase, ContractOwnership { }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; import {IERC20} from "@openzeppelin/contracts/interfaces/IERC20.sol"; import {IERC721} from "./../../token/ERC721/interfaces/IERC721.sol"; import {ContractOwnershipStorage} from "./../../access/libraries/ContractOwnershipStorage.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {Context} from "@openzeppelin/contracts/utils/Context.sol"; import {Address} from "@openzeppelin/contracts/utils/Address.sol"; /// @title Recovery mechanism for ETH/ERC20/ERC721 tokens accidentally sent to this contract (proxiable version). /// @dev This contract is to be used via inheritance in a proxied implementation. /// @dev Note: This contract requires ERC173 (Contract Ownership standard). contract TokenRecoveryBase is Context { using ContractOwnershipStorage for ContractOwnershipStorage.Layout; using SafeERC20 for IERC20; using Address for address payable; /// @notice Extract ETH tokens which were accidentally sent to the contract to a list of accounts. /// @dev Note: While contracts can generally prevent accidental ETH transfer by implementating a reverting /// `receive()` function, this can still be bypassed in a `selfdestruct(address)` scenario. /// @dev Warning: this function should be overriden for contracts which are supposed to hold ETH tokens /// so that the extraction is limited to only amounts sent accidentally. /// @dev Reverts if the sender is not the contract owner. /// @dev Reverts if `accounts` and `amounts` do not have the same length. /// @dev Reverts if one of the ETH transfers fails for any reason. /// @param accounts the list of accounts to transfer the tokens to. /// @param amounts the list of token amounts to transfer. function recoverETH(address payable[] calldata accounts, uint256[] calldata amounts) external virtual { ContractOwnershipStorage.layout().enforceIsContractOwner(_msgSender()); uint256 length = accounts.length; require(length == amounts.length, "Recovery: inconsistent arrays"); unchecked { for (uint256 i; i != length; ++i) { accounts[i].sendValue(amounts[i]); } } } /// @notice Extract ERC20 tokens which were accidentally sent to the contract to a list of accounts. /// @dev Warning: this function should be overriden for contracts which are supposed to hold ERC20 tokens /// so that the extraction is limited to only amounts sent accidentally. /// @dev Reverts if the sender is not the contract owner. /// @dev Reverts if `accounts`, `tokens` and `amounts` do not have the same length. /// @dev Reverts if one of the ERC20 transfers fails for any reason. /// @param accounts the list of accounts to transfer the tokens to. /// @param tokens the list of ERC20 token addresses. /// @param amounts the list of token amounts to transfer. function recoverERC20s(address[] calldata accounts, IERC20[] calldata tokens, uint256[] calldata amounts) external virtual { ContractOwnershipStorage.layout().enforceIsContractOwner(_msgSender()); uint256 length = accounts.length; require(length == tokens.length && length == amounts.length, "Recovery: inconsistent arrays"); unchecked { for (uint256 i; i != length; ++i) { tokens[i].safeTransfer(accounts[i], amounts[i]); } } } /// @notice Extract ERC721 tokens which were accidentally sent to the contract to a list of accounts. /// @dev Warning: this function should be overriden for contracts which are supposed to hold ERC721 tokens /// so that the extraction is limited to only tokens sent accidentally. /// @dev Reverts if the sender is not the contract owner. /// @dev Reverts if `accounts`, `contracts` and `amounts` do not have the same length. /// @dev Reverts if one of the ERC721 transfers fails for any reason. /// @param accounts the list of accounts to transfer the tokens to. /// @param contracts the list of ERC721 contract addresses. /// @param tokenIds the list of token ids to transfer. function recoverERC721s(address[] calldata accounts, IERC721[] calldata contracts, uint256[] calldata tokenIds) external virtual { ContractOwnershipStorage.layout().enforceIsContractOwner(_msgSender()); uint256 length = accounts.length; require(length == contracts.length && length == tokenIds.length, "Recovery: inconsistent arrays"); unchecked { for (uint256 i; i != length; ++i) { contracts[i].transferFrom(address(this), accounts[i], tokenIds[i]); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; import {ERC1155Storage} from "./libraries/ERC1155Storage.sol"; import {ERC1155BurnableBase} from "./base/ERC1155BurnableBase.sol"; /// @title ERC1155 Multi Token Standard, optional extension: Burnable (immutable version). /// @dev This contract is to be used via inheritance in an immutable (non-proxied) implementation. abstract contract ERC1155Burnable is ERC1155BurnableBase { /// @notice Marks the fllowing ERC165 interface(s) as supported: ERC1155Burnable constructor() { ERC1155Storage.initERC1155Burnable(); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; import {ERC1155Storage} from "./libraries/ERC1155Storage.sol"; import {ERC1155DeliverableBase} from "./base/ERC1155DeliverableBase.sol"; import {AccessControl} from "./../../access/AccessControl.sol"; /// @title ERC1155 Multi Token Standard, optional extension: Deliverable (immutable version). /// @dev This contract is to be used via inheritance in an immutable (non-proxied) implementation. abstract contract ERC1155Deliverable is ERC1155DeliverableBase, AccessControl { /// @notice Marks the fllowing ERC165 interface(s) as supported: ERC1155Deliverable constructor() { ERC1155Storage.initERC1155Deliverable(); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; import {ERC1155Storage} from "./libraries/ERC1155Storage.sol"; import {TokenMetadataWithBaseURIStorage} from "./../metadata/libraries/TokenMetadataWithBaseURIStorage.sol"; import {ERC1155MetadataURIWithBaseURIBase} from "./base/ERC1155MetadataURIWithBaseURIBase.sol"; import {ContractOwnership} from "./../../access/ContractOwnership.sol"; /// @title ERC1155 Multi Token Standard, optional extension: MetadataURIPerToken (immutable version). /// @notice ERC1155MetadataURI implementation where tokenURIs are the concatenation of a base metadata URI and the token identifier (decimal). /// @dev This contract is to be used via inheritance in an immutable (non-proxied) implementation. abstract contract ERC1155MetadataURIWithBaseURI is ERC1155MetadataURIWithBaseURIBase, ContractOwnership { using TokenMetadataWithBaseURIStorage for TokenMetadataWithBaseURIStorage.Layout; /// @notice Marks the fllowing ERC165 interface(s) as supported: ERC1155MetadataURI constructor() { ERC1155Storage.initERC1155MetadataURI(); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; import {ERC1155Storage} from "./libraries/ERC1155Storage.sol"; import {ERC1155MintableBase} from "./base/ERC1155MintableBase.sol"; import {AccessControl} from "./../../access/AccessControl.sol"; /// @title ERC1155 Multi Token Standard, optional extension: Mintable (immutable version). /// @dev This contract is to be used via inheritance in an immutable (non-proxied) implementation. abstract contract ERC1155Mintable is ERC1155MintableBase, AccessControl { /// @notice Marks the fllowing ERC165 interface(s) as supported: ERC1155Mintable constructor() { ERC1155Storage.initERC1155Mintable(); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; import {IOperatorFilterRegistry} from "./../royalty/interfaces/IOperatorFilterRegistry.sol"; import {ERC1155Storage} from "./libraries/ERC1155Storage.sol"; import {OperatorFiltererStorage} from "./../royalty/libraries/OperatorFiltererStorage.sol"; import {ERC1155WithOperatorFiltererBase} from "./base/ERC1155WithOperatorFiltererBase.sol"; import {OperatorFiltererBase} from "./../royalty/base/OperatorFiltererBase.sol"; import {ContractOwnership} from "./../../access/ContractOwnership.sol"; /// @title ERC1155 Multi Token Standard with Operator Filterer (immutable version). /// @dev This contract is to be used via inheritance in an immutable (non-proxied) implementation. abstract contract ERC1155WithOperatorFilterer is ERC1155WithOperatorFiltererBase, OperatorFiltererBase, ContractOwnership { using OperatorFiltererStorage for OperatorFiltererStorage.Layout; /// @notice Marks the following ERC165 interfaces as supported: ERC1155. /// @notice Sets the address that the contract will make OperatorFilter checks against. /// @param registry The operator filter registry address. When set to the zero address, checks will be bypassed. constructor(IOperatorFilterRegistry registry) { ERC1155Storage.init(); OperatorFiltererStorage.layout().constructorInit(registry); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; import {IERC1155Burnable} from "./../interfaces/IERC1155Burnable.sol"; import {ERC1155Storage} from "./../libraries/ERC1155Storage.sol"; import {Context} from "@openzeppelin/contracts/utils/Context.sol"; /// @title ERC1155 Multi Token Standard, optional extension: Burnable (proxiable version). /// @dev This contract is to be used via inheritance in a proxied implementation. /// @dev Note: This contract requires ERC1155 (Multi Token Standard). abstract contract ERC1155BurnableBase is Context, IERC1155Burnable { using ERC1155Storage for ERC1155Storage.Layout; /// @inheritdoc IERC1155Burnable function burnFrom(address from, uint256 id, uint256 value) external virtual override { ERC1155Storage.layout().burnFrom(_msgSender(), from, id, value); } /// @inheritdoc IERC1155Burnable function batchBurnFrom(address from, uint256[] calldata ids, uint256[] calldata values) external virtual override { ERC1155Storage.layout().batchBurnFrom(_msgSender(), from, ids, values); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; import {IERC1155Deliverable} from "./../interfaces/IERC1155Deliverable.sol"; import {ERC1155Storage} from "./../libraries/ERC1155Storage.sol"; import {AccessControlStorage} from "./../../../access/libraries/AccessControlStorage.sol"; import {Context} from "@openzeppelin/contracts/utils/Context.sol"; /// @title ERC1155 Multi Token Standard, optional extension: Deliverable (proxiable version). /// @dev This contract is to be used via inheritance in a proxied implementation. /// @dev Note: This contract requires ERC1155 (Multi Token Standard). /// @dev Note: This contract requires AccessControl. abstract contract ERC1155DeliverableBase is Context, IERC1155Deliverable { using ERC1155Storage for ERC1155Storage.Layout; using AccessControlStorage for AccessControlStorage.Layout; // prevent variable name clash with public ERC1155MintableBase.MINTER_ROLE bytes32 private constant _MINTER_ROLE = "minter"; /// @inheritdoc IERC1155Deliverable /// @dev Reverts if the sender does not have the 'minter' role. function safeDeliver( address[] calldata recipients, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external virtual override { address sender = _msgSender(); AccessControlStorage.layout().enforceHasRole(_MINTER_ROLE, sender); ERC1155Storage.layout().safeDeliver(sender, recipients, ids, values, data); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; import {IERC1155MetadataURI} from "./../interfaces/IERC1155MetadataURI.sol"; import {ERC1155Storage} from "./../libraries/ERC1155Storage.sol"; import {TokenMetadataWithBaseURIStorage} from "./../../metadata/libraries/TokenMetadataWithBaseURIStorage.sol"; import {ContractOwnershipStorage} from "./../../../access/libraries/ContractOwnershipStorage.sol"; import {Context} from "@openzeppelin/contracts/utils/Context.sol"; /// @title ERC1155 Multi Token Standard (proxiable version), optional extension: Metadata URI (proxiable version). /// @notice ERC1155MetadataURI implementation where tokenURIs are the concatenation of a base metadata URI and the token identifier (decimal). /// @dev This contract is to be used via inheritance in a proxied implementation. /// @dev Note: This contract requires ERC1155 (Multi Token Standard). /// @dev Note: This contract requires ERC173 (Contract Ownership standard). abstract contract ERC1155MetadataURIWithBaseURIBase is Context, IERC1155MetadataURI { using ERC1155Storage for ERC1155Storage.Layout; using TokenMetadataWithBaseURIStorage for TokenMetadataWithBaseURIStorage.Layout; using ContractOwnershipStorage for ContractOwnershipStorage.Layout; /// @notice Emitted when the base token metadata URI is updated. /// @param baseMetadataURI The new base metadata URI. event BaseMetadataURISet(string baseMetadataURI); /// @notice Sets the base metadata URI. /// @dev Reverts if the sender is not the contract owner. /// @dev Emits a {BaseMetadataURISet} event. /// @param baseURI The base metadata URI. function setBaseMetadataURI(string calldata baseURI) external { ContractOwnershipStorage.layout().enforceIsContractOwner(_msgSender()); TokenMetadataWithBaseURIStorage.layout().setBaseMetadataURI(baseURI); } /// @notice Gets the base metadata URI. /// @return baseURI The base metadata URI. function baseMetadataURI() external view returns (string memory baseURI) { return TokenMetadataWithBaseURIStorage.layout().baseMetadataURI(); } /// @inheritdoc IERC1155MetadataURI function uri(uint256 id) external view override returns (string memory metadataURI) { return TokenMetadataWithBaseURIStorage.layout().tokenMetadataURI(id); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; import {IERC1155Mintable} from "./../interfaces/IERC1155Mintable.sol"; import {ERC1155Storage} from "./../libraries/ERC1155Storage.sol"; import {AccessControlStorage} from "./../../../access/libraries/AccessControlStorage.sol"; import {Context} from "@openzeppelin/contracts/utils/Context.sol"; /// @title ERC1155 Multi Token Standard, optional extension: Mintable (proxiable version). /// @dev This contract is to be used via inheritance in a proxied implementation. /// @dev Note: This contract requires ERC1155 (Multi Token Standard). /// @dev Note: This contract requires AccessControl. abstract contract ERC1155MintableBase is Context, IERC1155Mintable { using ERC1155Storage for ERC1155Storage.Layout; using AccessControlStorage for AccessControlStorage.Layout; bytes32 public constant MINTER_ROLE = "minter"; /// @inheritdoc IERC1155Mintable /// @dev Reverts if the sender does not have the 'minter' role. function safeMint(address to, uint256 id, uint256 value, bytes calldata data) external virtual override { address sender = _msgSender(); AccessControlStorage.layout().enforceHasRole(MINTER_ROLE, sender); ERC1155Storage.layout().safeMint(sender, to, id, value, data); } /// @inheritdoc IERC1155Mintable /// @dev Reverts if the sender does not have the 'minter' role. function safeBatchMint(address to, uint256[] calldata ids, uint256[] calldata values, bytes calldata data) external virtual override { address sender = _msgSender(); AccessControlStorage.layout().enforceHasRole(MINTER_ROLE, sender); ERC1155Storage.layout().safeBatchMint(sender, to, ids, values, data); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; import {IERC1155} from "./../interfaces/IERC1155.sol"; import {ERC1155Storage} from "./../libraries/ERC1155Storage.sol"; import {OperatorFiltererStorage} from "./../../royalty/libraries/OperatorFiltererStorage.sol"; import {Context} from "@openzeppelin/contracts/utils/Context.sol"; /// @title ERC1155 Multi Token Standard with Operator Filterer (proxiable version). /// @dev This contract is to be used via inheritance in a proxied implementation. /// @dev Note: This contract requires ERC165 (Interface Detection Standard). abstract contract ERC1155WithOperatorFiltererBase is Context, IERC1155 { using ERC1155Storage for ERC1155Storage.Layout; using OperatorFiltererStorage for OperatorFiltererStorage.Layout; /// @inheritdoc IERC1155 /// @dev Reverts with OperatorNotAllowed if the sender is not `from` and is not allowed by the operator registry. function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external virtual override { address sender = _msgSender(); OperatorFiltererStorage.layout().requireAllowedOperatorForTransfer(sender, from); ERC1155Storage.layout().safeTransferFrom(sender, from, to, id, value, data); } /// @inheritdoc IERC1155 /// @dev Reverts with OperatorNotAllowed if the sender is not `from` and is not allowed by the operator registry. function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external virtual override { address sender = _msgSender(); OperatorFiltererStorage.layout().requireAllowedOperatorForTransfer(sender, from); ERC1155Storage.layout().safeBatchTransferFrom(sender, from, to, ids, values, data); } /// @inheritdoc IERC1155 /// @dev Reverts with OperatorNotAllowed if `operator` is not allowed by the operator registry. function setApprovalForAll(address operator, bool approved) external virtual override { if (approved) { OperatorFiltererStorage.layout().requireAllowedOperatorForApproval(operator); } ERC1155Storage.layout().setApprovalForAll(_msgSender(), operator, approved); } /// @inheritdoc IERC1155 function isApprovedForAll(address owner, address operator) external view override returns (bool approvedForAll) { return ERC1155Storage.layout().isApprovedForAll(owner, operator); } /// @inheritdoc IERC1155 function balanceOf(address owner, uint256 id) external view virtual override returns (uint256 balance) { return ERC1155Storage.layout().balanceOf(owner, id); } /// @inheritdoc IERC1155 function balanceOfBatch(address[] calldata owners, uint256[] calldata ids) external view virtual override returns (uint256[] memory balances) { return ERC1155Storage.layout().balanceOfBatch(owners, ids); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; /// @title ERC1155 Multi Token Standard, basic interface. /// @dev See https://eips.ethereum.org/EIPS/eip-1155 /// @dev Note: The ERC-165 identifier for this interface is 0xd9b67a26. interface IERC1155 { /// @notice Emitted when some token is transferred. /// @param operator The initiator of the transfer. /// @param from The previous token owner. /// @param to The new token owner. /// @param id The transferred token identifier. /// @param value The amount of token. event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /// @notice Emitted when a batch of tokens is transferred. /// @param operator The initiator of the transfer. /// @param from The previous tokens owner. /// @param to The new tokens owner. /// @param ids The transferred tokens identifiers. /// @param values The amounts of tokens. event TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values); /// @notice Emitted when an approval for all tokens is set or unset. /// @param owner The tokens owner. /// @param operator The approved address. /// @param approved True when then approval is set, false when it is unset. event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /// @notice Emitted optionally when a token metadata URI is set. /// @param value The token metadata URI. /// @param id The token identifier. event URI(string value, uint256 indexed id); /// @notice Safely transfers some token. /// @dev Reverts if `to` is the zero address. /// @dev Reverts if the sender is not `from` and has not been approved by `from`. /// @dev Reverts if `from` has an insufficient balance of `id`. /// @dev Reverts if `to` is a contract and the call to {IERC1155TokenReceiver-onERC1155Received} fails, reverts or is rejected. /// @dev Emits a {TransferSingle} event. /// @param from Current token owner. /// @param to Address of the new token owner. /// @param id Identifier of the token to transfer. /// @param value Amount of token to transfer. /// @param data Optional data to send along to a receiver contract. function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external; /// @notice Safely transfers a batch of tokens. /// @dev Reverts if `to` is the zero address. /// @dev Reverts if `ids` and `values` have different lengths. /// @dev Reverts if the sender is not `from` and has not been approved by `from`. /// @dev Reverts if `from` has an insufficient balance for any of `ids`. /// @dev Reverts if `to` is a contract and the call to {IERC1155TokenReceiver-onERC1155BatchReceived} fails, reverts or is rejected. /// @dev Emits a {TransferBatch} event. /// @param from Current tokens owner. /// @param to Address of the new tokens owner. /// @param ids Identifiers of the tokens to transfer. /// @param values Amounts of tokens to transfer. /// @param data Optional data to send along to a receiver contract. function safeBatchTransferFrom(address from, address to, uint256[] calldata ids, uint256[] calldata values, bytes calldata data) external; /// @notice Enables or disables an operator's approval. /// @dev Emits an {ApprovalForAll} event. /// @param operator Address of the operator. /// @param approved True to approve the operator, false to revoke its approval. function setApprovalForAll(address operator, bool approved) external; /// @notice Retrieves the approval status of an operator for a given owner. /// @param owner Address of the authorisation giver. /// @param operator Address of the operator. /// @return approved True if the operator is approved, false if not. function isApprovedForAll(address owner, address operator) external view returns (bool approved); /// @notice Retrieves the balance of `id` owned by account `owner`. /// @param owner The account to retrieve the balance of. /// @param id The identifier to retrieve the balance of. /// @return balance The balance of `id` owned by account `owner`. function balanceOf(address owner, uint256 id) external view returns (uint256 balance); /// @notice Retrieves the balances of `ids` owned by accounts `owners`. /// @dev Reverts if `owners` and `ids` have different lengths. /// @param owners The addresses of the token holders /// @param ids The identifiers to retrieve the balance of. /// @return balances The balances of `ids` owned by accounts `owners`. function balanceOfBatch(address[] calldata owners, uint256[] calldata ids) external view returns (uint256[] memory balances); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; /// @title ERC1155 Multi Token Standard, optional extension: Burnable. /// @dev See https://eips.ethereum.org/EIPS/eip-1155 /// @dev Note: The ERC-165 identifier for this interface is 0x921ed8d1. interface IERC1155Burnable { /// @notice Burns some token. /// @dev Reverts if the sender is not `from` and has not been approved by `from`. /// @dev Reverts if `from` has an insufficient balance of `id`. /// @dev Emits an {IERC1155-TransferSingle} event. /// @param from Address of the current token owner. /// @param id Identifier of the token to burn. /// @param value Amount of token to burn. function burnFrom(address from, uint256 id, uint256 value) external; /// @notice Burns multiple tokens. /// @dev Reverts if `ids` and `values` have different lengths. /// @dev Reverts if the sender is not `from` and has not been approved by `from`. /// @dev Reverts if `from` has an insufficient balance for any of `ids`. /// @dev Emits an {IERC1155-TransferBatch} event. /// @param from Address of the current tokens owner. /// @param ids Identifiers of the tokens to burn. /// @param values Amounts of tokens to burn. function batchBurnFrom(address from, uint256[] calldata ids, uint256[] calldata values) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; /// @title ERC1155 Multi Token Standard, optional extension: Deliverable. /// @dev See https://eips.ethereum.org/EIPS/eip-1155 /// @dev Note: The ERC-165 identifier for this interface is 0xe8ab9ccc. interface IERC1155Deliverable { /// @notice Safely mints tokens to multiple recipients. /// @dev Reverts if `recipients`, `ids` and `values` have different lengths. /// @dev Reverts if one of `recipients` is the zero address. /// @dev Reverts if one of `recipients` balance overflows. /// @dev Reverts if one of `recipients` is a contract and the call to {IERC1155TokenReceiver-onERC1155Received} fails, reverts or is rejected. /// @dev Emits an {IERC1155-TransferSingle} event from the zero address for each transfer. /// @param recipients Addresses of the new tokens owners. /// @param ids Identifiers of the tokens to mint. /// @param values Amounts of tokens to mint. /// @param data Optional data to send along to a receiver contract. function safeDeliver(address[] calldata recipients, uint256[] calldata ids, uint256[] calldata values, bytes calldata data) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; /// @title ERC1155 Multi Token Standard, optional extension: Metadata URI. /// @dev See https://eips.ethereum.org/EIPS/eip-1155 /// @dev Note: The ERC-165 identifier for this interface is 0x0e89341c. interface IERC1155MetadataURI { /// @notice Retrieves the URI for a given token. /// @dev URIs are defined in RFC 3986. /// @dev The URI MUST point to a JSON file that conforms to the "ERC1155 Metadata URI JSON Schema". /// @dev The uri function SHOULD be used to retrieve values if no event was emitted. /// @dev The uri function MUST return the same value as the latest event for an _id if it was emitted. /// @dev The uri function MUST NOT be used to check for the existence of a token as it is possible for /// an implementation to return a valid string even if the token does not exist. /// @return metadataURI The URI associated to the token. function uri(uint256 id) external view returns (string memory metadataURI); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; /// @title ERC1155 Multi Token Standard, optional extension: Mintable. /// @dev See https://eips.ethereum.org/EIPS/eip-1155 /// @dev Note: The ERC-165 identifier for this interface is 0x5190c92c. interface IERC1155Mintable { /// @notice Safely mints some token. /// @dev Reverts if `to` is the zero address. /// @dev Reverts if `to`'s balance of `id` overflows. /// @dev Reverts if `to` is a contract and the call to {IERC1155TokenReceiver-onERC1155Received} fails, reverts or is rejected. /// @dev Emits an {IERC1155-TransferSingle} event. /// @param to Address of the new token owner. /// @param id Identifier of the token to mint. /// @param value Amount of token to mint. /// @param data Optional data to send along to a receiver contract. function safeMint(address to, uint256 id, uint256 value, bytes calldata data) external; /// @notice Safely mints a batch of tokens. /// @dev Reverts if `ids` and `values` have different lengths. /// @dev Reverts if `to` is the zero address. /// @dev Reverts if `to`'s balance overflows for one of `ids`. /// @dev Reverts if `to` is a contract and the call to {IERC1155TokenReceiver-onERC1155batchReceived} fails, reverts or is rejected. /// @dev Emits an {IERC1155-TransferBatch} event. /// @param to Address of the new tokens owner. /// @param ids Identifiers of the tokens to mint. /// @param values Amounts of tokens to mint. /// @param data Optional data to send along to a receiver contract. function safeBatchMint(address to, uint256[] calldata ids, uint256[] calldata values, bytes calldata data) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; /// @title ERC1155 Multi Token Standard, Tokens Receiver. /// @notice Interface for any contract that wants to support transfers from ERC1155 asset contracts. /// @dev See https://eips.ethereum.org/EIPS/eip-1155 /// @dev Note: The ERC-165 identifier for this interface is 0x4e2312e0. interface IERC1155TokenReceiver { /// @notice Handles the receipt of a single ERC1155 token type. /// @notice ERC1155 contracts MUST call this function on a recipient contract, at the end of a `safeTransferFrom` after the balance update. /// @dev Return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` (`0xf23a6e61`) to accept the transfer. /// @dev Return of any other value than the prescribed keccak256 generated value will 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 magicValue `0xf23a6e61` to accept the transfer, or any other value to reject it. function onERC1155Received(address operator, address from, uint256 id, uint256 value, bytes calldata data) external returns (bytes4 magicValue); /// @notice Handles the receipt of multiple ERC1155 token types. /// @notice ERC1155 contracts MUST call this function on a recipient contract, at the end of a `safeBatchTransferFrom` after the balance updates. /// @dev Return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` (`0xbc197c81`) to accept the transfer. /// @dev Return of any other value than the prescribed keccak256 generated value will 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 magicValue `0xbc197c81` to accept the transfer, or any other value to reject it. function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns (bytes4 magicValue); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; import {IERC1155} from "./../interfaces/IERC1155.sol"; import {IERC1155MetadataURI} from "./../interfaces/IERC1155MetadataURI.sol"; import {IERC1155Mintable} from "./../interfaces/IERC1155Mintable.sol"; import {IERC1155Deliverable} from "./../interfaces/IERC1155Deliverable.sol"; import {IERC1155Burnable} from "./../interfaces/IERC1155Burnable.sol"; import {IERC1155TokenReceiver} from "./../interfaces/IERC1155TokenReceiver.sol"; import {Address} from "@openzeppelin/contracts/utils/Address.sol"; import {ProxyInitialization} from "./../../../proxy/libraries/ProxyInitialization.sol"; import {InterfaceDetectionStorage} from "./../../../introspection/libraries/InterfaceDetectionStorage.sol"; library ERC1155Storage { using Address for address; using ERC1155Storage for ERC1155Storage.Layout; using InterfaceDetectionStorage for InterfaceDetectionStorage.Layout; struct Layout { mapping(uint256 => mapping(address => uint256)) balances; mapping(address => mapping(address => bool)) operators; } bytes32 internal constant LAYOUT_STORAGE_SLOT = bytes32(uint256(keccak256("animoca.token.ERC1155.ERC1155.storage")) - 1); bytes4 internal constant ERC1155_SINGLE_RECEIVED = IERC1155TokenReceiver.onERC1155Received.selector; bytes4 internal constant ERC1155_BATCH_RECEIVED = IERC1155TokenReceiver.onERC1155BatchReceived.selector; event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); event TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values); event ApprovalForAll(address indexed owner, address indexed operator, bool approved); event URI(string value, uint256 indexed id); /// @notice Marks the following ERC165 interface(s) as supported: ERC1155. function init() internal { InterfaceDetectionStorage.layout().setSupportedInterface(type(IERC1155).interfaceId, true); } /// @notice Marks the following ERC165 interface(s) as supported: ERC1155MetadataURI. function initERC1155MetadataURI() internal { InterfaceDetectionStorage.layout().setSupportedInterface(type(IERC1155MetadataURI).interfaceId, true); } /// @notice Marks the following ERC165 interface(s) as supported: ERC1155Mintable. function initERC1155Mintable() internal { InterfaceDetectionStorage.layout().setSupportedInterface(type(IERC1155Mintable).interfaceId, true); } /// @notice Marks the following ERC165 interface(s) as supported: ERC1155Deliverable. function initERC1155Deliverable() internal { InterfaceDetectionStorage.layout().setSupportedInterface(type(IERC1155Deliverable).interfaceId, true); } /// @notice Marks the following ERC165 interface(s) as supported: ERC1155Burnable. function initERC1155Burnable() internal { InterfaceDetectionStorage.layout().setSupportedInterface(type(IERC1155Burnable).interfaceId, true); } /// @notice Safely transfers some token by a sender. /// @dev Note: This function implements {ERC1155-safeTransferFrom(address,address,uint256,uint256,bytes)}. /// @dev Warning: Since a `to` contract can run arbitrary code, developers should be aware of potential re-entrancy attacks. /// @dev Reverts if `to` is the zero address. /// @dev Reverts if `sender` is not `from` and has not been approved by `from`. /// @dev Reverts if `from` has an insufficient balance of `id`. /// @dev Reverts if `to` is a contract and the call to {IERC1155TokenReceiver-onERC1155Received} fails, reverts or is rejected. /// @dev Emits a {TransferSingle} event. /// @param sender The message sender. /// @param from Current token owner. /// @param to Address of the new token owner. /// @param id Identifier of the token to transfer. /// @param value Amount of token to transfer. /// @param data Optional data to send along to a receiver contract. function safeTransferFrom(Layout storage s, address sender, address from, address to, uint256 id, uint256 value, bytes calldata data) internal { require(to != address(0), "ERC1155: transfer to address(0)"); require(_isOperatable(s, from, sender), "ERC1155: non-approved sender"); _transferToken(s, from, to, id, value); emit TransferSingle(sender, from, to, id, value); if (to.isContract()) { _callOnERC1155Received(sender, from, to, id, value, data); } } /// @notice Safely transfers a batch of tokens by a sender. /// @dev Note: This function implements {ERC1155-safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)}. /// @dev Warning: Since a `to` contract can run arbitrary code, developers should be aware of potential re-entrancy attacks. /// @dev Reverts if `to` is the zero address. /// @dev Reverts if `ids` and `values` have different lengths. /// @dev Reverts if `sender` is not `from` and has not been approved by `from`. /// @dev Reverts if `from` has an insufficient balance for any of `ids`. /// @dev Reverts if `to` is a contract and the call to {IERC1155TokenReceiver-onERC1155BatchReceived} fails, reverts or is rejected. /// @dev Emits a {TransferBatch} event. /// @param sender The message sender. /// @param from Current tokens owner. /// @param to Address of the new tokens owner. /// @param ids Identifiers of the tokens to transfer. /// @param values Amounts of tokens to transfer. /// @param data Optional data to send along to a receiver contract. function safeBatchTransferFrom( Layout storage s, address sender, address from, address to, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) internal { require(to != address(0), "ERC1155: transfer to address(0)"); uint256 length = ids.length; require(length == values.length, "ERC1155: inconsistent arrays"); require(_isOperatable(s, from, sender), "ERC1155: non-approved sender"); unchecked { for (uint256 i; i != length; ++i) { _transferToken(s, from, to, ids[i], values[i]); } } emit TransferBatch(sender, from, to, ids, values); if (to.isContract()) { _callOnERC1155BatchReceived(sender, from, to, ids, values, data); } } /// @notice Safely mints some token by a sender. /// @dev Note: This function implements {ERC1155Mintable-safeMint(address,uint256,uint256,bytes)}. /// @dev Warning: Since a `to` contract can run arbitrary code, developers should be aware of potential re-entrancy attacks. /// @dev Reverts if `to` is the zero address. /// @dev Reverts if `to`'s balance of `id` overflows. /// @dev Reverts if `to` is a contract and the call to {IERC1155TokenReceiver-onERC1155Received} fails, reverts or is rejected. /// @dev Emits a {TransferSingle} event. /// @param sender The message sender. /// @param to Address of the new token owner. /// @param id Identifier of the token to mint. /// @param value Amount of token to mint. /// @param data Optional data to send along to a receiver contract. function safeMint(Layout storage s, address sender, address to, uint256 id, uint256 value, bytes memory data) internal { require(to != address(0), "ERC1155: mint to address(0)"); _mintToken(s, to, id, value); emit TransferSingle(sender, address(0), to, id, value); if (to.isContract()) { _callOnERC1155Received(sender, address(0), to, id, value, data); } } /// @notice Safely mints a batch of tokens by a sender. /// @dev Note: This function implements {ERC1155Mintable-safeBatchMint(address,uint256[],uint256[],bytes)}. /// @dev Warning: Since a `to` contract can run arbitrary code, developers should be aware of potential re-entrancy attacks. /// @dev Reverts if `ids` and `values` have different lengths. /// @dev Reverts if `to` is the zero address. /// @dev Reverts if `to`'s balance overflows for one of `ids`. /// @dev Reverts if `to` is a contract and the call to {IERC1155TokenReceiver-onERC1155batchReceived} fails, reverts or is rejected. /// @dev Emits a {TransferBatch} event. /// @param sender The message sender. /// @param to Address of the new tokens owner. /// @param ids Identifiers of the tokens to mint. /// @param values Amounts of tokens to mint. /// @param data Optional data to send along to a receiver contract. function safeBatchMint(Layout storage s, address sender, address to, uint256[] memory ids, uint256[] memory values, bytes memory data) internal { require(to != address(0), "ERC1155: mint to address(0)"); uint256 length = ids.length; require(length == values.length, "ERC1155: inconsistent arrays"); unchecked { for (uint256 i; i != length; ++i) { _mintToken(s, to, ids[i], values[i]); } } emit TransferBatch(sender, address(0), to, ids, values); if (to.isContract()) { _callOnERC1155BatchReceived(sender, address(0), to, ids, values, data); } } /// @notice Safely mints tokens to multiple recipients by a sender. /// @dev Note: This function implements {ERC1155Deliverable-safeDeliver(address[],uint256[],uint256[],bytes)}. /// @dev Warning: Since a `to` contract can run arbitrary code, developers should be aware of potential re-entrancy attacks. /// @dev Reverts if `recipients`, `ids` and `values` have different lengths. /// @dev Reverts if one of `recipients` is the zero address. /// @dev Reverts if one of `recipients` balance overflows. /// @dev Reverts if one of `recipients` is a contract and the call to {IERC1155TokenReceiver-onERC1155Received} fails, reverts or is rejected. /// @dev Emits a {TransferSingle} event from the zero address for each transfer. /// @param sender The message sender. /// @param recipients Addresses of the new tokens owners. /// @param ids Identifiers of the tokens to mint. /// @param values Amounts of tokens to mint. /// @param data Optional data to send along to a receiver contract. function safeDeliver( Layout storage s, address sender, address[] memory recipients, uint256[] memory ids, uint256[] memory values, bytes memory data ) internal { uint256 length = recipients.length; require(length == ids.length && length == values.length, "ERC1155: inconsistent arrays"); unchecked { for (uint256 i; i != length; ++i) { s.safeMint(sender, recipients[i], ids[i], values[i], data); } } } /// @notice Burns some token by a sender. /// @dev Reverts `sender` is not `from` and has not been approved by `from`. /// @dev Reverts if `from` has an insufficient balance of `id`. /// @dev Emits a {TransferSingle} event. /// @param sender The message sender. /// @param from Address of the current token owner. /// @param id Identifier of the token to burn. /// @param value Amount of token to burn. function burnFrom(Layout storage s, address sender, address from, uint256 id, uint256 value) internal { require(_isOperatable(s, from, sender), "ERC1155: non-approved sender"); _burnToken(s, from, id, value); emit TransferSingle(sender, from, address(0), id, value); } /// @notice Burns multiple tokens by a sender. /// @dev Reverts if `ids` and `values` have different lengths. /// @dev Reverts if `sender` is not `from` and has not been approved by `from`. /// @dev Reverts if `from` has an insufficient balance for any of `ids`. /// @dev Emits an {IERC1155-TransferBatch} event. /// @param sender The message sender. /// @param from Address of the current tokens owner. /// @param ids Identifiers of the tokens to burn. /// @param values Amounts of tokens to burn. function batchBurnFrom(Layout storage s, address sender, address from, uint256[] calldata ids, uint256[] calldata values) internal { uint256 length = ids.length; require(length == values.length, "ERC1155: inconsistent arrays"); require(_isOperatable(s, from, sender), "ERC1155: non-approved sender"); unchecked { for (uint256 i; i != length; ++i) { _burnToken(s, from, ids[i], values[i]); } } emit TransferBatch(sender, from, address(0), ids, values); } /// @notice Enables or disables an operator's approval by a sender. /// @dev Emits an {ApprovalForAll} event. /// @param sender The message sender. /// @param operator Address of the operator. /// @param approved True to approve the operator, false to revoke its approval. function setApprovalForAll(Layout storage s, address sender, address operator, bool approved) internal { require(operator != sender, "ERC1155: self-approval for all"); s.operators[sender][operator] = approved; emit ApprovalForAll(sender, operator, approved); } /// @notice Retrieves the approval status of an operator for a given owner. /// @param owner Address of the authorisation giver. /// @param operator Address of the operator. /// @return approved True if the operator is approved, false if not. function isApprovedForAll(Layout storage s, address owner, address operator) internal view returns (bool approved) { return s.operators[owner][operator]; } /// @notice Retrieves the balance of `id` owned by account `owner`. /// @param owner The account to retrieve the balance of. /// @param id The identifier to retrieve the balance of. /// @return balance The balance of `id` owned by account `owner`. function balanceOf(Layout storage s, address owner, uint256 id) internal view returns (uint256 balance) { require(owner != address(0), "ERC1155: balance of address(0)"); return s.balances[id][owner]; } /// @notice Retrieves the balances of `ids` owned by accounts `owners`. /// @dev Reverts if `owners` and `ids` have different lengths. /// @param owners The addresses of the token holders /// @param ids The identifiers to retrieve the balance of. /// @return balances The balances of `ids` owned by accounts `owners`. function balanceOfBatch(Layout storage s, address[] calldata owners, uint256[] calldata ids) internal view returns (uint256[] memory balances) { uint256 length = owners.length; require(length == ids.length, "ERC1155: inconsistent arrays"); balances = new uint256[](owners.length); unchecked { for (uint256 i; i != length; ++i) { balances[i] = s.balanceOf(owners[i], ids[i]); } } } function layout() internal pure returns (Layout storage s) { bytes32 position = LAYOUT_STORAGE_SLOT; assembly { s.slot := position } } /// @notice Returns whether an account is authorised to make a transfer on behalf of an owner. /// @param owner The token owner. /// @param account The account to check the operatability of. /// @return operatable True if `account` is `owner` or is an operator for `owner`, false otherwise. function _isOperatable(Layout storage s, address owner, address account) private view returns (bool operatable) { return (owner == account) || s.operators[owner][account]; } function _transferToken(Layout storage s, address from, address to, uint256 id, uint256 value) private { if (value != 0) { unchecked { uint256 fromBalance = s.balances[id][from]; uint256 newFromBalance = fromBalance - value; require(newFromBalance < fromBalance, "ERC1155: insufficient balance"); if (from != to) { uint256 toBalance = s.balances[id][to]; uint256 newToBalance = toBalance + value; require(newToBalance > toBalance, "ERC1155: balance overflow"); s.balances[id][from] = newFromBalance; s.balances[id][to] = newToBalance; } } } } function _mintToken(Layout storage s, address to, uint256 id, uint256 value) private { if (value != 0) { unchecked { uint256 balance = s.balances[id][to]; uint256 newBalance = balance + value; require(newBalance > balance, "ERC1155: balance overflow"); s.balances[id][to] = newBalance; } } } function _burnToken(Layout storage s, address from, uint256 id, uint256 value) private { if (value != 0) { unchecked { uint256 balance = s.balances[id][from]; uint256 newBalance = balance - value; require(newBalance < balance, "ERC1155: insufficient balance"); s.balances[id][from] = newBalance; } } } /// @notice Calls {IERC1155TokenReceiver-onERC1155Received} on a target contract. /// @dev Reverts if the call to the target fails, reverts or is rejected. /// @param sender The message sender. /// @param from Previous token owner. /// @param to New token owner. /// @param id Identifier of the token transferred. /// @param value Value transferred. /// @param data Optional data to send along with the receiver contract call. function _callOnERC1155Received(address sender, address from, address to, uint256 id, uint256 value, bytes memory data) private { require(IERC1155TokenReceiver(to).onERC1155Received(sender, from, id, value, data) == ERC1155_SINGLE_RECEIVED, "ERC1155: transfer rejected"); } /// @notice Calls {IERC1155TokenReceiver-onERC1155BatchReceived} on a target contract. /// @dev Reverts if the call to the target fails, reverts or is rejected. /// @param sender The message sender. /// @param from Previous token owner. /// @param to New token owner. /// @param ids Identifiers of the tokens transferred. /// @param values Values transferred. /// @param data Optional data to send along with the receiver contract call. function _callOnERC1155BatchReceived( address sender, address from, address to, uint256[] memory ids, uint256[] memory values, bytes memory data ) private { require( IERC1155TokenReceiver(to).onERC1155BatchReceived(sender, from, ids, values, data) == ERC1155_BATCH_RECEIVED, "ERC1155: transfer rejected" ); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; /// @title ERC721 Non-Fungible Token Standard, basic interface (functions). /// @dev See https://eips.ethereum.org/EIPS/eip-721 /// @dev This interface only contains the standard functions. See IERC721Events for the events. /// @dev Note: The ERC-165 identifier for this interface is 0x80ac58cd. interface IERC721 { /// @notice Sets or unsets an approval to transfer a single token on behalf of its owner. /// @dev Note: There can only be one approved address per token at a given time. /// @dev Note: A token approval gets reset when this token is transferred, including a self-transfer. /// @dev Reverts if `tokenId` does not exist. /// @dev Reverts if `to` is the token owner. /// @dev Reverts if the sender is not the token owner and has not been approved by the token owner. /// @dev Emits an {Approval} event. /// @param to The address to approve, or the zero address to remove any existing approval. /// @param tokenId The token identifier to give approval for. function approve(address to, uint256 tokenId) external; /// @notice Sets or unsets an approval to transfer all tokens on behalf of their owner. /// @dev Reverts if the sender is the same as `operator`. /// @dev Emits an {ApprovalForAll} event. /// @param operator The address to approve for all tokens. /// @param approved True to set an approval for all tokens, false to unset it. function setApprovalForAll(address operator, bool approved) external; /// @notice Unsafely transfers the ownership of a token to a recipient. /// @dev Note: Usage of this method is discouraged, use `safeTransferFrom` whenever possible. /// @dev Resets the token approval for `tokenId`. /// @dev Reverts if `to` is the zero address. /// @dev Reverts if `from` is not the owner of `tokenId`. /// @dev Reverts if the sender is not `from` and has not been approved by `from` for `tokenId`. /// @dev Emits a {Transfer} event. /// @param from The current token owner. /// @param to The recipient of the token transfer. Self-transfers are possible. /// @param tokenId The identifier of the token to transfer. function transferFrom(address from, address to, uint256 tokenId) external; /// @notice Safely transfers the ownership of a token to a recipient. /// @dev Resets the token approval for `tokenId`. /// @dev Reverts if `to` is the zero address. /// @dev Reverts if `from` is not the owner of `tokenId`. /// @dev Reverts if the sender is not `from` and has not been approved by `from` for `tokenId`. /// @dev Reverts if `to` is a contract and the call to {IERC721Receiver-onERC721Received} fails, reverts or is rejected. /// @dev Emits a {Transfer} event. /// @param from The current token owner. /// @param to The recipient of the token transfer. /// @param tokenId The identifier of the token to transfer. function safeTransferFrom(address from, address to, uint256 tokenId) external; /// @notice Safely transfers the ownership of a token to a recipient. /// @dev Resets the token approval for `tokenId`. /// @dev Reverts if `to` is the zero address. /// @dev Reverts if `from` is not the owner of `tokenId`. /// @dev Reverts if the sender is not `from` and has not been approved by `from` for `tokenId`. /// @dev Reverts if `to` is a contract and the call to {IERC721Receiver-onERC721Received} fails, reverts or is rejected. /// @dev Emits a {Transfer} event. /// @param from The current token owner. /// @param to The recipient of the token transfer. /// @param tokenId The identifier of the token to transfer. /// @param data Optional data to send along to a receiver contract. function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; /// @notice Gets the balance of an address. /// @dev Reverts if `owner` is the zero address. /// @param owner The address to query the balance of. /// @return balance The amount owned by the owner. function balanceOf(address owner) external view returns (uint256 balance); /// @notice Gets the owner of a token. /// @dev Reverts if `tokenId` does not exist. /// @param tokenId The token identifier to query the owner of. /// @return tokenOwner The owner of the token identifier. function ownerOf(uint256 tokenId) external view returns (address tokenOwner); /// @notice Gets the approved address for a token. /// @dev Reverts if `tokenId` does not exist. /// @param tokenId The token identifier to query the approval of. /// @return approved The approved address for the token identifier, or the zero address if no approval is set. function getApproved(uint256 tokenId) external view returns (address approved); /// @notice Gets whether an operator is approved for all tokens by an owner. /// @param owner The address which gives the approval for all tokens. /// @param operator The address which receives the approval for all tokens. /// @return approvedForAll Whether the operator is approved for all tokens by the owner. function isApprovedForAll(address owner, address operator) external view returns (bool approvedForAll); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; import {ProxyInitialization} from "./../../../proxy/libraries/ProxyInitialization.sol"; import {Strings} from "@openzeppelin/contracts/utils/Strings.sol"; library TokenMetadataWithBaseURIStorage { using TokenMetadataWithBaseURIStorage for TokenMetadataWithBaseURIStorage.Layout; using Strings for uint256; struct Layout { string baseURI; } bytes32 public constant LAYOUT_STORAGE_SLOT = bytes32(uint256(keccak256("animoca.token.metadata.TokenMetadataWithBaseURI.storage")) - 1); event BaseMetadataURISet(string baseMetadataURI); /// @notice Sets the base metadata URI. /// @dev Emits a {BaseMetadataURISet} event. /// @param baseURI The base metadata URI. function setBaseMetadataURI(Layout storage s, string calldata baseURI) internal { s.baseURI = baseURI; emit BaseMetadataURISet(baseURI); } /// @notice Gets the base metadata URI. /// @return baseURI The base metadata URI. function baseMetadataURI(Layout storage s) internal view returns (string memory baseURI) { return s.baseURI; } /// @notice Gets the token metadata URI for a token as the concatenation of the base metadata URI and the token identfier. /// @param id The token identifier. /// @return tokenURI The token metadata URI as the concatenation of the base metadata URI and the token identfier. function tokenMetadataURI(Layout storage s, uint256 id) internal view returns (string memory tokenURI) { return string(abi.encodePacked(s.baseURI, id.toString())); } function layout() internal pure returns (Layout storage s) { bytes32 position = LAYOUT_STORAGE_SLOT; assembly { s.slot := position } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; import {ERC2981Storage} from "./libraries/ERC2981Storage.sol"; import {ERC2981Base} from "./base/ERC2981Base.sol"; import {ContractOwnership} from "./../../access/ContractOwnership.sol"; /// @title ERC2981 NFT Royalty Standard (immutable version). /// @dev This contract is to be used via inheritance in an immutable (non-proxied) implementation. abstract contract ERC2981 is ERC2981Base, ContractOwnership { /// @notice Marks the following ERC165 interface(s) as supported: ERC2981. constructor() { ERC2981Storage.init(); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; import {IERC2981} from "./../interfaces/IERC2981.sol"; import {ERC2981Storage} from "./../libraries/ERC2981Storage.sol"; import {ContractOwnershipStorage} from "./../../../access/libraries/ContractOwnershipStorage.sol"; import {Context} from "@openzeppelin/contracts/utils/Context.sol"; /// @title ERC2981 NFT Royalty Standard (proxiable version). /// @dev This contract is to be used via inheritance in a proxied implementation. /// @dev Note: This contract requires ERC165 (Interface Detection Standard). /// @dev Note: This contract requires ERC173 (Contract Ownership standard). abstract contract ERC2981Base is Context, IERC2981 { using ERC2981Storage for ERC2981Storage.Layout; using ContractOwnershipStorage for ContractOwnershipStorage.Layout; uint256 public constant ROYALTY_FEE_DENOMINATOR = ERC2981Storage.ROYALTY_FEE_DENOMINATOR; /// @notice Sets the royalty percentage. /// @dev Reverts if the sender is not the contract owner. /// @dev Reverts with IncorrectRoyaltyPercentage if `percentage` is above 100% (> FEE_DENOMINATOR). /// @param percentage The new percentage to set. For example 50000 sets 50% royalty. function setRoyaltyPercentage(uint256 percentage) external { ContractOwnershipStorage.layout().enforceIsContractOwner(_msgSender()); ERC2981Storage.layout().setRoyaltyPercentage(percentage); } /// @notice Sets the royalty receiver. /// @dev Reverts if the sender is not the contract owner. /// @dev Reverts with IncorrectRoyaltyReceiver if `receiver` is the zero address. /// @param receiver The new receiver to set. function setRoyaltyReceiver(address receiver) external { ContractOwnershipStorage.layout().enforceIsContractOwner(_msgSender()); ERC2981Storage.layout().setRoyaltyReceiver(receiver); } /// @inheritdoc IERC2981 function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount) { return ERC2981Storage.layout().royaltyInfo(tokenId, salePrice); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; import {IOperatorFilterRegistry} from "./../interfaces/IOperatorFilterRegistry.sol"; import {OperatorFiltererStorage} from "./../libraries/OperatorFiltererStorage.sol"; import {ContractOwnershipStorage} from "./../../../access/libraries/ContractOwnershipStorage.sol"; import {Context} from "@openzeppelin/contracts/utils/Context.sol"; /// @title Operator Filterer for token contracts (proxiable version). /// @dev This contract is to be used via inheritance in a proxied implementation. /// @dev Note: This contract requires ERC173 (Contract Ownership standard). abstract contract OperatorFiltererBase is Context { using OperatorFiltererStorage for OperatorFiltererStorage.Layout; using ContractOwnershipStorage for ContractOwnershipStorage.Layout; /// @notice Updates the address that the contract will make OperatorFilter checks against. /// @dev Reverts if the sender is not the contract owner. /// @param registry The new operator filter registry address. When set to the zero address, checks will be bypassed. function updateOperatorFilterRegistry(IOperatorFilterRegistry registry) external { ContractOwnershipStorage.layout().enforceIsContractOwner(_msgSender()); OperatorFiltererStorage.layout().updateOperatorFilterRegistry(registry); } /// @notice Gets the operator filter registry address. function operatorFilterRegistry() external view returns (IOperatorFilterRegistry) { return OperatorFiltererStorage.layout().operatorFilterRegistry(); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; /// @title ERC2981 NFT Royalty Standard. /// @dev See https://eips.ethereum.org/EIPS/eip-2981 /// @dev Note: The ERC-165 identifier for this interface is 0x2a55205a. interface IERC2981 { /// @notice Called with the sale price to determine how much royalty is owed and to whom. /// @param tokenId The NFT asset queried for royalty information /// @param salePrice The sale price of the NFT asset specified by `tokenId` /// @return receiver Address of who should be sent the royalty payment /// @return royaltyAmount The royalty payment amount for `salePrice` function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; interface IOperatorFilterRegistry { function isOperatorAllowed(address registrant, address operator) external view returns (bool); function register(address registrant) external; function registerAndSubscribe(address registrant, address subscription) external; function registerAndCopyEntries(address registrant, address registrantToCopy) external; function unregister(address addr) external; function updateOperator(address registrant, address operator, bool filtered) external; function updateOperators(address registrant, address[] calldata operators, bool filtered) external; function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external; function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external; function subscribe(address registrant, address registrantToSubscribe) external; function unsubscribe(address registrant, bool copyExistingEntries) external; function subscriptionOf(address addr) external returns (address registrant); function subscribers(address registrant) external returns (address[] memory); function subscriberAt(address registrant, uint256 index) external returns (address); function copyEntriesOf(address registrant, address registrantToCopy) external; function isOperatorFiltered(address registrant, address operator) external returns (bool); function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool); function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool); function filteredOperators(address addr) external returns (address[] memory); function filteredCodeHashes(address addr) external returns (bytes32[] memory); function filteredOperatorAt(address registrant, uint256 index) external returns (address); function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32); function isRegistered(address addr) external returns (bool); function codeHashOf(address addr) external returns (bytes32); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; import {IERC2981} from "./../interfaces/IERC2981.sol"; import {InterfaceDetectionStorage} from "./../../../introspection/libraries/InterfaceDetectionStorage.sol"; library ERC2981Storage { using ERC2981Storage for ERC2981Storage.Layout; using InterfaceDetectionStorage for InterfaceDetectionStorage.Layout; struct Layout { address royaltyReceiver; uint96 royaltyPercentage; } bytes32 internal constant LAYOUT_STORAGE_SLOT = bytes32(uint256(keccak256("animoca.token.royalty.ERC2981.storage")) - 1); uint256 internal constant ROYALTY_FEE_DENOMINATOR = 100000; error IncorrectRoyaltyPercentage(uint256 percentage); error IncorrectRoyaltyReceiver(); /// @notice Marks the following ERC165 interface(s) as supported: ERC2981. function init() internal { InterfaceDetectionStorage.layout().setSupportedInterface(type(IERC2981).interfaceId, true); } /// @notice Sets the royalty percentage. /// @dev Reverts with IncorrectRoyaltyPercentage if `percentage` is above 100% (> FEE_DENOMINATOR). /// @param percentage The new percentage to set. For example 50000 sets 50% royalty. function setRoyaltyPercentage(Layout storage s, uint256 percentage) internal { if (percentage > ROYALTY_FEE_DENOMINATOR) { revert IncorrectRoyaltyPercentage(percentage); } s.royaltyPercentage = uint96(percentage); } /// @notice Sets the royalty receiver. /// @dev Reverts with IncorrectRoyaltyReceiver if `receiver` is the zero address. /// @param receiver The new receiver to set. function setRoyaltyReceiver(Layout storage s, address receiver) internal { if (receiver == address(0)) { revert IncorrectRoyaltyReceiver(); } s.royaltyReceiver = receiver; } /// @notice Called with the sale price to determine how much royalty is owed and to whom. // / @param tokenId The NFT asset queried for royalty information /// @param salePrice The sale price of the NFT asset specified by `tokenId` /// @return receiver Address of who should be sent the royalty payment /// @return royaltyAmount The royalty payment amount for `salePrice` function royaltyInfo(Layout storage s, uint256, uint256 salePrice) internal view returns (address receiver, uint256 royaltyAmount) { receiver = s.royaltyReceiver; uint256 royaltyPercentage = s.royaltyPercentage; if (salePrice == 0 || royaltyPercentage == 0) { royaltyAmount = 0; } else { if (salePrice < ROYALTY_FEE_DENOMINATOR) { royaltyAmount = (salePrice * royaltyPercentage) / ROYALTY_FEE_DENOMINATOR; } else { royaltyAmount = (salePrice / ROYALTY_FEE_DENOMINATOR) * royaltyPercentage; } } } function layout() internal pure returns (Layout storage s) { bytes32 position = LAYOUT_STORAGE_SLOT; assembly { s.slot := position } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; import {IOperatorFilterRegistry} from "./../interfaces/IOperatorFilterRegistry.sol"; import {ProxyInitialization} from "./../../../proxy/libraries/ProxyInitialization.sol"; library OperatorFiltererStorage { using OperatorFiltererStorage for OperatorFiltererStorage.Layout; struct Layout { IOperatorFilterRegistry registry; } bytes32 internal constant PROXY_INIT_PHASE_SLOT = bytes32(uint256(keccak256("animoca.token.royalty.OperatorFilterer.phase")) - 1); bytes32 internal constant LAYOUT_STORAGE_SLOT = bytes32(uint256(keccak256("animoca.token.royalty.OperatorFilterer.storage")) - 1); error OperatorNotAllowed(address operator); /// @notice Sets the address that the contract will make OperatorFilter checks against. /// @dev Note: This function should be called ONLY in the constructor of an immutable (non-proxied) contract. /// @param registry The operator filter registry address. When set to the zero address, checks will be bypassed. function constructorInit(Layout storage s, IOperatorFilterRegistry registry) internal { s.registry = registry; } /// @notice Sets the address that the contract will make OperatorFilter checks against. /// @dev Note: This function should be called ONLY in the init function of a proxied contract. /// @dev Reverts if the proxy initialization phase is set to `1` or above. /// @param registry The operator filter registry address. When set to the zero address, checks will be bypassed. function proxyInit(Layout storage s, IOperatorFilterRegistry registry) internal { ProxyInitialization.setPhase(PROXY_INIT_PHASE_SLOT, 1); s.constructorInit(registry); } /// @notice Updates the address that the contract will make OperatorFilter checks against. /// @param registry The new operator filter registry address. When set to the zero address, checks will be bypassed. function updateOperatorFilterRegistry(Layout storage s, IOperatorFilterRegistry registry) internal { s.registry = registry; } /// @dev Reverts with OperatorNotAllowed if `sender` is not `from` and is not allowed by a valid operator registry. function requireAllowedOperatorForTransfer(Layout storage s, address sender, address from) internal view { // Allow spending tokens from addresses with balance // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred from an EOA. if (sender != from) { _checkFilterOperator(s, sender); } } /// @dev Reverts with OperatorNotAllowed if `sender` is not allowed by a valid operator registry. function requireAllowedOperatorForApproval(Layout storage s, address operator) internal view { _checkFilterOperator(s, operator); } function operatorFilterRegistry(Layout storage s) internal view returns (IOperatorFilterRegistry) { return s.registry; } function layout() internal pure returns (Layout storage s) { bytes32 position = LAYOUT_STORAGE_SLOT; assembly { s.slot := position } } function _checkFilterOperator(Layout storage s, address operator) private view { IOperatorFilterRegistry registry = s.registry; // Check registry code length to facilitate testing in environments without a deployed registry. if (address(registry) != address(0) && address(registry).code.length > 0) { if (!registry.isOperatorAllowed(address(this), operator)) { revert OperatorNotAllowed(operator); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; library Bytes32 { /// @notice Converts bytes32 to base32 string. /// @param value value to convert. /// @return the converted base32 string. function toBase32String(bytes32 value) internal pure returns (string memory) { unchecked { bytes32 base32Alphabet = 0x6162636465666768696A6B6C6D6E6F707172737475767778797A323334353637; uint256 i = uint256(value); uint256 k = 52; bytes memory bstr = new bytes(k); bstr[--k] = base32Alphabet[uint8((i % 8) << 2)]; // uint8 s = uint8((256 - skip) % 5); // (i % (2**s)) << (5-s) i /= 8; while (k > 0) { bstr[--k] = base32Alphabet[i % 32]; i /= 32; } return string(bstr); } } /// @notice Converts a bytes32 value to an ASCII string, trimming the tailing zeros. /// @param value value to convert. /// @return the converted ASCII string. function toASCIIString(bytes32 value) internal pure returns (string memory) { unchecked { if (value == 0x00) return ""; bytes memory bytesString = bytes(abi.encodePacked(value)); uint256 pos = 31; while (true) { if (bytesString[pos] != 0) break; --pos; } bytes memory asciiString = new bytes(pos + 1); for (uint256 i; i <= pos; ++i) { asciiString[i] = bytesString[i]; } return string(asciiString); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol) pragma solidity ^0.8.0; import "../token/ERC20/IERC20.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts 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 // OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import {IOperatorFilterRegistry} from "@animoca/ethereum-contracts/contracts/token/royalty/interfaces/IOperatorFilterRegistry.sol"; import {IForwarderRegistry} from "@animoca/ethereum-contracts/contracts/metatx/interfaces/IForwarderRegistry.sol"; import {ERC1155WithOperatorFilterer} from "@animoca/ethereum-contracts/contracts/token/ERC1155/ERC1155WithOperatorFilterer.sol"; import {ERC1155Mintable} from "@animoca/ethereum-contracts/contracts/token/ERC1155/ERC1155Mintable.sol"; import {ERC1155Deliverable} from "@animoca/ethereum-contracts/contracts/token/ERC1155/ERC1155Deliverable.sol"; import {ERC1155MetadataURIWithBaseURI} from "@animoca/ethereum-contracts/contracts/token/ERC1155/ERC1155MetadataURIWithBaseURI.sol"; import {ERC1155Burnable} from "@animoca/ethereum-contracts/contracts/token/ERC1155/ERC1155Burnable.sol"; import {ERC2981} from "@animoca/ethereum-contracts/contracts/token/royalty/ERC2981.sol"; import {TokenRecovery} from "@animoca/ethereum-contracts/contracts/security/TokenRecovery.sol"; import {ContractOwnership} from "@animoca/ethereum-contracts/contracts/access/ContractOwnership.sol"; import {Context} from "@openzeppelin/contracts/utils/Context.sol"; import {ForwarderRegistryContextBase} from "@animoca/ethereum-contracts/contracts/metatx/base/ForwarderRegistryContextBase.sol"; import {ForwarderRegistryContext} from "@animoca/ethereum-contracts/contracts/metatx/ForwarderRegistryContext.sol"; contract REVVMotorsportVouchers is ERC1155WithOperatorFilterer, ERC1155Mintable, ERC1155Deliverable, ERC1155MetadataURIWithBaseURI, ERC1155Burnable, ERC2981, TokenRecovery, ForwarderRegistryContext { constructor( IOperatorFilterRegistry filterRegistry, IForwarderRegistry forwarderRegistry ) ERC1155WithOperatorFilterer(filterRegistry) ERC1155MetadataURIWithBaseURI() ERC1155Mintable() ERC1155Deliverable() ERC1155Burnable() ForwarderRegistryContext(forwarderRegistry) ContractOwnership(msg.sender) {} /// @inheritdoc ForwarderRegistryContextBase function _msgSender() internal view virtual override(Context, ForwarderRegistryContextBase) returns (address) { return ForwarderRegistryContextBase._msgSender(); } /// @inheritdoc ForwarderRegistryContextBase function _msgData() internal view virtual override(Context, ForwarderRegistryContextBase) returns (bytes calldata) { return ForwarderRegistryContextBase._msgData(); } }
{ "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 99999 }, "remappings": [], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract IOperatorFilterRegistry","name":"filterRegistry","type":"address"},{"internalType":"contract IForwarderRegistry","name":"forwarderRegistry","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"percentage","type":"uint256"}],"name":"IncorrectRoyaltyPercentage","type":"error"},{"inputs":[],"name":"IncorrectRoyaltyReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"OperatorNotAllowed","type":"error"},{"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":"string","name":"baseMetadataURI","type":"string"}],"name":"BaseMetadataURISet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"address","name":"operator","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"address","name":"operator","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"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ROYALTY_FEE_DENOMINATOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"owners","type":"address[]"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"balanceOfBatch","outputs":[{"internalType":"uint256[]","name":"balances","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseMetadataURI","outputs":[{"internalType":"string","name":"baseURI","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"batchBurnFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"burnFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"forwarderRegistry","outputs":[{"internalType":"contract IForwarderRegistry","name":"","type":"address"}],"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":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"approvedForAll","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"forwarder","type":"address"}],"name":"isTrustedForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operatorFilterRegistry","outputs":[{"internalType":"contract IOperatorFilterRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"contract IERC20[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"recoverERC20s","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"contract IERC721[]","name":"contracts","type":"address[]"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"recoverERC721s","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"recoverETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"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":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"royaltyAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeBatchMint","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":"values","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeBatchTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"recipients","type":"address[]"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeDeliver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeMint","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":"value","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":"setBaseMetadataURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"percentage","type":"uint256"}],"name":"setRoyaltyPercentage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"setRoyaltyReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IOperatorFilterRegistry","name":"registry","type":"address"}],"name":"updateOperatorFilterRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"metadataURI","type":"string"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60a06040523480156200001157600080fd5b5060405162004bcf38038062004bcf8339810160408190526200003491620003ed565b808083336200006681620000526200012a60201b62000f6b1760201c565b6200016060201b62000f991790919060201c565b506200007c620001f360201b620010561760201c565b620000aa81620000966200021860201b620010861760201c565b6200024860201b620010b41790919060201c565b50620000c06200026560201b620010f61760201c565b620000d56200028860201b620011241760201c565b620000ea620002ab60201b620011521760201c565b620000ff620002ce60201b620011801760201c565b62000114620002f160201b620011ae1760201c565b6001600160a01b0316608052506200044e915050565b6000806200015a60017fc9ed16f33ab3a66c84bfd83099ccb2a8845871e2e1c1928f63797152f0fd54cd6200042c565b92915050565b6001600160a01b03811615620001b75781546001600160a01b0319166001600160a01b03821690811783556040516000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a35b620001ef6307f5828d60e41b6001620001da6200031460201b620011d81760201c565b6200034460201b62001206179092919060201c565b5050565b62000216636cdb3d1360e11b6001620001da6200031460201b620011d81760201c565b565b6000806200015a60017f609b85bcafa81ecfaf3ff62cdde2c6c9082a68dbe4922f07399c706bdeb7cd316200042c565b81546001600160a01b0319166001600160a01b0391909116179055565b62000216631464324b60e21b6001620001da6200031460201b620011d81760201c565b62000216633a2ae73360e21b6001620001da6200031460201b620011d81760201c565b620002166303a24d0760e21b6001620001da6200031460201b620011d81760201c565b6200021663921ed8d160e01b6001620001da6200031460201b620011d81760201c565b6200021663152a902d60e11b6001620001da6200031460201b620011d81760201c565b6000806200015a60017fca9d3e17f264b0f3984e2634e94adb37fa3e6a8103f06aeae6fa59e21c769f5e6200042c565b600160e01b6001600160e01b0319831601620003a65760405162461bcd60e51b815260206004820152601f60248201527f496e74657266616365446574656374696f6e3a2077726f6e672076616c756500604482015260640160405180910390fd5b6001600160e01b03199190911660009081526020929092526040909120805460ff1916911515919091179055565b6001600160a01b0381168114620003ea57600080fd5b50565b600080604083850312156200040157600080fd5b82516200040e81620003d4565b60208401519092506200042181620003d4565b809150509250929050565b818103818111156200015a57634e487b7160e01b600052601160045260246000fd5b6080516147506200047f600039600081816102f40152818161038f01528181612cbd0152612d4501526147506000f3fe608060405234801561001057600080fd5b506004361061020a5760003560e01c80637e518ec81161012a578063c3666c36116100bd578063e8ab9ccc1161008c578063f242432a11610071578063f242432a1461050c578063f2fde38b1461051f578063f7ba94bd1461053257600080fd5b8063e8ab9ccc146104e6578063e985e9c5146104f957600080fd5b8063c3666c361461048f578063d5391393146104a2578063d547741f146104c9578063e1a8bf2c146104dc57600080fd5b80638dc251e3116100f95780638dc251e31461044e57806391d1485414610461578063a22cb46514610474578063b0ccc31e1461048757600080fd5b80637e518ec81461040d57806380534934146104205780638bb9c5bf146104335780638da5cb5b1461044657600080fd5b80632eb2c2d6116101a25780635b2bd79e116101715780635b2bd79e146103cc5780635cfa9297146103d457806361ba27da146103e757806373c8a958146103fa57600080fd5b80632eb2c2d6146103395780632f2ff15d1461034c5780634e1273f41461035f578063572b6c051461037f57600080fd5b8063114ba8ee116101de578063114ba8ee1461028d578063124d91e5146102a05780632a55205a146102b35780632b4c9f16146102f257600080fd5b8062fdd58e1461020f57806301ffc9a7146102355780630d6a5bbb146102585780630e89341c1461026d575b600080fd5b61022261021d3660046139d9565b610545565b6040519081526020015b60405180910390f35b610248610243366004613a33565b610564565b604051901515815260200161022c565b61026b610266366004613ade565b610578565b005b61028061027b366004613b8b565b610673565b60405161022c9190613c12565b61026b61029b366004613c25565b610687565b61026b6102ae366004613c42565b6106f2565b6102c66102c1366004613c77565b610716565b6040805173ffffffffffffffffffffffffffffffffffffffff909316835260208301919091520161022c565b7f00000000000000000000000000000000000000000000000000000000000000005b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161022c565b61026b610347366004613c99565b610739565b61026b61035a366004613d58565b610786565b61037261036d366004613d88565b6107b4565b60405161022c9190613e2f565b61024861038d366004613c25565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff90811691161490565b6102806107d9565b61026b6103e2366004613e42565b6107f0565b61026b6103f5366004613b8b565b610882565b61026b610408366004613eac565b61089f565b61026b61041b366004613f46565b6109bd565b61026b61042e366004613f88565b6109e0565b61026b610441366004613b8b565b610a0a565b610314610a25565b61026b61045c366004613c25565b610a4c565b61024861046f366004613d58565b610a69565b61026b610482366004614008565b610aad565b610314610ae2565b61026b61049d366004613eac565b610aef565b6102227f6d696e746572000000000000000000000000000000000000000000000000000081565b61026b6104d7366004613d58565b610c94565b610222620186a081565b61026b6104f4366004614036565b610cc2565b6102486105073660046140d9565b610ddc565b61026b61051a366004614107565b610e2a565b61026b61052d366004613c25565b610e6a565b61026b610540366004613d88565b610e85565b600061055b8383610554611312565b9190611340565b90505b92915050565b600061055e826105726111d8565b906113f4565b60006105826114ce565b90506105b87f6d696e7465720000000000000000000000000000000000000000000000000000826105b16114d8565b9190611506565b610669818989898080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020808d0282810182019093528c82529093508c92508b91829185019084908082843760009201919091525050604080516020601f8c018190048102820181019092528a815292508a915089908190840183828082843760009201919091525061065f9250611312915050565b94939291906115b2565b5050505050505050565b606061055e82610681611797565b906117c5565b6106a06106926114ce565b61069a610f6b565b906117f9565b6106ef816106ac611086565b9081547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff91909116179055565b50565b6107116106fd6114ce565b848484610708611312565b9392919061187c565b505050565b60008061072d8484610726611959565b9190611987565b915091505b9250929050565b60006107436114ce565b9050610759818a610752611086565b9190611a31565b61077b818a8a8a8a8a8a8a8a61076d611312565b989796959493929190611a6e565b505050505050505050565b60006107906114ce565b905061079e8161069a610f6b565b6107118383836107ac6114d8565b929190611d66565b60606107ce858585856107c5611312565b93929190611e3d565b90505b949350505050565b60606107eb6107e6611797565b611f7b565b905090565b60006107fa6114ce565b90506108297f6d696e7465720000000000000000000000000000000000000000000000000000826105b16114d8565b61087a8187878787878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506108709250611312915050565b9493929190612011565b505050505050565b61088d6106926114ce565b6106ef81610899611959565b9061211f565b6108aa6106926114ce565b8483811480156108b957508082145b610924576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f5265636f766572793a20696e636f6e73697374656e742061727261797300000060448201526064015b60405180910390fd5b60005b818114610669576109b588888381811061094357610943614171565b90506020020160208101906109589190613c25565b85858481811061096a5761096a614171565b9050602002013588888581811061098357610983614171565b90506020020160208101906109989190613c25565b73ffffffffffffffffffffffffffffffffffffffff1691906121a5565b600101610927565b6109c86106926114ce565b6109dc82826109d5611797565b9190612232565b5050565b610a036109eb6114ce565b86868686866109f8611312565b95949392919061227d565b5050505050565b6106ef610a156114ce565b82610a1e6114d8565b9190612434565b60006107eb610a32610f6b565b5473ffffffffffffffffffffffffffffffffffffffff1690565b610a576106926114ce565b6106ef81610a63611959565b906124d0565b600061055b8383610a786114d8565b60009283526020908152604080842073ffffffffffffffffffffffffffffffffffffffff909316845291905290205460ff1690565b8015610ac557610ac582610abf611086565b9061251d565b6109dc610ad06114ce565b8383610ada611312565b929190612527565b60006107eb610a32611086565b610afa6106926114ce565b848381148015610b0957508082145b610b6f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f5265636f766572793a20696e636f6e73697374656e7420617272617973000000604482015260640161091b565b60005b81811461066957858582818110610b8b57610b8b614171565b9050602002016020810190610ba09190613c25565b73ffffffffffffffffffffffffffffffffffffffff166323b872dd308a8a85818110610bce57610bce614171565b9050602002016020810190610be39190613c25565b878786818110610bf557610bf5614171565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e088901b16815273ffffffffffffffffffffffffffffffffffffffff958616600482015294909316602485015250602090910201356044820152606401600060405180830381600087803b158015610c7157600080fd5b505af1158015610c85573d6000803e3d6000fd5b50505050806001019050610b72565b6000610c9e6114ce565b9050610cac8161069a610f6b565b610711838383610cba6114d8565b929190612657565b6000610ccc6114ce565b9050610cfb7f6d696e7465720000000000000000000000000000000000000000000000000000826105b16114d8565b61077b818a8a8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020808e0282810182019093528d82529093508d92508c91829185019084908082843760009201919091525050604080516020808d0282810182019093528c82529093508c92508b91829185019084908082843760009201919091525050604080516020601f8c018190048102820181019092528a815292508a9150899081908401838280828437600092019190915250610dd29250611312915050565b9493929190612721565b600061055b8383610deb611312565b919073ffffffffffffffffffffffffffffffffffffffff9182166000908152600193909301602090815260408085209290931684525290205460ff1690565b6000610e346114ce565b9050610e438188610752611086565b610e6181888888888888610e55611312565b96959493929190612811565b50505050505050565b6106ef610e756114ce565b82610e7e610f6b565b91906129f4565b610e906106926114ce565b82818114610efa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f5265636f766572793a20696e636f6e73697374656e7420617272617973000000604482015260640161091b565b60005b81811461087a57610f63848483818110610f1957610f19614171565b90506020020135878784818110610f3257610f32614171565b9050602002016020810190610f479190613c25565b73ffffffffffffffffffffffffffffffffffffffff1690612b20565b600101610efd565b60008061055e60017fc9ed16f33ab3a66c84bfd83099ccb2a8845871e2e1c1928f63797152f0fd54cd6141cf565b73ffffffffffffffffffffffffffffffffffffffff8116156110215781547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff821690811783556040516000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a35b6109dc7f7f5828d000000000000000000000000000000000000000000000000000000000600161104f6111d8565b9190611206565b6110847fd9b67a2600000000000000000000000000000000000000000000000000000000600161104f6111d8565b565b60008061055e60017f609b85bcafa81ecfaf3ff62cdde2c6c9082a68dbe4922f07399c706bdeb7cd316141cf565b81547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff91909116179055565b6110847f5190c92c00000000000000000000000000000000000000000000000000000000600161104f6111d8565b6110847fe8ab9ccc00000000000000000000000000000000000000000000000000000000600161104f6111d8565b6110847f0e89341c00000000000000000000000000000000000000000000000000000000600161104f6111d8565b6110847f921ed8d100000000000000000000000000000000000000000000000000000000600161104f6111d8565b6110847f2a55205a00000000000000000000000000000000000000000000000000000000600161104f5b60008061055e60017fca9d3e17f264b0f3984e2634e94adb37fa3e6a8103f06aeae6fa59e21c769f5e6141cf565b7c01000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316016112ae576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f496e74657266616365446574656374696f6e3a2077726f6e672076616c756500604482015260640161091b565b7fffffffff00000000000000000000000000000000000000000000000000000000919091166000908152602092909252604090912080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b60008061055e60017f5ccf5846fa27a68fafc8e588671a68f5e67c2f9b56af4263806a4d71735e86136141cf565b600073ffffffffffffffffffffffffffffffffffffffff83166113bf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f455243313135353a2062616c616e6365206f6620616464726573732830290000604482015260640161091b565b5060009081526020928352604080822073ffffffffffffffffffffffffffffffffffffffff9390931682529190925290205490565b60007c01000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316016114445750600061055e565b7ffe003659000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316016114955750600161055e565b507fffffffff00000000000000000000000000000000000000000000000000000000166000908152602091909152604090205460ff1690565b60006107eb612c7a565b60008061055e60017fc8827d3282af6f37b64c3e9e6f3ac9df286ab0bb0fccd6f8661bf19adb368b236141cf565b60008281526020848152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166107115761154482612dc1565b60405160200161155491906141e2565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a000000000000000000000000000000000000000000000000000000000825261091b91600401613c12565b73ffffffffffffffffffffffffffffffffffffffff841661162f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f455243313135353a206d696e7420746f20616464726573732830290000000000604482015260640161091b565b82518251811461169b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f455243313135353a20696e636f6e73697374656e742061727261797300000000604482015260640161091b565b60005b8181146116eb576116e388878784815181106116bc576116bc614171565b60200260200101518785815181106116d6576116d6614171565b6020026020010151612f53565b60010161169e565b508473ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb878760405161176392919061424e565b60405180910390a473ffffffffffffffffffffffffffffffffffffffff85163b15610e6157610e6186600087878787613027565b60008061055e60017fe94434e3c6b941c5d90218142fadcc69cb2e13723993540bfa1c131dd1d3475a6141cf565b6060826117d18361314f565b6040516020016117e29291906142cf565b604051602081830303815290604052905092915050565b815473ffffffffffffffffffffffffffffffffffffffff8281169116146109dc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4f776e6572736869703a206e6f7420746865206f776e65720000000000000000604482015260640161091b565b61188785848661320d565b6118ed576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f455243313135353a206e6f6e2d617070726f7665642073656e64657200000000604482015260640161091b565b6118f985848484613282565b604080518381526020810183905260009173ffffffffffffffffffffffffffffffffffffffff86811692908816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a45050505050565b60008061055e60017f2c0cf10337caabbd02dcf226f05f5fd19a0919a41a8df8958c39b800078268586141cf565b825473ffffffffffffffffffffffffffffffffffffffff8116906000907401000000000000000000000000000000000000000090046bffffffffffffffffffffffff168315806119d5575080155b156119e35760009150611a28565b620186a0841015611a0d57620186a06119fc8286614374565b611a06919061438b565b9150611a28565b80611a1b620186a08661438b565b611a259190614374565b91505b50935093915050565b8073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614610711576107118383613322565b73ffffffffffffffffffffffffffffffffffffffff8716611aeb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f455243313135353a207472616e7366657220746f206164647265737328302900604482015260640161091b565b84838114611b55576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f455243313135353a20696e636f6e73697374656e742061727261797300000000604482015260640161091b565b611b608b8a8c61320d565b611bc6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f455243313135353a206e6f6e2d617070726f7665642073656e64657200000000604482015260640161091b565b60005b818114611c1557611c0d8c8b8b8b8b86818110611be857611be8614171565b905060200201358a8a87818110611c0157611c01614171565b90506020020135613449565b600101611bc9565b508773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff168b73ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8a8a8a8a604051611c909493929190614411565b60405180910390a473ffffffffffffffffffffffffffffffffffffffff88163b15611d5957611d598a8a8a8a8a8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020808e0282810182019093528d82529093508d92508c91829185019084908082843760009201919091525050604080516020601f8d018190048102820181019092528b815292508b91508a908190840183828082843760009201919091525061302792505050565b5050505050505050505050565b60008381526020858152604080832073ffffffffffffffffffffffffffffffffffffffff8616845290915290205460ff16611e375760008381526020858152604080832073ffffffffffffffffffffffffffffffffffffffff8681168086529184529382902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055815187815292830152918316918101919091527f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d906060015b60405180910390a15b50505050565b606083828114611ea9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f455243313135353a20696e636f6e73697374656e742061727261797300000000604482015260640161091b565b8467ffffffffffffffff811115611ec257611ec2614438565b604051908082528060200260200182016040528015611eeb578160200160208202803683370190505b50915060005b818114611f7057611f4b878783818110611f0d57611f0d614171565b9050602002016020810190611f229190613c25565b868684818110611f3457611f34614171565b905060200201358a6113409092919063ffffffff16565b838281518110611f5d57611f5d614171565b6020908102919091010152600101611ef1565b505095945050505050565b6060816000018054611f8c9061427c565b80601f0160208091040260200160405190810160405280929190818152602001828054611fb89061427c565b80156120055780601f10611fda57610100808354040283529160200191612005565b820191906000526020600020905b815481529060010190602001808311611fe857829003601f168201915b50505050509050919050565b73ffffffffffffffffffffffffffffffffffffffff841661208e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f455243313135353a206d696e7420746f20616464726573732830290000000000604482015260640161091b565b61209a86858585612f53565b604080518481526020810184905273ffffffffffffffffffffffffffffffffffffffff80871692600092918916917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a473ffffffffffffffffffffffffffffffffffffffff84163b1561087a5761087a856000868686866135fc565b620186a081111561215f576040517f3affc6c40000000000000000000000000000000000000000000000000000000081526004810182905260240161091b565b81546bffffffffffffffffffffffff909116740100000000000000000000000000000000000000000273ffffffffffffffffffffffffffffffffffffffff909116179055565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610711908490613658565b8261223e8284836144ad565b507f04b1dc5c136a3ce9fded8db0ce3d3366c58764ec3a8e4c2b9e52e4ddfe5ebbf782826040516122709291906145c7565b60405180910390a1505050565b828181146122e7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f455243313135353a20696e636f6e73697374656e742061727261797300000000604482015260640161091b565b6122f288878961320d565b612358576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f455243313135353a206e6f6e2d617070726f7665642073656e64657200000000604482015260640161091b565b60005b8181146123a65761239e898888888581811061237957612379614171565b9050602002013587878681811061239257612392614171565b90506020020135613282565b60010161235b565b50600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb888888886040516124229493929190614411565b60405180910390a45050505050505050565b61243f838284611506565b60008181526020848152604080832073ffffffffffffffffffffffffffffffffffffffff86168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905580518481529182018390528101919091527ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b90606001612270565b73ffffffffffffffffffffffffffffffffffffffff81166110b4576040517f6fe1b4c800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6109dc8282613322565b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036125bc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f455243313135353a2073656c662d617070726f76616c20666f7220616c6c0000604482015260640161091b565b73ffffffffffffffffffffffffffffffffffffffff838116600081815260018701602090815260408083209487168084529482529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a350505050565b60008381526020858152604080832073ffffffffffffffffffffffffffffffffffffffff8616845290915290205460ff1615611e375760008381526020858152604080832073ffffffffffffffffffffffffffffffffffffffff8681168086529184529382902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055815187815292830152918316918101919091527ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b90606001611e2e565b83518351811480156127335750825181145b612799576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f455243313135353a20696e636f6e73697374656e742061727261797300000000604482015260640161091b565b60005b81811461066957612809878783815181106127b9576127b9614171565b60200260200101518784815181106127d3576127d3614171565b60200260200101518785815181106127ed576127ed614171565b6020026020010151878d6120119095949392919063ffffffff16565b60010161279c565b73ffffffffffffffffffffffffffffffffffffffff851661288e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f455243313135353a207472616e7366657220746f206164647265737328302900604482015260640161091b565b61289988878961320d565b6128ff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f455243313135353a206e6f6e2d617070726f7665642073656e64657200000000604482015260640161091b565b61290c8887878787613449565b8473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62878760405161298b929190918252602082015260400190565b60405180910390a473ffffffffffffffffffffffffffffffffffffffff85163b1561066957610669878787878787878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506135fc92505050565b825473ffffffffffffffffffffffffffffffffffffffff9081169083168114612a79576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4f776e6572736869703a206e6f7420746865206f776e65720000000000000000604482015260640161091b565b8173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611e375783547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8381169182178655604051908316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a350505050565b80471015612b8a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015260640161091b565b60008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d8060008114612be4576040519150601f19603f3d011682016040523d82523d6000602084013e612be9565b606091505b5050905080610711576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d61792068617665207265766572746564000000000000606482015260840161091b565b600033321480612c8a5750601836105b15612c9457503390565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16331480612db057506040517f8929a8ca00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82811660048301523360248301527f00000000000000000000000000000000000000000000000000000000000000001690638929a8ca90604401602060405180830381865afa158015612d8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612db09190614614565b15612dba57919050565b3391505090565b60606000829003612de057505060408051602081019091526000815290565b600082604051602001612df591815260200190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190529050601f5b818181518110612e3a57612e3a614171565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016600003612e8f577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01612e28565b60008160010167ffffffffffffffff811115612ead57612ead614438565b6040519080825280601f01601f191660200182016040528015612ed7576020820181803683370190505b50905060005b828111612f4a57838181518110612ef657612ef6614171565b602001015160f81c60f81b828281518110612f1357612f13614171565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600101612edd565b50949350505050565b8015611e375760008281526020858152604080832073ffffffffffffffffffffffffffffffffffffffff87168452909152902054818101818111612ff3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f455243313135353a2062616c616e6365206f766572666c6f7700000000000000604482015260640161091b565b60009384526020958652604080852073ffffffffffffffffffffffffffffffffffffffff9690961685529490955250502055565b6040517fbc197c81000000000000000000000000000000000000000000000000000000008082529073ffffffffffffffffffffffffffffffffffffffff86169063bc197c8190613083908a908a90899089908990600401614631565b6020604051808303816000875af11580156130a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130c6919061469c565b7fffffffff00000000000000000000000000000000000000000000000000000000161461087a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f455243313135353a207472616e736665722072656a6563746564000000000000604482015260640161091b565b6060600061315c83613764565b600101905060008167ffffffffffffffff81111561317c5761317c614438565b6040519080825280601f01601f1916602001820160405280156131a6576020820181803683370190505b5090508181016020015b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff017f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a85049450846131b057509392505050565b60008173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806107d157505073ffffffffffffffffffffffffffffffffffffffff9182166000908152600193909301602090815260408085209290931684525290205460ff1690565b8015611e375760008281526020858152604080832073ffffffffffffffffffffffffffffffffffffffff87168452909152902054818103818110612ff3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f455243313135353a20696e73756666696369656e742062616c616e6365000000604482015260640161091b565b815473ffffffffffffffffffffffffffffffffffffffff168015801590613360575060008173ffffffffffffffffffffffffffffffffffffffff163b115b15610711576040517fc617113400000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff838116602483015282169063c617113490604401602060405180830381865afa1580156133d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133fb9190614614565b610711576040517fede71dcc00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8316600482015260240161091b565b8015610a035760008281526020868152604080832073ffffffffffffffffffffffffffffffffffffffff881684529091529020548181038181106134e9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f455243313135353a20696e73756666696369656e742062616c616e6365000000604482015260640161091b565b8473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614610e615760008481526020888152604080832073ffffffffffffffffffffffffffffffffffffffff891684529091529020548381018181116135b6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f455243313135353a2062616c616e6365206f766572666c6f7700000000000000604482015260640161091b565b600086815260208a8152604080832073ffffffffffffffffffffffffffffffffffffffff808d1685528184528285208890558b1684529091529020555050505050505050565b6040517ff23a6e61000000000000000000000000000000000000000000000000000000008082529073ffffffffffffffffffffffffffffffffffffffff86169063f23a6e6190613083908a908a908990899089906004016146b9565b60006136ba826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166138469092919063ffffffff16565b80519091501561071157808060200190518101906136d89190614614565b610711576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161091b565b6000807a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083106137ad577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000830492506040015b6d04ee2d6d415b85acef810000000083106137d9576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc1000083106137f757662386f26fc10000830492506010015b6305f5e100831061380f576305f5e100830492506008015b612710831061382357612710830492506004015b60648310613835576064830492506002015b600a831061055e5760010192915050565b60606107d18484600085856000808673ffffffffffffffffffffffffffffffffffffffff16858760405161387a91906146fe565b60006040518083038185875af1925050503d80600081146138b7576040519150601f19603f3d011682016040523d82523d6000602084013e6138bc565b606091505b50915091506138cd878383876138d8565b979650505050505050565b6060831561396e5782516000036139675773ffffffffffffffffffffffffffffffffffffffff85163b613967576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161091b565b50816107d1565b6107d183838151156139835781518083602001fd5b806040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161091b9190613c12565b73ffffffffffffffffffffffffffffffffffffffff811681146106ef57600080fd5b600080604083850312156139ec57600080fd5b82356139f7816139b7565b946020939093013593505050565b7fffffffff00000000000000000000000000000000000000000000000000000000811681146106ef57600080fd5b600060208284031215613a4557600080fd5b8135613a5081613a05565b9392505050565b60008083601f840112613a6957600080fd5b50813567ffffffffffffffff811115613a8157600080fd5b6020830191508360208260051b850101111561073257600080fd5b60008083601f840112613aae57600080fd5b50813567ffffffffffffffff811115613ac657600080fd5b60208301915083602082850101111561073257600080fd5b60008060008060008060006080888a031215613af957600080fd5b8735613b04816139b7565b9650602088013567ffffffffffffffff80821115613b2157600080fd5b613b2d8b838c01613a57565b909850965060408a0135915080821115613b4657600080fd5b613b528b838c01613a57565b909650945060608a0135915080821115613b6b57600080fd5b50613b788a828b01613a9c565b989b979a50959850939692959293505050565b600060208284031215613b9d57600080fd5b5035919050565b60005b83811015613bbf578181015183820152602001613ba7565b50506000910152565b60008151808452613be0816020860160208601613ba4565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60208152600061055b6020830184613bc8565b600060208284031215613c3757600080fd5b8135613a50816139b7565b600080600060608486031215613c5757600080fd5b8335613c62816139b7565b95602085013595506040909401359392505050565b60008060408385031215613c8a57600080fd5b50508035926020909101359150565b60008060008060008060008060a0898b031215613cb557600080fd5b8835613cc0816139b7565b97506020890135613cd0816139b7565b9650604089013567ffffffffffffffff80821115613ced57600080fd5b613cf98c838d01613a57565b909850965060608b0135915080821115613d1257600080fd5b613d1e8c838d01613a57565b909650945060808b0135915080821115613d3757600080fd5b50613d448b828c01613a9c565b999c989b5096995094979396929594505050565b60008060408385031215613d6b57600080fd5b823591506020830135613d7d816139b7565b809150509250929050565b60008060008060408587031215613d9e57600080fd5b843567ffffffffffffffff80821115613db657600080fd5b613dc288838901613a57565b90965094506020870135915080821115613ddb57600080fd5b50613de887828801613a57565b95989497509550505050565b600081518084526020808501945080840160005b83811015613e2457815187529582019590820190600101613e08565b509495945050505050565b60208152600061055b6020830184613df4565b600080600080600060808688031215613e5a57600080fd5b8535613e65816139b7565b94506020860135935060408601359250606086013567ffffffffffffffff811115613e8f57600080fd5b613e9b88828901613a9c565b969995985093965092949392505050565b60008060008060008060608789031215613ec557600080fd5b863567ffffffffffffffff80821115613edd57600080fd5b613ee98a838b01613a57565b90985096506020890135915080821115613f0257600080fd5b613f0e8a838b01613a57565b90965094506040890135915080821115613f2757600080fd5b50613f3489828a01613a57565b979a9699509497509295939492505050565b60008060208385031215613f5957600080fd5b823567ffffffffffffffff811115613f7057600080fd5b613f7c85828601613a9c565b90969095509350505050565b600080600080600060608688031215613fa057600080fd5b8535613fab816139b7565b9450602086013567ffffffffffffffff80821115613fc857600080fd5b613fd489838a01613a57565b90965094506040880135915080821115613fed57600080fd5b50613e9b88828901613a57565b80151581146106ef57600080fd5b6000806040838503121561401b57600080fd5b8235614026816139b7565b91506020830135613d7d81613ffa565b6000806000806000806000806080898b03121561405257600080fd5b883567ffffffffffffffff8082111561406a57600080fd5b6140768c838d01613a57565b909a50985060208b013591508082111561408f57600080fd5b61409b8c838d01613a57565b909850965060408b01359150808211156140b457600080fd5b6140c08c838d01613a57565b909650945060608b0135915080821115613d3757600080fd5b600080604083850312156140ec57600080fd5b82356140f7816139b7565b91506020830135613d7d816139b7565b60008060008060008060a0878903121561412057600080fd5b863561412b816139b7565b9550602087013561413b816139b7565b94506040870135935060608701359250608087013567ffffffffffffffff81111561416557600080fd5b613f3489828a01613a9c565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8181038181111561055e5761055e6141a0565b7f416363657373436f6e74726f6c3a206d697373696e672027000000000000000081526000825161421a816018850160208701613ba4565b7f2720726f6c6500000000000000000000000000000000000000000000000000006018939091019283015250601e01919050565b6040815260006142616040830185613df4565b82810360208401526142738185613df4565b95945050505050565b600181811c9082168061429057607f821691505b6020821081036142c9577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60008084546142dd8161427c565b600182811680156142f5576001811461432857614357565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0084168752821515830287019450614357565b8860005260208060002060005b8581101561434e5781548a820152908401908201614335565b50505082870194505b50505050835161436b818360208801613ba4565b01949350505050565b808202811582820484141761055e5761055e6141a0565b6000826143c1577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b81835260007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8311156143f857600080fd5b8260051b80836020870137939093016020019392505050565b6040815260006144256040830186886143c6565b82810360208401526138cd8185876143c6565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b601f82111561071157600081815260208120601f850160051c8101602086101561448e5750805b601f850160051c820191505b8181101561087a5782815560010161449a565b67ffffffffffffffff8311156144c5576144c5614438565b6144d9836144d3835461427c565b83614467565b6000601f84116001811461452b57600085156144f55750838201355b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600387901b1c1916600186901b178355610a03565b6000838152602090207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0861690835b8281101561457a578685013582556020948501946001909201910161455a565b50868210156145b5577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88860031b161c19848701351681555b505060018560011b0183555050505050565b60208152816020820152818360408301376000818301604090810191909152601f9092017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160101919050565b60006020828403121561462657600080fd5b8151613a5081613ffa565b600073ffffffffffffffffffffffffffffffffffffffff808816835280871660208401525060a0604083015261466a60a0830186613df4565b828103606084015261467c8186613df4565b905082810360808401526146908185613bc8565b98975050505050505050565b6000602082840312156146ae57600080fd5b8151613a5081613a05565b600073ffffffffffffffffffffffffffffffffffffffff808816835280871660208401525084604083015283606083015260a060808301526138cd60a0830184613bc8565b60008251614710818460208701613ba4565b919091019291505056fea2646970667358221220b326e9b0544581696400e783ac9625fade8ce0f9997ef95661f7293018bb3ef664736f6c63430008110033000000000000000000000000000000000000aaeb6d7670e522a718067333cd4e0000000000000000000000003f547f87251710f70109ae0409d461b270709693
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000aaeb6d7670e522a718067333cd4e0000000000000000000000003f547f87251710f70109ae0409d461b270709693
-----Decoded View---------------
Arg [0] : filterRegistry (address): 0x000000000000aaeb6d7670e522a718067333cd4e
Arg [1] : forwarderRegistry (address): 0x3f547f87251710f70109ae0409d461b270709693
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000000000000000aaeb6d7670e522a718067333cd4e
Arg [1] : 0000000000000000000000003f547f87251710f70109ae0409d461b270709693