Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 25 from a total of 80 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Grant Role | 19447468 | 214 days ago | IN | 0 ETH | 0.00174893 | ||||
Grant Role | 19447463 | 214 days ago | IN | 0 ETH | 0.00164739 | ||||
Set CAL Level | 19333839 | 229 days ago | IN | 0 ETH | 0.00252859 | ||||
Safe Transfer Fr... | 19232984 | 244 days ago | IN | 0 ETH | 0.00136172 | ||||
Set Approval For... | 19217340 | 246 days ago | IN | 0 ETH | 0.00159621 | ||||
Safe Transfer Fr... | 19162351 | 253 days ago | IN | 0 ETH | 0.00097131 | ||||
Safe Transfer Fr... | 19162262 | 253 days ago | IN | 0 ETH | 0.00130002 | ||||
Safe Transfer Fr... | 19137037 | 257 days ago | IN | 0 ETH | 0.00134328 | ||||
Safe Transfer Fr... | 19137026 | 257 days ago | IN | 0 ETH | 0.00173075 | ||||
Safe Transfer Fr... | 19137018 | 257 days ago | IN | 0 ETH | 0.00187909 | ||||
Safe Transfer Fr... | 19137010 | 257 days ago | IN | 0 ETH | 0.00123346 | ||||
Set Approval For... | 19095356 | 263 days ago | IN | 0 ETH | 0.001108 | ||||
Safe Transfer Fr... | 19017574 | 274 days ago | IN | 0 ETH | 0.00127819 | ||||
Safe Transfer Fr... | 18995818 | 277 days ago | IN | 0 ETH | 0.00115725 | ||||
Safe Transfer Fr... | 18994728 | 277 days ago | IN | 0 ETH | 0.00131186 | ||||
Safe Transfer Fr... | 18987131 | 278 days ago | IN | 0 ETH | 0.00151034 | ||||
Safe Transfer Fr... | 18987117 | 278 days ago | IN | 0 ETH | 0.0016599 | ||||
Safe Transfer Fr... | 18973349 | 280 days ago | IN | 0 ETH | 0.00145318 | ||||
Safe Transfer Fr... | 18969780 | 280 days ago | IN | 0 ETH | 0.00133519 | ||||
Safe Transfer Fr... | 18969273 | 281 days ago | IN | 0 ETH | 0.00130446 | ||||
Safe Transfer Fr... | 18969256 | 281 days ago | IN | 0 ETH | 0.00139407 | ||||
Safe Transfer Fr... | 18968356 | 281 days ago | IN | 0 ETH | 0.00149023 | ||||
Safe Transfer Fr... | 18967234 | 281 days ago | IN | 0 ETH | 0.00091453 | ||||
Safe Transfer Fr... | 18967217 | 281 days ago | IN | 0 ETH | 0.00119929 | ||||
Set Approval For... | 18923958 | 287 days ago | IN | 0 ETH | 0.00121179 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
DigDogTowns
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import "@openzeppelin/contracts/access/AccessControl.sol"; import "contract-allow-list/contracts/ERC721AntiScam/ERC721AntiScam.sol"; import "@openzeppelin/contracts/token/common/ERC2981.sol"; contract DigDogTowns is AccessControl, ERC721AntiScam, ERC2981 { bytes32 public constant ADMIN = keccak256("ADMIN"); bytes32 public constant MINTER = keccak256("MINTER"); mapping(uint256 => string) private _tokenURIs; address public royaltyReceiver = 0x30e2B5141e57607B6E154B2Eb937d18dBF42298A; constructor() ERC721Psi("DigDogTowns!!!", "DDT") { _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); _grantRole(ADMIN, msg.sender); _grantRole(MINTER, msg.sender); _setDefaultRoyalty(royaltyReceiver, 1000); // 10% } /** * ミント関数 */ /// @dev MINTERによる外部ミント関数 /// @notice この関数を止める機能は実装していません。 /// MINTERロールをrevokeするか、ミント用コントラクトにpauseを実装してください。 function mint(address _to, uint256 _amount) external onlyRole(MINTER) { /** * @notice ミント用コントラクトでコントラクトからのミントをrevertするので * _safeMint()ではなく_mint()を使用しています */ _mint(_to, _amount); } /// @dev エアドロミント関数 function adminMint( address[] calldata _airdropAddresses, uint256[] calldata _UserMintAmount ) external onlyRole(ADMIN) { require( _airdropAddresses.length == _UserMintAmount.length, "array length unmatch" ); for (uint256 i = 0; i < _UserMintAmount.length; i++) { require(_UserMintAmount[i] > 0, "amount 0 address exists!"); _safeMint(_airdropAddresses[i], _UserMintAmount[i]); } } /** * tokenURI関係 */ /// @dev ERC721URIStorageをそのまま流用 冗長かも function tokenURI( uint256 tokenId ) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Psi: URI query for nonexistent token"); string memory _tokenURI = _tokenURIs[tokenId]; string memory base = _baseURI(); // If there is no base URI, return the token URI. if (bytes(base).length == 0) { return _tokenURI; } // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). if (bytes(_tokenURI).length > 0) { return string(abi.encodePacked(base, _tokenURI)); } return super.tokenURI(tokenId); } /// @dev tokenIdごとメタデータファイルのsetter function setTokenURI( uint256[] calldata _tokenId, string[] calldata _tokenURI ) external onlyRole(ADMIN) { require(_tokenId.length == _tokenURI.length, "array length unmatch"); for (uint256 i = 0; i < _tokenId.length; i++) { _tokenURIs[_tokenId[i]] = _tokenURI[i]; } } /** * ADMIN用 setter関数 */ /// @dev sAFA抑止機能のON/OFF(基本はONですが、念のため) function setEnableRestrict(bool value) external onlyRole(ADMIN) { enableRestrict = value; } /// @dev ロック機構のON/OFF(基本はONですが、念のため) function setEnableLock(bool value) external onlyRole(ADMIN) { enableLock = value; } /** * OVERRIDES ERC721Lockable functions */ /** * @notice setTokenLock()とsetWalletLock()は持ち主に加え、ADMINも操作できるようにしました * setContractLock()はownerでなく、ADMINが使えるようにしました */ function setTokenLock( uint256[] calldata tokenIds, LockStatus lockStatus ) external override { for (uint256 i = 0; i < tokenIds.length; i++) { require( msg.sender == ownerOf(tokenIds[i]) || hasRole(ADMIN, msg.sender), "not owner or admin." ); } _setTokenLock(tokenIds, lockStatus); } function setWalletLock( address to, LockStatus lockStatus ) external override { require( to == msg.sender || hasRole(ADMIN, msg.sender), "not yourself or admin." ); _setWalletLock(to, lockStatus); } function setContractLock( LockStatus lockStatus ) external override onlyRole(ADMIN) { _setContractLock(lockStatus); } /** * OVERRIDES ERC721RestrictApprove functions */ function addLocalContractAllowList( address transferer ) external override onlyRole(ADMIN) { _addLocalContractAllowList(transferer); } function removeLocalContractAllowList( address transferer ) external override onlyRole(ADMIN) { _removeLocalContractAllowList(transferer); } function getLocalContractAllowList() external view override returns (address[] memory) { return _getLocalContractAllowList(); } function setCALLevel(uint256 level) external override onlyRole(ADMIN) { CALLevel = level; } function setCAL(address calAddress) external override onlyRole(ADMIN) { _setCAL(calAddress); } /** * ERC2981のSetter関数 */ function setDefaultRoyalty( address receiver, uint96 feeNumerator ) external onlyRole(ADMIN) { _setDefaultRoyalty(receiver, feeNumerator); } function deleteDefaultRoyalty() external onlyRole(ADMIN) { _deleteDefaultRoyalty(); } /** * その他の関数 */ function supportsInterface( bytes4 interfaceId ) public view virtual override(AccessControl, ERC721AntiScam, ERC2981) returns (bool) { return (AccessControl.supportsInterface(interfaceId) || ERC721AntiScam.supportsInterface(interfaceId) || ERC2981.supportsInterface(interfaceId) || super.supportsInterface(interfaceId)); } /// @notice admin専用burn関数 function adminBurn( address _address, uint256 _tokenId ) external onlyRole(ADMIN) { require(_address == ownerOf(_tokenId), "address is not owner"); _burn(_tokenId); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.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: * * ```solidity * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ```solidity * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules} * to enforce additional security measures for this role. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => 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.9.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. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { 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.9.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.9.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 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.9.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 (last updated v4.9.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 * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [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://consensys.net/diligence/blog/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.8.0/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 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.9.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) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 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 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. 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: * ```solidity * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._ * _Available since v4.9 for `string`, `bytes`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct StringSlot { string value; } struct BytesSlot { bytes value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev Returns an `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; import "./math/SignedMath.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 `int256` to its ASCII `string` decimal representation. */ function toString(int256 value) internal pure returns (string memory) { return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value)))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { 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); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.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. * * ```solidity * 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.0; import "./IERC721AntiScam.sol"; import "./lockable/ERC721Lockable.sol"; import "./restrictApprove/ERC721RestrictApprove.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; /// @title AntiScam機能付きERC721A /// @dev Readmeを見てください。 abstract contract ERC721AntiScam is IERC721AntiScam, ERC721Lockable, ERC721RestrictApprove, Ownable { /*/////////////////////////////////////////////////////////////// OVERRIDES //////////////////////////////////////////////////////////////*/ function isApprovedForAll(address owner, address operator) public view virtual override(ERC721Lockable, ERC721RestrictApprove) returns (bool) { if (isLocked(owner) || !_isAllowed(owner, operator)) { return false; } return super.isApprovedForAll(owner, operator); } function setApprovalForAll(address operator, bool approved) public virtual override(ERC721Lockable, ERC721RestrictApprove) { require( isLocked(msg.sender) == false || approved == false, "Can not approve locked token" ); require( _isAllowed(operator) || approved == false, "RestrictApprove: Can not approve locked token" ); super.setApprovalForAll(operator, approved); } function _beforeApprove(address to, uint256 tokenId) internal virtual override(ERC721Lockable, ERC721RestrictApprove) { ERC721Lockable._beforeApprove(to, tokenId); ERC721RestrictApprove._beforeApprove(to, tokenId); } function approve(address to, uint256 tokenId) public virtual override(ERC721Lockable, ERC721RestrictApprove) { _beforeApprove(to, tokenId); ERC721Psi.approve(to, tokenId); } function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual override(ERC721Psi, ERC721Lockable) { ERC721Lockable._beforeTokenTransfers(from, to, startTokenId, quantity); } function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual override(ERC721Lockable, ERC721RestrictApprove) { ERC721Lockable._afterTokenTransfers(from, to, startTokenId, quantity); ERC721RestrictApprove._afterTokenTransfers(from, to, startTokenId, quantity); } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Lockable, ERC721RestrictApprove) returns (bool) { return ERC721Psi.supportsInterface(interfaceId) || ERC721Lockable.supportsInterface(interfaceId) || ERC721RestrictApprove.supportsInterface(interfaceId) || interfaceId == type(IERC721AntiScam).interfaceId; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import "./lockable/IERC721Lockable.sol"; import "./restrictApprove/IERC721RestrictApprove.sol"; /// @title IERC721AntiScam /// @dev 詐欺防止機能付きコントラクトのインターフェース /// @author hayatti.eth interface IERC721AntiScam is IERC721Lockable, IERC721RestrictApprove { }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import "./IERC721Lockable.sol"; import "erc721psi/contracts/extension/ERC721PsiBurnable.sol"; /// @title トークンのtransfer抑止機能付きコントラクト /// @dev Readmeを見てください。 abstract contract ERC721Lockable is ERC721PsiBurnable, IERC721Lockable { /*////////////////////////////////////////////////////////////// ロック変数。トークンごとに個別ロック設定を行う //////////////////////////////////////////////////////////////*/ bool public enableLock = true; LockStatus public contractLockStatus = LockStatus.UnLock; // token lock mapping(uint256 => LockStatus) public tokenLock; // wallet lock mapping(address => LockStatus) public walletLock; /*////////////////////////////////////////////////////////////// modifier //////////////////////////////////////////////////////////////*/ modifier existToken(uint256 tokenId) { require( _exists(tokenId), "Lockable: locking query for nonexistent token" ); _; } /*/////////////////////////////////////////////////////////////// ロック機能ロジック //////////////////////////////////////////////////////////////*/ // function getLockStatus(uint256 tokenId) external view returns (LockStatus) existToken(tokenId) { // return _getLockStatus(ownerOf(tokenId), tokenId); // } function isLocked(uint256 tokenId) public view virtual existToken(tokenId) returns (bool) { if (!enableLock) { return false; } if ( tokenLock[tokenId] == LockStatus.Lock || (tokenLock[tokenId] == LockStatus.UnSet && isLocked(ownerOf(tokenId))) ) { return true; } return false; } function isLocked(address holder) public view virtual returns (bool) { if (!enableLock) { return false; } if ( walletLock[holder] == LockStatus.Lock || (walletLock[holder] == LockStatus.UnSet && contractLockStatus == LockStatus.Lock) ) { return true; } return false; } function getTokensUnderLock() public view virtual returns (uint256[] memory) { uint256 start = _startTokenId(); uint256 end = _nextTokenId(); return getTokensUnderLock(start, end); } function getTokensUnderLock(uint256 start, uint256 end) public view virtual returns (uint256[] memory) { bool[] memory lockList = new bool[](end - start + 1); uint256 i = 0; uint256 lockCount = 0; for (uint256 tokenId = start; tokenId <= end; tokenId++) { if (_exists(tokenId) && isLocked(tokenId)) { lockList[i] = true; lockCount++; } else { lockList[i] = false; } i++; } uint256[] memory tokensUnderLock = new uint256[](lockCount); i = 0; uint256 j = 0; for (uint256 tokenId = start; tokenId <= end; tokenId++) { if (lockList[i]) { tokensUnderLock[j] = tokenId; j++; } i++; } return tokensUnderLock; } function _deleteTokenLock(uint256 tokenId) internal virtual { delete tokenLock[tokenId]; } function _setTokenLock(uint256[] calldata tokenIds, LockStatus lockStatus) internal virtual { for (uint256 i = 0; i < tokenIds.length; i++) { tokenLock[tokenIds[i]] = lockStatus; emit TokenLock( ownerOf(tokenIds[i]), msg.sender, lockStatus, tokenIds[i] ); } } function _setWalletLock(address to, LockStatus lockStatus) internal virtual { walletLock[to] = lockStatus; emit WalletLock(to, msg.sender, lockStatus); } function _setContractLock(LockStatus lockStatus) internal virtual { contractLockStatus = lockStatus; } /*/////////////////////////////////////////////////////////////// OVERRIDES //////////////////////////////////////////////////////////////*/ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { if (isLocked(owner)) { return false; } return super.isApprovedForAll(owner, operator); } function setApprovalForAll(address operator, bool approved) public virtual override { require( isLocked(msg.sender) == false || approved == false, "Can not approve locked token" ); super.setApprovalForAll(operator, approved); } function _beforeApprove( address, /**to**/ uint256 tokenId ) internal virtual { require( isLocked(tokenId) == false, "Lockable: Can not approve locked token" ); } function approve(address to, uint256 tokenId) public virtual override { _beforeApprove(to, tokenId); super.approve(to, tokenId); } function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 /*quantity*/ ) internal virtual override { // 転送やバーンにおいては、常にstartTokenIdは TokenIDそのものとなります。 if (from != address(0) && to != address(0)) { // トークンがロックされている場合、転送を許可しない require( isLocked(startTokenId) == false, "Lockable: Can not transfer locked token" ); } } function _afterTokenTransfers( address from, address, /*to*/ uint256 startTokenId, uint256 /*quantity*/ ) internal virtual override { // 転送やバーンにおいては、常にstartTokenIdは TokenIDそのものとなります。 if (from != address(0)) { // ロックをデフォルトに戻す。 _deleteTokenLock(startTokenId); } } function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC721Lockable).interfaceId || super.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; /** * @title IERC721Lockable * @dev トークンのtransfer抑止機能付きコントラクトのインターフェース * @author Lavulite */ interface IERC721Lockable { enum LockStatus { UnSet, UnLock, Lock } /** * @dev 個別ロックが指定された場合のイベント */ event TokenLock(address indexed holder, address indexed operator, LockStatus lockStatus, uint256 indexed tokenId); /** * @dev ウォレットロックが指定された場合のイベント */ event WalletLock(address indexed holder, address indexed operator, LockStatus lockStatus); /** * @dev 該当トークンIDのロックステータスを変更する。 */ function setTokenLock(uint256[] calldata tokenIds, LockStatus lockStatus) external; /** * @dev 該当ウォレットのロックステータスを変更する。 */ function setWalletLock(address to, LockStatus lockStatus) external; /** * @dev コントラクトのロックステータスを変更する。 */ function setContractLock(LockStatus lockStatus) external; /** * @dev 該当トークンIDがロックされているかを返す */ function isLocked(uint256 tokenId) external view returns (bool); /** * @dev ウォレットロックを行っているかを返す */ function isLocked(address holder) external view returns (bool); /** * @dev 転送が拒否されているトークンを全て返す */ function getTokensUnderLock() external view returns (uint256[] memory); /** * @dev 転送が拒否されているstartからstopまでのトークンIDを返す */ function getTokensUnderLock(uint256 start, uint256 end) external view returns (uint256[] memory); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import "erc721psi/contracts/extension/ERC721PsiBurnable.sol"; import "./IERC721RestrictApprove.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "../../proxy/interface/IContractAllowListProxy.sol"; /// @title AntiScam機能付きERC721A /// @dev Readmeを見てください。 abstract contract ERC721RestrictApprove is ERC721PsiBurnable, IERC721RestrictApprove { using EnumerableSet for EnumerableSet.AddressSet; IContractAllowListProxy public CAL; EnumerableSet.AddressSet localAllowedAddresses; modifier onlyHolder(uint256 tokenId) { require( msg.sender == ownerOf(tokenId), "RestrictApprove: operation is only holder." ); _; } /*////////////////////////////////////////////////////////////// 変数 //////////////////////////////////////////////////////////////*/ bool public enableRestrict = true; // token lock mapping(uint256 => uint256) public tokenCALLevel; // wallet lock mapping(address => uint256) public walletCALLevel; // contract lock uint256 public CALLevel = 1; /*/////////////////////////////////////////////////////////////// Approve抑制機能ロジック //////////////////////////////////////////////////////////////*/ function _addLocalContractAllowList(address transferer) internal virtual { localAllowedAddresses.add(transferer); emit LocalCalAdded(msg.sender, transferer); } function _removeLocalContractAllowList(address transferer) internal virtual { localAllowedAddresses.remove(transferer); emit LocalCalRemoved(msg.sender, transferer); } function _getLocalContractAllowList() internal virtual view returns(address[] memory) { return localAllowedAddresses.values(); } function _isLocalAllowed(address transferer) internal view virtual returns (bool) { return localAllowedAddresses.contains(transferer); } function _isAllowed(address transferer) internal view virtual returns (bool) { return _isAllowed(msg.sender, transferer); } function _isAllowed(uint256 tokenId, address transferer) internal view virtual returns (bool) { uint256 level = _getCALLevel(msg.sender, tokenId); return _isAllowed(transferer, level); } function _isAllowed(address holder, address transferer) internal view virtual returns (bool) { uint256 level = _getCALLevel(holder); return _isAllowed(transferer, level); } function _isAllowed(address transferer, uint256 level) internal view virtual returns (bool) { if (!enableRestrict) { return true; } return _isLocalAllowed(transferer) || CAL.isAllowed(transferer, level); } function _getCALLevel(address holder, uint256 tokenId) internal view virtual returns (uint256) { if (tokenCALLevel[tokenId] > 0) { return tokenCALLevel[tokenId]; } return _getCALLevel(holder); } function _getCALLevel(address holder) internal view virtual returns (uint256) { if (walletCALLevel[holder] > 0) { return walletCALLevel[holder]; } return CALLevel; } function _setCAL(address _cal) internal virtual { CAL = IContractAllowListProxy(_cal); } function _deleteTokenCALLevel(uint256 tokenId) internal virtual { delete tokenCALLevel[tokenId]; } function setTokenCALLevel(uint256 tokenId, uint256 level) external virtual onlyHolder(tokenId) { tokenCALLevel[tokenId] = level; } function setWalletCALLevel(uint256 level) external virtual { walletCALLevel[msg.sender] = level; } /*/////////////////////////////////////////////////////////////// OVERRIDES //////////////////////////////////////////////////////////////*/ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { if (_isAllowed(owner, operator) == false) { return false; } return super.isApprovedForAll(owner, operator); } function setApprovalForAll(address operator, bool approved) public virtual override { require( _isAllowed(operator) || approved == false, "RestrictApprove: Can not approve locked token" ); super.setApprovalForAll(operator, approved); } function _beforeApprove(address to, uint256 tokenId) internal virtual { if (to != address(0)) { require(_isAllowed(tokenId, to), "RestrictApprove: The contract is not allowed."); } } function approve(address to, uint256 tokenId) public virtual override { _beforeApprove(to, tokenId); super.approve(to, tokenId); } function _afterTokenTransfers( address from, address, /*to*/ uint256 startTokenId, uint256 /*quantity*/ ) internal virtual override { // 転送やバーンにおいては、常にstartTokenIdは TokenIDそのものとなります。 if (from != address(0)) { // CALレベルをデフォルトに戻す。 _deleteTokenCALLevel(startTokenId); } } function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC721RestrictApprove).interfaceId || super.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; /// @title IERC721RestrictApprove /// @dev Approve抑制機能付きコントラクトのインターフェース /// @author Lavulite interface IERC721RestrictApprove { /** * @dev CALレベルが変更された場合のイベント */ event CalLevelChanged(address indexed operator, uint256 indexed level); /** * @dev LocalContractAllowListnに追加された場合のイベント */ event LocalCalAdded(address indexed operator, address indexed transferer); /** * @dev LocalContractAllowListnに削除された場合のイベント */ event LocalCalRemoved(address indexed operator, address indexed transferer); /** * @dev CALを利用する場合のCALのレベルを設定する。レベルが高いほど、許可されるコントラクトの範囲が狭い。 */ function setCALLevel(uint256 level) external; /** * @dev CALのアドレスをセットする。 */ function setCAL(address calAddress) external; /** * @dev CALのリストに無い独自の許可アドレスを追加する場合、こちらにアドレスを記載する。 */ function addLocalContractAllowList(address transferer) external; /** * @dev CALのリストにある独自の許可アドレスを削除する場合、こちらにアドレスを記載する。 */ function removeLocalContractAllowList(address transferer) external; /** * @dev CALのリストにある独自の許可アドレスの一覧を取得する。 */ function getLocalContractAllowList() external view returns(address[] memory); }
// 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 /** ______ _____ _____ ______ ___ __ _ _ _ | ____| __ \ / ____|____ |__ \/_ | || || | | |__ | |__) | | / / ) || | \| |/ | | __| | _ /| | / / / / | |\_ _/ | |____| | \ \| |____ / / / /_ | | | | |______|_| \_\\_____|/_/ |____||_| |_| - 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 private _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 = _startTokenId(); } /** * @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 0; } /** * @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(); } /** * @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: MIT /** _____ ___ ___ __ ____ _ __ / ___/____ / (_)___/ (_) /___ __ / __ )(_) /______ \__ \/ __ \/ / / __ / / __/ / / / / __ / / __/ ___/ ___/ / /_/ / / / /_/ / / /_/ /_/ / / /_/ / / /_(__ ) /____/\____/_/_/\__,_/_/\__/\__, / /_____/_/\__/____/ /____/ - npm: https://www.npmjs.com/package/solidity-bits - github: https://github.com/estarriolvetch/solidity-bits */ pragma solidity ^0.8.0; import "./BitScan.sol"; /** * @dev This Library is a modified version of Openzeppelin's BitMaps library. * 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. */ /** * @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 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]); } } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"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":"operator","type":"address"},{"indexed":true,"internalType":"uint256","name":"level","type":"uint256"}],"name":"CalLevelChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"transferer","type":"address"}],"name":"LocalCalAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"transferer","type":"address"}],"name":"LocalCalRemoved","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":"holder","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"enum IERC721Lockable.LockStatus","name":"lockStatus","type":"uint8"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"TokenLock","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"holder","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"enum IERC721Lockable.LockStatus","name":"lockStatus","type":"uint8"}],"name":"WalletLock","type":"event"},{"inputs":[],"name":"ADMIN","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","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":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"transferer","type":"address"}],"name":"addLocalContractAllowList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"adminBurn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_airdropAddresses","type":"address[]"},{"internalType":"uint256[]","name":"_UserMintAmount","type":"uint256[]"}],"name":"adminMint","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":"contractLockStatus","outputs":[{"internalType":"enum IERC721Lockable.LockStatus","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deleteDefaultRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"enableLock","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"enableRestrict","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLocalContractAllowList","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"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":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"}],"name":"getTokensUnderLock","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokensUnderLock","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"holder","type":"address"}],"name":"isLocked","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":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"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":[],"name":"royaltyReceiver","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"calAddress","type":"address"}],"name":"setCAL","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"level","type":"uint256"}],"name":"setCALLevel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum IERC721Lockable.LockStatus","name":"lockStatus","type":"uint8"}],"name":"setContractLock","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":"bool","name":"value","type":"bool"}],"name":"setEnableLock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"value","type":"bool"}],"name":"setEnableRestrict","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"level","type":"uint256"}],"name":"setTokenCALLevel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"internalType":"enum IERC721Lockable.LockStatus","name":"lockStatus","type":"uint8"}],"name":"setTokenLock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenId","type":"uint256[]"},{"internalType":"string[]","name":"_tokenURI","type":"string[]"}],"name":"setTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"level","type":"uint256"}],"name":"setWalletCALLevel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"enum IERC721Lockable.LockStatus","name":"lockStatus","type":"uint8"}],"name":"setWalletLock","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":"","type":"uint256"}],"name":"tokenCALLevel","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenLock","outputs":[{"internalType":"enum IERC721Lockable.LockStatus","name":"","type":"uint8"}],"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":"address","name":"","type":"address"}],"name":"walletCALLevel","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"walletLock","outputs":[{"internalType":"enum IERC721Lockable.LockStatus","name":"","type":"uint8"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60806040526009805461ffff1916610101179055600f805460ff19166001908117909155601255601780546001600160a01b0319167330e2b5141e57607b6e154b2eb937d18dbf42298a1790553480156200005957600080fd5b506040518060400160405280600e81526020016d446967446f67546f776e7321212160901b8152506040518060400160405280600381526020016211111560ea1b8152508160029081620000ae9190620003f2565b506003620000bd8282620003f2565b5050600060055550620000d03362000155565b620000dd600033620001a7565b620001097fdf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec4233620001a7565b620001357ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc933620001a7565b6017546200014f906001600160a01b03166103e862000248565b620004be565b601380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1662000244576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620002033390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b6127106001600160601b0382161115620002bc5760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b60648201526084015b60405180910390fd5b6001600160a01b038216620003145760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401620002b3565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217601455565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200037857607f821691505b6020821081036200039957634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620003ed57600081815260208120601f850160051c81016020861015620003c85750805b601f850160051c820191505b81811015620003e957828155600101620003d4565b5050505b505050565b81516001600160401b038111156200040e576200040e6200034d565b62000426816200041f845462000363565b846200039f565b602080601f8311600181146200045e5760008415620004455750858301515b600019600386901b1c1916600185901b178555620003e9565b600085815260208120601f198616915b828110156200048f578886015182559484019460019091019084016200046e565b5085821015620004ae5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b61417580620004ce6000396000f3fe608060405234801561001057600080fd5b50600436106103985760003560e01c806370a08231116101e9578063a41216ac1161010f578063d547741f116100ad578063f3b3059e1161007c578063f3b3059e1461082e578063f6aacfb114610841578063fe6d812414610854578063ff7682121461087b57600080fd5b8063d547741f146107ed578063e985e9c514610800578063eb05629714610813578063f2fde38b1461081b57600080fd5b8063aafb2d44116100e9578063aafb2d4414610794578063b31391cb146107a7578063b88d4fde146107c7578063c87b56dd146107da57600080fd5b8063a41216ac14610766578063a49340cc14610779578063aa1b103f1461078c57600080fd5b80638da5cb5b11610187578063a059b16411610156578063a059b16414610718578063a217fddf1461072b578063a22cb46514610733578063a35c23ad1461074657600080fd5b80638da5cb5b146106d957806391d14854146106ea57806395d89b41146106fd5780639fbc87131461070557600080fd5b806379884269116101c3578063798842691461067d5780637c3dc173146106a05780638462151c146106b3578063874a8b02146106c657600080fd5b806370a082311461064f578063715018a61461066257806372b44d711461066a57600080fd5b806323b872dd116102ce578063396e8f531161026c5780634b81d8bd1161023b5780634b81d8bd146106005780634f3db346146106205780634fdaf052146106295780636352211e1461063c57600080fd5b8063396e8f53146105b457806340c10f19146105c757806342842e0e146105da5780634a4fbeec146105ed57600080fd5b80632a55205a116102a85780632a55205a1461054f5780632f2ff15d1461058157806336568abe14610594578063374032a1146105a757600080fd5b806323b872dd14610504578063248a9ca3146105175780632a0acc6a1461053a57600080fd5b8063081812fc1161033b57806310c395bf1161031557806310c395bf1461048c57806313c52826146104ab57806318160ddd146104ce5780632398f843146104e457600080fd5b8063081812fc1461043b578063095ea7b3146104665780630f4345e21461047957600080fd5b806304634d8d1161037757806304634d8d146103f357806306dd04191461040657806306fdde0314610419578063072653891461042e57600080fd5b80623f332f1461039d57806301ffc9a7146103bb578063025e332e146103de575b600080fd5b6103a561088e565b6040516103b2919061360a565b60405180910390f35b6103ce6103c936600461366d565b61089d565b60405190151581526020016103b2565b6103f16103ec3660046136a1565b6108db565b005b6103f16104013660046136bc565b610916565b6103f16104143660046136ff565b61093d565b6104216109c3565b6040516103b29190613779565b600f546103ce9060ff1681565b61044e61044936600461378c565b610a55565b6040516001600160a01b0390911681526020016103b2565b6103f16104743660046136ff565b610ae0565b6103f161048736600461378c565b610af4565b60095461049e90610100900460ff1681565b6040516103b291906137bb565b61049e6104b93660046136a1565b600b6020526000908152604090205460ff1681565b6104d6610b12565b6040519081526020016103b2565b6104d66104f23660046136a1565b60116020526000908152604090205481565b6103f16105123660046137e3565b610b2e565b6104d661052536600461378c565b60009081526020819052604090206001015490565b6104d660008051602061402083398151915281565b61056261055d36600461381f565b610b5f565b604080516001600160a01b0390931683526020830191909152016103b2565b6103f161058f366004613841565b610c0d565b6103f16105a2366004613841565b610c32565b6009546103ce9060ff1681565b600c5461044e906001600160a01b031681565b6103f16105d53660046136ff565b610cac565b6103f16105e83660046137e3565b610ce0565b6103ce6105fb3660046136a1565b610cfb565b61061361060e36600461381f565b610db0565b6040516103b2919061386d565b6104d660125481565b6103f16106373660046138b4565b610f80565b61044e61064a36600461378c565b610fa1565b6104d661065d3660046136a1565b610fb5565b6103f1611083565b6103f16106783660046136a1565b611097565b61049e61068b36600461378c565b600a6020526000908152604090205460ff1681565b6103f16106ae36600461381f565b6110b8565b6106136106c13660046136a1565b611148565b6103f16106d43660046138cf565b61120f565b6013546001600160a01b031661044e565b6103ce6106f8366004613841565b611288565b6104216112b1565b60175461044e906001600160a01b031681565b6103f1610726366004613907565b6112c0565b6104d6600081565b6103f1610741366004613924565b6112ec565b6103f161075436600461378c565b33600090815260116020526040902055565b6103f1610774366004613907565b611383565b6103f1610787366004613995565b6113af565b6103f16114e2565b6103f16107a2366004613995565b611507565b6104d66107b536600461378c565b60106020526000908152604090205481565b6103f16107d5366004613a17565b6115df565b6104216107e836600461378c565b611617565b6103f16107fb366004613841565b611743565b6103ce61080e366004613af3565b611768565b6106136117a3565b6103f16108293660046136a1565b6117c4565b6103f161083c366004613b1d565b61183a565b6103ce61084f36600461378c565b6118f8565b6104d67ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc981565b6103f16108893660046136a1565b6119f5565b6060610898611a16565b905090565b60006108a882611a22565b806108b757506108b782611a57565b806108c657506108c682611a95565b806108d557506108d582611a95565b92915050565b6000805160206140208339815191526108f381611aba565b600c80546001600160a01b0319166001600160a01b0384161790555050565b5050565b60008051602061402083398151915261092e81611aba565b6109388383611ac4565b505050565b60008051602061402083398151915261095581611aba565b61095e82610fa1565b6001600160a01b0316836001600160a01b0316146109ba5760405162461bcd60e51b815260206004820152601460248201527330b2323932b9b99034b9903737ba1037bbb732b960611b60448201526064015b60405180910390fd5b61093882611bc1565b6060600280546109d290613b71565b80601f01602080910402602001604051908101604052809291908181526020018280546109fe90613b71565b8015610a4b5780601f10610a2057610100808354040283529160200191610a4b565b820191906000526020600020905b815481529060010190602001808311610a2e57829003601f168201915b5050505050905090565b6000610a6082611c2d565b610ac45760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a20617070726f76656420717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084016109b1565b506000908152600660205260409020546001600160a01b031690565b610aea8282611c63565b6109128282611c77565b600080516020614020833981519152610b0c81611aba565b50601255565b6000610b1c611d89565b610b24611deb565b6108989190613bbb565b610b383382611dfb565b610b545760405162461bcd60e51b81526004016109b190613bce565b610938838383611ec0565b60008281526015602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610bd45750604080518082019091526014546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090610bf3906001600160601b031687613c22565b610bfd9190613c39565b91519350909150505b9250929050565b600082815260208190526040902060010154610c2881611aba565b61093883836120bf565b6001600160a01b0381163314610ca25760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016109b1565b6109128282612143565b7ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc9610cd681611aba565b61093883836121a8565b610938838383604051806020016040528060008152506115df565b60095460009060ff16610d1057506000919050565b60026001600160a01b0383166000908152600b602052604090205460ff166002811115610d3f57610d3f6137a5565b1480610d9b57506001600160a01b0382166000908152600b602052604081205460ff166002811115610d7357610d736137a5565b148015610d9b57506002600954610100900460ff166002811115610d9957610d996137a5565b145b15610da857506001919050565b506000919050565b60606000610dbe8484613bbb565b610dc9906001613c5b565b67ffffffffffffffff811115610de157610de1613a01565b604051908082528060200260200182016040528015610e0a578160200160208202803683370190505b509050600080855b858111610eb257610e2281611c2d565b8015610e325750610e32816118f8565b15610e6d576001848481518110610e4b57610e4b613c6e565b9115156020928302919091019091015281610e6581613c84565b925050610e92565b6000848481518110610e8157610e81613c6e565b911515602092830291909101909101525b82610e9c81613c84565b9350508080610eaa90613c84565b915050610e12565b5060008167ffffffffffffffff811115610ece57610ece613a01565b604051908082528060200260200182016040528015610ef7578160200160208202803683370190505b5060009350905082875b878111610f7357858581518110610f1a57610f1a613c6e565b602002602001015115610f535780838381518110610f3a57610f3a613c6e565b602090810291909101015281610f4f81613c84565b9250505b84610f5d81613c84565b9550508080610f6b90613c84565b915050610f01565b5090979650505050505050565b600080516020614020833981519152610f9881611aba565b61091282612335565b600080610fad8361235e565b509392505050565b60006001600160a01b0382166110235760405162461bcd60e51b815260206004820152602d60248201527f4552433732315073693a2062616c616e636520717565727920666f722074686560448201526c207a65726f206164647265737360981b60648201526084016109b1565b6000805b60055481101561107c5761103a81611c2d565b1561106c5761104881610fa1565b6001600160a01b0316846001600160a01b03160361106c5761106982613c84565b91505b61107581613c84565b9050611027565b5092915050565b61108b6123f5565b611095600061244f565b565b6000805160206140208339815191526110af81611aba565b610912826124a1565b816110c281610fa1565b6001600160a01b0316336001600160a01b0316146111355760405162461bcd60e51b815260206004820152602a60248201527f5265737472696374417070726f76653a206f7065726174696f6e206973206f6e604482015269363c903437b63232b91760b11b60648201526084016109b1565b5060009182526010602052604090912055565b606060008061115684610fb5565b905060008167ffffffffffffffff81111561117357611173613a01565b60405190808252806020026020018201604052801561119c578160200160208202803683370190505b50905060005b828414611206576111b281611c2d565b156111fe57856001600160a01b03166111ca82610fa1565b6001600160a01b0316036111fe57808285806001019650815181106111f1576111f1613c6e565b6020026020010181815250505b6001016111a2565b50949350505050565b6001600160a01b038216331480611239575061123960008051602061402083398151915233611288565b61127e5760405162461bcd60e51b81526020600482015260166024820152753737ba103cb7bab939b2b6331037b91030b236b4b71760511b60448201526064016109b1565b61091282826124e6565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6060600380546109d290613b71565b6000805160206140208339815191526112d881611aba565b50600f805460ff1916911515919091179055565b6112f533610cfb565b15806112ff575080155b61134b5760405162461bcd60e51b815260206004820152601c60248201527f43616e206e6f7420617070726f7665206c6f636b656420746f6b656e0000000060448201526064016109b1565b6113548261256f565b8061135d575080155b6113795760405162461bcd60e51b81526004016109b190613c9d565b610912828261257b565b60008051602061402083398151915261139b81611aba565b506009805460ff1916911515919091179055565b6000805160206140208339815191526113c781611aba565b83821461140d5760405162461bcd60e51b81526020600482015260146024820152730c2e4e4c2f240d8cadccee8d040eadcdac2e8c6d60631b60448201526064016109b1565b60005b828110156114da57600084848381811061142c5761142c613c6e565b90506020020135116114805760405162461bcd60e51b815260206004820152601860248201527f616d6f756e74203020616464726573732065786973747321000000000000000060448201526064016109b1565b6114c886868381811061149557611495613c6e565b90506020020160208101906114aa91906136a1565b8585848181106114bc576114bc613c6e565b905060200201356125b3565b806114d281613c84565b915050611410565b505050505050565b6000805160206140208339815191526114fa81611aba565b6115046000601455565b50565b60008051602061402083398151915261151f81611aba565b8382146115655760405162461bcd60e51b81526020600482015260146024820152730c2e4e4c2f240d8cadccee8d040eadcdac2e8c6d60631b60448201526064016109b1565b60005b848110156114da5783838281811061158257611582613c6e565b90506020028101906115949190613cea565b601660008989868181106115aa576115aa613c6e565b90506020020135815260200190815260200160002091826115cc929190613d77565b50806115d781613c84565b915050611568565b6115e93383611dfb565b6116055760405162461bcd60e51b81526004016109b190613bce565b611611848484846125cd565b50505050565b606061162282611c2d565b61163e5760405162461bcd60e51b81526004016109b190613e38565b6000828152601660205260408120805461165790613b71565b80601f016020809104026020016040519081016040528092919081815260200182805461168390613b71565b80156116d05780601f106116a5576101008083540402835291602001916116d0565b820191906000526020600020905b8154815290600101906020018083116116b357829003601f168201915b5050505050905060006116ee60408051602081019091526000815290565b90508051600003611700575092915050565b81511561173257808260405160200161171a929190613e82565b60405160208183030381529060405292505050919050565b61173b84612602565b949350505050565b60008281526020819052604090206001015461175e81611aba565b6109388383612143565b600061177383610cfb565b8061178557506117838383612691565b155b15611792575060006108d5565b61179c83836126a9565b9392505050565b60606000806117b160055490565b90506117bd8282610db0565b9250505090565b6117cc6123f5565b6001600160a01b0381166118315760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016109b1565b6115048161244f565b60005b828110156118ec5761186684848381811061185a5761185a613c6e565b90506020020135610fa1565b6001600160a01b0316336001600160a01b03161480611898575061189860008051602061402083398151915233611288565b6118da5760405162461bcd60e51b81526020600482015260136024820152723737ba1037bbb732b91037b91030b236b4b71760691b60448201526064016109b1565b806118e481613c84565b91505061183d565b506109388383836126d0565b60008161190481611c2d565b6119665760405162461bcd60e51b815260206004820152602d60248201527f4c6f636b61626c653a206c6f636b696e6720717565727920666f72206e6f6e6560448201526c3c34b9ba32b73a103a37b5b2b760991b60648201526084016109b1565b60095460ff1661197957600091506119ef565b60026000848152600a602052604090205460ff16600281111561199e5761199e6137a5565b14806119dc57506000838152600a602052604081205460ff1660028111156119c8576119c86137a5565b1480156119dc57506119dc6105fb84610fa1565b156119ea57600191506119ef565b600091505b50919050565b600080516020614020833981519152611a0d81611aba565b610912826127b4565b6060610898600d6127f9565b60006001600160e01b03198216637965db0b60e01b14806108d557506301ffc9a760e01b6001600160e01b03198316146108d5565b6000611a6282612806565b80611a715750611a7182612846565b80611a805750611a808261286b565b806108d55750506001600160e01b0319161590565b60006001600160e01b0319821663152a902d60e11b14806108d557506108d582611a57565b6115048133612890565b6127106001600160601b0382161115611b325760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b60648201526084016109b1565b6001600160a01b038216611b885760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c69642072656365697665720000000000000060448201526064016109b1565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217601455565b6000611bcc82610fa1565b9050611bdc8160008460016128e9565b611be76008836128f5565b60405182906000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a4610912816000846001612921565b600881811c60009081526020919091526040812054600160ff1b60ff84161c1615611c5a57506000919050565b6108d582612939565b611c6d8282612955565b61091282826129ba565b6000611c8282610fa1565b9050806001600160a01b0316836001600160a01b031603611cf15760405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a20617070726f76616c20746f2063757272656e74206f6044820152633bb732b960e11b60648201526084016109b1565b336001600160a01b0382161480611d0d5750611d0d8133611768565b611d7f5760405162461bcd60e51b815260206004820152603b60248201527f4552433732315073693a20617070726f76652063616c6c6572206973206e6f7460448201527f206f776e6572206e6f7220617070726f76656420666f7220616c6c000000000060648201526084016109b1565b6109388383612a35565b60055460009081908190611da19060081c6001613c5b565b9050815b81811015611de557600081815260086020526040902054611dc581612aa3565b611dcf9086613c5b565b9450508080611ddd90613c84565b915050611da5565b50505090565b6000806005546108989190613bbb565b6000611e0682611c2d565b611e6a5760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a206f70657261746f7220717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084016109b1565b6000611e7583610fa1565b9050806001600160a01b0316846001600160a01b03161480611eb05750836001600160a01b0316611ea584610a55565b6001600160a01b0316145b8061173b575061173b8185611768565b600080611ecc8361235e565b91509150846001600160a01b0316826001600160a01b031614611f465760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a207472616e73666572206f6620746f6b656e2074686160448201526b3a1034b9903737ba1037bbb760a11b60648201526084016109b1565b6001600160a01b038416611fac5760405162461bcd60e51b815260206004820152602760248201527f4552433732315073693a207472616e7366657220746f20746865207a65726f206044820152666164647265737360c81b60648201526084016109b1565b611fb985858560016128e9565b611fc4600084612a35565b6000611fd1846001613c5b565b600881901c600090815260016020526040902054909150600160ff1b60ff83161c16158015612001575060055481105b1561203857600081815260046020526040902080546001600160a01b0319166001600160a01b0388161790556120386001826128f5565b600084815260046020526040902080546001600160a01b0319166001600160a01b038716179055818414612071576120716001856128f5565b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a46114da8686866001612921565b6120c98282611288565b610912576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556120ff3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61214d8282611288565b15610912576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60006121b360055490565b9050600082116122135760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a207175616e74697479206d7573742062652067726561604482015264074657220360dc1b60648201526084016109b1565b6001600160a01b0383166122755760405162461bcd60e51b815260206004820152602360248201527f4552433732315073693a206d696e7420746f20746865207a65726f206164647260448201526265737360e81b60648201526084016109b1565b61228260008483856128e9565b81600560008282546122949190613c5b565b9091555050600081815260046020526040902080546001600160a01b0319166001600160a01b0385161790556122cb6001826128f5565b6122d86000848385612921565b805b6122e48383613c5b565b8110156116115760405181906001600160a01b038616906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a48061232d81613c84565b9150506122da565b6009805482919061ff001916610100836002811115612356576123566137a5565b021790555050565b60008061236a83611c2d565b6123cb5760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a206f776e657220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016109b1565b6123d483612ac2565b6000818152600460205260409020546001600160a01b031694909350915050565b6013546001600160a01b031633146110955760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016109b1565b601380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6124ac600d82612acf565b506040516001600160a01b0382169033907f3b01c97343869ca2757fcc37cdb8f71683b0a7aed858e3755f4529a1db85729290600090a350565b6001600160a01b0382166000908152600b60205260409020805482919060ff1916600183600281111561251b5761251b6137a5565b0217905550336001600160a01b0316826001600160a01b03167f9fdb14457e6a7bd3753c649831b026de987c06e52d16459a928540738c2ea34b8360405161256391906137bb565b60405180910390a35050565b60006108d53383612691565b6125848261256f565b8061258d575080155b6125a95760405162461bcd60e51b81526004016109b190613c9d565b6109128282612ae4565b610912828260405180602001604052806000815250612b4d565b6125d8848484611ec0565b6125e6848484600185612b6e565b6116115760405162461bcd60e51b81526004016109b190613eb1565b606061260d82611c2d565b6126295760405162461bcd60e51b81526004016109b190613e38565b600061264060408051602081019091526000815290565b90506000815111612660576040518060200160405280600081525061179c565b8061266a84612ca5565b60405160200161267b929190613e82565b6040516020818303038152906040529392505050565b60008061269d84612d38565b905061173b8382612d7a565b60006126b58383612691565b15156000036126c6575060006108d5565b61179c8383612e13565b60005b828110156116115781600a60008686858181106126f2576126f2613c6e565b60209081029290920135835250810191909152604001600020805460ff19166001836002811115612725576127256137a5565b021790555083838281811061273c5761273c613c6e565b90506020020135336001600160a01b031661276286868581811061185a5761185a613c6e565b6001600160a01b03167f80a668baf7ac68b329075f26c37b4428d4aa272c3bd4c9611b25f5fb1c473f7c8560405161279a91906137bb565b60405180910390a4806127ac81613c84565b9150506126d3565b6127bf600d82612e59565b506040516001600160a01b0382169033907fbd0af1fe0a2c1c7bb340c17a284a291138979c8eeb797e176dbd1c415199af3c90600090a350565b6060600061179c83612e6e565b60006001600160e01b031982166380ac58cd60e01b148061283757506001600160e01b03198216635b5e139f60e01b145b806108d557506108d582611a22565b60006001600160e01b03198216632742b5b960e01b14806108d557506108d582612806565b60006001600160e01b03198216630101c11560e71b14806108d557506108d582612846565b61289a8282611288565b610912576128a781612eca565b6128b2836020612edc565b6040516020016128c3929190613f06565b60408051601f198184030181529082905262461bcd60e51b82526109b191600401613779565b61161184848484613078565b600881901c600090815260209290925260409091208054600160ff1b60ff9093169290921c9091179055565b61292d84848484613103565b6116118484848461312d565b600061294460055490565b821080156108d55750600192915050565b61295e816118f8565b156109125760405162461bcd60e51b815260206004820152602660248201527f4c6f636b61626c653a2043616e206e6f7420617070726f7665206c6f636b6564604482015265103a37b5b2b760d11b60648201526084016109b1565b6001600160a01b03821615610912576129d38183613150565b6109125760405162461bcd60e51b815260206004820152602d60248201527f5265737472696374417070726f76653a2054686520636f6e747261637420697360448201526c103737ba1030b63637bbb2b21760991b60648201526084016109b1565b600081815260066020526040902080546001600160a01b0319166001600160a01b0384169081179091558190612a6a82610fa1565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60005b8115612abd57600019820190911690600101612aa6565b919050565b60006108d560018361315d565b600061179c836001600160a01b038416613255565b612aed33610cfb565b1580612af7575080155b612b435760405162461bcd60e51b815260206004820152601c60248201527f43616e206e6f7420617070726f7665206c6f636b656420746f6b656e0000000060448201526064016109b1565b6109128282613348565b6000612b5860055490565b9050612b6484846121a8565b6125e66000858386865b60006001600160a01b0385163b15612c9857506001835b612b8f8486613c5b565b811015612c9257604051630a85bd0160e11b81526001600160a01b0387169063150b7a0290612bc89033908b9086908990600401613f7b565b6020604051808303816000875af1925050508015612c03575060408051601f3d908101601f19168201909252612c0091810190613fb8565b60015b612c60573d808015612c31576040519150601f19603f3d011682016040523d82523d6000602084013e612c36565b606091505b508051600003612c585760405162461bcd60e51b81526004016109b190613eb1565b805181602001fd5b828015612c7d57506001600160e01b03198116630a85bd0160e11b145b92505080612c8a81613c84565b915050612b85565b50612c9c565b5060015b95945050505050565b60606000612cb283613405565b600101905060008167ffffffffffffffff811115612cd257612cd2613a01565b6040519080825280601f01601f191660200182016040528015612cfc576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084612d0657509392505050565b6001600160a01b03811660009081526011602052604081205415612d7257506001600160a01b031660009081526011602052604090205490565b505060125490565b600f5460009060ff16612d8f575060016108d5565b612d98836134dd565b8061179c5750600c54604051630f8350ed60e41b81526001600160a01b038581166004830152602482018590529091169063f8350ed090604401602060405180830381865afa158015612def573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061179c9190613fd5565b6000612e1e83610cfb565b15612e2b575060006108d5565b6001600160a01b0380841660009081526007602090815260408083209386168352929052205460ff1661179c565b600061179c836001600160a01b038416613507565b606081600001805480602002602001604051908101604052809291908181526020018280548015612ebe57602002820191906000526020600020905b815481526020019060010190808311612eaa575b50505050509050919050565b60606108d56001600160a01b03831660145b60606000612eeb836002613c22565b612ef6906002613c5b565b67ffffffffffffffff811115612f0e57612f0e613a01565b6040519080825280601f01601f191660200182016040528015612f38576020820181803683370190505b509050600360fc1b81600081518110612f5357612f53613c6e565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110612f8257612f82613c6e565b60200101906001600160f81b031916908160001a9053506000612fa6846002613c22565b612fb1906001613c5b565b90505b6001811115613029576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110612fe557612fe5613c6e565b1a60f81b828281518110612ffb57612ffb613c6e565b60200101906001600160f81b031916908160001a90535060049490941c9361302281613ff2565b9050612fb4565b50831561179c5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016109b1565b6001600160a01b0384161580159061309857506001600160a01b03831615155b15611611576130a6826118f8565b156116115760405162461bcd60e51b815260206004820152602760248201527f4c6f636b61626c653a2043616e206e6f74207472616e73666572206c6f636b6560448201526632103a37b5b2b760c91b60648201526084016109b1565b6001600160a01b03841615611611576000828152600a60205260409020805460ff19169055611611565b6001600160a01b0384161561161157600082815260106020526040812055611611565b60008061269d3385613556565b600881901c60008181526020849052604081205490919060ff808516919082181c801561319f5761318d81613588565b60ff168203600884901b17935061324c565b6000831161320c5760405162461bcd60e51b815260206004820152603460248201527f4269744d6170733a205468652073657420626974206265666f7265207468652060448201527334b73232bc103237b2b9b713ba1032bc34b9ba1760611b60648201526084016109b1565b5060001990910160008181526020869052604090205490919080156132475761323481613588565b60ff0360ff16600884901b17935061324c565b61319f565b50505092915050565b6000818152600183016020526040812054801561333e576000613279600183613bbb565b855490915060009061328d90600190613bbb565b90508181146132f25760008660000182815481106132ad576132ad613c6e565b90600052602060002001549050808760000184815481106132d0576132d0613c6e565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061330357613303614009565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506108d5565b60009150506108d5565b336001600160a01b038316036133a05760405162461bcd60e51b815260206004820152601c60248201527f4552433732315073693a20617070726f766520746f2063616c6c65720000000060448201526064016109b1565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319101612563565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106134445772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310613470576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061348e57662386f26fc10000830492506010015b6305f5e10083106134a6576305f5e100830492506008015b61271083106134ba57612710830492506004015b606483106134cc576064830492506002015b600a83106108d55760010192915050565b60006108d5600d836001600160a01b0381166000908152600183016020526040812054151561179c565b600081815260018301602052604081205461354e575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556108d5565b5060006108d5565b6000818152601060205260408120541561357f57506000818152601060205260409020546108d5565b61179c83612d38565b60006040518061012001604052806101008152602001614040610100913960f87e818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff6135d1856135f2565b02901c815181106135e4576135e4613c6e565b016020015160f81c92915050565b600080821161360057600080fd5b5060008190031690565b6020808252825182820181905260009190848201906040850190845b8181101561364b5783516001600160a01b031683529284019291840191600101613626565b50909695505050505050565b6001600160e01b03198116811461150457600080fd5b60006020828403121561367f57600080fd5b813561179c81613657565b80356001600160a01b0381168114612abd57600080fd5b6000602082840312156136b357600080fd5b61179c8261368a565b600080604083850312156136cf57600080fd5b6136d88361368a565b915060208301356001600160601b03811681146136f457600080fd5b809150509250929050565b6000806040838503121561371257600080fd5b61371b8361368a565b946020939093013593505050565b60005b8381101561374457818101518382015260200161372c565b50506000910152565b60008151808452613765816020860160208601613729565b601f01601f19169290920160200192915050565b60208152600061179c602083018461374d565b60006020828403121561379e57600080fd5b5035919050565b634e487b7160e01b600052602160045260246000fd5b60208101600383106137dd57634e487b7160e01b600052602160045260246000fd5b91905290565b6000806000606084860312156137f857600080fd5b6138018461368a565b925061380f6020850161368a565b9150604084013590509250925092565b6000806040838503121561383257600080fd5b50508035926020909101359150565b6000806040838503121561385457600080fd5b823591506138646020840161368a565b90509250929050565b6020808252825182820181905260009190848201906040850190845b8181101561364b57835183529284019291840191600101613889565b803560038110612abd57600080fd5b6000602082840312156138c657600080fd5b61179c826138a5565b600080604083850312156138e257600080fd5b6138eb8361368a565b9150613864602084016138a5565b801515811461150457600080fd5b60006020828403121561391957600080fd5b813561179c816138f9565b6000806040838503121561393757600080fd5b6139408361368a565b915060208301356136f4816138f9565b60008083601f84011261396257600080fd5b50813567ffffffffffffffff81111561397a57600080fd5b6020830191508360208260051b8501011115610c0657600080fd5b600080600080604085870312156139ab57600080fd5b843567ffffffffffffffff808211156139c357600080fd5b6139cf88838901613950565b909650945060208701359150808211156139e857600080fd5b506139f587828801613950565b95989497509550505050565b634e487b7160e01b600052604160045260246000fd5b60008060008060808587031215613a2d57600080fd5b613a368561368a565b9350613a446020860161368a565b925060408501359150606085013567ffffffffffffffff80821115613a6857600080fd5b818701915087601f830112613a7c57600080fd5b813581811115613a8e57613a8e613a01565b604051601f8201601f19908116603f01168101908382118183101715613ab657613ab6613a01565b816040528281528a6020848701011115613acf57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b60008060408385031215613b0657600080fd5b613b0f8361368a565b91506138646020840161368a565b600080600060408486031215613b3257600080fd5b833567ffffffffffffffff811115613b4957600080fd5b613b5586828701613950565b9094509250613b689050602085016138a5565b90509250925092565b600181811c90821680613b8557607f821691505b6020821081036119ef57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b818103818111156108d5576108d5613ba5565b60208082526034908201527f4552433732315073693a207472616e736665722063616c6c6572206973206e6f6040820152731d081bdddb995c881b9bdc88185c1c1c9bdd995960621b606082015260800190565b80820281158282048414176108d5576108d5613ba5565b600082613c5657634e487b7160e01b600052601260045260246000fd5b500490565b808201808211156108d5576108d5613ba5565b634e487b7160e01b600052603260045260246000fd5b600060018201613c9657613c96613ba5565b5060010190565b6020808252602d908201527f5265737472696374417070726f76653a2043616e206e6f7420617070726f766560408201526c103637b1b5b2b2103a37b5b2b760991b606082015260800190565b6000808335601e19843603018112613d0157600080fd5b83018035915067ffffffffffffffff821115613d1c57600080fd5b602001915036819003821315610c0657600080fd5b601f82111561093857600081815260208120601f850160051c81016020861015613d585750805b601f850160051c820191505b818110156114da57828155600101613d64565b67ffffffffffffffff831115613d8f57613d8f613a01565b613da383613d9d8354613b71565b83613d31565b6000601f841160018114613dd75760008515613dbf5750838201355b600019600387901b1c1916600186901b178355613e31565b600083815260209020601f19861690835b82811015613e085786850135825560209485019460019092019101613de8565b5086821015613e255760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b6020808252602a908201527f4552433732315073693a2055524920717565727920666f72206e6f6e657869736040820152693a32b73a103a37b5b2b760b11b606082015260800190565b60008351613e94818460208801613729565b835190830190613ea8818360208801613729565b01949350505050565b60208082526035908201527f4552433732315073693a207472616e7366657220746f206e6f6e20455243373260408201527418a932b1b2b4bb32b91034b6b83632b6b2b73a32b960591b606082015260800190565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613f3e816017850160208801613729565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613f6f816028840160208801613729565b01602801949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613fae9083018461374d565b9695505050505050565b600060208284031215613fca57600080fd5b815161179c81613657565b600060208284031215613fe757600080fd5b815161179c816138f9565b60008161400157614001613ba5565b506000190190565b634e487b7160e01b600052603160045260246000fdfedf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec420001020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7506264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c9071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee30e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf7ff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c816365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f6fe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf5fd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f8a264697066735822122008aa2cbbe9dc8b7300b727bedea4b8abc5285eefc2f0550110ecf1b45ede859f64736f6c63430008130033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106103985760003560e01c806370a08231116101e9578063a41216ac1161010f578063d547741f116100ad578063f3b3059e1161007c578063f3b3059e1461082e578063f6aacfb114610841578063fe6d812414610854578063ff7682121461087b57600080fd5b8063d547741f146107ed578063e985e9c514610800578063eb05629714610813578063f2fde38b1461081b57600080fd5b8063aafb2d44116100e9578063aafb2d4414610794578063b31391cb146107a7578063b88d4fde146107c7578063c87b56dd146107da57600080fd5b8063a41216ac14610766578063a49340cc14610779578063aa1b103f1461078c57600080fd5b80638da5cb5b11610187578063a059b16411610156578063a059b16414610718578063a217fddf1461072b578063a22cb46514610733578063a35c23ad1461074657600080fd5b80638da5cb5b146106d957806391d14854146106ea57806395d89b41146106fd5780639fbc87131461070557600080fd5b806379884269116101c3578063798842691461067d5780637c3dc173146106a05780638462151c146106b3578063874a8b02146106c657600080fd5b806370a082311461064f578063715018a61461066257806372b44d711461066a57600080fd5b806323b872dd116102ce578063396e8f531161026c5780634b81d8bd1161023b5780634b81d8bd146106005780634f3db346146106205780634fdaf052146106295780636352211e1461063c57600080fd5b8063396e8f53146105b457806340c10f19146105c757806342842e0e146105da5780634a4fbeec146105ed57600080fd5b80632a55205a116102a85780632a55205a1461054f5780632f2ff15d1461058157806336568abe14610594578063374032a1146105a757600080fd5b806323b872dd14610504578063248a9ca3146105175780632a0acc6a1461053a57600080fd5b8063081812fc1161033b57806310c395bf1161031557806310c395bf1461048c57806313c52826146104ab57806318160ddd146104ce5780632398f843146104e457600080fd5b8063081812fc1461043b578063095ea7b3146104665780630f4345e21461047957600080fd5b806304634d8d1161037757806304634d8d146103f357806306dd04191461040657806306fdde0314610419578063072653891461042e57600080fd5b80623f332f1461039d57806301ffc9a7146103bb578063025e332e146103de575b600080fd5b6103a561088e565b6040516103b2919061360a565b60405180910390f35b6103ce6103c936600461366d565b61089d565b60405190151581526020016103b2565b6103f16103ec3660046136a1565b6108db565b005b6103f16104013660046136bc565b610916565b6103f16104143660046136ff565b61093d565b6104216109c3565b6040516103b29190613779565b600f546103ce9060ff1681565b61044e61044936600461378c565b610a55565b6040516001600160a01b0390911681526020016103b2565b6103f16104743660046136ff565b610ae0565b6103f161048736600461378c565b610af4565b60095461049e90610100900460ff1681565b6040516103b291906137bb565b61049e6104b93660046136a1565b600b6020526000908152604090205460ff1681565b6104d6610b12565b6040519081526020016103b2565b6104d66104f23660046136a1565b60116020526000908152604090205481565b6103f16105123660046137e3565b610b2e565b6104d661052536600461378c565b60009081526020819052604090206001015490565b6104d660008051602061402083398151915281565b61056261055d36600461381f565b610b5f565b604080516001600160a01b0390931683526020830191909152016103b2565b6103f161058f366004613841565b610c0d565b6103f16105a2366004613841565b610c32565b6009546103ce9060ff1681565b600c5461044e906001600160a01b031681565b6103f16105d53660046136ff565b610cac565b6103f16105e83660046137e3565b610ce0565b6103ce6105fb3660046136a1565b610cfb565b61061361060e36600461381f565b610db0565b6040516103b2919061386d565b6104d660125481565b6103f16106373660046138b4565b610f80565b61044e61064a36600461378c565b610fa1565b6104d661065d3660046136a1565b610fb5565b6103f1611083565b6103f16106783660046136a1565b611097565b61049e61068b36600461378c565b600a6020526000908152604090205460ff1681565b6103f16106ae36600461381f565b6110b8565b6106136106c13660046136a1565b611148565b6103f16106d43660046138cf565b61120f565b6013546001600160a01b031661044e565b6103ce6106f8366004613841565b611288565b6104216112b1565b60175461044e906001600160a01b031681565b6103f1610726366004613907565b6112c0565b6104d6600081565b6103f1610741366004613924565b6112ec565b6103f161075436600461378c565b33600090815260116020526040902055565b6103f1610774366004613907565b611383565b6103f1610787366004613995565b6113af565b6103f16114e2565b6103f16107a2366004613995565b611507565b6104d66107b536600461378c565b60106020526000908152604090205481565b6103f16107d5366004613a17565b6115df565b6104216107e836600461378c565b611617565b6103f16107fb366004613841565b611743565b6103ce61080e366004613af3565b611768565b6106136117a3565b6103f16108293660046136a1565b6117c4565b6103f161083c366004613b1d565b61183a565b6103ce61084f36600461378c565b6118f8565b6104d67ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc981565b6103f16108893660046136a1565b6119f5565b6060610898611a16565b905090565b60006108a882611a22565b806108b757506108b782611a57565b806108c657506108c682611a95565b806108d557506108d582611a95565b92915050565b6000805160206140208339815191526108f381611aba565b600c80546001600160a01b0319166001600160a01b0384161790555050565b5050565b60008051602061402083398151915261092e81611aba565b6109388383611ac4565b505050565b60008051602061402083398151915261095581611aba565b61095e82610fa1565b6001600160a01b0316836001600160a01b0316146109ba5760405162461bcd60e51b815260206004820152601460248201527330b2323932b9b99034b9903737ba1037bbb732b960611b60448201526064015b60405180910390fd5b61093882611bc1565b6060600280546109d290613b71565b80601f01602080910402602001604051908101604052809291908181526020018280546109fe90613b71565b8015610a4b5780601f10610a2057610100808354040283529160200191610a4b565b820191906000526020600020905b815481529060010190602001808311610a2e57829003601f168201915b5050505050905090565b6000610a6082611c2d565b610ac45760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a20617070726f76656420717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084016109b1565b506000908152600660205260409020546001600160a01b031690565b610aea8282611c63565b6109128282611c77565b600080516020614020833981519152610b0c81611aba565b50601255565b6000610b1c611d89565b610b24611deb565b6108989190613bbb565b610b383382611dfb565b610b545760405162461bcd60e51b81526004016109b190613bce565b610938838383611ec0565b60008281526015602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610bd45750604080518082019091526014546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090610bf3906001600160601b031687613c22565b610bfd9190613c39565b91519350909150505b9250929050565b600082815260208190526040902060010154610c2881611aba565b61093883836120bf565b6001600160a01b0381163314610ca25760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016109b1565b6109128282612143565b7ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc9610cd681611aba565b61093883836121a8565b610938838383604051806020016040528060008152506115df565b60095460009060ff16610d1057506000919050565b60026001600160a01b0383166000908152600b602052604090205460ff166002811115610d3f57610d3f6137a5565b1480610d9b57506001600160a01b0382166000908152600b602052604081205460ff166002811115610d7357610d736137a5565b148015610d9b57506002600954610100900460ff166002811115610d9957610d996137a5565b145b15610da857506001919050565b506000919050565b60606000610dbe8484613bbb565b610dc9906001613c5b565b67ffffffffffffffff811115610de157610de1613a01565b604051908082528060200260200182016040528015610e0a578160200160208202803683370190505b509050600080855b858111610eb257610e2281611c2d565b8015610e325750610e32816118f8565b15610e6d576001848481518110610e4b57610e4b613c6e565b9115156020928302919091019091015281610e6581613c84565b925050610e92565b6000848481518110610e8157610e81613c6e565b911515602092830291909101909101525b82610e9c81613c84565b9350508080610eaa90613c84565b915050610e12565b5060008167ffffffffffffffff811115610ece57610ece613a01565b604051908082528060200260200182016040528015610ef7578160200160208202803683370190505b5060009350905082875b878111610f7357858581518110610f1a57610f1a613c6e565b602002602001015115610f535780838381518110610f3a57610f3a613c6e565b602090810291909101015281610f4f81613c84565b9250505b84610f5d81613c84565b9550508080610f6b90613c84565b915050610f01565b5090979650505050505050565b600080516020614020833981519152610f9881611aba565b61091282612335565b600080610fad8361235e565b509392505050565b60006001600160a01b0382166110235760405162461bcd60e51b815260206004820152602d60248201527f4552433732315073693a2062616c616e636520717565727920666f722074686560448201526c207a65726f206164647265737360981b60648201526084016109b1565b6000805b60055481101561107c5761103a81611c2d565b1561106c5761104881610fa1565b6001600160a01b0316846001600160a01b03160361106c5761106982613c84565b91505b61107581613c84565b9050611027565b5092915050565b61108b6123f5565b611095600061244f565b565b6000805160206140208339815191526110af81611aba565b610912826124a1565b816110c281610fa1565b6001600160a01b0316336001600160a01b0316146111355760405162461bcd60e51b815260206004820152602a60248201527f5265737472696374417070726f76653a206f7065726174696f6e206973206f6e604482015269363c903437b63232b91760b11b60648201526084016109b1565b5060009182526010602052604090912055565b606060008061115684610fb5565b905060008167ffffffffffffffff81111561117357611173613a01565b60405190808252806020026020018201604052801561119c578160200160208202803683370190505b50905060005b828414611206576111b281611c2d565b156111fe57856001600160a01b03166111ca82610fa1565b6001600160a01b0316036111fe57808285806001019650815181106111f1576111f1613c6e565b6020026020010181815250505b6001016111a2565b50949350505050565b6001600160a01b038216331480611239575061123960008051602061402083398151915233611288565b61127e5760405162461bcd60e51b81526020600482015260166024820152753737ba103cb7bab939b2b6331037b91030b236b4b71760511b60448201526064016109b1565b61091282826124e6565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6060600380546109d290613b71565b6000805160206140208339815191526112d881611aba565b50600f805460ff1916911515919091179055565b6112f533610cfb565b15806112ff575080155b61134b5760405162461bcd60e51b815260206004820152601c60248201527f43616e206e6f7420617070726f7665206c6f636b656420746f6b656e0000000060448201526064016109b1565b6113548261256f565b8061135d575080155b6113795760405162461bcd60e51b81526004016109b190613c9d565b610912828261257b565b60008051602061402083398151915261139b81611aba565b506009805460ff1916911515919091179055565b6000805160206140208339815191526113c781611aba565b83821461140d5760405162461bcd60e51b81526020600482015260146024820152730c2e4e4c2f240d8cadccee8d040eadcdac2e8c6d60631b60448201526064016109b1565b60005b828110156114da57600084848381811061142c5761142c613c6e565b90506020020135116114805760405162461bcd60e51b815260206004820152601860248201527f616d6f756e74203020616464726573732065786973747321000000000000000060448201526064016109b1565b6114c886868381811061149557611495613c6e565b90506020020160208101906114aa91906136a1565b8585848181106114bc576114bc613c6e565b905060200201356125b3565b806114d281613c84565b915050611410565b505050505050565b6000805160206140208339815191526114fa81611aba565b6115046000601455565b50565b60008051602061402083398151915261151f81611aba565b8382146115655760405162461bcd60e51b81526020600482015260146024820152730c2e4e4c2f240d8cadccee8d040eadcdac2e8c6d60631b60448201526064016109b1565b60005b848110156114da5783838281811061158257611582613c6e565b90506020028101906115949190613cea565b601660008989868181106115aa576115aa613c6e565b90506020020135815260200190815260200160002091826115cc929190613d77565b50806115d781613c84565b915050611568565b6115e93383611dfb565b6116055760405162461bcd60e51b81526004016109b190613bce565b611611848484846125cd565b50505050565b606061162282611c2d565b61163e5760405162461bcd60e51b81526004016109b190613e38565b6000828152601660205260408120805461165790613b71565b80601f016020809104026020016040519081016040528092919081815260200182805461168390613b71565b80156116d05780601f106116a5576101008083540402835291602001916116d0565b820191906000526020600020905b8154815290600101906020018083116116b357829003601f168201915b5050505050905060006116ee60408051602081019091526000815290565b90508051600003611700575092915050565b81511561173257808260405160200161171a929190613e82565b60405160208183030381529060405292505050919050565b61173b84612602565b949350505050565b60008281526020819052604090206001015461175e81611aba565b6109388383612143565b600061177383610cfb565b8061178557506117838383612691565b155b15611792575060006108d5565b61179c83836126a9565b9392505050565b60606000806117b160055490565b90506117bd8282610db0565b9250505090565b6117cc6123f5565b6001600160a01b0381166118315760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016109b1565b6115048161244f565b60005b828110156118ec5761186684848381811061185a5761185a613c6e565b90506020020135610fa1565b6001600160a01b0316336001600160a01b03161480611898575061189860008051602061402083398151915233611288565b6118da5760405162461bcd60e51b81526020600482015260136024820152723737ba1037bbb732b91037b91030b236b4b71760691b60448201526064016109b1565b806118e481613c84565b91505061183d565b506109388383836126d0565b60008161190481611c2d565b6119665760405162461bcd60e51b815260206004820152602d60248201527f4c6f636b61626c653a206c6f636b696e6720717565727920666f72206e6f6e6560448201526c3c34b9ba32b73a103a37b5b2b760991b60648201526084016109b1565b60095460ff1661197957600091506119ef565b60026000848152600a602052604090205460ff16600281111561199e5761199e6137a5565b14806119dc57506000838152600a602052604081205460ff1660028111156119c8576119c86137a5565b1480156119dc57506119dc6105fb84610fa1565b156119ea57600191506119ef565b600091505b50919050565b600080516020614020833981519152611a0d81611aba565b610912826127b4565b6060610898600d6127f9565b60006001600160e01b03198216637965db0b60e01b14806108d557506301ffc9a760e01b6001600160e01b03198316146108d5565b6000611a6282612806565b80611a715750611a7182612846565b80611a805750611a808261286b565b806108d55750506001600160e01b0319161590565b60006001600160e01b0319821663152a902d60e11b14806108d557506108d582611a57565b6115048133612890565b6127106001600160601b0382161115611b325760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b60648201526084016109b1565b6001600160a01b038216611b885760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c69642072656365697665720000000000000060448201526064016109b1565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217601455565b6000611bcc82610fa1565b9050611bdc8160008460016128e9565b611be76008836128f5565b60405182906000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a4610912816000846001612921565b600881811c60009081526020919091526040812054600160ff1b60ff84161c1615611c5a57506000919050565b6108d582612939565b611c6d8282612955565b61091282826129ba565b6000611c8282610fa1565b9050806001600160a01b0316836001600160a01b031603611cf15760405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a20617070726f76616c20746f2063757272656e74206f6044820152633bb732b960e11b60648201526084016109b1565b336001600160a01b0382161480611d0d5750611d0d8133611768565b611d7f5760405162461bcd60e51b815260206004820152603b60248201527f4552433732315073693a20617070726f76652063616c6c6572206973206e6f7460448201527f206f776e6572206e6f7220617070726f76656420666f7220616c6c000000000060648201526084016109b1565b6109388383612a35565b60055460009081908190611da19060081c6001613c5b565b9050815b81811015611de557600081815260086020526040902054611dc581612aa3565b611dcf9086613c5b565b9450508080611ddd90613c84565b915050611da5565b50505090565b6000806005546108989190613bbb565b6000611e0682611c2d565b611e6a5760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a206f70657261746f7220717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084016109b1565b6000611e7583610fa1565b9050806001600160a01b0316846001600160a01b03161480611eb05750836001600160a01b0316611ea584610a55565b6001600160a01b0316145b8061173b575061173b8185611768565b600080611ecc8361235e565b91509150846001600160a01b0316826001600160a01b031614611f465760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a207472616e73666572206f6620746f6b656e2074686160448201526b3a1034b9903737ba1037bbb760a11b60648201526084016109b1565b6001600160a01b038416611fac5760405162461bcd60e51b815260206004820152602760248201527f4552433732315073693a207472616e7366657220746f20746865207a65726f206044820152666164647265737360c81b60648201526084016109b1565b611fb985858560016128e9565b611fc4600084612a35565b6000611fd1846001613c5b565b600881901c600090815260016020526040902054909150600160ff1b60ff83161c16158015612001575060055481105b1561203857600081815260046020526040902080546001600160a01b0319166001600160a01b0388161790556120386001826128f5565b600084815260046020526040902080546001600160a01b0319166001600160a01b038716179055818414612071576120716001856128f5565b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a46114da8686866001612921565b6120c98282611288565b610912576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556120ff3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61214d8282611288565b15610912576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60006121b360055490565b9050600082116122135760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a207175616e74697479206d7573742062652067726561604482015264074657220360dc1b60648201526084016109b1565b6001600160a01b0383166122755760405162461bcd60e51b815260206004820152602360248201527f4552433732315073693a206d696e7420746f20746865207a65726f206164647260448201526265737360e81b60648201526084016109b1565b61228260008483856128e9565b81600560008282546122949190613c5b565b9091555050600081815260046020526040902080546001600160a01b0319166001600160a01b0385161790556122cb6001826128f5565b6122d86000848385612921565b805b6122e48383613c5b565b8110156116115760405181906001600160a01b038616906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a48061232d81613c84565b9150506122da565b6009805482919061ff001916610100836002811115612356576123566137a5565b021790555050565b60008061236a83611c2d565b6123cb5760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a206f776e657220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016109b1565b6123d483612ac2565b6000818152600460205260409020546001600160a01b031694909350915050565b6013546001600160a01b031633146110955760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016109b1565b601380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6124ac600d82612acf565b506040516001600160a01b0382169033907f3b01c97343869ca2757fcc37cdb8f71683b0a7aed858e3755f4529a1db85729290600090a350565b6001600160a01b0382166000908152600b60205260409020805482919060ff1916600183600281111561251b5761251b6137a5565b0217905550336001600160a01b0316826001600160a01b03167f9fdb14457e6a7bd3753c649831b026de987c06e52d16459a928540738c2ea34b8360405161256391906137bb565b60405180910390a35050565b60006108d53383612691565b6125848261256f565b8061258d575080155b6125a95760405162461bcd60e51b81526004016109b190613c9d565b6109128282612ae4565b610912828260405180602001604052806000815250612b4d565b6125d8848484611ec0565b6125e6848484600185612b6e565b6116115760405162461bcd60e51b81526004016109b190613eb1565b606061260d82611c2d565b6126295760405162461bcd60e51b81526004016109b190613e38565b600061264060408051602081019091526000815290565b90506000815111612660576040518060200160405280600081525061179c565b8061266a84612ca5565b60405160200161267b929190613e82565b6040516020818303038152906040529392505050565b60008061269d84612d38565b905061173b8382612d7a565b60006126b58383612691565b15156000036126c6575060006108d5565b61179c8383612e13565b60005b828110156116115781600a60008686858181106126f2576126f2613c6e565b60209081029290920135835250810191909152604001600020805460ff19166001836002811115612725576127256137a5565b021790555083838281811061273c5761273c613c6e565b90506020020135336001600160a01b031661276286868581811061185a5761185a613c6e565b6001600160a01b03167f80a668baf7ac68b329075f26c37b4428d4aa272c3bd4c9611b25f5fb1c473f7c8560405161279a91906137bb565b60405180910390a4806127ac81613c84565b9150506126d3565b6127bf600d82612e59565b506040516001600160a01b0382169033907fbd0af1fe0a2c1c7bb340c17a284a291138979c8eeb797e176dbd1c415199af3c90600090a350565b6060600061179c83612e6e565b60006001600160e01b031982166380ac58cd60e01b148061283757506001600160e01b03198216635b5e139f60e01b145b806108d557506108d582611a22565b60006001600160e01b03198216632742b5b960e01b14806108d557506108d582612806565b60006001600160e01b03198216630101c11560e71b14806108d557506108d582612846565b61289a8282611288565b610912576128a781612eca565b6128b2836020612edc565b6040516020016128c3929190613f06565b60408051601f198184030181529082905262461bcd60e51b82526109b191600401613779565b61161184848484613078565b600881901c600090815260209290925260409091208054600160ff1b60ff9093169290921c9091179055565b61292d84848484613103565b6116118484848461312d565b600061294460055490565b821080156108d55750600192915050565b61295e816118f8565b156109125760405162461bcd60e51b815260206004820152602660248201527f4c6f636b61626c653a2043616e206e6f7420617070726f7665206c6f636b6564604482015265103a37b5b2b760d11b60648201526084016109b1565b6001600160a01b03821615610912576129d38183613150565b6109125760405162461bcd60e51b815260206004820152602d60248201527f5265737472696374417070726f76653a2054686520636f6e747261637420697360448201526c103737ba1030b63637bbb2b21760991b60648201526084016109b1565b600081815260066020526040902080546001600160a01b0319166001600160a01b0384169081179091558190612a6a82610fa1565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60005b8115612abd57600019820190911690600101612aa6565b919050565b60006108d560018361315d565b600061179c836001600160a01b038416613255565b612aed33610cfb565b1580612af7575080155b612b435760405162461bcd60e51b815260206004820152601c60248201527f43616e206e6f7420617070726f7665206c6f636b656420746f6b656e0000000060448201526064016109b1565b6109128282613348565b6000612b5860055490565b9050612b6484846121a8565b6125e66000858386865b60006001600160a01b0385163b15612c9857506001835b612b8f8486613c5b565b811015612c9257604051630a85bd0160e11b81526001600160a01b0387169063150b7a0290612bc89033908b9086908990600401613f7b565b6020604051808303816000875af1925050508015612c03575060408051601f3d908101601f19168201909252612c0091810190613fb8565b60015b612c60573d808015612c31576040519150601f19603f3d011682016040523d82523d6000602084013e612c36565b606091505b508051600003612c585760405162461bcd60e51b81526004016109b190613eb1565b805181602001fd5b828015612c7d57506001600160e01b03198116630a85bd0160e11b145b92505080612c8a81613c84565b915050612b85565b50612c9c565b5060015b95945050505050565b60606000612cb283613405565b600101905060008167ffffffffffffffff811115612cd257612cd2613a01565b6040519080825280601f01601f191660200182016040528015612cfc576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084612d0657509392505050565b6001600160a01b03811660009081526011602052604081205415612d7257506001600160a01b031660009081526011602052604090205490565b505060125490565b600f5460009060ff16612d8f575060016108d5565b612d98836134dd565b8061179c5750600c54604051630f8350ed60e41b81526001600160a01b038581166004830152602482018590529091169063f8350ed090604401602060405180830381865afa158015612def573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061179c9190613fd5565b6000612e1e83610cfb565b15612e2b575060006108d5565b6001600160a01b0380841660009081526007602090815260408083209386168352929052205460ff1661179c565b600061179c836001600160a01b038416613507565b606081600001805480602002602001604051908101604052809291908181526020018280548015612ebe57602002820191906000526020600020905b815481526020019060010190808311612eaa575b50505050509050919050565b60606108d56001600160a01b03831660145b60606000612eeb836002613c22565b612ef6906002613c5b565b67ffffffffffffffff811115612f0e57612f0e613a01565b6040519080825280601f01601f191660200182016040528015612f38576020820181803683370190505b509050600360fc1b81600081518110612f5357612f53613c6e565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110612f8257612f82613c6e565b60200101906001600160f81b031916908160001a9053506000612fa6846002613c22565b612fb1906001613c5b565b90505b6001811115613029576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110612fe557612fe5613c6e565b1a60f81b828281518110612ffb57612ffb613c6e565b60200101906001600160f81b031916908160001a90535060049490941c9361302281613ff2565b9050612fb4565b50831561179c5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016109b1565b6001600160a01b0384161580159061309857506001600160a01b03831615155b15611611576130a6826118f8565b156116115760405162461bcd60e51b815260206004820152602760248201527f4c6f636b61626c653a2043616e206e6f74207472616e73666572206c6f636b6560448201526632103a37b5b2b760c91b60648201526084016109b1565b6001600160a01b03841615611611576000828152600a60205260409020805460ff19169055611611565b6001600160a01b0384161561161157600082815260106020526040812055611611565b60008061269d3385613556565b600881901c60008181526020849052604081205490919060ff808516919082181c801561319f5761318d81613588565b60ff168203600884901b17935061324c565b6000831161320c5760405162461bcd60e51b815260206004820152603460248201527f4269744d6170733a205468652073657420626974206265666f7265207468652060448201527334b73232bc103237b2b9b713ba1032bc34b9ba1760611b60648201526084016109b1565b5060001990910160008181526020869052604090205490919080156132475761323481613588565b60ff0360ff16600884901b17935061324c565b61319f565b50505092915050565b6000818152600183016020526040812054801561333e576000613279600183613bbb565b855490915060009061328d90600190613bbb565b90508181146132f25760008660000182815481106132ad576132ad613c6e565b90600052602060002001549050808760000184815481106132d0576132d0613c6e565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061330357613303614009565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506108d5565b60009150506108d5565b336001600160a01b038316036133a05760405162461bcd60e51b815260206004820152601c60248201527f4552433732315073693a20617070726f766520746f2063616c6c65720000000060448201526064016109b1565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319101612563565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106134445772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310613470576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061348e57662386f26fc10000830492506010015b6305f5e10083106134a6576305f5e100830492506008015b61271083106134ba57612710830492506004015b606483106134cc576064830492506002015b600a83106108d55760010192915050565b60006108d5600d836001600160a01b0381166000908152600183016020526040812054151561179c565b600081815260018301602052604081205461354e575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556108d5565b5060006108d5565b6000818152601060205260408120541561357f57506000818152601060205260409020546108d5565b61179c83612d38565b60006040518061012001604052806101008152602001614040610100913960f87e818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff6135d1856135f2565b02901c815181106135e4576135e4613c6e565b016020015160f81c92915050565b600080821161360057600080fd5b5060008190031690565b6020808252825182820181905260009190848201906040850190845b8181101561364b5783516001600160a01b031683529284019291840191600101613626565b50909695505050505050565b6001600160e01b03198116811461150457600080fd5b60006020828403121561367f57600080fd5b813561179c81613657565b80356001600160a01b0381168114612abd57600080fd5b6000602082840312156136b357600080fd5b61179c8261368a565b600080604083850312156136cf57600080fd5b6136d88361368a565b915060208301356001600160601b03811681146136f457600080fd5b809150509250929050565b6000806040838503121561371257600080fd5b61371b8361368a565b946020939093013593505050565b60005b8381101561374457818101518382015260200161372c565b50506000910152565b60008151808452613765816020860160208601613729565b601f01601f19169290920160200192915050565b60208152600061179c602083018461374d565b60006020828403121561379e57600080fd5b5035919050565b634e487b7160e01b600052602160045260246000fd5b60208101600383106137dd57634e487b7160e01b600052602160045260246000fd5b91905290565b6000806000606084860312156137f857600080fd5b6138018461368a565b925061380f6020850161368a565b9150604084013590509250925092565b6000806040838503121561383257600080fd5b50508035926020909101359150565b6000806040838503121561385457600080fd5b823591506138646020840161368a565b90509250929050565b6020808252825182820181905260009190848201906040850190845b8181101561364b57835183529284019291840191600101613889565b803560038110612abd57600080fd5b6000602082840312156138c657600080fd5b61179c826138a5565b600080604083850312156138e257600080fd5b6138eb8361368a565b9150613864602084016138a5565b801515811461150457600080fd5b60006020828403121561391957600080fd5b813561179c816138f9565b6000806040838503121561393757600080fd5b6139408361368a565b915060208301356136f4816138f9565b60008083601f84011261396257600080fd5b50813567ffffffffffffffff81111561397a57600080fd5b6020830191508360208260051b8501011115610c0657600080fd5b600080600080604085870312156139ab57600080fd5b843567ffffffffffffffff808211156139c357600080fd5b6139cf88838901613950565b909650945060208701359150808211156139e857600080fd5b506139f587828801613950565b95989497509550505050565b634e487b7160e01b600052604160045260246000fd5b60008060008060808587031215613a2d57600080fd5b613a368561368a565b9350613a446020860161368a565b925060408501359150606085013567ffffffffffffffff80821115613a6857600080fd5b818701915087601f830112613a7c57600080fd5b813581811115613a8e57613a8e613a01565b604051601f8201601f19908116603f01168101908382118183101715613ab657613ab6613a01565b816040528281528a6020848701011115613acf57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b60008060408385031215613b0657600080fd5b613b0f8361368a565b91506138646020840161368a565b600080600060408486031215613b3257600080fd5b833567ffffffffffffffff811115613b4957600080fd5b613b5586828701613950565b9094509250613b689050602085016138a5565b90509250925092565b600181811c90821680613b8557607f821691505b6020821081036119ef57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b818103818111156108d5576108d5613ba5565b60208082526034908201527f4552433732315073693a207472616e736665722063616c6c6572206973206e6f6040820152731d081bdddb995c881b9bdc88185c1c1c9bdd995960621b606082015260800190565b80820281158282048414176108d5576108d5613ba5565b600082613c5657634e487b7160e01b600052601260045260246000fd5b500490565b808201808211156108d5576108d5613ba5565b634e487b7160e01b600052603260045260246000fd5b600060018201613c9657613c96613ba5565b5060010190565b6020808252602d908201527f5265737472696374417070726f76653a2043616e206e6f7420617070726f766560408201526c103637b1b5b2b2103a37b5b2b760991b606082015260800190565b6000808335601e19843603018112613d0157600080fd5b83018035915067ffffffffffffffff821115613d1c57600080fd5b602001915036819003821315610c0657600080fd5b601f82111561093857600081815260208120601f850160051c81016020861015613d585750805b601f850160051c820191505b818110156114da57828155600101613d64565b67ffffffffffffffff831115613d8f57613d8f613a01565b613da383613d9d8354613b71565b83613d31565b6000601f841160018114613dd75760008515613dbf5750838201355b600019600387901b1c1916600186901b178355613e31565b600083815260209020601f19861690835b82811015613e085786850135825560209485019460019092019101613de8565b5086821015613e255760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b6020808252602a908201527f4552433732315073693a2055524920717565727920666f72206e6f6e657869736040820152693a32b73a103a37b5b2b760b11b606082015260800190565b60008351613e94818460208801613729565b835190830190613ea8818360208801613729565b01949350505050565b60208082526035908201527f4552433732315073693a207472616e7366657220746f206e6f6e20455243373260408201527418a932b1b2b4bb32b91034b6b83632b6b2b73a32b960591b606082015260800190565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613f3e816017850160208801613729565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613f6f816028840160208801613729565b01602801949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613fae9083018461374d565b9695505050505050565b600060208284031215613fca57600080fd5b815161179c81613657565b600060208284031215613fe757600080fd5b815161179c816138f9565b60008161400157614001613ba5565b506000190190565b634e487b7160e01b600052603160045260246000fdfedf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec420001020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7506264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c9071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee30e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf7ff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c816365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f6fe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf5fd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f8a264697066735822122008aa2cbbe9dc8b7300b727bedea4b8abc5285eefc2f0550110ecf1b45ede859f64736f6c63430008130033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 27 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.