Source Code
Overview
MATIC Balance
2.965 MATIC
More Info
ContractCreator:
TokenTracker
Multichain Info
N/A
Latest 25 from a total of 28 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
Value | ||||
---|---|---|---|---|---|---|---|---|---|
Withdraw Game Fu... | 29429987 | 483 days ago | IN | 0 MATIC | 0.00004883 | ||||
Transfer | 29429802 | 483 days ago | IN | 2.75 MATIC | 0.0000445 | ||||
Withdraw Game Fu... | 29429784 | 483 days ago | IN | 0 MATIC | 0.00005053 | ||||
Withdraw Claim F... | 29429541 | 484 days ago | IN | 0 MATIC | 0.00005047 | ||||
Set Phase | 29346977 | 488 days ago | IN | 0 MATIC | 0.00105934 | ||||
Fusion Evo | 29345466 | 488 days ago | IN | 0.2 MATIC | 0.00044014 | ||||
Fusion Evo | 29245462 | 494 days ago | IN | 0.3 MATIC | 0.00029829 | ||||
Fusion Evo | 29245460 | 494 days ago | IN | 0.3 MATIC | 0.0002981 | ||||
Fusion Evo | 29245457 | 494 days ago | IN | 0.3 MATIC | 0.00029829 | ||||
Fusion Evo | 29245454 | 494 days ago | IN | 0.3 MATIC | 0.00029829 | ||||
Fusion Evo | 29245452 | 494 days ago | IN | 0.3 MATIC | 0.00029829 | ||||
Fusion Evo | 29245432 | 494 days ago | IN | 0.3 MATIC | 0.00029829 | ||||
Fusion Evo | 29245429 | 494 days ago | IN | 0.3 MATIC | 0.00029809 | ||||
Fusion Evo | 29245426 | 494 days ago | IN | 0.3 MATIC | 0.00029809 | ||||
Fusion Evo | 29245424 | 494 days ago | IN | 0.3 MATIC | 0.00029809 | ||||
Fusion Evo | 29245422 | 494 days ago | IN | 0.3 MATIC | 0.00029831 | ||||
Fusion Evo | 29245419 | 494 days ago | IN | 0.3 MATIC | 0.0003832 | ||||
Fusion Evo | 29210015 | 496 days ago | IN | 0.2 MATIC | 0.00022001 | ||||
Fusion Evo | 29210012 | 496 days ago | IN | 0.2 MATIC | 0.00026597 | ||||
Airdrop | 29209951 | 496 days ago | IN | 0 MATIC | 0.0001134 | ||||
Fusion Evo | 29209930 | 496 days ago | IN | 0.2 MATIC | 0.00024529 | ||||
Fusion Evo | 29209886 | 496 days ago | IN | 0.2 MATIC | 0.00035279 | ||||
Change Price Fus... | 29205021 | 497 days ago | IN | 0 MATIC | 0.0000505 | ||||
Set Phase | 29204997 | 497 days ago | IN | 0 MATIC | 0.00007524 | ||||
Change Price Fus... | 29204946 | 497 days ago | IN | 0 MATIC | 0.00004877 |
Loading...
Loading
Contract Name:
Timeout
Compiler Version
v0.8.13+commit.abaa5c0e
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.13; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/token/common/ERC2981.sol"; import "erc721a/contracts/ERC721A.sol"; import "erc721a/contracts/extensions/ERC721AQueryable.sol"; import {DataLibrarry} from "./lib/DataLibrarry.sol"; import {FunctionLib} from "./lib/FunctionLib.sol"; import {ITimeout} from "./ITimeout.sol"; import {Address} from "@openzeppelin/contracts/utils/Address.sol"; import {Strings} from "@openzeppelin/contracts/utils/Strings.sol"; import {Base64} from "@openzeppelin/contracts/utils/Base64.sol"; /** * @title Timeout * @author chixx.eth & @mouradmki * @notice ERC721A Royalties With fusion, claim for the genesis holder */ contract Timeout is ITimeout, ERC721A, ERC721AQueryable, Ownable, ERC2981, ReentrancyGuard { using Strings for uint256; uint256 public gameFunds; uint256 public claimFunds; uint256 public evolutionFunds; uint256[] public fusionPrices = [ 4.44 ether, 5.95 ether, 7.44 ether, 9.30 ether, 11.62 ether, 14.52 ether, 19.36 ether ]; uint16 public constant maxSupplyToMint = 8192; uint8 private constant maxMintPerWallet_phase03 = 2; uint8 private constant maxMintPerWallet_phase04 = 5; uint16 public indexMint = 2505; uint16[] private indexEvolutionBlue = [0, 0, 0, 0, 0, 0, 0]; uint16[] private indexEvolutionPink = [0, 0, 0, 0, 0, 0, 0]; uint16[] private maxSupplyEvos = [0, 2048, 1024, 512, 256, 128, 63]; uint16 private constant portionForClaim = 1294; uint16 private index = 2506; uint16 private maxSupplyPrivateSale = 1901; uint16 public phaseForClaim; uint public maxTimeAfterTransfert = 86400*2; address private WhiteListSigner = 0x831F13996DB0dc7321b09c8340432cF0E24F4d51; string public baseURI = "paste the base url here"; DataLibrarry.SalePhase public phase = DataLibrarry.SalePhase.Closed; mapping(uint256 => DataLibrarry.Metadata) private metadatas; /** * @notice mapping for know for each phase if the tokenId have claim * @dev * { * uint256 => phase * addres => user address * bool => isClaimed * } */ mapping(uint256 => mapping(address => bool)) public isClaimed; mapping(address => bool) public isFreeMinted; mapping(address => uint16) private mintCountPhase03; event NewURI(string newURI, address updatedBy); event updatePhase(DataLibrarry.SalePhase phase); event updatePhaseForClaim(uint16 phase); event UpdateFusionPrice(uint8 evolution, uint256 newPrice); event Receive(address sender, uint256 amount); event ClaimGame(uint256 tokenIdEvo7, address user, uint256 amountClaim); event Claim(address user, uint256 amount, uint16 phase); event Withdraw(uint256 amount); event WithdrawGameFunds(uint256 amount); event WithdrawClaimFunds(uint256 amount); constructor() ERC721A("Timeout", "TMT") { _setDefaultRoyalty(address(this), 1000); } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC2981, IERC721A, ERC721A) returns (bool) { return interfaceId == type(IERC2981).interfaceId || // interface ID for royalties interfaceId == type(IERC165).interfaceId || interfaceId == 0x80ac58cd || // interface ID for ERC721. interfaceId == 0x5b5e139f || // interface ID for ERC721Metadata. super.supportsInterface(interfaceId); } modifier onlyPhase04() { require(phase == DataLibrarry.SalePhase.Open, "Invalid phase"); _; } /** * @notice get the price for an evolution ( by level of evolution ) * */ function getPriseFusion(uint8 nextGen) public view returns (uint256) { return fusionPrices[nextGen]; } /** * @notice update the new price for fusion by level. * * Requirements: * * - Only owner of contract can call this function */ function changePriceFusion(uint256 newValue, uint8 nextGen) external onlyOwner { fusionPrices[nextGen] = newValue; emit UpdateFusionPrice(nextGen, newValue); } /** * @notice update the time where a transfered nft cannont be fusionned * * Requirements: * * - Only owner of contract can call this function */ function changeTransfertSleepTime(uint duration) external onlyOwner { maxTimeAfterTransfert = duration; } /** * @notice receive eth for royalties. */ receive() external payable { uint256 value = msg.value; if (msg.sender == owner()) gameFunds += value; else { gameFunds += (value * 75) / 100; claimFunds += (value * 25) / 100; } emit Receive(msg.sender, value); } /** * @notice withdraw the funds for the game. * * Requirements: * * - Only owner of contract can call this function */ function withdrawGameFunds() external onlyOwner { (bool success, ) = payable(msg.sender).call{value: gameFunds}(""); if (!success) revert FailToWithdraw(); emit WithdrawGameFunds(gameFunds); } /** * @notice withdraw the funds for the claim. * * Requirements: * * - Only owner of contract can call this function */ function withdrawClaimFunds() external onlyOwner { (bool success, ) = payable(msg.sender).call{value: claimFunds}(""); if (!success) revert FailToWithdraw(); emit WithdrawClaimFunds(claimFunds); } /** * @notice Returns the starting token ID. */ function _startTokenId() internal view virtual override returns (uint256) { return 1; } /** * @notice set the phase for mint */ function setPhase(DataLibrarry.SalePhase _phase) external onlyOwner { phase = _phase; emit updatePhase(_phase); } /** * @notice set the phase for claim */ function setPhaseForClaim(uint8 newPhase) external onlyOwner { phaseForClaim = newPhase; emit updatePhaseForClaim(newPhase); } /** * @notice get if msg.sender has claim in the current phase */ function hasClaimed() external view returns (bool) { return isClaimed[phaseForClaim][msg.sender]; } /** * @notice updates the new token URI in contract. * * Emits a {NewURI} event. * * Requirements: * * - Only owner of contract can call this function **/ function setBaseUri(string memory uri) external onlyOwner { baseURI = uri; emit NewURI(uri, msg.sender); } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view override(ERC721A, IERC721A) returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); DataLibrarry.Metadata memory datas = getMetadatas(tokenId); bytes memory json1 = abi.encodePacked( "{", '"name": "Timeout #', tokenId.toString(), '"', ",", '"image": ', '"', baseURI, uint256(datas.evolution).toString(), "-", uint256(datas.types).toString(), '.jpeg",' ); bytes memory json = abi.encodePacked( json1, '"attributes": [{"trait_type": "Evolution","value": "', uint256(datas.evolution).toString(), '"},', '{"trait_type": "type","value": "', datas.types == 0 ? "blue" : "pink", '"}]', "}" ); return string( abi.encodePacked( "data:application/json;base64,", Base64.encode(json) ) ); } /** * @notice privatesalesmint mint on private sale. * * Requirements: * * - Only whitelisted address can mint **/ function privatesalesmint( DataLibrarry.Coupon memory coupon, DataLibrarry.CouponType couponType, DataLibrarry.CouponTypeCount memory count ) external { if (phase != DataLibrarry.SalePhase.PrivatePremint) revert InvalidPhase(); if (isFreeMinted[msg.sender] == true) revert AlreadyUsePrivateSalesMint(); FunctionLib.verifyCoupon(WhiteListSigner, coupon, couponType, count); if (couponType == DataLibrarry.CouponType.WhiteListSales) revert InvalidWhitelist(); uint16 quantity; unchecked { quantity = (count.BasicCount * 2) + (count.UltrarareCount * 3) + (count.LegendaireCount * 4) + (count.eggCount * 2); } if (indexMint + quantity > maxSupplyToMint) revert MaxSupplyPrivateSaleReach(); _mint(msg.sender, quantity); unchecked { index += quantity; indexMint += quantity; isFreeMinted[msg.sender] = true; } } /** * @notice whitelistsalesmint mint on whitelist sale. * * Requirements: * * - Only whitelisted address can mint **/ function whitelistsalesmint( uint16 quantityToMint, DataLibrarry.Coupon memory coupon, DataLibrarry.CouponType couponType, DataLibrarry.CouponTypeCount memory count ) external { if (phase != DataLibrarry.SalePhase.Whitelist) revert InvalidPhase(); FunctionLib.verifyCoupon(WhiteListSigner, coupon, couponType, count); if ( mintCountPhase03[msg.sender] + quantityToMint > maxMintPerWallet_phase03 ) revert InvalidQuantity(); if (indexMint + quantityToMint > maxSupplyToMint) revert MaxSupplyReach(); _mint(msg.sender, quantityToMint); unchecked { mintCountPhase03[msg.sender] += quantityToMint; index += quantityToMint; indexMint += quantityToMint; } } /** * @notice mint on public sale. **/ function airdrop(address to, uint8 quantityToMint) external onlyOwner { if (indexMint + quantityToMint > maxSupplyToMint) revert MaxSupplyReach(); _mint(to, quantityToMint); unchecked { index += quantityToMint; indexMint += quantityToMint; } } /** * @notice get the metadata from a tokenId * @return data struct contain the metadata */ function getMetadatas(uint256 tokenId) public view returns (DataLibrarry.Metadata memory data) { if (!_exists(tokenId)) revert QueryForNonExistantTokenId(); if (metadatas[tokenId].evolution == 0) { if (tokenId % 2 == 0) { data.types = 0; } else { data.types = 1; } return data; } return metadatas[tokenId]; } /** * @notice clacule a pseudo random number * @return uint8 0 or 1 */ function random() public view returns (uint8) { return uint8( uint256( keccak256( abi.encodePacked(block.difficulty, block.timestamp) ) ) % 2 ); } /** * @notice fusion 2 evo0 for evo1. * * Requirements: * * - need evo0 blue and evo0 pink **/ function fusionEvo(uint256 tokenId0, uint256 tokenId1) external payable onlyPhase04 { if (!_exists(tokenId0) || !_exists(tokenId1)) revert QueryForNonExistantTokenId(); if (ownerOf(tokenId0) != msg.sender || ownerOf(tokenId1) != msg.sender) revert CallerNotOwnerOfTokenId(); DataLibrarry.Metadata memory metadata; uint8 _random = random(); DataLibrarry.Metadata memory datas1 = getMetadatas(tokenId0); DataLibrarry.Metadata memory datas2 = getMetadatas(tokenId1); if (datas1.evolution != datas2.evolution) revert InvalidTokenIdsForFusion(); if (datas1.types == datas2.types) revert InvalidTokenIdsForFusion(); if( datas1.last_transfer_timestamp > 0 && datas1.last_transfer_timestamp+maxTimeAfterTransfert < block.timestamp) revert nftCannontBeFusionnedToEarly(); if( datas2.last_transfer_timestamp > 0 && datas2.last_transfer_timestamp+maxTimeAfterTransfert < block.timestamp) revert nftCannontBeFusionnedToEarly(); uint256 value = msg.value; uint8 nextEvo = datas1.evolution + 1; uint256 priceFusion = getPriseFusion(nextEvo); if (priceFusion == 0) revert InvalidPriceForFusion(); if (value < priceFusion) revert InvalidPriceForFusion(); if (nextEvo < 7) { _random = FunctionLib.logicRandomEvo( _random, indexEvolutionBlue[nextEvo], indexEvolutionPink[nextEvo], maxSupplyEvos[nextEvo] ); if (_random == 0) { metadata.types = 0; unchecked { ++indexEvolutionBlue[nextEvo]; } } else { metadata.types = 1; unchecked { ++indexEvolutionPink[nextEvo]; } } } else { metadata.types = 3; } gameFunds += (value * 640) / 1000; claimFunds += (value * 310) / 1000; evolutionFunds += (value * 50) / 1000; metadata.evolution = nextEvo; metadatas[index] = metadata; _burn(tokenId0); _burn(tokenId1); _mint(msg.sender, 1); unchecked { ++index; } } /** * @notice claim 50% of the game funds. * * Requirements: * * - need evo7 **/ function claimGame(uint256 tokenIdEvo7) external nonReentrant { if (Address.isContract(msg.sender)) revert SenderIsContract(); if (!_exists(tokenIdEvo7)) revert QueryForNonExistantTokenId(); if (ownerOf(tokenIdEvo7) != msg.sender) revert CallerNotOwnerOfTokenId(); if (metadatas[tokenIdEvo7].evolution != 7) revert InvalidEvolution(); (bool success, ) = payable(address(msg.sender)).call{value: gameFunds}( "" ); if (!success) revert FailToTransferGameFunds(); gameFunds = gameFunds / 2; _burn(tokenIdEvo7); emit ClaimGame(tokenIdEvo7, msg.sender, gameFunds); } /** * @notice claim for genesis holder. * * Requirements: * * - need to be whitelisted, snapchot **/ function claim( DataLibrarry.Coupon memory coupon, DataLibrarry.CouponClaim memory couponClaim ) external nonReentrant { if (Address.isContract(msg.sender)) revert SenderIsContract(); if (msg.sender != couponClaim.user) revert InvalidUser(); if (isClaimed[phaseForClaim][msg.sender]) revert UserAlreadyClaimForThisPhase(); if (couponClaim.phase != phaseForClaim) revert InvalidPhase(); FunctionLib.verifyCouponForClaim(WhiteListSigner, coupon, couponClaim); uint256 portion = (couponClaim.legCount * 10) + (couponClaim.urEggCount * 6) + (couponClaim.urCount * 5) + (couponClaim.basicEggCount * 2) + (couponClaim.basicCount * 1); uint256 totalClaim = (claimFunds / portionForClaim) * portion; (bool success, ) = payable(address(msg.sender)).call{value: totalClaim}( "" ); if (!success) revert FailToTransferClaimFunds(); isClaimed[phaseForClaim][msg.sender] = true; emit Claim(msg.sender, totalClaim, phaseForClaim); } function transferFrom( address from, address to, uint256 tokenId ) public payable virtual override(ERC721A, IERC721A) { if (!Address.isContract(msg.sender)) { metadatas[tokenId].last_transfer_timestamp = block.timestamp; } super.transferFrom(from, to, tokenId); } /** * @notice withdraw fusion pot to some winner * * Requirements: * * - Only owner of contract can call this function */ function withdrawToWinnerOfFusions(address winner) external nonReentrant onlyOwner { (bool success, ) = payable(winner).call{value: evolutionFunds}(""); if (!success) revert FailToWithdraw(); evolutionFunds = 0; } }
// 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.8.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/common/ERC2981.sol) pragma solidity ^0.8.0; import "../../interfaces/IERC2981.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information. * * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first. * * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the * fee is specified in basis points by default. * * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported. * * _Available since v4.5._ */ abstract contract ERC2981 is IERC2981, ERC165 { struct RoyaltyInfo { address receiver; uint96 royaltyFraction; } RoyaltyInfo private _defaultRoyaltyInfo; mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) { return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId); } /** * @inheritdoc IERC2981 */ function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) { RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId]; if (royalty.receiver == address(0)) { royalty = _defaultRoyaltyInfo; } uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator(); return (royalty.receiver, royaltyAmount); } /** * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an * override. */ function _feeDenominator() internal pure virtual returns (uint96) { return 10000; } /** * @dev Sets the royalty information that all ids in this contract will default to. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: invalid receiver"); _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Removes default royalty information. */ function _deleteDefaultRoyalty() internal virtual { delete _defaultRoyaltyInfo; } /** * @dev Sets the royalty information for a specific token id, overriding the global default. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setTokenRoyalty( uint256 tokenId, address receiver, uint96 feeNumerator ) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: Invalid parameters"); _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Resets royalty information for the token id back to the global default. */ function _resetTokenRoyalty(uint256 tokenId) internal virtual { delete _tokenRoyaltyInfo[tokenId]; } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721A.sol'; /** * @dev Interface of ERC721 token receiver. */ interface ERC721A__IERC721Receiver { function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } /** * @title ERC721A * * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721) * Non-Fungible Token Standard, including the Metadata extension. * Optimized for lower gas during batch mints. * * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...) * starting from `_startTokenId()`. * * Assumptions: * * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256). */ contract ERC721A is IERC721A { // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364). struct TokenApprovalRef { address value; } // ============================================================= // CONSTANTS // ============================================================= // Mask of an entry in packed address data. uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1; // The bit position of `numberMinted` in packed address data. uint256 private constant _BITPOS_NUMBER_MINTED = 64; // The bit position of `numberBurned` in packed address data. uint256 private constant _BITPOS_NUMBER_BURNED = 128; // The bit position of `aux` in packed address data. uint256 private constant _BITPOS_AUX = 192; // Mask of all 256 bits in packed address data except the 64 bits for `aux`. uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1; // The bit position of `startTimestamp` in packed ownership. uint256 private constant _BITPOS_START_TIMESTAMP = 160; // The bit mask of the `burned` bit in packed ownership. uint256 private constant _BITMASK_BURNED = 1 << 224; // The bit position of the `nextInitialized` bit in packed ownership. uint256 private constant _BITPOS_NEXT_INITIALIZED = 225; // The bit mask of the `nextInitialized` bit in packed ownership. uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225; // The bit position of `extraData` in packed ownership. uint256 private constant _BITPOS_EXTRA_DATA = 232; // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`. uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1; // The mask of the lower 160 bits for addresses. uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1; // The maximum `quantity` that can be minted with {_mintERC2309}. // This limit is to prevent overflows on the address data entries. // For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309} // is required to cause an overflow, which is unrealistic. uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000; // The `Transfer` event signature is given by: // `keccak256(bytes("Transfer(address,address,uint256)"))`. bytes32 private constant _TRANSFER_EVENT_SIGNATURE = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; // ============================================================= // STORAGE // ============================================================= // The next token ID to be minted. uint256 private _currentIndex; // The number of tokens burned. uint256 private _burnCounter; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. // See {_packedOwnershipOf} implementation for details. // // Bits Layout: // - [0..159] `addr` // - [160..223] `startTimestamp` // - [224] `burned` // - [225] `nextInitialized` // - [232..255] `extraData` mapping(uint256 => uint256) private _packedOwnerships; // Mapping owner address to address data. // // Bits Layout: // - [0..63] `balance` // - [64..127] `numberMinted` // - [128..191] `numberBurned` // - [192..255] `aux` mapping(address => uint256) private _packedAddressData; // Mapping from token ID to approved address. mapping(uint256 => TokenApprovalRef) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; // ============================================================= // CONSTRUCTOR // ============================================================= constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; _currentIndex = _startTokenId(); } // ============================================================= // TOKEN COUNTING OPERATIONS // ============================================================= /** * @dev Returns the starting token ID. * To change the starting token ID, please override this function. */ function _startTokenId() internal view virtual returns (uint256) { return 0; } /** * @dev Returns the next token ID to be minted. */ function _nextTokenId() internal view virtual returns (uint256) { return _currentIndex; } /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() public view virtual override returns (uint256) { // Counter underflow is impossible as _burnCounter cannot be incremented // more than `_currentIndex - _startTokenId()` times. unchecked { return _currentIndex - _burnCounter - _startTokenId(); } } /** * @dev Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view virtual returns (uint256) { // Counter underflow is impossible as `_currentIndex` does not decrement, // and it is initialized to `_startTokenId()`. unchecked { return _currentIndex - _startTokenId(); } } /** * @dev Returns the total number of tokens burned. */ function _totalBurned() internal view virtual returns (uint256) { return _burnCounter; } // ============================================================= // ADDRESS DATA OPERATIONS // ============================================================= /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) public view virtual override returns (uint256) { if (owner == address(0)) revert BalanceQueryForZeroAddress(); return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens minted by `owner`. */ function _numberMinted(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens burned by or on behalf of `owner`. */ function _numberBurned(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). */ function _getAux(address owner) internal view returns (uint64) { return uint64(_packedAddressData[owner] >> _BITPOS_AUX); } /** * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). * If there are multiple variables, please pack them into a uint64. */ function _setAux(address owner, uint64 aux) internal virtual { uint256 packed = _packedAddressData[owner]; uint256 auxCasted; // Cast `aux` with assembly to avoid redundant masking. assembly { auxCasted := aux } packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX); _packedAddressData[owner] = packed; } // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { // The interface IDs are constants representing the first 4 bytes // of the XOR of all function selectors in the interface. // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165) // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`) return interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165. interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721. interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata. } // ============================================================= // IERC721Metadata // ============================================================= /** * @dev Returns the token collection name. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the token collection symbol. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : ''; } /** * @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, it can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ''; } // ============================================================= // OWNERSHIPS OPERATIONS // ============================================================= /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { return address(uint160(_packedOwnershipOf(tokenId))); } /** * @dev Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around over time. */ function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnershipOf(tokenId)); } /** * @dev Returns the unpacked `TokenOwnership` struct at `index`. */ function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnerships[index]); } /** * @dev Initializes the ownership slot minted at `index` for efficiency purposes. */ function _initializeOwnershipAt(uint256 index) internal virtual { if (_packedOwnerships[index] == 0) { _packedOwnerships[index] = _packedOwnershipOf(index); } } /** * Returns the packed ownership data of `tokenId`. */ function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) { uint256 curr = tokenId; unchecked { if (_startTokenId() <= curr) if (curr < _currentIndex) { uint256 packed = _packedOwnerships[curr]; // If not burned. if (packed & _BITMASK_BURNED == 0) { // Invariant: // There will always be an initialized ownership slot // (i.e. `ownership.addr != address(0) && ownership.burned == false`) // before an unintialized ownership slot // (i.e. `ownership.addr == address(0) && ownership.burned == false`) // Hence, `curr` will not underflow. // // We can directly compare the packed value. // If the address is zero, packed will be zero. while (packed == 0) { packed = _packedOwnerships[--curr]; } return packed; } } } revert OwnerQueryForNonexistentToken(); } /** * @dev Returns the unpacked `TokenOwnership` struct from `packed`. */ function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) { ownership.addr = address(uint160(packed)); ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP); ownership.burned = packed & _BITMASK_BURNED != 0; ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA); } /** * @dev Packs ownership data into a single uint256. */ function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`. result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags)) } } /** * @dev Returns the `nextInitialized` flag set if `quantity` equals 1. */ function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) { // For branchless setting of the `nextInitialized` flag. assembly { // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`. result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1)) } } // ============================================================= // APPROVAL OPERATIONS // ============================================================= /** * @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) public payable virtual override { address owner = ownerOf(tokenId); if (_msgSenderERC721A() != owner) if (!isApprovedForAll(owner, _msgSenderERC721A())) { revert ApprovalCallerNotOwnerNorApproved(); } _tokenApprovals[tokenId].value = to; emit Approval(owner, to, tokenId); } /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken(); return _tokenApprovals[tokenId].value; } /** * @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) public virtual override { _operatorApprovals[_msgSenderERC721A()][operator] = approved; emit ApprovalForAll(_msgSenderERC721A(), operator, approved); } /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @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. See {_mint}. */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _startTokenId() <= tokenId && tokenId < _currentIndex && // If within bounds, _packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned. } /** * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`. */ function _isSenderApprovedOrOwner( address approvedAddress, address owner, address msgSender ) private pure returns (bool result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean. msgSender := and(msgSender, _BITMASK_ADDRESS) // `msgSender == owner || msgSender == approvedAddress`. result := or(eq(msgSender, owner), eq(msgSender, approvedAddress)) } } /** * @dev Returns the storage slot and value for the approved address of `tokenId`. */ function _getApprovedSlotAndAddress(uint256 tokenId) private view returns (uint256 approvedAddressSlot, address approvedAddress) { TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId]; // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`. assembly { approvedAddressSlot := tokenApproval.slot approvedAddress := sload(approvedAddressSlot) } } // ============================================================= // TRANSFER OPERATIONS // ============================================================= /** * @dev Transfers `tokenId` from `from` to `to`. * * 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 ) public payable virtual override { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner(); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); if (to == address(0)) revert TransferToZeroAddress(); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // We can directly increment and decrement the balances. --_packedAddressData[from]; // Updates: `balance -= 1`. ++_packedAddressData[to]; // Updates: `balance += 1`. // Updates: // - `address` to the next owner. // - `startTimestamp` to the timestamp of transfering. // - `burned` to `false`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _packOwnershipData( to, _BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public payable virtual override { safeTransferFrom(from, to, tokenId, ''); } /** * @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 memory _data ) public payable virtual override { transferFrom(from, to, tokenId); if (to.code.length != 0) if (!_checkContractOnERC721Received(from, to, tokenId, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } /** * @dev Hook that is called before a set of serially-ordered token IDs * are about to be transferred. This includes minting. * And also called before burning one token. * * `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`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ 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. * And also called after one token has been burned. * * `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` has been * transferred to `to`. * - When `from` is zero, `tokenId` has been minted for `to`. * - When `to` is zero, `tokenId` has been burned by `from`. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract. * * `from` - Previous owner of the given token ID. * `to` - Target address that will receive the token. * `tokenId` - Token ID to be transferred. * `_data` - Optional data to send along with the call. * * Returns whether the call correctly returned the expected magic value. */ function _checkContractOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns ( bytes4 retval ) { return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert TransferToNonERC721ReceiverImplementer(); } else { assembly { revert(add(32, reason), mload(reason)) } } } } // ============================================================= // MINT OPERATIONS // ============================================================= /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event for each mint. */ function _mint(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // `balance` and `numberMinted` have a maximum limit of 2**64. // `tokenId` has a maximum limit of 2**256. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); uint256 toMasked; uint256 end = startTokenId + quantity; // Use assembly to loop and emit the `Transfer` event for gas savings. // The duplicated `log4` removes an extra check and reduces stack juggling. // The assembly, together with the surrounding Solidity code, have been // delicately arranged to nudge the compiler into producing optimized opcodes. assembly { // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. toMasked := and(to, _BITMASK_ADDRESS) // Emit the `Transfer` event. log4( 0, // Start of data (0, since no data). 0, // End of data (0, since no data). _TRANSFER_EVENT_SIGNATURE, // Signature. 0, // `address(0)`. toMasked, // `to`. startTokenId // `tokenId`. ) // The `iszero(eq(,))` check ensures that large values of `quantity` // that overflows uint256 will make the loop run out of gas. // The compiler will optimize the `iszero` away for performance. for { let tokenId := add(startTokenId, 1) } iszero(eq(tokenId, end)) { tokenId := add(tokenId, 1) } { // Emit the `Transfer` event. Similar to above. log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId) } } if (toMasked == 0) revert MintToZeroAddress(); _currentIndex = end; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * This function is intended for efficient minting only during contract creation. * * It emits only one {ConsecutiveTransfer} as defined in * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309), * instead of a sequence of {Transfer} event(s). * * Calling this function outside of contract creation WILL make your contract * non-compliant with the ERC721 standard. * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309 * {ConsecutiveTransfer} event is only permissible during contract creation. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {ConsecutiveTransfer} event. */ function _mintERC2309(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are unrealistic due to the above check for `quantity` to be below the limit. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to); _currentIndex = startTokenId + quantity; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @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. * * See {_mint}. * * Emits a {Transfer} event for each mint. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal virtual { _mint(to, quantity); unchecked { if (to.code.length != 0) { uint256 end = _currentIndex; uint256 index = end - quantity; do { if (!_checkContractOnERC721Received(address(0), to, index++, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } while (index < end); // Reentrancy protection. if (_currentIndex != end) revert(); } } } /** * @dev Equivalent to `_safeMint(to, quantity, '')`. */ function _safeMint(address to, uint256 quantity) internal virtual { _safeMint(to, quantity, ''); } // ============================================================= // BURN OPERATIONS // ============================================================= /** * @dev Equivalent to `_burn(tokenId, false)`. */ function _burn(uint256 tokenId) internal virtual { _burn(tokenId, false); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId, bool approvalCheck) internal virtual { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); address from = address(uint160(prevOwnershipPacked)); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); if (approvalCheck) { // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); } _beforeTokenTransfers(from, address(0), tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // Updates: // - `balance -= 1`. // - `numberBurned += 1`. // // We can directly decrement the balance, and increment the number burned. // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`. _packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1; // Updates: // - `address` to the last owner. // - `startTimestamp` to the timestamp of burning. // - `burned` to `true`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _packOwnershipData( from, (_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, address(0), tokenId); _afterTokenTransfers(from, address(0), tokenId, 1); // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times. unchecked { _burnCounter++; } } // ============================================================= // EXTRA DATA OPERATIONS // ============================================================= /** * @dev Directly sets the extra data for the ownership data `index`. */ function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual { uint256 packed = _packedOwnerships[index]; if (packed == 0) revert OwnershipNotInitializedForExtraData(); uint256 extraDataCasted; // Cast `extraData` with assembly to avoid redundant masking. assembly { extraDataCasted := extraData } packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA); _packedOwnerships[index] = packed; } /** * @dev Called during each token transfer to set the 24bit `extraData` field. * Intended to be overridden by the cosumer contract. * * `previousExtraData` - the value of `extraData` before transfer. * * 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`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _extraData( address from, address to, uint24 previousExtraData ) internal view virtual returns (uint24) {} /** * @dev Returns the next extra data for the packed ownership data. * The returned result is shifted into position. */ function _nextExtraData( address from, address to, uint256 prevOwnershipPacked ) private view returns (uint256) { uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA); return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA; } // ============================================================= // OTHER OPERATIONS // ============================================================= /** * @dev Returns the message sender (defaults to `msg.sender`). * * If you are writing GSN compatible contracts, you need to override this function. */ function _msgSenderERC721A() internal view virtual returns (address) { return msg.sender; } /** * @dev Converts a uint256 to its ASCII string decimal representation. */ function _toString(uint256 value) internal pure virtual returns (string memory str) { assembly { // The maximum value of a uint256 contains 78 digits (1 byte per digit), but // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned. // We will need 1 word for the trailing zeros padding, 1 word for the length, // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0. let m := add(mload(0x40), 0xa0) // Update the free memory pointer to allocate. mstore(0x40, m) // Assign the `str` to the end. str := sub(m, 0x20) // Zeroize the slot after the string. mstore(str, 0) // Cache the end of the memory to calculate the length later. let end := str // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. // prettier-ignore for { let temp := value } 1 {} { str := sub(str, 1) // Write the character to the pointer. // The ASCII index of the '0' character is 48. mstore8(str, add(48, mod(temp, 10))) // Keep dividing `temp` until zero. temp := div(temp, 10) // prettier-ignore if iszero(temp) { break } } let length := sub(end, str) // Move the pointer 32 bytes leftwards to make room for the length. str := sub(str, 0x20) // Store the length. mstore(str, length) } } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721AQueryable.sol'; import '../ERC721A.sol'; /** * @title ERC721AQueryable. * * @dev ERC721A subclass with convenience query functions. */ abstract contract ERC721AQueryable is ERC721A, IERC721AQueryable { /** * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting. * * If the `tokenId` is out of bounds: * * - `addr = address(0)` * - `startTimestamp = 0` * - `burned = false` * - `extraData = 0` * * If the `tokenId` is burned: * * - `addr = <Address of owner before token was burned>` * - `startTimestamp = <Timestamp when token was burned>` * - `burned = true` * - `extraData = <Extra data when token was burned>` * * Otherwise: * * - `addr = <Address of owner>` * - `startTimestamp = <Timestamp of start of ownership>` * - `burned = false` * - `extraData = <Extra data at start of ownership>` */ function explicitOwnershipOf(uint256 tokenId) public view virtual override returns (TokenOwnership memory) { TokenOwnership memory ownership; if (tokenId < _startTokenId() || tokenId >= _nextTokenId()) { return ownership; } ownership = _ownershipAt(tokenId); if (ownership.burned) { return ownership; } return _ownershipOf(tokenId); } /** * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order. * See {ERC721AQueryable-explicitOwnershipOf} */ function explicitOwnershipsOf(uint256[] calldata tokenIds) external view virtual override returns (TokenOwnership[] memory) { unchecked { uint256 tokenIdsLength = tokenIds.length; TokenOwnership[] memory ownerships = new TokenOwnership[](tokenIdsLength); for (uint256 i; i != tokenIdsLength; ++i) { ownerships[i] = explicitOwnershipOf(tokenIds[i]); } return ownerships; } } /** * @dev Returns an array of token IDs owned by `owner`, * in the range [`start`, `stop`) * (i.e. `start <= tokenId < stop`). * * This function allows for tokens to be queried if the collection * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}. * * Requirements: * * - `start < stop` */ function tokensOfOwnerIn( address owner, uint256 start, uint256 stop ) external view virtual override returns (uint256[] memory) { unchecked { if (start >= stop) revert InvalidQueryRange(); uint256 tokenIdsIdx; uint256 stopLimit = _nextTokenId(); // Set `start = max(start, _startTokenId())`. if (start < _startTokenId()) { start = _startTokenId(); } // Set `stop = min(stop, stopLimit)`. if (stop > stopLimit) { stop = stopLimit; } uint256 tokenIdsMaxLength = balanceOf(owner); // Set `tokenIdsMaxLength = min(balanceOf(owner), stop - start)`, // to cater for cases where `balanceOf(owner)` is too big. if (start < stop) { uint256 rangeLength = stop - start; if (rangeLength < tokenIdsMaxLength) { tokenIdsMaxLength = rangeLength; } } else { tokenIdsMaxLength = 0; } uint256[] memory tokenIds = new uint256[](tokenIdsMaxLength); if (tokenIdsMaxLength == 0) { return tokenIds; } // We need to call `explicitOwnershipOf(start)`, // because the slot at `start` may not be initialized. TokenOwnership memory ownership = explicitOwnershipOf(start); address currOwnershipAddr; // If the starting slot exists (i.e. not burned), initialize `currOwnershipAddr`. // `ownership.address` will not be zero, as `start` is clamped to the valid token ID range. if (!ownership.burned) { currOwnershipAddr = ownership.addr; } for (uint256 i = start; i != stop && tokenIdsIdx != tokenIdsMaxLength; ++i) { ownership = _ownershipAt(i); if (ownership.burned) { continue; } if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; } if (currOwnershipAddr == owner) { tokenIds[tokenIdsIdx++] = i; } } // Downsize the array to fit. assembly { mstore(tokenIds, tokenIdsIdx) } return tokenIds; } } /** * @dev Returns an array of token IDs owned by `owner`. * * This function scans the ownership mapping and is O(`totalSupply`) in complexity. * It is meant to be called off-chain. * * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into * multiple smaller scans if the collection is large enough to cause * an out-of-gas error (10K collections should be fine). */ function tokensOfOwner(address owner) external view virtual override returns (uint256[] memory) { unchecked { uint256 tokenIdsIdx; address currOwnershipAddr; uint256 tokenIdsLength = balanceOf(owner); uint256[] memory tokenIds = new uint256[](tokenIdsLength); TokenOwnership memory ownership; for (uint256 i = _startTokenId(); tokenIdsIdx != tokenIdsLength; ++i) { ownership = _ownershipAt(i); if (ownership.burned) { continue; } if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; } if (currOwnershipAddr == owner) { tokenIds[tokenIdsIdx++] = i; } } return tokenIds; } } }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.13; library DataLibrarry { struct Coupon { bytes32 r; bytes32 s; uint8 v; } struct Metadata { uint8 evolution; uint8 types; uint last_transfer_timestamp; } enum MetadataType { blue, pink } enum SalePhase { Closed, PrivatePremint, Whitelist, Open } enum CouponType { PrivateSales, WhiteListSales } struct CouponTypeCount { uint16 BasicCount; uint16 UltrarareCount; uint16 LegendaireCount; uint16 eggCount; } struct CouponClaim { address user; uint256 legCount; uint256 urEggCount; uint256 urCount; uint256 basicEggCount; uint256 basicCount; uint256 phase; } }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.13; import { DataLibrarry } from "./DataLibrarry.sol"; import { ITimeout } from "../ITimeout.sol"; library FunctionLib { /** * @notice verifyCoupon verify the coupon * @dev hash the info and check if valid signature */ function verifyCoupon( address signer, DataLibrarry.Coupon memory coupon, DataLibrarry.CouponType couponType, DataLibrarry.CouponTypeCount memory couponTypeCount ) internal view { bytes32 digest = getMessageHash( couponType, couponTypeCount ); if (_isVerifiedCoupon(digest, coupon) != signer) revert ITimeout.InvalidCoupon(); } function getMessageHash( DataLibrarry.CouponType couponType, DataLibrarry.CouponTypeCount memory couponTypeCount ) internal view returns(bytes32) { return keccak256( abi.encode( couponType, couponTypeCount.BasicCount, couponTypeCount.UltrarareCount, couponTypeCount.LegendaireCount, couponTypeCount.eggCount, msg.sender ) ); } function getMessageHashForAddress( DataLibrarry.CouponType couponType, DataLibrarry.CouponTypeCount memory couponTypeCount, address addressToEncode ) internal pure returns(bytes32) { return keccak256( abi.encode( couponType, couponTypeCount.BasicCount, couponTypeCount.UltrarareCount, couponTypeCount.LegendaireCount, couponTypeCount.eggCount, addressToEncode ) ); } /** * @notice verifyCouponForClaim verify the coupon for claim * @dev hash the info and check if valid signature */ function verifyCouponForClaim( address signer, DataLibrarry.Coupon memory coupon, DataLibrarry.CouponClaim memory couponClaim ) internal pure { bytes32 digest = getMessageHashForClaim(couponClaim); if (_isVerifiedCoupon(digest, coupon) != signer) revert ITimeout.InvalidCoupon(); } function getMessageHashForClaim(DataLibrarry.CouponClaim memory couponClaim) internal pure returns(bytes32) { return keccak256( abi.encode( couponClaim.user, couponClaim.legCount, couponClaim.urEggCount, couponClaim.urCount, couponClaim.basicEggCount, couponClaim.basicCount, couponClaim.phase ) ); } /** * @notice _isVerifiedCoupon verify the coupon * @return bool true or false if signature valid */ function _isVerifiedCoupon(bytes32 digest, DataLibrarry.Coupon memory coupon) internal pure returns(address) { address signer = ecrecover(digest, coupon.v, coupon.r, coupon.s); return signer; } function logicRandomEvo( uint8 random, uint32 indexEvolutionBlue, uint32 indexEvolutionPink, uint32 maxSupplyEvo ) internal pure returns(uint8) { if (random == 0) { if (indexEvolutionBlue > indexEvolutionPink) { uint32 plage = indexEvolutionBlue - indexEvolutionPink; if (plage > 4) { random = 1; } } } else { if (indexEvolutionBlue < indexEvolutionPink) { uint32 plage = indexEvolutionPink - indexEvolutionBlue; if (plage > 4) { random = 0; } } } if (indexEvolutionBlue >= maxSupplyEvo - 5 && indexEvolutionPink >= maxSupplyEvo - 5) { if (indexEvolutionBlue > indexEvolutionPink) { uint32 plage = indexEvolutionBlue - indexEvolutionPink; if (plage >= 1) { random = 1; } } if (indexEvolutionBlue < indexEvolutionPink) { uint32 plage = indexEvolutionPink - indexEvolutionBlue; if (plage >= 1) { random = 0; } } } return random; } }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.13; interface ITimeout { // mint error error InvalidCoupon(); error InvalidWhitelist(); error InvalidQuantity(); error QueryForNonExistantTokenId(); error AlreadyUsePremint(); error AlreadyUsePrivateSalesMint(); error MaxSupplyPrivateSaleReach(); error MaxSupplyReach(); error InvalidPhase(); // fusion error error CallerNotOwnerOfTokenId(); error InvalidTokenIdsForFusion(); error InvalidPriceForFusion(); error nftCannontBeFusionnedToEarly(); // claim error error SenderIsContract(); error InvalidEvolution(); error ThisTokenIdAlreadyClaim(); error FailToTransferGameFunds(); error InvalidUser(); error FailToTransferClaimFunds(); error UserAlreadyClaimForThisPhase(); // withdraw error error FailToWithdraw(); }
// 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 (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Base64.sol) pragma solidity ^0.8.0; /** * @dev Provides a set of functions to operate with Base64 strings. * * _Available since v4.5._ */ library Base64 { /** * @dev Base64 Encoding/Decoding Table */ string internal constant _TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; /** * @dev Converts a `bytes` to its Bytes64 `string` representation. */ function encode(bytes memory data) internal pure returns (string memory) { /** * Inspired by Brecht Devos (Brechtpd) implementation - MIT licence * https://github.com/Brechtpd/base64/blob/e78d9fd951e7b0977ddca77d92dc85183770daf4/base64.sol */ if (data.length == 0) return ""; // Loads the table into memory string memory table = _TABLE; // Encoding takes 3 bytes chunks of binary data from `bytes` data parameter // and split into 4 numbers of 6 bits. // The final Base64 length should be `bytes` data length multiplied by 4/3 rounded up // - `data.length + 2` -> Round up // - `/ 3` -> Number of 3-bytes chunks // - `4 *` -> 4 characters for each chunk string memory result = new string(4 * ((data.length + 2) / 3)); /// @solidity memory-safe-assembly assembly { // Prepare the lookup table (skip the first "length" byte) let tablePtr := add(table, 1) // Prepare result pointer, jump over length let resultPtr := add(result, 32) // Run over the input, 3 bytes at a time for { let dataPtr := data let endPtr := add(data, mload(data)) } lt(dataPtr, endPtr) { } { // Advance 3 bytes dataPtr := add(dataPtr, 3) let input := mload(dataPtr) // To write each character, shift the 3 bytes (18 bits) chunk // 4 times in blocks of 6 bits for each character (18, 12, 6, 0) // and apply logical AND with 0x3F which is the number of // the previous character in the ASCII table prior to the Base64 Table // The result is then added to the table to get the character to write, // and finally write it in the result pointer but with a left shift // of 256 (1 byte) - 8 (1 ASCII char) = 248 bits mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F)))) resultPtr := add(resultPtr, 1) // Advance mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F)))) resultPtr := add(resultPtr, 1) // Advance mstore8(resultPtr, mload(add(tablePtr, and(shr(6, input), 0x3F)))) resultPtr := add(resultPtr, 1) // Advance mstore8(resultPtr, mload(add(tablePtr, and(input, 0x3F)))) resultPtr := add(resultPtr, 1) // Advance } // When data `bytes` is not exactly 3 bytes long // it is padded with `=` characters at the end switch mod(mload(data), 3) case 1 { mstore8(sub(resultPtr, 1), 0x3d) mstore8(sub(resultPtr, 2), 0x3d) } case 2 { mstore8(sub(resultPtr, 1), 0x3d) } } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. * * _Available since v4.5._ */ interface IERC2981 is IERC165 { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be paid in that same unit of exchange. */ function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (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 // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; /** * @dev Interface of ERC721A. */ interface IERC721A { /** * The caller must own the token or be an approved operator. */ error ApprovalCallerNotOwnerNorApproved(); /** * The token does not exist. */ error ApprovalQueryForNonexistentToken(); /** * Cannot query the balance for the zero address. */ error BalanceQueryForZeroAddress(); /** * Cannot mint to the zero address. */ error MintToZeroAddress(); /** * The quantity of tokens minted must be more than zero. */ error MintZeroQuantity(); /** * The token does not exist. */ error OwnerQueryForNonexistentToken(); /** * The caller must own the token or be an approved operator. */ error TransferCallerNotOwnerNorApproved(); /** * The token must be owned by `from`. */ error TransferFromIncorrectOwner(); /** * Cannot safely transfer to a contract that does not implement the * ERC721Receiver interface. */ error TransferToNonERC721ReceiverImplementer(); /** * Cannot transfer to the zero address. */ error TransferToZeroAddress(); /** * The token does not exist. */ error URIQueryForNonexistentToken(); /** * The `quantity` minted with ERC2309 exceeds the safety limit. */ error MintERC2309QuantityExceedsLimit(); /** * The `extraData` cannot be set on an unintialized ownership slot. */ error OwnershipNotInitializedForExtraData(); // ============================================================= // STRUCTS // ============================================================= struct TokenOwnership { // The address of the owner. address addr; // Stores the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}. uint24 extraData; } // ============================================================= // TOKEN COUNTERS // ============================================================= /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() external view returns (uint256); // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); // ============================================================= // IERC721 // ============================================================= /** * @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`, * 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 be 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, bytes calldata data ) external payable; /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external payable; /** * @dev Transfers `tokenId` from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} * whenever possible. * * 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 payable; /** * @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 payable; /** * @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); // ============================================================= // IERC721Metadata // ============================================================= /** * @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); // ============================================================= // IERC2309 // ============================================================= /** * @dev Emitted when tokens in `fromTokenId` to `toTokenId` * (inclusive) is transferred from `from` to `to`, as defined in the * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard. * * See {_mintERC2309} for more details. */ event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to); }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import '../IERC721A.sol'; /** * @dev Interface of ERC721AQueryable. */ interface IERC721AQueryable is IERC721A { /** * Invalid query range (`start` >= `stop`). */ error InvalidQueryRange(); /** * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting. * * If the `tokenId` is out of bounds: * * - `addr = address(0)` * - `startTimestamp = 0` * - `burned = false` * - `extraData = 0` * * If the `tokenId` is burned: * * - `addr = <Address of owner before token was burned>` * - `startTimestamp = <Timestamp when token was burned>` * - `burned = true` * - `extraData = <Extra data when token was burned>` * * Otherwise: * * - `addr = <Address of owner>` * - `startTimestamp = <Timestamp of start of ownership>` * - `burned = false` * - `extraData = <Extra data at start of ownership>` */ function explicitOwnershipOf(uint256 tokenId) external view returns (TokenOwnership memory); /** * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order. * See {ERC721AQueryable-explicitOwnershipOf} */ function explicitOwnershipsOf(uint256[] memory tokenIds) external view returns (TokenOwnership[] memory); /** * @dev Returns an array of token IDs owned by `owner`, * in the range [`start`, `stop`) * (i.e. `start <= tokenId < stop`). * * This function allows for tokens to be queried if the collection * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}. * * Requirements: * * - `start < stop` */ function tokensOfOwnerIn( address owner, uint256 start, uint256 stop ) external view returns (uint256[] memory); /** * @dev Returns an array of token IDs owned by `owner`. * * This function scans the ownership mapping and is O(`totalSupply`) in complexity. * It is meant to be called off-chain. * * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into * multiple smaller scans if the collection is large enough to cause * an out-of-gas error (10K collections should be fine). */ function tokensOfOwner(address owner) external view returns (uint256[] memory); }
// 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); } } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyUsePremint","type":"error"},{"inputs":[],"name":"AlreadyUsePrivateSalesMint","type":"error"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"CallerNotOwnerOfTokenId","type":"error"},{"inputs":[],"name":"FailToTransferClaimFunds","type":"error"},{"inputs":[],"name":"FailToTransferGameFunds","type":"error"},{"inputs":[],"name":"FailToWithdraw","type":"error"},{"inputs":[],"name":"InvalidCoupon","type":"error"},{"inputs":[],"name":"InvalidEvolution","type":"error"},{"inputs":[],"name":"InvalidPhase","type":"error"},{"inputs":[],"name":"InvalidPriceForFusion","type":"error"},{"inputs":[],"name":"InvalidQuantity","type":"error"},{"inputs":[],"name":"InvalidQueryRange","type":"error"},{"inputs":[],"name":"InvalidTokenIdsForFusion","type":"error"},{"inputs":[],"name":"InvalidUser","type":"error"},{"inputs":[],"name":"InvalidWhitelist","type":"error"},{"inputs":[],"name":"MaxSupplyPrivateSaleReach","type":"error"},{"inputs":[],"name":"MaxSupplyReach","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"QueryForNonExistantTokenId","type":"error"},{"inputs":[],"name":"SenderIsContract","type":"error"},{"inputs":[],"name":"ThisTokenIdAlreadyClaim","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"UserAlreadyClaimForThisPhase","type":"error"},{"inputs":[],"name":"nftCannontBeFusionnedToEarly","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":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint16","name":"phase","type":"uint16"}],"name":"Claim","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenIdEvo7","type":"uint256"},{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountClaim","type":"uint256"}],"name":"ClaimGame","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"ConsecutiveTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"newURI","type":"string"},{"indexed":false,"internalType":"address","name":"updatedBy","type":"address"}],"name":"NewURI","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Receive","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"evolution","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"newPrice","type":"uint256"}],"name":"UpdateFusionPrice","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawClaimFunds","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawGameFunds","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"enum DataLibrarry.SalePhase","name":"phase","type":"uint8"}],"name":"updatePhase","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"phase","type":"uint16"}],"name":"updatePhaseForClaim","type":"event"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint8","name":"quantityToMint","type":"uint8"}],"name":"airdrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"newValue","type":"uint256"},{"internalType":"uint8","name":"nextGen","type":"uint8"}],"name":"changePriceFusion","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"duration","type":"uint256"}],"name":"changeTransfertSleepTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"},{"internalType":"uint8","name":"v","type":"uint8"}],"internalType":"struct DataLibrarry.Coupon","name":"coupon","type":"tuple"},{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"legCount","type":"uint256"},{"internalType":"uint256","name":"urEggCount","type":"uint256"},{"internalType":"uint256","name":"urCount","type":"uint256"},{"internalType":"uint256","name":"basicEggCount","type":"uint256"},{"internalType":"uint256","name":"basicCount","type":"uint256"},{"internalType":"uint256","name":"phase","type":"uint256"}],"internalType":"struct DataLibrarry.CouponClaim","name":"couponClaim","type":"tuple"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimFunds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenIdEvo7","type":"uint256"}],"name":"claimGame","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"evolutionFunds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"explicitOwnershipOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"},{"internalType":"uint24","name":"extraData","type":"uint24"}],"internalType":"struct IERC721A.TokenOwnership","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"explicitOwnershipsOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"},{"internalType":"uint24","name":"extraData","type":"uint24"}],"internalType":"struct IERC721A.TokenOwnership[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId0","type":"uint256"},{"internalType":"uint256","name":"tokenId1","type":"uint256"}],"name":"fusionEvo","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"fusionPrices","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gameFunds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getMetadatas","outputs":[{"components":[{"internalType":"uint8","name":"evolution","type":"uint8"},{"internalType":"uint8","name":"types","type":"uint8"},{"internalType":"uint256","name":"last_transfer_timestamp","type":"uint256"}],"internalType":"struct DataLibrarry.Metadata","name":"data","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"nextGen","type":"uint8"}],"name":"getPriseFusion","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"hasClaimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"indexMint","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"isClaimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isFreeMinted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSupplyToMint","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxTimeAfterTransfert","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"phase","outputs":[{"internalType":"enum DataLibrarry.SalePhase","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"phaseForClaim","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"},{"internalType":"uint8","name":"v","type":"uint8"}],"internalType":"struct DataLibrarry.Coupon","name":"coupon","type":"tuple"},{"internalType":"enum DataLibrarry.CouponType","name":"couponType","type":"uint8"},{"components":[{"internalType":"uint16","name":"BasicCount","type":"uint16"},{"internalType":"uint16","name":"UltrarareCount","type":"uint16"},{"internalType":"uint16","name":"LegendaireCount","type":"uint16"},{"internalType":"uint16","name":"eggCount","type":"uint16"}],"internalType":"struct DataLibrarry.CouponTypeCount","name":"count","type":"tuple"}],"name":"privatesalesmint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"random","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","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":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"uri","type":"string"}],"name":"setBaseUri","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum DataLibrarry.SalePhase","name":"_phase","type":"uint8"}],"name":"setPhase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"newPhase","type":"uint8"}],"name":"setPhaseForClaim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"tokensOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"stop","type":"uint256"}],"name":"tokensOfOwnerIn","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"quantityToMint","type":"uint16"},{"components":[{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"},{"internalType":"uint8","name":"v","type":"uint8"}],"internalType":"struct DataLibrarry.Coupon","name":"coupon","type":"tuple"},{"internalType":"enum DataLibrarry.CouponType","name":"couponType","type":"uint8"},{"components":[{"internalType":"uint16","name":"BasicCount","type":"uint16"},{"internalType":"uint16","name":"UltrarareCount","type":"uint16"},{"internalType":"uint16","name":"LegendaireCount","type":"uint16"},{"internalType":"uint16","name":"eggCount","type":"uint16"}],"internalType":"struct DataLibrarry.CouponTypeCount","name":"count","type":"tuple"}],"name":"whitelistsalesmint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawClaimFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawGameFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"winner","type":"address"}],"name":"withdrawToWinnerOfFusions","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
610160604052673d9e0c79d2bc00006080908152675292a579bd93000060a0526767403094c8e8000060c0526781103cb9fb22000060e05267a142886f420a00006101005267c9816711daac00006101205268010cac896d23900000610140526200006f90600f906007620003e6565b506010805461ffff19166109c91790556040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810191909152620000c890601190600762000441565b506040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c08101919091526200011290601290600762000441565b506040805160e08101825260008152610800602082015261040091810191909152610200606082015261010060808083019190915260a0820152603f60c082015262000163906013906007620004eb565b506014805463076d09ca63ffffffff199091161790556202a300601555601680546001600160a01b03191673831f13996db0dc7321b09c8340432cf0e24f4d511790556040805180820190915260178082527f70617374652074686520626173652075726c20686572650000000000000000006020909201918252620001ea918162000557565b506018805460ff191690553480156200020257600080fd5b506040805180820182526007815266151a5b595bdd5d60ca1b60208083019182528351808501909452600384526215135560ea1b9084015281519192916200024d9160029162000557565b5080516200026390600390602084019062000557565b505060016000555062000276336200028f565b6001600b5562000289306103e8620002e1565b62000627565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6127106001600160601b0382161115620003555760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b60648201526084015b60405180910390fd5b6001600160a01b038216620003ad5760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c69642072656365697665720000000000000060448201526064016200034c565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600955565b8280548282559060005260206000209081019282156200042f579160200282015b828111156200042f57825182906001600160481b031690559160200191906001019062000407565b506200043d929150620005d4565b5090565b82805482825590600052602060002090600f016010900481019282156200042f5791602002820160005b83821115620004ac57835183826101000a81548161ffff021916908360ff16021790555092602001926002016020816001010492830192600103026200046b565b8015620004dc5782816101000a81549061ffff0219169055600201602081600101049283019260010302620004ac565b50506200043d929150620005d4565b82805482825590600052602060002090600f016010900481019282156200042f5791602002820160005b83821115620004ac57835183826101000a81548161ffff021916908361ffff160217905550926020019260020160208160010104928301926001030262000515565b8280546200056590620005eb565b90600052602060002090601f0160209004810192826200058957600085556200042f565b82601f10620005a457805160ff19168380011785556200042f565b828001600101855582156200042f579182015b828111156200042f578251825591602001919060010190620005b7565b5b808211156200043d5760008155600101620005d5565b600181811c908216806200060057607f821691505b6020821081036200062157634e487b7160e01b600052602260045260246000fd5b50919050565b61408c80620006376000396000f3fe6080604052600436106103025760003560e01c80638462151c11610190578063b88d4fde116100dc578063ca98c4a611610095578063e31b3e2f1161006f578063e31b3e2f14610a50578063e985e9c514610a70578063f2fde38b14610ab9578063f93c853d14610ad957600080fd5b8063ca98c4a6146109e9578063d1181e15146109ff578063d2ef079514610a1557600080fd5b8063b88d4fde14610929578063b91993861461093c578063bf6704471461095c578063c03afb591461097c578063c23dc68f1461099c578063c87b56dd146109c957600080fd5b8063937abd3711610149578063a0bcfc7f11610123578063a0bcfc7f146108ac578063a22cb465146108cc578063ac307773146108ec578063b1c9fe6e1461090257600080fd5b8063937abd371461085757806395d89b411461087757806399a2557a1461088c57600080fd5b80638462151c1461076c578063891391c1146107995780638acf70b2146107b95780638d121297146107cf5780638da5cb5b146107ef5780639216b3701461080d57600080fd5b806342842e0e1161024f5780635bbb2177116102085780636352211e116101e25780636352211e146107025780636c0360eb1461072257806370a0823114610737578063715018a61461075757600080fd5b80635bbb21771461067e5780635d729df5146106ab5780635ec01e4d146106db57600080fd5b806342842e0e146105ee57806342bf085a146106015780634a9928ad146106215780634d61097f14610636578063512735591461065657806352a8ebbd1461066b57600080fd5b806318160ddd116102bc5780632a55205a116102965780632a55205a1461052e57806337b341b31461056d57806339236bef1461059057806340849c8e146105b057600080fd5b806318160ddd146104d45780631ea3dd24146104fb57806323b872dd1461051b57600080fd5b80621ca2d7146103e257806301ffc9a714610415578063041f9aec1461044557806306fdde0314610467578063081812fc14610489578063095ea7b3146104c157600080fd5b366103dd573461031a6008546001600160a01b031690565b6001600160a01b031633036103465780600c600082825461033b919061338c565b909155506103a29050565b606461035382604b6133a4565b61035d91906133d9565b600c600082825461036e919061338c565b90915550606490506103818260196133a4565b61038b91906133d9565b600d600082825461039c919061338c565b90915550505b60408051338152602081018390527fd6717f327e0cb88b4a97a7f67a453e9258252c34937ccbdd86de7cb840e7def3910160405180910390a1005b600080fd5b3480156103ee57600080fd5b506010546103fd9061ffff1681565b60405161ffff90911681526020015b60405180910390f35b34801561042157600080fd5b50610435610430366004613403565b610aef565b604051901515815260200161040c565b34801561045157600080fd5b50610465610460366004613431565b610b6b565b005b34801561047357600080fd5b5061047c610bd9565b60405161040c91906134b5565b34801561049557600080fd5b506104a96104a43660046134c8565b610c6b565b6040516001600160a01b03909116815260200161040c565b6104656104cf3660046134f8565b610caf565b3480156104e057600080fd5b5060015460005403600019015b60405190815260200161040c565b34801561050757600080fd5b506104656105163660046134c8565b610d4f565b610465610529366004613522565b610d5c565b34801561053a57600080fd5b5061054e61054936600461355e565b610d88565b604080516001600160a01b03909316835260208301919091520161040c565b34801561057957600080fd5b506014546103fd90640100000000900461ffff1681565b34801561059c57600080fd5b506104656105ab3660046134c8565b610e34565b3480156105bc57600080fd5b50601454640100000000900461ffff166000908152601a6020908152604080832033845290915290205460ff16610435565b6104656105fc366004613522565b610fba565b34801561060d57600080fd5b5061046561061c3660046136c0565b610fd5565b34801561062d57600080fd5b506104656110fe565b34801561064257600080fd5b50610465610651366004613717565b6111ae565b34801561066257600080fd5b50610465611235565b61046561067936600461355e565b6112da565b34801561068a57600080fd5b5061069e610699366004613741565b6117a9565b60405161040c91906137f1565b3480156106b757600080fd5b506104356106c6366004613833565b601b6020526000908152604090205460ff1681565b3480156106e757600080fd5b506106f0611874565b60405160ff909116815260200161040c565b34801561070e57600080fd5b506104a961071d3660046134c8565b6118bc565b34801561072e57600080fd5b5061047c6118c7565b34801561074357600080fd5b506104ed610752366004613833565b611955565b34801561076357600080fd5b506104656119a3565b34801561077857600080fd5b5061078c610787366004613833565b6119b7565b60405161040c919061384e565b3480156107a557600080fd5b506104ed6107b43660046134c8565b611abf565b3480156107c557600080fd5b506104ed600c5481565b3480156107db57600080fd5b506104656107ea366004613833565b611ae0565b3480156107fb57600080fd5b506008546001600160a01b03166104a9565b34801561081957600080fd5b5061082d6108283660046134c8565b611b73565b60408051825160ff908116825260208085015190911690820152918101519082015260600161040c565b34801561086357600080fd5b50610465610872366004613886565b611c39565b34801561088357600080fd5b5061047c611db3565b34801561089857600080fd5b5061078c6108a73660046138cc565b611dc2565b3480156108b857600080fd5b506104656108c7366004613974565b611f49565b3480156108d857600080fd5b506104656108e73660046139bc565b611f96565b3480156108f857600080fd5b506104ed600d5481565b34801561090e57600080fd5b5060185461091c9060ff1681565b60405161040c9190613a0e565b610465610937366004613a28565b612002565b34801561094857600080fd5b50610465610957366004613aa3565b61204c565b34801561096857600080fd5b50610465610977366004613abe565b6120a4565b34801561098857600080fd5b50610465610997366004613b51565b612324565b3480156109a857600080fd5b506109bc6109b73660046134c8565b61237f565b60405161040c9190613b72565b3480156109d557600080fd5b5061047c6109e43660046134c8565b612407565b3480156109f557600080fd5b506104ed60155481565b348015610a0b57600080fd5b506104ed600e5481565b348015610a2157600080fd5b50610435610a30366004613b80565b601a60209081526000928352604080842090915290825290205460ff1681565b348015610a5c57600080fd5b506104ed610a6b366004613aa3565b612542565b348015610a7c57600080fd5b50610435610a8b366004613ba3565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b348015610ac557600080fd5b50610465610ad4366004613833565b61256c565b348015610ae557600080fd5b506103fd61200081565b60006001600160e01b0319821663152a902d60e11b1480610b2057506001600160e01b031982166301ffc9a760e01b145b80610b3b57506380ac58cd60e01b6001600160e01b03198316145b80610b565750635b5e139f60e01b6001600160e01b03198316145b80610b655750610b65826125e2565b92915050565b610b73612617565b81600f8260ff1681548110610b8a57610b8a613bcd565b600091825260209182902001919091556040805160ff841681529182018490527fdb4f88e8a67eb25463e3f2434263c2ef375c850ed6d8ea78b95f82dc34550342910160405180910390a15050565b606060028054610be890613be3565b80601f0160208091040260200160405190810160405280929190818152602001828054610c1490613be3565b8015610c615780601f10610c3657610100808354040283529160200191610c61565b820191906000526020600020905b815481529060010190602001808311610c4457829003601f168201915b5050505050905090565b6000610c7682612671565b610c93576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b6000610cba826118bc565b9050336001600160a01b03821614610cf357610cd68133610a8b565b610cf3576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b610d57612617565b601555565b333b610d78576000818152601960205260409020426001909101555b610d838383836126a6565b505050565b6000828152600a602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610dfd5750604080518082019091526009546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090610e1c906001600160601b0316876133a4565b610e2691906133d9565b915196919550909350505050565b610e3c612836565b333b15610e5c57604051631b67e63960e01b815260040160405180910390fd5b610e6581612671565b610e8257604051630cd4afff60e01b815260040160405180910390fd5b33610e8c826118bc565b6001600160a01b031614610eb35760405163fb0d26af60e01b815260040160405180910390fd5b60008181526019602052604090205460ff16600714610ee5576040516330be256360e11b815260040160405180910390fd5b600c5460405160009133918381818185875af1925050503d8060008114610f28576040519150601f19603f3d011682016040523d82523d6000602084013e610f2d565b606091505b5050905080610f4f5760405163d558b6e760e01b815260040160405180910390fd5b6002600c54610f5e91906133d9565b600c55610f6a8261288f565b600c546040805184815233602082015280820192909252517fe553833251cb2736e49869c36df1254cb119b3e160ddee32ffc163a361a238699181900360600190a150610fb76001600b55565b50565b610d8383838360405180602001604052806000815250612002565b600260185460ff166003811115610fee57610fee6139f8565b1461100c5760405163268dbf6760e21b815260040160405180910390fd5b601654611024906001600160a01b031684848461289a565b336000908152601c602052604090205460029061104690869061ffff16613c1d565b61ffff1611156110695760405163524f409b60e01b815260040160405180910390fd5b6010546120009061107f90869061ffff16613c1d565b61ffff1611156110a257604051632d7a008560e11b815260040160405180910390fd5b6110b0338561ffff166128ea565b5050336000908152601c60205260409020805461ffff1980821661ffff9283168601831617909255601480548084169083168601831617905560108054928316928216909401161790915550565b611106612617565b600d5460405160009133918381818185875af1925050503d8060008114611149576040519150601f19603f3d011682016040523d82523d6000602084013e61114e565b606091505b5050905080611170576040516303e4130960e51b815260040160405180910390fd5b7ff06b968f376992cb39cae0430ac5abeac2afa77ecd69f95596944918de2d6ded600d546040516111a391815260200190565b60405180910390a150565b6111b6612617565b601054612000906111cf9060ff84169061ffff16613c1d565b61ffff1611156111f257604051632d7a008560e11b815260040160405180910390fd5b6111ff828260ff166128ea565b6014805461ffff1980821660ff9490941661ffff9283168101831694909417909255601080549283169282169093011617905550565b61123d612617565b600c5460405160009133918381818185875af1925050503d8060008114611280576040519150601f19603f3d011682016040523d82523d6000602084013e611285565b606091505b50509050806112a7576040516303e4130960e51b815260040160405180910390fd5b7f0ddd1e1f1feaf1334e0e43aa38b666f8a6aa56232e379578e4d627aee307737b600c546040516111a391815260200190565b600360185460ff1660038111156112f3576112f36139f8565b146113355760405162461bcd60e51b815260206004820152600d60248201526c496e76616c696420706861736560981b60448201526064015b60405180910390fd5b61133e82612671565b1580611350575061134e81612671565b155b1561136e57604051630cd4afff60e01b815260040160405180910390fd5b33611378836118bc565b6001600160a01b031614158061139f575033611393826118bc565b6001600160a01b031614155b156113bd5760405163fb0d26af60e01b815260040160405180910390fd5b60408051606081018252600080825260208201819052918101829052906113e2611874565b905060006113ef85611b73565b905060006113fc85611b73565b8051835191925060ff9182169116146114285760405163177fee8360e01b815260040160405180910390fd5b806020015160ff16826020015160ff16036114565760405163177fee8360e01b815260040160405180910390fd5b6000826040015111801561147a5750426015548360400151611478919061338c565b105b156114985760405163052721ff60e11b815260040160405180910390fd5b600081604001511180156114bc57504260155482604001516114ba919061338c565b105b156114da5760405163052721ff60e11b815260040160405180910390fd5b815134906000906114ec906001613c43565b905060006114f982612542565b90508060000361151c57604051630ad3ea0b60e11b815260040160405180910390fd5b8083101561153d57604051630ad3ea0b60e11b815260040160405180910390fd5b60078260ff16101561168b576116068660118460ff168154811061156357611563613bcd565b90600052602060002090601091828204019190066002029054906101000a900461ffff1661ffff1660128560ff16815481106115a1576115a1613bcd565b90600052602060002090601091828204019190066002029054906101000a900461ffff1661ffff1660138660ff16815481106115df576115df613bcd565b60009182526020909120601082040154600f9091166002026101000a900461ffff166129c4565b95508560ff1660000361166d57600060208801526011805460ff841690811061163157611631613bcd565b6000918252602090912060108204018054600f9092166002026101000a61ffff8181021984169382900481166001011602919091179055611693565b600160208801526012805460ff841690811061163157611631613bcd565b600360208801525b6103e86116a2846102806133a4565b6116ac91906133d9565b600c60008282546116bd919061338c565b909155506103e890506116d2846101366133a4565b6116dc91906133d9565b600d60008282546116ed919061338c565b909155506103e890506117018460326133a4565b61170b91906133d9565b600e600082825461171c919061338c565b909155505060ff808316885260145461ffff166000908152601960209081526040918290208a518154928c015185166101000261ffff19909316941693909317178255880151600191909101556117728961288f565b61177b8861288f565b6117863360016128ea565b50506014805461ffff8082166001011661ffff1990911617905550505050505050565b6060816000816001600160401b038111156117c6576117c6613592565b60405190808252806020026020018201604052801561181857816020015b6040805160808101825260008082526020808301829052928201819052606082015282526000199092019101816117e45790505b50905060005b82811461186b5761184686868381811061183a5761183a613bcd565b9050602002013561237f565b82828151811061185857611858613bcd565b602090810291909101015260010161181e565b50949350505050565b600060024442604051602001611894929190918252602082015260400190565b6040516020818303038152906040528051906020012060001c6118b79190613c68565b905090565b6000610b6582612b00565b601780546118d490613be3565b80601f016020809104026020016040519081016040528092919081815260200182805461190090613be3565b801561194d5780601f106119225761010080835404028352916020019161194d565b820191906000526020600020905b81548152906001019060200180831161193057829003601f168201915b505050505081565b60006001600160a01b03821661197e576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b6119ab612617565b6119b56000612b6f565b565b606060008060006119c785611955565b90506000816001600160401b038111156119e3576119e3613592565b604051908082528060200260200182016040528015611a0c578160200160208202803683370190505b509050611a3960408051608081018252600080825260208201819052918101829052606081019190915290565b60015b838614611ab357611a4c81612bc1565b91508160400151611aab5781516001600160a01b031615611a6c57815194505b876001600160a01b0316856001600160a01b031603611aab5780838780600101985081518110611a9e57611a9e613bcd565b6020026020010181815250505b600101611a3c565b50909695505050505050565b600f8181548110611acf57600080fd5b600091825260209091200154905081565b611ae8612836565b611af0612617565b600e546040516000916001600160a01b038416918381818185875af1925050503d8060008114611b3c576040519150601f19603f3d011682016040523d82523d6000602084013e611b41565b606091505b5050905080611b63576040516303e4130960e51b815260040160405180910390fd5b506000600e55610fb76001600b55565b6040805160608101825260008082526020820181905291810191909152611b9982612671565b611bb657604051630cd4afff60e01b815260040160405180910390fd5b60008281526019602052604081205460ff169003611bf957611bd9600283613c68565b600003611bec5760006020820152919050565b600160208201525b919050565b506000908152601960209081526040918290208251606081018452815460ff80821683526101009091041692810192909252600101549181019190915290565b600160185460ff166003811115611c5257611c526139f8565b14611c705760405163268dbf6760e21b815260040160405180910390fd5b336000908152601b602052604090205460ff161515600103611ca5576040516319ed3b7b60e11b815260040160405180910390fd5b601654611cbd906001600160a01b031684848461289a565b6001826001811115611cd157611cd16139f8565b03611cef57604051635c4ff00360e11b815260040160405180910390fd5b60008160600151600202826040015160040283602001516003028460000151600202010101905061200061ffff1681601060009054906101000a900461ffff16611d399190613c1d565b61ffff161115611d5c57604051632a8c358960e21b815260040160405180910390fd5b611d6a338261ffff166128ea565b6014805461ffff1980821661ffff928316850183161790925560108054928316928216909301161790555050336000908152601b60205260409020805460ff1916600117905550565b606060038054610be890613be3565b6060818310611de457604051631960ccad60e11b815260040160405180910390fd5b600080611df060005490565b90506001851015611e0057600194505b80841115611e0c578093505b6000611e1787611955565b905084861015611e365785850381811015611e30578091505b50611e3a565b5060005b6000816001600160401b03811115611e5457611e54613592565b604051908082528060200260200182016040528015611e7d578160200160208202803683370190505b50905081600003611e93579350611f4292505050565b6000611e9e8861237f565b905060008160400151611eaf575080515b885b888114158015611ec15750848714155b15611f3657611ecf81612bc1565b92508260400151611f2e5782516001600160a01b031615611eef57825191505b8a6001600160a01b0316826001600160a01b031603611f2e5780848880600101995081518110611f2157611f21613bcd565b6020026020010181815250505b600101611eb1565b50505092835250909150505b9392505050565b611f51612617565b8051611f649060179060208401906132dd565b507fc7908db8c8588ac430ee4efe758e7ba70a0d22e32a138b548fd0d34fa8a4839581336040516111a3929190613c7c565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61200d848484610d5c565b6001600160a01b0383163b156120465761202984848484612bfd565b612046576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b612054612617565b6014805465ffff00000000191660ff83166401000000008102919091179091556040519081527f9fae59ffe0f4afdf0a60db62802b902021c660224540fb521f9a8ffc19636655906020016111a3565b6120ac612836565b333b156120cc57604051631b67e63960e01b815260040160405180910390fd5b80516001600160a01b031633146120f65760405163fd684c3b60e01b815260040160405180910390fd5b601454640100000000900461ffff166000908152601a6020908152604080832033845290915290205460ff161561213f57604051627d5d6d60e11b815260040160405180910390fd5b60145460c082015164010000000090910461ffff16146121725760405163268dbf6760e21b815260040160405180910390fd5b601654612189906001600160a01b03168383612ce5565b60008160a00151600161219c91906133a4565b60808301516121ac9060026133a4565b60608401516121bc9060056133a4565b60408501516121cc9060066133a4565b60208601516121dc90600a6133a4565b6121e6919061338c565b6121f0919061338c565b6121fa919061338c565b612204919061338c565b905060008161050e61ffff16600d5461221d91906133d9565b61222791906133a4565b604051909150600090339083908381818185875af1925050503d806000811461226c576040519150601f19603f3d011682016040523d82523d6000602084013e612271565b606091505b50509050806122935760405163766c647960e01b815260040160405180910390fd5b6014805461ffff6401000000009182900481166000908152601a602090815260408083203380855290835292819020805460ff19166001179055945485519283529082018790529290920416918101919091527f0414118624d9fc11e875a6c6065d5664d0ff5d46ffd8ed732e125311fbc611a49060600160405180910390a15050506123206001600b55565b5050565b61232c612617565b6018805482919060ff1916600183600381111561234b5761234b6139f8565b02179055507fcf3d8e53760202bc7465ebbdd1853b59f1d66307a4ae92f72a06333ae7bb8783816040516111a39190613a0e565b60408051608081018252600080825260208201819052918101829052606081019190915260408051608081018252600080825260208201819052918101829052606081019190915260018310806123d857506000548310155b156123e35792915050565b6123ec83612bc1565b90508060400151156123fe5792915050565b611f4283612da2565b606061241282612671565b61242f57604051630a14c4b560e41b815260040160405180910390fd5b600061243a83611b73565b9050600061244784612dd7565b6017612459846000015160ff16612dd7565b612469856020015160ff16612dd7565b60405160200161247c9493929190613cc2565b60405160208183030381529060405290506000816124a0846000015160ff16612dd7565b602085015160ff16156124cf576040518060400160405280600481526020016370696e6b60e01b8152506124ed565b60405180604001604052806004815260200163626c756560e01b8152505b6040516020016124ff93929190613e09565b604051602081830303815290604052905061251981612e69565b6040516020016125299190613ee4565b6040516020818303038152906040529350505050919050565b6000600f8260ff168154811061255a5761255a613bcd565b90600052602060002001549050919050565b612574612617565b6001600160a01b0381166125d95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161132c565b610fb781612b6f565b60006001600160e01b0319821663152a902d60e11b1480610b6557506301ffc9a760e01b6001600160e01b0319831614610b65565b6008546001600160a01b031633146119b55760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161132c565b600081600111158015612685575060005482105b8015610b65575050600090815260046020526040902054600160e01b161590565b60006126b182612b00565b9050836001600160a01b0316816001600160a01b0316146126e45760405162a1148160e81b815260040160405180910390fd5b600082815260066020526040902080546127108187335b6001600160a01b039081169116811491141790565b61273b5761271e8633610a8b565b61273b57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b03851661276257604051633a954ecd60e21b815260040160405180910390fd5b801561276d57600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040812091909155600160e11b841690036127ff576001840160008181526004602052604081205490036127fd5760005481146127fd5760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b031660008051602061403783398151915260405160405180910390a4505050505050565b6002600b54036128885760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161132c565b6002600b55565b610fb7816000612fbb565b60006128a683836130f3565b9050846001600160a01b03166128bc828661313e565b6001600160a01b0316146128e35760405163c73e16c160e01b815260040160405180910390fd5b5050505050565b600080549082900361290f5760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b178317905582840190839083906000805160206140378339815191528180a4600183015b81811461299a5780836000600080516020614037833981519152600080a4600101612974565b50816000036129bb57604051622e076360e81b815260040160405180910390fd5b60005550505050565b60008460ff16600003612a0e578263ffffffff168463ffffffff161115612a095760006129f18486613f29565b905060048163ffffffff161115612a0757600195505b505b612a46565b8263ffffffff168463ffffffff161015612a46576000612a2e8585613f29565b905060048163ffffffff161115612a4457600095505b505b612a51600583613f29565b63ffffffff168463ffffffff1610158015612a825750612a72600583613f29565b63ffffffff168363ffffffff1610155b15612af5578263ffffffff168463ffffffff161115612abe576000612aa78486613f29565b905060018163ffffffff1610612abc57600195505b505b8263ffffffff168463ffffffff161015612af5576000612ade8585613f29565b905060018163ffffffff1610612af357600095505b505b50835b949350505050565b60008180600111612b5657600054811015612b565760008181526004602052604081205490600160e01b82169003612b54575b80600003611f42575060001901600081815260046020526040902054612b33565b505b604051636f96cda160e11b815260040160405180910390fd5b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b604080516080810182526000808252602082018190529181018290526060810191909152600082815260046020526040902054610b65906131be565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290612c32903390899088908890600401613f4e565b6020604051808303816000875af1925050508015612c6d575060408051601f3d908101601f19168201909252612c6a91810190613f8b565b60015b612ccb573d808015612c9b576040519150601f19603f3d011682016040523d82523d6000602084013e612ca0565b606091505b508051600003612cc3576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612af8565b6000612d6582805160208083015160408085015160608087015160808089015160a0808b015160c0808d015189516001600160a01b03909d169b8d019b909b52978b01989098529389019490945287015285015283015260e082015260009061010001604051602081830303815290604052805190602001209050919050565b9050836001600160a01b0316612d7b828561313e565b6001600160a01b0316146120465760405163c73e16c160e01b815260040160405180910390fd5b604080516080810182526000808252602082018190529181018290526060810191909152610b65612dd283612b00565b6131be565b60606000612de483613205565b60010190506000816001600160401b03811115612e0357612e03613592565b6040519080825280601f01601f191660200182016040528015612e2d576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084612e3757509392505050565b60608151600003612e8857505060408051602081019091526000815290565b6000604051806060016040528060408152602001613ff76040913990506000600384516002612eb7919061338c565b612ec191906133d9565b612ecc9060046133a4565b6001600160401b03811115612ee357612ee3613592565b6040519080825280601f01601f191660200182016040528015612f0d576020820181803683370190505b509050600182016020820185865187015b80821015612f79576003820191508151603f8160121c168501518453600184019350603f81600c1c168501518453600184019350603f8160061c168501518453600184019350603f8116850151845350600183019250612f1e565b5050600386510660018114612f955760028114612fa857612fb0565b603d6001830353603d6002830353612fb0565b603d60018303535b509195945050505050565b6000612fc683612b00565b905080600080612fe486600090815260066020526040902080549091565b91509150841561302457612ff98184336126fb565b613024576130078333610a8b565b61302457604051632ce44b5f60e11b815260040160405180910390fd5b801561302f57600082555b6001600160a01b038316600081815260056020526040902080546fffffffffffffffffffffffffffffffff0190554260a01b17600360e01b17600087815260046020526040812091909155600160e11b851690036130bd576001860160008181526004602052604081205490036130bb5760005481146130bb5760008181526004602052604090208590555b505b60405186906000906001600160a01b03861690600080516020614037833981519152908390a45050600180548101905550505050565b60008282600001518360200151846040015185606001513360405160200161312096959493929190613fa8565b60405160208183030381529060405280519060200120905092915050565b60008060018484604001518560000151866020015160405160008152602001604052604051613189949392919093845260ff9290921660208401526040830152606082015260800190565b6020604051602081039080840390855afa1580156131ab573d6000803e3d6000fd5b5050604051601f19015195945050505050565b604080516080810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b831615159181019190915260e89190911c606082015290565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106132445772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310613270576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061328e57662386f26fc10000830492506010015b6305f5e10083106132a6576305f5e100830492506008015b61271083106132ba57612710830492506004015b606483106132cc576064830492506002015b600a8310610b655760010192915050565b8280546132e990613be3565b90600052602060002090601f01602090048101928261330b5760008555613351565b82601f1061332457805160ff1916838001178555613351565b82800160010185558215613351579182015b82811115613351578251825591602001919060010190613336565b5061335d929150613361565b5090565b5b8082111561335d5760008155600101613362565b634e487b7160e01b600052601160045260246000fd5b6000821982111561339f5761339f613376565b500190565b60008160001904831182151516156133be576133be613376565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826133e8576133e86133c3565b500490565b6001600160e01b031981168114610fb757600080fd5b60006020828403121561341557600080fd5b8135611f42816133ed565b803560ff81168114611bf457600080fd5b6000806040838503121561344457600080fd5b8235915061345460208401613420565b90509250929050565b60005b83811015613478578181015183820152602001613460565b838111156120465750506000910152565b600081518084526134a181602086016020860161345d565b601f01601f19169290920160200192915050565b602081526000611f426020830184613489565b6000602082840312156134da57600080fd5b5035919050565b80356001600160a01b0381168114611bf457600080fd5b6000806040838503121561350b57600080fd5b613514836134e1565b946020939093013593505050565b60008060006060848603121561353757600080fd5b613540846134e1565b925061354e602085016134e1565b9150604084013590509250925092565b6000806040838503121561357157600080fd5b50508035926020909101359150565b803561ffff81168114611bf457600080fd5b634e487b7160e01b600052604160045260246000fd5b60405160e081016001600160401b03811182821017156135ca576135ca613592565b60405290565b6000606082840312156135e257600080fd5b604051606081018181106001600160401b038211171561360457613604613592565b8060405250809150823581526020830135602082015261362660408401613420565b60408201525092915050565b803560028110611bf457600080fd5b60006080828403121561365357600080fd5b604051608081018181106001600160401b038211171561367557613675613592565b60405290508061368483613580565b815261369260208401613580565b60208201526136a360408401613580565b60408201526136b460608401613580565b60608201525092915050565b60008060008061012085870312156136d757600080fd5b6136e085613580565b93506136ef86602087016135d0565b92506136fd60808601613632565b915061370c8660a08701613641565b905092959194509250565b6000806040838503121561372a57600080fd5b613733836134e1565b915061345460208401613420565b6000806020838503121561375457600080fd5b82356001600160401b038082111561376b57600080fd5b818501915085601f83011261377f57600080fd5b81358181111561378e57600080fd5b8660208260051b85010111156137a357600080fd5b60209290920196919550909350505050565b80516001600160a01b031682526020808201516001600160401b03169083015260408082015115159083015260609081015162ffffff16910152565b6020808252825182820181905260009190848201906040850190845b81811015611ab3576138208385516137b5565b928401926080929092019160010161380d565b60006020828403121561384557600080fd5b611f42826134e1565b6020808252825182820181905260009190848201906040850190845b81811015611ab35783518352928401929184019160010161386a565b6000806000610100848603121561389c57600080fd5b6138a685856135d0565b92506138b460608501613632565b91506138c38560808601613641565b90509250925092565b6000806000606084860312156138e157600080fd5b6138ea846134e1565b95602085013595506040909401359392505050565b60006001600160401b038084111561391957613919613592565b604051601f8501601f19908116603f0116810190828211818310171561394157613941613592565b8160405280935085815286868601111561395a57600080fd5b858560208301376000602087830101525050509392505050565b60006020828403121561398657600080fd5b81356001600160401b0381111561399c57600080fd5b8201601f810184136139ad57600080fd5b612af8848235602084016138ff565b600080604083850312156139cf57600080fd5b6139d8836134e1565b9150602083013580151581146139ed57600080fd5b809150509250929050565b634e487b7160e01b600052602160045260246000fd5b6020810160048310613a2257613a226139f8565b91905290565b60008060008060808587031215613a3e57600080fd5b613a47856134e1565b9350613a55602086016134e1565b92506040850135915060608501356001600160401b03811115613a7757600080fd5b8501601f81018713613a8857600080fd5b613a97878235602084016138ff565b91505092959194509250565b600060208284031215613ab557600080fd5b611f4282613420565b600080828403610140811215613ad357600080fd5b613add85856135d0565b925060e0605f1982011215613af157600080fd5b50613afa6135a8565b613b06606085016134e1565b81526080840135602082015260a0840135604082015260c0840135606082015260e0840135608082015261010084013560a082015261012084013560c0820152809150509250929050565b600060208284031215613b6357600080fd5b813560048110611f4257600080fd5b60808101610b6582846137b5565b60008060408385031215613b9357600080fd5b82359150613454602084016134e1565b60008060408385031215613bb657600080fd5b613bbf836134e1565b9150613454602084016134e1565b634e487b7160e01b600052603260045260246000fd5b600181811c90821680613bf757607f821691505b602082108103613c1757634e487b7160e01b600052602260045260246000fd5b50919050565b600061ffff808316818516808303821115613c3a57613c3a613376565b01949350505050565b600060ff821660ff84168060ff03821115613c6057613c60613376565b019392505050565b600082613c7757613c776133c3565b500690565b604081526000613c8f6040830185613489565b905060018060a01b03831660208301529392505050565b60008151613cb881856020860161345d565b9290920192915050565b607b60f81b81526000600171226e616d65223a202254696d656f7574202360701b8184015286516020613cfb8260138701838c0161345d565b601160f91b6013928601928301819052600b60fa1b60148401526801134b6b0b3b2911d160bd1b6015840152601e8301528754601f9060009080861c86821680613d4657607f821691505b8582108103613d6357634e487b7160e01b84526022600452602484fd5b808015613d775760018114613d8c57613dbd565b60ff1984168887015282880186019450613dbd565b60008e81526020902060005b84811015613db35781548a8201890152908a01908801613d98565b5050858389010194505b50505050613dfa613de7613de1613dd4848d613ca6565b602d60f81b815260010190565b8a613ca6565b660b9a9c1959c88b60ca1b815260070190565b9b9a5050505050505050505050565b60008451613e1b81846020890161345d565b80830190507f2261747472696275746573223a205b7b2274726169745f74797065223a2022458152733b37b63aba34b7b71116113b30b63ab2911d101160611b60208201528451613e7381603484016020890161345d565b62089f4b60ea1b603492909101918201527f7b2274726169745f74797065223a202274797065222c2276616c7565223a202260378201528351613ebd81605784016020880161345d565b62227d5d60e81b60579290910191820152607d60f81b605a820152605b0195945050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c000000815260008251613f1c81601d85016020870161345d565b91909101601d0192915050565b600063ffffffff83811690831681811015613f4657613f46613376565b039392505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613f8190830184613489565b9695505050505050565b600060208284031215613f9d57600080fd5b8151611f42816133ed565b60c0810160028810613fbc57613fbc6139f8565b96815261ffff95861660208201529385166040850152918416606084015290921660808201526001600160a01b0390911660a0909101529056fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa264697066735822122053bcf06200be7556208fa70d9e858970ee3e3bff5885ee14299574df2fd75d6e64736f6c634300080d0033
Deployed Bytecode
0x6080604052600436106103025760003560e01c80638462151c11610190578063b88d4fde116100dc578063ca98c4a611610095578063e31b3e2f1161006f578063e31b3e2f14610a50578063e985e9c514610a70578063f2fde38b14610ab9578063f93c853d14610ad957600080fd5b8063ca98c4a6146109e9578063d1181e15146109ff578063d2ef079514610a1557600080fd5b8063b88d4fde14610929578063b91993861461093c578063bf6704471461095c578063c03afb591461097c578063c23dc68f1461099c578063c87b56dd146109c957600080fd5b8063937abd3711610149578063a0bcfc7f11610123578063a0bcfc7f146108ac578063a22cb465146108cc578063ac307773146108ec578063b1c9fe6e1461090257600080fd5b8063937abd371461085757806395d89b411461087757806399a2557a1461088c57600080fd5b80638462151c1461076c578063891391c1146107995780638acf70b2146107b95780638d121297146107cf5780638da5cb5b146107ef5780639216b3701461080d57600080fd5b806342842e0e1161024f5780635bbb2177116102085780636352211e116101e25780636352211e146107025780636c0360eb1461072257806370a0823114610737578063715018a61461075757600080fd5b80635bbb21771461067e5780635d729df5146106ab5780635ec01e4d146106db57600080fd5b806342842e0e146105ee57806342bf085a146106015780634a9928ad146106215780634d61097f14610636578063512735591461065657806352a8ebbd1461066b57600080fd5b806318160ddd116102bc5780632a55205a116102965780632a55205a1461052e57806337b341b31461056d57806339236bef1461059057806340849c8e146105b057600080fd5b806318160ddd146104d45780631ea3dd24146104fb57806323b872dd1461051b57600080fd5b80621ca2d7146103e257806301ffc9a714610415578063041f9aec1461044557806306fdde0314610467578063081812fc14610489578063095ea7b3146104c157600080fd5b366103dd573461031a6008546001600160a01b031690565b6001600160a01b031633036103465780600c600082825461033b919061338c565b909155506103a29050565b606461035382604b6133a4565b61035d91906133d9565b600c600082825461036e919061338c565b90915550606490506103818260196133a4565b61038b91906133d9565b600d600082825461039c919061338c565b90915550505b60408051338152602081018390527fd6717f327e0cb88b4a97a7f67a453e9258252c34937ccbdd86de7cb840e7def3910160405180910390a1005b600080fd5b3480156103ee57600080fd5b506010546103fd9061ffff1681565b60405161ffff90911681526020015b60405180910390f35b34801561042157600080fd5b50610435610430366004613403565b610aef565b604051901515815260200161040c565b34801561045157600080fd5b50610465610460366004613431565b610b6b565b005b34801561047357600080fd5b5061047c610bd9565b60405161040c91906134b5565b34801561049557600080fd5b506104a96104a43660046134c8565b610c6b565b6040516001600160a01b03909116815260200161040c565b6104656104cf3660046134f8565b610caf565b3480156104e057600080fd5b5060015460005403600019015b60405190815260200161040c565b34801561050757600080fd5b506104656105163660046134c8565b610d4f565b610465610529366004613522565b610d5c565b34801561053a57600080fd5b5061054e61054936600461355e565b610d88565b604080516001600160a01b03909316835260208301919091520161040c565b34801561057957600080fd5b506014546103fd90640100000000900461ffff1681565b34801561059c57600080fd5b506104656105ab3660046134c8565b610e34565b3480156105bc57600080fd5b50601454640100000000900461ffff166000908152601a6020908152604080832033845290915290205460ff16610435565b6104656105fc366004613522565b610fba565b34801561060d57600080fd5b5061046561061c3660046136c0565b610fd5565b34801561062d57600080fd5b506104656110fe565b34801561064257600080fd5b50610465610651366004613717565b6111ae565b34801561066257600080fd5b50610465611235565b61046561067936600461355e565b6112da565b34801561068a57600080fd5b5061069e610699366004613741565b6117a9565b60405161040c91906137f1565b3480156106b757600080fd5b506104356106c6366004613833565b601b6020526000908152604090205460ff1681565b3480156106e757600080fd5b506106f0611874565b60405160ff909116815260200161040c565b34801561070e57600080fd5b506104a961071d3660046134c8565b6118bc565b34801561072e57600080fd5b5061047c6118c7565b34801561074357600080fd5b506104ed610752366004613833565b611955565b34801561076357600080fd5b506104656119a3565b34801561077857600080fd5b5061078c610787366004613833565b6119b7565b60405161040c919061384e565b3480156107a557600080fd5b506104ed6107b43660046134c8565b611abf565b3480156107c557600080fd5b506104ed600c5481565b3480156107db57600080fd5b506104656107ea366004613833565b611ae0565b3480156107fb57600080fd5b506008546001600160a01b03166104a9565b34801561081957600080fd5b5061082d6108283660046134c8565b611b73565b60408051825160ff908116825260208085015190911690820152918101519082015260600161040c565b34801561086357600080fd5b50610465610872366004613886565b611c39565b34801561088357600080fd5b5061047c611db3565b34801561089857600080fd5b5061078c6108a73660046138cc565b611dc2565b3480156108b857600080fd5b506104656108c7366004613974565b611f49565b3480156108d857600080fd5b506104656108e73660046139bc565b611f96565b3480156108f857600080fd5b506104ed600d5481565b34801561090e57600080fd5b5060185461091c9060ff1681565b60405161040c9190613a0e565b610465610937366004613a28565b612002565b34801561094857600080fd5b50610465610957366004613aa3565b61204c565b34801561096857600080fd5b50610465610977366004613abe565b6120a4565b34801561098857600080fd5b50610465610997366004613b51565b612324565b3480156109a857600080fd5b506109bc6109b73660046134c8565b61237f565b60405161040c9190613b72565b3480156109d557600080fd5b5061047c6109e43660046134c8565b612407565b3480156109f557600080fd5b506104ed60155481565b348015610a0b57600080fd5b506104ed600e5481565b348015610a2157600080fd5b50610435610a30366004613b80565b601a60209081526000928352604080842090915290825290205460ff1681565b348015610a5c57600080fd5b506104ed610a6b366004613aa3565b612542565b348015610a7c57600080fd5b50610435610a8b366004613ba3565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b348015610ac557600080fd5b50610465610ad4366004613833565b61256c565b348015610ae557600080fd5b506103fd61200081565b60006001600160e01b0319821663152a902d60e11b1480610b2057506001600160e01b031982166301ffc9a760e01b145b80610b3b57506380ac58cd60e01b6001600160e01b03198316145b80610b565750635b5e139f60e01b6001600160e01b03198316145b80610b655750610b65826125e2565b92915050565b610b73612617565b81600f8260ff1681548110610b8a57610b8a613bcd565b600091825260209182902001919091556040805160ff841681529182018490527fdb4f88e8a67eb25463e3f2434263c2ef375c850ed6d8ea78b95f82dc34550342910160405180910390a15050565b606060028054610be890613be3565b80601f0160208091040260200160405190810160405280929190818152602001828054610c1490613be3565b8015610c615780601f10610c3657610100808354040283529160200191610c61565b820191906000526020600020905b815481529060010190602001808311610c4457829003601f168201915b5050505050905090565b6000610c7682612671565b610c93576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b6000610cba826118bc565b9050336001600160a01b03821614610cf357610cd68133610a8b565b610cf3576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b610d57612617565b601555565b333b610d78576000818152601960205260409020426001909101555b610d838383836126a6565b505050565b6000828152600a602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610dfd5750604080518082019091526009546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090610e1c906001600160601b0316876133a4565b610e2691906133d9565b915196919550909350505050565b610e3c612836565b333b15610e5c57604051631b67e63960e01b815260040160405180910390fd5b610e6581612671565b610e8257604051630cd4afff60e01b815260040160405180910390fd5b33610e8c826118bc565b6001600160a01b031614610eb35760405163fb0d26af60e01b815260040160405180910390fd5b60008181526019602052604090205460ff16600714610ee5576040516330be256360e11b815260040160405180910390fd5b600c5460405160009133918381818185875af1925050503d8060008114610f28576040519150601f19603f3d011682016040523d82523d6000602084013e610f2d565b606091505b5050905080610f4f5760405163d558b6e760e01b815260040160405180910390fd5b6002600c54610f5e91906133d9565b600c55610f6a8261288f565b600c546040805184815233602082015280820192909252517fe553833251cb2736e49869c36df1254cb119b3e160ddee32ffc163a361a238699181900360600190a150610fb76001600b55565b50565b610d8383838360405180602001604052806000815250612002565b600260185460ff166003811115610fee57610fee6139f8565b1461100c5760405163268dbf6760e21b815260040160405180910390fd5b601654611024906001600160a01b031684848461289a565b336000908152601c602052604090205460029061104690869061ffff16613c1d565b61ffff1611156110695760405163524f409b60e01b815260040160405180910390fd5b6010546120009061107f90869061ffff16613c1d565b61ffff1611156110a257604051632d7a008560e11b815260040160405180910390fd5b6110b0338561ffff166128ea565b5050336000908152601c60205260409020805461ffff1980821661ffff9283168601831617909255601480548084169083168601831617905560108054928316928216909401161790915550565b611106612617565b600d5460405160009133918381818185875af1925050503d8060008114611149576040519150601f19603f3d011682016040523d82523d6000602084013e61114e565b606091505b5050905080611170576040516303e4130960e51b815260040160405180910390fd5b7ff06b968f376992cb39cae0430ac5abeac2afa77ecd69f95596944918de2d6ded600d546040516111a391815260200190565b60405180910390a150565b6111b6612617565b601054612000906111cf9060ff84169061ffff16613c1d565b61ffff1611156111f257604051632d7a008560e11b815260040160405180910390fd5b6111ff828260ff166128ea565b6014805461ffff1980821660ff9490941661ffff9283168101831694909417909255601080549283169282169093011617905550565b61123d612617565b600c5460405160009133918381818185875af1925050503d8060008114611280576040519150601f19603f3d011682016040523d82523d6000602084013e611285565b606091505b50509050806112a7576040516303e4130960e51b815260040160405180910390fd5b7f0ddd1e1f1feaf1334e0e43aa38b666f8a6aa56232e379578e4d627aee307737b600c546040516111a391815260200190565b600360185460ff1660038111156112f3576112f36139f8565b146113355760405162461bcd60e51b815260206004820152600d60248201526c496e76616c696420706861736560981b60448201526064015b60405180910390fd5b61133e82612671565b1580611350575061134e81612671565b155b1561136e57604051630cd4afff60e01b815260040160405180910390fd5b33611378836118bc565b6001600160a01b031614158061139f575033611393826118bc565b6001600160a01b031614155b156113bd5760405163fb0d26af60e01b815260040160405180910390fd5b60408051606081018252600080825260208201819052918101829052906113e2611874565b905060006113ef85611b73565b905060006113fc85611b73565b8051835191925060ff9182169116146114285760405163177fee8360e01b815260040160405180910390fd5b806020015160ff16826020015160ff16036114565760405163177fee8360e01b815260040160405180910390fd5b6000826040015111801561147a5750426015548360400151611478919061338c565b105b156114985760405163052721ff60e11b815260040160405180910390fd5b600081604001511180156114bc57504260155482604001516114ba919061338c565b105b156114da5760405163052721ff60e11b815260040160405180910390fd5b815134906000906114ec906001613c43565b905060006114f982612542565b90508060000361151c57604051630ad3ea0b60e11b815260040160405180910390fd5b8083101561153d57604051630ad3ea0b60e11b815260040160405180910390fd5b60078260ff16101561168b576116068660118460ff168154811061156357611563613bcd565b90600052602060002090601091828204019190066002029054906101000a900461ffff1661ffff1660128560ff16815481106115a1576115a1613bcd565b90600052602060002090601091828204019190066002029054906101000a900461ffff1661ffff1660138660ff16815481106115df576115df613bcd565b60009182526020909120601082040154600f9091166002026101000a900461ffff166129c4565b95508560ff1660000361166d57600060208801526011805460ff841690811061163157611631613bcd565b6000918252602090912060108204018054600f9092166002026101000a61ffff8181021984169382900481166001011602919091179055611693565b600160208801526012805460ff841690811061163157611631613bcd565b600360208801525b6103e86116a2846102806133a4565b6116ac91906133d9565b600c60008282546116bd919061338c565b909155506103e890506116d2846101366133a4565b6116dc91906133d9565b600d60008282546116ed919061338c565b909155506103e890506117018460326133a4565b61170b91906133d9565b600e600082825461171c919061338c565b909155505060ff808316885260145461ffff166000908152601960209081526040918290208a518154928c015185166101000261ffff19909316941693909317178255880151600191909101556117728961288f565b61177b8861288f565b6117863360016128ea565b50506014805461ffff8082166001011661ffff1990911617905550505050505050565b6060816000816001600160401b038111156117c6576117c6613592565b60405190808252806020026020018201604052801561181857816020015b6040805160808101825260008082526020808301829052928201819052606082015282526000199092019101816117e45790505b50905060005b82811461186b5761184686868381811061183a5761183a613bcd565b9050602002013561237f565b82828151811061185857611858613bcd565b602090810291909101015260010161181e565b50949350505050565b600060024442604051602001611894929190918252602082015260400190565b6040516020818303038152906040528051906020012060001c6118b79190613c68565b905090565b6000610b6582612b00565b601780546118d490613be3565b80601f016020809104026020016040519081016040528092919081815260200182805461190090613be3565b801561194d5780601f106119225761010080835404028352916020019161194d565b820191906000526020600020905b81548152906001019060200180831161193057829003601f168201915b505050505081565b60006001600160a01b03821661197e576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b6119ab612617565b6119b56000612b6f565b565b606060008060006119c785611955565b90506000816001600160401b038111156119e3576119e3613592565b604051908082528060200260200182016040528015611a0c578160200160208202803683370190505b509050611a3960408051608081018252600080825260208201819052918101829052606081019190915290565b60015b838614611ab357611a4c81612bc1565b91508160400151611aab5781516001600160a01b031615611a6c57815194505b876001600160a01b0316856001600160a01b031603611aab5780838780600101985081518110611a9e57611a9e613bcd565b6020026020010181815250505b600101611a3c565b50909695505050505050565b600f8181548110611acf57600080fd5b600091825260209091200154905081565b611ae8612836565b611af0612617565b600e546040516000916001600160a01b038416918381818185875af1925050503d8060008114611b3c576040519150601f19603f3d011682016040523d82523d6000602084013e611b41565b606091505b5050905080611b63576040516303e4130960e51b815260040160405180910390fd5b506000600e55610fb76001600b55565b6040805160608101825260008082526020820181905291810191909152611b9982612671565b611bb657604051630cd4afff60e01b815260040160405180910390fd5b60008281526019602052604081205460ff169003611bf957611bd9600283613c68565b600003611bec5760006020820152919050565b600160208201525b919050565b506000908152601960209081526040918290208251606081018452815460ff80821683526101009091041692810192909252600101549181019190915290565b600160185460ff166003811115611c5257611c526139f8565b14611c705760405163268dbf6760e21b815260040160405180910390fd5b336000908152601b602052604090205460ff161515600103611ca5576040516319ed3b7b60e11b815260040160405180910390fd5b601654611cbd906001600160a01b031684848461289a565b6001826001811115611cd157611cd16139f8565b03611cef57604051635c4ff00360e11b815260040160405180910390fd5b60008160600151600202826040015160040283602001516003028460000151600202010101905061200061ffff1681601060009054906101000a900461ffff16611d399190613c1d565b61ffff161115611d5c57604051632a8c358960e21b815260040160405180910390fd5b611d6a338261ffff166128ea565b6014805461ffff1980821661ffff928316850183161790925560108054928316928216909301161790555050336000908152601b60205260409020805460ff1916600117905550565b606060038054610be890613be3565b6060818310611de457604051631960ccad60e11b815260040160405180910390fd5b600080611df060005490565b90506001851015611e0057600194505b80841115611e0c578093505b6000611e1787611955565b905084861015611e365785850381811015611e30578091505b50611e3a565b5060005b6000816001600160401b03811115611e5457611e54613592565b604051908082528060200260200182016040528015611e7d578160200160208202803683370190505b50905081600003611e93579350611f4292505050565b6000611e9e8861237f565b905060008160400151611eaf575080515b885b888114158015611ec15750848714155b15611f3657611ecf81612bc1565b92508260400151611f2e5782516001600160a01b031615611eef57825191505b8a6001600160a01b0316826001600160a01b031603611f2e5780848880600101995081518110611f2157611f21613bcd565b6020026020010181815250505b600101611eb1565b50505092835250909150505b9392505050565b611f51612617565b8051611f649060179060208401906132dd565b507fc7908db8c8588ac430ee4efe758e7ba70a0d22e32a138b548fd0d34fa8a4839581336040516111a3929190613c7c565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61200d848484610d5c565b6001600160a01b0383163b156120465761202984848484612bfd565b612046576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b612054612617565b6014805465ffff00000000191660ff83166401000000008102919091179091556040519081527f9fae59ffe0f4afdf0a60db62802b902021c660224540fb521f9a8ffc19636655906020016111a3565b6120ac612836565b333b156120cc57604051631b67e63960e01b815260040160405180910390fd5b80516001600160a01b031633146120f65760405163fd684c3b60e01b815260040160405180910390fd5b601454640100000000900461ffff166000908152601a6020908152604080832033845290915290205460ff161561213f57604051627d5d6d60e11b815260040160405180910390fd5b60145460c082015164010000000090910461ffff16146121725760405163268dbf6760e21b815260040160405180910390fd5b601654612189906001600160a01b03168383612ce5565b60008160a00151600161219c91906133a4565b60808301516121ac9060026133a4565b60608401516121bc9060056133a4565b60408501516121cc9060066133a4565b60208601516121dc90600a6133a4565b6121e6919061338c565b6121f0919061338c565b6121fa919061338c565b612204919061338c565b905060008161050e61ffff16600d5461221d91906133d9565b61222791906133a4565b604051909150600090339083908381818185875af1925050503d806000811461226c576040519150601f19603f3d011682016040523d82523d6000602084013e612271565b606091505b50509050806122935760405163766c647960e01b815260040160405180910390fd5b6014805461ffff6401000000009182900481166000908152601a602090815260408083203380855290835292819020805460ff19166001179055945485519283529082018790529290920416918101919091527f0414118624d9fc11e875a6c6065d5664d0ff5d46ffd8ed732e125311fbc611a49060600160405180910390a15050506123206001600b55565b5050565b61232c612617565b6018805482919060ff1916600183600381111561234b5761234b6139f8565b02179055507fcf3d8e53760202bc7465ebbdd1853b59f1d66307a4ae92f72a06333ae7bb8783816040516111a39190613a0e565b60408051608081018252600080825260208201819052918101829052606081019190915260408051608081018252600080825260208201819052918101829052606081019190915260018310806123d857506000548310155b156123e35792915050565b6123ec83612bc1565b90508060400151156123fe5792915050565b611f4283612da2565b606061241282612671565b61242f57604051630a14c4b560e41b815260040160405180910390fd5b600061243a83611b73565b9050600061244784612dd7565b6017612459846000015160ff16612dd7565b612469856020015160ff16612dd7565b60405160200161247c9493929190613cc2565b60405160208183030381529060405290506000816124a0846000015160ff16612dd7565b602085015160ff16156124cf576040518060400160405280600481526020016370696e6b60e01b8152506124ed565b60405180604001604052806004815260200163626c756560e01b8152505b6040516020016124ff93929190613e09565b604051602081830303815290604052905061251981612e69565b6040516020016125299190613ee4565b6040516020818303038152906040529350505050919050565b6000600f8260ff168154811061255a5761255a613bcd565b90600052602060002001549050919050565b612574612617565b6001600160a01b0381166125d95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161132c565b610fb781612b6f565b60006001600160e01b0319821663152a902d60e11b1480610b6557506301ffc9a760e01b6001600160e01b0319831614610b65565b6008546001600160a01b031633146119b55760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161132c565b600081600111158015612685575060005482105b8015610b65575050600090815260046020526040902054600160e01b161590565b60006126b182612b00565b9050836001600160a01b0316816001600160a01b0316146126e45760405162a1148160e81b815260040160405180910390fd5b600082815260066020526040902080546127108187335b6001600160a01b039081169116811491141790565b61273b5761271e8633610a8b565b61273b57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b03851661276257604051633a954ecd60e21b815260040160405180910390fd5b801561276d57600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040812091909155600160e11b841690036127ff576001840160008181526004602052604081205490036127fd5760005481146127fd5760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b031660008051602061403783398151915260405160405180910390a4505050505050565b6002600b54036128885760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161132c565b6002600b55565b610fb7816000612fbb565b60006128a683836130f3565b9050846001600160a01b03166128bc828661313e565b6001600160a01b0316146128e35760405163c73e16c160e01b815260040160405180910390fd5b5050505050565b600080549082900361290f5760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b178317905582840190839083906000805160206140378339815191528180a4600183015b81811461299a5780836000600080516020614037833981519152600080a4600101612974565b50816000036129bb57604051622e076360e81b815260040160405180910390fd5b60005550505050565b60008460ff16600003612a0e578263ffffffff168463ffffffff161115612a095760006129f18486613f29565b905060048163ffffffff161115612a0757600195505b505b612a46565b8263ffffffff168463ffffffff161015612a46576000612a2e8585613f29565b905060048163ffffffff161115612a4457600095505b505b612a51600583613f29565b63ffffffff168463ffffffff1610158015612a825750612a72600583613f29565b63ffffffff168363ffffffff1610155b15612af5578263ffffffff168463ffffffff161115612abe576000612aa78486613f29565b905060018163ffffffff1610612abc57600195505b505b8263ffffffff168463ffffffff161015612af5576000612ade8585613f29565b905060018163ffffffff1610612af357600095505b505b50835b949350505050565b60008180600111612b5657600054811015612b565760008181526004602052604081205490600160e01b82169003612b54575b80600003611f42575060001901600081815260046020526040902054612b33565b505b604051636f96cda160e11b815260040160405180910390fd5b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b604080516080810182526000808252602082018190529181018290526060810191909152600082815260046020526040902054610b65906131be565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290612c32903390899088908890600401613f4e565b6020604051808303816000875af1925050508015612c6d575060408051601f3d908101601f19168201909252612c6a91810190613f8b565b60015b612ccb573d808015612c9b576040519150601f19603f3d011682016040523d82523d6000602084013e612ca0565b606091505b508051600003612cc3576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612af8565b6000612d6582805160208083015160408085015160608087015160808089015160a0808b015160c0808d015189516001600160a01b03909d169b8d019b909b52978b01989098529389019490945287015285015283015260e082015260009061010001604051602081830303815290604052805190602001209050919050565b9050836001600160a01b0316612d7b828561313e565b6001600160a01b0316146120465760405163c73e16c160e01b815260040160405180910390fd5b604080516080810182526000808252602082018190529181018290526060810191909152610b65612dd283612b00565b6131be565b60606000612de483613205565b60010190506000816001600160401b03811115612e0357612e03613592565b6040519080825280601f01601f191660200182016040528015612e2d576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084612e3757509392505050565b60608151600003612e8857505060408051602081019091526000815290565b6000604051806060016040528060408152602001613ff76040913990506000600384516002612eb7919061338c565b612ec191906133d9565b612ecc9060046133a4565b6001600160401b03811115612ee357612ee3613592565b6040519080825280601f01601f191660200182016040528015612f0d576020820181803683370190505b509050600182016020820185865187015b80821015612f79576003820191508151603f8160121c168501518453600184019350603f81600c1c168501518453600184019350603f8160061c168501518453600184019350603f8116850151845350600183019250612f1e565b5050600386510660018114612f955760028114612fa857612fb0565b603d6001830353603d6002830353612fb0565b603d60018303535b509195945050505050565b6000612fc683612b00565b905080600080612fe486600090815260066020526040902080549091565b91509150841561302457612ff98184336126fb565b613024576130078333610a8b565b61302457604051632ce44b5f60e11b815260040160405180910390fd5b801561302f57600082555b6001600160a01b038316600081815260056020526040902080546fffffffffffffffffffffffffffffffff0190554260a01b17600360e01b17600087815260046020526040812091909155600160e11b851690036130bd576001860160008181526004602052604081205490036130bb5760005481146130bb5760008181526004602052604090208590555b505b60405186906000906001600160a01b03861690600080516020614037833981519152908390a45050600180548101905550505050565b60008282600001518360200151846040015185606001513360405160200161312096959493929190613fa8565b60405160208183030381529060405280519060200120905092915050565b60008060018484604001518560000151866020015160405160008152602001604052604051613189949392919093845260ff9290921660208401526040830152606082015260800190565b6020604051602081039080840390855afa1580156131ab573d6000803e3d6000fd5b5050604051601f19015195945050505050565b604080516080810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b831615159181019190915260e89190911c606082015290565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106132445772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310613270576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061328e57662386f26fc10000830492506010015b6305f5e10083106132a6576305f5e100830492506008015b61271083106132ba57612710830492506004015b606483106132cc576064830492506002015b600a8310610b655760010192915050565b8280546132e990613be3565b90600052602060002090601f01602090048101928261330b5760008555613351565b82601f1061332457805160ff1916838001178555613351565b82800160010185558215613351579182015b82811115613351578251825591602001919060010190613336565b5061335d929150613361565b5090565b5b8082111561335d5760008155600101613362565b634e487b7160e01b600052601160045260246000fd5b6000821982111561339f5761339f613376565b500190565b60008160001904831182151516156133be576133be613376565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826133e8576133e86133c3565b500490565b6001600160e01b031981168114610fb757600080fd5b60006020828403121561341557600080fd5b8135611f42816133ed565b803560ff81168114611bf457600080fd5b6000806040838503121561344457600080fd5b8235915061345460208401613420565b90509250929050565b60005b83811015613478578181015183820152602001613460565b838111156120465750506000910152565b600081518084526134a181602086016020860161345d565b601f01601f19169290920160200192915050565b602081526000611f426020830184613489565b6000602082840312156134da57600080fd5b5035919050565b80356001600160a01b0381168114611bf457600080fd5b6000806040838503121561350b57600080fd5b613514836134e1565b946020939093013593505050565b60008060006060848603121561353757600080fd5b613540846134e1565b925061354e602085016134e1565b9150604084013590509250925092565b6000806040838503121561357157600080fd5b50508035926020909101359150565b803561ffff81168114611bf457600080fd5b634e487b7160e01b600052604160045260246000fd5b60405160e081016001600160401b03811182821017156135ca576135ca613592565b60405290565b6000606082840312156135e257600080fd5b604051606081018181106001600160401b038211171561360457613604613592565b8060405250809150823581526020830135602082015261362660408401613420565b60408201525092915050565b803560028110611bf457600080fd5b60006080828403121561365357600080fd5b604051608081018181106001600160401b038211171561367557613675613592565b60405290508061368483613580565b815261369260208401613580565b60208201526136a360408401613580565b60408201526136b460608401613580565b60608201525092915050565b60008060008061012085870312156136d757600080fd5b6136e085613580565b93506136ef86602087016135d0565b92506136fd60808601613632565b915061370c8660a08701613641565b905092959194509250565b6000806040838503121561372a57600080fd5b613733836134e1565b915061345460208401613420565b6000806020838503121561375457600080fd5b82356001600160401b038082111561376b57600080fd5b818501915085601f83011261377f57600080fd5b81358181111561378e57600080fd5b8660208260051b85010111156137a357600080fd5b60209290920196919550909350505050565b80516001600160a01b031682526020808201516001600160401b03169083015260408082015115159083015260609081015162ffffff16910152565b6020808252825182820181905260009190848201906040850190845b81811015611ab3576138208385516137b5565b928401926080929092019160010161380d565b60006020828403121561384557600080fd5b611f42826134e1565b6020808252825182820181905260009190848201906040850190845b81811015611ab35783518352928401929184019160010161386a565b6000806000610100848603121561389c57600080fd5b6138a685856135d0565b92506138b460608501613632565b91506138c38560808601613641565b90509250925092565b6000806000606084860312156138e157600080fd5b6138ea846134e1565b95602085013595506040909401359392505050565b60006001600160401b038084111561391957613919613592565b604051601f8501601f19908116603f0116810190828211818310171561394157613941613592565b8160405280935085815286868601111561395a57600080fd5b858560208301376000602087830101525050509392505050565b60006020828403121561398657600080fd5b81356001600160401b0381111561399c57600080fd5b8201601f810184136139ad57600080fd5b612af8848235602084016138ff565b600080604083850312156139cf57600080fd5b6139d8836134e1565b9150602083013580151581146139ed57600080fd5b809150509250929050565b634e487b7160e01b600052602160045260246000fd5b6020810160048310613a2257613a226139f8565b91905290565b60008060008060808587031215613a3e57600080fd5b613a47856134e1565b9350613a55602086016134e1565b92506040850135915060608501356001600160401b03811115613a7757600080fd5b8501601f81018713613a8857600080fd5b613a97878235602084016138ff565b91505092959194509250565b600060208284031215613ab557600080fd5b611f4282613420565b600080828403610140811215613ad357600080fd5b613add85856135d0565b925060e0605f1982011215613af157600080fd5b50613afa6135a8565b613b06606085016134e1565b81526080840135602082015260a0840135604082015260c0840135606082015260e0840135608082015261010084013560a082015261012084013560c0820152809150509250929050565b600060208284031215613b6357600080fd5b813560048110611f4257600080fd5b60808101610b6582846137b5565b60008060408385031215613b9357600080fd5b82359150613454602084016134e1565b60008060408385031215613bb657600080fd5b613bbf836134e1565b9150613454602084016134e1565b634e487b7160e01b600052603260045260246000fd5b600181811c90821680613bf757607f821691505b602082108103613c1757634e487b7160e01b600052602260045260246000fd5b50919050565b600061ffff808316818516808303821115613c3a57613c3a613376565b01949350505050565b600060ff821660ff84168060ff03821115613c6057613c60613376565b019392505050565b600082613c7757613c776133c3565b500690565b604081526000613c8f6040830185613489565b905060018060a01b03831660208301529392505050565b60008151613cb881856020860161345d565b9290920192915050565b607b60f81b81526000600171226e616d65223a202254696d656f7574202360701b8184015286516020613cfb8260138701838c0161345d565b601160f91b6013928601928301819052600b60fa1b60148401526801134b6b0b3b2911d160bd1b6015840152601e8301528754601f9060009080861c86821680613d4657607f821691505b8582108103613d6357634e487b7160e01b84526022600452602484fd5b808015613d775760018114613d8c57613dbd565b60ff1984168887015282880186019450613dbd565b60008e81526020902060005b84811015613db35781548a8201890152908a01908801613d98565b5050858389010194505b50505050613dfa613de7613de1613dd4848d613ca6565b602d60f81b815260010190565b8a613ca6565b660b9a9c1959c88b60ca1b815260070190565b9b9a5050505050505050505050565b60008451613e1b81846020890161345d565b80830190507f2261747472696275746573223a205b7b2274726169745f74797065223a2022458152733b37b63aba34b7b71116113b30b63ab2911d101160611b60208201528451613e7381603484016020890161345d565b62089f4b60ea1b603492909101918201527f7b2274726169745f74797065223a202274797065222c2276616c7565223a202260378201528351613ebd81605784016020880161345d565b62227d5d60e81b60579290910191820152607d60f81b605a820152605b0195945050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c000000815260008251613f1c81601d85016020870161345d565b91909101601d0192915050565b600063ffffffff83811690831681811015613f4657613f46613376565b039392505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613f8190830184613489565b9695505050505050565b600060208284031215613f9d57600080fd5b8151611f42816133ed565b60c0810160028810613fbc57613fbc6139f8565b96815261ffff95861660208201529385166040850152918416606084015290921660808201526001600160a01b0390911660a0909101529056fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa264697066735822122053bcf06200be7556208fa70d9e858970ee3e3bff5885ee14299574df2fd75d6e64736f6c634300080d0033
Loading...
Loading
[ Download: CSV Export ]
[ 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.