Overview
APE Balance
0 APE
APE Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x60806040 | 4767034 | 19 hrs ago | IN | 0 APE | 0.1043442 |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
Base1155
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
No with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT // @author: Buildtree - Powered by NFT Studios pragma solidity ^0.8.18; import "@openzeppelin/contracts/access/Ownable.sol"; import {ERC1155} from "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import {ERC2981} from "@openzeppelin/contracts/token/common/ERC2981.sol"; import {Lockable} from "./../libraries/Lockable.sol"; import {ProtectedMintBurn} from "./../libraries/ProtectedMintBurn.sol"; import {IMetadataResolver} from "./../interfaces/IMetadataResolver.sol"; import {IERC1155Mintable} from "./../interfaces/IERC1155Mintable.sol"; import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol"; contract Base1155 is ERC1155, ERC2981, Ownable, Lockable, ProtectedMintBurn, IERC1155Mintable { event TransferLocked(bool isTransferLocked); string public constant contractType = "ERC-1155"; string public constant version = "1.0.0"; IMetadataResolver public metadataResolver; uint256 public totalMinted; uint256 public totalBurned; bool public transferLocked; string private _name; string private _symbol; bool private _isInitialized; struct BatchMint { address addr; uint256[] ids; uint256[] values; } constructor() ERC1155("") Ownable(msg.sender) {} function init( address owner, uint96 royalty, string memory __name, string memory __symbol, bool _transferLocked, address _metadataResolver ) public { require(_isInitialized == false, "Contract already initialized."); _transferOwnership(msg.sender); _setDefaultRoyalty(owner, royalty); _name = __name; _symbol = __symbol; transferLocked = _transferLocked; metadataResolver = IMetadataResolver(_metadataResolver); _isInitialized = true; } // Only Minter function mint( address _to, uint256[] memory _ids, uint256[] memory _values ) external onlyMinter mintIsNotLocked { _mintBatch(_to, _ids, _values, ""); uint256 _totalMinted; for (uint256 i; i < _values.length; i++) { _totalMinted += _values[i]; } totalMinted += _totalMinted; } function batchMint( BatchMint[] memory bm ) external onlyMinter mintIsNotLocked { uint256 _totalMinted; for (uint256 i; i < bm.length; i++) { _mintBatch(bm[i].addr, bm[i].ids, bm[i].values, ""); for (uint256 f; f < bm[i].values.length; f++) { _totalMinted += bm[i].values[f]; } } totalMinted += _totalMinted; } // Only Burner function burn( address _from, uint256[] memory _ids, uint256[] memory _values ) external onlyBurner burnIsNotLocked { _burnBatch(_from, _ids, _values); uint256 _totalBurned; for (uint256 i; i < _values.length; i++) { _totalBurned += _values[i]; } totalBurned += _totalBurned; } // Only owner function setDefaultRoyalty( address _receiver, uint96 _feeNumerator ) external onlyOwner { _setDefaultRoyalty(_receiver, _feeNumerator); } function setTokenRoyalty( uint256 _tokenId, address _receiver, uint96 _feeNumerator ) external onlyOwner { _setTokenRoyalty(_tokenId, _receiver, _feeNumerator); } function setMetadataResolver( address _metadataResolverAddress ) external onlyOwner metadataIsNotLocked { metadataResolver = IMetadataResolver(_metadataResolverAddress); } function setTransferLocked(bool _transferLocked) external onlyOwner { transferLocked = _transferLocked; emit TransferLocked(_transferLocked); } // Public function name() public view virtual returns (string memory) { return _name; } function symbol() public view virtual returns (string memory) { return _symbol; } function uri( uint256 _tokenId ) public view virtual override returns (string memory) { return metadataResolver.getTokenURI(address(this), _tokenId); } function totalSupply() public view returns (uint256) { return totalMinted - totalBurned; } function supportsInterface( bytes4 _interfaceId ) public view virtual override(ERC1155, ERC2981) returns (bool) { return super.supportsInterface(_interfaceId); } function _update( address from, address to, uint256[] memory ids, uint256[] memory values ) internal virtual override { // Check that either the token is being minted // or that the transfer is unlocked require( from == address(0) || !transferLocked, "The token can not be transferred at this time." ); return super._update(from, to, ids, values); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol) pragma solidity ^0.8.20; import {IAccessControl} from "./IAccessControl.sol"; import {Context} from "../utils/Context.sol"; import {ERC165} from "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ```solidity * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ```solidity * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules} * to enforce additional security measures for this role. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address account => bool) hasRole; bytes32 adminRole; } mapping(bytes32 role => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with an {AccessControlUnauthorizedAccount} error including the required role. */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual returns (bool) { return _roles[role].hasRole[account]; } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()` * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier. */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account` * is missing `role`. */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert AccessControlUnauthorizedAccount(account, role); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `callerConfirmation`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address callerConfirmation) public virtual { if (callerConfirmation != _msgSender()) { revert AccessControlBadConfirmation(); } _revokeRole(role, callerConfirmation); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual returns (bool) { if (!hasRole(role, account)) { _roles[role].hasRole[account] = true; emit RoleGranted(role, account, _msgSender()); return true; } else { return false; } } /** * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual returns (bool) { if (hasRole(role, account)) { _roles[role].hasRole[account] = false; emit RoleRevoked(role, account, _msgSender()); return true; } else { return false; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol) pragma solidity ^0.8.20; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev The `account` is missing a role. */ error AccessControlUnauthorizedAccount(address account, bytes32 neededRole); /** * @dev The caller of a function is not the expected one. * * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}. */ error AccessControlBadConfirmation(); /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `callerConfirmation`. */ function renounceRole(bytes32 role, address callerConfirmation) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {Context} from "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is set to the address provided by the deployer. This can * later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ constructor(address initialOwner) { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol) pragma solidity ^0.8.20; /** * @dev Standard ERC20 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens. */ interface IERC20Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC20InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC20InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers. * @param spender Address that may be allowed to operate on tokens without being their owner. * @param allowance Amount of tokens a `spender` is allowed to operate with. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC20InvalidApprover(address approver); /** * @dev Indicates a failure with the `spender` to be approved. Used in approvals. * @param spender Address that may be allowed to operate on tokens without being their owner. */ error ERC20InvalidSpender(address spender); } /** * @dev Standard ERC721 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens. */ interface IERC721Errors { /** * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20. * Used in balance queries. * @param owner Address of the current owner of a token. */ error ERC721InvalidOwner(address owner); /** * @dev Indicates a `tokenId` whose `owner` is the zero address. * @param tokenId Identifier number of a token. */ error ERC721NonexistentToken(uint256 tokenId); /** * @dev Indicates an error related to the ownership over a particular token. Used in transfers. * @param sender Address whose tokens are being transferred. * @param tokenId Identifier number of a token. * @param owner Address of the current owner of a token. */ error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC721InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC721InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param tokenId Identifier number of a token. */ error ERC721InsufficientApproval(address operator, uint256 tokenId); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC721InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC721InvalidOperator(address operator); } /** * @dev Standard ERC1155 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens. */ interface IERC1155Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. * @param tokenId Identifier number of a token. */ error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC1155InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC1155InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param owner Address of the current owner of a token. */ error ERC1155MissingApprovalForAll(address operator, address owner); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC1155InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC1155InvalidOperator(address operator); /** * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation. * Used in batch transfers. * @param idsLength Length of the array of token identifiers * @param valuesLength Length of the array of token amounts */ error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.20; import {IERC165} from "../utils/introspection/IERC165.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. */ interface IERC2981 is IERC165 { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be paid in that same unit of exchange. */ function royaltyInfo( uint256 tokenId, uint256 salePrice ) external view returns (address receiver, uint256 royaltyAmount); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/Clones.sol) pragma solidity ^0.8.20; /** * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for * deploying minimal proxy contracts, also known as "clones". * * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies * > a minimal bytecode implementation that delegates all calls to a known, fixed address. * * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2` * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the * deterministic method. */ library Clones { /** * @dev A clone instance deployment failed. */ error ERC1167FailedCreateClone(); /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create opcode, which should never revert. */ function clone(address implementation) internal returns (address instance) { /// @solidity memory-safe-assembly assembly { // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes // of the `implementation` address with the bytecode before the address. mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000)) // Packs the remaining 17 bytes of `implementation` with the bytecode after the address. mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3)) instance := create(0, 0x09, 0x37) } if (instance == address(0)) { revert ERC1167FailedCreateClone(); } } /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create2 opcode and a `salt` to deterministically deploy * the clone. Using the same `implementation` and `salt` multiple time will revert, since * the clones cannot be deployed twice at the same address. */ function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) { /// @solidity memory-safe-assembly assembly { // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes // of the `implementation` address with the bytecode before the address. mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000)) // Packs the remaining 17 bytes of `implementation` with the bytecode after the address. mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3)) instance := create2(0, 0x09, 0x37, salt) } if (instance == address(0)) { revert ERC1167FailedCreateClone(); } } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress( address implementation, bytes32 salt, address deployer ) internal pure returns (address predicted) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(add(ptr, 0x38), deployer) mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff) mstore(add(ptr, 0x14), implementation) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73) mstore(add(ptr, 0x58), salt) mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37)) predicted := keccak256(add(ptr, 0x43), 0x55) } } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress( address implementation, bytes32 salt ) internal view returns (address predicted) { return predictDeterministicAddress(implementation, salt, address(this)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/common/ERC2981.sol) pragma solidity ^0.8.20; import {IERC2981} from "../../interfaces/IERC2981.sol"; import {IERC165, ERC165} from "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information. * * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first. * * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the * fee is specified in basis points by default. * * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported. */ abstract contract ERC2981 is IERC2981, ERC165 { struct RoyaltyInfo { address receiver; uint96 royaltyFraction; } RoyaltyInfo private _defaultRoyaltyInfo; mapping(uint256 tokenId => RoyaltyInfo) private _tokenRoyaltyInfo; /** * @dev The default royalty set is invalid (eg. (numerator / denominator) >= 1). */ error ERC2981InvalidDefaultRoyalty(uint256 numerator, uint256 denominator); /** * @dev The default royalty receiver is invalid. */ error ERC2981InvalidDefaultRoyaltyReceiver(address receiver); /** * @dev The royalty set for an specific `tokenId` is invalid (eg. (numerator / denominator) >= 1). */ error ERC2981InvalidTokenRoyalty(uint256 tokenId, uint256 numerator, uint256 denominator); /** * @dev The royalty receiver for `tokenId` is invalid. */ error ERC2981InvalidTokenRoyaltyReceiver(uint256 tokenId, address receiver); /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) { return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId); } /** * @inheritdoc IERC2981 */ function royaltyInfo(uint256 tokenId, uint256 salePrice) public view virtual returns (address, uint256) { RoyaltyInfo memory royalty = _tokenRoyaltyInfo[tokenId]; if (royalty.receiver == address(0)) { royalty = _defaultRoyaltyInfo; } uint256 royaltyAmount = (salePrice * royalty.royaltyFraction) / _feeDenominator(); return (royalty.receiver, royaltyAmount); } /** * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an * override. */ function _feeDenominator() internal pure virtual returns (uint96) { return 10000; } /** * @dev Sets the royalty information that all ids in this contract will default to. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual { uint256 denominator = _feeDenominator(); if (feeNumerator > denominator) { // Royalty fee will exceed the sale price revert ERC2981InvalidDefaultRoyalty(feeNumerator, denominator); } if (receiver == address(0)) { revert ERC2981InvalidDefaultRoyaltyReceiver(address(0)); } _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Removes default royalty information. */ function _deleteDefaultRoyalty() internal virtual { delete _defaultRoyaltyInfo; } /** * @dev Sets the royalty information for a specific token id, overriding the global default. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual { uint256 denominator = _feeDenominator(); if (feeNumerator > denominator) { // Royalty fee will exceed the sale price revert ERC2981InvalidTokenRoyalty(tokenId, feeNumerator, denominator); } if (receiver == address(0)) { revert ERC2981InvalidTokenRoyaltyReceiver(tokenId, address(0)); } _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Resets royalty information for the token id back to the global default. */ function _resetTokenRoyalty(uint256 tokenId) internal virtual { delete _tokenRoyaltyInfo[tokenId]; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/ERC1155.sol) pragma solidity ^0.8.20; import {IERC1155} from "./IERC1155.sol"; import {IERC1155Receiver} from "./IERC1155Receiver.sol"; import {IERC1155MetadataURI} from "./extensions/IERC1155MetadataURI.sol"; import {Context} from "../../utils/Context.sol"; import {IERC165, ERC165} from "../../utils/introspection/ERC165.sol"; import {Arrays} from "../../utils/Arrays.sol"; import {IERC1155Errors} from "../../interfaces/draft-IERC6093.sol"; /** * @dev Implementation of the basic standard multi-token. * See https://eips.ethereum.org/EIPS/eip-1155 * Originally based on code by Enjin: https://github.com/enjin/erc-1155 */ abstract contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI, IERC1155Errors { using Arrays for uint256[]; using Arrays for address[]; mapping(uint256 id => mapping(address account => uint256)) private _balances; mapping(address account => mapping(address operator => bool)) private _operatorApprovals; // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json string private _uri; /** * @dev See {_setURI}. */ constructor(string memory uri_) { _setURI(uri_); } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC1155).interfaceId || interfaceId == type(IERC1155MetadataURI).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC1155MetadataURI-uri}. * * This implementation returns the same URI for *all* token types. It relies * on the token type ID substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * Clients calling this function must replace the `\{id\}` substring with the * actual token type ID. */ function uri(uint256 /* id */) public view virtual returns (string memory) { return _uri; } /** * @dev See {IERC1155-balanceOf}. */ function balanceOf(address account, uint256 id) public view virtual returns (uint256) { return _balances[id][account]; } /** * @dev See {IERC1155-balanceOfBatch}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch( address[] memory accounts, uint256[] memory ids ) public view virtual returns (uint256[] memory) { if (accounts.length != ids.length) { revert ERC1155InvalidArrayLength(ids.length, accounts.length); } uint256[] memory batchBalances = new uint256[](accounts.length); for (uint256 i = 0; i < accounts.length; ++i) { batchBalances[i] = balanceOf(accounts.unsafeMemoryAccess(i), ids.unsafeMemoryAccess(i)); } return batchBalances; } /** * @dev See {IERC1155-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC1155-isApprovedForAll}. */ function isApprovedForAll(address account, address operator) public view virtual returns (bool) { return _operatorApprovals[account][operator]; } /** * @dev See {IERC1155-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes memory data) public virtual { address sender = _msgSender(); if (from != sender && !isApprovedForAll(from, sender)) { revert ERC1155MissingApprovalForAll(sender, from); } _safeTransferFrom(from, to, id, value, data); } /** * @dev See {IERC1155-safeBatchTransferFrom}. */ function safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory values, bytes memory data ) public virtual { address sender = _msgSender(); if (from != sender && !isApprovedForAll(from, sender)) { revert ERC1155MissingApprovalForAll(sender, from); } _safeBatchTransferFrom(from, to, ids, values, data); } /** * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`. Will mint (or burn) if `from` * (or `to`) is the zero address. * * Emits a {TransferSingle} event if the arrays contain one element, and {TransferBatch} otherwise. * * Requirements: * * - If `to` refers to a smart contract, it must implement either {IERC1155Receiver-onERC1155Received} * or {IERC1155Receiver-onERC1155BatchReceived} and return the acceptance magic value. * - `ids` and `values` must have the same length. * * NOTE: The ERC-1155 acceptance check is not performed in this function. See {_updateWithAcceptanceCheck} instead. */ function _update(address from, address to, uint256[] memory ids, uint256[] memory values) internal virtual { if (ids.length != values.length) { revert ERC1155InvalidArrayLength(ids.length, values.length); } address operator = _msgSender(); for (uint256 i = 0; i < ids.length; ++i) { uint256 id = ids.unsafeMemoryAccess(i); uint256 value = values.unsafeMemoryAccess(i); if (from != address(0)) { uint256 fromBalance = _balances[id][from]; if (fromBalance < value) { revert ERC1155InsufficientBalance(from, fromBalance, value, id); } unchecked { // Overflow not possible: value <= fromBalance _balances[id][from] = fromBalance - value; } } if (to != address(0)) { _balances[id][to] += value; } } if (ids.length == 1) { uint256 id = ids.unsafeMemoryAccess(0); uint256 value = values.unsafeMemoryAccess(0); emit TransferSingle(operator, from, to, id, value); } else { emit TransferBatch(operator, from, to, ids, values); } } /** * @dev Version of {_update} that performs the token acceptance check by calling * {IERC1155Receiver-onERC1155Received} or {IERC1155Receiver-onERC1155BatchReceived} on the receiver address if it * contains code (eg. is a smart contract at the moment of execution). * * IMPORTANT: Overriding this function is discouraged because it poses a reentrancy risk from the receiver. So any * update to the contract state after this function would break the check-effect-interaction pattern. Consider * overriding {_update} instead. */ function _updateWithAcceptanceCheck( address from, address to, uint256[] memory ids, uint256[] memory values, bytes memory data ) internal virtual { _update(from, to, ids, values); if (to != address(0)) { address operator = _msgSender(); if (ids.length == 1) { uint256 id = ids.unsafeMemoryAccess(0); uint256 value = values.unsafeMemoryAccess(0); _doSafeTransferAcceptanceCheck(operator, from, to, id, value, data); } else { _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, values, data); } } } /** * @dev Transfers a `value` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - `from` must have a balance of tokens of type `id` of at least `value` amount. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes memory data) internal { if (to == address(0)) { revert ERC1155InvalidReceiver(address(0)); } if (from == address(0)) { revert ERC1155InvalidSender(address(0)); } (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value); _updateWithAcceptanceCheck(from, to, ids, values, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. * - `ids` and `values` must have the same length. */ function _safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory values, bytes memory data ) internal { if (to == address(0)) { revert ERC1155InvalidReceiver(address(0)); } if (from == address(0)) { revert ERC1155InvalidSender(address(0)); } _updateWithAcceptanceCheck(from, to, ids, values, data); } /** * @dev Sets a new URI for all token types, by relying on the token type ID * substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * By this mechanism, any occurrence of the `\{id\}` substring in either the * URI or any of the values in the JSON file at said URI will be replaced by * clients with the token type ID. * * For example, the `https://token-cdn-domain/\{id\}.json` URI would be * interpreted by clients as * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json` * for token type ID 0x4cce0. * * See {uri}. * * Because these URIs cannot be meaningfully represented by the {URI} event, * this function emits no events. */ function _setURI(string memory newuri) internal virtual { _uri = newuri; } /** * @dev Creates a `value` amount of tokens of type `id`, and assigns them to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _mint(address to, uint256 id, uint256 value, bytes memory data) internal { if (to == address(0)) { revert ERC1155InvalidReceiver(address(0)); } (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value); _updateWithAcceptanceCheck(address(0), to, ids, values, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `values` must have the same length. * - `to` cannot be the zero address. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function _mintBatch(address to, uint256[] memory ids, uint256[] memory values, bytes memory data) internal { if (to == address(0)) { revert ERC1155InvalidReceiver(address(0)); } _updateWithAcceptanceCheck(address(0), to, ids, values, data); } /** * @dev Destroys a `value` amount of tokens of type `id` from `from` * * Emits a {TransferSingle} event. * * Requirements: * * - `from` cannot be the zero address. * - `from` must have at least `value` amount of tokens of type `id`. */ function _burn(address from, uint256 id, uint256 value) internal { if (from == address(0)) { revert ERC1155InvalidSender(address(0)); } (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value); _updateWithAcceptanceCheck(from, address(0), ids, values, ""); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}. * * Emits a {TransferBatch} event. * * Requirements: * * - `from` cannot be the zero address. * - `from` must have at least `value` amount of tokens of type `id`. * - `ids` and `values` must have the same length. */ function _burnBatch(address from, uint256[] memory ids, uint256[] memory values) internal { if (from == address(0)) { revert ERC1155InvalidSender(address(0)); } _updateWithAcceptanceCheck(from, address(0), ids, values, ""); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the zero address. */ function _setApprovalForAll(address owner, address operator, bool approved) internal virtual { if (operator == address(0)) { revert ERC1155InvalidOperator(address(0)); } _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Performs an acceptance check by calling {IERC1155-onERC1155Received} on the `to` address * if it contains code at the moment of execution. */ function _doSafeTransferAcceptanceCheck( address operator, address from, address to, uint256 id, uint256 value, bytes memory data ) private { if (to.code.length > 0) { try IERC1155Receiver(to).onERC1155Received(operator, from, id, value, data) returns (bytes4 response) { if (response != IERC1155Receiver.onERC1155Received.selector) { // Tokens rejected revert ERC1155InvalidReceiver(to); } } catch (bytes memory reason) { if (reason.length == 0) { // non-ERC1155Receiver implementer revert ERC1155InvalidReceiver(to); } else { /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } } } /** * @dev Performs a batch acceptance check by calling {IERC1155-onERC1155BatchReceived} on the `to` address * if it contains code at the moment of execution. */ function _doSafeBatchTransferAcceptanceCheck( address operator, address from, address to, uint256[] memory ids, uint256[] memory values, bytes memory data ) private { if (to.code.length > 0) { try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, values, data) returns ( bytes4 response ) { if (response != IERC1155Receiver.onERC1155BatchReceived.selector) { // Tokens rejected revert ERC1155InvalidReceiver(to); } } catch (bytes memory reason) { if (reason.length == 0) { // non-ERC1155Receiver implementer revert ERC1155InvalidReceiver(to); } else { /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } } } /** * @dev Creates an array in memory with only one value for each of the elements provided. */ function _asSingletonArrays( uint256 element1, uint256 element2 ) private pure returns (uint256[] memory array1, uint256[] memory array2) { /// @solidity memory-safe-assembly assembly { // Load the free memory pointer array1 := mload(0x40) // Set array length to 1 mstore(array1, 1) // Store the single element at the next word after the length (where content starts) mstore(add(array1, 0x20), element1) // Repeat for next array locating it right after the first array array2 := add(array1, 0x40) mstore(array2, 1) mstore(add(array2, 0x20), element2) // Update the free memory pointer by pointing after the second array mstore(0x40, add(array2, 0x40)) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/extensions/IERC1155MetadataURI.sol) pragma solidity ^0.8.20; import {IERC1155} from "../IERC1155.sol"; /** * @dev Interface of the optional ERC1155MetadataExtension interface, as defined * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP]. */ interface IERC1155MetadataURI is IERC1155 { /** * @dev Returns the URI for token type `id`. * * If the `\{id\}` substring is present in the URI, it must be replaced by * clients with the actual token type ID. */ function uri(uint256 id) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (token/ERC1155/IERC1155.sol) pragma solidity ^0.8.20; import {IERC165} from "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. */ interface IERC1155 is IERC165 { /** * @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values ); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the value of tokens of token type `id` owned by `account`. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch( address[] calldata accounts, uint256[] calldata ids ) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`. * * WARNING: This function can potentially allow a reentrancy attack when transferring tokens * to an untrusted contract, when invoking {onERC1155Received} on the receiver. * Ensure to follow the checks-effects-interactions pattern and consider employing * reentrancy guards when interacting with untrusted contracts. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `value` amount. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * WARNING: This function can potentially allow a reentrancy attack when transferring tokens * to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver. * Ensure to follow the checks-effects-interactions pattern and consider employing * reentrancy guards when interacting with untrusted contracts. * * Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments. * * Requirements: * * - `ids` and `values` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/IERC1155Receiver.sol) pragma solidity ^0.8.20; import {IERC165} from "../../utils/introspection/IERC165.sol"; /** * @dev Interface that must be implemented by smart contracts in order to receive * ERC-1155 token transfers. */ interface IERC1155Receiver is IERC165 { /** * @dev Handles the receipt of a single ERC1155 token type. This function is * called at the end of a `safeTransferFrom` after the balance has been updated. * * NOTE: To accept the transfer, this must return * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` * (i.e. 0xf23a6e61, or its own function selector). * * @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 `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed */ function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns (bytes4); /** * @dev Handles the receipt of a multiple ERC1155 token types. This function * is called at the end of a `safeBatchTransferFrom` after the balances have * been updated. * * NOTE: To accept the transfer(s), this must return * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` * (i.e. 0xbc197c81, or its own function selector). * * @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 `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed */ function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.20; import {IERC721} from "./IERC721.sol"; import {IERC721Receiver} from "./IERC721Receiver.sol"; import {IERC721Metadata} from "./extensions/IERC721Metadata.sol"; import {Context} from "../../utils/Context.sol"; import {Strings} from "../../utils/Strings.sol"; import {IERC165, ERC165} from "../../utils/introspection/ERC165.sol"; import {IERC721Errors} from "../../interfaces/draft-IERC6093.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ abstract contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Errors { using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; mapping(uint256 tokenId => address) private _owners; mapping(address owner => uint256) private _balances; mapping(uint256 tokenId => address) private _tokenApprovals; mapping(address owner => mapping(address operator => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual returns (uint256) { if (owner == address(0)) { revert ERC721InvalidOwner(address(0)); } return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual returns (address) { return _requireOwned(tokenId); } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual returns (string memory) { _requireOwned(tokenId); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string.concat(baseURI, tokenId.toString()) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual { _approve(to, tokenId, _msgSender()); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual returns (address) { _requireOwned(tokenId); return _getApproved(tokenId); } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom(address from, address to, uint256 tokenId) public virtual { if (to == address(0)) { revert ERC721InvalidReceiver(address(0)); } // Setting an "auth" arguments enables the `_isAuthorized` check which verifies that the token exists // (from != 0). Therefore, it is not needed to verify that the return value is not 0 here. address previousOwner = _update(to, tokenId, _msgSender()); if (previousOwner != from) { revert ERC721IncorrectOwner(from, tokenId, previousOwner); } } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 tokenId) public { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual { transferFrom(from, to, tokenId); _checkOnERC721Received(from, to, tokenId, data); } /** * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist * * IMPORTANT: Any overrides to this function that add ownership of tokens not tracked by the * core ERC721 logic MUST be matched with the use of {_increaseBalance} to keep balances * consistent with ownership. The invariant to preserve is that for any address `a` the value returned by * `balanceOf(a)` must be equal to the number of tokens such that `_ownerOf(tokenId)` is `a`. */ function _ownerOf(uint256 tokenId) internal view virtual returns (address) { return _owners[tokenId]; } /** * @dev Returns the approved address for `tokenId`. Returns 0 if `tokenId` is not minted. */ function _getApproved(uint256 tokenId) internal view virtual returns (address) { return _tokenApprovals[tokenId]; } /** * @dev Returns whether `spender` is allowed to manage `owner`'s tokens, or `tokenId` in * particular (ignoring whether it is owned by `owner`). * * WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this * assumption. */ function _isAuthorized(address owner, address spender, uint256 tokenId) internal view virtual returns (bool) { return spender != address(0) && (owner == spender || isApprovedForAll(owner, spender) || _getApproved(tokenId) == spender); } /** * @dev Checks if `spender` can operate on `tokenId`, assuming the provided `owner` is the actual owner. * Reverts if `spender` does not have approval from the provided `owner` for the given token or for all its assets * the `spender` for the specific `tokenId`. * * WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this * assumption. */ function _checkAuthorized(address owner, address spender, uint256 tokenId) internal view virtual { if (!_isAuthorized(owner, spender, tokenId)) { if (owner == address(0)) { revert ERC721NonexistentToken(tokenId); } else { revert ERC721InsufficientApproval(spender, tokenId); } } } /** * @dev Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override. * * NOTE: the value is limited to type(uint128).max. This protect against _balance overflow. It is unrealistic that * a uint256 would ever overflow from increments when these increments are bounded to uint128 values. * * WARNING: Increasing an account's balance using this function tends to be paired with an override of the * {_ownerOf} function to resolve the ownership of the corresponding tokens so that balances and ownership * remain consistent with one another. */ function _increaseBalance(address account, uint128 value) internal virtual { unchecked { _balances[account] += value; } } /** * @dev Transfers `tokenId` from its current owner to `to`, or alternatively mints (or burns) if the current owner * (or `to`) is the zero address. Returns the owner of the `tokenId` before the update. * * The `auth` argument is optional. If the value passed is non 0, then this function will check that * `auth` is either the owner of the token, or approved to operate on the token (by the owner). * * Emits a {Transfer} event. * * NOTE: If overriding this function in a way that tracks balances, see also {_increaseBalance}. */ function _update(address to, uint256 tokenId, address auth) internal virtual returns (address) { address from = _ownerOf(tokenId); // Perform (optional) operator check if (auth != address(0)) { _checkAuthorized(from, auth, tokenId); } // Execute the update if (from != address(0)) { // Clear approval. No need to re-authorize or emit the Approval event _approve(address(0), tokenId, address(0), false); unchecked { _balances[from] -= 1; } } if (to != address(0)) { unchecked { _balances[to] += 1; } } _owners[tokenId] = to; emit Transfer(from, to, tokenId); return from; } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal { if (to == address(0)) { revert ERC721InvalidReceiver(address(0)); } address previousOwner = _update(to, tokenId, address(0)); if (previousOwner != address(0)) { revert ERC721InvalidSender(address(0)); } } /** * @dev Mints `tokenId`, transfers it to `to` and checks for `to` acceptance. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual { _mint(to, tokenId); _checkOnERC721Received(address(0), to, tokenId, data); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * This is an internal function that does not check if the sender is authorized to operate on the token. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal { address previousOwner = _update(address(0), tokenId, address(0)); if (previousOwner == address(0)) { revert ERC721NonexistentToken(tokenId); } } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer(address from, address to, uint256 tokenId) internal { if (to == address(0)) { revert ERC721InvalidReceiver(address(0)); } address previousOwner = _update(to, tokenId, address(0)); if (previousOwner == address(0)) { revert ERC721NonexistentToken(tokenId); } else if (previousOwner != from) { revert ERC721IncorrectOwner(from, tokenId, previousOwner); } } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking that contract recipients * are aware of the ERC721 standard to prevent tokens from being forever locked. * * `data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is like {safeTransferFrom} in the sense that it invokes * {IERC721Receiver-onERC721Received} on the receiver, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `tokenId` token must exist and be owned by `from`. * - `to` cannot be the zero address. * - `from` cannot be the zero address. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer(address from, address to, uint256 tokenId) internal { _safeTransfer(from, to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeTransfer-address-address-uint256-}[`_safeTransfer`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual { _transfer(from, to, tokenId); _checkOnERC721Received(from, to, tokenId, data); } /** * @dev Approve `to` to operate on `tokenId` * * The `auth` argument is optional. If the value passed is non 0, then this function will check that `auth` is * either the owner of the token, or approved to operate on all tokens held by this owner. * * Emits an {Approval} event. * * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument. */ function _approve(address to, uint256 tokenId, address auth) internal { _approve(to, tokenId, auth, true); } /** * @dev Variant of `_approve` with an optional flag to enable or disable the {Approval} event. The event is not * emitted in the context of transfers. */ function _approve(address to, uint256 tokenId, address auth, bool emitEvent) internal virtual { // Avoid reading the owner unless necessary if (emitEvent || auth != address(0)) { address owner = _requireOwned(tokenId); // We do not use _isAuthorized because single-token approvals should not be able to call approve if (auth != address(0) && owner != auth && !isApprovedForAll(owner, auth)) { revert ERC721InvalidApprover(auth); } if (emitEvent) { emit Approval(owner, to, tokenId); } } _tokenApprovals[tokenId] = to; } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Requirements: * - operator can't be the address zero. * * Emits an {ApprovalForAll} event. */ function _setApprovalForAll(address owner, address operator, bool approved) internal virtual { if (operator == address(0)) { revert ERC721InvalidOperator(operator); } _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Reverts if the `tokenId` doesn't have a current owner (it hasn't been minted, or it has been burned). * Returns the owner. * * Overrides to ownership logic should be done to {_ownerOf}. */ function _requireOwned(uint256 tokenId) internal view returns (address) { address owner = _ownerOf(tokenId); if (owner == address(0)) { revert ERC721NonexistentToken(tokenId); } return owner; } /** * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target address. This will revert if the * recipient doesn't accept the token transfer. The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param data bytes optional data to send along with the call */ function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory data) private { if (to.code.length > 0) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) { if (retval != IERC721Receiver.onERC721Received.selector) { revert ERC721InvalidReceiver(to); } } catch (bytes memory reason) { if (reason.length == 0) { revert ERC721InvalidReceiver(to); } else { /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.20; import {IERC721} from "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.20; import {IERC165} from "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon * a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or * {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon * a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the address zero. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.20; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be * reverted. * * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Arrays.sol) pragma solidity ^0.8.20; import {StorageSlot} from "./StorageSlot.sol"; import {Math} from "./math/Math.sol"; /** * @dev Collection of functions related to array types. */ library Arrays { using StorageSlot for bytes32; /** * @dev Searches a sorted `array` and returns the first index that contains * a value greater or equal to `element`. If no such index exists (i.e. all * values in the array are strictly less than `element`), the array length is * returned. Time complexity O(log n). * * `array` is expected to be sorted in ascending order, and to contain no * repeated elements. */ function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) { uint256 low = 0; uint256 high = array.length; if (high == 0) { return 0; } while (low < high) { uint256 mid = Math.average(low, high); // Note that mid will always be strictly less than high (i.e. it will be a valid array index) // because Math.average rounds towards zero (it does integer division with truncation). if (unsafeAccess(array, mid).value > element) { high = mid; } else { low = mid + 1; } } // At this point `low` is the exclusive upper bound. We will return the inclusive upper bound. if (low > 0 && unsafeAccess(array, low - 1).value == element) { return low - 1; } else { return low; } } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeAccess(address[] storage arr, uint256 pos) internal pure returns (StorageSlot.AddressSlot storage) { bytes32 slot; // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr` // following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. /// @solidity memory-safe-assembly assembly { mstore(0, arr.slot) slot := add(keccak256(0, 0x20), pos) } return slot.getAddressSlot(); } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeAccess(bytes32[] storage arr, uint256 pos) internal pure returns (StorageSlot.Bytes32Slot storage) { bytes32 slot; // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr` // following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. /// @solidity memory-safe-assembly assembly { mstore(0, arr.slot) slot := add(keccak256(0, 0x20), pos) } return slot.getBytes32Slot(); } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeAccess(uint256[] storage arr, uint256 pos) internal pure returns (StorageSlot.Uint256Slot storage) { bytes32 slot; // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr` // following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. /// @solidity memory-safe-assembly assembly { mstore(0, arr.slot) slot := add(keccak256(0, 0x20), pos) } return slot.getUint256Slot(); } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeMemoryAccess(uint256[] memory arr, uint256 pos) internal pure returns (uint256 res) { assembly { res := mload(add(add(arr, 0x20), mul(pos, 0x20))) } } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeMemoryAccess(address[] memory arr, uint256 pos) internal pure returns (address res) { assembly { res := mload(add(add(arr, 0x20), mul(pos, 0x20))) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @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; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.20; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS } /** * @dev The signature derives the `address(0)`. */ error ECDSAInvalidSignature(); /** * @dev The signature has an invalid length. */ error ECDSAInvalidSignatureLength(uint256 length); /** * @dev The signature has an S value that is in the upper half order. */ error ECDSAInvalidSignatureS(bytes32 s); /** * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not * return address(0) without also returning an error description. Errors are documented using an enum (error type) * and a bytes32 providing additional information about the error. * * If no error is returned, then the address can be used for verification purposes. * * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length)); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature); _throwError(error, errorArg); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] */ function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) { unchecked { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); // We do not check for an overflow here since the shift operation results in 0 or 1. uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. */ function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs); _throwError(error, errorArg); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError, bytes32) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS, s); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature, bytes32(0)); } return (signer, RecoverError.NoError, bytes32(0)); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s); _throwError(error, errorArg); return recovered; } /** * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided. */ function _throwError(RecoverError error, bytes32 errorArg) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert ECDSAInvalidSignature(); } else if (error == RecoverError.InvalidSignatureLength) { revert ECDSAInvalidSignatureLength(uint256(errorArg)); } else if (error == RecoverError.InvalidSignatureS) { revert ECDSAInvalidSignatureS(errorArg); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol) pragma solidity ^0.8.20; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Muldiv operation overflow. */ error MathOverflowedMulDiv(); enum Rounding { Floor, // Toward negative infinity Ceil, // Toward positive infinity Trunc, // Toward zero Expand // Away from zero } /** * @dev Returns the addition of two unsigned integers, with an overflow flag. */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @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 towards infinity instead * of rounding towards zero. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { if (b == 0) { // Guarantee the same behavior as in a regular Solidity division. return a / b; } // (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 = x * y; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. if (denominator <= prod1) { revert MathOverflowedMulDiv(); } /////////////////////////////////////////////// // 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. uint256 twos = denominator & (0 - denominator); 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 (unsignedRoundsUp(rounding) && 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 * towards zero. * * 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 + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2 of a positive value rounded towards zero. * 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 + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10 of a positive value rounded towards zero. * 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 + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256 of a positive value rounded towards zero. * 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 256, 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 + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0); } } /** * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers. */ function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) { return uint8(rounding) % 2 == 1; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.20; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.20; /** * @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: * ```solidity * 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(newImplementation.code.length > 0); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct StringSlot { string value; } struct BytesSlot { bytes 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 } } /** * @dev Returns an `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev Returns an `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol) pragma solidity ^0.8.20; import {Math} from "./math/Math.sol"; import {SignedMath} from "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant HEX_DIGITS = "0123456789abcdef"; uint8 private constant ADDRESS_LENGTH = 20; /** * @dev The `value` string doesn't fit in the specified `length`. */ error StringsInsufficientHexLength(uint256 value, uint256 length); /** * @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), HEX_DIGITS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toStringSigned(int256 value) internal pure returns (string memory) { return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value))); } /** * @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) { uint256 localValue = value; bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = HEX_DIGITS[localValue & 0xf]; localValue >>= 4; } if (localValue != 0) { revert StringsInsufficientHexLength(value, length); } 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); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT // @author: Buildtree - Powered by NFT Studios pragma solidity ^0.8.18; import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol"; import {DTOs} from "./../libraries/dtos.sol"; import {SignatureProtected} from "./../libraries/SignatureProtected.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; interface IERC1155 { function init( address owner, uint96 royalty, string memory name, string memory symbol, bool transferLocked, address metadataResolver ) external; function addMinter(address minter) external; function transferOwnership(address owner) external; function owner() external returns (address); } interface IMinter { function init( address owner, address signerAddress, address feeRecipient, uint256[] memory availableTokens, DTOs.Recipient[] memory recipients, address erc1155Address ) external; } interface IMetadataResolver { function setBaseURI(address _address, string memory _baseURI) external; } contract ERC1155ProxyFactory is Ownable, SignatureProtected { address public paymentRecipient; address public erc1155Address; mapping(string => address) allowedMinters; string public metadataBaseUrl; IMetadataResolver public metadataResolver; event NewContract( string indexed iuuid, string uuid, address token, address minter, uint256[] extras ); constructor( address _erc1155Address, string memory _metadataBaseUrl, address _metadataResolverAddress, address _signerAddress, address _paymentRecipient ) { paymentRecipient = _paymentRecipient; erc1155Address = _erc1155Address; metadataBaseUrl = _metadataBaseUrl; metadataResolver = IMetadataResolver(_metadataResolverAddress); initSignatureProtected(_signerAddress); } // Only Owner function setERC721Address(address _erc1155Address) external onlyOwner { erc1155Address = _erc1155Address; } function addAllowedMinter( string memory _type, address _address ) external onlyOwner { allowedMinters[_type] = _address; } function removeAllowedMinter(string memory _type) external onlyOwner { delete allowedMinters[_type]; } function getAllowedMinterByKind( string memory kind ) public view returns (address) { require( allowedMinters[kind] != address(0), "No contract found for the given kind" ); return allowedMinters[kind]; } function setMetadataResolverAddress( address _metadataResolverAddress ) external onlyOwner { metadataResolver = IMetadataResolver(_metadataResolverAddress); } function setMetadataBaseUrl( string memory _metadataBaseUrl ) external onlyOwner { metadataBaseUrl = _metadataBaseUrl; } function setPaymentRecipient(address _paymentRecipient) external onlyOwner { paymentRecipient = _paymentRecipient; } // Public function create( DTOs.Create1155ContractDto calldata _createDto ) external payable { validateSignature( abi.encodePacked( keccak256(abi.encodePacked(_createDto.uuid)), _createDto.paymentAmount, _createDto.extras ), _createDto.signature ); handlePayment(_createDto.paymentAmount); address cloneErc1155Address = Clones.clone(erc1155Address); IERC1155 erc1155 = IERC1155(cloneErc1155Address); erc1155.init( _createDto.owner, _createDto.royaltyPercentage, _createDto.name, _createDto.symbol, _createDto.transferLocked, address(metadataResolver) ); address cloneMinterAddress = Clones.clone( getAllowedMinterByKind(_createDto.minterKind) ); IMinter minter = IMinter(cloneMinterAddress); minter.init( _createDto.owner, _createDto.signer, paymentRecipient, _createDto.availableTokens, _createDto.recipients, cloneErc1155Address ); erc1155.addMinter(cloneMinterAddress); erc1155.transferOwnership(_createDto.owner); metadataResolver.setBaseURI( cloneErc1155Address, string(abi.encodePacked(metadataBaseUrl, _createDto.uuid, "/")) ); emit NewContract( _createDto.uuid, _createDto.uuid, cloneErc1155Address, cloneMinterAddress, _createDto.extras ); } function handlePayment(uint256 paymentAmount) internal { if (paymentAmount == 0) { return; } require( msg.value >= paymentAmount, "The payment amount has not been satisfied" ); (bool success, ) = address(paymentRecipient).call{value: msg.value}(""); require(success, "Payable: Transfer failed"); } function encodeBytes32String( string memory source ) private pure returns (bytes32 result) { bytes memory tempBytes = bytes(source); if (tempBytes.length == 0) { return 0x0; } assembly { result := mload(add(tempBytes, 32)) } } }
// SPDX-License-Identifier: MIT // @author: Buildtree - Powered by NFT Studios pragma solidity ^0.8.18; import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol"; import {DTOs} from "./../libraries/dtos.sol"; import {SignatureProtected} from "./../libraries/SignatureProtected.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; interface IERC721 { function init( address owner, uint96 royalty, string memory name, string memory symbol, bool transferLocked, address metadataResolver ) external; function addMinter(address minter) external; function transferOwnership(address owner) external; function owner() external returns (address); } interface IMinter { function init( address owner, uint256 maxSupply, address signerAddress, address feeRecipient, DTOs.Recipient[] memory recipients, address erc721Address ) external; } interface IMetadataResolver { function setBaseURI(address _address, string memory _baseURI) external; } contract ERC721ProxyFactory is Ownable, SignatureProtected { address public paymentRecipient; address public erc721Address; mapping(string => address) allowedMinters; string public metadataBaseUrl; IMetadataResolver public metadataResolver; event NewContract( string indexed iuuid, string uuid, address token, address minter, uint256[] extras ); constructor( address _erc721Address, string memory _metadataBaseUrl, address _metadataResolverAddress, address _signerAddress, address _paymentRecipient ) { paymentRecipient = _paymentRecipient; erc721Address = _erc721Address; metadataBaseUrl = _metadataBaseUrl; metadataResolver = IMetadataResolver(_metadataResolverAddress); initSignatureProtected(_signerAddress); } // Only Owner function setERC721Address(address _erc721Address) external onlyOwner { erc721Address = _erc721Address; } function addAllowedMinter( string memory _type, address _address ) external onlyOwner { allowedMinters[_type] = _address; } function removeAllowedMinter(string memory _type) external onlyOwner { delete allowedMinters[_type]; } function getAllowedMinterByKind( string memory kind ) public view returns (address) { require( allowedMinters[kind] != address(0), "No contract found for the given kind" ); return allowedMinters[kind]; } function setMetadataResolverAddress( address _metadataResolverAddress ) external onlyOwner { metadataResolver = IMetadataResolver(_metadataResolverAddress); } function setMetadataBaseUrl( string memory _metadataBaseUrl ) external onlyOwner { metadataBaseUrl = _metadataBaseUrl; } function setPaymentRecipient(address _paymentRecipient) external onlyOwner { paymentRecipient = _paymentRecipient; } // Public function create( DTOs.Create721ContractDto calldata _createDto ) external payable { validateSignature( abi.encodePacked( keccak256(abi.encodePacked(_createDto.uuid)), _createDto.paymentAmount, _createDto.extras ), _createDto.signature ); handlePayment(_createDto.paymentAmount); address cloneErc721Address = Clones.clone(erc721Address); IERC721 erc721 = IERC721(cloneErc721Address); erc721.init( _createDto.owner, _createDto.royaltyPercentage, _createDto.name, _createDto.symbol, _createDto.transferLocked, address(metadataResolver) ); address cloneMinterAddress = Clones.clone( getAllowedMinterByKind(_createDto.minterKind) ); IMinter minter = IMinter(cloneMinterAddress); minter.init( _createDto.owner, _createDto.maxSupply, _createDto.signer, paymentRecipient, _createDto.recipients, cloneErc721Address ); erc721.addMinter(cloneMinterAddress); erc721.transferOwnership(_createDto.owner); metadataResolver.setBaseURI( cloneErc721Address, string(abi.encodePacked(metadataBaseUrl, _createDto.uuid, "/")) ); emit NewContract( _createDto.uuid, _createDto.uuid, cloneErc721Address, cloneMinterAddress, _createDto.extras ); } function handlePayment(uint256 paymentAmount) internal { if (paymentAmount == 0) { return; } require( msg.value >= paymentAmount, "The payment amount has not been satisfied" ); (bool success, ) = address(paymentRecipient).call{value: msg.value}(""); require(success, "Payable: Transfer failed"); } function encodeBytes32String( string memory source ) private pure returns (bytes32 result) { bytes memory tempBytes = bytes(source); if (tempBytes.length == 0) { return 0x0; } assembly { result := mload(add(tempBytes, 32)) } } }
// SPDX-License-Identifier: MIT // @author: Buildtree - Powered by NFT Studios pragma solidity ^0.8.18; interface IERC1155Mintable { function mint( address _to, uint256[] memory _ids, uint256[] memory _values ) external; function totalMinted() external returns (uint256); }
// SPDX-License-Identifier: MIT // @author: Buildtree - Powered by NFT Studios pragma solidity ^0.8.18; interface IERC721Mintable { function mint(address _to, uint256[] memory _ids) external; function totalMinted() external returns (uint256); function exists(uint256 _tokenId) external view returns (bool); }
// SPDX-License-Identifier: MIT // @author: Buildtree - Powered by NFT Studios pragma solidity ^0.8.18; interface IMetadataResolver { function getTokenURI( address _address, uint256 _tokenId ) external view returns (string memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library DTOs { struct Recipient { address addr; uint256 percentage; } struct Create721ContractDto { address owner; string uuid; string name; string symbol; bool transferLocked; uint96 royaltyPercentage; uint256 maxSupply; address signer; Recipient[] recipients; uint256 paymentAmount; string minterKind; uint256[] extras; bytes signature; } struct Create1155ContractDto { address owner; string uuid; string name; string symbol; bool transferLocked; uint96 royaltyPercentage; uint256[] availableTokens; address signer; Recipient[] recipients; uint256 paymentAmount; string minterKind; uint256[] extras; bytes signature; } }
// SPDX-License-Identifier: MIT // @author: Buildtree - Powered by NFT Studios pragma solidity ^0.8.18; abstract contract LimitPerWallet { mapping(address => uint256) public mintsPerWallet; /** * @dev Checks if the given wallet address can mint more tokens. * If the desired amount to be minted exceeds the amount of tokens left allowed to be minted by the given address * it will return the maximum amount of tokens that address can mint. * * If the given address can not mint more tokens it will revert the transaction. */ function getAvailableForWallet( uint256 _amount, uint256 _maxPerWallet ) internal returns (uint256) { // If maxPerWallet is 0 it means that there is no limit per wallet. if (_maxPerWallet == 0) { return _amount; } if (mintsPerWallet[msg.sender] + _amount > _maxPerWallet) { _amount = _maxPerWallet - mintsPerWallet[msg.sender]; } require( _amount > 0, "LimitPerWallet: The caller address can not mint more tokens" ); mintsPerWallet[msg.sender] += _amount; return _amount; } }
// SPDX-License-Identifier: MIT // @author: Buildtree - Powered by NFT Studios pragma solidity ^0.8.18; import "@openzeppelin/contracts/access/Ownable.sol"; abstract contract Lockable is Ownable { bool public isMintLocked; bool public isBurnLocked; bool public isMetadataLocked; modifier mintIsNotLocked() { require(isMintLocked == false, "Lockable: mint is locked"); _; } modifier burnIsNotLocked() { require(isBurnLocked == false, "Lockable: burn is locked"); _; } modifier metadataIsNotLocked() { require(isMetadataLocked == false, "Lockable: metadata is locked"); _; } function lockMint() external onlyOwner { isMintLocked = true; } function lockBurn() external onlyOwner { isBurnLocked = true; } function lockMetadata() external onlyOwner { isMetadataLocked = true; } }
// SPDX-License-Identifier: MIT // @author: Buildtree - Powered by NFT Studios pragma solidity ^0.8.18; import {DTOs} from "./../libraries/dtos.sol"; abstract contract Payable { address public feeRecipient; uint256 private _totalEarnings; modifier onlyRecipient() { bool isRecipient = false; for (uint256 i = 0; i < recipients.length; i++) { if (recipients[i].addr == msg.sender) { isRecipient = true; break; } } require( isRecipient, "Payable: The caller is not an allowed withdrawer" ); _; } uint256 constant BASIS_POINTS = 10000; DTOs.Recipient[] public recipients; function initPayable( address _feeRecipient, DTOs.Recipient[] memory _recipients ) internal { feeRecipient = _feeRecipient; for (uint256 i = 0; i < _recipients.length; i++) { recipients.push(_recipients[i]); } } function checkSentEther( uint256 _amount, uint256 _pricePerToken, uint256 _feePerToken ) internal { uint totalPrice = _amount * _pricePerToken; uint totalFee = _amount * _feePerToken; uint total = totalPrice + totalFee; require( msg.value >= total, "Payable: Not enough Ether provided to mint" ); if (msg.value > total) { payable(msg.sender).transfer(msg.value - total); } if (totalFee > 0) { (bool success, ) = address(feeRecipient).call{value: totalFee}(""); require(success, "Payable: Transfer failed"); } } function withdraw() external onlyRecipient { uint256 totalBalance = address(this).balance; _totalEarnings += totalBalance; for (uint256 i; i < recipients.length; i++) { (bool success, ) = address(recipients[i].addr).call{ value: mulScale( totalBalance, recipients[i].percentage, BASIS_POINTS ) }(""); require(success, "Payable: Transfer failed"); } } function totalEarnings() external view returns (uint256) { return _totalEarnings + address(this).balance; } function mulScale( uint256 x, uint256 y, uint256 scale ) internal pure returns (uint256) { uint256 a = x / scale; uint256 b = x % scale; uint256 c = y / scale; uint256 d = y % scale; return a * c * scale + a * d + b * c + (b * d) / scale; } }
// SPDX-License-Identifier: MIT // @author: Buildtree - Powered by NFT Studios pragma solidity ^0.8.18; import "@openzeppelin/contracts/access/Ownable.sol"; abstract contract ProtectedMintBurn is Ownable { event AddMinter(address _minter); event RemoveMinter(address _minter); event AddBurner(address _minter); event RemoveBurner(address _minter); mapping(address => bool) public allowedMinter; mapping(address => bool) public allowedBurner; constructor() { allowedMinter[msg.sender] = true; } modifier onlyMinter() { require( allowedMinter[msg.sender], "ProtectedMintBurn: caller is not a minter" ); _; } modifier onlyBurner() { require( allowedBurner[msg.sender], "ProtectedMintBurn: caller is not a burner" ); _; } function addMinter(address _minter) external onlyOwner { allowedMinter[_minter] = true; emit AddMinter(_minter); } function removeMinter(address _minter) external onlyOwner { allowedMinter[_minter] = false; emit RemoveMinter(_minter); } function addBurner(address _burner) external onlyOwner { allowedBurner[_burner] = true; emit AddBurner(_burner); } function removeBurner(address _burner) external onlyOwner { allowedBurner[_burner] = false; emit RemoveBurner(_burner); } }
// SPDX-License-Identifier: MIT // @author: Buildtree - Powered by NFT Studios pragma solidity ^0.8.18; abstract contract RandomGenerator { /** * @dev Generates a pseudo-random number. */ function getRandomNumber( uint256 _upper, uint256 _variable // This value should change in between calls to this function within the same block to avoid generating the same number. ) internal view returns (uint256) { uint256 random = uint256( keccak256( abi.encodePacked( _variable, blockhash(block.number - 1), block.coinbase, block.prevrandao, msg.sender ) ) ); return (random % _upper); } }
// SPDX-License-Identifier: MIT // @author: Buildtree - Powered by NFT Studios pragma solidity ^0.8.18; import "@openzeppelin/contracts/access/Ownable.sol"; import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol"; abstract contract SignatureProtected is Ownable { address public signerAddress; constructor() Ownable(msg.sender) {} function initSignatureProtected(address _signerAddress) internal { signerAddress = _signerAddress; } function setSignerAddress(address _signerAddress) external onlyOwner { signerAddress = _signerAddress; } function validateSignature( bytes memory packedParams, bytes calldata signature ) internal view { require( ECDSA.recover(generateHash(packedParams), signature) == signerAddress, "SignatureProtected: Invalid signature for the caller" ); } function generateHash( bytes memory packedParams ) private view returns (bytes32) { bytes32 _hash = keccak256( bytes.concat( abi.encodePacked(address(this), msg.sender), packedParams ) ); bytes memory result = abi.encodePacked( "\x19Ethereum Signed Message:\n32", _hash ); return keccak256(result); } }
// SPDX-License-Identifier: MIT // @author: Buildtree - Powered by NFT Studios pragma solidity ^0.8.18; abstract contract SupplyControl { uint256 public maxSupply; function initSupplyControl(uint256 _maxSupply) internal { maxSupply = _maxSupply; } /** * @dev Checks if there are tokens left to be minted. * If there are not enough tokens for the given amount to mint, it will return whatever is left. * * If there are no tokens left to be minted it will revert the transaction. */ function _getAvailableTokens( uint256 _amountToMint, uint256 _totalMinted ) internal view returns (uint256) { uint256 availableTokens = maxSupply - _totalMinted; require(availableTokens > 0, "SupplyControl: No tokens left to mint"); if (availableTokens < _amountToMint) { return availableTokens; } return _amountToMint; } }
// SPDX-License-Identifier: MIT // @author: Buildtree - Powered by NFT Studios pragma solidity ^0.8.18; abstract contract SupplyControl1155 { uint256[] internal availableTokens; uint256 public maxSupply; function initSupplyControl(uint256[] memory _availableTokens) internal { availableTokens = _availableTokens; for (uint256 i; i < _availableTokens.length; i++) { maxSupply += _availableTokens[i]; } } /** * @dev Checks if there are tokens left to be minted. * If there are not enough tokens for the given amount to mint, it will return whatever is left. * * If there are no tokens left to be minted it will revert the transaction. */ function _getAvailableTokens( uint256 _amountToMint ) internal view returns (uint256) { uint256 _availableTokens = getAvailableTokens(); require(_availableTokens > 0, "SupplyControl: No tokens left to mint"); if (_availableTokens < _amountToMint) { return _availableTokens; } return _amountToMint; } function getAvailableTokens() public view returns (uint256) { uint256 _availableTokens; for (uint256 i; i < availableTokens.length; i++) { _availableTokens += availableTokens[i]; } return _availableTokens; } }
// SPDX-License-Identifier: MIT // @author: Buildtree - Powered by NFT Studios pragma solidity ^0.8.18; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import {IMetadataResolver} from "./../interfaces/IMetadataResolver.sol"; contract MetadataBaseUrl is Ownable, IMetadataResolver { using Strings for uint256; mapping(address => bool) public allowedSetters; mapping(address => string) public baseURI; constructor() Ownable(msg.sender) { allowedSetters[msg.sender] = true; } function addAllowedSetter(address _allowedSetter) external onlyOwner { allowedSetters[_allowedSetter] = true; } function removeAllowedSetter(address _allowedSetter) external onlyOwner { allowedSetters[_allowedSetter] = false; } function setBaseURI(address _address, string memory _baseURI) external { require( allowedSetters[msg.sender], "MetadataBaseUrl: Caller not allowed" ); baseURI[_address] = _baseURI; } function getTokenURI( address _address, uint256 _tokenId ) external view returns (string memory) { return string(abi.encodePacked(baseURI[_address], _tokenId.toString())); } }
// SPDX-License-Identifier: MIT // @author: Buildtree - Powered by NFT Studios pragma solidity ^0.8.18; import {IERC1155Mintable} from "./../interfaces/IERC1155Mintable.sol"; import {Payable} from "./../libraries/Payable.sol"; import {SupplyControl1155} from "./../libraries/SupplyControl1155.sol"; import {LimitPerWallet} from "./../libraries/LimitPerWallet.sol"; import {SignatureProtected} from "./../libraries/SignatureProtected.sol"; import {DTOs} from "./../libraries/dtos.sol"; contract PickMint1155 is Payable, SupplyControl1155, LimitPerWallet, SignatureProtected { string public constant contractType = "PICK-MINTER-1155"; string public constant version = "1.0.0"; IERC1155Mintable public erc1155Contract; bool private _isInitialized; function init( address owner, address signerAddress, address feeRecipient, uint256[] memory availableTokens, DTOs.Recipient[] memory recipients, address erc1155Address ) external { require(_isInitialized == false, "Contract already initialized."); _transferOwnership(owner); initSupplyControl(availableTokens); initSignatureProtected(signerAddress); initPayable(feeRecipient, recipients); erc1155Contract = IERC1155Mintable(erc1155Address); _isInitialized = true; } function mint( uint256[] memory _ids, uint256[] memory _amounts, uint256 _maxPerWallet, uint256 _pricePerToken, uint256 _feePerToken, bytes calldata _signature ) external payable { validateSignature( abi.encodePacked(_maxPerWallet, _pricePerToken, _feePerToken), _signature ); uint256 _amount; for (uint256 i; i < _ids.length; i++) { require( _ids[i] < availableTokens.length, "Invalid ID to be minted" ); uint _available = availableTokens[_ids[i]]; if (_available < _amounts[i]) { _amounts[i] = _available; } availableTokens[_ids[i]] -= _amounts[i]; _amount += _amounts[i]; } require( _amount > 0, "None of the selected tokens to mint are available" ); uint256 _availableAmount = getAvailableForWallet( _amount, _maxPerWallet ); require( _availableAmount >= _amount, "Not enough tokens available to mint for your wallet" ); checkSentEther(_amount, _pricePerToken, _feePerToken); erc1155Contract.mint(msg.sender, _ids, _amounts); } }
// SPDX-License-Identifier: MIT // @author: Buildtree - Powered by NFT Studios pragma solidity ^0.8.18; import {IERC721Mintable} from "./../interfaces/IERC721Mintable.sol"; import {Payable} from "./../libraries/Payable.sol"; import {SupplyControl} from "./../libraries/SupplyControl.sol"; import {LimitPerWallet} from "./../libraries/LimitPerWallet.sol"; import {SignatureProtected} from "./../libraries/SignatureProtected.sol"; import {DTOs} from "./../libraries/dtos.sol"; contract PickMint721 is Payable, SupplyControl, LimitPerWallet, SignatureProtected { string public constant contractType = "PICK-MINTER-721"; string public constant version = "1.0.0"; IERC721Mintable public erc721Contract; bool private _isInitialized; function init( address owner, uint256 maxSupply, address signerAddress, address feeRecipient, DTOs.Recipient[] memory recipients, address erc721Address ) external { require(_isInitialized == false, "Contract already initialized."); _transferOwnership(owner); initSupplyControl(maxSupply); initSignatureProtected(signerAddress); initPayable(feeRecipient, recipients); erc721Contract = IERC721Mintable(erc721Address); _isInitialized = true; } function mint( uint256[] memory _ids, uint256 _maxPerWallet, uint256 _pricePerToken, uint256 _feePerToken, bytes calldata _signature ) external payable { validateSignature( abi.encodePacked(_maxPerWallet, _pricePerToken, _feePerToken), _signature ); uint256 _amount; for (uint256 i; i < _ids.length; i++) { require(_ids[i] < maxSupply, "Invalid ID to be minted"); if (!erc721Contract.exists(_ids[i])) { _amount++; } } uint256 _availableAmount = getAvailableForWallet( _amount, _maxPerWallet ); require( _availableAmount >= _amount, "Not enough tokens available to mint for your wallet" ); checkSentEther(_amount, _pricePerToken, _feePerToken); uint256[] memory idsToMint = new uint256[](_amount); uint256 c; for (uint256 i; i < _ids.length; i++) { if (erc721Contract.exists(_ids[i])) { continue; } idsToMint[c] = _ids[i]; c++; } erc721Contract.mint(msg.sender, idsToMint); } }
// SPDX-License-Identifier: MIT // @author: Buildtree - Powered by NFT Studios pragma solidity ^0.8.18; import {IERC1155Mintable} from "./../interfaces/IERC1155Mintable.sol"; import {Payable} from "./../libraries/Payable.sol"; import {SupplyControl1155} from "./../libraries/SupplyControl1155.sol"; import {LimitPerWallet} from "./../libraries/LimitPerWallet.sol"; import {SignatureProtected} from "./../libraries/SignatureProtected.sol"; import {DTOs} from "./../libraries/dtos.sol"; import {RandomGenerator} from "./../libraries/RandomGenerator.sol"; contract RandomMint1155 is Payable, SupplyControl1155, LimitPerWallet, SignatureProtected, RandomGenerator { string public constant contractType = "RANDOM-MINTER-1155"; string public constant version = "1.0.0"; IERC1155Mintable public erc1155Contract; bool private _isInitialized; function init( address owner, address signerAddress, address feeRecipient, uint256[] memory availableTokens, DTOs.Recipient[] memory recipients, address erc1155Address ) external { require(_isInitialized == false, "Contract already initialized."); _transferOwnership(owner); initSupplyControl(availableTokens); initSignatureProtected(signerAddress); initPayable(feeRecipient, recipients); erc1155Contract = IERC1155Mintable(erc1155Address); _isInitialized = true; } function mint( uint256 _amount, uint256 _maxPerWallet, uint256 _pricePerToken, uint256 _feePerToken, bytes calldata _signature ) external payable { validateSignature( abi.encodePacked(_maxPerWallet, _pricePerToken, _feePerToken), _signature ); _amount = _getAvailableTokens(_amount); _amount = getAvailableForWallet(_amount, _maxPerWallet); checkSentEther(_amount, _pricePerToken, _feePerToken); uint256[] memory amountsPerToken = new uint256[]( availableTokens.length ); uint256 diffCount = 0; for (uint256 i; i < _amount; i++) { uint256 tokenId = getRandomTokenId(i); if (amountsPerToken[tokenId] == 0) { diffCount++; } amountsPerToken[tokenId]++; } uint256[] memory ids = new uint256[](diffCount); uint256[] memory amounts = new uint256[](diffCount); uint256 found = 0; for (uint256 i; i < amountsPerToken.length; i++) { if (amountsPerToken[i] == 0) { continue; } ids[found] = i; amounts[found] = amountsPerToken[i]; found++; } erc1155Contract.mint(msg.sender, ids, amounts); } function getRandomTokenId( uint256 _randomVariable ) internal returns (uint256) { uint256 random = getRandomNumber(getAvailableTokens(), _randomVariable); uint256 total; for (uint256 i; i < availableTokens.length; i++) { total += availableTokens[i]; if (random < total) { availableTokens[i]--; return i; } } revert("Invalid random value generated"); } }
// SPDX-License-Identifier: MIT // @author: Buildtree - Powered by NFT Studios pragma solidity ^0.8.18; import {IERC721Mintable} from "./../interfaces/IERC721Mintable.sol"; import {Payable} from "./../libraries/Payable.sol"; import {SupplyControl} from "./../libraries/SupplyControl.sol"; import {LimitPerWallet} from "./../libraries/LimitPerWallet.sol"; import {SignatureProtected} from "./../libraries/SignatureProtected.sol"; import {DTOs} from "./../libraries/dtos.sol"; import {RandomGenerator} from "./../libraries/RandomGenerator.sol"; contract RandomMint721 is Payable, SupplyControl, LimitPerWallet, SignatureProtected, RandomGenerator { mapping(uint256 => uint256) private tokenMatrix; string public constant contractType = "RANDOM-MINTER-721"; string public constant version = "1.0.0"; IERC721Mintable public erc721Contract; bool private _isInitialized; function init( address owner, uint256 maxSupply, address signerAddress, address feeRecipient, DTOs.Recipient[] memory recipients, address erc721Address ) external { require(_isInitialized == false, "Contract already initialized."); _transferOwnership(owner); initSupplyControl(maxSupply); initSignatureProtected(signerAddress); initPayable(feeRecipient, recipients); erc721Contract = IERC721Mintable(erc721Address); _isInitialized = true; } function mint( uint256 _amount, uint256 _maxPerWallet, uint256 _pricePerToken, uint256 _feePerToken, bytes calldata _signature ) external payable { validateSignature( abi.encodePacked(_maxPerWallet, _pricePerToken, _feePerToken), _signature ); uint256 totalMinted = erc721Contract.totalMinted(); _amount = _getAvailableTokens(_amount, totalMinted); _amount = getAvailableForWallet(_amount, _maxPerWallet); checkSentEther(_amount, _pricePerToken, _feePerToken); uint256[] memory ids = new uint256[](_amount); for (uint256 i; i < ids.length; i++) { ids[i] = getTokenToBeMinted(totalMinted + i, maxSupply); } erc721Contract.mint(msg.sender, ids); } function getAvailableTokens() public view returns (uint256) { (bool success, bytes memory totalSupply) = address(erc721Contract) .staticcall(abi.encodeWithSignature("totalMinted()")); require(success, "Call to totalSupply failed"); return maxSupply - abi.decode(totalSupply, (uint256)); } /** * @dev Returns a random available token to be minted */ function getTokenToBeMinted( uint256 _totalSupply, uint256 _maxSupply ) internal returns (uint256) { uint256 maxIndex = _maxSupply - _totalSupply; uint256 random = getRandomNumber(maxIndex, _totalSupply); uint256 tokenId = tokenMatrix[random]; if (tokenMatrix[random] == 0) { tokenId = random; } tokenMatrix[maxIndex - 1] == 0 ? tokenMatrix[random] = maxIndex - 1 : tokenMatrix[random] = tokenMatrix[maxIndex - 1]; return tokenId; } }
// SPDX-License-Identifier: MIT // @author: Buildtree - Powered by NFT Studios pragma solidity ^0.8.18; import {IERC721Mintable} from "./../interfaces/IERC721Mintable.sol"; import {Payable} from "./../libraries/Payable.sol"; import {SupplyControl} from "./../libraries/SupplyControl.sol"; import {LimitPerWallet} from "./../libraries/LimitPerWallet.sol"; import {SignatureProtected} from "./../libraries/SignatureProtected.sol"; import {DTOs} from "./../libraries/dtos.sol"; contract SequentialMint721 is Payable, SupplyControl, LimitPerWallet, SignatureProtected { string public constant contractType = "SEQUENTIAL-MINTER-721"; string public constant version = "1.0.0"; IERC721Mintable public erc721Contract; bool private _isInitialized; function init( address owner, uint256 maxSupply, address signerAddress, address feeRecipient, DTOs.Recipient[] memory recipients, address erc721Address ) external { require(_isInitialized == false, "Contract already initialized."); _transferOwnership(owner); initSupplyControl(maxSupply); initSignatureProtected(signerAddress); initPayable(feeRecipient, recipients); erc721Contract = IERC721Mintable(erc721Address); _isInitialized = true; } function mint( uint256 _amount, uint256 _maxPerWallet, uint256 _pricePerToken, uint256 _feePerToken, bytes calldata _signature ) external payable { validateSignature( abi.encodePacked(_maxPerWallet, _pricePerToken, _feePerToken), _signature ); uint256 totalMinted = erc721Contract.totalMinted(); _amount = _getAvailableTokens(_amount, totalMinted); _amount = getAvailableForWallet(_amount, _maxPerWallet); checkSentEther(_amount, _pricePerToken, _feePerToken); uint256[] memory ids = new uint256[](_amount); for (uint256 i; i < ids.length; i++) { ids[i] = totalMinted + i; } erc721Contract.mint(msg.sender, ids); } }
// SPDX-License-Identifier: MIT // @author: Buildtree - Powered by NFT Studios pragma solidity ^0.8.18; import "@openzeppelin/contracts/access/Ownable.sol"; import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import {ERC2981} from "@openzeppelin/contracts/token/common/ERC2981.sol"; import {Lockable} from "./../libraries/Lockable.sol"; import {ProtectedMintBurn} from "./../libraries/ProtectedMintBurn.sol"; import {IMetadataResolver} from "./../interfaces/IMetadataResolver.sol"; import {IERC721Mintable} from "./../interfaces/IERC721Mintable.sol"; import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol"; contract Base721 is ERC721, ERC2981, Ownable, Lockable, ProtectedMintBurn, IERC721Mintable { event TransferLocked(bool isTransferLocked); string public constant contractType = "ERC-721"; string public constant version = "1.0.0"; IMetadataResolver public metadataResolver; uint256 public totalMinted; uint256 public totalBurned; bool public transferLocked; string private _name; string private _symbol; bool private _isInitialized; constructor() ERC721("", "") Ownable(msg.sender) {} function init( address owner, uint96 royalty, string memory __name, string memory __symbol, bool _transferLocked, address _metadataResolver ) public { require(_isInitialized == false, "Contract already initialized."); _transferOwnership(msg.sender); _setDefaultRoyalty(owner, royalty); _name = __name; _symbol = __symbol; transferLocked = _transferLocked; metadataResolver = IMetadataResolver(_metadataResolver); _isInitialized = true; } // Only Minter function mint( address _to, uint256[] memory _ids ) external onlyMinter mintIsNotLocked { for (uint i; i < _ids.length; i++) { _safeMint(_to, _ids[i]); } totalMinted += _ids.length; } function batchMint( address[] memory _addresses, uint256[] memory _ids ) external onlyMinter mintIsNotLocked { for (uint i; i < _ids.length; i++) { _safeMint(_addresses[i], _ids[i]); } totalMinted += _ids.length; } // Only Burner function burn(uint256[] memory _ids) external onlyBurner burnIsNotLocked { for (uint i; i < _ids.length; i++) { _burn(_ids[i]); } totalBurned += _ids.length; } // Only owner function setDefaultRoyalty( address _receiver, uint96 _feeNumerator ) external onlyOwner { _setDefaultRoyalty(_receiver, _feeNumerator); } function setTokenRoyalty( uint256 _tokenId, address _receiver, uint96 _feeNumerator ) external onlyOwner { _setTokenRoyalty(_tokenId, _receiver, _feeNumerator); } function setMetadataResolver( address _metadataResolverAddress ) external onlyOwner metadataIsNotLocked { metadataResolver = IMetadataResolver(_metadataResolverAddress); } function setTransferLocked(bool _transferLocked) external onlyOwner { transferLocked = _transferLocked; emit TransferLocked(_transferLocked); } // Public function name() public view virtual override returns (string memory) { return _name; } function symbol() public view virtual override returns (string memory) { return _symbol; } function tokenURI( uint256 _tokenId ) public view virtual override returns (string memory) { require(_ownerOf(_tokenId) != address(0), "Token does not exists"); return metadataResolver.getTokenURI(address(this), _tokenId); } function totalSupply() public view returns (uint256) { return totalMinted - totalBurned; } function exists(uint256 _tokenId) external view returns (bool) { return _ownerOf(_tokenId) != address(0); } function supportsInterface( bytes4 _interfaceId ) public view virtual override(ERC721, ERC2981) returns (bool) { return super.supportsInterface(_interfaceId); } function _update( address to, uint256 tokenId, address auth ) internal virtual override returns (address) { address from = _ownerOf(tokenId); // Check that either the token is being minted // or that the transfer is unlocked require( from == address(0) || !transferLocked, "The token can not be transferred at this time." ); return super._update(to, tokenId, auth); } }
{ "evmVersion": "paris", "optimizer": { "enabled": false, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC1155InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC1155InvalidApprover","type":"error"},{"inputs":[{"internalType":"uint256","name":"idsLength","type":"uint256"},{"internalType":"uint256","name":"valuesLength","type":"uint256"}],"name":"ERC1155InvalidArrayLength","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"ERC1155InvalidOperator","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC1155InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC1155InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"ERC1155MissingApprovalForAll","type":"error"},{"inputs":[{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"name":"ERC2981InvalidDefaultRoyalty","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC2981InvalidDefaultRoyaltyReceiver","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"name":"ERC2981InvalidTokenRoyalty","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC2981InvalidTokenRoyaltyReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_minter","type":"address"}],"name":"AddBurner","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_minter","type":"address"}],"name":"AddMinter","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","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":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":"address","name":"_minter","type":"address"}],"name":"RemoveBurner","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_minter","type":"address"}],"name":"RemoveMinter","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":false,"internalType":"bool","name":"isTransferLocked","type":"bool"}],"name":"TransferLocked","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":[{"internalType":"address","name":"_burner","type":"address"}],"name":"addBurner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_minter","type":"address"}],"name":"addMinter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"allowedBurner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"allowedMinter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"balanceOfBatch","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"}],"internalType":"struct Base1155.BatchMint[]","name":"bm","type":"tuple[]"}],"name":"batchMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint256[]","name":"_ids","type":"uint256[]"},{"internalType":"uint256[]","name":"_values","type":"uint256[]"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"contractType","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint96","name":"royalty","type":"uint96"},{"internalType":"string","name":"__name","type":"string"},{"internalType":"string","name":"__symbol","type":"string"},{"internalType":"bool","name":"_transferLocked","type":"bool"},{"internalType":"address","name":"_metadataResolver","type":"address"}],"name":"init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isBurnLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isMetadataLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isMintLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockBurn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lockMetadata","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lockMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"metadataResolver","outputs":[{"internalType":"contract IMetadataResolver","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256[]","name":"_ids","type":"uint256[]"},{"internalType":"uint256[]","name":"_values","type":"uint256[]"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_burner","type":"address"}],"name":"removeBurner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_minter","type":"address"}],"name":"removeMinter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":"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":"address","name":"_receiver","type":"address"},{"internalType":"uint96","name":"_feeNumerator","type":"uint96"}],"name":"setDefaultRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_metadataResolverAddress","type":"address"}],"name":"setMetadataResolver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint96","name":"_feeNumerator","type":"uint96"}],"name":"setTokenRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_transferLocked","type":"bool"}],"name":"setTransferLocked","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":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalBurned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"transferLocked","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":"uint256","name":"_tokenId","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b50336040518060200160405280600081525062000034816200011a60201b60201c565b50600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603620000aa5760006040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600401620000a191906200023a565b60405180910390fd5b620000bb816200012f60201b60201c565b506001600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550620005b8565b80600290816200012b9190620004d1565b5050565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006200022282620001f5565b9050919050565b620002348162000215565b82525050565b600060208201905062000251600083018462000229565b92915050565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680620002d957607f821691505b602082108103620002ef57620002ee62000291565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620003597fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826200031a565b6200036586836200031a565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b6000620003b2620003ac620003a6846200037d565b62000387565b6200037d565b9050919050565b6000819050919050565b620003ce8362000391565b620003e6620003dd82620003b9565b84845462000327565b825550505050565b600090565b620003fd620003ee565b6200040a818484620003c3565b505050565b5b81811015620004325762000426600082620003f3565b60018101905062000410565b5050565b601f82111562000481576200044b81620002f5565b62000456846200030a565b8101602085101562000466578190505b6200047e62000475856200030a565b8301826200040f565b50505b505050565b600082821c905092915050565b6000620004a66000198460080262000486565b1980831691505092915050565b6000620004c1838362000493565b9150826002028217905092915050565b620004dc8262000257565b67ffffffffffffffff811115620004f857620004f762000262565b5b620005048254620002c0565b6200051182828562000436565b600060209050601f83116001811462000549576000841562000534578287015190505b620005408582620004b3565b865550620005b0565b601f1984166200055986620002f5565b60005b8281101562000583578489015182556001820191506020850194506020810190506200055c565b86831015620005a357848901516200059f601f89168262000493565b8355505b6001600288020188555050505b505050505050565b61484580620005c86000396000f3fe608060405234801561001057600080fd5b50600436106102525760003560e01c80637995c1e411610146578063bc3ba856116100c3578063df10580a11610087578063df10580a1461069a578063e0b6bb67146106b8578063e985e9c5146106c2578063f242432a146106f2578063f2fde38b1461070e578063f44637ba1461072a57610252565b8063bc3ba85614610606578063bd3c996b14610622578063cb2ef6f714610640578063d7e45cd71461065e578063d89135cd1461067c57610252565b8063983b2d561161010a578063983b2d5614610588578063989bdbb6146105a4578063a0c76f62146105ae578063a22cb465146105cc578063a2309ff8146105e857610252565b80637995c1e4146104e45780638b78f0ef146105005780638da5cb5b1461053057806395d89b411461054e5780639727756a1461056c57610252565b80632a55205a116101d45780634b700fc3116101985780634b700fc3146104545780634e1273f41461047057806354fd4d50146104a05780635944c753146104be578063715018a6146104da57610252565b80632a55205a146103b35780632eb2c2d6146103e45780633092afd51461040057806335e60bd41461041c5780633db0f8ab1461043857610252565b80630e89341c1161021b5780630e89341c1461030d57806312686aae1461033d57806318160ddd1461035b5780631a2f459f146103795780631aff0dba146103a957610252565b8062fdd58e1461025757806301ffc9a71461028757806302846858146102b757806304634d8d146102d357806306fdde03146102ef575b600080fd5b610271600480360381019061026c9190612ea6565b610746565b60405161027e9190612ef5565b60405180910390f35b6102a1600480360381019061029c9190612f68565b6107a0565b6040516102ae9190612fb0565b60405180910390f35b6102d160048036038101906102cc9190612fcb565b6107b2565b005b6102ed60048036038101906102e8919061303c565b61084c565b005b6102f7610862565b604051610304919061310c565b60405180910390f35b6103276004803603810190610322919061312e565b6108f4565b604051610334919061310c565b60405180910390f35b6103456109a0565b6040516103529190612fb0565b60405180910390f35b6103636109b3565b6040516103709190612ef5565b60405180910390f35b610393600480360381019061038e9190612fcb565b6109ca565b6040516103a09190612fb0565b60405180910390f35b6103b16109ea565b005b6103cd60048036038101906103c8919061315b565b610a0f565b6040516103db9291906131aa565b60405180910390f35b6103fe60048036038101906103f991906133d0565b610bf9565b005b61041a60048036038101906104159190612fcb565b610ca1565b005b610436600480360381019061043191906134cb565b610d3b565b005b610452600480360381019061044d91906134f8565b610d97565b005b61046e60048036038101906104699190613624565b610ee6565b005b61048a600480360381019061048591906137ac565b610fed565b60405161049791906138e2565b60405180910390f35b6104a86110f6565b6040516104b5919061310c565b60405180910390f35b6104d860048036038101906104d39190613904565b61112f565b005b6104e2611147565b005b6104fe60048036038101906104f99190612fcb565b61115b565b005b61051a60048036038101906105159190612fcb565b6111fd565b6040516105279190612fb0565b60405180910390f35b61053861121d565b6040516105459190613957565b60405180910390f35b610556611247565b604051610563919061310c565b60405180910390f35b610586600480360381019061058191906134f8565b6112d9565b005b6105a2600480360381019061059d9190612fcb565b611438565b005b6105ac6114d2565b005b6105b66114f7565b6040516105c391906139d1565b60405180910390f35b6105e660048036038101906105e191906139ec565b61151d565b005b6105f0611533565b6040516105fd9190612ef5565b60405180910390f35b610620600480360381019061061b9190613bb3565b611539565b005b61062a611746565b6040516106379190612fb0565b60405180910390f35b610648611759565b604051610655919061310c565b60405180910390f35b610666611792565b6040516106739190612fb0565b60405180910390f35b6106846117a5565b6040516106919190612ef5565b60405180910390f35b6106a26117ab565b6040516106af9190612fb0565b60405180910390f35b6106c06117be565b005b6106dc60048036038101906106d79190613bfc565b6117e3565b6040516106e99190612fb0565b60405180910390f35b61070c60048036038101906107079190613c3c565b611877565b005b61072860048036038101906107239190612fcb565b61191f565b005b610744600480360381019061073f9190612fcb565b6119a5565b005b600080600083815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60006107ab82611a3f565b9050919050565b6107ba611ab9565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507faaa6f69bc76110b2804f7b88baa48f63b68d33979a039065d90d1cf8488d6921816040516108419190613957565b60405180910390a150565b610854611ab9565b61085e8282611b40565b5050565b6060600c805461087190613d02565b80601f016020809104026020016040519081016040528092919081815260200182805461089d90613d02565b80156108ea5780601f106108bf576101008083540402835291602001916108ea565b820191906000526020600020905b8154815290600101906020018083116108cd57829003601f168201915b5050505050905090565b6060600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630b63fd6230846040518363ffffffff1660e01b81526004016109539291906131aa565b600060405180830381865afa158015610970573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906109999190613da3565b9050919050565b600b60009054906101000a900460ff1681565b6000600a546009546109c59190613e1b565b905090565b60076020528060005260406000206000915054906101000a900460ff1681565b6109f2611ab9565b6001600560156101000a81548160ff021916908315150217905550565b6000806000600460008681526020019081526020016000206040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff166bffffffffffffffffffffffff16815250509050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1603610ba45760036040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff166bffffffffffffffffffffffff168152505090505b6000610bae611ce2565b6bffffffffffffffffffffffff1682602001516bffffffffffffffffffffffff1686610bda9190613e4f565b610be49190613ec0565b90508160000151819350935050509250929050565b6000610c03611cec565b90508073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614158015610c485750610c4686826117e3565b155b15610c8c5780866040517fe237d922000000000000000000000000000000000000000000000000000000008152600401610c83929190613ef1565b60405180910390fd5b610c998686868686611cf4565b505050505050565b610ca9611ab9565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f2f91b591fc56ac0917953ad01ec225524ee5ef0555213e4c8a9d8c9728ee7ffb81604051610d309190613957565b60405180910390a150565b610d43611ab9565b80600b60006101000a81548160ff0219169083151502179055507f203a216dffc18723de0cd43c6fe2c8dfb542b42f35fc1b295d2991fc92ea8bab81604051610d8c9190612fb0565b60405180910390a150565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610e23576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e1a90613f8c565b60405180910390fd5b60001515600560159054906101000a900460ff16151514610e79576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7090613ff8565b60405180910390fd5b610e84838383611dec565b6000805b8251811015610ec657828181518110610ea457610ea3614018565b5b602002602001015182610eb79190614047565b91508080600101915050610e88565b5080600a6000828254610ed99190614047565b9250508190555050505050565b60001515600e60009054906101000a900460ff16151514610f3c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f33906140c7565b60405180910390fd5b610f4533611e80565b610f4f8686611b40565b83600c9081610f5e9190614289565b5082600d9081610f6e9190614289565b5081600b60006101000a81548160ff02191690831515021790555080600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600e60006101000a81548160ff021916908315150217905550505050505050565b6060815183511461103957815183516040517f5b05999100000000000000000000000000000000000000000000000000000000815260040161103092919061435b565b60405180910390fd5b6000835167ffffffffffffffff811115611056576110556131d8565b5b6040519080825280602002602001820160405280156110845781602001602082028036833780820191505090505b50905060005b84518110156110eb576110c16110a98287611f4690919063ffffffff16565b6110bc8387611f5a90919063ffffffff16565b610746565b8282815181106110d4576110d3614018565b5b60200260200101818152505080600101905061108a565b508091505092915050565b6040518060400160405280600581526020017f312e302e3000000000000000000000000000000000000000000000000000000081525081565b611137611ab9565b611142838383611f6e565b505050565b61114f611ab9565b6111596000611e80565b565b611163611ab9565b60001515600560169054906101000a900460ff161515146111b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111b0906143d0565b60405180910390fd5b80600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60066020528060005260406000206000915054906101000a900460ff1681565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600d805461125690613d02565b80601f016020809104026020016040519081016040528092919081815260200182805461128290613d02565b80156112cf5780601f106112a4576101008083540402835291602001916112cf565b820191906000526020600020905b8154815290600101906020018083116112b257829003601f168201915b5050505050905090565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611365576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135c90614462565b60405180910390fd5b60001515600560149054906101000a900460ff161515146113bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113b2906144ce565b60405180910390fd5b6113d683838360405180602001604052806000815250612126565b6000805b8251811015611418578281815181106113f6576113f5614018565b5b6020026020010151826114099190614047565b915080806001019150506113da565b50806009600082825461142b9190614047565b9250508190555050505050565b611440611ab9565b6001600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f16baa937b08d58713325f93ac58b8a9369a4359bbefb4957d6d9b402735722ab816040516114c79190613957565b60405180910390a150565b6114da611ab9565b6001600560166101000a81548160ff021916908315150217905550565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61152f611528611cec565b83836121ac565b5050565b60095481565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166115c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115bc90614462565b60405180910390fd5b60001515600560149054906101000a900460ff1615151461161b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611612906144ce565b60405180910390fd5b6000805b82518110156117285761169d83828151811061163e5761163d614018565b5b60200260200101516000015184838151811061165d5761165c614018565b5b60200260200101516020015185848151811061167c5761167b614018565b5b60200260200101516040015160405180602001604052806000815250612126565b60005b8382815181106116b3576116b2614018565b5b6020026020010151604001515181101561171a578382815181106116da576116d9614018565b5b60200260200101516040015181815181106116f8576116f7614018565b5b60200260200101518361170b9190614047565b925080806001019150506116a0565b50808060010191505061161f565b50806009600082825461173b9190614047565b925050819055505050565b600560159054906101000a900460ff1681565b6040518060400160405280600881526020017f4552432d3131353500000000000000000000000000000000000000000000000081525081565b600560169054906101000a900460ff1681565b600a5481565b600560149054906101000a900460ff1681565b6117c6611ab9565b6001600560146101000a81548160ff021916908315150217905550565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6000611881611cec565b90508073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141580156118c657506118c486826117e3565b155b1561190a5780866040517fe237d922000000000000000000000000000000000000000000000000000000008152600401611901929190613ef1565b60405180910390fd5b611917868686868661231c565b505050505050565b611927611ab9565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036119995760006040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081526004016119909190613957565b60405180910390fd5b6119a281611e80565b50565b6119ad611ab9565b6001600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f2a85edc5fabdd9bbaa6d309617215d5b6905e0ed8a48d656d86fc9863e3c4b7781604051611a349190613957565b60405180910390a150565b60007f2a55205a000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611ab25750611ab182612427565b5b9050919050565b611ac1611cec565b73ffffffffffffffffffffffffffffffffffffffff16611adf61121d565b73ffffffffffffffffffffffffffffffffffffffff1614611b3e57611b02611cec565b6040517f118cdaa7000000000000000000000000000000000000000000000000000000008152600401611b359190613957565b60405180910390fd5b565b6000611b4a611ce2565b6bffffffffffffffffffffffff16905080826bffffffffffffffffffffffff161115611baf5781816040517f6f483d09000000000000000000000000000000000000000000000000000000008152600401611ba692919061451f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611c215760006040517fb6d9900a000000000000000000000000000000000000000000000000000000008152600401611c189190613957565b60405180910390fd5b60405180604001604052808473ffffffffffffffffffffffffffffffffffffffff168152602001836bffffffffffffffffffffffff16815250600360008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff160217905550905050505050565b6000612710905090565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603611d665760006040517f57f447ce000000000000000000000000000000000000000000000000000000008152600401611d5d9190613957565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1603611dd85760006040517f01a83514000000000000000000000000000000000000000000000000000000008152600401611dcf9190613957565b60405180910390fd5b611de58585858585612509565b5050505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611e5e5760006040517f01a83514000000000000000000000000000000000000000000000000000000008152600401611e559190613957565b60405180910390fd5b611e7b836000848460405180602001604052806000815250612509565b505050565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600060208202602084010151905092915050565b600060208202602084010151905092915050565b6000611f78611ce2565b6bffffffffffffffffffffffff16905080826bffffffffffffffffffffffff161115611fdf578382826040517fdfd1fc1b000000000000000000000000000000000000000000000000000000008152600401611fd693929190614548565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603612053578360006040517f969f085200000000000000000000000000000000000000000000000000000000815260040161204a92919061457f565b60405180910390fd5b60405180604001604052808473ffffffffffffffffffffffffffffffffffffffff168152602001836bffffffffffffffffffffffff168152506004600086815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff16021790555090505050505050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036121985760006040517f57f447ce00000000000000000000000000000000000000000000000000000000815260040161218f9190613957565b60405180910390fd5b6121a6600085858585612509565b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361221e5760006040517fced3e1000000000000000000000000000000000000000000000000000000000081526004016122159190613957565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405161230f9190612fb0565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff160361238e5760006040517f57f447ce0000000000000000000000000000000000000000000000000000000081526004016123859190613957565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16036124005760006040517f01a835140000000000000000000000000000000000000000000000000000000081526004016123f79190613957565b60405180910390fd5b60008061240d85856125bb565b9150915061241e8787848487612509565b50505050505050565b60007fd9b67a26000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806124f257507f0e89341c000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806125025750612501826125eb565b5b9050919050565b61251585858585612655565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16146125b4576000612553611cec565b905060018451036125a3576000612574600086611f5a90919063ffffffff16565b9050600061258c600086611f5a90919063ffffffff16565b905061259c8389898585896126ee565b50506125b2565b6125b18187878787876128a2565b5b505b5050505050565b60608060405191506001825283602083015260408201905060018152826020820152604081016040529250929050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148061269d5750600b60009054906101000a900460ff16155b6126dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126d39061461a565b60405180910390fd5b6126e884848484612a56565b50505050565b60008473ffffffffffffffffffffffffffffffffffffffff163b111561289a578373ffffffffffffffffffffffffffffffffffffffff1663f23a6e6187878686866040518663ffffffff1660e01b815260040161274f95949392919061468f565b6020604051808303816000875af192505050801561278b57506040513d601f19601f8201168201806040525081019061278891906146fe565b60015b61280f573d80600081146127bb576040519150601f19603f3d011682016040523d82523d6000602084013e6127c0565b606091505b50600081510361280757846040517f57f447ce0000000000000000000000000000000000000000000000000000000081526004016127fe9190613957565b60405180910390fd5b805181602001fd5b63f23a6e6160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161461289857846040517f57f447ce00000000000000000000000000000000000000000000000000000000815260040161288f9190613957565b60405180910390fd5b505b505050505050565b60008473ffffffffffffffffffffffffffffffffffffffff163b1115612a4e578373ffffffffffffffffffffffffffffffffffffffff1663bc197c8187878686866040518663ffffffff1660e01b815260040161290395949392919061472b565b6020604051808303816000875af192505050801561293f57506040513d601f19601f8201168201806040525081019061293c91906146fe565b60015b6129c3573d806000811461296f576040519150601f19603f3d011682016040523d82523d6000602084013e612974565b606091505b5060008151036129bb57846040517f57f447ce0000000000000000000000000000000000000000000000000000000081526004016129b29190613957565b60405180910390fd5b805181602001fd5b63bc197c8160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614612a4c57846040517f57f447ce000000000000000000000000000000000000000000000000000000008152600401612a439190613957565b60405180910390fd5b505b505050505050565b8051825114612aa057815181516040517f5b059991000000000000000000000000000000000000000000000000000000008152600401612a9792919061435b565b60405180910390fd5b6000612aaa611cec565b905060005b8351811015612cb9576000612acd8286611f5a90919063ffffffff16565b90506000612ae48386611f5a90919063ffffffff16565b9050600073ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff1614612c1157600080600084815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015612bb957888183856040517f03dee4c5000000000000000000000000000000000000000000000000000000008152600401612bb09493929190614793565b60405180910390fd5b81810360008085815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505b600073ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff1614612cac578060008084815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612ca49190614047565b925050819055505b5050806001019050612aaf565b506001835103612d78576000612cd9600085611f5a90919063ffffffff16565b90506000612cf1600085611f5a90919063ffffffff16565b90508573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628585604051612d6992919061435b565b60405180910390a45050612df7565b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8686604051612dee9291906147d8565b60405180910390a45b5050505050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612e3d82612e12565b9050919050565b612e4d81612e32565b8114612e5857600080fd5b50565b600081359050612e6a81612e44565b92915050565b6000819050919050565b612e8381612e70565b8114612e8e57600080fd5b50565b600081359050612ea081612e7a565b92915050565b60008060408385031215612ebd57612ebc612e08565b5b6000612ecb85828601612e5b565b9250506020612edc85828601612e91565b9150509250929050565b612eef81612e70565b82525050565b6000602082019050612f0a6000830184612ee6565b92915050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b612f4581612f10565b8114612f5057600080fd5b50565b600081359050612f6281612f3c565b92915050565b600060208284031215612f7e57612f7d612e08565b5b6000612f8c84828501612f53565b91505092915050565b60008115159050919050565b612faa81612f95565b82525050565b6000602082019050612fc56000830184612fa1565b92915050565b600060208284031215612fe157612fe0612e08565b5b6000612fef84828501612e5b565b91505092915050565b60006bffffffffffffffffffffffff82169050919050565b61301981612ff8565b811461302457600080fd5b50565b60008135905061303681613010565b92915050565b6000806040838503121561305357613052612e08565b5b600061306185828601612e5b565b925050602061307285828601613027565b9150509250929050565b600081519050919050565b600082825260208201905092915050565b60005b838110156130b657808201518184015260208101905061309b565b60008484015250505050565b6000601f19601f8301169050919050565b60006130de8261307c565b6130e88185613087565b93506130f8818560208601613098565b613101816130c2565b840191505092915050565b6000602082019050818103600083015261312681846130d3565b905092915050565b60006020828403121561314457613143612e08565b5b600061315284828501612e91565b91505092915050565b6000806040838503121561317257613171612e08565b5b600061318085828601612e91565b925050602061319185828601612e91565b9150509250929050565b6131a481612e32565b82525050565b60006040820190506131bf600083018561319b565b6131cc6020830184612ee6565b9392505050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b613210826130c2565b810181811067ffffffffffffffff8211171561322f5761322e6131d8565b5b80604052505050565b6000613242612dfe565b905061324e8282613207565b919050565b600067ffffffffffffffff82111561326e5761326d6131d8565b5b602082029050602081019050919050565b600080fd5b600061329761329284613253565b613238565b905080838252602082019050602084028301858111156132ba576132b961327f565b5b835b818110156132e357806132cf8882612e91565b8452602084019350506020810190506132bc565b5050509392505050565b600082601f830112613302576133016131d3565b5b8135613312848260208601613284565b91505092915050565b600080fd5b600067ffffffffffffffff82111561333b5761333a6131d8565b5b613344826130c2565b9050602081019050919050565b82818337600083830152505050565b600061337361336e84613320565b613238565b90508281526020810184848401111561338f5761338e61331b565b5b61339a848285613351565b509392505050565b600082601f8301126133b7576133b66131d3565b5b81356133c7848260208601613360565b91505092915050565b600080600080600060a086880312156133ec576133eb612e08565b5b60006133fa88828901612e5b565b955050602061340b88828901612e5b565b945050604086013567ffffffffffffffff81111561342c5761342b612e0d565b5b613438888289016132ed565b935050606086013567ffffffffffffffff81111561345957613458612e0d565b5b613465888289016132ed565b925050608086013567ffffffffffffffff81111561348657613485612e0d565b5b613492888289016133a2565b9150509295509295909350565b6134a881612f95565b81146134b357600080fd5b50565b6000813590506134c58161349f565b92915050565b6000602082840312156134e1576134e0612e08565b5b60006134ef848285016134b6565b91505092915050565b60008060006060848603121561351157613510612e08565b5b600061351f86828701612e5b565b935050602084013567ffffffffffffffff8111156135405761353f612e0d565b5b61354c868287016132ed565b925050604084013567ffffffffffffffff81111561356d5761356c612e0d565b5b613579868287016132ed565b9150509250925092565b600067ffffffffffffffff82111561359e5761359d6131d8565b5b6135a7826130c2565b9050602081019050919050565b60006135c76135c284613583565b613238565b9050828152602081018484840111156135e3576135e261331b565b5b6135ee848285613351565b509392505050565b600082601f83011261360b5761360a6131d3565b5b813561361b8482602086016135b4565b91505092915050565b60008060008060008060c0878903121561364157613640612e08565b5b600061364f89828a01612e5b565b965050602061366089828a01613027565b955050604087013567ffffffffffffffff81111561368157613680612e0d565b5b61368d89828a016135f6565b945050606087013567ffffffffffffffff8111156136ae576136ad612e0d565b5b6136ba89828a016135f6565b93505060806136cb89828a016134b6565b92505060a06136dc89828a01612e5b565b9150509295509295509295565b600067ffffffffffffffff821115613704576137036131d8565b5b602082029050602081019050919050565b6000613728613723846136e9565b613238565b9050808382526020820190506020840283018581111561374b5761374a61327f565b5b835b8181101561377457806137608882612e5b565b84526020840193505060208101905061374d565b5050509392505050565b600082601f830112613793576137926131d3565b5b81356137a3848260208601613715565b91505092915050565b600080604083850312156137c3576137c2612e08565b5b600083013567ffffffffffffffff8111156137e1576137e0612e0d565b5b6137ed8582860161377e565b925050602083013567ffffffffffffffff81111561380e5761380d612e0d565b5b61381a858286016132ed565b9150509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61385981612e70565b82525050565b600061386b8383613850565b60208301905092915050565b6000602082019050919050565b600061388f82613824565b613899818561382f565b93506138a483613840565b8060005b838110156138d55781516138bc888261385f565b97506138c783613877565b9250506001810190506138a8565b5085935050505092915050565b600060208201905081810360008301526138fc8184613884565b905092915050565b60008060006060848603121561391d5761391c612e08565b5b600061392b86828701612e91565b935050602061393c86828701612e5b565b925050604061394d86828701613027565b9150509250925092565b600060208201905061396c600083018461319b565b92915050565b6000819050919050565b600061399761399261398d84612e12565b613972565b612e12565b9050919050565b60006139a98261397c565b9050919050565b60006139bb8261399e565b9050919050565b6139cb816139b0565b82525050565b60006020820190506139e660008301846139c2565b92915050565b60008060408385031215613a0357613a02612e08565b5b6000613a1185828601612e5b565b9250506020613a22858286016134b6565b9150509250929050565b600067ffffffffffffffff821115613a4757613a466131d8565b5b602082029050602081019050919050565b600080fd5b600080fd5b600060608284031215613a7857613a77613a58565b5b613a826060613238565b90506000613a9284828501612e5b565b600083015250602082013567ffffffffffffffff811115613ab657613ab5613a5d565b5b613ac2848285016132ed565b602083015250604082013567ffffffffffffffff811115613ae657613ae5613a5d565b5b613af2848285016132ed565b60408301525092915050565b6000613b11613b0c84613a2c565b613238565b90508083825260208201905060208402830185811115613b3457613b3361327f565b5b835b81811015613b7b57803567ffffffffffffffff811115613b5957613b586131d3565b5b808601613b668982613a62565b85526020850194505050602081019050613b36565b5050509392505050565b600082601f830112613b9a57613b996131d3565b5b8135613baa848260208601613afe565b91505092915050565b600060208284031215613bc957613bc8612e08565b5b600082013567ffffffffffffffff811115613be757613be6612e0d565b5b613bf384828501613b85565b91505092915050565b60008060408385031215613c1357613c12612e08565b5b6000613c2185828601612e5b565b9250506020613c3285828601612e5b565b9150509250929050565b600080600080600060a08688031215613c5857613c57612e08565b5b6000613c6688828901612e5b565b9550506020613c7788828901612e5b565b9450506040613c8888828901612e91565b9350506060613c9988828901612e91565b925050608086013567ffffffffffffffff811115613cba57613cb9612e0d565b5b613cc6888289016133a2565b9150509295509295909350565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680613d1a57607f821691505b602082108103613d2d57613d2c613cd3565b5b50919050565b6000613d46613d4184613583565b613238565b905082815260208101848484011115613d6257613d6161331b565b5b613d6d848285613098565b509392505050565b600082601f830112613d8a57613d896131d3565b5b8151613d9a848260208601613d33565b91505092915050565b600060208284031215613db957613db8612e08565b5b600082015167ffffffffffffffff811115613dd757613dd6612e0d565b5b613de384828501613d75565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000613e2682612e70565b9150613e3183612e70565b9250828203905081811115613e4957613e48613dec565b5b92915050565b6000613e5a82612e70565b9150613e6583612e70565b9250828202613e7381612e70565b91508282048414831517613e8a57613e89613dec565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613ecb82612e70565b9150613ed683612e70565b925082613ee657613ee5613e91565b5b828204905092915050565b6000604082019050613f06600083018561319b565b613f13602083018461319b565b9392505050565b7f50726f7465637465644d696e744275726e3a2063616c6c6572206973206e6f7460008201527f2061206275726e65720000000000000000000000000000000000000000000000602082015250565b6000613f76602983613087565b9150613f8182613f1a565b604082019050919050565b60006020820190508181036000830152613fa581613f69565b9050919050565b7f4c6f636b61626c653a206275726e206973206c6f636b65640000000000000000600082015250565b6000613fe2601883613087565b9150613fed82613fac565b602082019050919050565b6000602082019050818103600083015261401181613fd5565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600061405282612e70565b915061405d83612e70565b925082820190508082111561407557614074613dec565b5b92915050565b7f436f6e747261637420616c726561647920696e697469616c697a65642e000000600082015250565b60006140b1601d83613087565b91506140bc8261407b565b602082019050919050565b600060208201905081810360008301526140e0816140a4565b9050919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026141497fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8261410c565b614153868361410c565b95508019841693508086168417925050509392505050565b600061418661418161417c84612e70565b613972565b612e70565b9050919050565b6000819050919050565b6141a08361416b565b6141b46141ac8261418d565b848454614119565b825550505050565b600090565b6141c96141bc565b6141d4818484614197565b505050565b5b818110156141f8576141ed6000826141c1565b6001810190506141da565b5050565b601f82111561423d5761420e816140e7565b614217846140fc565b81016020851015614226578190505b61423a614232856140fc565b8301826141d9565b50505b505050565b600082821c905092915050565b600061426060001984600802614242565b1980831691505092915050565b6000614279838361424f565b9150826002028217905092915050565b6142928261307c565b67ffffffffffffffff8111156142ab576142aa6131d8565b5b6142b58254613d02565b6142c08282856141fc565b600060209050601f8311600181146142f357600084156142e1578287015190505b6142eb858261426d565b865550614353565b601f198416614301866140e7565b60005b8281101561432957848901518255600182019150602085019450602081019050614304565b868310156143465784890151614342601f89168261424f565b8355505b6001600288020188555050505b505050505050565b60006040820190506143706000830185612ee6565b61437d6020830184612ee6565b9392505050565b7f4c6f636b61626c653a206d65746164617461206973206c6f636b656400000000600082015250565b60006143ba601c83613087565b91506143c582614384565b602082019050919050565b600060208201905081810360008301526143e9816143ad565b9050919050565b7f50726f7465637465644d696e744275726e3a2063616c6c6572206973206e6f7460008201527f2061206d696e7465720000000000000000000000000000000000000000000000602082015250565b600061444c602983613087565b9150614457826143f0565b604082019050919050565b6000602082019050818103600083015261447b8161443f565b9050919050565b7f4c6f636b61626c653a206d696e74206973206c6f636b65640000000000000000600082015250565b60006144b8601883613087565b91506144c382614482565b602082019050919050565b600060208201905081810360008301526144e7816144ab565b9050919050565b60006145096145046144ff84612ff8565b613972565b612e70565b9050919050565b614519816144ee565b82525050565b60006040820190506145346000830185614510565b6145416020830184612ee6565b9392505050565b600060608201905061455d6000830186612ee6565b61456a6020830185614510565b6145776040830184612ee6565b949350505050565b60006040820190506145946000830185612ee6565b6145a1602083018461319b565b9392505050565b7f54686520746f6b656e2063616e206e6f74206265207472616e7366657272656460008201527f20617420746869732074696d652e000000000000000000000000000000000000602082015250565b6000614604602e83613087565b915061460f826145a8565b604082019050919050565b60006020820190508181036000830152614633816145f7565b9050919050565b600081519050919050565b600082825260208201905092915050565b60006146618261463a565b61466b8185614645565b935061467b818560208601613098565b614684816130c2565b840191505092915050565b600060a0820190506146a4600083018861319b565b6146b1602083018761319b565b6146be6040830186612ee6565b6146cb6060830185612ee6565b81810360808301526146dd8184614656565b90509695505050505050565b6000815190506146f881612f3c565b92915050565b60006020828403121561471457614713612e08565b5b6000614722848285016146e9565b91505092915050565b600060a082019050614740600083018861319b565b61474d602083018761319b565b818103604083015261475f8186613884565b905081810360608301526147738185613884565b905081810360808301526147878184614656565b90509695505050505050565b60006080820190506147a8600083018761319b565b6147b56020830186612ee6565b6147c26040830185612ee6565b6147cf6060830184612ee6565b95945050505050565b600060408201905081810360008301526147f28185613884565b905081810360208301526148068184613884565b9050939250505056fea26469706673582212207eae19ede1839808c3b3404f87c2b63f0743e4a5491c0b39df10e6c8dbe9dc5664736f6c63430008180033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102525760003560e01c80637995c1e411610146578063bc3ba856116100c3578063df10580a11610087578063df10580a1461069a578063e0b6bb67146106b8578063e985e9c5146106c2578063f242432a146106f2578063f2fde38b1461070e578063f44637ba1461072a57610252565b8063bc3ba85614610606578063bd3c996b14610622578063cb2ef6f714610640578063d7e45cd71461065e578063d89135cd1461067c57610252565b8063983b2d561161010a578063983b2d5614610588578063989bdbb6146105a4578063a0c76f62146105ae578063a22cb465146105cc578063a2309ff8146105e857610252565b80637995c1e4146104e45780638b78f0ef146105005780638da5cb5b1461053057806395d89b411461054e5780639727756a1461056c57610252565b80632a55205a116101d45780634b700fc3116101985780634b700fc3146104545780634e1273f41461047057806354fd4d50146104a05780635944c753146104be578063715018a6146104da57610252565b80632a55205a146103b35780632eb2c2d6146103e45780633092afd51461040057806335e60bd41461041c5780633db0f8ab1461043857610252565b80630e89341c1161021b5780630e89341c1461030d57806312686aae1461033d57806318160ddd1461035b5780631a2f459f146103795780631aff0dba146103a957610252565b8062fdd58e1461025757806301ffc9a71461028757806302846858146102b757806304634d8d146102d357806306fdde03146102ef575b600080fd5b610271600480360381019061026c9190612ea6565b610746565b60405161027e9190612ef5565b60405180910390f35b6102a1600480360381019061029c9190612f68565b6107a0565b6040516102ae9190612fb0565b60405180910390f35b6102d160048036038101906102cc9190612fcb565b6107b2565b005b6102ed60048036038101906102e8919061303c565b61084c565b005b6102f7610862565b604051610304919061310c565b60405180910390f35b6103276004803603810190610322919061312e565b6108f4565b604051610334919061310c565b60405180910390f35b6103456109a0565b6040516103529190612fb0565b60405180910390f35b6103636109b3565b6040516103709190612ef5565b60405180910390f35b610393600480360381019061038e9190612fcb565b6109ca565b6040516103a09190612fb0565b60405180910390f35b6103b16109ea565b005b6103cd60048036038101906103c8919061315b565b610a0f565b6040516103db9291906131aa565b60405180910390f35b6103fe60048036038101906103f991906133d0565b610bf9565b005b61041a60048036038101906104159190612fcb565b610ca1565b005b610436600480360381019061043191906134cb565b610d3b565b005b610452600480360381019061044d91906134f8565b610d97565b005b61046e60048036038101906104699190613624565b610ee6565b005b61048a600480360381019061048591906137ac565b610fed565b60405161049791906138e2565b60405180910390f35b6104a86110f6565b6040516104b5919061310c565b60405180910390f35b6104d860048036038101906104d39190613904565b61112f565b005b6104e2611147565b005b6104fe60048036038101906104f99190612fcb565b61115b565b005b61051a60048036038101906105159190612fcb565b6111fd565b6040516105279190612fb0565b60405180910390f35b61053861121d565b6040516105459190613957565b60405180910390f35b610556611247565b604051610563919061310c565b60405180910390f35b610586600480360381019061058191906134f8565b6112d9565b005b6105a2600480360381019061059d9190612fcb565b611438565b005b6105ac6114d2565b005b6105b66114f7565b6040516105c391906139d1565b60405180910390f35b6105e660048036038101906105e191906139ec565b61151d565b005b6105f0611533565b6040516105fd9190612ef5565b60405180910390f35b610620600480360381019061061b9190613bb3565b611539565b005b61062a611746565b6040516106379190612fb0565b60405180910390f35b610648611759565b604051610655919061310c565b60405180910390f35b610666611792565b6040516106739190612fb0565b60405180910390f35b6106846117a5565b6040516106919190612ef5565b60405180910390f35b6106a26117ab565b6040516106af9190612fb0565b60405180910390f35b6106c06117be565b005b6106dc60048036038101906106d79190613bfc565b6117e3565b6040516106e99190612fb0565b60405180910390f35b61070c60048036038101906107079190613c3c565b611877565b005b61072860048036038101906107239190612fcb565b61191f565b005b610744600480360381019061073f9190612fcb565b6119a5565b005b600080600083815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60006107ab82611a3f565b9050919050565b6107ba611ab9565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507faaa6f69bc76110b2804f7b88baa48f63b68d33979a039065d90d1cf8488d6921816040516108419190613957565b60405180910390a150565b610854611ab9565b61085e8282611b40565b5050565b6060600c805461087190613d02565b80601f016020809104026020016040519081016040528092919081815260200182805461089d90613d02565b80156108ea5780601f106108bf576101008083540402835291602001916108ea565b820191906000526020600020905b8154815290600101906020018083116108cd57829003601f168201915b5050505050905090565b6060600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630b63fd6230846040518363ffffffff1660e01b81526004016109539291906131aa565b600060405180830381865afa158015610970573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906109999190613da3565b9050919050565b600b60009054906101000a900460ff1681565b6000600a546009546109c59190613e1b565b905090565b60076020528060005260406000206000915054906101000a900460ff1681565b6109f2611ab9565b6001600560156101000a81548160ff021916908315150217905550565b6000806000600460008681526020019081526020016000206040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff166bffffffffffffffffffffffff16815250509050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1603610ba45760036040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff166bffffffffffffffffffffffff168152505090505b6000610bae611ce2565b6bffffffffffffffffffffffff1682602001516bffffffffffffffffffffffff1686610bda9190613e4f565b610be49190613ec0565b90508160000151819350935050509250929050565b6000610c03611cec565b90508073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614158015610c485750610c4686826117e3565b155b15610c8c5780866040517fe237d922000000000000000000000000000000000000000000000000000000008152600401610c83929190613ef1565b60405180910390fd5b610c998686868686611cf4565b505050505050565b610ca9611ab9565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f2f91b591fc56ac0917953ad01ec225524ee5ef0555213e4c8a9d8c9728ee7ffb81604051610d309190613957565b60405180910390a150565b610d43611ab9565b80600b60006101000a81548160ff0219169083151502179055507f203a216dffc18723de0cd43c6fe2c8dfb542b42f35fc1b295d2991fc92ea8bab81604051610d8c9190612fb0565b60405180910390a150565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610e23576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e1a90613f8c565b60405180910390fd5b60001515600560159054906101000a900460ff16151514610e79576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7090613ff8565b60405180910390fd5b610e84838383611dec565b6000805b8251811015610ec657828181518110610ea457610ea3614018565b5b602002602001015182610eb79190614047565b91508080600101915050610e88565b5080600a6000828254610ed99190614047565b9250508190555050505050565b60001515600e60009054906101000a900460ff16151514610f3c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f33906140c7565b60405180910390fd5b610f4533611e80565b610f4f8686611b40565b83600c9081610f5e9190614289565b5082600d9081610f6e9190614289565b5081600b60006101000a81548160ff02191690831515021790555080600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600e60006101000a81548160ff021916908315150217905550505050505050565b6060815183511461103957815183516040517f5b05999100000000000000000000000000000000000000000000000000000000815260040161103092919061435b565b60405180910390fd5b6000835167ffffffffffffffff811115611056576110556131d8565b5b6040519080825280602002602001820160405280156110845781602001602082028036833780820191505090505b50905060005b84518110156110eb576110c16110a98287611f4690919063ffffffff16565b6110bc8387611f5a90919063ffffffff16565b610746565b8282815181106110d4576110d3614018565b5b60200260200101818152505080600101905061108a565b508091505092915050565b6040518060400160405280600581526020017f312e302e3000000000000000000000000000000000000000000000000000000081525081565b611137611ab9565b611142838383611f6e565b505050565b61114f611ab9565b6111596000611e80565b565b611163611ab9565b60001515600560169054906101000a900460ff161515146111b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111b0906143d0565b60405180910390fd5b80600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60066020528060005260406000206000915054906101000a900460ff1681565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600d805461125690613d02565b80601f016020809104026020016040519081016040528092919081815260200182805461128290613d02565b80156112cf5780601f106112a4576101008083540402835291602001916112cf565b820191906000526020600020905b8154815290600101906020018083116112b257829003601f168201915b5050505050905090565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611365576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135c90614462565b60405180910390fd5b60001515600560149054906101000a900460ff161515146113bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113b2906144ce565b60405180910390fd5b6113d683838360405180602001604052806000815250612126565b6000805b8251811015611418578281815181106113f6576113f5614018565b5b6020026020010151826114099190614047565b915080806001019150506113da565b50806009600082825461142b9190614047565b9250508190555050505050565b611440611ab9565b6001600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f16baa937b08d58713325f93ac58b8a9369a4359bbefb4957d6d9b402735722ab816040516114c79190613957565b60405180910390a150565b6114da611ab9565b6001600560166101000a81548160ff021916908315150217905550565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61152f611528611cec565b83836121ac565b5050565b60095481565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166115c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115bc90614462565b60405180910390fd5b60001515600560149054906101000a900460ff1615151461161b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611612906144ce565b60405180910390fd5b6000805b82518110156117285761169d83828151811061163e5761163d614018565b5b60200260200101516000015184838151811061165d5761165c614018565b5b60200260200101516020015185848151811061167c5761167b614018565b5b60200260200101516040015160405180602001604052806000815250612126565b60005b8382815181106116b3576116b2614018565b5b6020026020010151604001515181101561171a578382815181106116da576116d9614018565b5b60200260200101516040015181815181106116f8576116f7614018565b5b60200260200101518361170b9190614047565b925080806001019150506116a0565b50808060010191505061161f565b50806009600082825461173b9190614047565b925050819055505050565b600560159054906101000a900460ff1681565b6040518060400160405280600881526020017f4552432d3131353500000000000000000000000000000000000000000000000081525081565b600560169054906101000a900460ff1681565b600a5481565b600560149054906101000a900460ff1681565b6117c6611ab9565b6001600560146101000a81548160ff021916908315150217905550565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6000611881611cec565b90508073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141580156118c657506118c486826117e3565b155b1561190a5780866040517fe237d922000000000000000000000000000000000000000000000000000000008152600401611901929190613ef1565b60405180910390fd5b611917868686868661231c565b505050505050565b611927611ab9565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036119995760006040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081526004016119909190613957565b60405180910390fd5b6119a281611e80565b50565b6119ad611ab9565b6001600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f2a85edc5fabdd9bbaa6d309617215d5b6905e0ed8a48d656d86fc9863e3c4b7781604051611a349190613957565b60405180910390a150565b60007f2a55205a000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611ab25750611ab182612427565b5b9050919050565b611ac1611cec565b73ffffffffffffffffffffffffffffffffffffffff16611adf61121d565b73ffffffffffffffffffffffffffffffffffffffff1614611b3e57611b02611cec565b6040517f118cdaa7000000000000000000000000000000000000000000000000000000008152600401611b359190613957565b60405180910390fd5b565b6000611b4a611ce2565b6bffffffffffffffffffffffff16905080826bffffffffffffffffffffffff161115611baf5781816040517f6f483d09000000000000000000000000000000000000000000000000000000008152600401611ba692919061451f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611c215760006040517fb6d9900a000000000000000000000000000000000000000000000000000000008152600401611c189190613957565b60405180910390fd5b60405180604001604052808473ffffffffffffffffffffffffffffffffffffffff168152602001836bffffffffffffffffffffffff16815250600360008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff160217905550905050505050565b6000612710905090565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603611d665760006040517f57f447ce000000000000000000000000000000000000000000000000000000008152600401611d5d9190613957565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1603611dd85760006040517f01a83514000000000000000000000000000000000000000000000000000000008152600401611dcf9190613957565b60405180910390fd5b611de58585858585612509565b5050505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611e5e5760006040517f01a83514000000000000000000000000000000000000000000000000000000008152600401611e559190613957565b60405180910390fd5b611e7b836000848460405180602001604052806000815250612509565b505050565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600060208202602084010151905092915050565b600060208202602084010151905092915050565b6000611f78611ce2565b6bffffffffffffffffffffffff16905080826bffffffffffffffffffffffff161115611fdf578382826040517fdfd1fc1b000000000000000000000000000000000000000000000000000000008152600401611fd693929190614548565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603612053578360006040517f969f085200000000000000000000000000000000000000000000000000000000815260040161204a92919061457f565b60405180910390fd5b60405180604001604052808473ffffffffffffffffffffffffffffffffffffffff168152602001836bffffffffffffffffffffffff168152506004600086815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff16021790555090505050505050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036121985760006040517f57f447ce00000000000000000000000000000000000000000000000000000000815260040161218f9190613957565b60405180910390fd5b6121a6600085858585612509565b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361221e5760006040517fced3e1000000000000000000000000000000000000000000000000000000000081526004016122159190613957565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405161230f9190612fb0565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff160361238e5760006040517f57f447ce0000000000000000000000000000000000000000000000000000000081526004016123859190613957565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16036124005760006040517f01a835140000000000000000000000000000000000000000000000000000000081526004016123f79190613957565b60405180910390fd5b60008061240d85856125bb565b9150915061241e8787848487612509565b50505050505050565b60007fd9b67a26000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806124f257507f0e89341c000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806125025750612501826125eb565b5b9050919050565b61251585858585612655565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16146125b4576000612553611cec565b905060018451036125a3576000612574600086611f5a90919063ffffffff16565b9050600061258c600086611f5a90919063ffffffff16565b905061259c8389898585896126ee565b50506125b2565b6125b18187878787876128a2565b5b505b5050505050565b60608060405191506001825283602083015260408201905060018152826020820152604081016040529250929050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148061269d5750600b60009054906101000a900460ff16155b6126dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126d39061461a565b60405180910390fd5b6126e884848484612a56565b50505050565b60008473ffffffffffffffffffffffffffffffffffffffff163b111561289a578373ffffffffffffffffffffffffffffffffffffffff1663f23a6e6187878686866040518663ffffffff1660e01b815260040161274f95949392919061468f565b6020604051808303816000875af192505050801561278b57506040513d601f19601f8201168201806040525081019061278891906146fe565b60015b61280f573d80600081146127bb576040519150601f19603f3d011682016040523d82523d6000602084013e6127c0565b606091505b50600081510361280757846040517f57f447ce0000000000000000000000000000000000000000000000000000000081526004016127fe9190613957565b60405180910390fd5b805181602001fd5b63f23a6e6160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161461289857846040517f57f447ce00000000000000000000000000000000000000000000000000000000815260040161288f9190613957565b60405180910390fd5b505b505050505050565b60008473ffffffffffffffffffffffffffffffffffffffff163b1115612a4e578373ffffffffffffffffffffffffffffffffffffffff1663bc197c8187878686866040518663ffffffff1660e01b815260040161290395949392919061472b565b6020604051808303816000875af192505050801561293f57506040513d601f19601f8201168201806040525081019061293c91906146fe565b60015b6129c3573d806000811461296f576040519150601f19603f3d011682016040523d82523d6000602084013e612974565b606091505b5060008151036129bb57846040517f57f447ce0000000000000000000000000000000000000000000000000000000081526004016129b29190613957565b60405180910390fd5b805181602001fd5b63bc197c8160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614612a4c57846040517f57f447ce000000000000000000000000000000000000000000000000000000008152600401612a439190613957565b60405180910390fd5b505b505050505050565b8051825114612aa057815181516040517f5b059991000000000000000000000000000000000000000000000000000000008152600401612a9792919061435b565b60405180910390fd5b6000612aaa611cec565b905060005b8351811015612cb9576000612acd8286611f5a90919063ffffffff16565b90506000612ae48386611f5a90919063ffffffff16565b9050600073ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff1614612c1157600080600084815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015612bb957888183856040517f03dee4c5000000000000000000000000000000000000000000000000000000008152600401612bb09493929190614793565b60405180910390fd5b81810360008085815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505b600073ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff1614612cac578060008084815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612ca49190614047565b925050819055505b5050806001019050612aaf565b506001835103612d78576000612cd9600085611f5a90919063ffffffff16565b90506000612cf1600085611f5a90919063ffffffff16565b90508573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628585604051612d6992919061435b565b60405180910390a45050612df7565b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8686604051612dee9291906147d8565b60405180910390a45b5050505050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612e3d82612e12565b9050919050565b612e4d81612e32565b8114612e5857600080fd5b50565b600081359050612e6a81612e44565b92915050565b6000819050919050565b612e8381612e70565b8114612e8e57600080fd5b50565b600081359050612ea081612e7a565b92915050565b60008060408385031215612ebd57612ebc612e08565b5b6000612ecb85828601612e5b565b9250506020612edc85828601612e91565b9150509250929050565b612eef81612e70565b82525050565b6000602082019050612f0a6000830184612ee6565b92915050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b612f4581612f10565b8114612f5057600080fd5b50565b600081359050612f6281612f3c565b92915050565b600060208284031215612f7e57612f7d612e08565b5b6000612f8c84828501612f53565b91505092915050565b60008115159050919050565b612faa81612f95565b82525050565b6000602082019050612fc56000830184612fa1565b92915050565b600060208284031215612fe157612fe0612e08565b5b6000612fef84828501612e5b565b91505092915050565b60006bffffffffffffffffffffffff82169050919050565b61301981612ff8565b811461302457600080fd5b50565b60008135905061303681613010565b92915050565b6000806040838503121561305357613052612e08565b5b600061306185828601612e5b565b925050602061307285828601613027565b9150509250929050565b600081519050919050565b600082825260208201905092915050565b60005b838110156130b657808201518184015260208101905061309b565b60008484015250505050565b6000601f19601f8301169050919050565b60006130de8261307c565b6130e88185613087565b93506130f8818560208601613098565b613101816130c2565b840191505092915050565b6000602082019050818103600083015261312681846130d3565b905092915050565b60006020828403121561314457613143612e08565b5b600061315284828501612e91565b91505092915050565b6000806040838503121561317257613171612e08565b5b600061318085828601612e91565b925050602061319185828601612e91565b9150509250929050565b6131a481612e32565b82525050565b60006040820190506131bf600083018561319b565b6131cc6020830184612ee6565b9392505050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b613210826130c2565b810181811067ffffffffffffffff8211171561322f5761322e6131d8565b5b80604052505050565b6000613242612dfe565b905061324e8282613207565b919050565b600067ffffffffffffffff82111561326e5761326d6131d8565b5b602082029050602081019050919050565b600080fd5b600061329761329284613253565b613238565b905080838252602082019050602084028301858111156132ba576132b961327f565b5b835b818110156132e357806132cf8882612e91565b8452602084019350506020810190506132bc565b5050509392505050565b600082601f830112613302576133016131d3565b5b8135613312848260208601613284565b91505092915050565b600080fd5b600067ffffffffffffffff82111561333b5761333a6131d8565b5b613344826130c2565b9050602081019050919050565b82818337600083830152505050565b600061337361336e84613320565b613238565b90508281526020810184848401111561338f5761338e61331b565b5b61339a848285613351565b509392505050565b600082601f8301126133b7576133b66131d3565b5b81356133c7848260208601613360565b91505092915050565b600080600080600060a086880312156133ec576133eb612e08565b5b60006133fa88828901612e5b565b955050602061340b88828901612e5b565b945050604086013567ffffffffffffffff81111561342c5761342b612e0d565b5b613438888289016132ed565b935050606086013567ffffffffffffffff81111561345957613458612e0d565b5b613465888289016132ed565b925050608086013567ffffffffffffffff81111561348657613485612e0d565b5b613492888289016133a2565b9150509295509295909350565b6134a881612f95565b81146134b357600080fd5b50565b6000813590506134c58161349f565b92915050565b6000602082840312156134e1576134e0612e08565b5b60006134ef848285016134b6565b91505092915050565b60008060006060848603121561351157613510612e08565b5b600061351f86828701612e5b565b935050602084013567ffffffffffffffff8111156135405761353f612e0d565b5b61354c868287016132ed565b925050604084013567ffffffffffffffff81111561356d5761356c612e0d565b5b613579868287016132ed565b9150509250925092565b600067ffffffffffffffff82111561359e5761359d6131d8565b5b6135a7826130c2565b9050602081019050919050565b60006135c76135c284613583565b613238565b9050828152602081018484840111156135e3576135e261331b565b5b6135ee848285613351565b509392505050565b600082601f83011261360b5761360a6131d3565b5b813561361b8482602086016135b4565b91505092915050565b60008060008060008060c0878903121561364157613640612e08565b5b600061364f89828a01612e5b565b965050602061366089828a01613027565b955050604087013567ffffffffffffffff81111561368157613680612e0d565b5b61368d89828a016135f6565b945050606087013567ffffffffffffffff8111156136ae576136ad612e0d565b5b6136ba89828a016135f6565b93505060806136cb89828a016134b6565b92505060a06136dc89828a01612e5b565b9150509295509295509295565b600067ffffffffffffffff821115613704576137036131d8565b5b602082029050602081019050919050565b6000613728613723846136e9565b613238565b9050808382526020820190506020840283018581111561374b5761374a61327f565b5b835b8181101561377457806137608882612e5b565b84526020840193505060208101905061374d565b5050509392505050565b600082601f830112613793576137926131d3565b5b81356137a3848260208601613715565b91505092915050565b600080604083850312156137c3576137c2612e08565b5b600083013567ffffffffffffffff8111156137e1576137e0612e0d565b5b6137ed8582860161377e565b925050602083013567ffffffffffffffff81111561380e5761380d612e0d565b5b61381a858286016132ed565b9150509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61385981612e70565b82525050565b600061386b8383613850565b60208301905092915050565b6000602082019050919050565b600061388f82613824565b613899818561382f565b93506138a483613840565b8060005b838110156138d55781516138bc888261385f565b97506138c783613877565b9250506001810190506138a8565b5085935050505092915050565b600060208201905081810360008301526138fc8184613884565b905092915050565b60008060006060848603121561391d5761391c612e08565b5b600061392b86828701612e91565b935050602061393c86828701612e5b565b925050604061394d86828701613027565b9150509250925092565b600060208201905061396c600083018461319b565b92915050565b6000819050919050565b600061399761399261398d84612e12565b613972565b612e12565b9050919050565b60006139a98261397c565b9050919050565b60006139bb8261399e565b9050919050565b6139cb816139b0565b82525050565b60006020820190506139e660008301846139c2565b92915050565b60008060408385031215613a0357613a02612e08565b5b6000613a1185828601612e5b565b9250506020613a22858286016134b6565b9150509250929050565b600067ffffffffffffffff821115613a4757613a466131d8565b5b602082029050602081019050919050565b600080fd5b600080fd5b600060608284031215613a7857613a77613a58565b5b613a826060613238565b90506000613a9284828501612e5b565b600083015250602082013567ffffffffffffffff811115613ab657613ab5613a5d565b5b613ac2848285016132ed565b602083015250604082013567ffffffffffffffff811115613ae657613ae5613a5d565b5b613af2848285016132ed565b60408301525092915050565b6000613b11613b0c84613a2c565b613238565b90508083825260208201905060208402830185811115613b3457613b3361327f565b5b835b81811015613b7b57803567ffffffffffffffff811115613b5957613b586131d3565b5b808601613b668982613a62565b85526020850194505050602081019050613b36565b5050509392505050565b600082601f830112613b9a57613b996131d3565b5b8135613baa848260208601613afe565b91505092915050565b600060208284031215613bc957613bc8612e08565b5b600082013567ffffffffffffffff811115613be757613be6612e0d565b5b613bf384828501613b85565b91505092915050565b60008060408385031215613c1357613c12612e08565b5b6000613c2185828601612e5b565b9250506020613c3285828601612e5b565b9150509250929050565b600080600080600060a08688031215613c5857613c57612e08565b5b6000613c6688828901612e5b565b9550506020613c7788828901612e5b565b9450506040613c8888828901612e91565b9350506060613c9988828901612e91565b925050608086013567ffffffffffffffff811115613cba57613cb9612e0d565b5b613cc6888289016133a2565b9150509295509295909350565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680613d1a57607f821691505b602082108103613d2d57613d2c613cd3565b5b50919050565b6000613d46613d4184613583565b613238565b905082815260208101848484011115613d6257613d6161331b565b5b613d6d848285613098565b509392505050565b600082601f830112613d8a57613d896131d3565b5b8151613d9a848260208601613d33565b91505092915050565b600060208284031215613db957613db8612e08565b5b600082015167ffffffffffffffff811115613dd757613dd6612e0d565b5b613de384828501613d75565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000613e2682612e70565b9150613e3183612e70565b9250828203905081811115613e4957613e48613dec565b5b92915050565b6000613e5a82612e70565b9150613e6583612e70565b9250828202613e7381612e70565b91508282048414831517613e8a57613e89613dec565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613ecb82612e70565b9150613ed683612e70565b925082613ee657613ee5613e91565b5b828204905092915050565b6000604082019050613f06600083018561319b565b613f13602083018461319b565b9392505050565b7f50726f7465637465644d696e744275726e3a2063616c6c6572206973206e6f7460008201527f2061206275726e65720000000000000000000000000000000000000000000000602082015250565b6000613f76602983613087565b9150613f8182613f1a565b604082019050919050565b60006020820190508181036000830152613fa581613f69565b9050919050565b7f4c6f636b61626c653a206275726e206973206c6f636b65640000000000000000600082015250565b6000613fe2601883613087565b9150613fed82613fac565b602082019050919050565b6000602082019050818103600083015261401181613fd5565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600061405282612e70565b915061405d83612e70565b925082820190508082111561407557614074613dec565b5b92915050565b7f436f6e747261637420616c726561647920696e697469616c697a65642e000000600082015250565b60006140b1601d83613087565b91506140bc8261407b565b602082019050919050565b600060208201905081810360008301526140e0816140a4565b9050919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026141497fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8261410c565b614153868361410c565b95508019841693508086168417925050509392505050565b600061418661418161417c84612e70565b613972565b612e70565b9050919050565b6000819050919050565b6141a08361416b565b6141b46141ac8261418d565b848454614119565b825550505050565b600090565b6141c96141bc565b6141d4818484614197565b505050565b5b818110156141f8576141ed6000826141c1565b6001810190506141da565b5050565b601f82111561423d5761420e816140e7565b614217846140fc565b81016020851015614226578190505b61423a614232856140fc565b8301826141d9565b50505b505050565b600082821c905092915050565b600061426060001984600802614242565b1980831691505092915050565b6000614279838361424f565b9150826002028217905092915050565b6142928261307c565b67ffffffffffffffff8111156142ab576142aa6131d8565b5b6142b58254613d02565b6142c08282856141fc565b600060209050601f8311600181146142f357600084156142e1578287015190505b6142eb858261426d565b865550614353565b601f198416614301866140e7565b60005b8281101561432957848901518255600182019150602085019450602081019050614304565b868310156143465784890151614342601f89168261424f565b8355505b6001600288020188555050505b505050505050565b60006040820190506143706000830185612ee6565b61437d6020830184612ee6565b9392505050565b7f4c6f636b61626c653a206d65746164617461206973206c6f636b656400000000600082015250565b60006143ba601c83613087565b91506143c582614384565b602082019050919050565b600060208201905081810360008301526143e9816143ad565b9050919050565b7f50726f7465637465644d696e744275726e3a2063616c6c6572206973206e6f7460008201527f2061206d696e7465720000000000000000000000000000000000000000000000602082015250565b600061444c602983613087565b9150614457826143f0565b604082019050919050565b6000602082019050818103600083015261447b8161443f565b9050919050565b7f4c6f636b61626c653a206d696e74206973206c6f636b65640000000000000000600082015250565b60006144b8601883613087565b91506144c382614482565b602082019050919050565b600060208201905081810360008301526144e7816144ab565b9050919050565b60006145096145046144ff84612ff8565b613972565b612e70565b9050919050565b614519816144ee565b82525050565b60006040820190506145346000830185614510565b6145416020830184612ee6565b9392505050565b600060608201905061455d6000830186612ee6565b61456a6020830185614510565b6145776040830184612ee6565b949350505050565b60006040820190506145946000830185612ee6565b6145a1602083018461319b565b9392505050565b7f54686520746f6b656e2063616e206e6f74206265207472616e7366657272656460008201527f20617420746869732074696d652e000000000000000000000000000000000000602082015250565b6000614604602e83613087565b915061460f826145a8565b604082019050919050565b60006020820190508181036000830152614633816145f7565b9050919050565b600081519050919050565b600082825260208201905092915050565b60006146618261463a565b61466b8185614645565b935061467b818560208601613098565b614684816130c2565b840191505092915050565b600060a0820190506146a4600083018861319b565b6146b1602083018761319b565b6146be6040830186612ee6565b6146cb6060830185612ee6565b81810360808301526146dd8184614656565b90509695505050505050565b6000815190506146f881612f3c565b92915050565b60006020828403121561471457614713612e08565b5b6000614722848285016146e9565b91505092915050565b600060a082019050614740600083018861319b565b61474d602083018761319b565b818103604083015261475f8186613884565b905081810360608301526147738185613884565b905081810360808301526147878184614656565b90509695505050505050565b60006080820190506147a8600083018761319b565b6147b56020830186612ee6565b6147c26040830185612ee6565b6147cf6060830184612ee6565b95945050505050565b600060408201905081810360008301526147f28185613884565b905081810360208301526148068184613884565b9050939250505056fea26469706673582212207eae19ede1839808c3b3404f87c2b63f0743e4a5491c0b39df10e6c8dbe9dc5664736f6c63430008180033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.