More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 25 from a total of 4,390 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Set Approval For... | 20590982 | 2 hrs ago | IN | 0 ETH | 0.00005916 | ||||
Set Approval For... | 20589897 | 5 hrs ago | IN | 0 ETH | 0.00006485 | ||||
Transfer From | 20589426 | 7 hrs ago | IN | 0 ETH | 0.00009827 | ||||
Transfer From | 20589408 | 7 hrs ago | IN | 0 ETH | 0.00008653 | ||||
Transfer From | 20589399 | 7 hrs ago | IN | 0 ETH | 0.00008805 | ||||
Transfer From | 20589390 | 7 hrs ago | IN | 0 ETH | 0.00009511 | ||||
Safe Transfer Fr... | 20589076 | 8 hrs ago | IN | 0 ETH | 0.00010427 | ||||
Approve | 20587860 | 12 hrs ago | IN | 0 ETH | 0.00008264 | ||||
Set Blocked Toke... | 20587440 | 14 hrs ago | IN | 0 ETH | 0.00002837 | ||||
Set Approval For... | 20582620 | 30 hrs ago | IN | 0 ETH | 0.00004237 | ||||
Transfer From | 20582151 | 31 hrs ago | IN | 0 ETH | 0.00022243 | ||||
Transfer From | 20580772 | 36 hrs ago | IN | 0 ETH | 0.00016863 | ||||
Approve | 20577251 | 2 days ago | IN | 0 ETH | 0.00008752 | ||||
Set Approval For... | 20576524 | 2 days ago | IN | 0 ETH | 0.00003877 | ||||
Set Approval For... | 20576520 | 2 days ago | IN | 0 ETH | 0.0000386 | ||||
Transfer From | 20576514 | 2 days ago | IN | 0 ETH | 0.00007107 | ||||
Set Approval For... | 20575784 | 2 days ago | IN | 0 ETH | 0.00008979 | ||||
Set Approval For... | 20575662 | 2 days ago | IN | 0 ETH | 0.00008779 | ||||
Set Approval For... | 20575563 | 2 days ago | IN | 0 ETH | 0.0000471 | ||||
Transfer From | 20573567 | 2 days ago | IN | 0 ETH | 0.00006696 | ||||
Transfer From | 20570132 | 3 days ago | IN | 0 ETH | 0.0001107 | ||||
Set Approval For... | 20569925 | 3 days ago | IN | 0 ETH | 0.00005771 | ||||
Transfer From | 20563239 | 3 days ago | IN | 0 ETH | 0.00031331 | ||||
Transfer From | 20563232 | 3 days ago | IN | 0 ETH | 0.00044577 | ||||
Approve | 20563183 | 3 days ago | IN | 0 ETH | 0.00026237 |
Advanced mode: Intended for advanced users or developers and will display all Internal Transactions including zero value transfers. Name tag integration is not available in advanced view.
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block | From | To | ||||
---|---|---|---|---|---|---|---|
20590982 | 2 hrs ago | 0 ETH | |||||
20590025 | 5 hrs ago | 0 ETH | |||||
20590025 | 5 hrs ago | 0 ETH | |||||
20590025 | 5 hrs ago | 0 ETH | |||||
20590025 | 5 hrs ago | 0 ETH | |||||
20590025 | 5 hrs ago | 0 ETH | |||||
20590025 | 5 hrs ago | 0 ETH | |||||
20590025 | 5 hrs ago | 0 ETH | |||||
20590025 | 5 hrs ago | 0 ETH | |||||
20589897 | 5 hrs ago | 0 ETH | |||||
20584235 | 24 hrs ago | 0 ETH | |||||
20584235 | 24 hrs ago | 0 ETH | |||||
20584235 | 24 hrs ago | 0 ETH | |||||
20584235 | 24 hrs ago | 0 ETH | |||||
20584235 | 24 hrs ago | 0 ETH | |||||
20584235 | 24 hrs ago | 0 ETH | |||||
20584235 | 24 hrs ago | 0 ETH | |||||
20584235 | 24 hrs ago | 0 ETH | |||||
20584235 | 24 hrs ago | 0 ETH | |||||
20584235 | 24 hrs ago | 0 ETH | |||||
20584235 | 24 hrs ago | 0 ETH | |||||
20584235 | 24 hrs ago | 0 ETH | |||||
20584235 | 24 hrs ago | 0 ETH | |||||
20584235 | 24 hrs ago | 0 ETH | |||||
20584235 | 24 hrs ago | 0 ETH |
Loading...
Loading
Contract Name:
CryptoNinjaPartners
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 800 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import {AccessControl} from "openzeppelin-contracts/contracts/access/AccessControl.sol"; import {EnumerableSet} from "openzeppelin-contracts/contracts/utils/structs/EnumerableSet.sol"; import {ERC2981} from "openzeppelin-contracts/contracts/token/common/ERC2981.sol"; import {DefaultOperatorFilterer} from "operator-filter-registry/src/DefaultOperatorFilterer.sol"; import {IContractAllowListProxy} from "ContractAllowList/proxy/interface/IContractAllowListProxy.sol"; import {BitMaps} from "solidity-bits/contracts/BitMaps.sol"; import {SS2ERC721PsiBurnable,ERC721Psi} from './SS2ERC721PsiBurnable.sol'; import {Ownable} from "openzeppelin-contracts/contracts/access/Ownable.sol"; import {UseLocker} from "./Locker/UseLocker.sol"; contract CryptoNinjaPartners is SS2ERC721PsiBurnable, DefaultOperatorFilterer, Ownable, ERC2981, AccessControl, UseLocker { using EnumerableSet for EnumerableSet.AddressSet; using BitMaps for BitMaps.BitMap; bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE"); bytes32 public constant CONFIGURATOR_ROLE = keccak256('CONFIGURATOR_ROLE'); string public constant BASE_EXTENSION = ".json"; address public constant WITHDRAW_ADDRESS = 0x0a2C099044c088A431b78a0D6Bb5A137a5663297; string public baseURI = "https://data.cryptoninjapartners.com/new/json/"; IContractAllowListProxy public cal; uint256 public calLevel = 1; bool public enableRestrict = true; BitMaps.BitMap internal _blockedToken; EnumerableSet.AddressSet private localAllowedAddresses; address[] private pointers; modifier onlyMinter() { require(hasRole(MINTER_ROLE, _msgSender()), "Caller is not a minter"); _; } modifier onlyBurner() { require(hasRole(BURNER_ROLE, _msgSender()), "Caller is not a burner"); _; } modifier onlyConfigrator() { require(hasRole(CONFIGURATOR_ROLE, _msgSender()), "Caller is not a configrator"); _; } constructor() SS2ERC721PsiBurnable("CryptoNinjaPartners", "CNP") { _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); _grantRole(MINTER_ROLE, msg.sender); _grantRole(BURNER_ROLE, msg.sender); _grantRole(CONFIGURATOR_ROLE, msg.sender); _setDefaultRoyalty(WITHDRAW_ADDRESS, 1000); } // internal function _baseURI() internal view override returns (string memory) { return baseURI; } function _isAllowed(address transferer) internal view virtual returns (bool) { if (!enableRestrict) return true; return localAllowedAddresses.contains(transferer) || cal.isAllowed(transferer, calLevel); } function _beforeTokenTransfers( address, address, uint256 startTokenId, uint256 ) internal virtual override { require(!_blockedToken.get(startTokenId),'This token ID has been blocked.'); } //external function getBlockedToken(uint256 tokenId) external view virtual returns(bool){ return _blockedToken.get(tokenId); } function getLocalContractAllowList() external view returns (address[] memory) { return localAllowedAddresses.values(); } // external (only minter) function minterMint(address _address, uint256 _amount) external onlyMinter { _safeMint(_address, _amount); } // external (only burner) function burnerBurn(address _address, uint256[] calldata tokenIds) external onlyBurner { for (uint256 i = 0; i < tokenIds.length; i++) { uint256 tokenId = tokenIds[i]; require(_address == ownerOf(tokenId), "address is not owner"); _burn(tokenId); } } // public (only configrator) function setBlockedTokens(uint256[] calldata tokenIds) external onlyConfigrator{ for (uint256 i = 0; i < tokenIds.length;) { _blockedToken.set(tokenIds[i]); unchecked { ++i; } } } function unsetBlockedTokens(uint256[] calldata tokenIds) external onlyConfigrator{ for (uint256 i = 0; i < tokenIds.length;) { _blockedToken.unset(tokenIds[i]); unchecked { ++i; } } } function setAddressData(address _address,AddressData calldata _addressData) external onlyConfigrator { _setAddressData(_address,_addressData); } function setAddressDatas(address[] calldata _address,AddressData[] calldata _addressData) external onlyConfigrator { for (uint256 i = 0; i < _address.length;) { _setAddressData(_address[i],_addressData[i]); unchecked { ++i; } } } function setOwnerPointers(address[] calldata _pointer,uint256 startIndex) external onlyConfigrator { for (uint256 i = startIndex; i < _pointer.length;) { _pushOwnerPointer(_pointer[i]); unchecked { ++i; } } } function setAddressPointers(address[] calldata _pointer,uint256 startIndex) external onlyConfigrator { for (uint256 i = startIndex; i < _pointer.length;) { _pushAddressPointer(_pointer[i]); unchecked { ++i; } } } function setOwnerPointer(address pointer,uint256 index) external onlyConfigrator { _setOwnerPointer(pointer,index); } function setAddressPointer(address pointer,uint256 index) external onlyConfigrator { _setAddressPointer(pointer,index); } function emitTramsferEvents(address[] calldata _address,uint256 startIndex) external onlyConfigrator { _transferEvent(_address,startIndex); } function setLocker(address value) external override onlyConfigrator { _setLocker(value); } // external (only owner) function addLocalContractAllowList(address transferer) external onlyOwner { localAllowedAddresses.add(transferer); } function removeLocalContractAllowList(address transferer) external onlyOwner { localAllowedAddresses.remove(transferer); } function setCAL(address value) external onlyOwner { cal = IContractAllowListProxy(value); } function setCALLevel(uint256 value) external onlyOwner { calLevel = value; } function setDefaultRoyalty(address receiver, uint96 feeNumerator) external onlyOwner { _setDefaultRoyalty(receiver, feeNumerator); } // public (only owner) function ownerMint(address to, uint256 count) public onlyOwner { _safeMint(to, count); } function setBaseURI(string memory _newBaseURI) public onlyOwner { baseURI = _newBaseURI; } function withdraw() public payable onlyOwner { (bool os, ) = payable(WITHDRAW_ADDRESS).call{value: address(this).balance}(""); require(os, "withdraw error"); } //public function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { return string(abi.encodePacked(ERC721Psi.tokenURI(tokenId), BASE_EXTENSION)); } function approve(address to, uint256 tokenId) public virtual override whenNotLocked(tokenId) { super.approve(to, tokenId); } function transferFrom( address from, address to, uint256 tokenId ) public override(ERC721Psi) onlyAllowedOperator(from) whenNotLocked(tokenId) { super.transferFrom(from, to, tokenId); } function safeTransferFrom( address from, address to, uint256 tokenId ) public override(ERC721Psi) onlyAllowedOperator(from) whenNotLocked(tokenId) { super.safeTransferFrom(from, to, tokenId); } function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory data ) public override(ERC721Psi) onlyAllowedOperator(from) whenNotLocked(tokenId) { super.safeTransferFrom(from, to, tokenId, data); } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Psi, AccessControl, ERC2981) returns (bool) { return AccessControl.supportsInterface(interfaceId) || ERC721Psi.supportsInterface(interfaceId) || ERC2981.supportsInterface(interfaceId); } function setApprovalForAll(address operator, bool approved) public virtual override { require( _isAllowed(operator) || !approved, "Can not approve locked token" ); super.setApprovalForAll(operator, approved); } function isApprovedForAll(address account, address operator) public view virtual override returns (bool) { if (!_isAllowed(operator)) return false; return super.isApprovedForAll(account, operator); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.7.0 <0.9.0; interface IContractAllowListProxy { function isAllowed(address _transferer, uint256 _level) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../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: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(account), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../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. * * By default, the owner account will be the one that deploys the contract. 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; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @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 { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing 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 { require(newOwner != address(0), "Ownable: new owner is the zero address"); _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 v4.6.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "../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. * * _Available since v4.5._ */ 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 v4.8.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../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 caller. * * 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 v4.6.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @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 v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../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 v4.7.0) (token/common/ERC2981.sol) pragma solidity ^0.8.0; import "../../interfaces/IERC2981.sol"; import "../../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. * * _Available since v4.5._ */ abstract contract ERC2981 is IERC2981, ERC165 { struct RoyaltyInfo { address receiver; uint96 royaltyFraction; } RoyaltyInfo private _defaultRoyaltyInfo; mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo; /** * @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 override 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 { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: invalid receiver"); _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 { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: Invalid parameters"); _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 v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values in the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import {OperatorFilterer} from "./OperatorFilterer.sol"; import {CANONICAL_CORI_SUBSCRIPTION} from "./lib/Constants.sol"; /** * @title DefaultOperatorFilterer * @notice Inherits from OperatorFilterer and automatically subscribes to the default OpenSea subscription. * @dev Please note that if your token contract does not provide an owner with EIP-173, it must provide * administration methods on the contract itself to interact with the registry otherwise the subscription * will be locked to the options set during construction. */ abstract contract DefaultOperatorFilterer is OperatorFilterer { /// @dev The constructor that is called when the contract is being deployed. constructor() OperatorFilterer(CANONICAL_CORI_SUBSCRIPTION, true) {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; interface IOperatorFilterRegistry { /** * @notice Returns true if operator is not filtered for a given token, either by address or codeHash. Also returns * true if supplied registrant address is not registered. */ function isOperatorAllowed(address registrant, address operator) external view returns (bool); /** * @notice Registers an address with the registry. May be called by address itself or by EIP-173 owner. */ function register(address registrant) external; /** * @notice Registers an address with the registry and "subscribes" to another address's filtered operators and codeHashes. */ function registerAndSubscribe(address registrant, address subscription) external; /** * @notice Registers an address with the registry and copies the filtered operators and codeHashes from another * address without subscribing. */ function registerAndCopyEntries(address registrant, address registrantToCopy) external; /** * @notice Unregisters an address with the registry and removes its subscription. May be called by address itself or by EIP-173 owner. * Note that this does not remove any filtered addresses or codeHashes. * Also note that any subscriptions to this registrant will still be active and follow the existing filtered addresses and codehashes. */ function unregister(address addr) external; /** * @notice Update an operator address for a registered address - when filtered is true, the operator is filtered. */ function updateOperator(address registrant, address operator, bool filtered) external; /** * @notice Update multiple operators for a registered address - when filtered is true, the operators will be filtered. Reverts on duplicates. */ function updateOperators(address registrant, address[] calldata operators, bool filtered) external; /** * @notice Update a codeHash for a registered address - when filtered is true, the codeHash is filtered. */ function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external; /** * @notice Update multiple codeHashes for a registered address - when filtered is true, the codeHashes will be filtered. Reverts on duplicates. */ function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external; /** * @notice Subscribe an address to another registrant's filtered operators and codeHashes. Will remove previous * subscription if present. * Note that accounts with subscriptions may go on to subscribe to other accounts - in this case, * subscriptions will not be forwarded. Instead the former subscription's existing entries will still be * used. */ function subscribe(address registrant, address registrantToSubscribe) external; /** * @notice Unsubscribe an address from its current subscribed registrant, and optionally copy its filtered operators and codeHashes. */ function unsubscribe(address registrant, bool copyExistingEntries) external; /** * @notice Get the subscription address of a given registrant, if any. */ function subscriptionOf(address addr) external returns (address registrant); /** * @notice Get the set of addresses subscribed to a given registrant. * Note that order is not guaranteed as updates are made. */ function subscribers(address registrant) external returns (address[] memory); /** * @notice Get the subscriber at a given index in the set of addresses subscribed to a given registrant. * Note that order is not guaranteed as updates are made. */ function subscriberAt(address registrant, uint256 index) external returns (address); /** * @notice Copy filtered operators and codeHashes from a different registrantToCopy to addr. */ function copyEntriesOf(address registrant, address registrantToCopy) external; /** * @notice Returns true if operator is filtered by a given address or its subscription. */ function isOperatorFiltered(address registrant, address operator) external returns (bool); /** * @notice Returns true if the hash of an address's code is filtered by a given address or its subscription. */ function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool); /** * @notice Returns true if a codeHash is filtered by a given address or its subscription. */ function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool); /** * @notice Returns a list of filtered operators for a given address or its subscription. */ function filteredOperators(address addr) external returns (address[] memory); /** * @notice Returns the set of filtered codeHashes for a given address or its subscription. * Note that order is not guaranteed as updates are made. */ function filteredCodeHashes(address addr) external returns (bytes32[] memory); /** * @notice Returns the filtered operator at the given index of the set of filtered operators for a given address or * its subscription. * Note that order is not guaranteed as updates are made. */ function filteredOperatorAt(address registrant, uint256 index) external returns (address); /** * @notice Returns the filtered codeHash at the given index of the list of filtered codeHashes for a given address or * its subscription. * Note that order is not guaranteed as updates are made. */ function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32); /** * @notice Returns true if an address has registered */ function isRegistered(address addr) external returns (bool); /** * @dev Convenience method to compute the code hash of an arbitrary contract */ function codeHashOf(address addr) external returns (bytes32); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import {IOperatorFilterRegistry} from "./IOperatorFilterRegistry.sol"; import {CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS} from "./lib/Constants.sol"; /** * @title OperatorFilterer * @notice Abstract contract whose constructor automatically registers and optionally subscribes to or copies another * registrant's entries in the OperatorFilterRegistry. * @dev This smart contract is meant to be inherited by token contracts so they can use the following: * - `onlyAllowedOperator` modifier for `transferFrom` and `safeTransferFrom` methods. * - `onlyAllowedOperatorApproval` modifier for `approve` and `setApprovalForAll` methods. * Please note that if your token contract does not provide an owner with EIP-173, it must provide * administration methods on the contract itself to interact with the registry otherwise the subscription * will be locked to the options set during construction. */ abstract contract OperatorFilterer { /// @dev Emitted when an operator is not allowed. error OperatorNotAllowed(address operator); IOperatorFilterRegistry public constant OPERATOR_FILTER_REGISTRY = IOperatorFilterRegistry(CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS); /// @dev The constructor that is called when the contract is being deployed. constructor(address subscriptionOrRegistrantToCopy, bool subscribe) { // If an inheriting token contract is deployed to a network without the registry deployed, the modifier // will not revert, but the contract will need to be registered with the registry once it is deployed in // order for the modifier to filter addresses. if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) { if (subscribe) { OPERATOR_FILTER_REGISTRY.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy); } else { if (subscriptionOrRegistrantToCopy != address(0)) { OPERATOR_FILTER_REGISTRY.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy); } else { OPERATOR_FILTER_REGISTRY.register(address(this)); } } } } /** * @dev A helper function to check if an operator is allowed. */ modifier onlyAllowedOperator(address from) virtual { // Allow spending tokens from addresses with balance // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred // from an EOA. if (from != msg.sender) { _checkFilterOperator(msg.sender); } _; } /** * @dev A helper function to check if an operator approval is allowed. */ modifier onlyAllowedOperatorApproval(address operator) virtual { _checkFilterOperator(operator); _; } /** * @dev A helper function to check if an operator is allowed. */ function _checkFilterOperator(address operator) internal view virtual { // Check registry code length to facilitate testing in environments without a deployed registry. if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) { // under normal circumstances, this function will revert rather than return false, but inheriting contracts // may specify their own OperatorFilterRegistry implementations, which may behave differently if (!OPERATOR_FILTER_REGISTRY.isOperatorAllowed(address(this), operator)) { revert OperatorNotAllowed(operator); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; address constant CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS = 0x000000000000AAeB6D7670E522A718067333cd4E; address constant CANONICAL_CORI_SUBSCRIPTION = 0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6;
// SPDX-License-Identifier: MIT /** _____ ___ ___ __ ____ _ __ / ___/____ / (_)___/ (_) /___ __ / __ )(_) /______ \__ \/ __ \/ / / __ / / __/ / / / / __ / / __/ ___/ ___/ / /_/ / / / /_/ / / /_/ /_/ / / /_/ / / /_(__ ) /____/\____/_/_/\__,_/_/\__/\__, / /_____/_/\__/____/ /____/ - npm: https://www.npmjs.com/package/solidity-bits - github: https://github.com/estarriolvetch/solidity-bits */ pragma solidity ^0.8.0; import "./BitScan.sol"; import "./Popcount.sol"; /** * @dev This Library is a modified version of Openzeppelin's BitMaps library with extra features. * * 1. Functions of finding the index of the closest set bit from a given index are added. * The indexing of each bucket is modifed to count from the MSB to the LSB instead of from the LSB to the MSB. * The modification of indexing makes finding the closest previous set bit more efficient in gas usage. * 2. Setting and unsetting the bitmap consecutively. * 3. Accounting number of set bits within a given range. * */ /** * @dev Library for managing uint256 to bool mapping in a compact and efficient way, providing the keys are sequential. * Largelly inspired by Uniswap's https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol[merkle-distributor]. */ library BitMaps { using BitScan for uint256; uint256 private constant MASK_INDEX_ZERO = (1 << 255); uint256 private constant MASK_FULL = type(uint256).max; struct BitMap { mapping(uint256 => uint256) _data; } /** * @dev Returns whether the bit at `index` is set. */ function get(BitMap storage bitmap, uint256 index) internal view returns (bool) { uint256 bucket = index >> 8; uint256 mask = MASK_INDEX_ZERO >> (index & 0xff); return bitmap._data[bucket] & mask != 0; } /** * @dev Sets the bit at `index` to the boolean `value`. */ function setTo( BitMap storage bitmap, uint256 index, bool value ) internal { if (value) { set(bitmap, index); } else { unset(bitmap, index); } } /** * @dev Sets the bit at `index`. */ function set(BitMap storage bitmap, uint256 index) internal { uint256 bucket = index >> 8; uint256 mask = MASK_INDEX_ZERO >> (index & 0xff); bitmap._data[bucket] |= mask; } /** * @dev Unsets the bit at `index`. */ function unset(BitMap storage bitmap, uint256 index) internal { uint256 bucket = index >> 8; uint256 mask = MASK_INDEX_ZERO >> (index & 0xff); bitmap._data[bucket] &= ~mask; } /** * @dev Consecutively sets `amount` of bits starting from the bit at `startIndex`. */ function setBatch(BitMap storage bitmap, uint256 startIndex, uint256 amount) internal { uint256 bucket = startIndex >> 8; uint256 bucketStartIndex = (startIndex & 0xff); unchecked { if(bucketStartIndex + amount < 256) { bitmap._data[bucket] |= MASK_FULL << (256 - amount) >> bucketStartIndex; } else { bitmap._data[bucket] |= MASK_FULL >> bucketStartIndex; amount -= (256 - bucketStartIndex); bucket++; while(amount > 256) { bitmap._data[bucket] = MASK_FULL; amount -= 256; bucket++; } bitmap._data[bucket] |= MASK_FULL << (256 - amount); } } } /** * @dev Consecutively unsets `amount` of bits starting from the bit at `startIndex`. */ function unsetBatch(BitMap storage bitmap, uint256 startIndex, uint256 amount) internal { uint256 bucket = startIndex >> 8; uint256 bucketStartIndex = (startIndex & 0xff); unchecked { if(bucketStartIndex + amount < 256) { bitmap._data[bucket] &= ~(MASK_FULL << (256 - amount) >> bucketStartIndex); } else { bitmap._data[bucket] &= ~(MASK_FULL >> bucketStartIndex); amount -= (256 - bucketStartIndex); bucket++; while(amount > 256) { bitmap._data[bucket] = 0; amount -= 256; bucket++; } bitmap._data[bucket] &= ~(MASK_FULL << (256 - amount)); } } } /** * @dev Returns number of set bits within a range. */ function popcountA(BitMap storage bitmap, uint256 startIndex, uint256 amount) internal view returns(uint256 count) { uint256 bucket = startIndex >> 8; uint256 bucketStartIndex = (startIndex & 0xff); unchecked { if(bucketStartIndex + amount < 256) { count += Popcount.popcount256A( bitmap._data[bucket] & (MASK_FULL << (256 - amount) >> bucketStartIndex) ); } else { count += Popcount.popcount256A( bitmap._data[bucket] & (MASK_FULL >> bucketStartIndex) ); amount -= (256 - bucketStartIndex); bucket++; while(amount > 256) { count += Popcount.popcount256A(bitmap._data[bucket]); amount -= 256; bucket++; } count += Popcount.popcount256A( bitmap._data[bucket] & (MASK_FULL << (256 - amount)) ); } } } /** * @dev Returns number of set bits within a range. */ function popcountB(BitMap storage bitmap, uint256 startIndex, uint256 amount) internal view returns(uint256 count) { uint256 bucket = startIndex >> 8; uint256 bucketStartIndex = (startIndex & 0xff); unchecked { if(bucketStartIndex + amount < 256) { count += Popcount.popcount256B( bitmap._data[bucket] & (MASK_FULL << (256 - amount) >> bucketStartIndex) ); } else { count += Popcount.popcount256B( bitmap._data[bucket] & (MASK_FULL >> bucketStartIndex) ); amount -= (256 - bucketStartIndex); bucket++; while(amount > 256) { count += Popcount.popcount256B(bitmap._data[bucket]); amount -= 256; bucket++; } count += Popcount.popcount256B( bitmap._data[bucket] & (MASK_FULL << (256 - amount)) ); } } } /** * @dev Find the closest index of the set bit before `index`. */ function scanForward(BitMap storage bitmap, uint256 index) internal view returns (uint256 setBitIndex) { uint256 bucket = index >> 8; // index within the bucket uint256 bucketIndex = (index & 0xff); // load a bitboard from the bitmap. uint256 bb = bitmap._data[bucket]; // offset the bitboard to scan from `bucketIndex`. bb = bb >> (0xff ^ bucketIndex); // bb >> (255 - bucketIndex) if(bb > 0) { unchecked { setBitIndex = (bucket << 8) | (bucketIndex - bb.bitScanForward256()); } } else { while(true) { require(bucket > 0, "BitMaps: The set bit before the index doesn't exist."); unchecked { bucket--; } // No offset. Always scan from the least significiant bit now. bb = bitmap._data[bucket]; if(bb > 0) { unchecked { setBitIndex = (bucket << 8) | (255 - bb.bitScanForward256()); break; } } } } } function getBucket(BitMap storage bitmap, uint256 bucket) internal view returns (uint256) { return bitmap._data[bucket]; } }
// SPDX-License-Identifier: MIT /** _____ ___ ___ __ ____ _ __ / ___/____ / (_)___/ (_) /___ __ / __ )(_) /______ \__ \/ __ \/ / / __ / / __/ / / / / __ / / __/ ___/ ___/ / /_/ / / / /_/ / / /_/ /_/ / / /_/ / / /_(__ ) /____/\____/_/_/\__,_/_/\__/\__, / /_____/_/\__/____/ /____/ - npm: https://www.npmjs.com/package/solidity-bits - github: https://github.com/estarriolvetch/solidity-bits */ pragma solidity ^0.8.0; library BitScan { uint256 constant private DEBRUIJN_256 = 0x818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff; bytes constant private LOOKUP_TABLE_256 = hex"0001020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7506264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c9071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee30e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf7ff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c816365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f6fe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf5fd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f8"; /** @dev Isolate the least significant set bit. */ function isolateLS1B256(uint256 bb) pure internal returns (uint256) { require(bb > 0); unchecked { return bb & (0 - bb); } } /** @dev Isolate the most significant set bit. */ function isolateMS1B256(uint256 bb) pure internal returns (uint256) { require(bb > 0); unchecked { bb |= bb >> 128; bb |= bb >> 64; bb |= bb >> 32; bb |= bb >> 16; bb |= bb >> 8; bb |= bb >> 4; bb |= bb >> 2; bb |= bb >> 1; return (bb >> 1) + 1; } } /** @dev Find the index of the lest significant set bit. (trailing zero count) */ function bitScanForward256(uint256 bb) pure internal returns (uint8) { unchecked { return uint8(LOOKUP_TABLE_256[(isolateLS1B256(bb) * DEBRUIJN_256) >> 248]); } } /** @dev Find the index of the most significant set bit. */ function bitScanReverse256(uint256 bb) pure internal returns (uint8) { unchecked { return 255 - uint8(LOOKUP_TABLE_256[((isolateMS1B256(bb) * DEBRUIJN_256) >> 248)]); } } function log2(uint256 bb) pure internal returns (uint8) { unchecked { return uint8(LOOKUP_TABLE_256[(isolateMS1B256(bb) * DEBRUIJN_256) >> 248]); } } }
// SPDX-License-Identifier: MIT /** _____ ___ ___ __ ____ _ __ / ___/____ / (_)___/ (_) /___ __ / __ )(_) /______ \__ \/ __ \/ / / __ / / __/ / / / / __ / / __/ ___/ ___/ / /_/ / / / /_/ / / /_/ /_/ / / /_/ / / /_(__ ) /____/\____/_/_/\__,_/_/\__/\__, / /_____/_/\__/____/ /____/ - npm: https://www.npmjs.com/package/solidity-bits - github: https://github.com/estarriolvetch/solidity-bits */ pragma solidity ^0.8.0; library Popcount { uint256 private constant m1 = 0x5555555555555555555555555555555555555555555555555555555555555555; uint256 private constant m2 = 0x3333333333333333333333333333333333333333333333333333333333333333; uint256 private constant m4 = 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f; uint256 private constant h01 = 0x0101010101010101010101010101010101010101010101010101010101010101; function popcount256A(uint256 x) internal pure returns (uint256 count) { unchecked{ for (count=0; x!=0; count++) x &= x - 1; } } function popcount256B(uint256 x) internal pure returns (uint256) { if (x == type(uint256).max) { return 256; } unchecked { x -= (x >> 1) & m1; //put count of each 2 bits into those 2 bits x = (x & m2) + ((x >> 2) & m2); //put count of each 4 bits into those 4 bits x = (x + (x >> 4)) & m4; //put count of each 8 bits into those 8 bits x = (x * h01) >> 248; //returns left 8 bits of x + (x<<8) + (x<<16) + (x<<24) + ... } return x; } }
// SPDX-License-Identifier: MIT /** ______ _____ _____ ______ ___ __ _ _ _ | ____| __ \ / ____|____ |__ \/_ | || || | | |__ | |__) | | / / ) || | \| |/ | | __| | _ /| | / / / / | |\_ _/ | |____| | \ \| |____ / / / /_ | | | | |______|_| \_\\_____|/_/ |____||_| |_| - github: https://github.com/estarriolvetch/ERC721Psi - npm: https://www.npmjs.com/package/erc721psi */ pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/StorageSlot.sol"; import "solidity-bits/contracts/BitMaps.sol"; contract ERC721Psi is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; using BitMaps for BitMaps.BitMap; BitMaps.BitMap internal _batchHead; string private _name; string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) internal _owners; uint256 private _currentIndex; mapping(uint256 => address) private _tokenApprovals; mapping(address => mapping(address => 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_; _currentIndex = 26667; } /** * @dev Returns the starting token ID. * To change the starting token ID, please override this function. */ function _startTokenId() internal pure returns (uint256) { // It will become modifiable in the future versions return 1; } /** * @dev Returns the next token ID to be minted. */ function _nextTokenId() internal view virtual returns (uint256) { return _currentIndex; } /** * @dev Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view virtual returns (uint256) { return _currentIndex - _startTokenId(); } /** * @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 override returns (uint) { require(owner != address(0), "ERC721Psi: balance query for the zero address"); uint count; for( uint i = _startTokenId(); i < _nextTokenId(); ++i ){ if(_exists(i)){ if( owner == ownerOf(i)){ ++count; } } } return count; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { (address owner, ) = _ownerAndBatchHeadOf(tokenId); return owner; } function _ownerAndBatchHeadOf(uint256 tokenId) internal view returns (address owner, uint256 tokenIdBatchHead){ require(_exists(tokenId), "ERC721Psi: owner query for nonexistent token"); tokenIdBatchHead = _getBatchHead(tokenId); owner = _owners[tokenIdBatchHead]; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Psi: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(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 overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ownerOf(tokenId); require(to != owner, "ERC721Psi: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721Psi: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require( _exists(tokenId), "ERC721Psi: approved query for nonexistent token" ); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721Psi: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require( _isApprovedOrOwner(_msgSender(), tokenId), "ERC721Psi: transfer caller is not owner nor approved" ); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require( _isApprovedOrOwner(_msgSender(), tokenId), "ERC721Psi: transfer caller is not owner nor approved" ); _safeTransfer(from, to, tokenId, _data); } /** * @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. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - 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, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require( _checkOnERC721Received(from, to, tokenId, 1,_data), "ERC721Psi: transfer to non ERC721Receiver implementer" ); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return tokenId < _nextTokenId() && _startTokenId() <= tokenId; } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require( _exists(tokenId), "ERC721Psi: operator query for nonexistent token" ); address owner = ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 quantity) internal virtual { _safeMint(to, quantity, ""); } function _safeMint( address to, uint256 quantity, bytes memory _data ) internal virtual { uint256 nextTokenId = _nextTokenId(); _mint(to, quantity); require( _checkOnERC721Received(address(0), to, nextTokenId, quantity, _data), "ERC721Psi: transfer to non ERC721Receiver implementer" ); } function _mint( address to, uint256 quantity ) internal virtual { uint256 nextTokenId = _nextTokenId(); require(quantity > 0, "ERC721Psi: quantity must be greater 0"); require(to != address(0), "ERC721Psi: mint to the zero address"); _beforeTokenTransfers(address(0), to, nextTokenId, quantity); _currentIndex += quantity; _owners[nextTokenId] = to; _batchHead.set(nextTokenId); _afterTokenTransfers(address(0), to, nextTokenId, quantity); // Emit events for(uint256 tokenId=nextTokenId; tokenId < nextTokenId + quantity; tokenId++){ emit Transfer(address(0), to, 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 virtual { (address owner, uint256 tokenIdBatchHead) = _ownerAndBatchHeadOf(tokenId); require( owner == from, "ERC721Psi: transfer of token that is not own" ); require(to != address(0), "ERC721Psi: transfer to the zero address"); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner _approve(address(0), tokenId); uint256 subsequentTokenId = tokenId + 1; if(!_batchHead.get(subsequentTokenId) && subsequentTokenId < _nextTokenId() ) { _owners[subsequentTokenId] = from; _batchHead.set(subsequentTokenId); } _owners[tokenId] = to; if(tokenId != tokenIdBatchHead) { _batchHead.set(tokenId); } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * 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 startTokenId uint256 the first ID of the tokens to be transferred * @param quantity uint256 amount of the tokens to be transfered. * @param _data bytes optional data to send along with the call * @return r bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 startTokenId, uint256 quantity, bytes memory _data ) private returns (bool r) { if (to.isContract()) { r = true; for(uint256 tokenId = startTokenId; tokenId < startTokenId + quantity; tokenId++){ try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { r = r && retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721Psi: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } return r; } else { return true; } } function _getBatchHead(uint256 tokenId) internal view returns (uint256 tokenIdBatchHead) { tokenIdBatchHead = _batchHead.scanForward(tokenId); } function totalSupply() public virtual view returns (uint256) { return _totalMinted(); } /** * @dev Returns an array of token IDs owned by `owner`. * * This function scans the ownership mapping and is O(`totalSupply`) in complexity. * It is meant to be called off-chain. * * This function is compatiable with ERC721AQueryable. */ function tokensOfOwner(address owner) external view virtual returns (uint256[] memory) { unchecked { uint256 tokenIdsIdx; uint256 tokenIdsLength = balanceOf(owner); uint256[] memory tokenIds = new uint256[](tokenIdsLength); for (uint256 i = _startTokenId(); tokenIdsIdx != tokenIdsLength; ++i) { if (_exists(i)) { if (ownerOf(i) == owner) { tokenIds[tokenIdsIdx++] = i; } } } return tokenIds; } } /** * @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes * minting. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - when `from` and `to` are both non-zero. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} }
// SPDX-License-Identifier: MIT /** ______ _____ _____ ______ ___ __ _ _ _ | ____| __ \ / ____|____ |__ \/_ | || || | | |__ | |__) | | / / ) || | \| |/ | | __| | _ /| | / / / / | |\_ _/ | |____| | \ \| |____ / / / /_ | | | | |______|_| \_\\_____|/_/ |____||_| |_| */ pragma solidity ^0.8.0; import "solidity-bits/contracts/BitMaps.sol"; import "./ERC721Psi.sol"; abstract contract ERC721PsiBurnable is ERC721Psi { using BitMaps for BitMaps.BitMap; BitMaps.BitMap private _burnedToken; /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address from = ownerOf(tokenId); _beforeTokenTransfers(from, address(0), tokenId, 1); _burnedToken.set(tokenId); emit Transfer(from, address(0), tokenId); _afterTokenTransfers(from, address(0), tokenId, 1); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view override virtual returns (bool){ if(_burnedToken.get(tokenId)) { return false; } return super._exists(tokenId); } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalMinted() - _burned() - 4444; } /** * @dev Returns number of token burned. */ function _burned() internal view returns (uint256 burned){ uint256 startBucket = _startTokenId() >> 8; uint256 lastBucket = (_nextTokenId() >> 8) + 1; for(uint256 i=startBucket; i < lastBucket; i++) { uint256 bucket = _burnedToken.getBucket(i); burned += _popcount(bucket); } } /** * @dev Returns number of set bits. */ function _popcount(uint256 x) private pure returns (uint256 count) { unchecked{ for (count=0; x!=0; count++) x &= x - 1; } } }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.19; interface ILocker { function isLocked(address collectionAddress, uint256 tokenId) external view returns (bool); }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.19; import "./ILocker.sol"; abstract contract UseLocker { ILocker public locker; modifier whenNotLocked(uint256 tokenId) { require( !isLocked(tokenId), "The token is loked now." ); _; } function isLocked(uint256 tokenId) public virtual view returns(bool) { return address(locker) != address(0) && locker.isLocked(address(this), tokenId); } function _setLocker(address value) internal virtual { locker = ILocker(value); } function setLocker(address value) virtual external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import {EnumerableSet} from "openzeppelin-contracts/contracts/utils/structs/EnumerableSet.sol"; import {ERC721PsiBurnable,ERC721Psi} from "./ERC721Psi/ERC721PsiBurnable.sol"; import {BitMaps} from "solidity-bits/contracts/BitMaps.sol"; import {ImmutableArray} from './libs/ImmutableArray.sol'; contract SS2ERC721PsiBurnable is ERC721PsiBurnable { using EnumerableSet for EnumerableSet.AddressSet; using BitMaps for BitMaps.BitMap; struct AddressData{ uint128 id; uint128 balance; } uint256 internal constant _addressLength = 1200; uint256 internal constant _ownerLength = 6000; uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1; bytes32 private constant _TRANSFER_EVENT_SIGNATURE = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; address[] internal _addressPointers; address[] internal _ownerPointers; mapping(address => AddressData) internal _addressDatas; BitMaps.BitMap internal _transferedToken; constructor(string memory name_, string memory symbol_) ERC721Psi(name_, symbol_) {} //public function balanceOf(address owner) public view virtual override returns (uint256) { return _addressDatas[owner].balance; } function ownerOf(uint256 tokenId) public view virtual override returns (address) { if(!_transferedToken.get(tokenId)){ require(_exists(tokenId), "ERC721Psi: owner query for nonexistent token"); uint256 pid = (tokenId-1)/_ownerLength; uint256 pindex = tokenId-1-(pid*_ownerLength); (uint16 addressIndex,,) = ImmutableArray.readUint16(_ownerPointers[pid], pindex); pid = (addressIndex)/_addressLength; pindex = addressIndex-(pid*_addressLength); (address owner,,) = ImmutableArray.readAddress(_addressPointers[pid], pindex); return owner; } return super.ownerOf(tokenId); } function _exists(uint256 tokenId) internal view override virtual returns (bool){ if(!_transferedToken.get(tokenId)) { uint256 pid = (tokenId-1)/_ownerLength; uint256 pindex = tokenId-1-(pid*_ownerLength); (uint16 addressIndex,,) = ImmutableArray.readUint16(_ownerPointers[pid], pindex); if(addressIndex == 0xffff){ return false; } return true; } return super._exists(tokenId); } //external function getAddressPointerLength() external virtual view returns(uint256) { return _addressPointers.length; } function getAddressPointer(uint256 index) external virtual view returns(address) { return _addressPointers[index]; } function getOwnerPointerLength() external virtual view returns(uint256) { return _ownerPointers.length; } function getOwnerPointer(uint256 index) external virtual view returns(address) { return _ownerPointers[index]; } function getAddressData(address _address) external virtual view returns(AddressData memory){ return _addressDatas[_address]; } // internal function _transferEvent(address[] calldata to,uint256 start) internal virtual { uint256 nextTokenId = start; uint256 toMasked; uint256 end = start + to.length; uint256 i = 1; // Use assembly to loop and emit the `Transfer` event for gas savings. // The duplicated `log4` removes an extra check and reduces stack juggling. // The assembly, together with the surrounding Solidity code, have been // delicately arranged to nudge the compiler into producing optimized opcodes. assembly { let offset := to.offset // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. toMasked := and(calldataload(offset), _BITMASK_ADDRESS) // Emit the `Transfer` event. log4( 0, // Start of data (0, since no data). 0, // End of data (0, since no data). _TRANSFER_EVENT_SIGNATURE, // Signature. 0, // `address(0)`. toMasked, // `to`. nextTokenId // `tokenId`. ) // The `iszero(eq(,))` check ensures that large values of `quantity` // that overflows uint256 will make the loop run out of gas. // The compiler will optimize the `iszero` away for performance. for { let tokenId := add(nextTokenId, 1) } iszero(eq(tokenId, end)) { tokenId := add(tokenId, 1) i := add(i, 1) } { toMasked := and(calldataload(add(offset,mul(i,32))), _BITMASK_ADDRESS) if not(iszero(toMasked)) { // Emit the `Transfer` event. Similar to above. log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId) } } } } function _pushOwnerPointer(address pointer) internal virtual { _ownerPointers.push(pointer); } function _setOwnerPointer(address pointer,uint256 index) internal virtual { _ownerPointers[index] = pointer; } function _pushAddressPointer(address pointer) internal virtual { _addressPointers.push(pointer); } function _setAddressPointer(address pointer,uint256 index) internal virtual { _addressPointers[index] = pointer; } function _setAddressData(address _address,AddressData memory _addressData) internal virtual { _addressDatas[_address] = _addressData; } function _afterTokenTransfers(address from,address to,uint256 startTokenId,uint256 amount) internal virtual override { if(!_transferedToken.get(startTokenId)) _transferedToken.set(startTokenId); unchecked { if(from != address(0)) _addressDatas[from].balance-=uint128(amount); if(to != address(0)) _addressDatas[to].balance+=uint128(amount); } } function _transfer( address from, address to, uint256 tokenId ) internal virtual override { if(!_transferedToken.get(tokenId)){ address owner = ownerOf(tokenId); require( owner == from, "SS2ERC721PsiBurnable: transfer of token that is not own" ); require(to != address(0), "SS2ERC721PsiBurnable: transfer to the zero address"); _beforeTokenTransfers(address(0), to, tokenId, 1); _approve(address(0), tokenId); _owners[tokenId] = to; _batchHead.set(tokenId); _afterTokenTransfers(address(0), to, tokenId, 1); emit Transfer(from, to, tokenId); return; } super._transfer(from,to,tokenId); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Library for reading data of contract by SSTORE2 as immutable array. /// @author 0xedy //import "forge-std/console.sol"; library ImmutableArray { uint256 private constant _DATA_OFFSET = 1; uint256 private constant _HEADER_LENGTH = 3; uint256 private constant _BYTES_ARRAY_LENGTH_ADDRESS = 2; uint256 private constant _ADDRESS_SIZE_BYTES = 20; uint256 private constant _ADDRESS_OFFSET_BYTES = 12; uint256 private constant _UINT16_SIZE_BYTES = 4; uint256 private constant _UINT16_OFFSET_BYTES = 28; uint256 private constant _UINT256_SIZE_BYTES = 32; uint256 private constant _FORMAT_BYTES = 0x40; error InvalidPointer(); error InconsistentArray(); error FormatMismatch(); error IndexOutOfBound(); /** * @dev Reads header and code size of immutable array. */ function readProperty(address pointer) internal view returns (uint256 format, uint256 length, uint256 codeSize) { assembly{ codeSize := extcodesize(pointer) if lt(codeSize, add(_DATA_OFFSET, _HEADER_LENGTH)) { // Store the function selector of `InvalidPointer()`. mstore(0x00, 0x11052bb4) // Revert with (offset, size). revert(0x1c, 0x04) } } (format, length) = readProperty_unchecked(pointer); } /** * @dev Reads header and code size of immutable array without checking. */ function readProperty_unchecked(address pointer) internal view returns (uint256 format, uint256 length) { /// @solidity memory-safe-assembly assembly { // reset scratch space mstore(0x00, 0) // copy data from pointer extcodecopy( pointer, 0, _DATA_OFFSET, _HEADER_LENGTH ) // load header to stack let val := mload(0x00) // extract 8 bits in most left for packType format := shr(248, val) // extract next 16 bits for length length := shr(240, shl(8, val)) } } function readUint256(address pointer, uint256 index) internal view returns (uint256 ret, uint256 format, uint256 length, uint256 codeSize) { (format, length, codeSize) = readProperty(pointer); // Check the consistency of array and the validity of `index`. if (format > 32) revert FormatMismatch(); if (format == 0) revert FormatMismatch(); // Check the validity of `index`. if (index + 1 > length) revert IndexOutOfBound(); // Check boundary if (_HEADER_LENGTH + length * format + _DATA_OFFSET > codeSize) revert InconsistentArray(); // Read value as uint256 ret = readUint256_unchecked(pointer, index, format); } function readUint256Next(address pointer, uint256 index, uint256 format, uint256 length) internal view returns (uint256 ret) { // Check the validity of `index`. if (index + 1 > length) revert IndexOutOfBound(); // Read value as uint256 ret = readUint256_unchecked(pointer, index, format); } function readUint256_unchecked(address pointer, uint256 index, uint256 format) internal view returns (uint256 ret) { /// @solidity memory-safe-assembly assembly { // calculates start position let start := add(_HEADER_LENGTH, mul(format, index)) // reset scratch space mstore(0x00, 0) // copy data from pointer extcodecopy( pointer, sub(_UINT256_SIZE_BYTES, format), add(start, _DATA_OFFSET), format ) // copy from memory to return stack ret := mload(0x00) } } /** * @dev Reads address at `index` in immutable array at first call in a function. * This function returns code size and header information from `pointer` contract. * Once call this, {readAddressNext} or {readAddressNext_unchecked} can be called to save gas. */ function readAddress(address pointer, uint256 index) internal view returns (address ret, uint256 length, uint256 codeSize) { uint256 format; (format, length, codeSize) = readProperty(pointer); // Check format as address if (format != _ADDRESS_SIZE_BYTES) revert FormatMismatch(); // Check the validity of `index`. if (index + 1 > length) revert IndexOutOfBound(); // Check boundary if (_HEADER_LENGTH + length * _ADDRESS_SIZE_BYTES + _DATA_OFFSET > codeSize) revert InconsistentArray(); // read address ret = readAddress_unchecked(pointer, index); } /** * @dev Reads address at `index` in immutable array after first call in a function. * This function must be provided with lenght and codeSize from the first call. */ function readAddressNext(address pointer, uint256 index, uint256 length) internal view returns (address ret) { // Check the validity of `index`. if (index + 1 > length) revert IndexOutOfBound(); // read address ret = readAddress_unchecked(pointer, index); } /** * @dev Reads address at `index` in immutable array after first call in a function. * This function must be provided with codeSize from the first call. * Also unchecking index bound to save gas. */ function readAddress_unchecked( address pointer, uint256 index ) internal view returns (address ret) { /// @solidity memory-safe-assembly assembly { // calculates start position let start := add(_HEADER_LENGTH, mul(_ADDRESS_SIZE_BYTES, index)) // reset scratch space mstore(0x00, 0) // copy data from pointer extcodecopy( pointer, _ADDRESS_OFFSET_BYTES, add(start, _DATA_OFFSET), _ADDRESS_SIZE_BYTES ) // copy from memory to return stack ret := mload(0x00) } } /** * @dev Reads address at `index` in immutable array at first call in a function. * This function returns code size and header information from `pointer` contract. * Once call this, {readAddressNext} or {readAddressNext_unchecked} can be called to save gas. */ function readUint16(address pointer, uint256 index) internal view returns (uint16 ret, uint256 length, uint256 codeSize) { uint256 format; (format, length, codeSize) = readProperty(pointer); // Check format as address if (format != _UINT16_SIZE_BYTES) revert FormatMismatch(); // Check the validity of `index`. if (index + 1 > length) revert IndexOutOfBound(); // Check boundary if (_HEADER_LENGTH + length * _UINT16_SIZE_BYTES + _DATA_OFFSET > codeSize) revert InconsistentArray(); // read address ret = readUint16_unchecked(pointer, index); } /** * @dev Reads address at `index` in immutable array after first call in a function. * This function must be provided with lenght and codeSize from the first call. */ function readUint16Next(address pointer, uint256 index, uint256 length) internal view returns (uint16 ret) { // Check the validity of `index`. if (index + 1 > length) revert IndexOutOfBound(); // read address ret = readUint16_unchecked(pointer, index); } /** * @dev Reads address at `index` in immutable array after first call in a function. * This function must be provided with codeSize from the first call. * Also unchecking index bound to save gas. */ function readUint16_unchecked( address pointer, uint256 index ) internal view returns (uint16 ret) { /// @solidity memory-safe-assembly assembly { // calculates start position let start := add(_HEADER_LENGTH, mul(_UINT16_SIZE_BYTES, index)) // reset scratch space mstore(0x00, 0) // copy data from pointer extcodecopy( pointer, _UINT16_OFFSET_BYTES, add(start, _DATA_OFFSET), _UINT16_SIZE_BYTES ) // copy from memory to return stack ret := mload(0x00) } } function readBytes(address pointer, uint256 index) internal view returns (bytes memory ret, uint256 length, uint256 codeSize) { uint256 format; (format, length, codeSize) = readProperty(pointer); // Check the consistency of array and the validity of `index`. if (format != _FORMAT_BYTES) revert FormatMismatch(); // Check the validity of `index`. if (index + 1 > length) revert IndexOutOfBound(); // Read last address. uint256 lastAddress = readUint256_unchecked(pointer, length - 1, _BYTES_ARRAY_LENGTH_ADDRESS); // Check size if (lastAddress + _DATA_OFFSET > codeSize) revert InconsistentArray(); // read bytes data. ret = readBytes_unchecked(pointer, index, length); } function readBytesNext(address pointer, uint256 index, uint256 length) internal view returns (bytes memory ret) { // Check the validity of `index`. if (index + 1 > length) revert IndexOutOfBound(); // read bytes data. ret = readBytes_unchecked(pointer, index, length); } function readBytes_unchecked(address pointer, uint256 index, uint256 length) internal view returns (bytes memory ret) { /// @solidity memory-safe-assembly assembly { // Read address list // start is the address one before index. // Since _HEADER_LENGTH > _BYTES_ARRAY_LENGTH_ADDRESS, // start is not underflow even if index is zero. let start := add( sub(_HEADER_LENGTH, _BYTES_ARRAY_LENGTH_ADDRESS), mul(index, _BYTES_ARRAY_LENGTH_ADDRESS) ) // Extract list size is 2 addresses let size := mul(_BYTES_ARRAY_LENGTH_ADDRESS, 2) // reset scratch space mstore(0x00, 0) // copy address list from pointer to scratch space. extcodecopy( pointer, sub(32, size), add(start, _DATA_OFFSET), size ) // copy address list from scratch space to stack let list := mload(0x00) // Switch which index is zero. switch gt(index, 0) case 1{ // start is after address list. start := and(shr(mul(_BYTES_ARRAY_LENGTH_ADDRESS, 8), list), 0xFFFF) } default { // start is from lower of address list start := add(_HEADER_LENGTH, mul(length, _BYTES_ARRAY_LENGTH_ADDRESS)) } // size = end - start size := sub(and(list, 0xFFFF), start) // Get the pointer to the free memory and allocate // enough 32-byte words for the data and the length of the data, // then copy the code to the allocated memory. // Masking with 0xffe0 will suffice, since contract size is less than 16 bits. ret := mload(0x40) mstore(0x40, add(ret, and(add(size, 0x3f), 0xffe0))) mstore(ret, size) mstore(add(add(ret, 0x20), size), 0) // Zeroize the last slot. extcodecopy(pointer, add(ret, 0x20), add(start, _DATA_OFFSET), size) } } }
{ "remappings": [ "@openzeppelin/=lib/openzeppelin-contracts/", "ContractAllowList/=lib/ContractAllowList/contracts/", "ERC721Psi/=lib/ERC721Psi/contracts/", "ds-test/=lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/operator-filter-registry/lib/openzeppelin-contracts/lib/erc4626-tests/", "erc721a/=lib/ERC721Psi/node_modules/erc721a/contracts/", "forge-std/=lib/forge-std/src/", "hardhat/=lib/ERC721Psi/node_modules/hardhat/", "openzeppelin-contracts-upgradeable/=lib/operator-filter-registry/lib/openzeppelin-contracts-upgradeable/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "operator-filter-registry/=lib/operator-filter-registry/", "solidity-bits/=lib/solidity-bits/" ], "optimizer": { "enabled": true, "runs": 800 }, "metadata": { "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "viaIR": true, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"FormatMismatch","type":"error"},{"inputs":[],"name":"InconsistentArray","type":"error"},{"inputs":[],"name":"IndexOutOfBound","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"OperatorNotAllowed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"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":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"BASE_EXTENSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BURNER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CONFIGURATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_FILTER_REGISTRY","outputs":[{"internalType":"contract IOperatorFilterRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WITHDRAW_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"transferer","type":"address"}],"name":"addLocalContractAllowList","outputs":[],"stateMutability":"nonpayable","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":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"burnerBurn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cal","outputs":[{"internalType":"contract IContractAllowListProxy","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"calLevel","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_address","type":"address[]"},{"internalType":"uint256","name":"startIndex","type":"uint256"}],"name":"emitTramsferEvents","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"enableRestrict","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"getAddressData","outputs":[{"components":[{"internalType":"uint128","name":"id","type":"uint128"},{"internalType":"uint128","name":"balance","type":"uint128"}],"internalType":"struct SS2ERC721PsiBurnable.AddressData","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getAddressPointer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAddressPointerLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"uint256","name":"tokenId","type":"uint256"}],"name":"getBlockedToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLocalContractAllowList","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getOwnerPointer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getOwnerPointerLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"isLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"locker","outputs":[{"internalType":"contract ILocker","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"minterMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"count","type":"uint256"}],"name":"ownerMint","outputs":[],"stateMutability":"nonpayable","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":"transferer","type":"address"}],"name":"removeLocalContractAllowList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"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":"_address","type":"address"},{"components":[{"internalType":"uint128","name":"id","type":"uint128"},{"internalType":"uint128","name":"balance","type":"uint128"}],"internalType":"struct SS2ERC721PsiBurnable.AddressData","name":"_addressData","type":"tuple"}],"name":"setAddressData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_address","type":"address[]"},{"components":[{"internalType":"uint128","name":"id","type":"uint128"},{"internalType":"uint128","name":"balance","type":"uint128"}],"internalType":"struct SS2ERC721PsiBurnable.AddressData[]","name":"_addressData","type":"tuple[]"}],"name":"setAddressDatas","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"pointer","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"setAddressPointer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_pointer","type":"address[]"},{"internalType":"uint256","name":"startIndex","type":"uint256"}],"name":"setAddressPointers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_newBaseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"setBlockedTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"value","type":"address"}],"name":"setCAL","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"setCALLevel","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":"value","type":"address"}],"name":"setLocker","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"pointer","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"setOwnerPointer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_pointer","type":"address[]"},{"internalType":"uint256","name":"startIndex","type":"uint256"}],"name":"setOwnerPointers","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":[{"internalType":"address","name":"owner","type":"address"}],"name":"tokensOfOwner","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":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"unsetBlockedTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"payable","type":"function"}]
Contract Creation Code
608060409080825234620006595760006200001a826200065e565b601382526020907f43727970746f4e696e6a61506172746e6572730000000000000000000000000082840152835162000053816200065e565b60038152620434e560ec1b8382015283516001600160401b0394909290858411620004d657600193806200008886546200067a565b92601f9384811162000629575b508790848311600114620005c5578592620005b9575b5050600019600383901b1c191690851b1784555b8251868111620005a5579185918593600295620000dd87546200067a565b8381116200056a575b508490838311600114620005045784919083620004f8575b5050600019600383901b1c191690851b1785555b61682b6004556daaeb6d7670e522a718067333cd4e803b62000452575b50600c8054336001600160a01b0319821681179092556d2e636f6d2f6e65772f6a736f6e2f60901b9691906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08580a3620001946011546200067a565b908282116200042c575b505050605d60115560118152207f68747470733a2f2f646174612e63727970746f6e696e6a61706172746e657273815501558060135560ff198181601454161760145560008052600f918284528560002033600052845260ff86600020541615620003f2575b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6806000528385528660002033600052855260ff87600020541615620003b6575b507f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a848806000528385528660002033600052855260ff876000205416156200037a575b507f3b49a237fe2d18fa4d9642b8a0e065923cceb71b797783b619a030a61d848bf092836000528085528660002033600052855260ff876000205416156200033d575b505050508251838101928184109084111762000327576103e8928452730a2c099044c088a431b78a0d6bb5a137a5663297815201527503e80a2c099044c088a431b78a0d6bb5a137a5663297600d55516149e19081620006d18239f35b634e487b7160e01b600052604160045260246000fd5b83600052845285600020336000528452856000209182541617905533903390600080516020620050b2833981519152600080a438808080620002ca565b806000528385528660002033600052855286600020828482541617905533903390600080516020620050b2833981519152600080a43862000287565b806000528385528660002033600052855286600020828482541617905533903390600080516020620050b2833981519152600080a43862000245565b600080528284528560002033600052845285600020818382541617905533336000600080516020620050b28339815191528180a462000204565b6200044992601160005285600020920160051c82019101620006b7565b3880806200019e565b9193509150803b15620004f45782809160448a5180948193633e9f1edf60e11b8352306004840152733cc6cdda760b79bafa08df41ecfa224f810dceb660248401525af18015620004ea57918593918793156200012f57889194508092935011620004d657875283918591906d2e636f6d2f6e65772f6a736f6e2f60901b6200012f565b634e487b7160e01b82526041600452602482fd5b88513d85823e3d90fd5b8280fd5b015190503880620000fe565b8785528585209190601f198416865b818110620005525750908489959493921062000538575b505050811b01855562000112565b015160001960f88460031b161c191690553880806200052a565b8383015185558b998d99950194938401930162000513565b62000594908886528686208580860160051c8201928987106200059b575b0160051c0190620006b7565b38620000e6565b9250819262000588565b634e487b7160e01b83526041600452602483fd5b015190503880620000ab565b8786528886208894509190601f198416875b8b828210620006125750508411620005f8575b505050811b018455620000bf565b015160001960f88460031b161c19169055388080620005ea565b8385015186558b97909501949384019301620005d7565b62000652908887528987208680860160051c8201928c87106200059b570160051c0190620006b7565b3862000095565b600080fd5b604081019081106001600160401b038211176200032757604052565b90600182811c92168015620006ac575b60208310146200069657565b634e487b7160e01b600052602260045260246000fd5b91607f16916200068a565b818110620006c3575050565b60008155600101620006b756fe6080604052600436101561001257600080fd5b60003560e01c80623f332f1461041657806301ffc9a714610411578063025e332e1461040c57806304634d8d1461040757806306fdde031461040257806307265389146103fd578063081812fc146103f8578063095ea7b3146103f35780630f4345e2146103ee578063122e04a8146103e9578063171060ec146103e457806318160ddd146103df5780631fffe2b0146103da57806321f314ca146103d557806323b872dd146103d0578063248a9ca3146103cb578063282c51f3146103c657806329b3ed8b146103c15780632a55205a146103bc5780632f2ff15d146103b75780633279da60146103b257806336568abe146103ad5780633ccfd60b146103a85780633efd0e13146103a357806341f434341461039e57806342842e0e14610399578063484b973c146103945780634f6878641461038f57806355f804b31461038a5780635e19a537146103855780636352211e146103805780636c0360eb1461037b57806370a0823114610376578063715018a61461037157806372b44d711461036c5780638462151c146103675780638da5cb5b146103625780638fd124801461035d57806391d1485414610358578063925e34c51461035357806394cedaee1461034e57806395d89b4114610349578063a217fddf14610344578063a22cb4651461033f578063ae66a5bb1461033a578063b4fc5cbe14610335578063b7c738f414610330578063b8768b1c1461032b578063b88d4fde14610326578063c87b56dd14610321578063cc835a881461031c578063d11f829414610317578063d539139314610312578063d547741f1461030d578063d7b96d4e14610308578063d853015e14610303578063df3fdf00146102fe578063e0284ccb146102f9578063e08668ca146102f4578063e985e9c5146102ef578063f02f5baf146102ea578063f2fde38b146102e5578063f6aacfb1146102e05763ff768212146102db57600080fd5b6127fd565b6127df565b612702565b6126c8565b61268a565b6125bf565b612565565b612549565b6124c2565b61249b565b612459565b61241e565b6123a2565b612384565b612285565b612202565b61216d565b612146565b61208e565b612013565b611e91565b611e6b565b611dc4565b611cf9565b611c54565b611bfd565b611b80565b611b59565b611a9c565b611a2b565b6119cf565b61198e565b61195e565b61184a565b6117b5565b611689565b611577565b611474565b6113e4565b6113bb565b6112e8565b611261565b6111bd565b61115e565b611085565b610fd5565b610fb7565b610f7c565b610f4d565b610ef9565b610cb5565b610b4d565b610a66565b6109ff565b6109d0565b6109af565b610879565b61084a565b610827565b610747565b6105c9565b610585565b6104ee565b346104d7576000806003193601126104d45760405180916016549081835260208093018092601683527fd833147d7dc355ba459fc788f669e58cfaf9dc25ddcd0702e87d69c7b512428990835b8181106104c05750505084610479910385611605565b60405193838594850191818652518092526040850193925b8281106104a057505050500390f35b83516001600160a01b031685528695509381019392810192600101610491565b825484529286019260019283019201610463565b80fd5b600080fd5b6001600160e01b03198116036104d757565b346104d75760203660031901126104d757602060043561050d816104dc565b6001600160e01b03198116637965db0b60e01b14908115610563575b8115610552575b8115610542575b506040519015158152f35b61054c915061327d565b38610537565b905061055d816133c3565b90610530565b905061056e8161327d565b90610529565b6001600160a01b038116036104d757565b346104d75760203660031901126104d7576001600160a01b036004356105aa81610574565b6105b2612a2b565b166001600160a01b03196012541617601255600080f35b346104d75760403660031901126104d7576004356105e681610574565b602435906bffffffffffffffffffffffff82168083036104d7576127109061060c612a2b565b116106805761065b61067e9261062c6001600160a01b038416151561306f565b610646610637611627565b6001600160a01b039094168452565b6bffffffffffffffffffffffff166020830152565b6001600160a01b031960206001600160a01b0383511692015160a01b1617600d55565b005b60405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c2065786365656460448201527f2073616c655072696365000000000000000000000000000000000000000000006064820152608490fd5b60005b8381106106fe5750506000910152565b81810151838201526020016106ee565b90602091610727815180928185528580860191016106eb565b601f01601f1916010190565b90602061074492818152019061070e565b90565b346104d7576000806003193601126104d4576040519080600180549161076c83611868565b808652928281169081156107fd57506001146107a3575b61079f8561079381870382611605565b60405191829182610733565b0390f35b92508083527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf65b8284106107e55750505081016020016107938261079f610783565b805460208587018101919091529093019281016107ca565b86955061079f9693506020925061079394915060ff191682840152151560051b8201019293610783565b346104d75760003660031901126104d757602060ff601454166040519015158152f35b346104d75760203660031901126104d757602061086860043561354a565b6001600160a01b0360405191168152f35b346104d75760403660031901126104d75760043561089681610574565b6024356108ab6108a582613d10565b1561315c565b6108b481613dcb565b6001600160a01b03808216809185161461095e57331490811561094c575b50156108e15761067e9161388e565b60405162461bcd60e51b815260206004820152603b60248201527f4552433732315073693a20617070726f76652063616c6c6572206973206e6f7460448201527f206f776e6572206e6f7220617070726f76656420666f7220616c6c00000000006064820152608490fd5b6109589150339061337b565b386108d2565b60405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a20617070726f76616c20746f2063757272656e74206f6044820152633bb732b960e11b6064820152608490fd5b346104d75760203660031901126104d7576109c8612a2b565b600435601355005b346104d75760003660031901126104d7576020604051730a2c099044c088a431b78a0d6bb5a137a56632978152f35b346104d75760203660031901126104d7576001600160a01b03600435610a2481610574565b33600090815260008051602061498c83398151915260205260409020610a4f9060ff905b5416612cc6565b166001600160a01b03196010541617601055600080f35b346104d7576000806003193601126104d4576004546000198082019290828411610b1757819260081c91600190818401809411610b1757929190835b838510610ace5761079f610abe610ab9888a612f54565b612f35565b6040519081529081906020820190565b90919293948582526007602052604082205490838284935b610b08575050610aff91610af991612b05565b95612ca7565b93929190610aa2565b92019184908087011680610ae6565b612aa9565b9181601f840112156104d75782359167ffffffffffffffff83116104d7576020808501948460051b0101116104d757565b346104d7576040806003193601126104d757600490813591610b6e83610574565b6024803567ffffffffffffffff81116104d757610b8e9036908401610b1c565b937f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a848600052602091600f835260ff610bdc3384600020906001600160a01b0316600052602052604060002090565b541615610c7357946000906001600160a01b03809816915b818110610bfd57005b610c0881838a612cb6565b3589610c1382613dcb565b168403610c315790610c27610c2c92613bfe565b612ca7565b610bf4565b845162461bcd60e51b81528089018790526014818901527f61646472657373206973206e6f74206f776e65720000000000000000000000006044820152606490fd5b815162461bcd60e51b81528086018490526016818601527f43616c6c6572206973206e6f742061206275726e6572000000000000000000006044820152606490fd5b346104d75760403660031901126104d757600435610cd281610574565b3360009081527f3ac2ae920192ffec1f2616e363ccfeffb7844a5d9224b2df5eacfefada83760760205260408120549091906024359060ff1615610e8857604051610d1c816115cc565b838152600454918015610e1d576001600160a01b03841692610d3f841515613770565b610d48816137c8565b610d5a610d558383612b05565b600455565b610d8d85610d72836000526003602052604060002090565b906001600160a01b03166001600160a01b0319825416179055565b610db3818060081c600052600060205260406000209060ff6001811b91161c8154179055565b610dbe82828761424b565b805b610dca8383612b05565b811015610e065780610e019186897fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4612ca7565b610dc0565b50610e159350610e1a94613968565b613641565b80f35b60405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a207175616e74697479206d757374206265206772656160448201527f74657220300000000000000000000000000000000000000000000000000000006064820152608490fd5b60405162461bcd60e51b815260206004820152601660248201527f43616c6c6572206973206e6f742061206d696e746572000000000000000000006044820152606490fd5b60609060031901126104d757600435610ee581610574565b90602435610ef281610574565b9060443590565b346104d75761067e610f0a36610ecd565b91336001600160a01b03821603610f3f575b610f286108a584613d10565b610f3a610f3584336136b3565b6135cf565b6144d2565b610f48336131c9565b610f1c565b346104d75760203660031901126104d757600435600052600f6020526020600160406000200154604051908152f35b346104d75760003660031901126104d75760206040517f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a8488152f35b346104d75760003660031901126104d7576020600854604051908152f35b346104d75760403660031901126104d757600435600052600e602052604060002060405190611003826115ab565b54906001600160a01b03908183169283825260a01c60208201529115611075575b61104d6110456bffffffffffffffffffffffff602085015116602435612ad6565b612710900490565b91511661079f60405192839283602090939291936001600160a01b0360408201951681520152565b905061107f612a83565b90611024565b346104d75760403660031901126104d7576004356024356110a581610574565b600091808352600f6020526110c06001604085200154612833565b808352600f60205260ff6110ea8360408620906001600160a01b0316600052602052604060002090565b5416156110f5578280f35b808352600f60205261111d8260408520906001600160a01b0316600052602052604060002090565b805460ff1916600117905533916001600160a01b0316907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8480a438808280f35b346104d75760203660031901126104d7576004356008548110156111b8576001600160a01b0360209160086000527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee3015416604051908152f35b612b71565b346104d75760403660031901126104d7576024356111da81610574565b336001600160a01b038216036111f65761067e90600435612992565b60405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608490fd5b6000806003193601126104d457611276612a2b565b8080808047730a2c099044c088a431b78a0d6bb5a137a56632975af161129a61312c565b50156112a35780f35b60405162461bcd60e51b815260206004820152600e60248201527f7769746864726177206572726f720000000000000000000000000000000000006044820152606490fd5b346104d75760603660031901126104d75760043561130581610574565b60403660231901126104d75733600090815260008051602061498c8339815191526020526040812090919061133c9060ff90610a48565b604051611348816115ab565b6001600160801b039160243583811681036113b757825260443592831683036113b357610e1a9260208301526001600160a01b03166000908152600a602090815260409091208251919092015160801b6001600160801b0319166001600160801b0391909116179055565b8380fd5b8480fd5b346104d75760003660031901126104d75760206040516daaeb6d7670e522a718067333cd4e8152f35b346104d75761067e610e156113f836610ecd565b90336001600160a01b03841614159283611466575b6114196108a584613d10565b60405193611426856115cc565b60008552611458575b61143b6108a584613d10565b611448610f3584336136b3565b6114538383836144d2565b613af8565b611461336131c9565b61142f565b61146f336131c9565b61140d565b346104d75760403660031901126104d75760043561149181610574565b6024359061149d612a2b565b604051916114aa836115cc565b600092838152600454918015610e1d576001600160a01b038416926114d0841515613770565b6114d9816137c8565b6114e6610d558383612b05565b6114fe85610d72836000526003602052604060002090565b611524818060081c600052600060205260406000209060ff6001811b91161c8154179055565b61152f82828761424b565b805b61153b8383612b05565b811015610e0657806115729186897fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4612ca7565b611531565b346104d75760003660031901126104d7576020600954604051908152f35b634e487b7160e01b600052604160045260246000fd5b6040810190811067ffffffffffffffff8211176115c757604052565b611595565b6020810190811067ffffffffffffffff8211176115c757604052565b610120810190811067ffffffffffffffff8211176115c757604052565b90601f8019910116810190811067ffffffffffffffff8211176115c757604052565b60405190611634826115ab565b565b67ffffffffffffffff81116115c757601f01601f191660200190565b92919261165e82611636565b9161166c6040519384611605565b8294818452818301116104d7578281602093846000960137010152565b346104d7576020806003193601126104d75767ffffffffffffffff6004358181116104d757366023820112156104d7576116cd903690602481600401359101611652565b916116d6612a2b565b82519182116115c7576116f3826116ee601154611868565b6130bb565b80601f831160011461172e57508192600092611723575b5050600019600383901b1c191660019190911b17601155005b01519050388061170a565b90601f1983169361176160116000527f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c6890565b926000905b86821061179d5750508360019510611784575b505050811b01601155005b015160001960f88460031b161c19169055388080611779565b80600185968294968601518155019501930190611766565b346104d75760403660031901126104d7576004356117d281610574565b33600090815260008051602061498c8339815191526020526040902060243591906117ff9060ff90610a48565b6009548210156111b85761067e917f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af01906001600160a01b03166001600160a01b0319825416179055565b346104d75760203660031901126104d7576020610868600435613dcb565b90600182811c92168015611898575b602083101461188257565b634e487b7160e01b600052602260045260246000fd5b91607f1691611877565b60405190600082601154916118b683611868565b8083529260019081811690811561193c57506001146118dd575b5061163492500383611605565b6011600090815291507f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c685b84831061192157506116349350508101602001386118d0565b81935090816020925483858a01015201910190918592611908565b90506020925061163494915060ff191682840152151560051b820101386118d0565b346104d75760003660031901126104d75761079f61197a6118a2565b60405191829160208352602083019061070e565b346104d75760203660031901126104d7576001600160a01b036004356119b381610574565b16600052600a602052602060406000205460801c604051908152f35b346104d7576000806003193601126104d4576119e9612a2b565b806001600160a01b03600c546001600160a01b03198116600c55167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b346104d75760203660031901126104d75761067e6001600160a01b03600435611a5381610574565b611a5b612a2b565b16612fbd565b6020908160408183019282815285518094520193019160005b828110611a88575050505090565b835185529381019392810192600101611a7a565b346104d75760203660031901126104d757600435611ab981610574565b6001600160a01b039081166000818152600a602052604081205460801c90611ae082613bd2565b92611aee6040519485611605565b828452601f19611afd84613bd2565b01366020860137600194855b848403611b1e576040518061079f8882611a61565b80611b29889261418e565b611b34575b01611b09565b8383611b3f83613dcb565b1603611b2e5780611b538387019689613bea565b52611b2e565b346104d75760003660031901126104d75760206001600160a01b03600c5416604051908152f35b346104d75760203660031901126104d7576001600160a01b03600435611ba581610574565b60006020604051611bb5816115ab565b828152015216600052600a602052604080600020815190611bd5826115ab565b546001600160801b0390602082821693848152019060801c8152835192835251166020820152f35b346104d75760403660031901126104d757602060ff611c48602435611c2181610574565b600435600052600f84526040600020906001600160a01b0316600052602052604060002090565b54166040519015158152f35b346104d75760403660031901126104d75767ffffffffffffffff6004358181116104d757611c86903690600401610b1c565b9190602435928284116104d757366023850112156104d75783600401359283116104d7573660248460061b860101116104d757602461067e940191612d26565b60406003198201126104d7576004359067ffffffffffffffff82116104d757611cf191600401610b1c565b909160243590565b346104d757611d0736611cc6565b33600090815260008051602061498c833981519152602052604081209093929190611d349060ff90610a48565b818110611d3f578380f35b611d4a818385612cb6565b3590611d5582610574565b6008805492680100000000000000008410156115c7576001938481018084558110156111b857611dbe9288527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee301906001600160a01b03166001600160a01b0319825416179055565b01611d34565b346104d7576000806003193601126104d4576040519080600254611de781611868565b808552916001918083169081156107fd5750600114611e105761079f8561079381870382611605565b9250600283527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace5b828410611e535750505081016020016107938261079f610783565b80546020858701810191909152909301928101611e38565b346104d75760003660031901126104d757602060405160008152f35b801515036104d757565b346104d75760403660031901126104d757600435611eae81610574565b602435611eba81611e87565b611ec3826132a6565b8015611fdc575b15611f97576001600160a01b03821691338314611f525781611f0f611f20923360005260066020526040600020906001600160a01b0316600052602052604060002090565b9060ff801983541691151516179055565b604051901515815233907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3190602090a3005b60405162461bcd60e51b815260206004820152601c60248201527f4552433732315073693a20617070726f766520746f2063616c6c6572000000006044820152606490fd5b60405162461bcd60e51b815260206004820152601c60248201527f43616e206e6f7420617070726f7665206c6f636b656420746f6b656e000000006044820152606490fd5b508015611eca565b60206003198201126104d7576004359067ffffffffffffffff82116104d75761200f91600401610b1c565b9091565b346104d75761202136611fe4565b33600090815260008051602061498c8339815191526020908152604080832092949360ff93612051908590610a48565b855b81811061205e578680f35b8061206c6001928489612cb6565b358060081c89526015865284892090878460ff1b91161c815417905501612053565b346104d75761209c36611cc6565b33600090815260008051602061498c833981519152602052604081209092906120c79060ff90610a48565b810190818111610b17579060019182906001600160a01b0395847fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92808984351689868180a4015b84810361211a578680f35b858181928a8760051b8601351680151961213a575b50500193019261210f565b8a878180a4803861212f565b346104d75760003660031901126104d75760206001600160a01b0360125416604051908152f35b346104d75760403660031901126104d75760043561218a81610574565b33600090815260008051602061498c8339815191526020526040902060243591906121b79060ff90610a48565b6008548210156111b85761067e917ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee301906001600160a01b03166001600160a01b0319825416179055565b346104d75760803660031901126104d75760043561221f81610574565b6024359061222c82610574565b6064359060443567ffffffffffffffff83116104d757366023840112156104d75761067e93612268610e15943690602481600401359101611652565b92336001600160a01b038216036114585761143b6108a584613d10565b346104d75760203660031901126104d7576004356122a28161418e565b15612319576122af6118a2565b805115612301576107936122e26122f66122e2936122e86122d261079f97613407565b604051948593602085019061297b565b9061297b565b03601f198101835282611605565b6122e86122d2612510565b505061079f6122e26107936123146124fd565b6122f6565b60405162461bcd60e51b815260206004820152602a60248201527f4552433732315073693a2055524920717565727920666f72206e6f6e6578697360448201527f74656e7420746f6b656e000000000000000000000000000000000000000000006064820152608490fd5b346104d75760003660031901126104d7576020601354604051908152f35b346104d7576123b036611fe4565b33600090815260008051602061498c8339815191526020908152604080832092949360ff936123e0908590610a48565b855b8181106123ed578680f35b806123fb6001928489612cb6565b358060081c89526015865284892090878460ff1b91161c198154169055016123e2565b346104d75760003660031901126104d75760206040517f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a68152f35b346104d75760403660031901126104d75761067e60243560043561247c82610574565b80600052600f602052612496600160406000200154612833565b612992565b346104d75760003660031901126104d75760206001600160a01b0360105416604051908152f35b346104d75760003660031901126104d75760206040517f3b49a237fe2d18fa4d9642b8a0e065923cceb71b797783b619a030a61d848bf08152f35b6040519061250a826115cc565b60008252565b6040519061251d826115ab565b600582527f2e6a736f6e0000000000000000000000000000000000000000000000000000006020830152565b346104d75760003660031901126104d75761079f61197a612510565b346104d75760203660031901126104d7576004356009548110156111b8576001600160a01b0360209160096000527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af015416604051908152f35b346104d7576125cd36611cc6565b33600090815260008051602061498c8339815191526020526040812090939291906125fa9060ff90610a48565b818110612605578380f35b612610818385612cb6565b359061261b82610574565b6009805492680100000000000000008410156115c7576001938481018084558110156111b8576126849288527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af01906001600160a01b03166001600160a01b0319825416179055565b016125fa565b346104d75760403660031901126104d75760206126be6004356126ac81610574565b602435906126b982610574565b61337b565b6040519015158152f35b346104d75760203660031901126104d75760206126be6004358060081c600052601560205260ff6001811b91161c60406000205416151590565b346104d75760203660031901126104d75760043561271f81610574565b612727612a2b565b6001600160a01b0380911690811561277457600c54826001600160a01b0319821617600c55167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3005b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608490fd5b346104d75760203660031901126104d75760206126be600435613d10565b346104d75760203660031901126104d75761067e6001600160a01b0360043561282581610574565b61282d612a2b565b16612eb9565b80600052600f908160205260ff612861336040600020906001600160a01b0316600052602052604060002090565b54161561286c575050565b33612875612b12565b92603061288185612b87565b53607861288d85612b94565b536029905b60018211612939576129356128f461291d876122e86128ba896128b58a15612bc2565b612c0d565b6122e26040519586946122e2602087016017907f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081520190565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000815260110190565b60405162461bcd60e51b815291829160048301610733565b0390fd5b90918181169060108210156111b8576f181899199a1a9b1b9c1cb0b131b232b360811b612975921a61296b8588612ba4565b5360041c92612bb5565b90612892565b9061298e602092828151948592016106eb565b0190565b600090808252600f60205260ff6129bf8460408520906001600160a01b0316600052602052604060002090565b54166129ca57505050565b808252600f6020526129f28360408420906001600160a01b0316600052602052604060002090565b60ff1981541690557ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b6001600160a01b033394169280a4565b6001600160a01b03600c54163303612a3f57565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b60405190612a90826115ab565b600d546001600160a01b038116835260a01c6020830152565b634e487b7160e01b600052601160045260246000fd5b9061177091828102928184041490151715610b1757565b81810292918115918404141715610b1757565b9060018201809211610b1757565b6003019081600311610b1757565b91908201809211610b1757565b604051906060820182811067ffffffffffffffff8211176115c757604052602a8252604082602036910137565b90612b4982611636565b612b566040519182611605565b8281528092612b67601f1991611636565b0190602036910137565b634e487b7160e01b600052603260045260246000fd5b8051156111b85760200190565b8051600110156111b85760210190565b9081518110156111b8570160200190565b8015610b17576000190190565b15612bc957565b606460405162461bcd60e51b815260206004820152602060248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b604051906080820182811067ffffffffffffffff8211176115c7576040526042825260603660208401376030612c4283612b87565b536078612c4e83612b94565b536041905b60018211612c6657610744915015612bc2565b600f81169060108210156111b8576f181899199a1a9b1b9c1cb0b131b232b360811b612ca1921a612c978486612ba4565b5360041c91612bb5565b90612c53565b6000198114610b175760010190565b91908110156111b85760051b0190565b15612ccd57565b60405162461bcd60e51b815260206004820152601b60248201527f43616c6c6572206973206e6f74206120636f6e6669677261746f7200000000006044820152606490fd5b35906001600160801b03821682036104d757565b33600090815260008051602061498c8339815191526020908152604080832092969395939491939092909190612d5e9060ff90610a48565b865b818110612d71575050505050505050565b612d7c818389612cb6565b35612d8681610574565b868210156111b8578160061b8401908582360312612e105760019291612e0a91612dc789895193612db6856115ab565b612dbf81612d12565b855201612d12565b898301526001600160a01b03166000908152600a602090815260409091208251919092015160801b6001600160801b0319166001600160801b0391909116179055565b01612d60565b8980fd5b6009548110156111b85760096000527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af0190600090565b6008548110156111b85760086000527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30190600090565b6016548110156111b85760166000527fd833147d7dc355ba459fc788f669e58cfaf9dc25ddcd0702e87d69c7b51242890190600090565b80600052601760205260406000205415600014612f2f57601654680100000000000000008110156115c75760018101806016558110156111b85781907fd833147d7dc355ba459fc788f669e58cfaf9dc25ddcd0702e87d69c7b51242890155601654906000526017602052604060002055600190565b50600090565b61115b19810191908211610b1757565b600019810191908211610b1757565b91908203918211610b1757565b6016548015612fa757600019810190808210156111b8577fd833147d7dc355ba459fc788f669e58cfaf9dc25ddcd0702e87d69c7b5124288600091601683520155601655565b634e487b7160e01b600052603160045260246000fd5b6000818152601760205260409020548015613068576000199181830191808311610b1757601654938401938411610b17578383613018946000960361301e575b505050613008612f61565b6000526017602052604060002090565b55600190565b6130086130469161303e61303461305f95612e82565b90549060031b1c90565b928391612e82565b90919082549060031b91821b91600019901b1916179055565b55388080612ffd565b5050600090565b1561307657565b60405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606490fd5b601f81116130c7575050565b600090601182527f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c68906020601f850160051c83019410613122575b601f0160051c01915b82811061311757505050565b81815560010161310b565b9092508290613102565b3d15613157573d9061313d82611636565b9161314b6040519384611605565b82523d6000602084013e565b606090565b1561316357565b60405162461bcd60e51b815260206004820152601760248201527f54686520746f6b656e206973206c6f6b6564206e6f772e0000000000000000006044820152606490fd5b908160209103126104d7575161074481611e87565b6040513d6000823e3d90fd5b6daaeb6d7670e522a718067333cd4e803b6131e2575050565b602060449160405192838092633185c44d60e21b82523060048301526001600160a01b03871660248301525afa9081156132785760009161324a575b50156132275750565b604051633b79c77360e21b81526001600160a01b03919091166004820152602490fd5b61326b915060203d8111613271575b6132638183611605565b8101906131a8565b3861321e565b503d613259565b6131bd565b6001600160e01b0319811663152a902d60e11b1490811561329c575090565b61074491506133c3565b6132b96132b560145460ff1690565b1590565b613375576132dd6001600160a01b0382166000526017602052604060002054151590565b9081156132e8575090565b61334691506020906133116133056012546001600160a01b031690565b6001600160a01b031690565b601354604051630f8350ed60e41b81526001600160a01b03909316600484015260248301529092839190829081906044820190565b03915afa9081156132785760009161335d575b5090565b610744915060203d8111613271576132638183611605565b50600190565b613384826132a6565b156130685760ff916001600160a01b036133be921660005260066020526040600020906001600160a01b0316600052602052604060002090565b541690565b63ffffffff60e01b166380ac58cd60e01b81149081156133f6575b81156133e8575090565b6301ffc9a760e01b14919050565b635b5e139f60e01b811491506133de565b806000917a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008082101561353c575b506d04ee2d6d415b85acef81000000008083101561352d575b50662386f26fc100008083101561351e575b506305f5e1008083101561350f575b5061271080831015613500575b5060648210156134f0575b600a809210156134e6575b60019081602161349e828701612b3f565b95860101905b6134b0575b5050505090565b600019019083906f181899199a1a9b1b9c1cb0b131b232b360811b8282061a8353049182156134e1579190826134a4565b6134a9565b916001019161348d565b9190606460029104910191613482565b60049193920491019138613477565b6008919392049101913861346a565b6010919392049101913861345b565b60209193920491019138613449565b604093508104915038613430565b6135538161418e565b156135725760005260056020526001600160a01b036040600020541690565b60405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a20617070726f76656420717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608490fd5b156135d657565b60405162461bcd60e51b815260206004820152603460248201527f4552433732315073693a207472616e736665722063616c6c6572206973206e6f60448201527f74206f776e6572206e6f7220617070726f7665640000000000000000000000006064820152608490fd5b1561364857565b60405162461bcd60e51b815260206004820152603560248201527f4552433732315073693a207472616e7366657220746f206e6f6e20455243373260448201527f31526563656976657220696d706c656d656e74657200000000000000000000006064820152608490fd5b6136bc8261418e565b15613713576136ca82613dcb565b6001600160a01b038083169080831682149485156136fb575b50505082156136f157505090565b610744925061337b565b613708919293955061354a565b1614913880806136e3565b60405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a206f70657261746f7220717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608490fd5b1561377757565b60405162461bcd60e51b815260206004820152602360248201527f4552433732315073693a206d696e7420746f20746865207a65726f206164647260448201526265737360e81b6064820152608490fd5b6137ed908060081c600052601560205260ff6001811b91161c60406000205416151590565b6137f357565b60405162461bcd60e51b815260206004820152601f60248201527f5468697320746f6b656e20494420686173206265656e20626c6f636b65642e006044820152606490fd5b80600052600560205260406000206001600160a01b0319815416905560006001600160a01b0361386783613dcb565b167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258280a4565b8160005260056020526138bb816040600020906001600160a01b03166001600160a01b0319825416179055565b6001600160a01b03806138cd84613dcb565b169116907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600080a4565b908160209103126104d75751610744816104dc565b61074493926001600160a01b03608093168252600060208301526040820152816060820152019061070e565b909261074494936080936001600160a01b0380921684521660208301526040820152816060820152019061070e565b909290803b15613aef5792919060018091819585935b61398c575b50505050505090565b61399a858798999697612b05565b841015613ae657604095865197630a85bd0160e11b998a8a5260209a8b60049b808d898c33928401926139cc9361390d565b0390828160009381856001600160a01b038d165af1919282613ab7575b5050613a79578c8c8c6139fa61312c565b80519384613a7357825162461bcd60e51b815260208186018181526035918101919091527f4552433732315073693a207472616e7366657220746f206e6f6e20455243373260408201527f31526563656976657220696d706c656d656e7465720000000000000000000000606082015281906080010390fd5b84925001fd5b91939699509194979a50613a989396995082613aa3575b505096612ca7565b92859294919561397e565b6001600160e01b0319161490503880613a90565b613ad7929350803d10613adf575b613acf8183611605565b8101906138f8565b90388e6139e9565b503d613ac5565b84979650613983565b50505050600190565b919290803b15613aef5790929160019081948285935b613b1b5750505050505090565b613b288697989596612ae9565b841015613ae657604095865197630a85bd0160e11b998a8a5260209a8b60049b808d898c8c3393850193613b5b94613939565b0390828160009381856001600160a01b038c165af1919282613bb3575b5050613b89578c8c8c6139fa61312c565b91939699509194979a50613ba79396995082613aa357505096612ca7565b92809592949195613b0e565b613bca929350803d10613adf57613acf8183611605565b90388e613b78565b67ffffffffffffffff81116115c75760051b60200190565b80518210156111b85760209160051b010190565b613c0781613dcb565b90613c2d818060081c600052601560205260ff6001811b91161c60406000205416151590565b6137f3576001600160a01b036000928260081c8452600760205260408420600160ff1b60ff85161c815417905516908083837fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8280a4600881901c6000908152600b6020526040902054600160ff1b60ff83161c1615613ce4575b5080613cb2575050565b8152600a6020526040902080546001600160801b038116608091821c6000190190911b6001600160801b031916179055565b613d0a908060081c600052600b60205260406000209060ff6001811b91161c8154179055565b38613ca8565b6001600160a01b0360105416908115159182613d2b57505090565b60405163267328db60e21b815230600482015260248101929092529091506020908290818060448101613346565b15613d6057565b60405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a206f776e657220717565727920666f72206e6f6e657860448201527f697374656e7420746f6b656e00000000000000000000000000000000000000006064820152608490fd5b600881901c6000908152600b6020526040902054600160ff1b60ff83161c1615613df85761335990613eac565b613e09613e048261418e565b613d59565b6000198101818111610b1757611770613e23910491612f45565b90613e2d81612abf565b8203918211610b175761ffff916001600160a01b03613e4e613e5b93612e14565b90549060031b1c16614923565b5050166104b09081810490828202928284041482151715610b1757613e8f613e89613ea794613ea293612f54565b92612e4b565b90546001600160a01b039160031b1c1690565b614841565b505090565b613eb8613e048261418e565b600090600891604060ff83851c9316918381528060205220548160ff181c801515600014613f1f57613eec613ef291613fe3565b60ff1690565b9003911b175b613f1c613f0f826000526003602052604060002090565b546001600160a01b031690565b91565b50505b613f2d811515613f71565b60001901613f45816000526000602052604060002090565b5480613f515750613f22565b613eec613f60613f6992613fe3565b60ff9081031690565b911b17613ef8565b15613f7857565b60405162461bcd60e51b815260206004820152603460248201527f4269744d6170733a205468652073657420626974206265666f7265207468652060448201527f696e64657820646f65736e27742065786973742e0000000000000000000000006064820152608490fd5b604051613fef816115e8565b7ffd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f86101008083527e01020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7560208401527f06264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c960408401527f071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee360608401527f0e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf760808401527fff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c860a08401527f16365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f660c08401527ffe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf560e084015282015281156104d757614162614188917e818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff8461074495600003160260f81c90612ba4565b517fff000000000000000000000000000000000000000000000000000000000000001690565b60f81c90565b600881901c6000908152600b6020526040902054600160ff1b60ff83161c16156141bb5761074490614212565b6000198101818111610b17576117706141d5910491612f45565b6141de82612abf565b8103908111610b17576001600160a01b03613e4e6141fb93612e14565b505061ffff8091161461420d57600190565b600090565b8060081c6000526007602052600160ff1b60ff82161c60406000205416612f2f5760045481109081614242575090565b90506001111590565b9190614272818060081c600052600b60205260ff6001811b91161c60406000205416151590565b156142d6575b506001600160a01b03821661428b575050565b6142ab611634926001600160a01b0316600052600a602052604060002090565b80546001600160801b03818116608092831c9190941601901b6001600160801b031916919091179055565b6142fc908060081c600052600b60205260406000209060ff6001811b91161c8154179055565b38614278565b90614328818060081c600052600b60205260ff6001811b91161c60406000205416151590565b15614386575b506001600160a01b0381166143405750565b614360611634916001600160a01b0316600052600a602052604060002090565b80546001600160801b038116608091821c60010190911b6001600160801b031916179055565b6143ac908060081c600052600b60205260406000209060ff6001811b91161c8154179055565b3861432e565b90916143d9818060081c600052600b60205260ff6001811b91161c60406000205416151590565b15614434575b506001600160a01b03809116806143fb575b5081166143405750565b6000908152600a6020526040902080546001600160801b038116608091821c6000190190911b6001600160801b031916179055386143f1565b61445a908060081c600052600b60205260406000209060ff6001811b91161c8154179055565b386143df565b1561446757565b60405162461bcd60e51b815260206004820152603260248201527f5353324552433732315073694275726e61626c653a207472616e73666572207460448201527f6f20746865207a65726f206164647265737300000000000000000000000000006064820152608490fd5b600883901c6000908152600b6020526040902054600160ff1b60ff85161c16156145015790611634929161468c565b61450a83613dcb565b6001600160a01b03918216919081168290036145af578361458891841693614533851515614460565b61453c826137c8565b61454582613838565b61455d81610d72846000526003602052604060002090565b614583828060081c600052600060205260406000209060ff6001811b91161c8154179055565b614302565b7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4565b60405162461bcd60e51b815260206004820152603760248201527f5353324552433732315073694275726e61626c653a207472616e73666572206f60448201527f6620746f6b656e2074686174206973206e6f74206f776e0000000000000000006064820152608490fd5b1561462157565b60405162461bcd60e51b815260206004820152602760248201527f4552433732315073693a207472616e7366657220746f20746865207a65726f2060448201527f61646472657373000000000000000000000000000000000000000000000000006064820152608490fd5b919061469782613eac565b93906001600160a01b0394859182841696879116036147d6576116349585928516916146c483151561461a565b6146cd846137c8565b6146d684613838565b6146df84612ae9565b6147076132b5828060081c600052600060205260ff6001811b91161c60406000205416151590565b806147cb575b614787575b5061472b86610d72866000526003602052604060002090565b830361475c575b7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a46143b2565b614782838060081c600052600060205260406000209060ff6001811b91161c8154179055565b614732565b806147a387610d726147c5946000526003602052604060002090565b8060081c600052600060205260406000209060ff6001811b91161c8154179055565b38614712565b50600454811061470d565b60405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a207472616e73666572206f6620746f6b656e2074686160448201527f74206973206e6f74206f776e00000000000000000000000000000000000000006064820152608490fd5b9061484b826148d6565b80949294939160148196036148c45760018301808411610b175781106148b257601481029080820460141490151715610b175761488a61488f91612af7565b612ae9565b116148a05761489d9161490d565b92565b60405163051aa8b360e31b8152600490fd5b60405163d3482f7b60e01b8152600490fd5b6040516313290f5360e31b8152600490fd5b803b90600482106148ff57600160006003928180523c6000519061ffff8260e81c169160f81c92565b6311052bb46000526004601cfd5b600c600460149360008052840201913c60005190565b9061492d826148d6565b80949294939160048196036148c45760018301808411610b175781106148b2578060021b9080820460041490151715610b175761488a61496c91612af7565b116148a05761489d91601c600480936000805260021b01913c6000519056fe650ad5d074f4dd8c5280d202a5923a7954d773cd6ccdd5bf8b3bf86b123f5e53a264697066735822122053e9de685463d582f7d70142a8676347a94e6e8cc6ca1016bbd65abb99359af964736f6c634300081300332f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d
Deployed Bytecode
0x6080604052600436101561001257600080fd5b60003560e01c80623f332f1461041657806301ffc9a714610411578063025e332e1461040c57806304634d8d1461040757806306fdde031461040257806307265389146103fd578063081812fc146103f8578063095ea7b3146103f35780630f4345e2146103ee578063122e04a8146103e9578063171060ec146103e457806318160ddd146103df5780631fffe2b0146103da57806321f314ca146103d557806323b872dd146103d0578063248a9ca3146103cb578063282c51f3146103c657806329b3ed8b146103c15780632a55205a146103bc5780632f2ff15d146103b75780633279da60146103b257806336568abe146103ad5780633ccfd60b146103a85780633efd0e13146103a357806341f434341461039e57806342842e0e14610399578063484b973c146103945780634f6878641461038f57806355f804b31461038a5780635e19a537146103855780636352211e146103805780636c0360eb1461037b57806370a0823114610376578063715018a61461037157806372b44d711461036c5780638462151c146103675780638da5cb5b146103625780638fd124801461035d57806391d1485414610358578063925e34c51461035357806394cedaee1461034e57806395d89b4114610349578063a217fddf14610344578063a22cb4651461033f578063ae66a5bb1461033a578063b4fc5cbe14610335578063b7c738f414610330578063b8768b1c1461032b578063b88d4fde14610326578063c87b56dd14610321578063cc835a881461031c578063d11f829414610317578063d539139314610312578063d547741f1461030d578063d7b96d4e14610308578063d853015e14610303578063df3fdf00146102fe578063e0284ccb146102f9578063e08668ca146102f4578063e985e9c5146102ef578063f02f5baf146102ea578063f2fde38b146102e5578063f6aacfb1146102e05763ff768212146102db57600080fd5b6127fd565b6127df565b612702565b6126c8565b61268a565b6125bf565b612565565b612549565b6124c2565b61249b565b612459565b61241e565b6123a2565b612384565b612285565b612202565b61216d565b612146565b61208e565b612013565b611e91565b611e6b565b611dc4565b611cf9565b611c54565b611bfd565b611b80565b611b59565b611a9c565b611a2b565b6119cf565b61198e565b61195e565b61184a565b6117b5565b611689565b611577565b611474565b6113e4565b6113bb565b6112e8565b611261565b6111bd565b61115e565b611085565b610fd5565b610fb7565b610f7c565b610f4d565b610ef9565b610cb5565b610b4d565b610a66565b6109ff565b6109d0565b6109af565b610879565b61084a565b610827565b610747565b6105c9565b610585565b6104ee565b346104d7576000806003193601126104d45760405180916016549081835260208093018092601683527fd833147d7dc355ba459fc788f669e58cfaf9dc25ddcd0702e87d69c7b512428990835b8181106104c05750505084610479910385611605565b60405193838594850191818652518092526040850193925b8281106104a057505050500390f35b83516001600160a01b031685528695509381019392810192600101610491565b825484529286019260019283019201610463565b80fd5b600080fd5b6001600160e01b03198116036104d757565b346104d75760203660031901126104d757602060043561050d816104dc565b6001600160e01b03198116637965db0b60e01b14908115610563575b8115610552575b8115610542575b506040519015158152f35b61054c915061327d565b38610537565b905061055d816133c3565b90610530565b905061056e8161327d565b90610529565b6001600160a01b038116036104d757565b346104d75760203660031901126104d7576001600160a01b036004356105aa81610574565b6105b2612a2b565b166001600160a01b03196012541617601255600080f35b346104d75760403660031901126104d7576004356105e681610574565b602435906bffffffffffffffffffffffff82168083036104d7576127109061060c612a2b565b116106805761065b61067e9261062c6001600160a01b038416151561306f565b610646610637611627565b6001600160a01b039094168452565b6bffffffffffffffffffffffff166020830152565b6001600160a01b031960206001600160a01b0383511692015160a01b1617600d55565b005b60405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c2065786365656460448201527f2073616c655072696365000000000000000000000000000000000000000000006064820152608490fd5b60005b8381106106fe5750506000910152565b81810151838201526020016106ee565b90602091610727815180928185528580860191016106eb565b601f01601f1916010190565b90602061074492818152019061070e565b90565b346104d7576000806003193601126104d4576040519080600180549161076c83611868565b808652928281169081156107fd57506001146107a3575b61079f8561079381870382611605565b60405191829182610733565b0390f35b92508083527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf65b8284106107e55750505081016020016107938261079f610783565b805460208587018101919091529093019281016107ca565b86955061079f9693506020925061079394915060ff191682840152151560051b8201019293610783565b346104d75760003660031901126104d757602060ff601454166040519015158152f35b346104d75760203660031901126104d757602061086860043561354a565b6001600160a01b0360405191168152f35b346104d75760403660031901126104d75760043561089681610574565b6024356108ab6108a582613d10565b1561315c565b6108b481613dcb565b6001600160a01b03808216809185161461095e57331490811561094c575b50156108e15761067e9161388e565b60405162461bcd60e51b815260206004820152603b60248201527f4552433732315073693a20617070726f76652063616c6c6572206973206e6f7460448201527f206f776e6572206e6f7220617070726f76656420666f7220616c6c00000000006064820152608490fd5b6109589150339061337b565b386108d2565b60405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a20617070726f76616c20746f2063757272656e74206f6044820152633bb732b960e11b6064820152608490fd5b346104d75760203660031901126104d7576109c8612a2b565b600435601355005b346104d75760003660031901126104d7576020604051730a2c099044c088a431b78a0d6bb5a137a56632978152f35b346104d75760203660031901126104d7576001600160a01b03600435610a2481610574565b33600090815260008051602061498c83398151915260205260409020610a4f9060ff905b5416612cc6565b166001600160a01b03196010541617601055600080f35b346104d7576000806003193601126104d4576004546000198082019290828411610b1757819260081c91600190818401809411610b1757929190835b838510610ace5761079f610abe610ab9888a612f54565b612f35565b6040519081529081906020820190565b90919293948582526007602052604082205490838284935b610b08575050610aff91610af991612b05565b95612ca7565b93929190610aa2565b92019184908087011680610ae6565b612aa9565b9181601f840112156104d75782359167ffffffffffffffff83116104d7576020808501948460051b0101116104d757565b346104d7576040806003193601126104d757600490813591610b6e83610574565b6024803567ffffffffffffffff81116104d757610b8e9036908401610b1c565b937f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a848600052602091600f835260ff610bdc3384600020906001600160a01b0316600052602052604060002090565b541615610c7357946000906001600160a01b03809816915b818110610bfd57005b610c0881838a612cb6565b3589610c1382613dcb565b168403610c315790610c27610c2c92613bfe565b612ca7565b610bf4565b845162461bcd60e51b81528089018790526014818901527f61646472657373206973206e6f74206f776e65720000000000000000000000006044820152606490fd5b815162461bcd60e51b81528086018490526016818601527f43616c6c6572206973206e6f742061206275726e6572000000000000000000006044820152606490fd5b346104d75760403660031901126104d757600435610cd281610574565b3360009081527f3ac2ae920192ffec1f2616e363ccfeffb7844a5d9224b2df5eacfefada83760760205260408120549091906024359060ff1615610e8857604051610d1c816115cc565b838152600454918015610e1d576001600160a01b03841692610d3f841515613770565b610d48816137c8565b610d5a610d558383612b05565b600455565b610d8d85610d72836000526003602052604060002090565b906001600160a01b03166001600160a01b0319825416179055565b610db3818060081c600052600060205260406000209060ff6001811b91161c8154179055565b610dbe82828761424b565b805b610dca8383612b05565b811015610e065780610e019186897fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4612ca7565b610dc0565b50610e159350610e1a94613968565b613641565b80f35b60405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a207175616e74697479206d757374206265206772656160448201527f74657220300000000000000000000000000000000000000000000000000000006064820152608490fd5b60405162461bcd60e51b815260206004820152601660248201527f43616c6c6572206973206e6f742061206d696e746572000000000000000000006044820152606490fd5b60609060031901126104d757600435610ee581610574565b90602435610ef281610574565b9060443590565b346104d75761067e610f0a36610ecd565b91336001600160a01b03821603610f3f575b610f286108a584613d10565b610f3a610f3584336136b3565b6135cf565b6144d2565b610f48336131c9565b610f1c565b346104d75760203660031901126104d757600435600052600f6020526020600160406000200154604051908152f35b346104d75760003660031901126104d75760206040517f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a8488152f35b346104d75760003660031901126104d7576020600854604051908152f35b346104d75760403660031901126104d757600435600052600e602052604060002060405190611003826115ab565b54906001600160a01b03908183169283825260a01c60208201529115611075575b61104d6110456bffffffffffffffffffffffff602085015116602435612ad6565b612710900490565b91511661079f60405192839283602090939291936001600160a01b0360408201951681520152565b905061107f612a83565b90611024565b346104d75760403660031901126104d7576004356024356110a581610574565b600091808352600f6020526110c06001604085200154612833565b808352600f60205260ff6110ea8360408620906001600160a01b0316600052602052604060002090565b5416156110f5578280f35b808352600f60205261111d8260408520906001600160a01b0316600052602052604060002090565b805460ff1916600117905533916001600160a01b0316907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8480a438808280f35b346104d75760203660031901126104d7576004356008548110156111b8576001600160a01b0360209160086000527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee3015416604051908152f35b612b71565b346104d75760403660031901126104d7576024356111da81610574565b336001600160a01b038216036111f65761067e90600435612992565b60405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608490fd5b6000806003193601126104d457611276612a2b565b8080808047730a2c099044c088a431b78a0d6bb5a137a56632975af161129a61312c565b50156112a35780f35b60405162461bcd60e51b815260206004820152600e60248201527f7769746864726177206572726f720000000000000000000000000000000000006044820152606490fd5b346104d75760603660031901126104d75760043561130581610574565b60403660231901126104d75733600090815260008051602061498c8339815191526020526040812090919061133c9060ff90610a48565b604051611348816115ab565b6001600160801b039160243583811681036113b757825260443592831683036113b357610e1a9260208301526001600160a01b03166000908152600a602090815260409091208251919092015160801b6001600160801b0319166001600160801b0391909116179055565b8380fd5b8480fd5b346104d75760003660031901126104d75760206040516daaeb6d7670e522a718067333cd4e8152f35b346104d75761067e610e156113f836610ecd565b90336001600160a01b03841614159283611466575b6114196108a584613d10565b60405193611426856115cc565b60008552611458575b61143b6108a584613d10565b611448610f3584336136b3565b6114538383836144d2565b613af8565b611461336131c9565b61142f565b61146f336131c9565b61140d565b346104d75760403660031901126104d75760043561149181610574565b6024359061149d612a2b565b604051916114aa836115cc565b600092838152600454918015610e1d576001600160a01b038416926114d0841515613770565b6114d9816137c8565b6114e6610d558383612b05565b6114fe85610d72836000526003602052604060002090565b611524818060081c600052600060205260406000209060ff6001811b91161c8154179055565b61152f82828761424b565b805b61153b8383612b05565b811015610e0657806115729186897fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4612ca7565b611531565b346104d75760003660031901126104d7576020600954604051908152f35b634e487b7160e01b600052604160045260246000fd5b6040810190811067ffffffffffffffff8211176115c757604052565b611595565b6020810190811067ffffffffffffffff8211176115c757604052565b610120810190811067ffffffffffffffff8211176115c757604052565b90601f8019910116810190811067ffffffffffffffff8211176115c757604052565b60405190611634826115ab565b565b67ffffffffffffffff81116115c757601f01601f191660200190565b92919261165e82611636565b9161166c6040519384611605565b8294818452818301116104d7578281602093846000960137010152565b346104d7576020806003193601126104d75767ffffffffffffffff6004358181116104d757366023820112156104d7576116cd903690602481600401359101611652565b916116d6612a2b565b82519182116115c7576116f3826116ee601154611868565b6130bb565b80601f831160011461172e57508192600092611723575b5050600019600383901b1c191660019190911b17601155005b01519050388061170a565b90601f1983169361176160116000527f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c6890565b926000905b86821061179d5750508360019510611784575b505050811b01601155005b015160001960f88460031b161c19169055388080611779565b80600185968294968601518155019501930190611766565b346104d75760403660031901126104d7576004356117d281610574565b33600090815260008051602061498c8339815191526020526040902060243591906117ff9060ff90610a48565b6009548210156111b85761067e917f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af01906001600160a01b03166001600160a01b0319825416179055565b346104d75760203660031901126104d7576020610868600435613dcb565b90600182811c92168015611898575b602083101461188257565b634e487b7160e01b600052602260045260246000fd5b91607f1691611877565b60405190600082601154916118b683611868565b8083529260019081811690811561193c57506001146118dd575b5061163492500383611605565b6011600090815291507f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c685b84831061192157506116349350508101602001386118d0565b81935090816020925483858a01015201910190918592611908565b90506020925061163494915060ff191682840152151560051b820101386118d0565b346104d75760003660031901126104d75761079f61197a6118a2565b60405191829160208352602083019061070e565b346104d75760203660031901126104d7576001600160a01b036004356119b381610574565b16600052600a602052602060406000205460801c604051908152f35b346104d7576000806003193601126104d4576119e9612a2b565b806001600160a01b03600c546001600160a01b03198116600c55167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b346104d75760203660031901126104d75761067e6001600160a01b03600435611a5381610574565b611a5b612a2b565b16612fbd565b6020908160408183019282815285518094520193019160005b828110611a88575050505090565b835185529381019392810192600101611a7a565b346104d75760203660031901126104d757600435611ab981610574565b6001600160a01b039081166000818152600a602052604081205460801c90611ae082613bd2565b92611aee6040519485611605565b828452601f19611afd84613bd2565b01366020860137600194855b848403611b1e576040518061079f8882611a61565b80611b29889261418e565b611b34575b01611b09565b8383611b3f83613dcb565b1603611b2e5780611b538387019689613bea565b52611b2e565b346104d75760003660031901126104d75760206001600160a01b03600c5416604051908152f35b346104d75760203660031901126104d7576001600160a01b03600435611ba581610574565b60006020604051611bb5816115ab565b828152015216600052600a602052604080600020815190611bd5826115ab565b546001600160801b0390602082821693848152019060801c8152835192835251166020820152f35b346104d75760403660031901126104d757602060ff611c48602435611c2181610574565b600435600052600f84526040600020906001600160a01b0316600052602052604060002090565b54166040519015158152f35b346104d75760403660031901126104d75767ffffffffffffffff6004358181116104d757611c86903690600401610b1c565b9190602435928284116104d757366023850112156104d75783600401359283116104d7573660248460061b860101116104d757602461067e940191612d26565b60406003198201126104d7576004359067ffffffffffffffff82116104d757611cf191600401610b1c565b909160243590565b346104d757611d0736611cc6565b33600090815260008051602061498c833981519152602052604081209093929190611d349060ff90610a48565b818110611d3f578380f35b611d4a818385612cb6565b3590611d5582610574565b6008805492680100000000000000008410156115c7576001938481018084558110156111b857611dbe9288527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee301906001600160a01b03166001600160a01b0319825416179055565b01611d34565b346104d7576000806003193601126104d4576040519080600254611de781611868565b808552916001918083169081156107fd5750600114611e105761079f8561079381870382611605565b9250600283527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace5b828410611e535750505081016020016107938261079f610783565b80546020858701810191909152909301928101611e38565b346104d75760003660031901126104d757602060405160008152f35b801515036104d757565b346104d75760403660031901126104d757600435611eae81610574565b602435611eba81611e87565b611ec3826132a6565b8015611fdc575b15611f97576001600160a01b03821691338314611f525781611f0f611f20923360005260066020526040600020906001600160a01b0316600052602052604060002090565b9060ff801983541691151516179055565b604051901515815233907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3190602090a3005b60405162461bcd60e51b815260206004820152601c60248201527f4552433732315073693a20617070726f766520746f2063616c6c6572000000006044820152606490fd5b60405162461bcd60e51b815260206004820152601c60248201527f43616e206e6f7420617070726f7665206c6f636b656420746f6b656e000000006044820152606490fd5b508015611eca565b60206003198201126104d7576004359067ffffffffffffffff82116104d75761200f91600401610b1c565b9091565b346104d75761202136611fe4565b33600090815260008051602061498c8339815191526020908152604080832092949360ff93612051908590610a48565b855b81811061205e578680f35b8061206c6001928489612cb6565b358060081c89526015865284892090878460ff1b91161c815417905501612053565b346104d75761209c36611cc6565b33600090815260008051602061498c833981519152602052604081209092906120c79060ff90610a48565b810190818111610b17579060019182906001600160a01b0395847fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92808984351689868180a4015b84810361211a578680f35b858181928a8760051b8601351680151961213a575b50500193019261210f565b8a878180a4803861212f565b346104d75760003660031901126104d75760206001600160a01b0360125416604051908152f35b346104d75760403660031901126104d75760043561218a81610574565b33600090815260008051602061498c8339815191526020526040902060243591906121b79060ff90610a48565b6008548210156111b85761067e917ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee301906001600160a01b03166001600160a01b0319825416179055565b346104d75760803660031901126104d75760043561221f81610574565b6024359061222c82610574565b6064359060443567ffffffffffffffff83116104d757366023840112156104d75761067e93612268610e15943690602481600401359101611652565b92336001600160a01b038216036114585761143b6108a584613d10565b346104d75760203660031901126104d7576004356122a28161418e565b15612319576122af6118a2565b805115612301576107936122e26122f66122e2936122e86122d261079f97613407565b604051948593602085019061297b565b9061297b565b03601f198101835282611605565b6122e86122d2612510565b505061079f6122e26107936123146124fd565b6122f6565b60405162461bcd60e51b815260206004820152602a60248201527f4552433732315073693a2055524920717565727920666f72206e6f6e6578697360448201527f74656e7420746f6b656e000000000000000000000000000000000000000000006064820152608490fd5b346104d75760003660031901126104d7576020601354604051908152f35b346104d7576123b036611fe4565b33600090815260008051602061498c8339815191526020908152604080832092949360ff936123e0908590610a48565b855b8181106123ed578680f35b806123fb6001928489612cb6565b358060081c89526015865284892090878460ff1b91161c198154169055016123e2565b346104d75760003660031901126104d75760206040517f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a68152f35b346104d75760403660031901126104d75761067e60243560043561247c82610574565b80600052600f602052612496600160406000200154612833565b612992565b346104d75760003660031901126104d75760206001600160a01b0360105416604051908152f35b346104d75760003660031901126104d75760206040517f3b49a237fe2d18fa4d9642b8a0e065923cceb71b797783b619a030a61d848bf08152f35b6040519061250a826115cc565b60008252565b6040519061251d826115ab565b600582527f2e6a736f6e0000000000000000000000000000000000000000000000000000006020830152565b346104d75760003660031901126104d75761079f61197a612510565b346104d75760203660031901126104d7576004356009548110156111b8576001600160a01b0360209160096000527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af015416604051908152f35b346104d7576125cd36611cc6565b33600090815260008051602061498c8339815191526020526040812090939291906125fa9060ff90610a48565b818110612605578380f35b612610818385612cb6565b359061261b82610574565b6009805492680100000000000000008410156115c7576001938481018084558110156111b8576126849288527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af01906001600160a01b03166001600160a01b0319825416179055565b016125fa565b346104d75760403660031901126104d75760206126be6004356126ac81610574565b602435906126b982610574565b61337b565b6040519015158152f35b346104d75760203660031901126104d75760206126be6004358060081c600052601560205260ff6001811b91161c60406000205416151590565b346104d75760203660031901126104d75760043561271f81610574565b612727612a2b565b6001600160a01b0380911690811561277457600c54826001600160a01b0319821617600c55167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3005b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608490fd5b346104d75760203660031901126104d75760206126be600435613d10565b346104d75760203660031901126104d75761067e6001600160a01b0360043561282581610574565b61282d612a2b565b16612eb9565b80600052600f908160205260ff612861336040600020906001600160a01b0316600052602052604060002090565b54161561286c575050565b33612875612b12565b92603061288185612b87565b53607861288d85612b94565b536029905b60018211612939576129356128f461291d876122e86128ba896128b58a15612bc2565b612c0d565b6122e26040519586946122e2602087016017907f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081520190565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000815260110190565b60405162461bcd60e51b815291829160048301610733565b0390fd5b90918181169060108210156111b8576f181899199a1a9b1b9c1cb0b131b232b360811b612975921a61296b8588612ba4565b5360041c92612bb5565b90612892565b9061298e602092828151948592016106eb565b0190565b600090808252600f60205260ff6129bf8460408520906001600160a01b0316600052602052604060002090565b54166129ca57505050565b808252600f6020526129f28360408420906001600160a01b0316600052602052604060002090565b60ff1981541690557ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b6001600160a01b033394169280a4565b6001600160a01b03600c54163303612a3f57565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b60405190612a90826115ab565b600d546001600160a01b038116835260a01c6020830152565b634e487b7160e01b600052601160045260246000fd5b9061177091828102928184041490151715610b1757565b81810292918115918404141715610b1757565b9060018201809211610b1757565b6003019081600311610b1757565b91908201809211610b1757565b604051906060820182811067ffffffffffffffff8211176115c757604052602a8252604082602036910137565b90612b4982611636565b612b566040519182611605565b8281528092612b67601f1991611636565b0190602036910137565b634e487b7160e01b600052603260045260246000fd5b8051156111b85760200190565b8051600110156111b85760210190565b9081518110156111b8570160200190565b8015610b17576000190190565b15612bc957565b606460405162461bcd60e51b815260206004820152602060248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b604051906080820182811067ffffffffffffffff8211176115c7576040526042825260603660208401376030612c4283612b87565b536078612c4e83612b94565b536041905b60018211612c6657610744915015612bc2565b600f81169060108210156111b8576f181899199a1a9b1b9c1cb0b131b232b360811b612ca1921a612c978486612ba4565b5360041c91612bb5565b90612c53565b6000198114610b175760010190565b91908110156111b85760051b0190565b15612ccd57565b60405162461bcd60e51b815260206004820152601b60248201527f43616c6c6572206973206e6f74206120636f6e6669677261746f7200000000006044820152606490fd5b35906001600160801b03821682036104d757565b33600090815260008051602061498c8339815191526020908152604080832092969395939491939092909190612d5e9060ff90610a48565b865b818110612d71575050505050505050565b612d7c818389612cb6565b35612d8681610574565b868210156111b8578160061b8401908582360312612e105760019291612e0a91612dc789895193612db6856115ab565b612dbf81612d12565b855201612d12565b898301526001600160a01b03166000908152600a602090815260409091208251919092015160801b6001600160801b0319166001600160801b0391909116179055565b01612d60565b8980fd5b6009548110156111b85760096000527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af0190600090565b6008548110156111b85760086000527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30190600090565b6016548110156111b85760166000527fd833147d7dc355ba459fc788f669e58cfaf9dc25ddcd0702e87d69c7b51242890190600090565b80600052601760205260406000205415600014612f2f57601654680100000000000000008110156115c75760018101806016558110156111b85781907fd833147d7dc355ba459fc788f669e58cfaf9dc25ddcd0702e87d69c7b51242890155601654906000526017602052604060002055600190565b50600090565b61115b19810191908211610b1757565b600019810191908211610b1757565b91908203918211610b1757565b6016548015612fa757600019810190808210156111b8577fd833147d7dc355ba459fc788f669e58cfaf9dc25ddcd0702e87d69c7b5124288600091601683520155601655565b634e487b7160e01b600052603160045260246000fd5b6000818152601760205260409020548015613068576000199181830191808311610b1757601654938401938411610b17578383613018946000960361301e575b505050613008612f61565b6000526017602052604060002090565b55600190565b6130086130469161303e61303461305f95612e82565b90549060031b1c90565b928391612e82565b90919082549060031b91821b91600019901b1916179055565b55388080612ffd565b5050600090565b1561307657565b60405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606490fd5b601f81116130c7575050565b600090601182527f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c68906020601f850160051c83019410613122575b601f0160051c01915b82811061311757505050565b81815560010161310b565b9092508290613102565b3d15613157573d9061313d82611636565b9161314b6040519384611605565b82523d6000602084013e565b606090565b1561316357565b60405162461bcd60e51b815260206004820152601760248201527f54686520746f6b656e206973206c6f6b6564206e6f772e0000000000000000006044820152606490fd5b908160209103126104d7575161074481611e87565b6040513d6000823e3d90fd5b6daaeb6d7670e522a718067333cd4e803b6131e2575050565b602060449160405192838092633185c44d60e21b82523060048301526001600160a01b03871660248301525afa9081156132785760009161324a575b50156132275750565b604051633b79c77360e21b81526001600160a01b03919091166004820152602490fd5b61326b915060203d8111613271575b6132638183611605565b8101906131a8565b3861321e565b503d613259565b6131bd565b6001600160e01b0319811663152a902d60e11b1490811561329c575090565b61074491506133c3565b6132b96132b560145460ff1690565b1590565b613375576132dd6001600160a01b0382166000526017602052604060002054151590565b9081156132e8575090565b61334691506020906133116133056012546001600160a01b031690565b6001600160a01b031690565b601354604051630f8350ed60e41b81526001600160a01b03909316600484015260248301529092839190829081906044820190565b03915afa9081156132785760009161335d575b5090565b610744915060203d8111613271576132638183611605565b50600190565b613384826132a6565b156130685760ff916001600160a01b036133be921660005260066020526040600020906001600160a01b0316600052602052604060002090565b541690565b63ffffffff60e01b166380ac58cd60e01b81149081156133f6575b81156133e8575090565b6301ffc9a760e01b14919050565b635b5e139f60e01b811491506133de565b806000917a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008082101561353c575b506d04ee2d6d415b85acef81000000008083101561352d575b50662386f26fc100008083101561351e575b506305f5e1008083101561350f575b5061271080831015613500575b5060648210156134f0575b600a809210156134e6575b60019081602161349e828701612b3f565b95860101905b6134b0575b5050505090565b600019019083906f181899199a1a9b1b9c1cb0b131b232b360811b8282061a8353049182156134e1579190826134a4565b6134a9565b916001019161348d565b9190606460029104910191613482565b60049193920491019138613477565b6008919392049101913861346a565b6010919392049101913861345b565b60209193920491019138613449565b604093508104915038613430565b6135538161418e565b156135725760005260056020526001600160a01b036040600020541690565b60405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a20617070726f76656420717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608490fd5b156135d657565b60405162461bcd60e51b815260206004820152603460248201527f4552433732315073693a207472616e736665722063616c6c6572206973206e6f60448201527f74206f776e6572206e6f7220617070726f7665640000000000000000000000006064820152608490fd5b1561364857565b60405162461bcd60e51b815260206004820152603560248201527f4552433732315073693a207472616e7366657220746f206e6f6e20455243373260448201527f31526563656976657220696d706c656d656e74657200000000000000000000006064820152608490fd5b6136bc8261418e565b15613713576136ca82613dcb565b6001600160a01b038083169080831682149485156136fb575b50505082156136f157505090565b610744925061337b565b613708919293955061354a565b1614913880806136e3565b60405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a206f70657261746f7220717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608490fd5b1561377757565b60405162461bcd60e51b815260206004820152602360248201527f4552433732315073693a206d696e7420746f20746865207a65726f206164647260448201526265737360e81b6064820152608490fd5b6137ed908060081c600052601560205260ff6001811b91161c60406000205416151590565b6137f357565b60405162461bcd60e51b815260206004820152601f60248201527f5468697320746f6b656e20494420686173206265656e20626c6f636b65642e006044820152606490fd5b80600052600560205260406000206001600160a01b0319815416905560006001600160a01b0361386783613dcb565b167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258280a4565b8160005260056020526138bb816040600020906001600160a01b03166001600160a01b0319825416179055565b6001600160a01b03806138cd84613dcb565b169116907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600080a4565b908160209103126104d75751610744816104dc565b61074493926001600160a01b03608093168252600060208301526040820152816060820152019061070e565b909261074494936080936001600160a01b0380921684521660208301526040820152816060820152019061070e565b909290803b15613aef5792919060018091819585935b61398c575b50505050505090565b61399a858798999697612b05565b841015613ae657604095865197630a85bd0160e11b998a8a5260209a8b60049b808d898c33928401926139cc9361390d565b0390828160009381856001600160a01b038d165af1919282613ab7575b5050613a79578c8c8c6139fa61312c565b80519384613a7357825162461bcd60e51b815260208186018181526035918101919091527f4552433732315073693a207472616e7366657220746f206e6f6e20455243373260408201527f31526563656976657220696d706c656d656e7465720000000000000000000000606082015281906080010390fd5b84925001fd5b91939699509194979a50613a989396995082613aa3575b505096612ca7565b92859294919561397e565b6001600160e01b0319161490503880613a90565b613ad7929350803d10613adf575b613acf8183611605565b8101906138f8565b90388e6139e9565b503d613ac5565b84979650613983565b50505050600190565b919290803b15613aef5790929160019081948285935b613b1b5750505050505090565b613b288697989596612ae9565b841015613ae657604095865197630a85bd0160e11b998a8a5260209a8b60049b808d898c8c3393850193613b5b94613939565b0390828160009381856001600160a01b038c165af1919282613bb3575b5050613b89578c8c8c6139fa61312c565b91939699509194979a50613ba79396995082613aa357505096612ca7565b92809592949195613b0e565b613bca929350803d10613adf57613acf8183611605565b90388e613b78565b67ffffffffffffffff81116115c75760051b60200190565b80518210156111b85760209160051b010190565b613c0781613dcb565b90613c2d818060081c600052601560205260ff6001811b91161c60406000205416151590565b6137f3576001600160a01b036000928260081c8452600760205260408420600160ff1b60ff85161c815417905516908083837fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8280a4600881901c6000908152600b6020526040902054600160ff1b60ff83161c1615613ce4575b5080613cb2575050565b8152600a6020526040902080546001600160801b038116608091821c6000190190911b6001600160801b031916179055565b613d0a908060081c600052600b60205260406000209060ff6001811b91161c8154179055565b38613ca8565b6001600160a01b0360105416908115159182613d2b57505090565b60405163267328db60e21b815230600482015260248101929092529091506020908290818060448101613346565b15613d6057565b60405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a206f776e657220717565727920666f72206e6f6e657860448201527f697374656e7420746f6b656e00000000000000000000000000000000000000006064820152608490fd5b600881901c6000908152600b6020526040902054600160ff1b60ff83161c1615613df85761335990613eac565b613e09613e048261418e565b613d59565b6000198101818111610b1757611770613e23910491612f45565b90613e2d81612abf565b8203918211610b175761ffff916001600160a01b03613e4e613e5b93612e14565b90549060031b1c16614923565b5050166104b09081810490828202928284041482151715610b1757613e8f613e89613ea794613ea293612f54565b92612e4b565b90546001600160a01b039160031b1c1690565b614841565b505090565b613eb8613e048261418e565b600090600891604060ff83851c9316918381528060205220548160ff181c801515600014613f1f57613eec613ef291613fe3565b60ff1690565b9003911b175b613f1c613f0f826000526003602052604060002090565b546001600160a01b031690565b91565b50505b613f2d811515613f71565b60001901613f45816000526000602052604060002090565b5480613f515750613f22565b613eec613f60613f6992613fe3565b60ff9081031690565b911b17613ef8565b15613f7857565b60405162461bcd60e51b815260206004820152603460248201527f4269744d6170733a205468652073657420626974206265666f7265207468652060448201527f696e64657820646f65736e27742065786973742e0000000000000000000000006064820152608490fd5b604051613fef816115e8565b7ffd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f86101008083527e01020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7560208401527f06264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c960408401527f071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee360608401527f0e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf760808401527fff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c860a08401527f16365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f660c08401527ffe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf560e084015282015281156104d757614162614188917e818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff8461074495600003160260f81c90612ba4565b517fff000000000000000000000000000000000000000000000000000000000000001690565b60f81c90565b600881901c6000908152600b6020526040902054600160ff1b60ff83161c16156141bb5761074490614212565b6000198101818111610b17576117706141d5910491612f45565b6141de82612abf565b8103908111610b17576001600160a01b03613e4e6141fb93612e14565b505061ffff8091161461420d57600190565b600090565b8060081c6000526007602052600160ff1b60ff82161c60406000205416612f2f5760045481109081614242575090565b90506001111590565b9190614272818060081c600052600b60205260ff6001811b91161c60406000205416151590565b156142d6575b506001600160a01b03821661428b575050565b6142ab611634926001600160a01b0316600052600a602052604060002090565b80546001600160801b03818116608092831c9190941601901b6001600160801b031916919091179055565b6142fc908060081c600052600b60205260406000209060ff6001811b91161c8154179055565b38614278565b90614328818060081c600052600b60205260ff6001811b91161c60406000205416151590565b15614386575b506001600160a01b0381166143405750565b614360611634916001600160a01b0316600052600a602052604060002090565b80546001600160801b038116608091821c60010190911b6001600160801b031916179055565b6143ac908060081c600052600b60205260406000209060ff6001811b91161c8154179055565b3861432e565b90916143d9818060081c600052600b60205260ff6001811b91161c60406000205416151590565b15614434575b506001600160a01b03809116806143fb575b5081166143405750565b6000908152600a6020526040902080546001600160801b038116608091821c6000190190911b6001600160801b031916179055386143f1565b61445a908060081c600052600b60205260406000209060ff6001811b91161c8154179055565b386143df565b1561446757565b60405162461bcd60e51b815260206004820152603260248201527f5353324552433732315073694275726e61626c653a207472616e73666572207460448201527f6f20746865207a65726f206164647265737300000000000000000000000000006064820152608490fd5b600883901c6000908152600b6020526040902054600160ff1b60ff85161c16156145015790611634929161468c565b61450a83613dcb565b6001600160a01b03918216919081168290036145af578361458891841693614533851515614460565b61453c826137c8565b61454582613838565b61455d81610d72846000526003602052604060002090565b614583828060081c600052600060205260406000209060ff6001811b91161c8154179055565b614302565b7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4565b60405162461bcd60e51b815260206004820152603760248201527f5353324552433732315073694275726e61626c653a207472616e73666572206f60448201527f6620746f6b656e2074686174206973206e6f74206f776e0000000000000000006064820152608490fd5b1561462157565b60405162461bcd60e51b815260206004820152602760248201527f4552433732315073693a207472616e7366657220746f20746865207a65726f2060448201527f61646472657373000000000000000000000000000000000000000000000000006064820152608490fd5b919061469782613eac565b93906001600160a01b0394859182841696879116036147d6576116349585928516916146c483151561461a565b6146cd846137c8565b6146d684613838565b6146df84612ae9565b6147076132b5828060081c600052600060205260ff6001811b91161c60406000205416151590565b806147cb575b614787575b5061472b86610d72866000526003602052604060002090565b830361475c575b7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a46143b2565b614782838060081c600052600060205260406000209060ff6001811b91161c8154179055565b614732565b806147a387610d726147c5946000526003602052604060002090565b8060081c600052600060205260406000209060ff6001811b91161c8154179055565b38614712565b50600454811061470d565b60405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a207472616e73666572206f6620746f6b656e2074686160448201527f74206973206e6f74206f776e00000000000000000000000000000000000000006064820152608490fd5b9061484b826148d6565b80949294939160148196036148c45760018301808411610b175781106148b257601481029080820460141490151715610b175761488a61488f91612af7565b612ae9565b116148a05761489d9161490d565b92565b60405163051aa8b360e31b8152600490fd5b60405163d3482f7b60e01b8152600490fd5b6040516313290f5360e31b8152600490fd5b803b90600482106148ff57600160006003928180523c6000519061ffff8260e81c169160f81c92565b6311052bb46000526004601cfd5b600c600460149360008052840201913c60005190565b9061492d826148d6565b80949294939160048196036148c45760018301808411610b175781106148b2578060021b9080820460041490151715610b175761488a61496c91612af7565b116148a05761489d91601c600480936000805260021b01913c6000519056fe650ad5d074f4dd8c5280d202a5923a7954d773cd6ccdd5bf8b3bf86b123f5e53a264697066735822122053e9de685463d582f7d70142a8676347a94e6e8cc6ca1016bbd65abb99359af964736f6c63430008130033
Loading...
Loading
Loading...
Loading
OVERVIEW
We completed Smart Contract Migration on April 29th, 2023. CryptoNinja Partners (CNP) is a 22,222-piece collection starring CryptoNinja sub-characters.Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.