Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
TokenTracker
Loading...
Loading
Contract Name:
BabyBunta2
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 10 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.9; //import "erc721psi/contracts/ERC721Psi.sol"; import "erc721psi/contracts/extension/ERC721PsiAddressData.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; import "./libs/DefaultOperatorFilterer.sol"; import "./libs/IDescriptor.sol"; import "./libs/IContractAllowListProxy.sol"; import "@openzeppelin/contracts/interfaces/IERC2981.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; abstract contract BabyBunta2State { /////////////////////////////////////////////////////////////////////////// // Enum /////////////////////////////////////////////////////////////////////////// enum SalePhase { FreeMint, PreSale, PublicSale } /////////////////////////////////////////////////////////////////////////// // Constants /////////////////////////////////////////////////////////////////////////// uint256 public constant MAX_SUPPLY = 1000; uint8 public constant ALLOCATION_FOR_FREE_MINT = 2; uint8 public constant ALLOCATION_FOR_ALLOW_LIST = 5; address public constant WITHDRAW_ADDRESS = 0xFBa08BBFf544A20CaAa6e2278BED853f5Ed88648; /////////////////////////////////////////////////////////////////////////// // Variables /////////////////////////////////////////////////////////////////////////// // CAL IContractAllowListProxy public CAL; uint256 public CALLevel = 1; // MintAmountLimitation : This array is used as CONSTANT uint16[3] public maxMintAmount = [ ALLOCATION_FOR_FREE_MINT, ALLOCATION_FOR_ALLOW_LIST, 2 ]; // AL mapping(address => uint256) public freeMintList; mapping(address => uint256) public preSaleList; mapping(address => uint16[2]) public limitedMintedAmount; // Sale Status bool public paused = true; SalePhase public salePhase; // Automatic sale control bool public usePeriodSale = true; uint256[3] public timeStart = [ 1669719900, /* 11/29 2005 */ 1669806300, /* 11/30 2005 */ 1669892700 /* 12/1 2005*/ ]; uint256[3] public timeDuration = [ 2 hours - 300, 4 hours - 300, 7 days - 300 ]; // cost uint256[3] public cost = [0, 0.005 ether, 0.008 ether]; // metadata IDescriptor public descriptor; // royalty address public royaltyAddress = WITHDRAW_ADDRESS; uint96 public royaltyFee = 1000; // default:10% // SBT bool public isSBT; /////////////////////////////////////////////////////////////////////////// // Error Functions /////////////////////////////////////////////////////////////////////////// error ZeroAddress(); error InvlidRoyaltyFee(uint256 fee); error SaleIsPaused(); error NoAllocationInThisSale(); error InsufficientAllocation(); error MintAmountExceeded(); error MaxSupplyExceeded(); error InsufficientFunds(); error CallerNotUser(); error MintAmountIsZero(); error ProhibitedBecauseSBT(); error NotAllowedByCAL(address operator); } abstract contract BabyBunta2Admin is BabyBunta2State, IERC2981, DefaultOperatorFilterer, AccessControl, Ownable, ERC721PsiAddressData { /////////////////////////////////////////////////////////////////////////// // Withdraw funds /////////////////////////////////////////////////////////////////////////// function withdraw() public onlyOwner { (bool os, ) = payable(WITHDRAW_ADDRESS).call{ value: address(this).balance }(""); require(os); } /////////////////////////////////////////////////////////////////////////// // Owner Mint function /////////////////////////////////////////////////////////////////////////// function ownerMint(address to, uint256 quantity) public onlyOwner { _mint(to, quantity); } /////////////////////////////////////////////////////////////////////////// // Setter functions /////////////////////////////////////////////////////////////////////////// function setPause(bool _state) external onlyAdmin { paused = _state; } function setSalePhase(SalePhase _phase) external onlyAdmin { salePhase = _phase; } function setCost(uint256 _newCost, SalePhase _target) external onlyAdmin { cost[uint256(_target)] = _newCost; } function setFreeMintList(address[] memory _addr, bool _state) external onlyOwner { uint256 l = _addr.length; uint8 newAlloc; if (_state) { newAlloc = ALLOCATION_FOR_FREE_MINT; } for (uint256 i = 0; i < l; i++) { freeMintList[_addr[i]] = newAlloc; } } function setPreSaleList(address[] memory _addr, bool _state) external onlyOwner { uint256 l = _addr.length; uint8 newAlloc; // =0 if (_state) { newAlloc = ALLOCATION_FOR_ALLOW_LIST; } for (uint256 i = 0; i < l; i++) { preSaleList[_addr[i]] = newAlloc; } } function setDescriptor(IDescriptor _new) external onlyAdmin { descriptor = _new; } 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; } function setIsSBT(bool _state) external onlyAdmin { isSBT = _state; } function setTimeStart(uint256 index, uint256 newTime) external onlyAdmin { timeStart[index] = newTime; } function setTimeDuration(uint256 index, uint256 newDuration) external onlyAdmin { timeDuration[index] = newDuration; } function setUsePeriodSale(bool _state) external onlyAdmin { usePeriodSale = _state; } function setCAL(IContractAllowListProxy _newCAL) external onlyAdmin { CAL = _newCAL; } function setCALLevel(uint256 _newLevel) external onlyAdmin { CALLevel = _newLevel; } /////////////////////////////////////////////////////////////////////////// // Essential getter functions /////////////////////////////////////////////////////////////////////////// /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(AccessControl, IERC165, ERC721Psi) returns (bool) { return interfaceId == type(IERC2981).interfaceId || AccessControl.supportsInterface(interfaceId) || super.supportsInterface(interfaceId); } /** * @inheritdoc IERC2981 */ function royaltyInfo( uint256, /*_tokenId*/ uint256 _salePrice ) public view virtual override returns (address, uint256) { return (royaltyAddress, (_salePrice * uint256(royaltyFee)) / 10000); } /////////////////////////////////////////////////////////////////////////// // Modifiers /////////////////////////////////////////////////////////////////////////// modifier onlyAdmin() { _checkRole(DEFAULT_ADMIN_ROLE); _; } modifier whenOnSale() { if (paused) { if (!usePeriodSale) { revert SaleIsPaused(); } else { uint256 phase = uint256(salePhase); uint256 start = timeStart[phase]; if (block.timestamp < start) revert SaleIsPaused(); if (block.timestamp > start + timeDuration[phase]) revert SaleIsPaused(); } } _; } modifier onlyValidMinter() { if (salePhase == SalePhase.FreeMint) { if (freeMintList[msg.sender] == 0) revert NoAllocationInThisSale(); } if (salePhase == SalePhase.PreSale) { if (preSaleList[msg.sender] == 0) revert NoAllocationInThisSale(); } _; } modifier callerIsUser() { if (tx.origin != msg.sender) revert CallerNotUser(); _; } modifier whenValidMintAmount(uint256 amount) { // Check mint amount in one transaction if (amount > maxMintAmount[uint256(salePhase)]) revert MintAmountExceeded(); if (amount == 0) revert MintAmountIsZero(); // Check remaining quantity of allocation if (salePhase != SalePhase.PublicSale) { uint256 alloc = (salePhase == SalePhase.FreeMint) ? freeMintList[msg.sender] : preSaleList[msg.sender]; if ( alloc < amount + limitedMintedAmount[msg.sender][uint256(salePhase)] ) revert InsufficientAllocation(); } _; } modifier whenEnoughFunds(uint256 value, uint256 amount) { if (value < (amount * cost[uint256(salePhase)])) revert InsufficientFunds(); _; } } contract BabyBunta2 is BabyBunta2Admin { using Strings for uint256; /////////////////////////////////////////////////////////////////////////// // Constructor /////////////////////////////////////////////////////////////////////////// constructor() ERC721Psi("BabyBunta 2nd collection", "BBC") { _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); // TODO _mint(WITHDRAW_ADDRESS, 1); // _mint(owner(), 10); } /////////////////////////////////////////////////////////////////////////// // Mint functions /////////////////////////////////////////////////////////////////////////// function mint(uint256 amount) external payable whenOnSale onlyValidMinter callerIsUser whenValidMintAmount(amount) whenEnoughFunds(msg.value, amount) { if (salePhase != SalePhase.PublicSale) { limitedMintedAmount[msg.sender][uint256(salePhase)] += uint16( amount ); } // CallerIsUserなので、_safeMintを使う必要はない _mint(msg.sender, amount); } function _mint(address to, uint256 quantity) internal override { if (quantity + totalSupply() > MAX_SUPPLY) revert MaxSupplyExceeded(); super._mint(to, quantity); } /////////////////////////////////////////////////////////////////////////// // State functions /////////////////////////////////////////////////////////////////////////// function nowOnSale() external view whenOnSale returns (bool) { return true; } /////////////////////////////////////////////////////////////////////////// // Metadata functions /////////////////////////////////////////////////////////////////////////// function tokenURI(uint256 tokenId) public view override returns (string memory) { require(_exists(tokenId), "ERC721Psi: URI query for nonexistent token"); return descriptor.tokenURI(tokenId); } /////////////////////////////////////////////////////////////////////////// // 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 { if (approved){ if (isSBT) revert ProhibitedBecauseSBT(); if (address(CAL) != address(0)){ if (!CAL.isAllowed(operator, CALLevel)) revert NotAllowedByCAL(operator); } } super.setApprovalForAll(operator, approved); } function approve(address to, uint256 tokenId) public virtual override { if (to != address(0)) { if (isSBT) revert ProhibitedBecauseSBT(); if (address(CAL) != address(0)){ if (!CAL.isAllowed(to, CALLevel)) revert NotAllowedByCAL(to); } } super.approve(to, tokenId); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(account), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. * * _Available since v4.5._ */ interface IERC2981 is IERC165 { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be paid in that same unit of exchange. */ function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); }
// 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 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.13; import {OperatorFilterer} from "./OperatorFilterer.sol"; abstract contract DefaultOperatorFilterer is OperatorFilterer { address constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6); constructor() OperatorFilterer(DEFAULT_SUBSCRIPTION, true) {} }
// SPDX-License-Identifier: MIT pragma solidity >=0.7.0 <0.9.0; interface IContractAllowListProxy { // -------------------------------------------------------------------------- // For user // -------------------------------------------------------------------------- function isAllowed(address transferer,uint256 level) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; interface IDescriptor { function tokenURI(uint256 tokenId) external view returns (string memory); }
// 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 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"; abstract contract OperatorFilterer { error OperatorNotAllowed(address operator); IOperatorFilterRegistry constant operatorFilterRegistry = 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(operatorFilterRegistry).code.length > 0) { if (subscribe) { operatorFilterRegistry.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy); } else { if (subscriptionOrRegistrantToCopy != address(0)) { operatorFilterRegistry.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy); } else { operatorFilterRegistry.register(address(this)); } } } } modifier onlyAllowedOperator(address from) virtual { // Check registry code length to facilitate testing in environments without a deployed registry. if (address(operatorFilterRegistry).code.length > 0) { // 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) { _; return; } if ( !( operatorFilterRegistry.isOperatorAllowed(address(this), msg.sender) && operatorFilterRegistry.isOperatorAllowed(address(this), from) ) ) { revert OperatorNotAllowed(msg.sender); } } _; } }
// SPDX-License-Identifier: MIT /** ______ _____ _____ ______ ___ __ _ _ _ | ____| __ \ / ____|____ |__ \/_ | || || | | |__ | |__) | | / / ) || | \| |/ | | __| | _ /| | / / / / | |\_ _/ | |____| | \ \| |____ / / / /_ | | | | |______|_| \_\\_____|/_/ |____||_| |_| */ 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/token/ERC721/extensions/IERC721Enumerable.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, IERC721Enumerable { 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 internal _minted; 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_; } /** * @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 || interfaceId == type(IERC721Enumerable).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; i < _minted; ++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 < _minted; } /** * @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 startTokenId = _minted; _mint(to, quantity); require( _checkOnERC721Received(address(0), to, startTokenId, quantity, _data), "ERC721Psi: transfer to non ERC721Receiver implementer" ); } function _mint( address to, uint256 quantity ) internal virtual { uint256 tokenIdBatchHead = _minted; require(quantity > 0, "ERC721Psi: quantity must be greater 0"); require(to != address(0), "ERC721Psi: mint to the zero address"); _beforeTokenTransfers(address(0), to, tokenIdBatchHead, quantity); _minted += quantity; _owners[tokenIdBatchHead] = to; _batchHead.set(tokenIdBatchHead); _afterTokenTransfers(address(0), to, tokenIdBatchHead, quantity); // Emit events for(uint256 tokenId=tokenIdBatchHead;tokenId < tokenIdBatchHead + 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 nextTokenId = tokenId + 1; if(!_batchHead.get(nextTokenId) && nextTokenId < _minted ) { _owners[nextTokenId] = from; _batchHead.set(nextTokenId); } _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); } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _minted; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256 tokenId) { require(index < totalSupply(), "ERC721Psi: global index out of bounds"); uint count; for(uint i; i < _minted; i++){ if(_exists(i)){ if(count == index) return i; else count++; } } } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256 tokenId) { uint count; for(uint i; i < _minted; i++){ if(_exists(i) && owner == ownerOf(i)){ if(count == index) return i; else count++; } } revert("ERC721Psi: owner index out of bounds"); } /** * @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"; /** @dev This extension follows the AddressData format of ERC721A, so it can be a dropped-in replacement for the contract that requires AddressData */ abstract contract ERC721PsiAddressData is ERC721Psi { // 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; } /** * @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 /** _____ ___ ___ __ ____ _ __ / ___/____ / (_)___/ (_) /___ __ / __ )(_) /______ \__ \/ __ \/ / / __ / / __/ / / / / __ / / __/ ___/ ___/ / /_/ / / / /_/ / / /_/ /_/ / / /_/ / / /_(__ ) /____/\____/_/_/\__,_/_/\__/\__, / /_____/_/\__/____/ /____/ - 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": 10 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"CallerNotUser","type":"error"},{"inputs":[],"name":"InsufficientAllocation","type":"error"},{"inputs":[],"name":"InsufficientFunds","type":"error"},{"inputs":[{"internalType":"uint256","name":"fee","type":"uint256"}],"name":"InvlidRoyaltyFee","type":"error"},{"inputs":[],"name":"MaxSupplyExceeded","type":"error"},{"inputs":[],"name":"MintAmountExceeded","type":"error"},{"inputs":[],"name":"MintAmountIsZero","type":"error"},{"inputs":[],"name":"NoAllocationInThisSale","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"NotAllowedByCAL","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"OperatorNotAllowed","type":"error"},{"inputs":[],"name":"ProhibitedBecauseSBT","type":"error"},{"inputs":[],"name":"SaleIsPaused","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"ALLOCATION_FOR_ALLOW_LIST","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ALLOCATION_FOR_FREE_MINT","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"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":"WITHDRAW_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"cost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"descriptor","outputs":[{"internalType":"contract IDescriptor","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"freeMintList","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isSBT","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"limitedMintedAmount","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"maxMintAmount","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nowOnSale","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"ownerMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"preSaleList","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"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":[],"name":"salePhase","outputs":[{"internalType":"enum BabyBunta2State.SalePhase","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IContractAllowListProxy","name":"_newCAL","type":"address"}],"name":"setCAL","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newLevel","type":"uint256"}],"name":"setCALLevel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newCost","type":"uint256"},{"internalType":"enum BabyBunta2State.SalePhase","name":"_target","type":"uint8"}],"name":"setCost","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IDescriptor","name":"_new","type":"address"}],"name":"setDescriptor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_addr","type":"address[]"},{"internalType":"bool","name":"_state","type":"bool"}],"name":"setFreeMintList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_state","type":"bool"}],"name":"setIsSBT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_state","type":"bool"}],"name":"setPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_addr","type":"address[]"},{"internalType":"bool","name":"_state","type":"bool"}],"name":"setPreSaleList","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":"enum BabyBunta2State.SalePhase","name":"_phase","type":"uint8"}],"name":"setSalePhase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"uint256","name":"newDuration","type":"uint256"}],"name":"setTimeDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"uint256","name":"newTime","type":"uint256"}],"name":"setTimeStart","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_state","type":"bool"}],"name":"setUsePeriodSale","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":"timeDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"timeStart","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"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":[],"name":"usePeriodSale","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
6001805560e060405260026080818152600560a05260c082905262000027919060036200088c565b506006805462ff00ff19166201000117905560408051606081018252636385e75c815263638738dc60208201526363888a5c918101919091526200007090600790600362000928565b5060408051606081018252611af4815261371460208201526209395491810191909152620000a390600a90600362000961565b5060408051606081018252600081526611c37937e080006020820152661c6bf52634000091810191909152620000de90600d90600362000999565b507503e8fba08bbff544a20caaa6e2278bed853f5ed886486011553480156200010657600080fd5b50604080518082018252601881527f4261627942756e746120326e6420636f6c6c656374696f6e00000000000000006020808301919091528251808401909352600383526242424360e81b9083015290733cc6cdda760b79bafa08df41ecfa224f810dceb660016daaeb6d7670e522a718067333cd4e3b15620002b25780156200020057604051633e9f1edf60e11b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e90637d3e3dbe906044015b600060405180830381600087803b158015620001e157600080fd5b505af1158015620001f6573d6000803e3d6000fd5b50505050620002b2565b6001600160a01b03821615620002515760405163a0af290360e01b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e9063a0af290390604401620001c6565b604051632210724360e11b81523060048201526daaeb6d7670e522a718067333cd4e90634420e48690602401600060405180830381600087803b1580156200029857600080fd5b505af1158015620002ad573d6000803e3d6000fd5b505050505b50620002c090503362000316565b6016620002ce838262000a91565b506017620002dd828262000a91565b50620002ef9150600090503362000368565b6200031073fba08bbff544a20caaa6e2278bed853f5ed886486001620003f3565b62000bf2565b601480546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b62000374828262000443565b620003ef5760008281526013602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620003ae3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b6103e86200040060195490565b6200040c908362000b73565b11156200042c57604051638a164f6360e01b815260040160405180910390fd5b620003ef82826200047060201b620020681760201c565b60008281526013602090815260408083206001600160a01b038516845290915290205460ff165b92915050565b60195481620004d45760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a207175616e74697479206d7573742062652067726561604482015264074657220360dc1b60648201526084015b60405180910390fd5b6001600160a01b038316620005385760405162461bcd60e51b815260206004820152602360248201527f4552433732315073693a206d696e7420746f20746865207a65726f206164647260448201526265737360e81b6064820152608401620004cb565b6200054760008483856200061b565b81601960008282546200055b919062000b73565b9091555050600081815260186020908152604090912080546001600160a01b0319166001600160a01b038616179055620005a390601590839062000686811b620021d617901c565b620005b26000848385620006b2565b805b620005c0838362000b73565b811015620006155760405181906001600160a01b038616906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4806200060c8162000b89565b915050620005b4565b50505050565b60125460ff1680156200063657506001600160a01b03841615155b80156200064e57506001600160a01b03831661dead14155b156200066d5760405163f30c72c560e01b815260040160405180910390fd5b62000615848484846200061560201b62000fcb1760201c565b600881901c600090815260209290925260409091208054600160ff1b60ff9093169290921c9091179055565b680100000000000000008110620006c857600080fd5b806001600160a01b0385161562000736576001600160a01b0385166000908152601c6020526040812080548392906200070c9084906001600160401b031662000ba5565b92506101000a8154816001600160401b0302191690836001600160401b031602179055506200079d565b6001600160a01b0384166000908152601c602052604090208054829190600890620007789084906801000000000000000090046001600160401b031662000bcf565b92506101000a8154816001600160401b0302191690836001600160401b031602179055505b6001600160a01b038416156200080a576001600160a01b0384166000908152601c602052604081208054839290620007e09084906001600160401b031662000bcf565b92506101000a8154816001600160401b0302191690836001600160401b031602179055506200086c565b6001600160a01b0385166000908152601c60205260409020805482919060109062000847908490600160801b90046001600160401b031662000bcf565b92506101000a8154816001600160401b0302191690836001600160401b031602179055505b62000885858585856200061560201b62000fcb1760201c565b5050505050565b600183019183908215620009165791602002820160005b83821115620008e457835183826101000a81548161ffff021916908360ff1602179055509260200192600201602081600101049283019260010302620008a3565b8015620009145782816101000a81549061ffff0219169055600201602081600101049283019260010302620008e4565b505b5062000924929150620009d5565b5090565b826003810192821562000916579160200282015b8281111562000916578251829063ffffffff169055916020019190600101906200093c565b826003810192821562000916579160200282015b8281111562000916578251829062ffffff1690559160200191906001019062000975565b826003810192821562000916579160200282015b8281111562000916578251829066ffffffffffffff16905591602001919060010190620009ad565b5b80821115620009245760008155600101620009d6565b634e487b7160e01b600052604160045260246000fd5b600181811c9082168062000a1757607f821691505b60208210810362000a3857634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111562000a8c57600081815260208120601f850160051c8101602086101562000a675750805b601f850160051c820191505b8181101562000a885782815560010162000a73565b5050505b505050565b81516001600160401b0381111562000aad5762000aad620009ec565b62000ac58162000abe845462000a02565b8462000a3e565b602080601f83116001811462000afd576000841562000ae45750858301515b600019600386901b1c1916600185901b17855562000a88565b600085815260208120601f198616915b8281101562000b2e5788860151825594840194600190910190840162000b0d565b508582101562000b4d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052601160045260246000fd5b808201808211156200046a576200046a62000b5d565b60006001820162000b9e5762000b9e62000b5d565b5060010190565b6001600160401b0382811682821603908082111562000bc85762000bc862000b5d565b5092915050565b6001600160401b0381811683821601908082111562000bc85762000bc862000b5d565b613b258062000c026000396000f3fe6080604052600436106102e35760003560e01c806355c492381161018257806355c492381461070d5780635c975abb1461072d5780636352211e1461074757806370a0823114610767578063715018a614610787578063785cdcf01461079c5780637ad59431146107c95780638da5cb5b146107e95780639097548d146107fe57806391d148541461081e57806395d89b411461083e578063a0712d6814610853578063a18b1d4814610866578063a217fddf14610886578063a22cb4651461089b578063a5324093146108bb578063ad2f852a146108e8578063b88d4fde14610908578063b8997a9714610928578063bedb86fb1461095c578063c87b56dd1461097c578063cb8fbbd21461099c578063ccc3abe2146109b1578063cf3d49c4146109d1578063d547741f146109f1578063dee78a4314610a11578063df9cc7e314610a31578063e3bb2eec14610a51578063e4f2487a14610a71578063e985e9c514610a9d578063f2fde38b14610abd578063fcd1aac914610add57600080fd5b806301b9a397146102e857806301ffc9a71461030a578063025e332e1461033f57806306d254da1461035f57806306fdde031461037f578063081812fc146103a157806308e8dec6146103ce578063095ea7b3146103ee5780630f4345e21461040e578063122e04a81461042e57806318160ddd1461045657806323b872dd14610475578063248a9ca3146104955780632a55205a146104b55780632bc0e377146104e35780632f2ff15d146104f85780632f745c5914610518578063303e74df1461053857806331faafb41461055857806332cb6b0c1461057857806336568abe1461058e578063396e8f53146105ae5780633c215c91146105ce5780633ccfd60b146105ee5780633cf40df3146106035780633f5ecdf11461061d57806342842e0e1461065057806346b7d75514610670578063484b973c146106905780634915122a146106b05780634f3db346146106d75780634f6ccce7146106ed575b600080fd5b3480156102f457600080fd5b50610308610303366004613177565b610afd565b005b34801561031657600080fd5b5061032a6103253660046131aa565b610b29565b60405190151581526020015b60405180910390f35b34801561034b57600080fd5b5061030861035a366004613177565b610b63565b34801561036b57600080fd5b5061030861037a366004613177565b610b8f565b34801561038b57600080fd5b50610394610be2565b6040516103369190613217565b3480156103ad57600080fd5b506103c16103bc36600461322a565b610c74565b6040516103369190613243565b3480156103da57600080fd5b506103086103e93660046132bb565b610d06565b3480156103fa57600080fd5b5061030861040936600461337e565b610d87565b34801561041a57600080fd5b5061030861042936600461322a565b610e6d565b34801561043a57600080fd5b506103c173fba08bbff544a20caaa6e2278bed853f5ed8864881565b34801561046257600080fd5b506019545b604051908152602001610336565b34801561048157600080fd5b506103086104903660046133aa565b610e7c565b3480156104a157600080fd5b506104676104b036600461322a565b610fd1565b3480156104c157600080fd5b506104d56104d03660046133eb565b610fe6565b60405161033692919061340d565b3480156104ef57600080fd5b5061032a61102c565b34801561050457600080fd5b50610308610513366004613426565b611106565b34801561052457600080fd5b5061046761053336600461337e565b611127565b34801561054457600080fd5b506010546103c1906001600160a01b031681565b34801561056457600080fd5b50610308610573366004613456565b6111f1565b34801561058457600080fd5b506104676103e881565b34801561059a57600080fd5b506103086105a9366004613426565b611250565b3480156105ba57600080fd5b506000546103c1906001600160a01b031681565b3480156105da57600080fd5b506103086105e936600461348e565b6112ca565b3480156105fa57600080fd5b506103086112ff565b34801561060f57600080fd5b5060125461032a9060ff1681565b34801561062957600080fd5b5061063d61063836600461322a565b611373565b60405161ffff9091168152602001610336565b34801561065c57600080fd5b5061030861066b3660046133aa565b6113a1565b34801561067c57600080fd5b5061030861068b3660046134ba565b6114eb565b34801561069c57600080fd5b506103086106ab36600461337e565b611511565b3480156106bc57600080fd5b506106c5600581565b60405160ff9091168152602001610336565b3480156106e357600080fd5b5061046760015481565b3480156106f957600080fd5b5061046761070836600461322a565b611523565b34801561071957600080fd5b506103086107283660046133eb565b6115dd565b34801561073957600080fd5b5060065461032a9060ff1681565b34801561075357600080fd5b506103c161076236600461322a565b6115fb565b34801561077357600080fd5b50610467610782366004613177565b61160f565b34801561079357600080fd5b506103086116a2565b3480156107a857600080fd5b506104676107b7366004613177565b60046020526000908152604090205481565b3480156107d557600080fd5b506103086107e43660046134d7565b6116b6565b3480156107f557600080fd5b506103c16116e9565b34801561080a57600080fd5b5061046761081936600461322a565b6116f8565b34801561082a57600080fd5b5061032a610839366004613426565b61170f565b34801561084a57600080fd5b5061039461173a565b61030861086136600461322a565b611749565b34801561087257600080fd5b5060065461032a9062010000900460ff1681565b34801561089257600080fd5b50610467600081565b3480156108a757600080fd5b506103086108b63660046134f2565b611b72565b3480156108c757600080fd5b506104676108d6366004613177565b60036020526000908152604090205481565b3480156108f457600080fd5b506011546103c1906001600160a01b031681565b34801561091457600080fd5b50610308610923366004613547565b611c4b565b34801561093457600080fd5b5060115461094f90600160a01b90046001600160601b031681565b60405161033691906135f5565b34801561096857600080fd5b506103086109773660046134ba565b611d9c565b34801561098857600080fd5b5061039461099736600461322a565b611db9565b3480156109a857600080fd5b506106c5600281565b3480156109bd57600080fd5b506103086109cc3660046133eb565b611e96565b3480156109dd57600080fd5b506104676109ec36600461322a565b611eb4565b3480156109fd57600080fd5b50610308610a0c366004613426565b611ec4565b348015610a1d57600080fd5b50610308610a2c3660046132bb565b611ee0565b348015610a3d57600080fd5b5061063d610a4c36600461337e565b611f5a565b348015610a5d57600080fd5b50610467610a6c36600461322a565b611f97565b348015610a7d57600080fd5b50600654610a9090610100900460ff1681565b604051610336919061361f565b348015610aa957600080fd5b5061032a610ab8366004613647565b611fa7565b348015610ac957600080fd5b50610308610ad8366004613177565b611fd5565b348015610ae957600080fd5b50610308610af83660046134ba565b61204b565b610b076000612202565b601080546001600160a01b0319166001600160a01b0392909216919091179055565b60006001600160e01b0319821663152a902d60e11b1480610b4e5750610b4e8261220c565b80610b5d5750610b5d82612241565b92915050565b610b6d6000612202565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b610b996000612202565b6001600160a01b038116610bc05760405163d92e233d60e01b815260040160405180910390fd5b601180546001600160a01b0319166001600160a01b0392909216919091179055565b606060168054610bf190613675565b80601f0160208091040260200160405190810160405280929190818152602001828054610c1d90613675565b8015610c6a5780601f10610c3f57610100808354040283529160200191610c6a565b820191906000526020600020905b815481529060010190602001808311610c4d57829003601f168201915b5050505050905090565b6000610c81826019541190565b610cea5760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a20617070726f76656420717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084015b60405180910390fd5b506000908152601a60205260409020546001600160a01b031690565b610d0e61229c565b815160008215610d1c575060025b60005b82811015610d80578160ff1660036000878481518110610d4157610d416136af565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020819055508080610d78906136db565b915050610d1f565b5050505050565b6001600160a01b03821615610e5f5760125460ff1615610dba5760405163f30c72c560e01b815260040160405180910390fd5b6000546001600160a01b031615610e5f57600054600154604051630f8350ed60e41b81526001600160a01b039092169163f8350ed091610dff9186919060040161340d565b602060405180830381865afa158015610e1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4091906136f4565b610e5f57816040516338332a8160e11b8152600401610ce19190613243565b610e6982826122fb565b5050565b610e776000612202565b600155565b826daaeb6d7670e522a718067333cd4e3b15610fc057336001600160a01b03821603610eb257610ead84848461240b565b610fcb565b604051633185c44d60e21b81526daaeb6d7670e522a718067333cd4e9063c617113490610ee59030903390600401613711565b602060405180830381865afa158015610f02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f2691906136f4565b8015610fa15750604051633185c44d60e21b81526daaeb6d7670e522a718067333cd4e9063c617113490610f609030908590600401613711565b602060405180830381865afa158015610f7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fa191906136f4565b610fc05733604051633b79c77360e21b8152600401610ce19190613243565b610fcb84848461240b565b50505050565b60009081526013602052604090206001015490565b60115460009081906001600160a01b038116906127109061101790600160a01b90046001600160601b03168661372b565b6110219190613742565b915091509250929050565b60065460009060ff16156111005760065462010000900460ff1661106357604051631c7324b560e21b815260040160405180910390fd5b600654600090610100900460ff16600281111561108257611082613609565b9050600060078260038110611099576110996136af565b01549050804210156110be57604051631c7324b560e21b815260040160405180910390fd5b600a82600381106110d1576110d16136af565b01546110dd9082613764565b4211156110fd57604051631c7324b560e21b815260040160405180910390fd5b50505b50600190565b61110f82610fd1565b61111881612202565b611122838361243c565b505050565b60008060005b60195481101561119c57611142816019541190565b80156111675750611152816115fb565b6001600160a01b0316856001600160a01b0316145b1561118a5783820361117c579150610b5d9050565b81611186816136db565b9250505b80611194816136db565b91505061112d565b5060405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a206f776e657220696e646578206f7574206f6620626f604482015263756e647360e01b6064820152608401610ce1565b6111fb6000612202565b612710816001600160601b03161061122857806040516349d647ad60e01b8152600401610ce191906135f5565b601180546001600160601b03909216600160a01b026001600160a01b03909216919091179055565b6001600160a01b03811633146112c05760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610ce1565b610e6982826124c2565b6112d46000612202565b81600d8260028111156112e9576112e9613609565b600381106112f9576112f96136af565b01555050565b61130761229c565b60405160009073fba08bbff544a20caaa6e2278bed853f5ed886489047908381818185875af1925050503d806000811461135d576040519150601f19603f3d011682016040523d82523d6000602084013e611362565b606091505b505090508061137057600080fd5b50565b6002816003811061138357600080fd5b60109182820401919006600202915054906101000a900461ffff1681565b826daaeb6d7670e522a718067333cd4e3b156114e057336001600160a01b038216036113d257610ead848484612529565b604051633185c44d60e21b81526daaeb6d7670e522a718067333cd4e9063c6171134906114059030903390600401613711565b602060405180830381865afa158015611422573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144691906136f4565b80156114c15750604051633185c44d60e21b81526daaeb6d7670e522a718067333cd4e9063c6171134906114809030908590600401613711565b602060405180830381865afa15801561149d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114c191906136f4565b6114e05733604051633b79c77360e21b8152600401610ce19190613243565b610fcb848484612529565b6114f56000612202565b60068054911515620100000262ff000019909216919091179055565b61151961229c565b610e698282612544565b600061152e60195490565b821061158a5760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a20676c6f62616c20696e646578206f7574206f6620626044820152646f756e647360d81b6064820152608401610ce1565b6000805b6019548110156115d6576115a3816019541190565b156115c4578382036115b6579392505050565b816115c0816136db565b9250505b806115ce816136db565b91505061158e565b5050919050565b6115e76000612202565b80600a83600381106112f9576112f96136af565b60008061160783612583565b509392505050565b60006001600160a01b03821661167d5760405162461bcd60e51b815260206004820152602d60248201527f4552433732315073693a2062616c616e636520717565727920666f722074686560448201526c207a65726f206164647265737360981b6064820152608401610ce1565b506001600160a01b03166000908152601c60205260409020546001600160401b031690565b6116aa61229c565b6116b4600061261c565b565b6116c06000612202565b6006805482919061ff0019166101008360028111156116e1576116e1613609565b021790555050565b6014546001600160a01b031690565b600d816003811061170857600080fd5b0154905081565b60009182526013602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060178054610bf190613675565b60065460ff161561181a5760065462010000900460ff1661177d57604051631c7324b560e21b815260040160405180910390fd5b600654600090610100900460ff16600281111561179c5761179c613609565b90506000600782600381106117b3576117b36136af565b01549050804210156117d857604051631c7324b560e21b815260040160405180910390fd5b600a82600381106117eb576117eb6136af565b01546117f79082613764565b42111561181757604051631c7324b560e21b815260040160405180910390fd5b50505b6000600654610100900460ff16600281111561183857611838613609565b0361186c5733600090815260036020526040812054900361186c57604051632527687b60e21b815260040160405180910390fd5b6001600654610100900460ff16600281111561188a5761188a613609565b036118be573360009081526004602052604081205490036118be57604051632527687b60e21b815260040160405180910390fd5b3233146118de57604051631c4e317f60e11b815260040160405180910390fd5b6006548190600290610100900460ff16818111156118fe576118fe613609565b6003811061190e5761190e6136af565b601091828204019190066002029054906101000a900461ffff1661ffff1681111561194c576040516315bf7c7b60e31b815260040160405180910390fd5b8060000361196d57604051631e97cd6360e21b815260040160405180910390fd5b6002600654610100900460ff16600281111561198b5761198b613609565b14611a6457600080600654610100900460ff1660028111156119af576119af613609565b146119c957336000908152600460205260409020546119da565b336000908152600360205260409020545b33600090815260056020526040902060065491925090610100900460ff166002811115611a0957611a09613609565b60028110611a1957611a196136af565b601091828204019190066002029054906101000a900461ffff1661ffff1682611a429190613764565b811015611a62576040516337cb51dd60e21b815260040160405180910390fd5b505b3482600d600660019054906101000a900460ff166002811115611a8957611a89613609565b60038110611a9957611a996136af565b0154611aa5908261372b565b821015611ac55760405163356680b760e01b815260040160405180910390fd5b6002600654610100900460ff166002811115611ae357611ae3613609565b14611b6857336000908152600560205260409020600654859190610100900460ff166002811115611b1657611b16613609565b60028110611b2657611b266136af565b601091828204019190066002028282829054906101000a900461ffff16611b4d9190613777565b92506101000a81548161ffff021916908361ffff1602179055505b610fcb3385612544565b8015611c415760125460ff1615611b9c5760405163f30c72c560e01b815260040160405180910390fd5b6000546001600160a01b031615611c4157600054600154604051630f8350ed60e41b81526001600160a01b039092169163f8350ed091611be19186919060040161340d565b602060405180830381865afa158015611bfe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c2291906136f4565b611c4157816040516338332a8160e11b8152600401610ce19190613243565b610e69828261266e565b836daaeb6d7670e522a718067333cd4e3b15611d9057336001600160a01b03821603611c8257611c7d85858585612731565b610d80565b604051633185c44d60e21b81526daaeb6d7670e522a718067333cd4e9063c617113490611cb59030903390600401613711565b602060405180830381865afa158015611cd2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cf691906136f4565b8015611d715750604051633185c44d60e21b81526daaeb6d7670e522a718067333cd4e9063c617113490611d309030908590600401613711565b602060405180830381865afa158015611d4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d7191906136f4565b611d905733604051633b79c77360e21b8152600401610ce19190613243565b610d8085858585612731565b611da66000612202565b6006805460ff1916911515919091179055565b6060611dc6826019541190565b611e255760405162461bcd60e51b815260206004820152602a60248201527f4552433732315073693a2055524920717565727920666f72206e6f6e657869736044820152693a32b73a103a37b5b2b760b11b6064820152608401610ce1565b60105460405163c87b56dd60e01b8152600481018490526001600160a01b039091169063c87b56dd90602401600060405180830381865afa158015611e6e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b5d9190810190613799565b611ea06000612202565b80600783600381106112f9576112f96136af565b6007816003811061170857600080fd5b611ecd82610fd1565b611ed681612202565b61112283836124c2565b611ee861229c565b815160008215611ef6575060055b60005b82811015610d80578160ff1660046000878481518110611f1b57611f1b6136af565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020819055508080611f52906136db565b915050611ef9565b60056020528160005260406000208160028110611f7657600080fd5b60109182820401919006600202915091509054906101000a900461ffff1681565b600a816003811061170857600080fd5b6001600160a01b039182166000908152601b6020908152604080832093909416825291909152205460ff1690565b611fdd61229c565b6001600160a01b0381166120425760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610ce1565b6113708161261c565b6120556000612202565b6012805460ff1916911515919091179055565b601954816120c65760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a207175616e74697479206d7573742062652067726561604482015264074657220360dc1b6064820152608401610ce1565b6001600160a01b0383166121285760405162461bcd60e51b815260206004820152602360248201527f4552433732315073693a206d696e7420746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610ce1565b6121356000848385612763565b81601960008282546121479190613764565b9091555050600081815260186020526040902080546001600160a01b0319166001600160a01b03851617905561217e6015826121d6565b61218b60008483856127b2565b805b6121978383613764565b811015610fcb5760405181906001600160a01b038616906000906000805160206139d0833981519152908290a4806121ce816136db565b91505061218d565b600881901c600090815260209290925260409091208054600160ff1b60ff9093169290921c9091179055565b6113708133612930565b60006001600160e01b03198216637965db0b60e01b1480610b5d57506301ffc9a760e01b6001600160e01b0319831614610b5d565b60006001600160e01b031982166380ac58cd60e01b148061227257506001600160e01b03198216635b5e139f60e01b145b8061228d57506001600160e01b0319821663780e9d6360e01b145b80610b5d5750610b5d8261220c565b336122a56116e9565b6001600160a01b0316146116b45760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ce1565b6000612306826115fb565b9050806001600160a01b0316836001600160a01b0316036123755760405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a20617070726f76616c20746f2063757272656e74206f6044820152633bb732b960e11b6064820152608401610ce1565b336001600160a01b038216148061239157506123918133611fa7565b6124015760405162461bcd60e51b815260206004820152603b60248201527f4552433732315073693a20617070726f76652063616c6c6572206973206e6f7460448201527a081bdddb995c881b9bdc88185c1c1c9bdd995908199bdc88185b1b602a1b6064820152608401610ce1565b6111228383612989565b61241533826129f7565b6124315760405162461bcd60e51b8152600401610ce190613806565b611122838383612ac6565b612446828261170f565b610e695760008281526013602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561247e3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6124cc828261170f565b15610e695760008281526013602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b61112283838360405180602001604052806000815250611c4b565b6103e861255060195490565b61255a9083613764565b111561257957604051638a164f6360e01b815260040160405180910390fd5b610e698282612068565b600080612591836019541190565b6125f25760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a206f776e657220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610ce1565b6125fb83612cbb565b6000818152601860205260409020546001600160a01b031694909350915050565b601480546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b336001600160a01b038316036126c55760405162461bcd60e51b815260206004820152601c60248201527b22a9219b9918a839b49d1030b8383937bb32903a379031b0b63632b960211b6044820152606401610ce1565b336000818152601b602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61273b33836129f7565b6127575760405162461bcd60e51b8152600401610ce190613806565b610fcb84848484612cc8565b60125460ff16801561277d57506001600160a01b03841615155b801561279457506001600160a01b03831661dead14155b15610ead5760405163f30c72c560e01b815260040160405180910390fd5b600160401b81106127c257600080fd5b806001600160a01b0385161561282c576001600160a01b0385166000908152601c6020526040812080548392906128039084906001600160401b031661385a565b92506101000a8154816001600160401b0302191690836001600160401b0316021790555061288c565b6001600160a01b0384166000908152601c602052604090208054829190600890612867908490600160401b90046001600160401b031661387a565b92506101000a8154816001600160401b0302191690836001600160401b031602179055505b6001600160a01b038416156128f5576001600160a01b0384166000908152601c6020526040812080548392906128cc9084906001600160401b031661387a565b92506101000a8154816001600160401b0302191690836001600160401b03160217905550610d80565b6001600160a01b0385166000908152601c6020526040902080548291906010906128cc908490600160801b90046001600160401b031661387a565b61293a828261170f565b610e695761294781612cfd565b612952836020612d0f565b60405160200161296392919061389a565b60408051601f198184030181529082905262461bcd60e51b8252610ce191600401613217565b6000818152601a6020526040902080546001600160a01b0319166001600160a01b03841690811790915581906129be826115fb565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000612a04826019541190565b612a685760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a206f70657261746f7220717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610ce1565b6000612a73836115fb565b9050806001600160a01b0316846001600160a01b03161480612aae5750836001600160a01b0316612aa384610c74565b6001600160a01b0316145b80612abe5750612abe8185611fa7565b949350505050565b600080612ad283612583565b91509150846001600160a01b0316826001600160a01b031614612b4c5760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a207472616e73666572206f6620746f6b656e2074686160448201526b3a1034b9903737ba1037bbb760a11b6064820152608401610ce1565b6001600160a01b038416612bb25760405162461bcd60e51b815260206004820152602760248201527f4552433732315073693a207472616e7366657220746f20746865207a65726f206044820152666164647265737360c81b6064820152608401610ce1565b612bbf8585856001612763565b612bca600084612989565b6000612bd7846001613764565b600881901c600090815260156020526040902054909150600160ff1b60ff83161c16158015612c07575060195481105b15612c3e57600081815260186020526040902080546001600160a01b0319166001600160a01b038816179055612c3e6015826121d6565b600084815260186020526040902080546001600160a01b0319166001600160a01b038716179055818414612c7757612c776015856121d6565b83856001600160a01b0316876001600160a01b03166000805160206139d083398151915260405160405180910390a4612cb386868660016127b2565b505050505050565b6000610b5d601583612eb1565b612cd3848484612ac6565b612ce1848484600185612fa9565b610fcb5760405162461bcd60e51b8152600401610ce190613909565b6060610b5d6001600160a01b03831660145b60606000612d1e83600261372b565b612d29906002613764565b6001600160401b03811115612d4057612d40613257565b6040519080825280601f01601f191660200182016040528015612d6a576020820181803683370190505b509050600360fc1b81600081518110612d8557612d856136af565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110612db457612db46136af565b60200101906001600160f81b031916908160001a9053506000612dd884600261372b565b612de3906001613764565b90505b6001811115612e5b576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110612e1757612e176136af565b1a60f81b828281518110612e2d57612e2d6136af565b60200101906001600160f81b031916908160001a90535060049490941c93612e548161395e565b9050612de6565b508315612eaa5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610ce1565b9392505050565b600881901c60008181526020849052604081205490919060ff808516919082181c8015612ef357612ee1816130e0565b60ff168203600884901b179350612fa0565b60008311612f605760405162461bcd60e51b815260206004820152603460248201527f4269744d6170733a205468652073657420626974206265666f7265207468652060448201527334b73232bc103237b2b9b713ba1032bc34b9ba1760611b6064820152608401610ce1565b506000199091016000818152602086905260409020549091908015612f9b57612f88816130e0565b60ff0360ff16600884901b179350612fa0565b612ef3565b50505092915050565b60006001600160a01b0385163b156130d357506001835b612fca8486613764565b8110156130cd57604051630a85bd0160e11b81526001600160a01b0387169063150b7a02906130039033908b9086908990600401613975565b6020604051808303816000875af192505050801561303e575060408051601f3d908101601f1916820190925261303b918101906139b2565b60015b61309b573d80801561306c576040519150601f19603f3d011682016040523d82523d6000602084013e613071565b606091505b5080516000036130935760405162461bcd60e51b8152600401610ce190613909565b805181602001fd5b8280156130b857506001600160e01b03198116630a85bd0160e11b145b925050806130c5816136db565b915050612fc0565b506130d7565b5060015b95945050505050565b600060405180610120016040528061010081526020016139f0610100913960f87e818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff6131298561314a565b02901c8151811061313c5761313c6136af565b016020015160f81c92915050565b600080821161315857600080fd5b5060008190031690565b6001600160a01b038116811461137057600080fd5b60006020828403121561318957600080fd5b8135612eaa81613162565b6001600160e01b03198116811461137057600080fd5b6000602082840312156131bc57600080fd5b8135612eaa81613194565b60005b838110156131e25781810151838201526020016131ca565b50506000910152565b600081518084526132038160208601602086016131c7565b601f01601f19169290920160200192915050565b602081526000612eaa60208301846131eb565b60006020828403121561323c57600080fd5b5035919050565b6001600160a01b0391909116815260200190565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561329557613295613257565b604052919050565b801515811461137057600080fd5b80356132b68161329d565b919050565b600080604083850312156132ce57600080fd5b82356001600160401b03808211156132e557600080fd5b818501915085601f8301126132f957600080fd5b813560208282111561330d5761330d613257565b8160051b925061331e81840161326d565b828152928401810192818101908985111561333857600080fd5b948201945b84861015613362578535935061335284613162565b838252948201949082019061333d565b965061337190508782016132ab565b9450505050509250929050565b6000806040838503121561339157600080fd5b823561339c81613162565b946020939093013593505050565b6000806000606084860312156133bf57600080fd5b83356133ca81613162565b925060208401356133da81613162565b929592945050506040919091013590565b600080604083850312156133fe57600080fd5b50508035926020909101359150565b6001600160a01b03929092168252602082015260400190565b6000806040838503121561343957600080fd5b82359150602083013561344b81613162565b809150509250929050565b60006020828403121561346857600080fd5b81356001600160601b0381168114612eaa57600080fd5b8035600381106132b657600080fd5b600080604083850312156134a157600080fd5b823591506134b16020840161347f565b90509250929050565b6000602082840312156134cc57600080fd5b8135612eaa8161329d565b6000602082840312156134e957600080fd5b612eaa8261347f565b6000806040838503121561350557600080fd5b823561351081613162565b9150602083013561344b8161329d565b60006001600160401b0382111561353957613539613257565b50601f01601f191660200190565b6000806000806080858703121561355d57600080fd5b843561356881613162565b9350602085013561357881613162565b92506040850135915060608501356001600160401b0381111561359a57600080fd5b8501601f810187136135ab57600080fd5b80356135be6135b982613520565b61326d565b8181528860208385010111156135d357600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b6001600160601b0391909116815260200190565b634e487b7160e01b600052602160045260246000fd5b602081016003831061364157634e487b7160e01b600052602160045260246000fd5b91905290565b6000806040838503121561365a57600080fd5b823561366581613162565b9150602083013561344b81613162565b600181811c9082168061368957607f821691505b6020821081036136a957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016136ed576136ed6136c5565b5060010190565b60006020828403121561370657600080fd5b8151612eaa8161329d565b6001600160a01b0392831681529116602082015260400190565b8082028115828204841417610b5d57610b5d6136c5565b60008261375f57634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115610b5d57610b5d6136c5565b61ffff818116838216019080821115613792576137926136c5565b5092915050565b6000602082840312156137ab57600080fd5b81516001600160401b038111156137c157600080fd5b8201601f810184136137d257600080fd5b80516137e06135b982613520565b8181528560208385010111156137f557600080fd5b6130d78260208301602086016131c7565b60208082526034908201527f4552433732315073693a207472616e736665722063616c6c6572206973206e6f6040820152731d081bdddb995c881b9bdc88185c1c1c9bdd995960621b606082015260800190565b6001600160401b03828116828216039080821115613792576137926136c5565b6001600160401b03818116838216019080821115613792576137926136c5565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8152600083516138cc8160178501602088016131c7565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516138fd8160288401602088016131c7565b01602801949350505050565b60208082526035908201527f4552433732315073693a207472616e7366657220746f206e6f6e20455243373260408201527418a932b1b2b4bb32b91034b6b83632b6b2b73a32b960591b606082015260800190565b60008161396d5761396d6136c5565b506000190190565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906139a8908301846131eb565b9695505050505050565b6000602082840312156139c457600080fd5b8151612eaa8161319456feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef0001020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7506264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c9071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee30e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf7ff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c816365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f6fe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf5fd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f8a2646970667358221220d866437c14ba3528acfaef93e6696122ede948208109b6062a6efd03f140ed7164736f6c63430008110033
Deployed Bytecode
0x6080604052600436106102e35760003560e01c806355c492381161018257806355c492381461070d5780635c975abb1461072d5780636352211e1461074757806370a0823114610767578063715018a614610787578063785cdcf01461079c5780637ad59431146107c95780638da5cb5b146107e95780639097548d146107fe57806391d148541461081e57806395d89b411461083e578063a0712d6814610853578063a18b1d4814610866578063a217fddf14610886578063a22cb4651461089b578063a5324093146108bb578063ad2f852a146108e8578063b88d4fde14610908578063b8997a9714610928578063bedb86fb1461095c578063c87b56dd1461097c578063cb8fbbd21461099c578063ccc3abe2146109b1578063cf3d49c4146109d1578063d547741f146109f1578063dee78a4314610a11578063df9cc7e314610a31578063e3bb2eec14610a51578063e4f2487a14610a71578063e985e9c514610a9d578063f2fde38b14610abd578063fcd1aac914610add57600080fd5b806301b9a397146102e857806301ffc9a71461030a578063025e332e1461033f57806306d254da1461035f57806306fdde031461037f578063081812fc146103a157806308e8dec6146103ce578063095ea7b3146103ee5780630f4345e21461040e578063122e04a81461042e57806318160ddd1461045657806323b872dd14610475578063248a9ca3146104955780632a55205a146104b55780632bc0e377146104e35780632f2ff15d146104f85780632f745c5914610518578063303e74df1461053857806331faafb41461055857806332cb6b0c1461057857806336568abe1461058e578063396e8f53146105ae5780633c215c91146105ce5780633ccfd60b146105ee5780633cf40df3146106035780633f5ecdf11461061d57806342842e0e1461065057806346b7d75514610670578063484b973c146106905780634915122a146106b05780634f3db346146106d75780634f6ccce7146106ed575b600080fd5b3480156102f457600080fd5b50610308610303366004613177565b610afd565b005b34801561031657600080fd5b5061032a6103253660046131aa565b610b29565b60405190151581526020015b60405180910390f35b34801561034b57600080fd5b5061030861035a366004613177565b610b63565b34801561036b57600080fd5b5061030861037a366004613177565b610b8f565b34801561038b57600080fd5b50610394610be2565b6040516103369190613217565b3480156103ad57600080fd5b506103c16103bc36600461322a565b610c74565b6040516103369190613243565b3480156103da57600080fd5b506103086103e93660046132bb565b610d06565b3480156103fa57600080fd5b5061030861040936600461337e565b610d87565b34801561041a57600080fd5b5061030861042936600461322a565b610e6d565b34801561043a57600080fd5b506103c173fba08bbff544a20caaa6e2278bed853f5ed8864881565b34801561046257600080fd5b506019545b604051908152602001610336565b34801561048157600080fd5b506103086104903660046133aa565b610e7c565b3480156104a157600080fd5b506104676104b036600461322a565b610fd1565b3480156104c157600080fd5b506104d56104d03660046133eb565b610fe6565b60405161033692919061340d565b3480156104ef57600080fd5b5061032a61102c565b34801561050457600080fd5b50610308610513366004613426565b611106565b34801561052457600080fd5b5061046761053336600461337e565b611127565b34801561054457600080fd5b506010546103c1906001600160a01b031681565b34801561056457600080fd5b50610308610573366004613456565b6111f1565b34801561058457600080fd5b506104676103e881565b34801561059a57600080fd5b506103086105a9366004613426565b611250565b3480156105ba57600080fd5b506000546103c1906001600160a01b031681565b3480156105da57600080fd5b506103086105e936600461348e565b6112ca565b3480156105fa57600080fd5b506103086112ff565b34801561060f57600080fd5b5060125461032a9060ff1681565b34801561062957600080fd5b5061063d61063836600461322a565b611373565b60405161ffff9091168152602001610336565b34801561065c57600080fd5b5061030861066b3660046133aa565b6113a1565b34801561067c57600080fd5b5061030861068b3660046134ba565b6114eb565b34801561069c57600080fd5b506103086106ab36600461337e565b611511565b3480156106bc57600080fd5b506106c5600581565b60405160ff9091168152602001610336565b3480156106e357600080fd5b5061046760015481565b3480156106f957600080fd5b5061046761070836600461322a565b611523565b34801561071957600080fd5b506103086107283660046133eb565b6115dd565b34801561073957600080fd5b5060065461032a9060ff1681565b34801561075357600080fd5b506103c161076236600461322a565b6115fb565b34801561077357600080fd5b50610467610782366004613177565b61160f565b34801561079357600080fd5b506103086116a2565b3480156107a857600080fd5b506104676107b7366004613177565b60046020526000908152604090205481565b3480156107d557600080fd5b506103086107e43660046134d7565b6116b6565b3480156107f557600080fd5b506103c16116e9565b34801561080a57600080fd5b5061046761081936600461322a565b6116f8565b34801561082a57600080fd5b5061032a610839366004613426565b61170f565b34801561084a57600080fd5b5061039461173a565b61030861086136600461322a565b611749565b34801561087257600080fd5b5060065461032a9062010000900460ff1681565b34801561089257600080fd5b50610467600081565b3480156108a757600080fd5b506103086108b63660046134f2565b611b72565b3480156108c757600080fd5b506104676108d6366004613177565b60036020526000908152604090205481565b3480156108f457600080fd5b506011546103c1906001600160a01b031681565b34801561091457600080fd5b50610308610923366004613547565b611c4b565b34801561093457600080fd5b5060115461094f90600160a01b90046001600160601b031681565b60405161033691906135f5565b34801561096857600080fd5b506103086109773660046134ba565b611d9c565b34801561098857600080fd5b5061039461099736600461322a565b611db9565b3480156109a857600080fd5b506106c5600281565b3480156109bd57600080fd5b506103086109cc3660046133eb565b611e96565b3480156109dd57600080fd5b506104676109ec36600461322a565b611eb4565b3480156109fd57600080fd5b50610308610a0c366004613426565b611ec4565b348015610a1d57600080fd5b50610308610a2c3660046132bb565b611ee0565b348015610a3d57600080fd5b5061063d610a4c36600461337e565b611f5a565b348015610a5d57600080fd5b50610467610a6c36600461322a565b611f97565b348015610a7d57600080fd5b50600654610a9090610100900460ff1681565b604051610336919061361f565b348015610aa957600080fd5b5061032a610ab8366004613647565b611fa7565b348015610ac957600080fd5b50610308610ad8366004613177565b611fd5565b348015610ae957600080fd5b50610308610af83660046134ba565b61204b565b610b076000612202565b601080546001600160a01b0319166001600160a01b0392909216919091179055565b60006001600160e01b0319821663152a902d60e11b1480610b4e5750610b4e8261220c565b80610b5d5750610b5d82612241565b92915050565b610b6d6000612202565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b610b996000612202565b6001600160a01b038116610bc05760405163d92e233d60e01b815260040160405180910390fd5b601180546001600160a01b0319166001600160a01b0392909216919091179055565b606060168054610bf190613675565b80601f0160208091040260200160405190810160405280929190818152602001828054610c1d90613675565b8015610c6a5780601f10610c3f57610100808354040283529160200191610c6a565b820191906000526020600020905b815481529060010190602001808311610c4d57829003601f168201915b5050505050905090565b6000610c81826019541190565b610cea5760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a20617070726f76656420717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084015b60405180910390fd5b506000908152601a60205260409020546001600160a01b031690565b610d0e61229c565b815160008215610d1c575060025b60005b82811015610d80578160ff1660036000878481518110610d4157610d416136af565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020819055508080610d78906136db565b915050610d1f565b5050505050565b6001600160a01b03821615610e5f5760125460ff1615610dba5760405163f30c72c560e01b815260040160405180910390fd5b6000546001600160a01b031615610e5f57600054600154604051630f8350ed60e41b81526001600160a01b039092169163f8350ed091610dff9186919060040161340d565b602060405180830381865afa158015610e1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4091906136f4565b610e5f57816040516338332a8160e11b8152600401610ce19190613243565b610e6982826122fb565b5050565b610e776000612202565b600155565b826daaeb6d7670e522a718067333cd4e3b15610fc057336001600160a01b03821603610eb257610ead84848461240b565b610fcb565b604051633185c44d60e21b81526daaeb6d7670e522a718067333cd4e9063c617113490610ee59030903390600401613711565b602060405180830381865afa158015610f02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f2691906136f4565b8015610fa15750604051633185c44d60e21b81526daaeb6d7670e522a718067333cd4e9063c617113490610f609030908590600401613711565b602060405180830381865afa158015610f7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fa191906136f4565b610fc05733604051633b79c77360e21b8152600401610ce19190613243565b610fcb84848461240b565b50505050565b60009081526013602052604090206001015490565b60115460009081906001600160a01b038116906127109061101790600160a01b90046001600160601b03168661372b565b6110219190613742565b915091509250929050565b60065460009060ff16156111005760065462010000900460ff1661106357604051631c7324b560e21b815260040160405180910390fd5b600654600090610100900460ff16600281111561108257611082613609565b9050600060078260038110611099576110996136af565b01549050804210156110be57604051631c7324b560e21b815260040160405180910390fd5b600a82600381106110d1576110d16136af565b01546110dd9082613764565b4211156110fd57604051631c7324b560e21b815260040160405180910390fd5b50505b50600190565b61110f82610fd1565b61111881612202565b611122838361243c565b505050565b60008060005b60195481101561119c57611142816019541190565b80156111675750611152816115fb565b6001600160a01b0316856001600160a01b0316145b1561118a5783820361117c579150610b5d9050565b81611186816136db565b9250505b80611194816136db565b91505061112d565b5060405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a206f776e657220696e646578206f7574206f6620626f604482015263756e647360e01b6064820152608401610ce1565b6111fb6000612202565b612710816001600160601b03161061122857806040516349d647ad60e01b8152600401610ce191906135f5565b601180546001600160601b03909216600160a01b026001600160a01b03909216919091179055565b6001600160a01b03811633146112c05760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610ce1565b610e6982826124c2565b6112d46000612202565b81600d8260028111156112e9576112e9613609565b600381106112f9576112f96136af565b01555050565b61130761229c565b60405160009073fba08bbff544a20caaa6e2278bed853f5ed886489047908381818185875af1925050503d806000811461135d576040519150601f19603f3d011682016040523d82523d6000602084013e611362565b606091505b505090508061137057600080fd5b50565b6002816003811061138357600080fd5b60109182820401919006600202915054906101000a900461ffff1681565b826daaeb6d7670e522a718067333cd4e3b156114e057336001600160a01b038216036113d257610ead848484612529565b604051633185c44d60e21b81526daaeb6d7670e522a718067333cd4e9063c6171134906114059030903390600401613711565b602060405180830381865afa158015611422573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144691906136f4565b80156114c15750604051633185c44d60e21b81526daaeb6d7670e522a718067333cd4e9063c6171134906114809030908590600401613711565b602060405180830381865afa15801561149d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114c191906136f4565b6114e05733604051633b79c77360e21b8152600401610ce19190613243565b610fcb848484612529565b6114f56000612202565b60068054911515620100000262ff000019909216919091179055565b61151961229c565b610e698282612544565b600061152e60195490565b821061158a5760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a20676c6f62616c20696e646578206f7574206f6620626044820152646f756e647360d81b6064820152608401610ce1565b6000805b6019548110156115d6576115a3816019541190565b156115c4578382036115b6579392505050565b816115c0816136db565b9250505b806115ce816136db565b91505061158e565b5050919050565b6115e76000612202565b80600a83600381106112f9576112f96136af565b60008061160783612583565b509392505050565b60006001600160a01b03821661167d5760405162461bcd60e51b815260206004820152602d60248201527f4552433732315073693a2062616c616e636520717565727920666f722074686560448201526c207a65726f206164647265737360981b6064820152608401610ce1565b506001600160a01b03166000908152601c60205260409020546001600160401b031690565b6116aa61229c565b6116b4600061261c565b565b6116c06000612202565b6006805482919061ff0019166101008360028111156116e1576116e1613609565b021790555050565b6014546001600160a01b031690565b600d816003811061170857600080fd5b0154905081565b60009182526013602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060178054610bf190613675565b60065460ff161561181a5760065462010000900460ff1661177d57604051631c7324b560e21b815260040160405180910390fd5b600654600090610100900460ff16600281111561179c5761179c613609565b90506000600782600381106117b3576117b36136af565b01549050804210156117d857604051631c7324b560e21b815260040160405180910390fd5b600a82600381106117eb576117eb6136af565b01546117f79082613764565b42111561181757604051631c7324b560e21b815260040160405180910390fd5b50505b6000600654610100900460ff16600281111561183857611838613609565b0361186c5733600090815260036020526040812054900361186c57604051632527687b60e21b815260040160405180910390fd5b6001600654610100900460ff16600281111561188a5761188a613609565b036118be573360009081526004602052604081205490036118be57604051632527687b60e21b815260040160405180910390fd5b3233146118de57604051631c4e317f60e11b815260040160405180910390fd5b6006548190600290610100900460ff16818111156118fe576118fe613609565b6003811061190e5761190e6136af565b601091828204019190066002029054906101000a900461ffff1661ffff1681111561194c576040516315bf7c7b60e31b815260040160405180910390fd5b8060000361196d57604051631e97cd6360e21b815260040160405180910390fd5b6002600654610100900460ff16600281111561198b5761198b613609565b14611a6457600080600654610100900460ff1660028111156119af576119af613609565b146119c957336000908152600460205260409020546119da565b336000908152600360205260409020545b33600090815260056020526040902060065491925090610100900460ff166002811115611a0957611a09613609565b60028110611a1957611a196136af565b601091828204019190066002029054906101000a900461ffff1661ffff1682611a429190613764565b811015611a62576040516337cb51dd60e21b815260040160405180910390fd5b505b3482600d600660019054906101000a900460ff166002811115611a8957611a89613609565b60038110611a9957611a996136af565b0154611aa5908261372b565b821015611ac55760405163356680b760e01b815260040160405180910390fd5b6002600654610100900460ff166002811115611ae357611ae3613609565b14611b6857336000908152600560205260409020600654859190610100900460ff166002811115611b1657611b16613609565b60028110611b2657611b266136af565b601091828204019190066002028282829054906101000a900461ffff16611b4d9190613777565b92506101000a81548161ffff021916908361ffff1602179055505b610fcb3385612544565b8015611c415760125460ff1615611b9c5760405163f30c72c560e01b815260040160405180910390fd5b6000546001600160a01b031615611c4157600054600154604051630f8350ed60e41b81526001600160a01b039092169163f8350ed091611be19186919060040161340d565b602060405180830381865afa158015611bfe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c2291906136f4565b611c4157816040516338332a8160e11b8152600401610ce19190613243565b610e69828261266e565b836daaeb6d7670e522a718067333cd4e3b15611d9057336001600160a01b03821603611c8257611c7d85858585612731565b610d80565b604051633185c44d60e21b81526daaeb6d7670e522a718067333cd4e9063c617113490611cb59030903390600401613711565b602060405180830381865afa158015611cd2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cf691906136f4565b8015611d715750604051633185c44d60e21b81526daaeb6d7670e522a718067333cd4e9063c617113490611d309030908590600401613711565b602060405180830381865afa158015611d4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d7191906136f4565b611d905733604051633b79c77360e21b8152600401610ce19190613243565b610d8085858585612731565b611da66000612202565b6006805460ff1916911515919091179055565b6060611dc6826019541190565b611e255760405162461bcd60e51b815260206004820152602a60248201527f4552433732315073693a2055524920717565727920666f72206e6f6e657869736044820152693a32b73a103a37b5b2b760b11b6064820152608401610ce1565b60105460405163c87b56dd60e01b8152600481018490526001600160a01b039091169063c87b56dd90602401600060405180830381865afa158015611e6e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b5d9190810190613799565b611ea06000612202565b80600783600381106112f9576112f96136af565b6007816003811061170857600080fd5b611ecd82610fd1565b611ed681612202565b61112283836124c2565b611ee861229c565b815160008215611ef6575060055b60005b82811015610d80578160ff1660046000878481518110611f1b57611f1b6136af565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020819055508080611f52906136db565b915050611ef9565b60056020528160005260406000208160028110611f7657600080fd5b60109182820401919006600202915091509054906101000a900461ffff1681565b600a816003811061170857600080fd5b6001600160a01b039182166000908152601b6020908152604080832093909416825291909152205460ff1690565b611fdd61229c565b6001600160a01b0381166120425760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610ce1565b6113708161261c565b6120556000612202565b6012805460ff1916911515919091179055565b601954816120c65760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a207175616e74697479206d7573742062652067726561604482015264074657220360dc1b6064820152608401610ce1565b6001600160a01b0383166121285760405162461bcd60e51b815260206004820152602360248201527f4552433732315073693a206d696e7420746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610ce1565b6121356000848385612763565b81601960008282546121479190613764565b9091555050600081815260186020526040902080546001600160a01b0319166001600160a01b03851617905561217e6015826121d6565b61218b60008483856127b2565b805b6121978383613764565b811015610fcb5760405181906001600160a01b038616906000906000805160206139d0833981519152908290a4806121ce816136db565b91505061218d565b600881901c600090815260209290925260409091208054600160ff1b60ff9093169290921c9091179055565b6113708133612930565b60006001600160e01b03198216637965db0b60e01b1480610b5d57506301ffc9a760e01b6001600160e01b0319831614610b5d565b60006001600160e01b031982166380ac58cd60e01b148061227257506001600160e01b03198216635b5e139f60e01b145b8061228d57506001600160e01b0319821663780e9d6360e01b145b80610b5d5750610b5d8261220c565b336122a56116e9565b6001600160a01b0316146116b45760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ce1565b6000612306826115fb565b9050806001600160a01b0316836001600160a01b0316036123755760405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a20617070726f76616c20746f2063757272656e74206f6044820152633bb732b960e11b6064820152608401610ce1565b336001600160a01b038216148061239157506123918133611fa7565b6124015760405162461bcd60e51b815260206004820152603b60248201527f4552433732315073693a20617070726f76652063616c6c6572206973206e6f7460448201527a081bdddb995c881b9bdc88185c1c1c9bdd995908199bdc88185b1b602a1b6064820152608401610ce1565b6111228383612989565b61241533826129f7565b6124315760405162461bcd60e51b8152600401610ce190613806565b611122838383612ac6565b612446828261170f565b610e695760008281526013602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561247e3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6124cc828261170f565b15610e695760008281526013602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b61112283838360405180602001604052806000815250611c4b565b6103e861255060195490565b61255a9083613764565b111561257957604051638a164f6360e01b815260040160405180910390fd5b610e698282612068565b600080612591836019541190565b6125f25760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a206f776e657220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610ce1565b6125fb83612cbb565b6000818152601860205260409020546001600160a01b031694909350915050565b601480546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b336001600160a01b038316036126c55760405162461bcd60e51b815260206004820152601c60248201527b22a9219b9918a839b49d1030b8383937bb32903a379031b0b63632b960211b6044820152606401610ce1565b336000818152601b602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61273b33836129f7565b6127575760405162461bcd60e51b8152600401610ce190613806565b610fcb84848484612cc8565b60125460ff16801561277d57506001600160a01b03841615155b801561279457506001600160a01b03831661dead14155b15610ead5760405163f30c72c560e01b815260040160405180910390fd5b600160401b81106127c257600080fd5b806001600160a01b0385161561282c576001600160a01b0385166000908152601c6020526040812080548392906128039084906001600160401b031661385a565b92506101000a8154816001600160401b0302191690836001600160401b0316021790555061288c565b6001600160a01b0384166000908152601c602052604090208054829190600890612867908490600160401b90046001600160401b031661387a565b92506101000a8154816001600160401b0302191690836001600160401b031602179055505b6001600160a01b038416156128f5576001600160a01b0384166000908152601c6020526040812080548392906128cc9084906001600160401b031661387a565b92506101000a8154816001600160401b0302191690836001600160401b03160217905550610d80565b6001600160a01b0385166000908152601c6020526040902080548291906010906128cc908490600160801b90046001600160401b031661387a565b61293a828261170f565b610e695761294781612cfd565b612952836020612d0f565b60405160200161296392919061389a565b60408051601f198184030181529082905262461bcd60e51b8252610ce191600401613217565b6000818152601a6020526040902080546001600160a01b0319166001600160a01b03841690811790915581906129be826115fb565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000612a04826019541190565b612a685760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a206f70657261746f7220717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610ce1565b6000612a73836115fb565b9050806001600160a01b0316846001600160a01b03161480612aae5750836001600160a01b0316612aa384610c74565b6001600160a01b0316145b80612abe5750612abe8185611fa7565b949350505050565b600080612ad283612583565b91509150846001600160a01b0316826001600160a01b031614612b4c5760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a207472616e73666572206f6620746f6b656e2074686160448201526b3a1034b9903737ba1037bbb760a11b6064820152608401610ce1565b6001600160a01b038416612bb25760405162461bcd60e51b815260206004820152602760248201527f4552433732315073693a207472616e7366657220746f20746865207a65726f206044820152666164647265737360c81b6064820152608401610ce1565b612bbf8585856001612763565b612bca600084612989565b6000612bd7846001613764565b600881901c600090815260156020526040902054909150600160ff1b60ff83161c16158015612c07575060195481105b15612c3e57600081815260186020526040902080546001600160a01b0319166001600160a01b038816179055612c3e6015826121d6565b600084815260186020526040902080546001600160a01b0319166001600160a01b038716179055818414612c7757612c776015856121d6565b83856001600160a01b0316876001600160a01b03166000805160206139d083398151915260405160405180910390a4612cb386868660016127b2565b505050505050565b6000610b5d601583612eb1565b612cd3848484612ac6565b612ce1848484600185612fa9565b610fcb5760405162461bcd60e51b8152600401610ce190613909565b6060610b5d6001600160a01b03831660145b60606000612d1e83600261372b565b612d29906002613764565b6001600160401b03811115612d4057612d40613257565b6040519080825280601f01601f191660200182016040528015612d6a576020820181803683370190505b509050600360fc1b81600081518110612d8557612d856136af565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110612db457612db46136af565b60200101906001600160f81b031916908160001a9053506000612dd884600261372b565b612de3906001613764565b90505b6001811115612e5b576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110612e1757612e176136af565b1a60f81b828281518110612e2d57612e2d6136af565b60200101906001600160f81b031916908160001a90535060049490941c93612e548161395e565b9050612de6565b508315612eaa5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610ce1565b9392505050565b600881901c60008181526020849052604081205490919060ff808516919082181c8015612ef357612ee1816130e0565b60ff168203600884901b179350612fa0565b60008311612f605760405162461bcd60e51b815260206004820152603460248201527f4269744d6170733a205468652073657420626974206265666f7265207468652060448201527334b73232bc103237b2b9b713ba1032bc34b9ba1760611b6064820152608401610ce1565b506000199091016000818152602086905260409020549091908015612f9b57612f88816130e0565b60ff0360ff16600884901b179350612fa0565b612ef3565b50505092915050565b60006001600160a01b0385163b156130d357506001835b612fca8486613764565b8110156130cd57604051630a85bd0160e11b81526001600160a01b0387169063150b7a02906130039033908b9086908990600401613975565b6020604051808303816000875af192505050801561303e575060408051601f3d908101601f1916820190925261303b918101906139b2565b60015b61309b573d80801561306c576040519150601f19603f3d011682016040523d82523d6000602084013e613071565b606091505b5080516000036130935760405162461bcd60e51b8152600401610ce190613909565b805181602001fd5b8280156130b857506001600160e01b03198116630a85bd0160e11b145b925050806130c5816136db565b915050612fc0565b506130d7565b5060015b95945050505050565b600060405180610120016040528061010081526020016139f0610100913960f87e818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff6131298561314a565b02901c8151811061313c5761313c6136af565b016020015160f81c92915050565b600080821161315857600080fd5b5060008190031690565b6001600160a01b038116811461137057600080fd5b60006020828403121561318957600080fd5b8135612eaa81613162565b6001600160e01b03198116811461137057600080fd5b6000602082840312156131bc57600080fd5b8135612eaa81613194565b60005b838110156131e25781810151838201526020016131ca565b50506000910152565b600081518084526132038160208601602086016131c7565b601f01601f19169290920160200192915050565b602081526000612eaa60208301846131eb565b60006020828403121561323c57600080fd5b5035919050565b6001600160a01b0391909116815260200190565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561329557613295613257565b604052919050565b801515811461137057600080fd5b80356132b68161329d565b919050565b600080604083850312156132ce57600080fd5b82356001600160401b03808211156132e557600080fd5b818501915085601f8301126132f957600080fd5b813560208282111561330d5761330d613257565b8160051b925061331e81840161326d565b828152928401810192818101908985111561333857600080fd5b948201945b84861015613362578535935061335284613162565b838252948201949082019061333d565b965061337190508782016132ab565b9450505050509250929050565b6000806040838503121561339157600080fd5b823561339c81613162565b946020939093013593505050565b6000806000606084860312156133bf57600080fd5b83356133ca81613162565b925060208401356133da81613162565b929592945050506040919091013590565b600080604083850312156133fe57600080fd5b50508035926020909101359150565b6001600160a01b03929092168252602082015260400190565b6000806040838503121561343957600080fd5b82359150602083013561344b81613162565b809150509250929050565b60006020828403121561346857600080fd5b81356001600160601b0381168114612eaa57600080fd5b8035600381106132b657600080fd5b600080604083850312156134a157600080fd5b823591506134b16020840161347f565b90509250929050565b6000602082840312156134cc57600080fd5b8135612eaa8161329d565b6000602082840312156134e957600080fd5b612eaa8261347f565b6000806040838503121561350557600080fd5b823561351081613162565b9150602083013561344b8161329d565b60006001600160401b0382111561353957613539613257565b50601f01601f191660200190565b6000806000806080858703121561355d57600080fd5b843561356881613162565b9350602085013561357881613162565b92506040850135915060608501356001600160401b0381111561359a57600080fd5b8501601f810187136135ab57600080fd5b80356135be6135b982613520565b61326d565b8181528860208385010111156135d357600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b6001600160601b0391909116815260200190565b634e487b7160e01b600052602160045260246000fd5b602081016003831061364157634e487b7160e01b600052602160045260246000fd5b91905290565b6000806040838503121561365a57600080fd5b823561366581613162565b9150602083013561344b81613162565b600181811c9082168061368957607f821691505b6020821081036136a957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016136ed576136ed6136c5565b5060010190565b60006020828403121561370657600080fd5b8151612eaa8161329d565b6001600160a01b0392831681529116602082015260400190565b8082028115828204841417610b5d57610b5d6136c5565b60008261375f57634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115610b5d57610b5d6136c5565b61ffff818116838216019080821115613792576137926136c5565b5092915050565b6000602082840312156137ab57600080fd5b81516001600160401b038111156137c157600080fd5b8201601f810184136137d257600080fd5b80516137e06135b982613520565b8181528560208385010111156137f557600080fd5b6130d78260208301602086016131c7565b60208082526034908201527f4552433732315073693a207472616e736665722063616c6c6572206973206e6f6040820152731d081bdddb995c881b9bdc88185c1c1c9bdd995960621b606082015260800190565b6001600160401b03828116828216039080821115613792576137926136c5565b6001600160401b03818116838216019080821115613792576137926136c5565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8152600083516138cc8160178501602088016131c7565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516138fd8160288401602088016131c7565b01602801949350505050565b60208082526035908201527f4552433732315073693a207472616e7366657220746f206e6f6e20455243373260408201527418a932b1b2b4bb32b91034b6b83632b6b2b73a32b960591b606082015260800190565b60008161396d5761396d6136c5565b506000190190565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906139a8908301846131eb565b9695505050505050565b6000602082840312156139c457600080fd5b8151612eaa8161319456feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef0001020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7506264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c9071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee30e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf7ff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c816365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f6fe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf5fd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f8a2646970667358221220d866437c14ba3528acfaef93e6696122ede948208109b6062a6efd03f140ed7164736f6c63430008110033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.