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 | 4767038 | 26 hrs ago | IN | 0 APE | 0.09753219 |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
Base721
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 {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); } }
// 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 {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); } }
{ "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":"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":"sender","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"owner","type":"address"}],"name":"ERC721IncorrectOwner","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC721InsufficientApproval","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC721InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"ERC721InvalidOperator","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"ERC721InvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC721InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC721InvalidSender","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC721NonexistentToken","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":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":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":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"isTransferLocked","type":"bool"}],"name":"TransferLocked","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":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_addresses","type":"address[]"},{"internalType":"uint256[]","name":"_ids","type":"uint256[]"}],"name":"batchMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_ids","type":"uint256[]"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"contractType","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"exists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"owner","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[]"}],"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":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","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":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","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":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"tokenURI","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":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","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":[],"name":"version","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b5033604051806020016040528060008152506040518060200160405280600081525081600090816200004491906200047e565b5080600190816200005691906200047e565b505050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603620000ce5760006040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600401620000c59190620005aa565b60405180910390fd5b620000df816200013e60201b60201c565b506001600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550620005c7565b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200028657607f821691505b6020821081036200029c576200029b6200023e565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620003067fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82620002c7565b620003128683620002c7565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b60006200035f6200035962000353846200032a565b62000334565b6200032a565b9050919050565b6000819050919050565b6200037b836200033e565b620003936200038a8262000366565b848454620002d4565b825550505050565b600090565b620003aa6200039b565b620003b781848462000370565b505050565b5b81811015620003df57620003d3600082620003a0565b600181019050620003bd565b5050565b601f8211156200042e57620003f881620002a2565b6200040384620002b7565b8101602085101562000413578190505b6200042b6200042285620002b7565b830182620003bc565b50505b505050565b600082821c905092915050565b6000620004536000198460080262000433565b1980831691505092915050565b60006200046e838362000440565b9150826002028217905092915050565b620004898262000204565b67ffffffffffffffff811115620004a557620004a46200020f565b5b620004b182546200026d565b620004be828285620003e3565b600060209050601f831160018114620004f65760008415620004e1578287015190505b620004ed858262000460565b8655506200055d565b601f1984166200050686620002a2565b60005b82811015620005305784890151825560018201915060208501945060208101905062000509565b868310156200055057848901516200054c601f89168262000440565b8355505b6001600288020188555050505b505050505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620005928262000565565b9050919050565b620005a48162000585565b82525050565b6000602082019050620005c1600083018462000599565b92915050565b61435d80620005d76000396000f3fe608060405234801561001057600080fd5b506004361061027f5760003560e01c8063715018a61161015c578063b88d4fde116100ce578063de836ebd11610087578063de836ebd1461075f578063df10580a1461077b578063e0b6bb6714610799578063e985e9c5146107a3578063f2fde38b146107d3578063f44637ba146107ef5761027f565b8063b88d4fde1461069b578063bd3c996b146106b7578063c87b56dd146106d5578063cb2ef6f714610705578063d7e45cd714610723578063d89135cd146107415761027f565b8063983b2d5611610120578063983b2d5614610601578063989bdbb61461061d578063a0c76f6214610627578063a22cb46514610645578063a2309ff814610661578063b80f55c91461067f5761027f565b8063715018a61461056f5780637995c1e4146105795780638b78f0ef146105955780638da5cb5b146105c557806395d89b41146105e35761027f565b80632a55205a116101f55780634f558e79116101b95780634f558e791461048957806354fd4d50146104b95780635944c753146104d75780636352211e146104f3578063685731071461052357806370a082311461053f5761027f565b80632a55205a146103e85780633092afd51461041957806335e60bd41461043557806342842e0e146104515780634b700fc31461046d5761027f565b8063095ea7b311610247578063095ea7b31461033a57806312686aae1461035657806318160ddd146103745780631a2f459f146103925780631aff0dba146103c257806323b872dd146103cc5761027f565b806301ffc9a71461028457806302846858146102b457806304634d8d146102d057806306fdde03146102ec578063081812fc1461030a575b600080fd5b61029e60048036038101906102999190612d49565b61080b565b6040516102ab9190612d91565b60405180910390f35b6102ce60048036038101906102c99190612e0a565b61081d565b005b6102ea60048036038101906102e59190612e7b565b6108b7565b005b6102f46108cd565b6040516103019190612f4b565b60405180910390f35b610324600480360381019061031f9190612fa3565b61095f565b6040516103319190612fdf565b60405180910390f35b610354600480360381019061034f9190612ffa565b61097b565b005b61035e610991565b60405161036b9190612d91565b60405180910390f35b61037c6109a4565b6040516103899190613049565b60405180910390f35b6103ac60048036038101906103a79190612e0a565b6109bb565b6040516103b99190612d91565b60405180910390f35b6103ca6109db565b005b6103e660048036038101906103e19190613064565b610a00565b005b61040260048036038101906103fd91906130b7565b610b02565b6040516104109291906130f7565b60405180910390f35b610433600480360381019061042e9190612e0a565b610cec565b005b61044f600480360381019061044a919061314c565b610d86565b005b61046b60048036038101906104669190613064565b610de2565b005b610487600480360381019061048291906132ae565b610e02565b005b6104a3600480360381019061049e9190612fa3565b610f09565b6040516104b09190612d91565b60405180910390f35b6104c1610f4a565b6040516104ce9190612f4b565b60405180910390f35b6104f160048036038101906104ec9190613373565b610f83565b005b61050d60048036038101906105089190612fa3565b610f9b565b60405161051a9190612fdf565b60405180910390f35b61053d60048036038101906105389190613551565b610fad565b005b61055960048036038101906105549190612e0a565b611105565b6040516105669190613049565b60405180910390f35b6105776111bf565b005b610593600480360381019061058e9190612e0a565b6111d3565b005b6105af60048036038101906105aa9190612e0a565b611275565b6040516105bc9190612d91565b60405180910390f35b6105cd611295565b6040516105da9190612fdf565b60405180910390f35b6105eb6112bf565b6040516105f89190612f4b565b60405180910390f35b61061b60048036038101906106169190612e0a565b611351565b005b6106256113eb565b005b61062f611410565b60405161063c9190613628565b60405180910390f35b61065f600480360381019061065a9190613643565b611436565b005b61066961144c565b6040516106769190613049565b60405180910390f35b61069960048036038101906106949190613683565b611452565b005b6106b560048036038101906106b0919061376d565b61158e565b005b6106bf6115ab565b6040516106cc9190612d91565b60405180910390f35b6106ef60048036038101906106ea9190612fa3565b6115be565b6040516106fc9190612f4b565b60405180910390f35b61070d6116e1565b60405161071a9190612f4b565b60405180910390f35b61072b61171a565b6040516107389190612d91565b60405180910390f35b61074961172d565b6040516107569190613049565b60405180910390f35b610779600480360381019061077491906137f0565b611733565b005b610783611871565b6040516107909190612d91565b60405180910390f35b6107a1611884565b005b6107bd60048036038101906107b8919061384c565b6118a9565b6040516107ca9190612d91565b60405180910390f35b6107ed60048036038101906107e89190612e0a565b61193d565b005b61080960048036038101906108049190612e0a565b6119c3565b005b600061081682611a5d565b9050919050565b610825611ad7565b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507faaa6f69bc76110b2804f7b88baa48f63b68d33979a039065d90d1cf8488d6921816040516108ac9190612fdf565b60405180910390a150565b6108bf611ad7565b6108c98282611b5e565b5050565b6060600f80546108dc906138bb565b80601f0160208091040260200160405190810160405280929190818152602001828054610908906138bb565b80156109555780601f1061092a57610100808354040283529160200191610955565b820191906000526020600020905b81548152906001019060200180831161093857829003601f168201915b5050505050905090565b600061096a82611d00565b5061097482611d88565b9050919050565b61098d8282610988611dc5565b611dcd565b5050565b600e60009054906101000a900460ff1681565b6000600d54600c546109b6919061391b565b905090565b600a6020528060005260406000206000915054906101000a900460ff1681565b6109e3611ad7565b6001600860156101000a81548160ff021916908315150217905550565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610a725760006040517f64a0ae92000000000000000000000000000000000000000000000000000000008152600401610a699190612fdf565b60405180910390fd5b6000610a868383610a81611dc5565b611ddf565b90508373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610afc578382826040517f64283d7b000000000000000000000000000000000000000000000000000000008152600401610af39392919061394f565b60405180910390fd5b50505050565b6000806000600760008681526020019081526020016000206040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff166bffffffffffffffffffffffff16815250509050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1603610c975760066040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff166bffffffffffffffffffffffff168152505090505b6000610ca1611e89565b6bffffffffffffffffffffffff1682602001516bffffffffffffffffffffffff1686610ccd9190613986565b610cd791906139f7565b90508160000151819350935050509250929050565b610cf4611ad7565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f2f91b591fc56ac0917953ad01ec225524ee5ef0555213e4c8a9d8c9728ee7ffb81604051610d7b9190612fdf565b60405180910390a150565b610d8e611ad7565b80600e60006101000a81548160ff0219169083151502179055507f203a216dffc18723de0cd43c6fe2c8dfb542b42f35fc1b295d2991fc92ea8bab81604051610dd79190612d91565b60405180910390a150565b610dfd8383836040518060200160405280600081525061158e565b505050565b60001515601160009054906101000a900460ff16151514610e58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e4f90613a74565b60405180910390fd5b610e6133611e93565b610e6b8686611b5e565b83600f9081610e7a9190613c36565b508260109081610e8a9190613c36565b5081600e60006101000a81548160ff02191690831515021790555080600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001601160006101000a81548160ff021916908315150217905550505050505050565b60008073ffffffffffffffffffffffffffffffffffffffff16610f2b83611f59565b73ffffffffffffffffffffffffffffffffffffffff1614159050919050565b6040518060400160405280600581526020017f312e302e3000000000000000000000000000000000000000000000000000000081525081565b610f8b611ad7565b610f96838383611f96565b505050565b6000610fa682611d00565b9050919050565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611039576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161103090613d7a565b60405180910390fd5b60001515600860149054906101000a900460ff1615151461108f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161108690613de6565b60405180910390fd5b60005b81518110156110e6576110d98382815181106110b1576110b0613e06565b5b60200260200101518383815181106110cc576110cb613e06565b5b602002602001015161214e565b8080600101915050611092565b508051600c60008282546110fa9190613e35565b925050819055505050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036111785760006040517f89c62b6400000000000000000000000000000000000000000000000000000000815260040161116f9190612fdf565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6111c7611ad7565b6111d16000611e93565b565b6111db611ad7565b60001515600860169054906101000a900460ff16151514611231576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161122890613eb5565b60405180910390fd5b80600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60096020528060005260406000206000915054906101000a900460ff1681565b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060601080546112ce906138bb565b80601f01602080910402602001604051908101604052809291908181526020018280546112fa906138bb565b80156113475780601f1061131c57610100808354040283529160200191611347565b820191906000526020600020905b81548152906001019060200180831161132a57829003601f168201915b5050505050905090565b611359611ad7565b6001600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f16baa937b08d58713325f93ac58b8a9369a4359bbefb4957d6d9b402735722ab816040516113e09190612fdf565b60405180910390a150565b6113f3611ad7565b6001600860166101000a81548160ff021916908315150217905550565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b611448611441611dc5565b838361216c565b5050565b600c5481565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166114de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114d590613f47565b60405180910390fd5b60001515600860159054906101000a900460ff16151514611534576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152b90613fb3565b60405180910390fd5b60005b81518110156115705761156382828151811061155657611555613e06565b5b60200260200101516122db565b8080600101915050611537565b508051600d60008282546115849190613e35565b9250508190555050565b611599848484610a00565b6115a584848484612361565b50505050565b600860159054906101000a900460ff1681565b6060600073ffffffffffffffffffffffffffffffffffffffff166115e183611f59565b73ffffffffffffffffffffffffffffffffffffffff1603611637576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161162e9061401f565b60405180910390fd5b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630b63fd6230846040518363ffffffff1660e01b81526004016116949291906130f7565b600060405180830381865afa1580156116b1573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906116da91906140af565b9050919050565b6040518060400160405280600781526020017f4552432d3732310000000000000000000000000000000000000000000000000081525081565b600860169054906101000a900460ff1681565b600d5481565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166117bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117b690613d7a565b60405180910390fd5b60001515600860149054906101000a900460ff16151514611815576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161180c90613de6565b60405180910390fd5b60005b8151811015611852576118458383838151811061183857611837613e06565b5b602002602001015161214e565b8080600101915050611818565b508051600c60008282546118669190613e35565b925050819055505050565b600860149054906101000a900460ff1681565b61188c611ad7565b6001600860146101000a81548160ff021916908315150217905550565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b611945611ad7565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036119b75760006040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081526004016119ae9190612fdf565b60405180910390fd5b6119c081611e93565b50565b6119cb611ad7565b6001600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f2a85edc5fabdd9bbaa6d309617215d5b6905e0ed8a48d656d86fc9863e3c4b7781604051611a529190612fdf565b60405180910390a150565b60007f2a55205a000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611ad05750611acf82612518565b5b9050919050565b611adf611dc5565b73ffffffffffffffffffffffffffffffffffffffff16611afd611295565b73ffffffffffffffffffffffffffffffffffffffff1614611b5c57611b20611dc5565b6040517f118cdaa7000000000000000000000000000000000000000000000000000000008152600401611b539190612fdf565b60405180910390fd5b565b6000611b68611e89565b6bffffffffffffffffffffffff16905080826bffffffffffffffffffffffff161115611bcd5781816040517f6f483d09000000000000000000000000000000000000000000000000000000008152600401611bc4929190614129565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611c3f5760006040517fb6d9900a000000000000000000000000000000000000000000000000000000008152600401611c369190612fdf565b60405180910390fd5b60405180604001604052808473ffffffffffffffffffffffffffffffffffffffff168152602001836bffffffffffffffffffffffff16815250600660008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff160217905550905050505050565b600080611d0c83611f59565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611d7f57826040517f7e273289000000000000000000000000000000000000000000000000000000008152600401611d769190613049565b60405180910390fd5b80915050919050565b60006004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600033905090565b611dda83838360016125fa565b505050565b600080611deb84611f59565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161480611e355750600e60009054906101000a900460ff16155b611e74576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e6b906141c4565b60405180910390fd5b611e7f8585856127bf565b9150509392505050565b6000612710905090565b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60006002600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000611fa0611e89565b6bffffffffffffffffffffffff16905080826bffffffffffffffffffffffff161115612007578382826040517fdfd1fc1b000000000000000000000000000000000000000000000000000000008152600401611ffe939291906141e4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361207b578360006040517f969f085200000000000000000000000000000000000000000000000000000000815260040161207292919061421b565b60405180910390fd5b60405180604001604052808473ffffffffffffffffffffffffffffffffffffffff168152602001836bffffffffffffffffffffffff168152506007600086815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff16021790555090505050505050565b6121688282604051806020016040528060008152506129d9565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036121dd57816040517f5b08ba180000000000000000000000000000000000000000000000000000000081526004016121d49190612fdf565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516122ce9190612d91565b60405180910390a3505050565b60006122ea6000836000611ddf565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361235d57816040517f7e2732890000000000000000000000000000000000000000000000000000000081526004016123549190613049565b60405180910390fd5b5050565b60008373ffffffffffffffffffffffffffffffffffffffff163b1115612512578273ffffffffffffffffffffffffffffffffffffffff1663150b7a026123a5611dc5565b8685856040518563ffffffff1660e01b81526004016123c79493929190614299565b6020604051808303816000875af192505050801561240357506040513d601f19601f8201168201806040525081019061240091906142fa565b60015b612487573d8060008114612433576040519150601f19603f3d011682016040523d82523d6000602084013e612438565b606091505b50600081510361247f57836040517f64a0ae920000000000000000000000000000000000000000000000000000000081526004016124769190612fdf565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161461251057836040517f64a0ae920000000000000000000000000000000000000000000000000000000081526004016125079190612fdf565b60405180910390fd5b505b50505050565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806125e357507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806125f357506125f2826129f5565b5b9050919050565b80806126335750600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561276757600061264384611d00565b9050600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156126ae57508273ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b80156126c157506126bf81846118a9565b155b1561270357826040517fa9fbf51f0000000000000000000000000000000000000000000000000000000081526004016126fa9190612fdf565b60405180910390fd5b811561276557838573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45b505b836004600085815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050505050565b6000806127cb84611f59565b9050600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161461280d5761280c818486612a5f565b5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461289e5761284f6000856000806125fa565b6001600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614612921576001600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055505b846002600086815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550838573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4809150509392505050565b6129e38383612b23565b6129f06000848484612361565b505050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b612a6a838383612c1c565b612b1e57600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603612adf57806040517f7e273289000000000000000000000000000000000000000000000000000000008152600401612ad69190613049565b60405180910390fd5b81816040517f177e802f000000000000000000000000000000000000000000000000000000008152600401612b159291906130f7565b60405180910390fd5b505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603612b955760006040517f64a0ae92000000000000000000000000000000000000000000000000000000008152600401612b8c9190612fdf565b60405180910390fd5b6000612ba383836000611ddf565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614612c175760006040517f73c6ac6e000000000000000000000000000000000000000000000000000000008152600401612c0e9190612fdf565b60405180910390fd5b505050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015612cd457508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480612c955750612c9484846118a9565b5b80612cd357508273ffffffffffffffffffffffffffffffffffffffff16612cbb83611d88565b73ffffffffffffffffffffffffffffffffffffffff16145b5b90509392505050565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b612d2681612cf1565b8114612d3157600080fd5b50565b600081359050612d4381612d1d565b92915050565b600060208284031215612d5f57612d5e612ce7565b5b6000612d6d84828501612d34565b91505092915050565b60008115159050919050565b612d8b81612d76565b82525050565b6000602082019050612da66000830184612d82565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612dd782612dac565b9050919050565b612de781612dcc565b8114612df257600080fd5b50565b600081359050612e0481612dde565b92915050565b600060208284031215612e2057612e1f612ce7565b5b6000612e2e84828501612df5565b91505092915050565b60006bffffffffffffffffffffffff82169050919050565b612e5881612e37565b8114612e6357600080fd5b50565b600081359050612e7581612e4f565b92915050565b60008060408385031215612e9257612e91612ce7565b5b6000612ea085828601612df5565b9250506020612eb185828601612e66565b9150509250929050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612ef5578082015181840152602081019050612eda565b60008484015250505050565b6000601f19601f8301169050919050565b6000612f1d82612ebb565b612f278185612ec6565b9350612f37818560208601612ed7565b612f4081612f01565b840191505092915050565b60006020820190508181036000830152612f658184612f12565b905092915050565b6000819050919050565b612f8081612f6d565b8114612f8b57600080fd5b50565b600081359050612f9d81612f77565b92915050565b600060208284031215612fb957612fb8612ce7565b5b6000612fc784828501612f8e565b91505092915050565b612fd981612dcc565b82525050565b6000602082019050612ff46000830184612fd0565b92915050565b6000806040838503121561301157613010612ce7565b5b600061301f85828601612df5565b925050602061303085828601612f8e565b9150509250929050565b61304381612f6d565b82525050565b600060208201905061305e600083018461303a565b92915050565b60008060006060848603121561307d5761307c612ce7565b5b600061308b86828701612df5565b935050602061309c86828701612df5565b92505060406130ad86828701612f8e565b9150509250925092565b600080604083850312156130ce576130cd612ce7565b5b60006130dc85828601612f8e565b92505060206130ed85828601612f8e565b9150509250929050565b600060408201905061310c6000830185612fd0565b613119602083018461303a565b9392505050565b61312981612d76565b811461313457600080fd5b50565b60008135905061314681613120565b92915050565b60006020828403121561316257613161612ce7565b5b600061317084828501613137565b91505092915050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6131bb82612f01565b810181811067ffffffffffffffff821117156131da576131d9613183565b5b80604052505050565b60006131ed612cdd565b90506131f982826131b2565b919050565b600067ffffffffffffffff82111561321957613218613183565b5b61322282612f01565b9050602081019050919050565b82818337600083830152505050565b600061325161324c846131fe565b6131e3565b90508281526020810184848401111561326d5761326c61317e565b5b61327884828561322f565b509392505050565b600082601f83011261329557613294613179565b5b81356132a584826020860161323e565b91505092915050565b60008060008060008060c087890312156132cb576132ca612ce7565b5b60006132d989828a01612df5565b96505060206132ea89828a01612e66565b955050604087013567ffffffffffffffff81111561330b5761330a612cec565b5b61331789828a01613280565b945050606087013567ffffffffffffffff81111561333857613337612cec565b5b61334489828a01613280565b935050608061335589828a01613137565b92505060a061336689828a01612df5565b9150509295509295509295565b60008060006060848603121561338c5761338b612ce7565b5b600061339a86828701612f8e565b93505060206133ab86828701612df5565b92505060406133bc86828701612e66565b9150509250925092565b600067ffffffffffffffff8211156133e1576133e0613183565b5b602082029050602081019050919050565b600080fd5b600061340a613405846133c6565b6131e3565b9050808382526020820190506020840283018581111561342d5761342c6133f2565b5b835b8181101561345657806134428882612df5565b84526020840193505060208101905061342f565b5050509392505050565b600082601f83011261347557613474613179565b5b81356134858482602086016133f7565b91505092915050565b600067ffffffffffffffff8211156134a9576134a8613183565b5b602082029050602081019050919050565b60006134cd6134c88461348e565b6131e3565b905080838252602082019050602084028301858111156134f0576134ef6133f2565b5b835b8181101561351957806135058882612f8e565b8452602084019350506020810190506134f2565b5050509392505050565b600082601f83011261353857613537613179565b5b81356135488482602086016134ba565b91505092915050565b6000806040838503121561356857613567612ce7565b5b600083013567ffffffffffffffff81111561358657613585612cec565b5b61359285828601613460565b925050602083013567ffffffffffffffff8111156135b3576135b2612cec565b5b6135bf85828601613523565b9150509250929050565b6000819050919050565b60006135ee6135e96135e484612dac565b6135c9565b612dac565b9050919050565b6000613600826135d3565b9050919050565b6000613612826135f5565b9050919050565b61362281613607565b82525050565b600060208201905061363d6000830184613619565b92915050565b6000806040838503121561365a57613659612ce7565b5b600061366885828601612df5565b925050602061367985828601613137565b9150509250929050565b60006020828403121561369957613698612ce7565b5b600082013567ffffffffffffffff8111156136b7576136b6612cec565b5b6136c384828501613523565b91505092915050565b600067ffffffffffffffff8211156136e7576136e6613183565b5b6136f082612f01565b9050602081019050919050565b600061371061370b846136cc565b6131e3565b90508281526020810184848401111561372c5761372b61317e565b5b61373784828561322f565b509392505050565b600082601f83011261375457613753613179565b5b81356137648482602086016136fd565b91505092915050565b6000806000806080858703121561378757613786612ce7565b5b600061379587828801612df5565b94505060206137a687828801612df5565b93505060406137b787828801612f8e565b925050606085013567ffffffffffffffff8111156137d8576137d7612cec565b5b6137e48782880161373f565b91505092959194509250565b6000806040838503121561380757613806612ce7565b5b600061381585828601612df5565b925050602083013567ffffffffffffffff81111561383657613835612cec565b5b61384285828601613523565b9150509250929050565b6000806040838503121561386357613862612ce7565b5b600061387185828601612df5565b925050602061388285828601612df5565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806138d357607f821691505b6020821081036138e6576138e561388c565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061392682612f6d565b915061393183612f6d565b9250828203905081811115613949576139486138ec565b5b92915050565b60006060820190506139646000830186612fd0565b613971602083018561303a565b61397e6040830184612fd0565b949350505050565b600061399182612f6d565b915061399c83612f6d565b92508282026139aa81612f6d565b915082820484148315176139c1576139c06138ec565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613a0282612f6d565b9150613a0d83612f6d565b925082613a1d57613a1c6139c8565b5b828204905092915050565b7f436f6e747261637420616c726561647920696e697469616c697a65642e000000600082015250565b6000613a5e601d83612ec6565b9150613a6982613a28565b602082019050919050565b60006020820190508181036000830152613a8d81613a51565b9050919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302613af67fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82613ab9565b613b008683613ab9565b95508019841693508086168417925050509392505050565b6000613b33613b2e613b2984612f6d565b6135c9565b612f6d565b9050919050565b6000819050919050565b613b4d83613b18565b613b61613b5982613b3a565b848454613ac6565b825550505050565b600090565b613b76613b69565b613b81818484613b44565b505050565b5b81811015613ba557613b9a600082613b6e565b600181019050613b87565b5050565b601f821115613bea57613bbb81613a94565b613bc484613aa9565b81016020851015613bd3578190505b613be7613bdf85613aa9565b830182613b86565b50505b505050565b600082821c905092915050565b6000613c0d60001984600802613bef565b1980831691505092915050565b6000613c268383613bfc565b9150826002028217905092915050565b613c3f82612ebb565b67ffffffffffffffff811115613c5857613c57613183565b5b613c6282546138bb565b613c6d828285613ba9565b600060209050601f831160018114613ca05760008415613c8e578287015190505b613c988582613c1a565b865550613d00565b601f198416613cae86613a94565b60005b82811015613cd657848901518255600182019150602085019450602081019050613cb1565b86831015613cf35784890151613cef601f891682613bfc565b8355505b6001600288020188555050505b505050505050565b7f50726f7465637465644d696e744275726e3a2063616c6c6572206973206e6f7460008201527f2061206d696e7465720000000000000000000000000000000000000000000000602082015250565b6000613d64602983612ec6565b9150613d6f82613d08565b604082019050919050565b60006020820190508181036000830152613d9381613d57565b9050919050565b7f4c6f636b61626c653a206d696e74206973206c6f636b65640000000000000000600082015250565b6000613dd0601883612ec6565b9150613ddb82613d9a565b602082019050919050565b60006020820190508181036000830152613dff81613dc3565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000613e4082612f6d565b9150613e4b83612f6d565b9250828201905080821115613e6357613e626138ec565b5b92915050565b7f4c6f636b61626c653a206d65746164617461206973206c6f636b656400000000600082015250565b6000613e9f601c83612ec6565b9150613eaa82613e69565b602082019050919050565b60006020820190508181036000830152613ece81613e92565b9050919050565b7f50726f7465637465644d696e744275726e3a2063616c6c6572206973206e6f7460008201527f2061206275726e65720000000000000000000000000000000000000000000000602082015250565b6000613f31602983612ec6565b9150613f3c82613ed5565b604082019050919050565b60006020820190508181036000830152613f6081613f24565b9050919050565b7f4c6f636b61626c653a206275726e206973206c6f636b65640000000000000000600082015250565b6000613f9d601883612ec6565b9150613fa882613f67565b602082019050919050565b60006020820190508181036000830152613fcc81613f90565b9050919050565b7f546f6b656e20646f6573206e6f74206578697374730000000000000000000000600082015250565b6000614009601583612ec6565b915061401482613fd3565b602082019050919050565b6000602082019050818103600083015261403881613ffc565b9050919050565b600061405261404d846131fe565b6131e3565b90508281526020810184848401111561406e5761406d61317e565b5b614079848285612ed7565b509392505050565b600082601f83011261409657614095613179565b5b81516140a684826020860161403f565b91505092915050565b6000602082840312156140c5576140c4612ce7565b5b600082015167ffffffffffffffff8111156140e3576140e2612cec565b5b6140ef84828501614081565b91505092915050565b600061411361410e61410984612e37565b6135c9565b612f6d565b9050919050565b614123816140f8565b82525050565b600060408201905061413e600083018561411a565b61414b602083018461303a565b9392505050565b7f54686520746f6b656e2063616e206e6f74206265207472616e7366657272656460008201527f20617420746869732074696d652e000000000000000000000000000000000000602082015250565b60006141ae602e83612ec6565b91506141b982614152565b604082019050919050565b600060208201905081810360008301526141dd816141a1565b9050919050565b60006060820190506141f9600083018661303a565b614206602083018561411a565b614213604083018461303a565b949350505050565b6000604082019050614230600083018561303a565b61423d6020830184612fd0565b9392505050565b600081519050919050565b600082825260208201905092915050565b600061426b82614244565b614275818561424f565b9350614285818560208601612ed7565b61428e81612f01565b840191505092915050565b60006080820190506142ae6000830187612fd0565b6142bb6020830186612fd0565b6142c8604083018561303a565b81810360608301526142da8184614260565b905095945050505050565b6000815190506142f481612d1d565b92915050565b6000602082840312156143105761430f612ce7565b5b600061431e848285016142e5565b9150509291505056fea264697066735822122077aa447880fb36deb580ce654b7fb732325e5d5e47bfd0dde5f2eb568df509a064736f6c63430008180033
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061027f5760003560e01c8063715018a61161015c578063b88d4fde116100ce578063de836ebd11610087578063de836ebd1461075f578063df10580a1461077b578063e0b6bb6714610799578063e985e9c5146107a3578063f2fde38b146107d3578063f44637ba146107ef5761027f565b8063b88d4fde1461069b578063bd3c996b146106b7578063c87b56dd146106d5578063cb2ef6f714610705578063d7e45cd714610723578063d89135cd146107415761027f565b8063983b2d5611610120578063983b2d5614610601578063989bdbb61461061d578063a0c76f6214610627578063a22cb46514610645578063a2309ff814610661578063b80f55c91461067f5761027f565b8063715018a61461056f5780637995c1e4146105795780638b78f0ef146105955780638da5cb5b146105c557806395d89b41146105e35761027f565b80632a55205a116101f55780634f558e79116101b95780634f558e791461048957806354fd4d50146104b95780635944c753146104d75780636352211e146104f3578063685731071461052357806370a082311461053f5761027f565b80632a55205a146103e85780633092afd51461041957806335e60bd41461043557806342842e0e146104515780634b700fc31461046d5761027f565b8063095ea7b311610247578063095ea7b31461033a57806312686aae1461035657806318160ddd146103745780631a2f459f146103925780631aff0dba146103c257806323b872dd146103cc5761027f565b806301ffc9a71461028457806302846858146102b457806304634d8d146102d057806306fdde03146102ec578063081812fc1461030a575b600080fd5b61029e60048036038101906102999190612d49565b61080b565b6040516102ab9190612d91565b60405180910390f35b6102ce60048036038101906102c99190612e0a565b61081d565b005b6102ea60048036038101906102e59190612e7b565b6108b7565b005b6102f46108cd565b6040516103019190612f4b565b60405180910390f35b610324600480360381019061031f9190612fa3565b61095f565b6040516103319190612fdf565b60405180910390f35b610354600480360381019061034f9190612ffa565b61097b565b005b61035e610991565b60405161036b9190612d91565b60405180910390f35b61037c6109a4565b6040516103899190613049565b60405180910390f35b6103ac60048036038101906103a79190612e0a565b6109bb565b6040516103b99190612d91565b60405180910390f35b6103ca6109db565b005b6103e660048036038101906103e19190613064565b610a00565b005b61040260048036038101906103fd91906130b7565b610b02565b6040516104109291906130f7565b60405180910390f35b610433600480360381019061042e9190612e0a565b610cec565b005b61044f600480360381019061044a919061314c565b610d86565b005b61046b60048036038101906104669190613064565b610de2565b005b610487600480360381019061048291906132ae565b610e02565b005b6104a3600480360381019061049e9190612fa3565b610f09565b6040516104b09190612d91565b60405180910390f35b6104c1610f4a565b6040516104ce9190612f4b565b60405180910390f35b6104f160048036038101906104ec9190613373565b610f83565b005b61050d60048036038101906105089190612fa3565b610f9b565b60405161051a9190612fdf565b60405180910390f35b61053d60048036038101906105389190613551565b610fad565b005b61055960048036038101906105549190612e0a565b611105565b6040516105669190613049565b60405180910390f35b6105776111bf565b005b610593600480360381019061058e9190612e0a565b6111d3565b005b6105af60048036038101906105aa9190612e0a565b611275565b6040516105bc9190612d91565b60405180910390f35b6105cd611295565b6040516105da9190612fdf565b60405180910390f35b6105eb6112bf565b6040516105f89190612f4b565b60405180910390f35b61061b60048036038101906106169190612e0a565b611351565b005b6106256113eb565b005b61062f611410565b60405161063c9190613628565b60405180910390f35b61065f600480360381019061065a9190613643565b611436565b005b61066961144c565b6040516106769190613049565b60405180910390f35b61069960048036038101906106949190613683565b611452565b005b6106b560048036038101906106b0919061376d565b61158e565b005b6106bf6115ab565b6040516106cc9190612d91565b60405180910390f35b6106ef60048036038101906106ea9190612fa3565b6115be565b6040516106fc9190612f4b565b60405180910390f35b61070d6116e1565b60405161071a9190612f4b565b60405180910390f35b61072b61171a565b6040516107389190612d91565b60405180910390f35b61074961172d565b6040516107569190613049565b60405180910390f35b610779600480360381019061077491906137f0565b611733565b005b610783611871565b6040516107909190612d91565b60405180910390f35b6107a1611884565b005b6107bd60048036038101906107b8919061384c565b6118a9565b6040516107ca9190612d91565b60405180910390f35b6107ed60048036038101906107e89190612e0a565b61193d565b005b61080960048036038101906108049190612e0a565b6119c3565b005b600061081682611a5d565b9050919050565b610825611ad7565b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507faaa6f69bc76110b2804f7b88baa48f63b68d33979a039065d90d1cf8488d6921816040516108ac9190612fdf565b60405180910390a150565b6108bf611ad7565b6108c98282611b5e565b5050565b6060600f80546108dc906138bb565b80601f0160208091040260200160405190810160405280929190818152602001828054610908906138bb565b80156109555780601f1061092a57610100808354040283529160200191610955565b820191906000526020600020905b81548152906001019060200180831161093857829003601f168201915b5050505050905090565b600061096a82611d00565b5061097482611d88565b9050919050565b61098d8282610988611dc5565b611dcd565b5050565b600e60009054906101000a900460ff1681565b6000600d54600c546109b6919061391b565b905090565b600a6020528060005260406000206000915054906101000a900460ff1681565b6109e3611ad7565b6001600860156101000a81548160ff021916908315150217905550565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610a725760006040517f64a0ae92000000000000000000000000000000000000000000000000000000008152600401610a699190612fdf565b60405180910390fd5b6000610a868383610a81611dc5565b611ddf565b90508373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610afc578382826040517f64283d7b000000000000000000000000000000000000000000000000000000008152600401610af39392919061394f565b60405180910390fd5b50505050565b6000806000600760008681526020019081526020016000206040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff166bffffffffffffffffffffffff16815250509050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1603610c975760066040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff166bffffffffffffffffffffffff168152505090505b6000610ca1611e89565b6bffffffffffffffffffffffff1682602001516bffffffffffffffffffffffff1686610ccd9190613986565b610cd791906139f7565b90508160000151819350935050509250929050565b610cf4611ad7565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f2f91b591fc56ac0917953ad01ec225524ee5ef0555213e4c8a9d8c9728ee7ffb81604051610d7b9190612fdf565b60405180910390a150565b610d8e611ad7565b80600e60006101000a81548160ff0219169083151502179055507f203a216dffc18723de0cd43c6fe2c8dfb542b42f35fc1b295d2991fc92ea8bab81604051610dd79190612d91565b60405180910390a150565b610dfd8383836040518060200160405280600081525061158e565b505050565b60001515601160009054906101000a900460ff16151514610e58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e4f90613a74565b60405180910390fd5b610e6133611e93565b610e6b8686611b5e565b83600f9081610e7a9190613c36565b508260109081610e8a9190613c36565b5081600e60006101000a81548160ff02191690831515021790555080600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001601160006101000a81548160ff021916908315150217905550505050505050565b60008073ffffffffffffffffffffffffffffffffffffffff16610f2b83611f59565b73ffffffffffffffffffffffffffffffffffffffff1614159050919050565b6040518060400160405280600581526020017f312e302e3000000000000000000000000000000000000000000000000000000081525081565b610f8b611ad7565b610f96838383611f96565b505050565b6000610fa682611d00565b9050919050565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611039576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161103090613d7a565b60405180910390fd5b60001515600860149054906101000a900460ff1615151461108f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161108690613de6565b60405180910390fd5b60005b81518110156110e6576110d98382815181106110b1576110b0613e06565b5b60200260200101518383815181106110cc576110cb613e06565b5b602002602001015161214e565b8080600101915050611092565b508051600c60008282546110fa9190613e35565b925050819055505050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036111785760006040517f89c62b6400000000000000000000000000000000000000000000000000000000815260040161116f9190612fdf565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6111c7611ad7565b6111d16000611e93565b565b6111db611ad7565b60001515600860169054906101000a900460ff16151514611231576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161122890613eb5565b60405180910390fd5b80600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60096020528060005260406000206000915054906101000a900460ff1681565b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060601080546112ce906138bb565b80601f01602080910402602001604051908101604052809291908181526020018280546112fa906138bb565b80156113475780601f1061131c57610100808354040283529160200191611347565b820191906000526020600020905b81548152906001019060200180831161132a57829003601f168201915b5050505050905090565b611359611ad7565b6001600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f16baa937b08d58713325f93ac58b8a9369a4359bbefb4957d6d9b402735722ab816040516113e09190612fdf565b60405180910390a150565b6113f3611ad7565b6001600860166101000a81548160ff021916908315150217905550565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b611448611441611dc5565b838361216c565b5050565b600c5481565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166114de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114d590613f47565b60405180910390fd5b60001515600860159054906101000a900460ff16151514611534576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152b90613fb3565b60405180910390fd5b60005b81518110156115705761156382828151811061155657611555613e06565b5b60200260200101516122db565b8080600101915050611537565b508051600d60008282546115849190613e35565b9250508190555050565b611599848484610a00565b6115a584848484612361565b50505050565b600860159054906101000a900460ff1681565b6060600073ffffffffffffffffffffffffffffffffffffffff166115e183611f59565b73ffffffffffffffffffffffffffffffffffffffff1603611637576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161162e9061401f565b60405180910390fd5b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630b63fd6230846040518363ffffffff1660e01b81526004016116949291906130f7565b600060405180830381865afa1580156116b1573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906116da91906140af565b9050919050565b6040518060400160405280600781526020017f4552432d3732310000000000000000000000000000000000000000000000000081525081565b600860169054906101000a900460ff1681565b600d5481565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166117bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117b690613d7a565b60405180910390fd5b60001515600860149054906101000a900460ff16151514611815576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161180c90613de6565b60405180910390fd5b60005b8151811015611852576118458383838151811061183857611837613e06565b5b602002602001015161214e565b8080600101915050611818565b508051600c60008282546118669190613e35565b925050819055505050565b600860149054906101000a900460ff1681565b61188c611ad7565b6001600860146101000a81548160ff021916908315150217905550565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b611945611ad7565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036119b75760006040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081526004016119ae9190612fdf565b60405180910390fd5b6119c081611e93565b50565b6119cb611ad7565b6001600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f2a85edc5fabdd9bbaa6d309617215d5b6905e0ed8a48d656d86fc9863e3c4b7781604051611a529190612fdf565b60405180910390a150565b60007f2a55205a000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611ad05750611acf82612518565b5b9050919050565b611adf611dc5565b73ffffffffffffffffffffffffffffffffffffffff16611afd611295565b73ffffffffffffffffffffffffffffffffffffffff1614611b5c57611b20611dc5565b6040517f118cdaa7000000000000000000000000000000000000000000000000000000008152600401611b539190612fdf565b60405180910390fd5b565b6000611b68611e89565b6bffffffffffffffffffffffff16905080826bffffffffffffffffffffffff161115611bcd5781816040517f6f483d09000000000000000000000000000000000000000000000000000000008152600401611bc4929190614129565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611c3f5760006040517fb6d9900a000000000000000000000000000000000000000000000000000000008152600401611c369190612fdf565b60405180910390fd5b60405180604001604052808473ffffffffffffffffffffffffffffffffffffffff168152602001836bffffffffffffffffffffffff16815250600660008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff160217905550905050505050565b600080611d0c83611f59565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611d7f57826040517f7e273289000000000000000000000000000000000000000000000000000000008152600401611d769190613049565b60405180910390fd5b80915050919050565b60006004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600033905090565b611dda83838360016125fa565b505050565b600080611deb84611f59565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161480611e355750600e60009054906101000a900460ff16155b611e74576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e6b906141c4565b60405180910390fd5b611e7f8585856127bf565b9150509392505050565b6000612710905090565b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60006002600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000611fa0611e89565b6bffffffffffffffffffffffff16905080826bffffffffffffffffffffffff161115612007578382826040517fdfd1fc1b000000000000000000000000000000000000000000000000000000008152600401611ffe939291906141e4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361207b578360006040517f969f085200000000000000000000000000000000000000000000000000000000815260040161207292919061421b565b60405180910390fd5b60405180604001604052808473ffffffffffffffffffffffffffffffffffffffff168152602001836bffffffffffffffffffffffff168152506007600086815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff16021790555090505050505050565b6121688282604051806020016040528060008152506129d9565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036121dd57816040517f5b08ba180000000000000000000000000000000000000000000000000000000081526004016121d49190612fdf565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516122ce9190612d91565b60405180910390a3505050565b60006122ea6000836000611ddf565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361235d57816040517f7e2732890000000000000000000000000000000000000000000000000000000081526004016123549190613049565b60405180910390fd5b5050565b60008373ffffffffffffffffffffffffffffffffffffffff163b1115612512578273ffffffffffffffffffffffffffffffffffffffff1663150b7a026123a5611dc5565b8685856040518563ffffffff1660e01b81526004016123c79493929190614299565b6020604051808303816000875af192505050801561240357506040513d601f19601f8201168201806040525081019061240091906142fa565b60015b612487573d8060008114612433576040519150601f19603f3d011682016040523d82523d6000602084013e612438565b606091505b50600081510361247f57836040517f64a0ae920000000000000000000000000000000000000000000000000000000081526004016124769190612fdf565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161461251057836040517f64a0ae920000000000000000000000000000000000000000000000000000000081526004016125079190612fdf565b60405180910390fd5b505b50505050565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806125e357507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806125f357506125f2826129f5565b5b9050919050565b80806126335750600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561276757600061264384611d00565b9050600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156126ae57508273ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b80156126c157506126bf81846118a9565b155b1561270357826040517fa9fbf51f0000000000000000000000000000000000000000000000000000000081526004016126fa9190612fdf565b60405180910390fd5b811561276557838573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45b505b836004600085815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050505050565b6000806127cb84611f59565b9050600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161461280d5761280c818486612a5f565b5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461289e5761284f6000856000806125fa565b6001600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614612921576001600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055505b846002600086815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550838573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4809150509392505050565b6129e38383612b23565b6129f06000848484612361565b505050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b612a6a838383612c1c565b612b1e57600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603612adf57806040517f7e273289000000000000000000000000000000000000000000000000000000008152600401612ad69190613049565b60405180910390fd5b81816040517f177e802f000000000000000000000000000000000000000000000000000000008152600401612b159291906130f7565b60405180910390fd5b505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603612b955760006040517f64a0ae92000000000000000000000000000000000000000000000000000000008152600401612b8c9190612fdf565b60405180910390fd5b6000612ba383836000611ddf565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614612c175760006040517f73c6ac6e000000000000000000000000000000000000000000000000000000008152600401612c0e9190612fdf565b60405180910390fd5b505050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015612cd457508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480612c955750612c9484846118a9565b5b80612cd357508273ffffffffffffffffffffffffffffffffffffffff16612cbb83611d88565b73ffffffffffffffffffffffffffffffffffffffff16145b5b90509392505050565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b612d2681612cf1565b8114612d3157600080fd5b50565b600081359050612d4381612d1d565b92915050565b600060208284031215612d5f57612d5e612ce7565b5b6000612d6d84828501612d34565b91505092915050565b60008115159050919050565b612d8b81612d76565b82525050565b6000602082019050612da66000830184612d82565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612dd782612dac565b9050919050565b612de781612dcc565b8114612df257600080fd5b50565b600081359050612e0481612dde565b92915050565b600060208284031215612e2057612e1f612ce7565b5b6000612e2e84828501612df5565b91505092915050565b60006bffffffffffffffffffffffff82169050919050565b612e5881612e37565b8114612e6357600080fd5b50565b600081359050612e7581612e4f565b92915050565b60008060408385031215612e9257612e91612ce7565b5b6000612ea085828601612df5565b9250506020612eb185828601612e66565b9150509250929050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612ef5578082015181840152602081019050612eda565b60008484015250505050565b6000601f19601f8301169050919050565b6000612f1d82612ebb565b612f278185612ec6565b9350612f37818560208601612ed7565b612f4081612f01565b840191505092915050565b60006020820190508181036000830152612f658184612f12565b905092915050565b6000819050919050565b612f8081612f6d565b8114612f8b57600080fd5b50565b600081359050612f9d81612f77565b92915050565b600060208284031215612fb957612fb8612ce7565b5b6000612fc784828501612f8e565b91505092915050565b612fd981612dcc565b82525050565b6000602082019050612ff46000830184612fd0565b92915050565b6000806040838503121561301157613010612ce7565b5b600061301f85828601612df5565b925050602061303085828601612f8e565b9150509250929050565b61304381612f6d565b82525050565b600060208201905061305e600083018461303a565b92915050565b60008060006060848603121561307d5761307c612ce7565b5b600061308b86828701612df5565b935050602061309c86828701612df5565b92505060406130ad86828701612f8e565b9150509250925092565b600080604083850312156130ce576130cd612ce7565b5b60006130dc85828601612f8e565b92505060206130ed85828601612f8e565b9150509250929050565b600060408201905061310c6000830185612fd0565b613119602083018461303a565b9392505050565b61312981612d76565b811461313457600080fd5b50565b60008135905061314681613120565b92915050565b60006020828403121561316257613161612ce7565b5b600061317084828501613137565b91505092915050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6131bb82612f01565b810181811067ffffffffffffffff821117156131da576131d9613183565b5b80604052505050565b60006131ed612cdd565b90506131f982826131b2565b919050565b600067ffffffffffffffff82111561321957613218613183565b5b61322282612f01565b9050602081019050919050565b82818337600083830152505050565b600061325161324c846131fe565b6131e3565b90508281526020810184848401111561326d5761326c61317e565b5b61327884828561322f565b509392505050565b600082601f83011261329557613294613179565b5b81356132a584826020860161323e565b91505092915050565b60008060008060008060c087890312156132cb576132ca612ce7565b5b60006132d989828a01612df5565b96505060206132ea89828a01612e66565b955050604087013567ffffffffffffffff81111561330b5761330a612cec565b5b61331789828a01613280565b945050606087013567ffffffffffffffff81111561333857613337612cec565b5b61334489828a01613280565b935050608061335589828a01613137565b92505060a061336689828a01612df5565b9150509295509295509295565b60008060006060848603121561338c5761338b612ce7565b5b600061339a86828701612f8e565b93505060206133ab86828701612df5565b92505060406133bc86828701612e66565b9150509250925092565b600067ffffffffffffffff8211156133e1576133e0613183565b5b602082029050602081019050919050565b600080fd5b600061340a613405846133c6565b6131e3565b9050808382526020820190506020840283018581111561342d5761342c6133f2565b5b835b8181101561345657806134428882612df5565b84526020840193505060208101905061342f565b5050509392505050565b600082601f83011261347557613474613179565b5b81356134858482602086016133f7565b91505092915050565b600067ffffffffffffffff8211156134a9576134a8613183565b5b602082029050602081019050919050565b60006134cd6134c88461348e565b6131e3565b905080838252602082019050602084028301858111156134f0576134ef6133f2565b5b835b8181101561351957806135058882612f8e565b8452602084019350506020810190506134f2565b5050509392505050565b600082601f83011261353857613537613179565b5b81356135488482602086016134ba565b91505092915050565b6000806040838503121561356857613567612ce7565b5b600083013567ffffffffffffffff81111561358657613585612cec565b5b61359285828601613460565b925050602083013567ffffffffffffffff8111156135b3576135b2612cec565b5b6135bf85828601613523565b9150509250929050565b6000819050919050565b60006135ee6135e96135e484612dac565b6135c9565b612dac565b9050919050565b6000613600826135d3565b9050919050565b6000613612826135f5565b9050919050565b61362281613607565b82525050565b600060208201905061363d6000830184613619565b92915050565b6000806040838503121561365a57613659612ce7565b5b600061366885828601612df5565b925050602061367985828601613137565b9150509250929050565b60006020828403121561369957613698612ce7565b5b600082013567ffffffffffffffff8111156136b7576136b6612cec565b5b6136c384828501613523565b91505092915050565b600067ffffffffffffffff8211156136e7576136e6613183565b5b6136f082612f01565b9050602081019050919050565b600061371061370b846136cc565b6131e3565b90508281526020810184848401111561372c5761372b61317e565b5b61373784828561322f565b509392505050565b600082601f83011261375457613753613179565b5b81356137648482602086016136fd565b91505092915050565b6000806000806080858703121561378757613786612ce7565b5b600061379587828801612df5565b94505060206137a687828801612df5565b93505060406137b787828801612f8e565b925050606085013567ffffffffffffffff8111156137d8576137d7612cec565b5b6137e48782880161373f565b91505092959194509250565b6000806040838503121561380757613806612ce7565b5b600061381585828601612df5565b925050602083013567ffffffffffffffff81111561383657613835612cec565b5b61384285828601613523565b9150509250929050565b6000806040838503121561386357613862612ce7565b5b600061387185828601612df5565b925050602061388285828601612df5565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806138d357607f821691505b6020821081036138e6576138e561388c565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061392682612f6d565b915061393183612f6d565b9250828203905081811115613949576139486138ec565b5b92915050565b60006060820190506139646000830186612fd0565b613971602083018561303a565b61397e6040830184612fd0565b949350505050565b600061399182612f6d565b915061399c83612f6d565b92508282026139aa81612f6d565b915082820484148315176139c1576139c06138ec565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613a0282612f6d565b9150613a0d83612f6d565b925082613a1d57613a1c6139c8565b5b828204905092915050565b7f436f6e747261637420616c726561647920696e697469616c697a65642e000000600082015250565b6000613a5e601d83612ec6565b9150613a6982613a28565b602082019050919050565b60006020820190508181036000830152613a8d81613a51565b9050919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302613af67fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82613ab9565b613b008683613ab9565b95508019841693508086168417925050509392505050565b6000613b33613b2e613b2984612f6d565b6135c9565b612f6d565b9050919050565b6000819050919050565b613b4d83613b18565b613b61613b5982613b3a565b848454613ac6565b825550505050565b600090565b613b76613b69565b613b81818484613b44565b505050565b5b81811015613ba557613b9a600082613b6e565b600181019050613b87565b5050565b601f821115613bea57613bbb81613a94565b613bc484613aa9565b81016020851015613bd3578190505b613be7613bdf85613aa9565b830182613b86565b50505b505050565b600082821c905092915050565b6000613c0d60001984600802613bef565b1980831691505092915050565b6000613c268383613bfc565b9150826002028217905092915050565b613c3f82612ebb565b67ffffffffffffffff811115613c5857613c57613183565b5b613c6282546138bb565b613c6d828285613ba9565b600060209050601f831160018114613ca05760008415613c8e578287015190505b613c988582613c1a565b865550613d00565b601f198416613cae86613a94565b60005b82811015613cd657848901518255600182019150602085019450602081019050613cb1565b86831015613cf35784890151613cef601f891682613bfc565b8355505b6001600288020188555050505b505050505050565b7f50726f7465637465644d696e744275726e3a2063616c6c6572206973206e6f7460008201527f2061206d696e7465720000000000000000000000000000000000000000000000602082015250565b6000613d64602983612ec6565b9150613d6f82613d08565b604082019050919050565b60006020820190508181036000830152613d9381613d57565b9050919050565b7f4c6f636b61626c653a206d696e74206973206c6f636b65640000000000000000600082015250565b6000613dd0601883612ec6565b9150613ddb82613d9a565b602082019050919050565b60006020820190508181036000830152613dff81613dc3565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000613e4082612f6d565b9150613e4b83612f6d565b9250828201905080821115613e6357613e626138ec565b5b92915050565b7f4c6f636b61626c653a206d65746164617461206973206c6f636b656400000000600082015250565b6000613e9f601c83612ec6565b9150613eaa82613e69565b602082019050919050565b60006020820190508181036000830152613ece81613e92565b9050919050565b7f50726f7465637465644d696e744275726e3a2063616c6c6572206973206e6f7460008201527f2061206275726e65720000000000000000000000000000000000000000000000602082015250565b6000613f31602983612ec6565b9150613f3c82613ed5565b604082019050919050565b60006020820190508181036000830152613f6081613f24565b9050919050565b7f4c6f636b61626c653a206275726e206973206c6f636b65640000000000000000600082015250565b6000613f9d601883612ec6565b9150613fa882613f67565b602082019050919050565b60006020820190508181036000830152613fcc81613f90565b9050919050565b7f546f6b656e20646f6573206e6f74206578697374730000000000000000000000600082015250565b6000614009601583612ec6565b915061401482613fd3565b602082019050919050565b6000602082019050818103600083015261403881613ffc565b9050919050565b600061405261404d846131fe565b6131e3565b90508281526020810184848401111561406e5761406d61317e565b5b614079848285612ed7565b509392505050565b600082601f83011261409657614095613179565b5b81516140a684826020860161403f565b91505092915050565b6000602082840312156140c5576140c4612ce7565b5b600082015167ffffffffffffffff8111156140e3576140e2612cec565b5b6140ef84828501614081565b91505092915050565b600061411361410e61410984612e37565b6135c9565b612f6d565b9050919050565b614123816140f8565b82525050565b600060408201905061413e600083018561411a565b61414b602083018461303a565b9392505050565b7f54686520746f6b656e2063616e206e6f74206265207472616e7366657272656460008201527f20617420746869732074696d652e000000000000000000000000000000000000602082015250565b60006141ae602e83612ec6565b91506141b982614152565b604082019050919050565b600060208201905081810360008301526141dd816141a1565b9050919050565b60006060820190506141f9600083018661303a565b614206602083018561411a565b614213604083018461303a565b949350505050565b6000604082019050614230600083018561303a565b61423d6020830184612fd0565b9392505050565b600081519050919050565b600082825260208201905092915050565b600061426b82614244565b614275818561424f565b9350614285818560208601612ed7565b61428e81612f01565b840191505092915050565b60006080820190506142ae6000830187612fd0565b6142bb6020830186612fd0565b6142c8604083018561303a565b81810360608301526142da8184614260565b905095945050505050565b6000815190506142f481612d1d565b92915050565b6000602082840312156143105761430f612ce7565b5b600061431e848285016142e5565b9150509291505056fea264697066735822122077aa447880fb36deb580ce654b7fb732325e5d5e47bfd0dde5f2eb568df509a064736f6c63430008180033
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.