Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 25 from a total of 272 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Set Approval For... | 24154123 | 54 days ago | IN | 0 ETH | 0.00018826 | ||||
| Set Approval For... | 23558683 | 137 days ago | IN | 0 ETH | 0.00001547 | ||||
| Safe Transfer Fr... | 23402777 | 159 days ago | IN | 0 ETH | 0.00017177 | ||||
| Set Approval For... | 23325540 | 170 days ago | IN | 0 ETH | 0.00012351 | ||||
| Safe Transfer Fr... | 22855518 | 236 days ago | IN | 0 ETH | 0.00018497 | ||||
| Safe Transfer Fr... | 22855516 | 236 days ago | IN | 0 ETH | 0.00024446 | ||||
| Safe Transfer Fr... | 22855514 | 236 days ago | IN | 0 ETH | 0.00028349 | ||||
| Set Approval For... | 22810197 | 242 days ago | IN | 0 ETH | 0.00020987 | ||||
| Set Approval For... | 22430701 | 295 days ago | IN | 0 ETH | 0.00003771 | ||||
| Set Approval For... | 22316982 | 311 days ago | IN | 0 ETH | 0.00009031 | ||||
| Set Approval For... | 22301737 | 313 days ago | IN | 0 ETH | 0.0000302 | ||||
| Set Approval For... | 22114465 | 339 days ago | IN | 0 ETH | 0.00005608 | ||||
| Set Approval For... | 22096462 | 342 days ago | IN | 0 ETH | 0.00009547 | ||||
| Set Approval For... | 21859192 | 375 days ago | IN | 0 ETH | 0.00010783 | ||||
| Set Approval For... | 21748637 | 390 days ago | IN | 0 ETH | 0.00015433 | ||||
| Set Approval For... | 21748308 | 390 days ago | IN | 0 ETH | 0.00017558 | ||||
| Set Approval For... | 21550219 | 418 days ago | IN | 0 ETH | 0.00060093 | ||||
| Set Approval For... | 20202662 | 606 days ago | IN | 0 ETH | 0.00017726 | ||||
| Set Approval For... | 20180827 | 609 days ago | IN | 0 ETH | 0.00053032 | ||||
| Set Approval For... | 19466839 | 709 days ago | IN | 0 ETH | 0.00203315 | ||||
| Set Approval For... | 19461382 | 710 days ago | IN | 0 ETH | 0.00187609 | ||||
| Set Approval For... | 19455418 | 711 days ago | IN | 0 ETH | 0.00077972 | ||||
| Set Approval For... | 19455397 | 711 days ago | IN | 0 ETH | 0.00079996 | ||||
| Set Approval For... | 19455296 | 711 days ago | IN | 0 ETH | 0.00060645 | ||||
| Safe Transfer Fr... | 19108927 | 759 days ago | IN | 0 ETH | 0.00080665 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
PixelHeroesVillains
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 20 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import "./libs/IMetadataRouter.sol";
import "./libs/ERC721BasicFrame.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "./libs/BitOperator.sol";
contract PixelHeroesVillains is ERC721BasicFrame {
using Strings for uint256;
using BitOperator for uint256;
/*
* @dev Token aux for routing parameter : bit layout
* 0..7 update index like burnin without changing token id
*/
uint256 private constant BITPOS_AUX_UPDATE_INDEX = 0;
/*
* @dev Routing parameter bit layout
* 0 bool of lock status
* 1..8 update index like burnin without changing token id
*/
uint256 private constant BITPOS_LOCK_STATUS = 0;
uint256 private constant BITPOS_UPDATE_INDEX = BITPOS_LOCK_STATUS + 1;
uint8 public currentUpdateIndex;
event UpdateToken(uint256 indexed tokenId, uint8 indexed updateIndex);
event IncreaseUpdateIndex(uint8 indexed updateIndex);
error InvalidUpdateIndex();
error ZeroUpdateIndex();
error RouterNotSet();
IMetadataRouter public router;
///////////////////////////////////////////////////////////////////////////
// Constructor
///////////////////////////////////////////////////////////////////////////
constructor() ERC721BasicFrame("Pixel Heroes Villains", "PHV", 10000) {
royaltyAddress = 0x56b75E59Ced86AB9C9eA4A0cAB89Db334620fA15;
// Grants minter and burner role for owner address
_grantRole(MINTER_ROLE, msg.sender);
_grantRole(BURNER_ROLE, msg.sender);
// mint 1. please burn by yourself for token number starts from 1
_mint(msg.sender, 1);
}
///////////////////////////////////////////////////////////////////////////
// Setter functions : Metadata Router
///////////////////////////////////////////////////////////////////////////
function setRouter(IMetadataRouter _new) external onlyAdmin {
router = _new;
}
/**
* @dev Allow administrators to change the lock status so that locked tokens are not listed in the marketplace.
*/
function setTokenLockByAdmin(uint256[] calldata tokenIds, LockStatus lockStatus)
external
onlyAdmin
{
// _setTokenLock call _exists(tokenId) in ownerOf() function.
// So this function calls internal function without checking token existance
_setTokenLock(tokenIds, lockStatus);
}
///////////////////////////////////////////////////////////////////////////
// Update Index functions
///////////////////////////////////////////////////////////////////////////
function getTokenUpdateIndex(uint256 tokenId) external view virtual returns(uint8){
if (!_exists(tokenId)) revert TokenNonexistent(tokenId);
return _getTokenUpdateIndex(tokenId);
}
function _getTokenUpdateIndex(uint256 tokenId) internal view virtual returns(uint8){
return _getTokenAux(tokenId).getBitValueUint8(BITPOS_AUX_UPDATE_INDEX);
}
function updateToken(uint256 tokenId)
external
virtual
onlyRole(UPDATER_ROLE)
{
// Grab from strage
uint8 index = currentUpdateIndex;
uint256 aux = _getTokenAux(tokenId);
if (!_exists(tokenId)) revert TokenNonexistent(tokenId);
if (index == 0) revert ZeroUpdateIndex();
if (aux.getBitValueUint8(BITPOS_AUX_UPDATE_INDEX) >= index) revert InvalidUpdateIndex();
emit UpdateToken(tokenId, index);
_setTokenAux(tokenId, aux.setBitValueUint8(BITPOS_AUX_UPDATE_INDEX, index));
}
function increaseCurrentUpdateIndex()
external
virtual
onlyRole(UPDATER_ROLE)
returns(uint8)
{
uint8 newIndex = currentUpdateIndex++;
emit IncreaseUpdateIndex(newIndex);
return newIndex;
}
///////////////////////////////////////////////////////////////////////////
// Metadata functions
///////////////////////////////////////////////////////////////////////////
function tokenURI(uint256 tokenId)
public
view
override
returns (string memory)
{
if (address(router) == address(0)) revert RouterNotSet();
if (!_exists(tokenId)) revert TokenNonexistent(tokenId);
uint256 param = isLocked(tokenId) ? 1 : 0;
param = param.setBitValueUint8(BITPOS_UPDATE_INDEX, _getTokenUpdateIndex(tokenId));
return router.getURI(tokenId, ownerOf(tokenId), param);
}
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual override {
// reset SubIdForToken when tansfers
if (from != address(0) && address(router) != address(0)) {
router.resetTokenPriority(startTokenId);
}
super._afterTokenTransfers(from, to, startTokenId, quantity);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it.
*/
abstract contract AccessControl is Context, IAccessControl, ERC165 {
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
mapping(bytes32 => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with a standardized message including the required role.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*
* _Available since v4.1._
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
return _roles[role].members[account];
}
/**
* @dev Revert with a standard message if `_msgSender()` is missing `role`.
* Overriding this function changes the behavior of the {onlyRole} modifier.
*
* Format of the revert message is described in {_checkRole}.
*
* _Available since v4.6._
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Revert with a standard message if `account` is missing `role`.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
Strings.toHexString(account),
" is missing role ",
Strings.toHexString(uint256(role), 32)
)
)
);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address account) public virtual override {
require(account == _msgSender(), "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event. Note that unlike {grantRole}, this function doesn't perform any
* checks on the calling account.
*
* May emit a {RoleGranted} event.
*
* [WARNING]
* ====
* This function should only be called from the constructor when setting
* up the initial roles for the system.
*
* Using this function in any other way is effectively circumventing the admin
* system imposed by {AccessControl}.
* ====
*
* NOTE: This function is deprecated in favor of {_grantRole}.
*/
function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Grants `role` to `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
/**
* @dev Revokes `role` from `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol)
pragma solidity ^0.8.0;
import "../utils/introspection/IERC165.sol";
/**
* @dev Interface for the NFT Royalty Standard.
*
* A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
* support for royalty payments across all NFT marketplaces and ecosystem participants.
*
* _Available since v4.5._
*/
interface IERC2981 is IERC165 {
/**
* @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
* exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
*/
function royaltyInfo(uint256 tokenId, uint256 salePrice)
external
view
returns (address receiver, uint256 royaltyAmount);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts 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.8.0) (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
* or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
* understand this adds an external call which potentially creates a reentrancy vulnerability.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.0;
/**
* @dev These functions deal with verification of Merkle Tree proofs.
*
* The tree and the proofs can be generated using our
* https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
* You will find a quickstart guide in the readme.
*
* WARNING: You should avoid using leaf values that are 64 bytes long prior to
* hashing, or use a hash function other than keccak256 for hashing leaves.
* This is because the concatenation of a sorted pair of internal nodes in
* the merkle tree could be reinterpreted as a leaf value.
* OpenZeppelin's JavaScript library generates merkle trees that are safe
* against this attack out of the box.
*/
library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(
bytes32[] memory proof,
bytes32 root,
bytes32 leaf
) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
/**
* @dev Calldata version of {verify}
*
* _Available since v4.7._
*/
function verifyCalldata(
bytes32[] calldata proof,
bytes32 root,
bytes32 leaf
) internal pure returns (bool) {
return processProofCalldata(proof, leaf) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leafs & pre-images are assumed to be sorted.
*
* _Available since v4.4._
*/
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Calldata version of {processProof}
*
* _Available since v4.7._
*/
function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by
* `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
*
* CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
*
* _Available since v4.7._
*/
function multiProofVerify(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProof(proof, proofFlags, leaves) == root;
}
/**
* @dev Calldata version of {multiProofVerify}
*
* CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
*
* _Available since v4.7._
*/
function multiProofVerifyCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProofCalldata(proof, proofFlags, leaves) == root;
}
/**
* @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
* proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
* leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
* respectively.
*
* CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
* is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
* tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
*
* _Available since v4.7._
*/
function processMultiProof(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the merkle tree.
uint256 leavesLen = leaves.length;
uint256 totalHashes = proofFlags.length;
// Check proof validity.
require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](totalHashes);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value for the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < totalHashes; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];
hashes[i] = _hashPair(a, b);
}
if (totalHashes > 0) {
return hashes[totalHashes - 1];
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
/**
* @dev Calldata version of {processMultiProof}.
*
* CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
*
* _Available since v4.7._
*/
function processMultiProofCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the merkle tree.
uint256 leavesLen = leaves.length;
uint256 totalHashes = proofFlags.length;
// Check proof validity.
require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](totalHashes);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value for the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < totalHashes; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];
hashes[i] = _hashPair(a, b);
}
if (totalHashes > 0) {
return hashes[totalHashes - 1];
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
}
function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator
) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1);
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator,
Rounding rounding
) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10**64) {
value /= 10**64;
result += 64;
}
if (value >= 10**32) {
value /= 10**32;
result += 32;
}
if (value >= 10**16) {
value /= 10**16;
result += 16;
}
if (value >= 10**8) {
value /= 10**8;
result += 8;
}
if (value >= 10**4) {
value /= 10**4;
result += 4;
}
if (value >= 10**2) {
value /= 10**2;
result += 2;
}
if (value >= 10**1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)
pragma solidity ^0.8.0;
/**
* @dev Library for reading and writing primitive types to specific storage slots.
*
* Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
* This library helps with reading and writing to such slots without the need for inline assembly.
*
* The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
*
* Example usage to set ERC1967 implementation slot:
* ```
* contract ERC1967 {
* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
*
* function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
*
* function _setImplementation(address newImplementation) internal {
* require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*
* _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._
*/
library StorageSlot {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 value;
}
/**
* @dev Returns an `AddressSlot` with member `value` located at `slot`.
*/
function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/Math.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
}// SPDX-License-Identifier: MIT
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.7.0 <0.9.0;
interface IContractAllowListProxy {
function isAllowed(address _transferer, uint256 _level)
external
view
returns (bool);
}//// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
library BitOperator{
string private constant ERROR_OVERFLOW = "position should overflow";
function getBitValueUint8(uint256 value, uint256 pos) internal pure returns(uint8){
if (pos > 248) revert(ERROR_OVERFLOW);
return uint8(value >> pos);
}
function getBitValueBool(uint256 value, uint256 pos) internal pure returns(bool){
if (pos > 255) revert(ERROR_OVERFLOW);
return ((value >> pos) & 0x01 == 1);
}
function setBitValueUint8(uint256 value, uint256 pos, uint8 set) internal pure returns(uint256){
if (pos > 248) revert(ERROR_OVERFLOW);
return (value & ~(0xFF << pos)) | (uint256(set) << pos);
}
function setBitValueBool(uint256 value, uint256 pos, bool set) internal pure returns(uint256){
if (pos > 255) revert(ERROR_OVERFLOW);
return (value & ~(0x01 << pos)) | ((set ? uint256(1) : uint256(0)) << pos);
}
}//// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
//import "contract-allow-list/contracts/ERC721AntiScam/ERC721AntiScam.sol";
import "./ERC721AntiScamSubset.sol";
abstract contract ERC721AntiScamSalesInfo is ERC721AntiScamSubset{
/* ==================================================================
* This section is derived from ERC721PsiAddressData
* Splits the aux to record sales information on the "allow list"
* ==================================================================*/
// Mapping owner address to address data
mapping(address => AddressData) _addressData;
// Compiler will pack this into a single 256bit word.
struct AddressData {
// Realistically, 2**64-1 is more than enough.
uint64 balance;
// Keeps track of mint count with minimal overhead for tokenomics.
uint64 numberMinted;
// Keeps track of burn count with minimal overhead for tokenomics.
uint64 numberBurned;
// For miscellaneous variable(s) pertaining to the address
// (e.g. number of whitelist mint slots used).
// If there are multiple variables, please pack them into a uint64.
//uint64 aux;
// Keeps track of recent sale index
uint8 saleIndex;
// Keeps track of the consumed amount of allocations in the recent sale
uint16 numberConsumedInRecentSale;
// New aux
uint40 aux;
}
/**
* @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");
return uint256(_addressData[owner].balance);
}
/**
* @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 override virtual {
require(quantity < 2 ** 64);
uint64 _quantity = uint64(quantity);
if(from != address(0)){
_addressData[from].balance -= _quantity;
} else {
// Mint
_addressData[to].numberMinted += _quantity;
}
if(to != address(0)){
_addressData[to].balance += _quantity;
} else {
// Burn
_addressData[from].numberBurned += _quantity;
}
super._afterTokenTransfers(from, to, startTokenId, quantity);
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
//import "./IERC721AntiScam.sol";
import "contract-allow-list/contracts/ERC721AntiScam/lockable/ERC721Lockable.sol";
import "./ERC721RestrictApproveGlobalOnly.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/// @title ERC721PsiBurnable with Anti Scam functions(Subset version)
/// @dev See readme.
abstract contract ERC721AntiScamSubset is
ERC721Lockable,
ERC721RestrictApproveGlobalOnly,
Ownable
{
/*///////////////////////////////////////////////////////////////
OVERRIDES
//////////////////////////////////////////////////////////////*/
function isApprovedForAll(address owner, address operator)
public
view
virtual
override(ERC721Lockable, ERC721RestrictApproveGlobalOnly)
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, ERC721RestrictApproveGlobalOnly)
{
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, ERC721RestrictApproveGlobalOnly)
{
ERC721Lockable._beforeApprove(to, tokenId);
ERC721RestrictApproveGlobalOnly._beforeApprove(to, tokenId);
}
function approve(address to, uint256 tokenId)
public
virtual
override(ERC721Lockable, ERC721RestrictApproveGlobalOnly)
{
_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, ERC721RestrictApproveGlobalOnly) {
ERC721Lockable._afterTokenTransfers(from, to, startTokenId, quantity);
ERC721RestrictApproveGlobalOnly._afterTokenTransfers(from, to, startTokenId, quantity);
}
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC721Lockable, ERC721RestrictApproveGlobalOnly)
returns (bool)
{
return
ERC721Psi.supportsInterface(interfaceId) ||
ERC721Lockable.supportsInterface(interfaceId) ||
ERC721RestrictApproveGlobalOnly.supportsInterface(interfaceId) /*||
interfaceId == type(IERC721AntiScam).interfaceId*/;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "operator-filter-registry/src/DefaultOperatorFilterer.sol";
import "contract-allow-list/contracts/proxy/interface/IContractAllowListProxy.sol";
import "./ERC721AntiScamSalesInfo.sol";
import "./ISalesItem.sol";
import "@openzeppelin/contracts/interfaces/IERC2981.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
abstract contract ERC721BasicFrameControlable is
IERC2981,
ISalesItem,
DefaultOperatorFilterer,
AccessControl,
Ownable,
ERC721AntiScamSalesInfo
{
///////////////////////////////////////////////////////////////////////////
// Constants
///////////////////////////////////////////////////////////////////////////
uint256 public immutable MAX_SUPPLY;
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");
bytes32 public constant SELLER_ROLE = keccak256("SELLER_ROLE");
bytes32 public constant UPDATER_ROLE = keccak256("UPDATER_ROLE");
constructor(uint256 maxSupply){
MAX_SUPPLY = maxSupply;
}
///////////////////////////////////////////////////////////////////////////
// Variables
///////////////////////////////////////////////////////////////////////////
// Mapping from tokenId to uint256 aux
mapping(uint256 => uint256) private _tokenAux;
// royalty
address public royaltyAddress;
uint96 public royaltyFee = 1000; // default:10%
// SBT
bool public isSBT;
/*
// tokenId -> unlock time
mapping(uint256 => uint256) unlockTokenTimestamp;
// wallet -> unlock time
mapping(address => uint256) unlockWalletTimestamp;
uint256 public unlockLeadTime = 3 hours;
*/
///////////////////////////////////////////////////////////////////////////
// Error Functions
///////////////////////////////////////////////////////////////////////////
error ZeroAddress();
error InvlidRoyaltyFee(uint256 fee);
error MaxSupplyExceeded();
error ProhibitedBecauseSBT();
error NotAllowedByCAL(address operator);
error ArrayLengthIsZero();
error NotTokenHolder();
error WalletLockNotAllowedByOthers();
error InvalidRole();
error TokenNonexistent(uint256 tokenId);
///////////////////////////////////////////////////////////////////////////
// External Mint / Burn function
///////////////////////////////////////////////////////////////////////////
function externalMint(address to, uint256 quantity) external onlyRole(MINTER_ROLE) {
_mint(to, quantity);
}
function sellerMint(address to, uint256 quantity) external onlyRole(SELLER_ROLE) {
_mint(to, quantity);
}
function externalBurn(uint256 tokenId) external onlyRole(BURNER_ROLE) {
_burn(tokenId);
}
function sellerBurn(uint256 tokenId) external onlyRole(SELLER_ROLE) {
_burn(tokenId);
}
///////////////////////////////////////////////////////////////////////////
// Override function : _mint
///////////////////////////////////////////////////////////////////////////
function _mint(address to, uint256 quantity) internal override {
if (quantity + totalSupply() > MAX_SUPPLY) revert MaxSupplyExceeded();
super._mint(to, quantity);
}
///////////////////////////////////////////////////////////////////////////
// Number burned function
///////////////////////////////////////////////////////////////////////////
function burned() external view returns(uint256){
return _burned();
}
///////////////////////////////////////////////////////////////////////////
// Setter functions : Aux region of _addressData
///////////////////////////////////////////////////////////////////////////
function setConsumedAllocation(address _target, uint8 _currentSaleIndex, uint16 _consumed)
external
virtual
onlyRole(SELLER_ROLE)
{
// Grab memory
AddressData memory data = _addressData[_target];
data.saleIndex = _currentSaleIndex;
data.numberConsumedInRecentSale = _consumed;
_addressData[_target] = data;
}
function addConsumedAllocation(address _target, uint8 _currentSaleIndex, uint16 _consumed)
external
virtual
onlyRole(SELLER_ROLE)
{
// Grab memory
AddressData memory data = _addressData[_target];
// If previous sale was recorded in the data, updates it with the current sale
if (data.saleIndex != _currentSaleIndex){
data.saleIndex = _currentSaleIndex;
data.numberConsumedInRecentSale = _consumed;
} else {
data.numberConsumedInRecentSale += _consumed;
}
_addressData[_target] = data;
}
function _setAddressAux(address _target, uint40 _aux)
internal
virtual
{
_addressData[_target].aux = _aux;
}
///////////////////////////////////////////////////////////////////////////
// Setter functions : TokenId Aux
///////////////////////////////////////////////////////////////////////////
function _setTokenAux(uint256 tokenId, uint256 aux) internal virtual{
_tokenAux[tokenId] = aux;
}
///////////////////////////////////////////////////////////////////////////
// Setter functions : ERC2981
///////////////////////////////////////////////////////////////////////////
function setRoyaltyAddress(address _new) external onlyAdmin {
if (_new == address(0)) revert ZeroAddress();
royaltyAddress = _new;
}
function setRoyaltyFee(uint96 _new) external onlyAdmin {
if (_new > 10000) revert InvlidRoyaltyFee(_new);
royaltyFee = _new;
}
///////////////////////////////////////////////////////////////////////////
// Setter functions : Soul Bound Tokenizer
///////////////////////////////////////////////////////////////////////////
function setIsSBT(bool _state) external onlyAdmin {
isSBT = _state;
}
///////////////////////////////////////////////////////////////////////////
// Essential getter functions
///////////////////////////////////////////////////////////////////////////
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(AccessControl, IERC165, ERC721AntiScamSubset)
returns (bool)
{
return
interfaceId == type(IERC2981).interfaceId ||
interfaceId == type(ISalesItem).interfaceId ||
AccessControl.supportsInterface(interfaceId) ||
super.supportsInterface(interfaceId);
}
///////////////////////////////////////////////////////////////////////////
// AntiScam functions : Enabler
///////////////////////////////////////////////////////////////////////////
function setEnableRestrict(bool value) external onlyAdmin {
enableRestrict = value;
}
function setEnableLock(bool value) external onlyAdmin {
enableLock = value;
}
///////////////////////////////////////////////////////////////////////////
// Override functions : IERC721RestrictApprove
///////////////////////////////////////////////////////////////////////////
function setCALLevel(uint256 level) external onlyAdmin{
CALLevel = level;
}
function setCAL(address calAddress) external onlyAdmin{
_setCAL(calAddress);
}
/*
function addLocalContractAllowList(address transferer) external onlyAdmin{
_addLocalContractAllowList(transferer);
}
function removeLocalContractAllowList(address transferer) external onlyAdmin{
_removeLocalContractAllowList(transferer);
}
function getLocalContractAllowList() external view returns(address[] memory){
return _getLocalContractAllowList();
}
*/
///////////////////////////////////////////////////////////////////////////
// TimeLock derived from default-nft-contract
// https://github.com/Lavulite/default-nft-contract/blob/main/contracts/tokens/NFT/base/ERC721AntiScamTimeLock.sol
///////////////////////////////////////////////////////////////////////////
/*
function setWalletLock(address to, LockStatus lockStatus)
external
override
{
if(msg.sender != to) revert WalletLockNotAllowedByOthers();
if (
walletLock[to] == LockStatus.Lock && lockStatus != LockStatus.Lock
) {
unlockWalletTimestamp[to] = block.timestamp;
}
_setWalletLock(to, lockStatus);
}
function _isTokenLockToUnlock(uint256 tokenId, LockStatus newLockStatus)
private
view
returns (bool)
{
if (newLockStatus == LockStatus.UnLock) {
LockStatus currentWalletLock = walletLock[msg.sender];
bool isWalletLock_TokenLockOrUnset = (currentWalletLock ==
LockStatus.Lock &&
tokenLock[tokenId] != LockStatus.UnLock);
bool isWalletUnlockOrUnset_TokenLock = (currentWalletLock !=
LockStatus.Lock &&
tokenLock[tokenId] == LockStatus.Lock);
return
isWalletLock_TokenLockOrUnset ||
isWalletUnlockOrUnset_TokenLock;
} else if (newLockStatus == LockStatus.UnSet) {
LockStatus currentWalletLock = walletLock[msg.sender];
bool isNotWalletLock = currentWalletLock != LockStatus.Lock;
bool isTokenLock = tokenLock[tokenId] == LockStatus.Lock;
return isNotWalletLock && isTokenLock;
} else {
return false;
}
}
function setTokenLock(uint256[] calldata tokenIds, LockStatus newLockStatus)
external
override
{
if (tokenIds.length == 0) revert ArrayLengthIsZero();
for (uint256 i = 0; i < tokenIds.length; i++) {
if(msg.sender != ownerOf(tokenIds[i])) revert NotTokenHolder();
//}
//for (uint256 i = 0; i < tokenIds.length; i++) {
if (_isTokenLockToUnlock(tokenIds[i], newLockStatus)) {
unlockTokenTimestamp[tokenIds[i]] = block.timestamp;
}
}
_setTokenLock(tokenIds, newLockStatus);
}
function _isTokenTimeLock(uint256 tokenId) private view returns (bool) {
return unlockTokenTimestamp[tokenId] + unlockLeadTime > block.timestamp;
}
function _isWalletTimeLock(uint256 tokenId) private view returns (bool) {
return
unlockWalletTimestamp[ownerOf(tokenId)] + unlockLeadTime >
block.timestamp;
}
function isLocked(uint256 tokenId)
public
view
/// override(IERC721Lockable, ERC721Lockable)
override(ERC721Lockable)
returns (bool)
{
return
ERC721Lockable.isLocked(tokenId) ||
_isTokenTimeLock(tokenId) ||
_isWalletTimeLock(tokenId);
}
function setUnlockLeadTime(uint256 value) external onlyAdmin {
unlockLeadTime = value;
}
*/
///////////////////////////////////////////////////////////////////////////
// Override functions for support interface of IERC721BasicFrame
///////////////////////////////////////////////////////////////////////////
/*
function ownerOf(uint256 tokenId) public view virtual override(IERC721BasicFrame, ERC721Psi) returns (address){
return ERC721Psi.ownerOf(tokenId);
}
function totalSupply() public view virtual override(IERC721BasicFrame, ERC721PsiBurnable) returns (uint256){
return ERC721PsiBurnable.totalSupply();
}
*/
///////////////////////////////////////////////////////////////////////////
// Override functions : ERC721Locable
///////////////////////////////////////////////////////////////////////////
function setTokenLock(uint256[] calldata tokenIds, LockStatus lockStatus)
external
virtual
override
{
for (uint256 i = 0; i < tokenIds.length; i++) {
if (msg.sender != ownerOf(tokenIds[i])) revert NotTokenHolder();
}
_setTokenLock(tokenIds, lockStatus);
}
function setWalletLock(address to, LockStatus lockStatus)
external
virtual
override
{
require(to == msg.sender, "not yourself.");
_setWalletLock(to, lockStatus);
}
function setContractLock(LockStatus lockStatus) external onlyAdmin{
_setContractLock(lockStatus);
}
///////////////////////////////////////////////////////////////////////////
// Internal State functions : TokenId Aux
///////////////////////////////////////////////////////////////////////////
function _getAddressAux(address _target) internal virtual view returns(uint40){
return _addressData[_target].aux;
}
function _getTokenAux(uint256 tokenId) internal virtual view returns(uint256){
return _tokenAux[tokenId];
}
///////////////////////////////////////////////////////////////////////////
// Modifiers
///////////////////////////////////////////////////////////////////////////
modifier onlyAdmin() {
_checkRole(DEFAULT_ADMIN_ROLE);
_;
}
}
abstract contract ERC721BasicFrame is ERC721BasicFrameControlable {
using Strings for uint256;
///////////////////////////////////////////////////////////////////////////
// Constructor
///////////////////////////////////////////////////////////////////////////
constructor(string memory _name, string memory _symbol, uint256 maxSupply)
ERC721Psi(_name, _symbol)
ERC721BasicFrameControlable(maxSupply)
{
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
}
///////////////////////////////////////////////////////////////////////////
// State functions : Aux region of _addressData
///////////////////////////////////////////////////////////////////////////
/*
* @dev Returns consumed allocation in the current sale
*/
function getConsumedAllocation(address _target, uint8 _currentSaleIndex) external view virtual returns(uint16){
// Grab stuck
AddressData memory data = _addressData[_target];
// If previous sale was recorded in the data, updates it with the current sale
if (data.saleIndex != _currentSaleIndex){
return 0;
}
return data.numberConsumedInRecentSale;
}
///////////////////////////////////////////////////////////////////////////
// Override functions : ERC2981
///////////////////////////////////////////////////////////////////////////
function royaltyInfo(
uint256, /*_tokenId*/
uint256 _salePrice
) public view virtual override returns (address, uint256) {
return (royaltyAddress, (_salePrice * uint256(royaltyFee)) / 10000);
}
///////////////////////////////////////////////////////////////////////////
// Transfer functions
///////////////////////////////////////////////////////////////////////////
function transferFrom(
address from,
address to,
uint256 tokenId
) public override onlyAllowedOperator(from) {
super.transferFrom(from, to, tokenId);
}
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public override onlyAllowedOperator(from) {
super.safeTransferFrom(from, to, tokenId);
}
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory data
) public override onlyAllowedOperator(from) {
super.safeTransferFrom(from, to, tokenId, data);
}
function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual override {
if (
isSBT &&
from != address(0) &&
to != address(0x000000000000000000000000000000000000dEaD)
) revert ProhibitedBecauseSBT();
super._beforeTokenTransfers(from, to, startTokenId, quantity);
}
///////////////////////////////////////////////////////////////////////////
// Approve functions
///////////////////////////////////////////////////////////////////////////
function setApprovalForAll(address operator, bool approved)
public
virtual
override
onlyAllowedOperatorApproval(operator)
{
if (approved){
if (isSBT) revert ProhibitedBecauseSBT();
}
super.setApprovalForAll(operator, approved);
}
function approve(address operator, uint256 tokenId)
public
virtual
override
onlyAllowedOperatorApproval(operator)
{
if (operator != address(0)) {
if (isSBT) revert ProhibitedBecauseSBT();
}
super.approve(operator, tokenId);
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "erc721psi/contracts/extension/ERC721PsiBurnable.sol";
import "./IERC721RestrictApproveGlobalOnly.sol";
//import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "contract-allow-list/contracts/proxy/interface/IContractAllowListProxy.sol";
/// @title ERC721PsiBurnable with RestrictApprove without Local CAL List.
/// @dev See readme.
abstract contract ERC721RestrictApproveGlobalOnly is ERC721PsiBurnable, IERC721RestrictApproveGlobalOnly {
//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(IERC721RestrictApproveGlobalOnly).interfaceId ||
super.supportsInterface(interfaceId);
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
/// @title IERC721RestrictApprove
/// @dev Approve抑制機能付きコントラクトのインターフェース
/// @author Lavulite
interface IERC721RestrictApproveGlobalOnly {
/**
* @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.8.17;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
interface IMetadataRouter{
/* enum NFTStandard{
ERC721,
ERC1155
}*/
struct SubNFT {
address addr;
// NFTStandard standard;
uint256 tokenId;
string baseURI;
}
/**
* @dev Emitted when subNFT of `subId` is updated.
*/
event UpdateSubNFT(uint16 indexed subId, address indexed addr, uint256 indexed tokenId, string key);
/**
* @dev Emitted when the first `subId` of `tokenId` is updated.
*/
event UpdateSubIdForToken(uint256 tokenId, uint16 subId);
/**
* @dev Emitted when global priority list is updated.
*/
event UpdateGlobalPriority();
/**
* @dev Emitted when main NFT contract address `addr` is updated.
*/
event UpdateMainNFT(address indexed addr);
/**
* @dev Returns the subNFT infromation as SubNFT struct of `subId` index.
*/
function subNFTs(uint16) external view returns(SubNFT memory);//(address, NFTStandard, uint256, string memory);
/**
* @dev Returns the first pritoriy `subId` of `tokenId` token.
*/
function tokenPriority(uint256 tokenId) external view returns(uint16 subId);
/**
* @dev Returns the global priority subId array.
*/
function globalPriorityArray() external view returns(uint16[] memory subIds);
/**
* @dev Returns the global priority `subId` at `index`.
*/
function globalPriority(uint256 index) external view returns(uint16 subId);
function getGlobalPriorityLength() external view returns(uint256);
function mainNFT() external view returns(IERC721);
function getURI(uint256 tokenId, address owner, uint256 param) external view returns(string memory);
function getTotalSubNFTs() external view returns(uint256 total);
/**
* @dev append new SubNFT `info` on subNFTs array.
* Returns provided `sudId` starting from 1.
*/
function appendSubNFT(SubNFT memory info) external returns(uint16 subId);
function updateSubNFT(uint16 subId, SubNFT memory info) external;
function disableSubNFT(uint16 subId) external;
function setTokenPriority(uint256 tokenId, uint16 subId) external;
function resetTokenPriority(uint256 tokenId) external;
function setGlobalPriority(uint16[] memory subIds) external;
function setMainNFT(IERC721 addr) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
interface ISalesItem is IERC165{
function sellerMint(address to, uint256 quantity) external;
function sellerBurn(uint256 tokenId) external;
function burned() external view returns(uint256);
function getConsumedAllocation(address _target, uint8 _currentSaleIndex) external view returns(uint16);
function setConsumedAllocation(address _target, uint8 _currentSaleIndex, uint16 _consumed) external;
function addConsumedAllocation(address _target, uint8 _currentSaleIndex, uint16 _consumed) external;
}// 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
pragma solidity ^0.8.13;
import {OperatorFilterer} from "./OperatorFilterer.sol";
/**
* @title DefaultOperatorFilterer
* @notice Inherits from OperatorFilterer and automatically subscribes to the default OpenSea subscription.
*/
abstract contract DefaultOperatorFilterer is OperatorFilterer {
address constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);
constructor() OperatorFilterer(DEFAULT_SUBSCRIPTION, true) {}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
interface IOperatorFilterRegistry {
function isOperatorAllowed(address registrant, address operator) external view returns (bool);
function register(address registrant) external;
function registerAndSubscribe(address registrant, address subscription) external;
function registerAndCopyEntries(address registrant, address registrantToCopy) external;
function unregister(address addr) external;
function updateOperator(address registrant, address operator, bool filtered) external;
function updateOperators(address registrant, address[] calldata operators, bool filtered) external;
function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external;
function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external;
function subscribe(address registrant, address registrantToSubscribe) external;
function unsubscribe(address registrant, bool copyExistingEntries) external;
function subscriptionOf(address addr) external returns (address registrant);
function subscribers(address registrant) external returns (address[] memory);
function subscriberAt(address registrant, uint256 index) external returns (address);
function copyEntriesOf(address registrant, address registrantToCopy) external;
function isOperatorFiltered(address registrant, address operator) external returns (bool);
function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);
function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);
function filteredOperators(address addr) external returns (address[] memory);
function filteredCodeHashes(address addr) external returns (bytes32[] memory);
function filteredOperatorAt(address registrant, uint256 index) external returns (address);
function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);
function isRegistered(address addr) external returns (bool);
function codeHashOf(address addr) external returns (bytes32);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import {IOperatorFilterRegistry} from "./IOperatorFilterRegistry.sol";
/**
* @title OperatorFilterer
* @notice Abstract contract whose constructor automatically registers and optionally subscribes to or copies another
* registrant's entries in the OperatorFilterRegistry.
* @dev This smart contract is meant to be inherited by token contracts so they can use the following:
* - `onlyAllowedOperator` modifier for `transferFrom` and `safeTransferFrom` methods.
* - `onlyAllowedOperatorApproval` modifier for `approve` and `setApprovalForAll` methods.
*/
abstract contract OperatorFilterer {
error OperatorNotAllowed(address operator);
IOperatorFilterRegistry public constant OPERATOR_FILTER_REGISTRY =
IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E);
constructor(address subscriptionOrRegistrantToCopy, bool subscribe) {
// If an inheriting token contract is deployed to a network without the registry deployed, the modifier
// will not revert, but the contract will need to be registered with the registry once it is deployed in
// order for the modifier to filter addresses.
if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) {
if (subscribe) {
OPERATOR_FILTER_REGISTRY.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);
} else {
if (subscriptionOrRegistrantToCopy != address(0)) {
OPERATOR_FILTER_REGISTRY.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);
} else {
OPERATOR_FILTER_REGISTRY.register(address(this));
}
}
}
}
modifier onlyAllowedOperator(address from) virtual {
// Allow spending tokens from addresses with balance
// Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred
// from an EOA.
if (from != msg.sender) {
_checkFilterOperator(msg.sender);
}
_;
}
modifier onlyAllowedOperatorApproval(address operator) virtual {
_checkFilterOperator(operator);
_;
}
function _checkFilterOperator(address operator) internal view virtual {
// Check registry code length to facilitate testing in environments without a deployed registry.
if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) {
if (!OPERATOR_FILTER_REGISTRY.isOperatorAllowed(address(this), operator)) {
revert OperatorNotAllowed(operator);
}
}
}
}// 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": 20
},
"viaIR": false,
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ArrayLengthIsZero","type":"error"},{"inputs":[],"name":"InvalidRole","type":"error"},{"inputs":[],"name":"InvalidUpdateIndex","type":"error"},{"inputs":[{"internalType":"uint256","name":"fee","type":"uint256"}],"name":"InvlidRoyaltyFee","type":"error"},{"inputs":[],"name":"MaxSupplyExceeded","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"NotAllowedByCAL","type":"error"},{"inputs":[],"name":"NotTokenHolder","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"OperatorNotAllowed","type":"error"},{"inputs":[],"name":"ProhibitedBecauseSBT","type":"error"},{"inputs":[],"name":"RouterNotSet","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"TokenNonexistent","type":"error"},{"inputs":[],"name":"WalletLockNotAllowedByOthers","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"inputs":[],"name":"ZeroUpdateIndex","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"uint256","name":"level","type":"uint256"}],"name":"CalLevelChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint8","name":"updateIndex","type":"uint8"}],"name":"IncreaseUpdateIndex","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":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"uint8","name":"updateIndex","type":"uint8"}],"name":"UpdateToken","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":"BURNER_ROLE","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":"MAX_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_FILTER_REGISTRY","outputs":[{"internalType":"contract IOperatorFilterRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SELLER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPDATER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_target","type":"address"},{"internalType":"uint8","name":"_currentSaleIndex","type":"uint8"},{"internalType":"uint16","name":"_consumed","type":"uint16"}],"name":"addConsumedAllocation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","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":"burned","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":"currentUpdateIndex","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","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":"externalBurn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"externalMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_target","type":"address"},{"internalType":"uint8","name":"_currentSaleIndex","type":"uint8"}],"name":"getConsumedAllocation","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"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":"tokenId","type":"uint256"}],"name":"getTokenUpdateIndex","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"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":[],"name":"increaseCurrentUpdateIndex","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"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":[],"name":"isSBT","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","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":[],"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":[],"name":"router","outputs":[{"internalType":"contract IMetadataRouter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"royaltyAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"royaltyFee","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"sellerBurn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"sellerMint","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":"address","name":"_target","type":"address"},{"internalType":"uint8","name":"_currentSaleIndex","type":"uint8"},{"internalType":"uint16","name":"_consumed","type":"uint16"}],"name":"setConsumedAllocation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum IERC721Lockable.LockStatus","name":"lockStatus","type":"uint8"}],"name":"setContractLock","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":"bool","name":"_state","type":"bool"}],"name":"setIsSBT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IMetadataRouter","name":"_new","type":"address"}],"name":"setRouter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_new","type":"address"}],"name":"setRoyaltyAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint96","name":"_new","type":"uint96"}],"name":"setRoyaltyFee","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":"tokenIds","type":"uint256[]"},{"internalType":"enum IERC721Lockable.LockStatus","name":"lockStatus","type":"uint8"}],"name":"setTokenLockByAdmin","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":"uint256","name":"tokenId","type":"uint256"}],"name":"updateToken","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
60a06040526009805461ffff1916610101179055600c805460ff60a01b1916600160a01b1790556001600f5560138054607d60a31b6001600160a01b039091161790553480156200004f57600080fd5b50604080518082018252601581527f506978656c204865726f65732056696c6c61696e7300000000000000000000006020808301919091528251808401909352600383526228242b60e91b9083015290612710808383733cc6cdda760b79bafa08df41ecfa224f810dceb660016daaeb6d7670e522a718067333cd4e3b15620002015780156200014f57604051633e9f1edf60e11b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e90637d3e3dbe906044015b600060405180830381600087803b1580156200013057600080fd5b505af115801562000145573d6000803e3d6000fd5b5050505062000201565b6001600160a01b03821615620001a05760405163a0af290360e01b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e9063a0af29039060440162000115565b604051632210724360e11b81523060048201526daaeb6d7670e522a718067333cd4e90634420e48690602401600060405180830381600087803b158015620001e757600080fd5b505af1158015620001fc573d6000803e3d6000fd5b505050505b5060029050620002128382620010aa565b506003620002218282620010aa565b50506000600555506200023433620002d8565b608052620002446000336200032a565b5050601380546001600160a01b0319167356b75e59ced86ab9c9ea4a0cab89db334620fa1517905550620002997f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6336200032a565b620002c57f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a848336200032a565b620002d2336001620003b3565b62001237565b601080546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b62000336828262000403565b620003af576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556200036e3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b608051620003c06200042e565b620003cc90836200118c565b1115620003ec57604051638a164f6360e01b815260040160405180910390fd5b620003af82826200045560201b62001efc1760201c565b6000828152602081815260408083206001600160a01b038516845290915290205460ff165b92915050565b60006200043a6200060e565b620004446200068a565b620004509190620011a2565b905090565b60006200046160055490565b905060008211620004c75760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a207175616e74697479206d7573742062652067726561604482015264074657220360dc1b60648201526084015b60405180910390fd5b6001600160a01b0383166200052b5760405162461bcd60e51b815260206004820152602360248201527f4552433732315073693a206d696e7420746f20746865207a65726f206164647260448201526265737360e81b6064820152608401620004be565b6200053a60008483856200069c565b81600560008282546200054e91906200118c565b9091555050600081815260046020908152604090912080546001600160a01b0319166001600160a01b0386161790556200059690600190839062000707811b6200207717901c565b620005a5600084838562000733565b805b620005b383836200118c565b811015620006085760405181906001600160a01b038616906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a480620005ff81620011b8565b915050620005a7565b50505050565b60055460009081908190620006289060081c60016200118c565b9050815b818110156200068457600062000652826008620007e160201b620020a31790919060201c565b90506200065f81620007f4565b6200066b90866200118c565b94505080806200067b90620011b8565b9150506200062c565b50505090565b600080600554620004509190620011a2565b60145460ff168015620006b757506001600160a01b03841615155b8015620006cf57506001600160a01b03831661dead14155b15620006ee5760405163f30c72c560e01b815260040160405180910390fd5b62000608848484846200081560201b620020b61760201c565b600881901c600090815260209290925260409091208054600160ff1b60ff9093169290921c9091179055565b6001600160a01b038416158015906200075c57506014546201000090046001600160a01b031615155b15620007c8576014546040516310745d3b60e11b815260048101849052620100009091046001600160a01b0316906320e8ba7690602401600060405180830381600087803b158015620007ae57600080fd5b505af1158015620007c3573d6000803e3d6000fd5b505050505b62000608848484846200082e60201b620020c21760201c565b6000908152602091909152604090205490565b60005b81156200081057600019820190911690600101620007f7565b919050565b620006088484848462000a0860201b620022711760201c565b6801000000000000000081106200084457600080fd5b806001600160a01b03851615620008b2576001600160a01b03851660009081526011602052604081208054839290620008889084906001600160401b0316620011d4565b92506101000a8154816001600160401b0302191690836001600160401b0316021790555062000919565b6001600160a01b03841660009081526011602052604090208054829190600890620008f49084906801000000000000000090046001600160401b0316620011fe565b92506101000a8154816001600160401b0302191690836001600160401b031602179055505b6001600160a01b0384161562000986576001600160a01b038416600090815260116020526040812080548392906200095c9084906001600160401b0316620011fe565b92506101000a8154816001600160401b0302191690836001600160401b03160217905550620009e8565b6001600160a01b03851660009081526011602052604090208054829190601090620009c3908490600160801b90046001600160401b0316620011fe565b92506101000a8154816001600160401b0302191690836001600160401b031602179055505b62000a018585858562000a9960201b620022fc1760201c565b5050505050565b6001600160a01b0384161580159062000a2957506001600160a01b03831615155b15620006085762000a3a8262000acb565b15620006085760405162461bcd60e51b815260206004820152602760248201527f4c6f636b61626c653a2043616e206e6f74207472616e73666572206c6f636b6560448201526632103a37b5b2b760c91b6064820152608401620004be565b62000ab28484848462000be160201b620023141760201c565b620006088484848462000c0d60201b6200233e1760201c565b60008162000ad98162000c32565b62000b3d5760405162461bcd60e51b815260206004820152602d60248201527f4c6f636b61626c653a206c6f636b696e6720717565727920666f72206e6f6e6560448201526c3c34b9ba32b73a103a37b5b2b760991b6064820152608401620004be565b60095460ff1662000b52576000915062000bdb565b60026000848152600a602052604090205460ff16600281111562000b7a5762000b7a62000ff5565b148062000bc657506000838152600a602052604081205460ff16600281111562000ba85762000ba862000ff5565b14801562000bc6575062000bc662000bc08462000c73565b62000c89565b1562000bd6576001915062000bdb565b600091505b50919050565b6001600160a01b0384161562000608576000828152600a60205260409020805460ff1916905562000608565b6001600160a01b0384161562000608576000828152600d602052604081205562000608565b600062000c4f82600862000d4b60201b620023611790919060201c565b1562000c5d57506000919050565b620004288262000d7260201b620023881760201c565b60008062000c818362000d90565b509392505050565b60095460009060ff1662000c9f57506000919050565b60026001600160a01b0383166000908152600b602052604090205460ff16600281111562000cd15762000cd162000ff5565b148062000d3557506001600160a01b0382166000908152600b602052604081205460ff16600281111562000d095762000d0962000ff5565b14801562000d3557506002600954610100900460ff16600281111562000d335762000d3362000ff5565b145b1562000d4357506001919050565b506000919050565b600881901c600090815260208390526040902054600160ff1b60ff83161c16151592915050565b600062000d7e60055490565b82108015620004285750600192915050565b60008062000d9e8362000c32565b62000e015760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a206f776e657220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401620004be565b62000e0c8362000e2d565b6000818152600460205260409020546001600160a01b031694909350915050565b60006200042882600162000e4a60201b620023a41790919060201c565b600881901c60008181526020849052604081205490919060ff808516919082181c801562000e9b5762000e888162000f6c60201b6200249c1760201c565b60ff168203600884901b17935062000f63565b6000831162000f135760405162461bcd60e51b815260206004820152603460248201527f4269744d6170733a205468652073657420626974206265666f7265207468652060448201527f696e64657820646f65736e27742065786973742e0000000000000000000000006064820152608401620004be565b50600019909101600081815260208690526040902054909190801562000f5d5762000f498162000f6c60201b6200249c1760201c565b60ff0360ff16600884901b17935062000f63565b62000e9b565b50505092915050565b600060405180610120016040528061010081526020016200579d610100913960f87e818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff62000fb88562000fdc565b02901c8151811062000fce5762000fce62001221565b016020015160f81c92915050565b600080821162000feb57600080fd5b5060008190031690565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200103657607f821691505b60208210810362000bdb57634e487b7160e01b600052602260045260246000fd5b601f821115620010a557600081815260208120601f850160051c81016020861015620010805750805b601f850160051c820191505b81811015620010a1578281556001016200108c565b5050505b505050565b81516001600160401b03811115620010c657620010c66200100b565b620010de81620010d7845462001021565b8462001057565b602080601f831160018114620011165760008415620010fd5750858301515b600019600386901b1c1916600185901b178555620010a1565b600085815260208120601f198616915b82811015620011475788860151825594840194600190910190840162001126565b5085821015620011665787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052601160045260246000fd5b8082018082111562000428576200042862001176565b8181038181111562000428576200042862001176565b600060018201620011cd57620011cd62001176565b5060010190565b6001600160401b03828116828216039080821115620011f757620011f762001176565b5092915050565b6001600160401b03818116838216019080821115620011f757620011f762001176565b634e487b7160e01b600052603260045260246000fd5b6080516145436200125a600039600081816105530152612c0901526145436000f3fe608060405234801561001057600080fd5b506004361061037e5760003560e01c806370a08231116101d6578063a41216ac1161010b578063a41216ac1461081c578063aa0e2ad61461082f578063ad2f852a14610841578063b31391cb14610854578063b88d4fde14610874578063b8997a9714610887578063bc98a00f146108ae578063c0d78655146108c1578063c87b56dd146108d4578063d5391393146108e7578063d547741f1461090e578063dbe4613d14610921578063e985e9c514610936578063eb05629714610949578063f2fde38b14610951578063f3b3059e14610964578063f6aacfb114610977578063f887ea401461098a578063fcd1aac9146109a357600080fd5b806370a08231146106e0578063715018a6146106f357806371745b62146106fb57806373f425611461070e57806379884269146107165780637c3dc173146107395780638462151c1461074c578063874a8b021461075f5780638d5b98d5146107725780638da5cb5b1461078557806391d148541461078d57806395323239146107a057806395d89b41146107b357806399f98898146107bb578063a059b164146107ce578063a217fddf146107e1578063a22cb465146107e9578063a35c23ad146107fc57600080fd5b806332cb6b0c116102b757806332cb6b0c1461054e57806336568abe14610575578063374032a114610588578063396e8f53146105955780633cf40df3146105a857806341f43434146105b557806342842e0e146105ca57806344f71db2146105dd57806347e63380146105f057806348521943146106055780634a4fbeec1461062b5780634b81d8bd1461063e5780634f3db3461461065e5780634fdaf05214610667578063526d5ca71461067a578063570009721461068d5780635aca43a2146106a757806360e7a0e6146106ba5780636352211e146106cd57600080fd5b806301ffc9a714610383578063025e332e146103ab57806306d254da146103c057806306fdde03146103d357806307265389146103e8578063081812fc146103fc578063095ea7b31461041c5780630f4345e21461042f57806310c395bf1461044257806313c528261461046157806318160ddd146104845780632398f8431461049a57806323b872dd146104ba578063248a9ca3146104cd578063282c51f3146104e05780632a55205a146105075780632f2ff15d1461052857806331faafb41461053b575b600080fd5b610396610391366004613a37565b6109b6565b60405190151581526020015b60405180910390f35b6103be6103b9366004613a69565b610a0b565b005b6103be6103ce366004613a69565b610a36565b6103db610a89565b6040516103a29190613ad6565b600c5461039690600160a01b900460ff1681565b61040f61040a366004613ae9565b610b1b565b6040516103a29190613b02565b6103be61042a366004613b16565b610bab565b6103be61043d366004613ae9565b610bf7565b60095461045490610100900460ff1681565b6040516103a29190613b58565b61045461046f366004613a69565b600b6020526000908152604090205460ff1681565b61048c610c06565b6040519081526020016103a2565b61048c6104a8366004613a69565b600e6020526000908152604090205481565b6103be6104c8366004613b80565b610c27565b61048c6104db366004613ae9565b610c52565b61048c7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84881565b61051a610515366004613bc1565b610c67565b6040516103a2929190613be3565b6103be610536366004613bfc565b610cad565b6103be610549366004613c2c565b610cc9565b61048c7f000000000000000000000000000000000000000000000000000000000000000081565b6103be610583366004613bfc565b610d29565b6009546103969060ff1681565b600c5461040f906001600160a01b031681565b6014546103969060ff1681565b61040f6daaeb6d7670e522a718067333cd4e81565b6103be6105d8366004613b80565b610da7565b6103be6105eb366004613ae9565b610dcc565b61048c6000805160206143ce83398151915281565b610618610613366004613c66565b610dff565b60405161ffff90911681526020016103a2565b610396610639366004613a69565b610ea8565b61065161064c366004613bc1565b610f5d565b6040516103a29190613c9b565b61048c600f5481565b6103be610675366004613cee565b61112b565b6103be610688366004613ae9565b61113e565b610695611156565b60405160ff90911681526020016103a2565b6103be6106b5366004613d09565b6111dc565b6103be6106c8366004613d09565b611388565b61040f6106db366004613ae9565b611611565b61048c6106ee366004613a69565b611625565b6103be6116b8565b6103be610709366004613d59565b6116cc565b61048c6116e1565b610454610724366004613ae9565b600a6020526000908152604090205460ff1681565b6103be610747366004613bc1565b6116eb565b61065161075a366004613a69565b61177b565b6103be61076d366004613ddc565b611841565b6103be610780366004613ae9565b611893565b61040f611998565b61039661079b366004613bfc565b6119a7565b6106956107ae366004613ae9565b6119d0565b6103db611a04565b6103be6107c9366004613b16565b611a13565b6103be6107dc366004613e16565b611a47565b61048c600081565b6103be6107f7366004613e33565b611a6f565b6103be61080a366004613ae9565b336000908152600e6020526040902055565b6103be61082a366004613e16565b611aad565b60145461069590610100900460ff1681565b60135461040f906001600160a01b031681565b61048c610862366004613ae9565b600d6020526000908152604090205481565b6103be610882366004613ece565b611aca565b6013546108a190600160a01b90046001600160601b031681565b6040516103a29190613f7c565b6103be6108bc366004613b16565b611af7565b6103be6108cf366004613a69565b611b0f565b6103db6108e2366004613ae9565b611b43565b61048c7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b6103be61091c366004613bfc565b611c80565b61048c6000805160206143ae83398151915281565b610396610944366004613f90565b611c9c565b610651611cd0565b6103be61095f366004613a69565b611cf1565b6103be610972366004613d59565b611d67565b610396610985366004613ae9565b611de2565b60145461040f906201000090046001600160a01b031681565b6103be6109b1366004613e16565b611edf565b60006001600160e01b0319821663152a902d60e11b14806109e757506001600160e01b031982166377bf11e760e11b145b806109f657506109f682612506565b80610a055750610a058261253b565b92915050565b610a156000612564565b600c80546001600160a01b0319166001600160a01b03831617905550565b50565b610a406000612564565b6001600160a01b038116610a675760405163d92e233d60e01b815260040160405180910390fd5b601380546001600160a01b0319166001600160a01b0392909216919091179055565b606060028054610a9890613fbe565b80601f0160208091040260200160405190810160405280929190818152602001828054610ac490613fbe565b8015610b115780601f10610ae657610100808354040283529160200191610b11565b820191906000526020600020905b815481529060010190602001808311610af457829003601f168201915b5050505050905090565b6000610b268261256e565b610b8f5760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a20617070726f76656420717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084015b60405180910390fd5b506000908152600660205260409020546001600160a01b031690565b81610bb581612591565b6001600160a01b03831615610be85760145460ff1615610be85760405163f30c72c560e01b815260040160405180910390fd5b610bf28383612641565b505050565b610c016000612564565b600f55565b6000610c10612655565b610c186126b7565b610c229190614008565b905090565b826001600160a01b0381163314610c4157610c4133612591565b610c4c8484846126c7565b50505050565b60009081526020819052604090206001015490565b60135460009081906001600160a01b0381169061271090610c9890600160a01b90046001600160601b03168661401b565b610ca29190614032565b915091509250929050565b610cb682610c52565b610cbf81612564565b610bf283836126f8565b610cd36000612564565b612710816001600160601b03161115610d0157806040516349d647ad60e01b8152600401610b869190613f7c565b601380546001600160601b03909216600160a01b026001600160a01b03909216919091179055565b6001600160a01b0381163314610d995760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610b86565b610da3828261277c565b5050565b826001600160a01b0381163314610dc157610dc133612591565b610c4c8484846127e1565b7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a848610df681612564565b610da3826127fc565b6001600160a01b0382166000908152601160209081526040808320815160c08101835290546001600160401b038082168352600160401b8204811694830194909452600160801b810490931691810191909152600160c01b820460ff90811660608301819052600160c81b840461ffff166080840152600160d81b90930464ffffffffff1660a0830152909190841614610e9d576000915050610a05565b608001519392505050565b60095460009060ff16610ebd57506000919050565b60026001600160a01b0383166000908152600b602052604090205460ff166002811115610eec57610eec613b42565b1480610f4857506001600160a01b0382166000908152600b602052604081205460ff166002811115610f2057610f20613b42565b148015610f4857506002600954610100900460ff166002811115610f4657610f46613b42565b145b15610f5557506001919050565b506000919050565b60606000610f6b8484614008565b610f76906001614054565b6001600160401b03811115610f8d57610f8d613e61565b604051908082528060200260200182016040528015610fb6578160200160208202803683370190505b509050600080855b85811161105e57610fce8161256e565b8015610fde5750610fde81611de2565b15611019576001848481518110610ff757610ff7614067565b91151560209283029190910190910152816110118161407d565b92505061103e565b600084848151811061102d5761102d614067565b911515602092830291909101909101525b826110488161407d565b93505080806110569061407d565b915050610fbe565b506000816001600160401b0381111561107957611079613e61565b6040519080825280602002602001820160405280156110a2578160200160208202803683370190505b5060009350905082875b87811161111e578585815181106110c5576110c5614067565b6020026020010151156110fe57808383815181106110e5576110e5614067565b6020908102919091010152816110fa8161407d565b9250505b846111088161407d565b95505080806111169061407d565b9150506110ac565b5090979650505050505050565b6111356000612564565b610a3381612856565b6000805160206143ae833981519152610df681612564565b60006000805160206143ce83398151915261117081612564565b6014805460009161010090910460ff1690600161118c83614096565b91906101000a81548160ff021916908360ff16021790555090508060ff167f39dedb493270cf57e3d892a36452ebba9db444e0d5406b467262f6b70448847b60405160405180910390a291505090565b6000805160206143ae8339815191526111f481612564565b6001600160a01b038416600090815260116020908152604091829020825160c08101845290546001600160401b038082168352600160401b8204811693830193909352600160801b810490921692810192909252600160c01b810460ff90811660608401819052600160c81b830461ffff166080850152600160d81b90920464ffffffffff1660a084015285161461129e5760ff8416606082015261ffff831660808201526112b8565b82816080018181516112b091906140b5565b61ffff169052505b6001600160a01b03909416600090815260116020908152604091829020865181549288015193880151606089015160808a015160a0909a015164ffffffffff16600160d81b026001600160d81b0361ffff909b16600160c81b029a909a166001600160c81b0360ff909216600160c01b0260ff60c01b196001600160401b03948516600160801b0216600160801b600160c81b0319988516600160401b026001600160801b0319909816949095169390931795909517959095169190911717929092161794909417909355505050565b6000805160206143ae8339815191526113a081612564565b600060116000866001600160a01b03166001600160a01b031681526020019081526020016000206040518060c00160405290816000820160009054906101000a90046001600160401b03166001600160401b03166001600160401b031681526020016000820160089054906101000a90046001600160401b03166001600160401b03166001600160401b031681526020016000820160109054906101000a90046001600160401b03166001600160401b03166001600160401b031681526020016000820160189054906101000a900460ff1660ff1660ff1681526020016000820160199054906101000a900461ffff1661ffff1661ffff16815260200160008201601b9054906101000a900464ffffffffff1664ffffffffff1664ffffffffff1681525050905083816060019060ff16908160ff168152505082816080019061ffff16908161ffff16815250508060116000876001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a8154816001600160401b0302191690836001600160401b0316021790555060208201518160000160086101000a8154816001600160401b0302191690836001600160401b0316021790555060408201518160000160106101000a8154816001600160401b0302191690836001600160401b0316021790555060608201518160000160186101000a81548160ff021916908360ff16021790555060808201518160000160196101000a81548161ffff021916908361ffff16021790555060a082015181600001601b6101000a81548164ffffffffff021916908364ffffffffff1602179055509050505050505050565b60008061161d8361287f565b509392505050565b60006001600160a01b0382166116935760405162461bcd60e51b815260206004820152602d60248201527f4552433732315073693a2062616c616e636520717565727920666f722074686560448201526c207a65726f206164647265737360981b6064820152608401610b86565b506001600160a01b03166000908152601160205260409020546001600160401b031690565b6116c0612916565b6116ca6000612975565b565b6116d66000612564565b610bf28383836129c7565b6000610c22612655565b816116f581611611565b6001600160a01b0316336001600160a01b0316146117685760405162461bcd60e51b815260206004820152602a60248201527f5265737472696374417070726f76653a206f7065726174696f6e206973206f6e604482015269363c903437b63232b91760b11b6064820152608401610b86565b506000918252600d602052604090912055565b606060008061178984611625565b90506000816001600160401b038111156117a5576117a5613e61565b6040519080825280602002602001820160405280156117ce578160200160208202803683370190505b50905060005b828414611838576117e48161256e565b1561183057856001600160a01b03166117fc82611611565b6001600160a01b031603611830578082858060010196508151811061182357611823614067565b6020026020010181815250505b6001016117d4565b50949350505050565b6001600160a01b03821633146118895760405162461bcd60e51b815260206004820152600d60248201526c3737ba103cb7bab939b2b6331760991b6044820152606401610b86565b610da38282612aab565b6000805160206143ce8339815191526118ab81612564565b60145460008381526012602052604081205461010090920460ff169190506118d28461256e565b6118f2576040516308ac597760e01b815260048101859052602401610b86565b8160ff166000036119165760405163038d6ce760e01b815260040160405180910390fd5b60ff8216611925826000612b34565b60ff1610611946576040516376de221360e01b815260040160405180910390fd5b60405160ff83169085907f73eca9ff1b97607af9c8765c3a002b2d958a586d5e014ab7b861210d55b338c190600090a3610c4c8461198683600086612b8a565b60009182526012602052604090912055565b6010546001600160a01b031690565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b60006119db8261256e565b6119fb576040516308ac597760e01b815260048101839052602401610b86565b610a0582612bee565b606060038054610a9890613fbe565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6611a3d81612564565b610bf28383612c07565b611a516000612564565b600c8054911515600160a01b0260ff60a01b19909216919091179055565b81611a7981612591565b8115611aa35760145460ff1615611aa35760405163f30c72c560e01b815260040160405180910390fd5b610bf28383612c63565b611ab76000612564565b6009805460ff1916911515919091179055565b836001600160a01b0381163314611ae457611ae433612591565b611af085858585612cca565b5050505050565b6000805160206143ae833981519152611a3d81612564565b611b196000612564565b601480546001600160a01b03909216620100000262010000600160b01b0319909216919091179055565b6014546060906201000090046001600160a01b0316611b755760405163179ce99f60e01b815260040160405180910390fd5b611b7e8261256e565b611b9e576040516308ac597760e01b815260048101839052602401610b86565b6000611ba983611de2565b611bb4576000611bb7565b60015b60ff169050611bdc611bcb60006001614054565b611bd485612bee565b839190612b8a565b6014549091506201000090046001600160a01b0316635eb8ac6684611c0081611611565b6040516001600160e01b031960e085901b16815260048101929092526001600160a01b0316602482015260448101849052606401600060405180830381865afa158015611c51573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611c7991908101906140d7565b9392505050565b611c8982610c52565b611c9281612564565b610bf2838361277c565b6000611ca783610ea8565b80611cb95750611cb78383612cfc565b155b15611cc657506000610a05565b611c798383612d1c565b6060600080611cde60055490565b9050611cea8282610f5d565b9250505090565b611cf9612916565b6001600160a01b038116611d5e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610b86565b610a3381612975565b60005b82811015611dd657611d93848483818110611d8757611d87614067565b90506020020135611611565b6001600160a01b0316336001600160a01b031614611dc45760405163e131a43f60e01b815260040160405180910390fd5b80611dce8161407d565b915050611d6a565b50610bf28383836129c7565b600081611dee8161256e565b611e505760405162461bcd60e51b815260206004820152602d60248201527f4c6f636b61626c653a206c6f636b696e6720717565727920666f72206e6f6e6560448201526c3c34b9ba32b73a103a37b5b2b760991b6064820152608401610b86565b60095460ff16611e635760009150611ed9565b60026000848152600a602052604090205460ff166002811115611e8857611e88613b42565b1480611ec657506000838152600a602052604081205460ff166002811115611eb257611eb2613b42565b148015611ec65750611ec661063984611611565b15611ed45760019150611ed9565b600091505b50919050565b611ee96000612564565b6014805460ff1916911515919091179055565b6000611f0760055490565b905060008211611f675760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a207175616e74697479206d7573742062652067726561604482015264074657220360dc1b6064820152608401610b86565b6001600160a01b038316611fc95760405162461bcd60e51b815260206004820152602360248201527f4552433732315073693a206d696e7420746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610b86565b611fd66000848385612d43565b8160056000828254611fe89190614054565b9091555050600081815260046020526040902080546001600160a01b0319166001600160a01b03851617905561201f600182612077565b61202c6000848385612d9e565b805b6120388383614054565b811015610c4c5760405181906001600160a01b038616906000906000805160206143ee833981519152908290a48061206f8161407d565b91505061202e565b600881901c600090815260209290925260409091208054600160ff1b60ff9093169290921c9091179055565b6000908152602091909152604090205490565b610c4c84848484612271565b600160401b81106120d257600080fd5b806001600160a01b0385161561213c576001600160a01b038516600090815260116020526040812080548392906121139084906001600160401b0316614144565b92506101000a8154816001600160401b0302191690836001600160401b0316021790555061219c565b6001600160a01b03841660009081526011602052604090208054829190600890612177908490600160401b90046001600160401b0316614164565b92506101000a8154816001600160401b0302191690836001600160401b031602179055505b6001600160a01b03841615612205576001600160a01b038416600090815260116020526040812080548392906121dc9084906001600160401b0316614164565b92506101000a8154816001600160401b0302191690836001600160401b03160217905550612265565b6001600160a01b03851660009081526011602052604090208054829190601090612240908490600160801b90046001600160401b0316614164565b92506101000a8154816001600160401b0302191690836001600160401b031602179055505b611af0858585856122fc565b6001600160a01b0384161580159061229157506001600160a01b03831615155b15610c4c5761229f82611de2565b15610c4c5760405162461bcd60e51b815260206004820152602760248201527f4c6f636b61626c653a2043616e206e6f74207472616e73666572206c6f636b6560448201526632103a37b5b2b760c91b6064820152608401610b86565b61230884848484612314565b610c4c8484848461233e565b6001600160a01b03841615610c4c576000828152600a60205260409020805460ff19169055610c4c565b6001600160a01b03841615610c4c576000828152600d6020526040812055610c4c565b600881901c600090815260208390526040902054600160ff1b60ff83161c16151592915050565b600061239360055490565b82108015610a055750600192915050565b600881901c60008181526020849052604081205490919060ff808516919082181c80156123e6576123d48161249c565b60ff168203600884901b179350612493565b600083116124535760405162461bcd60e51b815260206004820152603460248201527f4269744d6170733a205468652073657420626974206265666f7265207468652060448201527334b73232bc103237b2b9b713ba1032bc34b9ba1760611b6064820152608401610b86565b50600019909101600081815260208690526040902054909190801561248e5761247b8161249c565b60ff0360ff16600884901b179350612493565b6123e6565b50505092915050565b6000604051806101200160405280610100815260200161440e610100913960f87e818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff6124e585612e3b565b02901c815181106124f8576124f8614067565b016020015160f81c92915050565b60006001600160e01b03198216637965db0b60e01b1480610a0557506301ffc9a760e01b6001600160e01b0319831614610a05565b600061254682612e53565b80612555575061255582612e93565b80610a055750610a0582612eb8565b610a338133612edd565b600061257b600883612361565b1561258857506000919050565b610a0582612388565b6daaeb6d7670e522a718067333cd4e3b15610a3357604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa1580156125fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126229190614184565b610a335780604051633b79c77360e21b8152600401610b869190613b02565b61264b8282612f36565b610da38282612f4a565b6005546000908190819061266d9060081c6001614054565b9050815b818110156126b15760006126866008836120a3565b90506126918161305a565b61269b9086614054565b94505080806126a99061407d565b915050612671565b50505090565b600080600554610c229190614008565b6126d13382613079565b6126ed5760405162461bcd60e51b8152600401610b86906141a1565b610bf283838361313e565b61270282826119a7565b610da3576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556127383390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61278682826119a7565b15610da3576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b610bf283838360405180602001604052806000815250611aca565b600061280782611611565b9050612817816000846001612d43565b612822600883612077565b60405182906000906001600160a01b038416906000805160206143ee833981519152908390a4610da3816000846001612d9e565b6009805482919061ff00191661010083600281111561287757612877613b42565b021790555050565b60008061288b8361256e565b6128ec5760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a206f776e657220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610b86565b6128f58361331e565b6000818152600460205260409020546001600160a01b031694909350915050565b3361291f611998565b6001600160a01b0316146116ca5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b86565b601080546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60005b82811015610c4c5781600a60008686858181106129e9576129e9614067565b60209081029290920135835250810191909152604001600020805460ff19166001836002811115612a1c57612a1c613b42565b0217905550838382818110612a3357612a33614067565b90506020020135336001600160a01b0316612a59868685818110611d8757611d87614067565b6001600160a01b03167f80a668baf7ac68b329075f26c37b4428d4aa272c3bd4c9611b25f5fb1c473f7c85604051612a919190613b58565b60405180910390a480612aa38161407d565b9150506129ca565b6001600160a01b0382166000908152600b60205260409020805482919060ff19166001836002811115612ae057612ae0613b42565b0217905550336001600160a01b0316826001600160a01b03167f9fdb14457e6a7bd3753c649831b026de987c06e52d16459a928540738c2ea34b83604051612b289190613b58565b60405180910390a35050565b600060f8821115612b85576040805180820182526018815277706f736974696f6e2073686f756c64206f766572666c6f7760401b6020820152905162461bcd60e51b8152610b869190600401613ad6565b501c90565b600060f8831115612bdb576040805180820182526018815277706f736974696f6e2073686f756c64206f766572666c6f7760401b6020820152905162461bcd60e51b8152610b869190600401613ad6565b5060ff908116821b911b19919091161790565b600081815260126020526040812054610a059082612b34565b7f0000000000000000000000000000000000000000000000000000000000000000612c30610c06565b612c3a9083614054565b1115612c5957604051638a164f6360e01b815260040160405180910390fd5b610da38282611efc565b612c6c33610ea8565b1580612c76575080155b612c925760405162461bcd60e51b8152600401610b86906141f5565b612c9b8261332b565b80612ca4575080155b612cc05760405162461bcd60e51b8152600401610b869061422b565b610da38282613337565b612cd43383613079565b612cf05760405162461bcd60e51b8152600401610b86906141a1565b610c4c8484848461336f565b600080612d08846133a4565b9050612d1483826133e6565b949350505050565b6000612d288383612cfc565b1515600003612d3957506000610a05565b611c798383613475565b60145460ff168015612d5d57506001600160a01b03841615155b8015612d7457506001600160a01b03831661dead14155b15612d925760405163f30c72c560e01b815260040160405180910390fd5b610c4c848484846120b6565b6001600160a01b03841615801590612dc657506014546201000090046001600160a01b031615155b15612e2f576014546040516310745d3b60e11b815260048101849052620100009091046001600160a01b0316906320e8ba7690602401600060405180830381600087803b158015612e1657600080fd5b505af1158015612e2a573d6000803e3d6000fd5b505050505b610c4c848484846120c2565b6000808211612e4957600080fd5b5060008190031690565b60006001600160e01b031982166380ac58cd60e01b1480612e8457506001600160e01b03198216635b5e139f60e01b145b80610a055750610a0582612506565b60006001600160e01b03198216632742b5b960e01b1480610a055750610a0582612e53565b60006001600160e01b031982166303475db360e21b1480610a055750610a0582612e93565b612ee782826119a7565b610da357612ef4816134bb565b612eff8360206134cd565b604051602001612f10929190614278565b60408051601f198184030181529082905262461bcd60e51b8252610b8691600401613ad6565b612f408282613668565b610da382826136cd565b6000612f5582611611565b9050806001600160a01b0316836001600160a01b031603612fc45760405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a20617070726f76616c20746f2063757272656e74206f6044820152633bb732b960e11b6064820152608401610b86565b336001600160a01b0382161480612fe05750612fe08133611c9c565b6130505760405162461bcd60e51b815260206004820152603b60248201527f4552433732315073693a20617070726f76652063616c6c6572206973206e6f7460448201527a081bdddb995c881b9bdc88185c1c1c9bdd995908199bdc88185b1b602a1b6064820152608401610b86565b610bf28383613748565b60005b81156130745760001982019091169060010161305d565b919050565b60006130848261256e565b6130e85760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a206f70657261746f7220717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610b86565b60006130f383611611565b9050806001600160a01b0316846001600160a01b0316148061312e5750836001600160a01b031661312384610b1b565b6001600160a01b0316145b80612d145750612d148185611c9c565b60008061314a8361287f565b91509150846001600160a01b0316826001600160a01b0316146131c45760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a207472616e73666572206f6620746f6b656e2074686160448201526b3a1034b9903737ba1037bbb760a11b6064820152608401610b86565b6001600160a01b03841661322a5760405162461bcd60e51b815260206004820152602760248201527f4552433732315073693a207472616e7366657220746f20746865207a65726f206044820152666164647265737360c81b6064820152608401610b86565b6132378585856001612d43565b613242600084613748565b600061324f846001614054565b905061325c600182612361565b15801561326a575060055481105b156132a157600081815260046020526040902080546001600160a01b0319166001600160a01b0388161790556132a1600182612077565b600084815260046020526040902080546001600160a01b0319166001600160a01b0387161790558184146132da576132da600185612077565b83856001600160a01b0316876001600160a01b03166000805160206143ee83398151915260405160405180910390a46133168686866001612d9e565b505050505050565b6000610a056001836123a4565b6000610a053383612cfc565b6133408261332b565b80613349575080155b6133655760405162461bcd60e51b8152600401610b869061422b565b610da382826137b6565b61337a84848461313e565b6133888484846001856137ef565b610c4c5760405162461bcd60e51b8152600401610b86906142e7565b6001600160a01b0381166000908152600e6020526040812054156133de57506001600160a01b03166000908152600e602052604090205490565b5050600f5490565b600c54600090600160a01b900460ff1661340257506001610a05565b600c54604051630f8350ed60e41b81526001600160a01b039091169063f8350ed0906134349086908690600401613be3565b602060405180830381865afa158015613451573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c799190614184565b600061348083610ea8565b1561348d57506000610a05565b6001600160a01b0380841660009081526007602090815260408083209386168352929052205460ff16611c79565b6060610a056001600160a01b03831660145b606060006134dc83600261401b565b6134e7906002614054565b6001600160401b038111156134fe576134fe613e61565b6040519080825280601f01601f191660200182016040528015613528576020820181803683370190505b509050600360fc1b8160008151811061354357613543614067565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061357257613572614067565b60200101906001600160f81b031916908160001a905350600061359684600261401b565b6135a1906001614054565b90505b6001811115613619576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106135d5576135d5614067565b1a60f81b8282815181106135eb576135eb614067565b60200101906001600160f81b031916908160001a90535060049490941c936136128161433c565b90506135a4565b508315611c795760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610b86565b61367181611de2565b15610da35760405162461bcd60e51b815260206004820152602660248201527f4c6f636b61626c653a2043616e206e6f7420617070726f7665206c6f636b6564604482015265103a37b5b2b760d11b6064820152608401610b86565b6001600160a01b03821615610da3576136e68183613926565b610da35760405162461bcd60e51b815260206004820152602d60248201527f5265737472696374417070726f76653a2054686520636f6e747261637420697360448201526c103737ba1030b63637bbb2b21760991b6064820152608401610b86565b600081815260066020526040902080546001600160a01b0319166001600160a01b038416908117909155819061377d82611611565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6137bf33610ea8565b15806137c9575080155b6137e55760405162461bcd60e51b8152600401610b86906141f5565b610da38282613933565b60006001600160a01b0385163b1561391957506001835b6138108486614054565b81101561391357604051630a85bd0160e11b81526001600160a01b0387169063150b7a02906138499033908b9086908990600401614353565b6020604051808303816000875af1925050508015613884575060408051601f3d908101601f1916820190925261388191810190614390565b60015b6138e1573d8080156138b2576040519150601f19603f3d011682016040523d82523d6000602084013e6138b7565b606091505b5080516000036138d95760405162461bcd60e51b8152600401610b86906142e7565b805181602001fd5b8280156138fe57506001600160e01b03198116630a85bd0160e11b145b9250508061390b8161407d565b915050613806565b5061391d565b5060015b95945050505050565b600080612d0833856139ef565b336001600160a01b0383160361398a5760405162461bcd60e51b815260206004820152601c60248201527b22a9219b9918a839b49d1030b8383937bb32903a379031b0b63632b960211b6044820152606401610b86565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319101612b28565b6000818152600d602052604081205415613a1857506000818152600d6020526040902054610a05565b611c79836133a4565b6001600160e01b031981168114610a3357600080fd5b600060208284031215613a4957600080fd5b8135611c7981613a21565b6001600160a01b0381168114610a3357600080fd5b600060208284031215613a7b57600080fd5b8135611c7981613a54565b60005b83811015613aa1578181015183820152602001613a89565b50506000910152565b60008151808452613ac2816020860160208601613a86565b601f01601f19169290920160200192915050565b602081526000611c796020830184613aaa565b600060208284031215613afb57600080fd5b5035919050565b6001600160a01b0391909116815260200190565b60008060408385031215613b2957600080fd5b8235613b3481613a54565b946020939093013593505050565b634e487b7160e01b600052602160045260246000fd5b6020810160038310613b7a57634e487b7160e01b600052602160045260246000fd5b91905290565b600080600060608486031215613b9557600080fd5b8335613ba081613a54565b92506020840135613bb081613a54565b929592945050506040919091013590565b60008060408385031215613bd457600080fd5b50508035926020909101359150565b6001600160a01b03929092168252602082015260400190565b60008060408385031215613c0f57600080fd5b823591506020830135613c2181613a54565b809150509250929050565b600060208284031215613c3e57600080fd5b81356001600160601b0381168114611c7957600080fd5b803560ff8116811461307457600080fd5b60008060408385031215613c7957600080fd5b8235613c8481613a54565b9150613c9260208401613c55565b90509250929050565b6020808252825182820181905260009190848201906040850190845b81811015613cd357835183529284019291840191600101613cb7565b50909695505050505050565b80356003811061307457600080fd5b600060208284031215613d0057600080fd5b611c7982613cdf565b600080600060608486031215613d1e57600080fd5b8335613d2981613a54565b9250613d3760208501613c55565b9150604084013561ffff81168114613d4e57600080fd5b809150509250925092565b600080600060408486031215613d6e57600080fd5b83356001600160401b0380821115613d8557600080fd5b818601915086601f830112613d9957600080fd5b813581811115613da857600080fd5b8760208260051b8501011115613dbd57600080fd5b602092830195509350613dd39186019050613cdf565b90509250925092565b60008060408385031215613def57600080fd5b8235613dfa81613a54565b9150613c9260208401613cdf565b8015158114610a3357600080fd5b600060208284031215613e2857600080fd5b8135611c7981613e08565b60008060408385031215613e4657600080fd5b8235613e5181613a54565b91506020830135613c2181613e08565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715613e9f57613e9f613e61565b604052919050565b60006001600160401b03821115613ec057613ec0613e61565b50601f01601f191660200190565b60008060008060808587031215613ee457600080fd5b8435613eef81613a54565b93506020850135613eff81613a54565b92506040850135915060608501356001600160401b03811115613f2157600080fd5b8501601f81018713613f3257600080fd5b8035613f45613f4082613ea7565b613e77565b818152886020838501011115613f5a57600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b6001600160601b0391909116815260200190565b60008060408385031215613fa357600080fd5b8235613fae81613a54565b91506020830135613c2181613a54565b600181811c90821680613fd257607f821691505b602082108103611ed957634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b81810381811115610a0557610a05613ff2565b8082028115828204841417610a0557610a05613ff2565b60008261404f57634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115610a0557610a05613ff2565b634e487b7160e01b600052603260045260246000fd5b60006001820161408f5761408f613ff2565b5060010190565b600060ff821660ff81036140ac576140ac613ff2565b60010192915050565b61ffff8181168382160190808211156140d0576140d0613ff2565b5092915050565b6000602082840312156140e957600080fd5b81516001600160401b038111156140ff57600080fd5b8201601f8101841361411057600080fd5b805161411e613f4082613ea7565b81815285602083850101111561413357600080fd5b61391d826020830160208601613a86565b6001600160401b038281168282160390808211156140d0576140d0613ff2565b6001600160401b038181168382160190808211156140d0576140d0613ff2565b60006020828403121561419657600080fd5b8151611c7981613e08565b60208082526034908201527f4552433732315073693a207472616e736665722063616c6c6572206973206e6f6040820152731d081bdddb995c881b9bdc88185c1c1c9bdd995960621b606082015260800190565b6020808252601c908201527b21b0b7103737ba1030b8383937bb32903637b1b5b2b2103a37b5b2b760211b604082015260600190565b6020808252602d908201527f5265737472696374417070726f76653a2043616e206e6f7420617070726f766560408201526c103637b1b5b2b2103a37b5b2b760991b606082015260800190565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8152600083516142aa816017850160208801613a86565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516142db816028840160208801613a86565b01602801949350505050565b60208082526035908201527f4552433732315073693a207472616e7366657220746f206e6f6e20455243373260408201527418a932b1b2b4bb32b91034b6b83632b6b2b73a32b960591b606082015260800190565b60008161434b5761434b613ff2565b506000190190565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061438690830184613aaa565b9695505050505050565b6000602082840312156143a257600080fd5b8151611c7981613a2156fe43f25613eb2f15fb17222a5d424ca2655743e71265d98e4b93c05e5fb589ecde73e573f9566d61418a34d5de3ff49360f9c51fec37f7486551670290f6285dabddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef0001020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7506264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c9071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee30e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf7ff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c816365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f6fe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf5fd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f8a2646970667358221220aae0fb4529e1e2536bfff0062fb5a073c9e9b121d9a8d3d21f79afcc2ff13c2764736f6c634300081100330001020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7506264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c9071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee30e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf7ff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c816365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f6fe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf5fd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f8
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061037e5760003560e01c806370a08231116101d6578063a41216ac1161010b578063a41216ac1461081c578063aa0e2ad61461082f578063ad2f852a14610841578063b31391cb14610854578063b88d4fde14610874578063b8997a9714610887578063bc98a00f146108ae578063c0d78655146108c1578063c87b56dd146108d4578063d5391393146108e7578063d547741f1461090e578063dbe4613d14610921578063e985e9c514610936578063eb05629714610949578063f2fde38b14610951578063f3b3059e14610964578063f6aacfb114610977578063f887ea401461098a578063fcd1aac9146109a357600080fd5b806370a08231146106e0578063715018a6146106f357806371745b62146106fb57806373f425611461070e57806379884269146107165780637c3dc173146107395780638462151c1461074c578063874a8b021461075f5780638d5b98d5146107725780638da5cb5b1461078557806391d148541461078d57806395323239146107a057806395d89b41146107b357806399f98898146107bb578063a059b164146107ce578063a217fddf146107e1578063a22cb465146107e9578063a35c23ad146107fc57600080fd5b806332cb6b0c116102b757806332cb6b0c1461054e57806336568abe14610575578063374032a114610588578063396e8f53146105955780633cf40df3146105a857806341f43434146105b557806342842e0e146105ca57806344f71db2146105dd57806347e63380146105f057806348521943146106055780634a4fbeec1461062b5780634b81d8bd1461063e5780634f3db3461461065e5780634fdaf05214610667578063526d5ca71461067a578063570009721461068d5780635aca43a2146106a757806360e7a0e6146106ba5780636352211e146106cd57600080fd5b806301ffc9a714610383578063025e332e146103ab57806306d254da146103c057806306fdde03146103d357806307265389146103e8578063081812fc146103fc578063095ea7b31461041c5780630f4345e21461042f57806310c395bf1461044257806313c528261461046157806318160ddd146104845780632398f8431461049a57806323b872dd146104ba578063248a9ca3146104cd578063282c51f3146104e05780632a55205a146105075780632f2ff15d1461052857806331faafb41461053b575b600080fd5b610396610391366004613a37565b6109b6565b60405190151581526020015b60405180910390f35b6103be6103b9366004613a69565b610a0b565b005b6103be6103ce366004613a69565b610a36565b6103db610a89565b6040516103a29190613ad6565b600c5461039690600160a01b900460ff1681565b61040f61040a366004613ae9565b610b1b565b6040516103a29190613b02565b6103be61042a366004613b16565b610bab565b6103be61043d366004613ae9565b610bf7565b60095461045490610100900460ff1681565b6040516103a29190613b58565b61045461046f366004613a69565b600b6020526000908152604090205460ff1681565b61048c610c06565b6040519081526020016103a2565b61048c6104a8366004613a69565b600e6020526000908152604090205481565b6103be6104c8366004613b80565b610c27565b61048c6104db366004613ae9565b610c52565b61048c7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84881565b61051a610515366004613bc1565b610c67565b6040516103a2929190613be3565b6103be610536366004613bfc565b610cad565b6103be610549366004613c2c565b610cc9565b61048c7f000000000000000000000000000000000000000000000000000000000000271081565b6103be610583366004613bfc565b610d29565b6009546103969060ff1681565b600c5461040f906001600160a01b031681565b6014546103969060ff1681565b61040f6daaeb6d7670e522a718067333cd4e81565b6103be6105d8366004613b80565b610da7565b6103be6105eb366004613ae9565b610dcc565b61048c6000805160206143ce83398151915281565b610618610613366004613c66565b610dff565b60405161ffff90911681526020016103a2565b610396610639366004613a69565b610ea8565b61065161064c366004613bc1565b610f5d565b6040516103a29190613c9b565b61048c600f5481565b6103be610675366004613cee565b61112b565b6103be610688366004613ae9565b61113e565b610695611156565b60405160ff90911681526020016103a2565b6103be6106b5366004613d09565b6111dc565b6103be6106c8366004613d09565b611388565b61040f6106db366004613ae9565b611611565b61048c6106ee366004613a69565b611625565b6103be6116b8565b6103be610709366004613d59565b6116cc565b61048c6116e1565b610454610724366004613ae9565b600a6020526000908152604090205460ff1681565b6103be610747366004613bc1565b6116eb565b61065161075a366004613a69565b61177b565b6103be61076d366004613ddc565b611841565b6103be610780366004613ae9565b611893565b61040f611998565b61039661079b366004613bfc565b6119a7565b6106956107ae366004613ae9565b6119d0565b6103db611a04565b6103be6107c9366004613b16565b611a13565b6103be6107dc366004613e16565b611a47565b61048c600081565b6103be6107f7366004613e33565b611a6f565b6103be61080a366004613ae9565b336000908152600e6020526040902055565b6103be61082a366004613e16565b611aad565b60145461069590610100900460ff1681565b60135461040f906001600160a01b031681565b61048c610862366004613ae9565b600d6020526000908152604090205481565b6103be610882366004613ece565b611aca565b6013546108a190600160a01b90046001600160601b031681565b6040516103a29190613f7c565b6103be6108bc366004613b16565b611af7565b6103be6108cf366004613a69565b611b0f565b6103db6108e2366004613ae9565b611b43565b61048c7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b6103be61091c366004613bfc565b611c80565b61048c6000805160206143ae83398151915281565b610396610944366004613f90565b611c9c565b610651611cd0565b6103be61095f366004613a69565b611cf1565b6103be610972366004613d59565b611d67565b610396610985366004613ae9565b611de2565b60145461040f906201000090046001600160a01b031681565b6103be6109b1366004613e16565b611edf565b60006001600160e01b0319821663152a902d60e11b14806109e757506001600160e01b031982166377bf11e760e11b145b806109f657506109f682612506565b80610a055750610a058261253b565b92915050565b610a156000612564565b600c80546001600160a01b0319166001600160a01b03831617905550565b50565b610a406000612564565b6001600160a01b038116610a675760405163d92e233d60e01b815260040160405180910390fd5b601380546001600160a01b0319166001600160a01b0392909216919091179055565b606060028054610a9890613fbe565b80601f0160208091040260200160405190810160405280929190818152602001828054610ac490613fbe565b8015610b115780601f10610ae657610100808354040283529160200191610b11565b820191906000526020600020905b815481529060010190602001808311610af457829003601f168201915b5050505050905090565b6000610b268261256e565b610b8f5760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a20617070726f76656420717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084015b60405180910390fd5b506000908152600660205260409020546001600160a01b031690565b81610bb581612591565b6001600160a01b03831615610be85760145460ff1615610be85760405163f30c72c560e01b815260040160405180910390fd5b610bf28383612641565b505050565b610c016000612564565b600f55565b6000610c10612655565b610c186126b7565b610c229190614008565b905090565b826001600160a01b0381163314610c4157610c4133612591565b610c4c8484846126c7565b50505050565b60009081526020819052604090206001015490565b60135460009081906001600160a01b0381169061271090610c9890600160a01b90046001600160601b03168661401b565b610ca29190614032565b915091509250929050565b610cb682610c52565b610cbf81612564565b610bf283836126f8565b610cd36000612564565b612710816001600160601b03161115610d0157806040516349d647ad60e01b8152600401610b869190613f7c565b601380546001600160601b03909216600160a01b026001600160a01b03909216919091179055565b6001600160a01b0381163314610d995760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610b86565b610da3828261277c565b5050565b826001600160a01b0381163314610dc157610dc133612591565b610c4c8484846127e1565b7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a848610df681612564565b610da3826127fc565b6001600160a01b0382166000908152601160209081526040808320815160c08101835290546001600160401b038082168352600160401b8204811694830194909452600160801b810490931691810191909152600160c01b820460ff90811660608301819052600160c81b840461ffff166080840152600160d81b90930464ffffffffff1660a0830152909190841614610e9d576000915050610a05565b608001519392505050565b60095460009060ff16610ebd57506000919050565b60026001600160a01b0383166000908152600b602052604090205460ff166002811115610eec57610eec613b42565b1480610f4857506001600160a01b0382166000908152600b602052604081205460ff166002811115610f2057610f20613b42565b148015610f4857506002600954610100900460ff166002811115610f4657610f46613b42565b145b15610f5557506001919050565b506000919050565b60606000610f6b8484614008565b610f76906001614054565b6001600160401b03811115610f8d57610f8d613e61565b604051908082528060200260200182016040528015610fb6578160200160208202803683370190505b509050600080855b85811161105e57610fce8161256e565b8015610fde5750610fde81611de2565b15611019576001848481518110610ff757610ff7614067565b91151560209283029190910190910152816110118161407d565b92505061103e565b600084848151811061102d5761102d614067565b911515602092830291909101909101525b826110488161407d565b93505080806110569061407d565b915050610fbe565b506000816001600160401b0381111561107957611079613e61565b6040519080825280602002602001820160405280156110a2578160200160208202803683370190505b5060009350905082875b87811161111e578585815181106110c5576110c5614067565b6020026020010151156110fe57808383815181106110e5576110e5614067565b6020908102919091010152816110fa8161407d565b9250505b846111088161407d565b95505080806111169061407d565b9150506110ac565b5090979650505050505050565b6111356000612564565b610a3381612856565b6000805160206143ae833981519152610df681612564565b60006000805160206143ce83398151915261117081612564565b6014805460009161010090910460ff1690600161118c83614096565b91906101000a81548160ff021916908360ff16021790555090508060ff167f39dedb493270cf57e3d892a36452ebba9db444e0d5406b467262f6b70448847b60405160405180910390a291505090565b6000805160206143ae8339815191526111f481612564565b6001600160a01b038416600090815260116020908152604091829020825160c08101845290546001600160401b038082168352600160401b8204811693830193909352600160801b810490921692810192909252600160c01b810460ff90811660608401819052600160c81b830461ffff166080850152600160d81b90920464ffffffffff1660a084015285161461129e5760ff8416606082015261ffff831660808201526112b8565b82816080018181516112b091906140b5565b61ffff169052505b6001600160a01b03909416600090815260116020908152604091829020865181549288015193880151606089015160808a015160a0909a015164ffffffffff16600160d81b026001600160d81b0361ffff909b16600160c81b029a909a166001600160c81b0360ff909216600160c01b0260ff60c01b196001600160401b03948516600160801b0216600160801b600160c81b0319988516600160401b026001600160801b0319909816949095169390931795909517959095169190911717929092161794909417909355505050565b6000805160206143ae8339815191526113a081612564565b600060116000866001600160a01b03166001600160a01b031681526020019081526020016000206040518060c00160405290816000820160009054906101000a90046001600160401b03166001600160401b03166001600160401b031681526020016000820160089054906101000a90046001600160401b03166001600160401b03166001600160401b031681526020016000820160109054906101000a90046001600160401b03166001600160401b03166001600160401b031681526020016000820160189054906101000a900460ff1660ff1660ff1681526020016000820160199054906101000a900461ffff1661ffff1661ffff16815260200160008201601b9054906101000a900464ffffffffff1664ffffffffff1664ffffffffff1681525050905083816060019060ff16908160ff168152505082816080019061ffff16908161ffff16815250508060116000876001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a8154816001600160401b0302191690836001600160401b0316021790555060208201518160000160086101000a8154816001600160401b0302191690836001600160401b0316021790555060408201518160000160106101000a8154816001600160401b0302191690836001600160401b0316021790555060608201518160000160186101000a81548160ff021916908360ff16021790555060808201518160000160196101000a81548161ffff021916908361ffff16021790555060a082015181600001601b6101000a81548164ffffffffff021916908364ffffffffff1602179055509050505050505050565b60008061161d8361287f565b509392505050565b60006001600160a01b0382166116935760405162461bcd60e51b815260206004820152602d60248201527f4552433732315073693a2062616c616e636520717565727920666f722074686560448201526c207a65726f206164647265737360981b6064820152608401610b86565b506001600160a01b03166000908152601160205260409020546001600160401b031690565b6116c0612916565b6116ca6000612975565b565b6116d66000612564565b610bf28383836129c7565b6000610c22612655565b816116f581611611565b6001600160a01b0316336001600160a01b0316146117685760405162461bcd60e51b815260206004820152602a60248201527f5265737472696374417070726f76653a206f7065726174696f6e206973206f6e604482015269363c903437b63232b91760b11b6064820152608401610b86565b506000918252600d602052604090912055565b606060008061178984611625565b90506000816001600160401b038111156117a5576117a5613e61565b6040519080825280602002602001820160405280156117ce578160200160208202803683370190505b50905060005b828414611838576117e48161256e565b1561183057856001600160a01b03166117fc82611611565b6001600160a01b031603611830578082858060010196508151811061182357611823614067565b6020026020010181815250505b6001016117d4565b50949350505050565b6001600160a01b03821633146118895760405162461bcd60e51b815260206004820152600d60248201526c3737ba103cb7bab939b2b6331760991b6044820152606401610b86565b610da38282612aab565b6000805160206143ce8339815191526118ab81612564565b60145460008381526012602052604081205461010090920460ff169190506118d28461256e565b6118f2576040516308ac597760e01b815260048101859052602401610b86565b8160ff166000036119165760405163038d6ce760e01b815260040160405180910390fd5b60ff8216611925826000612b34565b60ff1610611946576040516376de221360e01b815260040160405180910390fd5b60405160ff83169085907f73eca9ff1b97607af9c8765c3a002b2d958a586d5e014ab7b861210d55b338c190600090a3610c4c8461198683600086612b8a565b60009182526012602052604090912055565b6010546001600160a01b031690565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b60006119db8261256e565b6119fb576040516308ac597760e01b815260048101839052602401610b86565b610a0582612bee565b606060038054610a9890613fbe565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6611a3d81612564565b610bf28383612c07565b611a516000612564565b600c8054911515600160a01b0260ff60a01b19909216919091179055565b81611a7981612591565b8115611aa35760145460ff1615611aa35760405163f30c72c560e01b815260040160405180910390fd5b610bf28383612c63565b611ab76000612564565b6009805460ff1916911515919091179055565b836001600160a01b0381163314611ae457611ae433612591565b611af085858585612cca565b5050505050565b6000805160206143ae833981519152611a3d81612564565b611b196000612564565b601480546001600160a01b03909216620100000262010000600160b01b0319909216919091179055565b6014546060906201000090046001600160a01b0316611b755760405163179ce99f60e01b815260040160405180910390fd5b611b7e8261256e565b611b9e576040516308ac597760e01b815260048101839052602401610b86565b6000611ba983611de2565b611bb4576000611bb7565b60015b60ff169050611bdc611bcb60006001614054565b611bd485612bee565b839190612b8a565b6014549091506201000090046001600160a01b0316635eb8ac6684611c0081611611565b6040516001600160e01b031960e085901b16815260048101929092526001600160a01b0316602482015260448101849052606401600060405180830381865afa158015611c51573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611c7991908101906140d7565b9392505050565b611c8982610c52565b611c9281612564565b610bf2838361277c565b6000611ca783610ea8565b80611cb95750611cb78383612cfc565b155b15611cc657506000610a05565b611c798383612d1c565b6060600080611cde60055490565b9050611cea8282610f5d565b9250505090565b611cf9612916565b6001600160a01b038116611d5e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610b86565b610a3381612975565b60005b82811015611dd657611d93848483818110611d8757611d87614067565b90506020020135611611565b6001600160a01b0316336001600160a01b031614611dc45760405163e131a43f60e01b815260040160405180910390fd5b80611dce8161407d565b915050611d6a565b50610bf28383836129c7565b600081611dee8161256e565b611e505760405162461bcd60e51b815260206004820152602d60248201527f4c6f636b61626c653a206c6f636b696e6720717565727920666f72206e6f6e6560448201526c3c34b9ba32b73a103a37b5b2b760991b6064820152608401610b86565b60095460ff16611e635760009150611ed9565b60026000848152600a602052604090205460ff166002811115611e8857611e88613b42565b1480611ec657506000838152600a602052604081205460ff166002811115611eb257611eb2613b42565b148015611ec65750611ec661063984611611565b15611ed45760019150611ed9565b600091505b50919050565b611ee96000612564565b6014805460ff1916911515919091179055565b6000611f0760055490565b905060008211611f675760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a207175616e74697479206d7573742062652067726561604482015264074657220360dc1b6064820152608401610b86565b6001600160a01b038316611fc95760405162461bcd60e51b815260206004820152602360248201527f4552433732315073693a206d696e7420746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610b86565b611fd66000848385612d43565b8160056000828254611fe89190614054565b9091555050600081815260046020526040902080546001600160a01b0319166001600160a01b03851617905561201f600182612077565b61202c6000848385612d9e565b805b6120388383614054565b811015610c4c5760405181906001600160a01b038616906000906000805160206143ee833981519152908290a48061206f8161407d565b91505061202e565b600881901c600090815260209290925260409091208054600160ff1b60ff9093169290921c9091179055565b6000908152602091909152604090205490565b610c4c84848484612271565b600160401b81106120d257600080fd5b806001600160a01b0385161561213c576001600160a01b038516600090815260116020526040812080548392906121139084906001600160401b0316614144565b92506101000a8154816001600160401b0302191690836001600160401b0316021790555061219c565b6001600160a01b03841660009081526011602052604090208054829190600890612177908490600160401b90046001600160401b0316614164565b92506101000a8154816001600160401b0302191690836001600160401b031602179055505b6001600160a01b03841615612205576001600160a01b038416600090815260116020526040812080548392906121dc9084906001600160401b0316614164565b92506101000a8154816001600160401b0302191690836001600160401b03160217905550612265565b6001600160a01b03851660009081526011602052604090208054829190601090612240908490600160801b90046001600160401b0316614164565b92506101000a8154816001600160401b0302191690836001600160401b031602179055505b611af0858585856122fc565b6001600160a01b0384161580159061229157506001600160a01b03831615155b15610c4c5761229f82611de2565b15610c4c5760405162461bcd60e51b815260206004820152602760248201527f4c6f636b61626c653a2043616e206e6f74207472616e73666572206c6f636b6560448201526632103a37b5b2b760c91b6064820152608401610b86565b61230884848484612314565b610c4c8484848461233e565b6001600160a01b03841615610c4c576000828152600a60205260409020805460ff19169055610c4c565b6001600160a01b03841615610c4c576000828152600d6020526040812055610c4c565b600881901c600090815260208390526040902054600160ff1b60ff83161c16151592915050565b600061239360055490565b82108015610a055750600192915050565b600881901c60008181526020849052604081205490919060ff808516919082181c80156123e6576123d48161249c565b60ff168203600884901b179350612493565b600083116124535760405162461bcd60e51b815260206004820152603460248201527f4269744d6170733a205468652073657420626974206265666f7265207468652060448201527334b73232bc103237b2b9b713ba1032bc34b9ba1760611b6064820152608401610b86565b50600019909101600081815260208690526040902054909190801561248e5761247b8161249c565b60ff0360ff16600884901b179350612493565b6123e6565b50505092915050565b6000604051806101200160405280610100815260200161440e610100913960f87e818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff6124e585612e3b565b02901c815181106124f8576124f8614067565b016020015160f81c92915050565b60006001600160e01b03198216637965db0b60e01b1480610a0557506301ffc9a760e01b6001600160e01b0319831614610a05565b600061254682612e53565b80612555575061255582612e93565b80610a055750610a0582612eb8565b610a338133612edd565b600061257b600883612361565b1561258857506000919050565b610a0582612388565b6daaeb6d7670e522a718067333cd4e3b15610a3357604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa1580156125fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126229190614184565b610a335780604051633b79c77360e21b8152600401610b869190613b02565b61264b8282612f36565b610da38282612f4a565b6005546000908190819061266d9060081c6001614054565b9050815b818110156126b15760006126866008836120a3565b90506126918161305a565b61269b9086614054565b94505080806126a99061407d565b915050612671565b50505090565b600080600554610c229190614008565b6126d13382613079565b6126ed5760405162461bcd60e51b8152600401610b86906141a1565b610bf283838361313e565b61270282826119a7565b610da3576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556127383390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61278682826119a7565b15610da3576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b610bf283838360405180602001604052806000815250611aca565b600061280782611611565b9050612817816000846001612d43565b612822600883612077565b60405182906000906001600160a01b038416906000805160206143ee833981519152908390a4610da3816000846001612d9e565b6009805482919061ff00191661010083600281111561287757612877613b42565b021790555050565b60008061288b8361256e565b6128ec5760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a206f776e657220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610b86565b6128f58361331e565b6000818152600460205260409020546001600160a01b031694909350915050565b3361291f611998565b6001600160a01b0316146116ca5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b86565b601080546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60005b82811015610c4c5781600a60008686858181106129e9576129e9614067565b60209081029290920135835250810191909152604001600020805460ff19166001836002811115612a1c57612a1c613b42565b0217905550838382818110612a3357612a33614067565b90506020020135336001600160a01b0316612a59868685818110611d8757611d87614067565b6001600160a01b03167f80a668baf7ac68b329075f26c37b4428d4aa272c3bd4c9611b25f5fb1c473f7c85604051612a919190613b58565b60405180910390a480612aa38161407d565b9150506129ca565b6001600160a01b0382166000908152600b60205260409020805482919060ff19166001836002811115612ae057612ae0613b42565b0217905550336001600160a01b0316826001600160a01b03167f9fdb14457e6a7bd3753c649831b026de987c06e52d16459a928540738c2ea34b83604051612b289190613b58565b60405180910390a35050565b600060f8821115612b85576040805180820182526018815277706f736974696f6e2073686f756c64206f766572666c6f7760401b6020820152905162461bcd60e51b8152610b869190600401613ad6565b501c90565b600060f8831115612bdb576040805180820182526018815277706f736974696f6e2073686f756c64206f766572666c6f7760401b6020820152905162461bcd60e51b8152610b869190600401613ad6565b5060ff908116821b911b19919091161790565b600081815260126020526040812054610a059082612b34565b7f0000000000000000000000000000000000000000000000000000000000002710612c30610c06565b612c3a9083614054565b1115612c5957604051638a164f6360e01b815260040160405180910390fd5b610da38282611efc565b612c6c33610ea8565b1580612c76575080155b612c925760405162461bcd60e51b8152600401610b86906141f5565b612c9b8261332b565b80612ca4575080155b612cc05760405162461bcd60e51b8152600401610b869061422b565b610da38282613337565b612cd43383613079565b612cf05760405162461bcd60e51b8152600401610b86906141a1565b610c4c8484848461336f565b600080612d08846133a4565b9050612d1483826133e6565b949350505050565b6000612d288383612cfc565b1515600003612d3957506000610a05565b611c798383613475565b60145460ff168015612d5d57506001600160a01b03841615155b8015612d7457506001600160a01b03831661dead14155b15612d925760405163f30c72c560e01b815260040160405180910390fd5b610c4c848484846120b6565b6001600160a01b03841615801590612dc657506014546201000090046001600160a01b031615155b15612e2f576014546040516310745d3b60e11b815260048101849052620100009091046001600160a01b0316906320e8ba7690602401600060405180830381600087803b158015612e1657600080fd5b505af1158015612e2a573d6000803e3d6000fd5b505050505b610c4c848484846120c2565b6000808211612e4957600080fd5b5060008190031690565b60006001600160e01b031982166380ac58cd60e01b1480612e8457506001600160e01b03198216635b5e139f60e01b145b80610a055750610a0582612506565b60006001600160e01b03198216632742b5b960e01b1480610a055750610a0582612e53565b60006001600160e01b031982166303475db360e21b1480610a055750610a0582612e93565b612ee782826119a7565b610da357612ef4816134bb565b612eff8360206134cd565b604051602001612f10929190614278565b60408051601f198184030181529082905262461bcd60e51b8252610b8691600401613ad6565b612f408282613668565b610da382826136cd565b6000612f5582611611565b9050806001600160a01b0316836001600160a01b031603612fc45760405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a20617070726f76616c20746f2063757272656e74206f6044820152633bb732b960e11b6064820152608401610b86565b336001600160a01b0382161480612fe05750612fe08133611c9c565b6130505760405162461bcd60e51b815260206004820152603b60248201527f4552433732315073693a20617070726f76652063616c6c6572206973206e6f7460448201527a081bdddb995c881b9bdc88185c1c1c9bdd995908199bdc88185b1b602a1b6064820152608401610b86565b610bf28383613748565b60005b81156130745760001982019091169060010161305d565b919050565b60006130848261256e565b6130e85760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a206f70657261746f7220717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610b86565b60006130f383611611565b9050806001600160a01b0316846001600160a01b0316148061312e5750836001600160a01b031661312384610b1b565b6001600160a01b0316145b80612d145750612d148185611c9c565b60008061314a8361287f565b91509150846001600160a01b0316826001600160a01b0316146131c45760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a207472616e73666572206f6620746f6b656e2074686160448201526b3a1034b9903737ba1037bbb760a11b6064820152608401610b86565b6001600160a01b03841661322a5760405162461bcd60e51b815260206004820152602760248201527f4552433732315073693a207472616e7366657220746f20746865207a65726f206044820152666164647265737360c81b6064820152608401610b86565b6132378585856001612d43565b613242600084613748565b600061324f846001614054565b905061325c600182612361565b15801561326a575060055481105b156132a157600081815260046020526040902080546001600160a01b0319166001600160a01b0388161790556132a1600182612077565b600084815260046020526040902080546001600160a01b0319166001600160a01b0387161790558184146132da576132da600185612077565b83856001600160a01b0316876001600160a01b03166000805160206143ee83398151915260405160405180910390a46133168686866001612d9e565b505050505050565b6000610a056001836123a4565b6000610a053383612cfc565b6133408261332b565b80613349575080155b6133655760405162461bcd60e51b8152600401610b869061422b565b610da382826137b6565b61337a84848461313e565b6133888484846001856137ef565b610c4c5760405162461bcd60e51b8152600401610b86906142e7565b6001600160a01b0381166000908152600e6020526040812054156133de57506001600160a01b03166000908152600e602052604090205490565b5050600f5490565b600c54600090600160a01b900460ff1661340257506001610a05565b600c54604051630f8350ed60e41b81526001600160a01b039091169063f8350ed0906134349086908690600401613be3565b602060405180830381865afa158015613451573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c799190614184565b600061348083610ea8565b1561348d57506000610a05565b6001600160a01b0380841660009081526007602090815260408083209386168352929052205460ff16611c79565b6060610a056001600160a01b03831660145b606060006134dc83600261401b565b6134e7906002614054565b6001600160401b038111156134fe576134fe613e61565b6040519080825280601f01601f191660200182016040528015613528576020820181803683370190505b509050600360fc1b8160008151811061354357613543614067565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061357257613572614067565b60200101906001600160f81b031916908160001a905350600061359684600261401b565b6135a1906001614054565b90505b6001811115613619576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106135d5576135d5614067565b1a60f81b8282815181106135eb576135eb614067565b60200101906001600160f81b031916908160001a90535060049490941c936136128161433c565b90506135a4565b508315611c795760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610b86565b61367181611de2565b15610da35760405162461bcd60e51b815260206004820152602660248201527f4c6f636b61626c653a2043616e206e6f7420617070726f7665206c6f636b6564604482015265103a37b5b2b760d11b6064820152608401610b86565b6001600160a01b03821615610da3576136e68183613926565b610da35760405162461bcd60e51b815260206004820152602d60248201527f5265737472696374417070726f76653a2054686520636f6e747261637420697360448201526c103737ba1030b63637bbb2b21760991b6064820152608401610b86565b600081815260066020526040902080546001600160a01b0319166001600160a01b038416908117909155819061377d82611611565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6137bf33610ea8565b15806137c9575080155b6137e55760405162461bcd60e51b8152600401610b86906141f5565b610da38282613933565b60006001600160a01b0385163b1561391957506001835b6138108486614054565b81101561391357604051630a85bd0160e11b81526001600160a01b0387169063150b7a02906138499033908b9086908990600401614353565b6020604051808303816000875af1925050508015613884575060408051601f3d908101601f1916820190925261388191810190614390565b60015b6138e1573d8080156138b2576040519150601f19603f3d011682016040523d82523d6000602084013e6138b7565b606091505b5080516000036138d95760405162461bcd60e51b8152600401610b86906142e7565b805181602001fd5b8280156138fe57506001600160e01b03198116630a85bd0160e11b145b9250508061390b8161407d565b915050613806565b5061391d565b5060015b95945050505050565b600080612d0833856139ef565b336001600160a01b0383160361398a5760405162461bcd60e51b815260206004820152601c60248201527b22a9219b9918a839b49d1030b8383937bb32903a379031b0b63632b960211b6044820152606401610b86565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319101612b28565b6000818152600d602052604081205415613a1857506000818152600d6020526040902054610a05565b611c79836133a4565b6001600160e01b031981168114610a3357600080fd5b600060208284031215613a4957600080fd5b8135611c7981613a21565b6001600160a01b0381168114610a3357600080fd5b600060208284031215613a7b57600080fd5b8135611c7981613a54565b60005b83811015613aa1578181015183820152602001613a89565b50506000910152565b60008151808452613ac2816020860160208601613a86565b601f01601f19169290920160200192915050565b602081526000611c796020830184613aaa565b600060208284031215613afb57600080fd5b5035919050565b6001600160a01b0391909116815260200190565b60008060408385031215613b2957600080fd5b8235613b3481613a54565b946020939093013593505050565b634e487b7160e01b600052602160045260246000fd5b6020810160038310613b7a57634e487b7160e01b600052602160045260246000fd5b91905290565b600080600060608486031215613b9557600080fd5b8335613ba081613a54565b92506020840135613bb081613a54565b929592945050506040919091013590565b60008060408385031215613bd457600080fd5b50508035926020909101359150565b6001600160a01b03929092168252602082015260400190565b60008060408385031215613c0f57600080fd5b823591506020830135613c2181613a54565b809150509250929050565b600060208284031215613c3e57600080fd5b81356001600160601b0381168114611c7957600080fd5b803560ff8116811461307457600080fd5b60008060408385031215613c7957600080fd5b8235613c8481613a54565b9150613c9260208401613c55565b90509250929050565b6020808252825182820181905260009190848201906040850190845b81811015613cd357835183529284019291840191600101613cb7565b50909695505050505050565b80356003811061307457600080fd5b600060208284031215613d0057600080fd5b611c7982613cdf565b600080600060608486031215613d1e57600080fd5b8335613d2981613a54565b9250613d3760208501613c55565b9150604084013561ffff81168114613d4e57600080fd5b809150509250925092565b600080600060408486031215613d6e57600080fd5b83356001600160401b0380821115613d8557600080fd5b818601915086601f830112613d9957600080fd5b813581811115613da857600080fd5b8760208260051b8501011115613dbd57600080fd5b602092830195509350613dd39186019050613cdf565b90509250925092565b60008060408385031215613def57600080fd5b8235613dfa81613a54565b9150613c9260208401613cdf565b8015158114610a3357600080fd5b600060208284031215613e2857600080fd5b8135611c7981613e08565b60008060408385031215613e4657600080fd5b8235613e5181613a54565b91506020830135613c2181613e08565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715613e9f57613e9f613e61565b604052919050565b60006001600160401b03821115613ec057613ec0613e61565b50601f01601f191660200190565b60008060008060808587031215613ee457600080fd5b8435613eef81613a54565b93506020850135613eff81613a54565b92506040850135915060608501356001600160401b03811115613f2157600080fd5b8501601f81018713613f3257600080fd5b8035613f45613f4082613ea7565b613e77565b818152886020838501011115613f5a57600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b6001600160601b0391909116815260200190565b60008060408385031215613fa357600080fd5b8235613fae81613a54565b91506020830135613c2181613a54565b600181811c90821680613fd257607f821691505b602082108103611ed957634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b81810381811115610a0557610a05613ff2565b8082028115828204841417610a0557610a05613ff2565b60008261404f57634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115610a0557610a05613ff2565b634e487b7160e01b600052603260045260246000fd5b60006001820161408f5761408f613ff2565b5060010190565b600060ff821660ff81036140ac576140ac613ff2565b60010192915050565b61ffff8181168382160190808211156140d0576140d0613ff2565b5092915050565b6000602082840312156140e957600080fd5b81516001600160401b038111156140ff57600080fd5b8201601f8101841361411057600080fd5b805161411e613f4082613ea7565b81815285602083850101111561413357600080fd5b61391d826020830160208601613a86565b6001600160401b038281168282160390808211156140d0576140d0613ff2565b6001600160401b038181168382160190808211156140d0576140d0613ff2565b60006020828403121561419657600080fd5b8151611c7981613e08565b60208082526034908201527f4552433732315073693a207472616e736665722063616c6c6572206973206e6f6040820152731d081bdddb995c881b9bdc88185c1c1c9bdd995960621b606082015260800190565b6020808252601c908201527b21b0b7103737ba1030b8383937bb32903637b1b5b2b2103a37b5b2b760211b604082015260600190565b6020808252602d908201527f5265737472696374417070726f76653a2043616e206e6f7420617070726f766560408201526c103637b1b5b2b2103a37b5b2b760991b606082015260800190565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8152600083516142aa816017850160208801613a86565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516142db816028840160208801613a86565b01602801949350505050565b60208082526035908201527f4552433732315073693a207472616e7366657220746f206e6f6e20455243373260408201527418a932b1b2b4bb32b91034b6b83632b6b2b73a32b960591b606082015260800190565b60008161434b5761434b613ff2565b506000190190565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061438690830184613aaa565b9695505050505050565b6000602082840312156143a257600080fd5b8151611c7981613a2156fe43f25613eb2f15fb17222a5d424ca2655743e71265d98e4b93c05e5fb589ecde73e573f9566d61418a34d5de3ff49360f9c51fec37f7486551670290f6285dabddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef0001020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7506264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c9071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee30e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf7ff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c816365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f6fe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf5fd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f8a2646970667358221220aae0fb4529e1e2536bfff0062fb5a073c9e9b121d9a8d3d21f79afcc2ff13c2764736f6c63430008110033
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
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.