DOUDOCHAIN (DOUDO)
Overview
TokenID
866
Total Transfers
-
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract
Loading...
Loading
Loading...
Loading
Loading...
Loading
Contract Name:
DOUDOCHAIN
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL3.0 pragma solidity ^0.8.9; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import {VRFConsumerBaseV2Plus} from "@chainlink/contracts/src/v0.8/vrf/dev/VRFConsumerBaseV2Plus.sol"; import {VRFV2PlusClient} from "@chainlink/contracts/src/v0.8/vrf/dev/libraries/VRFV2PlusClient.sol"; import {AggregatorV3Interface} from "@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol"; import "erc721a/contracts/ERC721A.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; // DOUDOCHAIN contract implementing ERC721A for efficient batch minting, // and integrating with Chainlink VRF for randomness in reveals. contract DOUDOCHAIN is ERC721A, VRFConsumerBaseV2Plus, ReentrancyGuard, AccessControl { // Chainlink VRF-related variables and constants uint256 s_subscriptionId; bytes32 immutable s_keyHash; uint32 callbackGasLimit = 2500000; uint16 requestConfirmations = 3; // Define roles bytes32 public constant OPERATION_ROLE = keccak256("OPERATION_ROLE"); bytes32 public constant ADMINMINT_ROLE = keccak256("ADMINMINT_ROLE"); // enum to seperate reveal and lastprize enum Variable { reveal, lastPrize } mapping(uint256 => Variable) public requests; // Event emitted when a new series is created event NewSeries( uint256 indexed seriesID, string seriesName, uint256 totalTicketNumbers, uint256 remainingTicketNumbers, uint256 priceInUSDTWei, uint256 priceInTWD, bool isGoodsArrived, uint256 estimateDeliverTime, uint256 exchangeExpireTime, string exchangeTokenURI, string unrevealTokenURI, string revealTokenURI, string seriesMetaDataURI, address lastPrizeOwner, bool isRefund, bool isPreOrder ); // Event emitted when a new series is updated event UpdateSeriesInformation( uint256 indexed seriesID, bool isGoodsArrived, // 是否獎品已送達開放Reveal uint256 estimateDeliverTime, uint256 exchangeExpireTime, string exchangeTokenURI, string unrevealTokenURI, string revealTokenURI, string seriesMetaDataURI ); // Event emitted when a new series is refunded event RefundSeries(uint256 indexed seriesID, bool isRefund); // Event emitted when a series lastPrizeOwner is updated event UpdateSeriesLastPrizeOwner( uint256 indexed seriesID, address[] lastPrizeOwner ); //Event emitted when a series remainingTicketNumbers is updated event UpdateSeriesRemainingTicketNumbers( uint256 indexed seriesID, uint256 remainingTicketNumbers ); // Event emitted when a new NFT Prize is created event NewSubPrize( uint256 indexed seriesID, uint256 subPrizeID, string prizeGroup, string subPrizeName, uint256 subPrizeRemainingQuantity ); // Event emitted when subPrize reset event ResetSubPrize(uint256 indexed seriesID); // Event emitted when a new NFT Prize is updated event UpdatePrize( uint256 indexed seriesID, uint256 subPrizeID, uint256 subPrizeRemainingQuantity ); // Event emitted when a ticket status is created event NewTicketStatus( uint256 tokenID, uint256 seriesID, uint256 tokenRevealedPrize, bool tokenExchange, bool tokenRevealed, address tokenOwner ); // Event emitted when a ticket status is updated event UpdateTicketStatus( uint256 tokenID, uint256 seriesID, uint256 tokenRevealedPrize, bool tokenExchange, bool tokenRevealed ); // Event emitted when a last prize random number request is sent event LastPrizeDraw(uint256 requestId, uint256 seriesID, uint256 quantity); // Event emitted when a last prize random number request is fulfilled event LastPrizeWinner(uint256 requestId, uint256[] randomWord); // Event emitted when a reveal random number request is sent event RevealDrawSent(uint256 requestId, uint256[] tokenIDs); // Event emitted when a reveal random number request is fulfilled event RevealDrawFulfilled( uint256 requestId, uint256 seriesID, uint256[] randomWords ); // Structure representing each NFT's ticket status struct TicketStatus { uint256 seriesID; // NFT所屬的抽獎系列 uint256 tokenRevealedPrize; //開獎結果 Ex 1~8代表 A~H賞 bool tokenExchange; // 有沒有兌換過實體獎品 bool tokenRevealed; // Whether the token has been revealed } // Structure representing each subprize in a series struct subPrize { uint256 subPrizeID; // 獎項ID 例子 '1~20' string prizeGroup; // 獎項群組 A, B, C, D, E, F, G, H string subPrizeName; // 獎項名稱,如 A1 uint256 subPrizeRemainingQuantity; // 該獎項預設有幾個 Ex A賞 2個, B賞4個 etc. } // Structure representing each NFT series struct Series { subPrize[] subPrizes; string seriesName; // 此抽獎系列名稱 uint256 totalTicketNumbers; // 總共提供幾抽 uint256 remainingTicketNumbers; // 剩餘幾抽 uint256 priceInUSDTWei; // 每抽多少錢 bool isGoodsArrived; // 是否獎品已送達開放Reveal uint256 estimateDeliverTime; // 預估到貨時間 uint256 exchangeExpireTime; // 取貨最後時間 address[] lastPrizeOwner; // 最後一賞得主 string exchangeTokenURI; // 兌換獎品修改metadata string unrevealTokenURI; // 抽獎前票券長相 string revealTokenURI; // 抽獎後票券長相 string seriesMetaDataURI; // Link to off chain infromation like image source uint256 priceInTWD; // 每抽多少台幣 bool isRefund; // 本套是否進行退款 bool isPreOrder; // 本套是否為集單 } // Mappings for series data and token status mapping(uint256 => Series) public ICHISeries; mapping(uint256 => uint256[]) public seriesTokens; mapping(uint256 => TicketStatus) public ticketStatusDetail; mapping(uint256 => uint256[]) public requestToRevealToken; mapping(uint256 => uint256) public requestToLastPrizeToken; // Define seriesCounter variable uint256 private seriesCounter = 0; // Erc20 token to let user to choose which currency to pay, include contract address, and price feed address // customizedRateToUSDTinWei EX 1 token = 0.8 USDT then customizedRateToUSDTinWei = 0.8 * 1e18 struct Currency { address currencyToken; address priceFeedAddress; uint256 customizedRateToUSDTinWei; uint8 decimals; } Currency[] public currencyList; // Custom error messages error GoodsAlreadyArrived(); error GoodsNotArrived(); error SeriesIsRefund(); error AlreadyRefund(); error NotEnoughNFTsRemaining(); error NotSoldOutYet(); error AlreadyChoseWinner(); error SubprizeQuantityNotEqual(); error InsufficientMaticSent(); error InsufficientCurrencyAllowance(); error InsufficientCurrencyBalance(); error NotEnoughTokensToReveal(); error NotTheTokenOwner(); error TokenAlreadyExchanged(); error TokenAlreadyRevealed(); error TokenNotRevealed(); error TokenNotInTheSeries(); error TokenDoesNotExist(); // Constructor for setting up the DOUDOCHAIN contract constructor( uint256 subscriptionId ) ERC721A("DOUDOCHAIN", "DOUDO") VRFConsumerBaseV2Plus(0x343300b5d84D444B2ADc9116FEF1bED02BE49Cf2) { s_subscriptionId = subscriptionId; s_keyHash = 0x816bedba8a50b294e5cbd47842baf240c2385f2eaf719edbd4f250a137a8c899; // 0x816bedba8a50b294e5cbd47842baf240c2385f2eaf719edbd4f250a137a8c899 amoy // 0x192234a5cda4cc07c0b66dfbcfbb785341cc790edc50032e842667dbb506cada // 0x8596b430971ac45bdf6088665b9ad8e8630c9d5049ab54b14dff711bee7c0e26 testnet hash // 0x343300b5d84D444B2ADc9116FEF1bED02BE49Cf2 amoy Coordinator // Set up roles _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); // Grant the contract deployer the default admin role _setupRole(OPERATION_ROLE, msg.sender); // Grant the contract deployer the withdraw role _setupRole(ADMINMINT_ROLE, msg.sender); // Grant the contract deployer the admin role } // Override supportsInterface function supportsInterface( bytes4 interfaceId ) public view virtual override(ERC721A, AccessControl) returns (bool) { return ERC721A.supportsInterface(interfaceId) || AccessControl.supportsInterface(interfaceId); } // Function to create a new NFT series function createSeries( string memory seriesName, uint256 priceInUSDTWei, uint256 priceInTWD, uint256 estimateDeliverTime, uint256 totalPrizeQuantity, bool isPreOrder, string memory exchangeTokenURI, string memory unrevealTokenURI, string memory revealTokenURI, string memory seriesMetaDataURI ) public onlyRole(OPERATION_ROLE) { // Calculate the total of all prize quantities uint256 seriesID = seriesCounter++; Series storage series = ICHISeries[seriesID]; series.seriesName = seriesName; series.totalTicketNumbers = totalPrizeQuantity; series.remainingTicketNumbers = totalPrizeQuantity; series.priceInUSDTWei = priceInUSDTWei; series.priceInTWD = priceInTWD; series.isGoodsArrived = false; series.estimateDeliverTime = estimateDeliverTime; series.exchangeExpireTime = estimateDeliverTime + 86400 * 60; series.exchangeTokenURI = exchangeTokenURI; series.unrevealTokenURI = unrevealTokenURI; series.revealTokenURI = revealTokenURI; series.seriesMetaDataURI = seriesMetaDataURI; series.isRefund = false; series.isPreOrder = isPreOrder; // Emit event for the new series emitNewSeriesEvent(seriesID); } function emitNewSeriesEvent(uint256 seriesID) internal { Series storage series = ICHISeries[seriesID]; emit NewSeries( seriesID, series.seriesName, series.totalTicketNumbers, series.totalTicketNumbers, series.priceInUSDTWei, series.priceInTWD, false, series.estimateDeliverTime, series.estimateDeliverTime + 86400 * 60, series.exchangeTokenURI, series.unrevealTokenURI, series.revealTokenURI, series.seriesMetaDataURI, address(0), false, series.isPreOrder ); } function updateSeriesInfo( uint256 seriesID, uint256 estimateDeliverTime, string memory exchangeTokenURI, string memory unrevealTokenURI, string memory revealTokenURI, string memory seriesMetaDataURI ) public onlyRole(OPERATION_ROLE) { Series storage series = ICHISeries[seriesID]; // require series is not arrived if (series.isGoodsArrived) { revert GoodsAlreadyArrived(); } series.estimateDeliverTime = estimateDeliverTime; series.exchangeExpireTime = estimateDeliverTime + 86400 * 60; series.exchangeTokenURI = exchangeTokenURI; series.unrevealTokenURI = unrevealTokenURI; series.revealTokenURI = revealTokenURI; series.seriesMetaDataURI = seriesMetaDataURI; emit UpdateSeriesInformation( seriesID, series.isGoodsArrived, estimateDeliverTime, estimateDeliverTime + 86400 * 60, exchangeTokenURI, unrevealTokenURI, revealTokenURI, seriesMetaDataURI ); } function updateSeriesSubPrize( uint256 seriesID, subPrize[] memory subPrizes ) public onlyRole(OPERATION_ROLE) { Series storage series = ICHISeries[seriesID]; // check series is not arrived if (series.isGoodsArrived) { revert GoodsAlreadyArrived(); } // check subprize remaining quantity = total ticket numbers uint256 totalPrizeQuantity = 0; for (uint256 i = 0; i < subPrizes.length; i++) { totalPrizeQuantity += subPrizes[i].subPrizeRemainingQuantity; } if (totalPrizeQuantity != series.totalTicketNumbers) { revert SubprizeQuantityNotEqual(); } // reset subprize series.subPrizes = new subPrize[](0); emit ResetSubPrize(seriesID); for (uint256 i = 0; i < subPrizes.length; i++) { series.subPrizes.push(subPrizes[i]); emit NewSubPrize( seriesID, 1 + i, subPrizes[i].prizeGroup, subPrizes[i].subPrizeName, subPrizes[i].subPrizeRemainingQuantity ); } } // Function to mint NFTs in a specified series function mintByMatic( uint256 seriesID, uint256 quantity ) public payable nonReentrant { Series storage series = ICHISeries[seriesID]; if (series.isRefund) { revert SeriesIsRefund(); } // Get latest MATIC/USDT rate from Chainlink int256 maticPriceInUSDT = getChainlinkDataFeedLatestAnswer( 0x001382149eBa3441043c1c66972b4772963f5D43 // 0x001382149eBa3441043c1c66972b4772963f5D43 amoy // 0x2514895c72f50D8bd4B4F9b1110F0D6bD2c97526 ); // Chainlink MATIC/USDT rate with 8 decimals uint256 maticPerUSDTInWei = uint256(maticPriceInUSDT) * 1e10; // Adjust Chainlink price to 18 decimals // Calculate the total cost in MATIC wei uint256 totalCostInMaticWei = (series.priceInUSDTWei * 1e12 * quantity * 1e18) / maticPerUSDTInWei; // Check if sent MATIC is sufficient if (msg.value < totalCostInMaticWei) { revert InsufficientMaticSent(); } // Check if there are enough NFTs remaining to mint if (quantity > series.remainingTicketNumbers) { revert NotEnoughNFTsRemaining(); } // Minting process _safeMint(msg.sender, quantity); for (uint256 i = 0; i < quantity; ++i) { uint256 tokenId = _nextTokenId() - quantity + i; ticketStatusDetail[tokenId].seriesID = seriesID; seriesTokens[seriesID].push(tokenId); // Track each NFT by series emit NewTicketStatus( tokenId, seriesID, 0, false, false, msg.sender ); } // Update and emit remaining ticket numbers for the series series.remainingTicketNumbers -= quantity; emit UpdateSeriesRemainingTicketNumbers( seriesID, series.remainingTicketNumbers ); } // Function to mint NFTs with a currency token list to let user to choose ex usdc, eth etc.. and pass chainlink price feed address to get price // use currencyList struct to let user to choose which currency to pay // combine mintByUSDT into it and remove mintByUSDT function mintByCurrency( uint256 seriesID, uint256 quantity, uint256 CurrencyIndex // index of currencyList ) public nonReentrant { Series storage series = ICHISeries[seriesID]; if (series.isRefund) { revert SeriesIsRefund(); } Currency memory currency = currencyList[CurrencyIndex]; uint256 totalCostInWei; uint256 adjustedDecimals = 10 ** currency.decimals; if (currency.customizedRateToUSDTinWei != 0) { // Use the custom rate if defined totalCostInWei = (series.priceInUSDTWei * quantity * adjustedDecimals) / currency.customizedRateToUSDTinWei; } else { int256 priceInUSDT = getChainlinkDataFeedLatestAnswer( currency.priceFeedAddress ); // Get latest currency/USDT rate // the calculate logic like mint function uint256 toeknPerUSDTInWei = uint256(priceInUSDT) * 1e10; // Convert price to wei (assuming 8 decimals from Chainlink) totalCostInWei = (series.priceInUSDTWei * quantity * 1e18) / toeknPerUSDTInWei; } if ( IERC20(currency.currencyToken).allowance( msg.sender, address(this) ) < totalCostInWei ) { revert InsufficientCurrencyAllowance(); } if ( IERC20(currency.currencyToken).balanceOf(msg.sender) < totalCostInWei ) { revert InsufficientCurrencyBalance(); } IERC20(currency.currencyToken).transferFrom( msg.sender, address(this), totalCostInWei ); if (quantity > series.remainingTicketNumbers) { revert NotEnoughNFTsRemaining(); } _safeMint(msg.sender, quantity); for (uint256 i = 0; i < quantity; ++i) { uint256 tokenId = _nextTokenId() - quantity + i; ticketStatusDetail[tokenId].seriesID = seriesID; seriesTokens[seriesID].push(tokenId); emit NewTicketStatus( tokenId, seriesID, 0, false, false, msg.sender ); } series.remainingTicketNumbers -= quantity; emit UpdateSeriesRemainingTicketNumbers( seriesID, series.remainingTicketNumbers ); } // Admin function to mint NFTs in a specified series without payment function AdminMint( address to, uint256 seriesID, uint256 quantity ) public onlyRole(ADMINMINT_ROLE) { Series storage series = ICHISeries[seriesID]; if (quantity > series.remainingTicketNumbers) { revert NotEnoughNFTsRemaining(); } if (series.isRefund) { revert SeriesIsRefund(); } _safeMint(to, quantity); // Correctly map the token IDs to the series for (uint256 i = 0; i < quantity; ++i) { uint256 tokenId = _nextTokenId() - quantity + i; ticketStatusDetail[tokenId].seriesID = seriesID; seriesTokens[seriesID].push(tokenId); // Append the token ID to the series // Emit event for the new ticket status emit NewTicketStatus(tokenId, seriesID, 0, false, false, to); } series.remainingTicketNumbers -= quantity; // emit event to update series remaining ticket numbers emit UpdateSeriesRemainingTicketNumbers( seriesID, series.remainingTicketNumbers ); } // Function to reveal specified NFTs in a series function reveal(uint256 seriesID, uint256[] memory tokenIDs) public { Series storage series = ICHISeries[seriesID]; if (!series.isGoodsArrived) { revert GoodsNotArrived(); } if (tokenIDs.length > balanceOf(msg.sender)) { revert NotEnoughTokensToReveal(); } if (series.isRefund) { revert SeriesIsRefund(); } // Request randomness for each token for (uint256 i = 0; i < tokenIDs.length; i++) { if (ownerOf(tokenIDs[i]) != msg.sender) { revert NotTheTokenOwner(); } if (ticketStatusDetail[tokenIDs[i]].tokenRevealed) { revert TokenAlreadyRevealed(); } if (ticketStatusDetail[tokenIDs[i]].seriesID != seriesID) { revert TokenNotInTheSeries(); } } uint256 requestId = s_vrfCoordinator.requestRandomWords( VRFV2PlusClient.RandomWordsRequest({ keyHash: s_keyHash, subId: s_subscriptionId, requestConfirmations: requestConfirmations, callbackGasLimit: callbackGasLimit, numWords: uint32(tokenIDs.length), extraArgs: VRFV2PlusClient._argsToBytes( VRFV2PlusClient.ExtraArgsV1({nativePayment: false}) ) }) ); requestToRevealToken[requestId] = tokenIDs; requests[requestId] = Variable.reveal; emit RevealDrawSent(requestId, tokenIDs); } // Function to choose the winner of a series last prize with vrf function chooseLastPrizeWinner( uint256 seriesID, uint32 quantity ) public onlyRole(OPERATION_ROLE) { Series storage series = ICHISeries[seriesID]; if (series.remainingTicketNumbers != 0) { revert NotSoldOutYet(); } if (series.lastPrizeOwner.length != 0) { revert AlreadyChoseWinner(); } if (series.isRefund) { revert SeriesIsRefund(); } uint256[] memory tokensInSeries = seriesTokens[seriesID]; uint256 totalTokensInSeries = tokensInSeries.length; uint256[] memory lastTokenIDInSeries = new uint256[](1); lastTokenIDInSeries[0] = tokensInSeries[totalTokensInSeries - 1]; if (!series.isPreOrder) { address winnerAddress = ownerOf( tokensInSeries[totalTokensInSeries - 1] ); _safeMint(winnerAddress, 1); uint256 newTokenId = _nextTokenId() - 1; ticketStatusDetail[newTokenId].seriesID = seriesID; ticketStatusDetail[newTokenId].tokenRevealedPrize = 999; ticketStatusDetail[newTokenId].tokenRevealed = true; // Add the winner to the lastPrizeOwner array series.lastPrizeOwner.push(winnerAddress); // Emit event for the new ticket status emit NewTicketStatus( newTokenId, seriesID, 999, false, true, winnerAddress ); // Emit event for the updated series information emit UpdateSeriesLastPrizeOwner(seriesID, series.lastPrizeOwner); emit LastPrizeDraw(seriesID, seriesID, quantity); // Emit event for the last prize winner emit LastPrizeWinner(seriesID, lastTokenIDInSeries); } else { // Request randomness for each token uint256 requestId = s_vrfCoordinator.requestRandomWords( VRFV2PlusClient.RandomWordsRequest({ keyHash: s_keyHash, subId: s_subscriptionId, requestConfirmations: requestConfirmations, callbackGasLimit: callbackGasLimit, numWords: quantity, extraArgs: VRFV2PlusClient._argsToBytes( VRFV2PlusClient.ExtraArgsV1({nativePayment: false}) ) }) ); requestToLastPrizeToken[requestId] = seriesID; requests[requestId] = Variable.lastPrize; emit LastPrizeDraw(requestId, seriesID, quantity); } } function fulfillRandomWords( uint256 requestId, uint256[] calldata randomWords ) internal override { Variable variable = requests[requestId]; if (variable == Variable.reveal) { fulfillRevealRandomWords(requestId, randomWords); } else if (variable == Variable.lastPrize) { fulfillLastPrizeRandomWords(requestId, randomWords); } } function fulfillRevealRandomWords( uint256 requestId, uint256[] calldata randomWords ) internal { uint256[] memory tokenIDs = requestToRevealToken[requestId]; Series storage calculateSeries = ICHISeries[ ticketStatusDetail[tokenIDs[0]].seriesID ]; // emit event for the fulfilled reveal draw emit RevealDrawFulfilled( requestId, ticketStatusDetail[tokenIDs[0]].seriesID, randomWords ); // iterate through the series to calculate the unreveal prize quantity uint256 totalReaminingPrizeQuantity = 0; for (uint256 i = 0; i < calculateSeries.subPrizes.length; i++) { totalReaminingPrizeQuantity += calculateSeries .subPrizes[i] .subPrizeRemainingQuantity; } // calculate the remaing prize quantity in each prize) for (uint256 i = 0; i < tokenIDs.length; i++) { uint256 tokenId = tokenIDs[i]; Series storage series = ICHISeries[ ticketStatusDetail[tokenId].seriesID ]; uint256 selectedPrizeIndex = randomWords[i] % totalReaminingPrizeQuantity; // Selecting from available prizes // Use the selectedPrizeIndex to find the index is in which range of prize for (uint256 j = 0; j < series.subPrizes.length; j++) { if ( selectedPrizeIndex < series.subPrizes[j].subPrizeRemainingQuantity ) { selectedPrizeIndex = j; break; } selectedPrizeIndex -= series .subPrizes[j] .subPrizeRemainingQuantity; } // Award the prize subPrize storage selectedSubPrize = series.subPrizes[ selectedPrizeIndex ]; totalReaminingPrizeQuantity -= 1; selectedSubPrize.subPrizeRemainingQuantity -= 1; ticketStatusDetail[tokenId].tokenRevealedPrize = selectedSubPrize .subPrizeID; ticketStatusDetail[tokenId].tokenRevealed = true; // Emit event for the updated prize remaining quantity emit UpdatePrize( ticketStatusDetail[tokenId].seriesID, selectedSubPrize.subPrizeID, selectedSubPrize.subPrizeRemainingQuantity ); // Emit event for the updated ticket status emit UpdateTicketStatus( tokenId, ticketStatusDetail[tokenId].seriesID, selectedSubPrize.subPrizeID, false, true ); } delete requestToRevealToken[requestId]; } function fulfillLastPrizeRandomWords( uint256 requestId, uint256[] calldata randomWords ) internal { uint256 seriesID = requestToLastPrizeToken[requestId]; Series storage series = ICHISeries[seriesID]; uint256[] memory tokensInSeries = seriesTokens[seriesID]; uint256 totalTokensInSeries = tokensInSeries.length; // Loop over the randomWords array for (uint256 i = 0; i < randomWords.length; i++) { // Use the random number to select the winner uint256 randomIndex = randomWords[i] % totalTokensInSeries; address winnerAddress = ownerOf(tokensInSeries[randomIndex]); // Mint the last prize token to the winner address _safeMint(winnerAddress, 1); uint256 newTokenId = _nextTokenId() - 1; ticketStatusDetail[newTokenId].seriesID = seriesID; ticketStatusDetail[newTokenId].tokenRevealedPrize = 999; ticketStatusDetail[newTokenId].tokenRevealed = true; // Add the winner to the lastPrizeOwner array series.lastPrizeOwner.push(winnerAddress); // Emit event for the new ticket status emit NewTicketStatus( newTokenId, seriesID, 999, false, true, winnerAddress ); } // Emit event for the updated series information emit UpdateSeriesLastPrizeOwner(seriesID, series.lastPrizeOwner); // Emit event for the last prize winner emit LastPrizeWinner(requestId, randomWords); delete requestToLastPrizeToken[requestId]; } // Override tokenURI to provide the correct metadata based on reveal status function tokenURI( uint256 tokenId ) public view override returns (string memory) { if (!_exists(tokenId)) { revert TokenDoesNotExist(); } uint256 seriesID = ticketStatusDetail[tokenId].seriesID; Series storage series = ICHISeries[seriesID]; if (ticketStatusDetail[tokenId].tokenExchange) { return string( abi.encodePacked( series.exchangeTokenURI, _toString( ticketStatusDetail[tokenId].tokenRevealedPrize ) ) ); } else if (ticketStatusDetail[tokenId].tokenRevealed) { return string( abi.encodePacked( series.revealTokenURI, _toString( ticketStatusDetail[tokenId].tokenRevealedPrize ) ) ); } else { // If the token has not been revealed, return the unrevealTokenURI return series.unrevealTokenURI; } } function goodsArrived(uint256 seriesID) public onlyRole(OPERATION_ROLE) { Series storage series = ICHISeries[seriesID]; if (series.isRefund) { revert AlreadyRefund(); } if (series.isGoodsArrived) { revert GoodsAlreadyArrived(); } uint256 nowTime = block.timestamp; series.isGoodsArrived = true; series.estimateDeliverTime = nowTime; series.exchangeExpireTime = nowTime + 86400 * 60; emit UpdateSeriesInformation( seriesID, true, nowTime, nowTime + 86400 * 60, series.exchangeTokenURI, series.unrevealTokenURI, series.revealTokenURI, series.seriesMetaDataURI ); } function seriesRefund(uint256 seriesID) public onlyRole(OPERATION_ROLE) { Series storage series = ICHISeries[seriesID]; if (series.isRefund) { revert AlreadyRefund(); } // can't refund if goods is arrived if (series.isGoodsArrived) { revert GoodsAlreadyArrived(); } series.isRefund = true; emit RefundSeries(seriesID, true); } function exchangePrize(uint256[] memory tokenIDs) public { for (uint256 i = 0; i < tokenIDs.length; i++) { if (ownerOf(tokenIDs[i]) != msg.sender) { revert NotTheTokenOwner(); } if (!ticketStatusDetail[tokenIDs[i]].tokenRevealed) { revert TokenNotRevealed(); } if (ticketStatusDetail[tokenIDs[i]].tokenExchange) { revert TokenAlreadyExchanged(); } ticketStatusDetail[tokenIDs[i]].tokenExchange = true; emit UpdateTicketStatus( tokenIDs[i], ticketStatusDetail[tokenIDs[i]].seriesID, ticketStatusDetail[tokenIDs[i]].tokenRevealedPrize, true, true ); } } function withdraw() external onlyOwner { (bool success, ) = payable(msg.sender).call{ value: address(this).balance }(""); require(success, "Transfer failed."); } function addCurrencyToken( address currencyToken, address priceFeedAddress, uint256 customizedRateToUSDTinWei, uint8 decimals ) external onlyRole(OPERATION_ROLE) { currencyList.push( Currency( currencyToken, priceFeedAddress, customizedRateToUSDTinWei, decimals ) ); } // withdraw currency token function withdrawCurrencyToken( address currencyToken, uint256 amount ) external onlyOwner { IERC20(currencyToken).transfer(msg.sender, amount); } // Function to get the latest price of MATIC/USDT from Chainlink and pass the price feed address to get price function getChainlinkDataFeedLatestAnswer( address priceFeedAddresss ) public view returns (int256) { AggregatorV3Interface priceFeed = AggregatorV3Interface( priceFeedAddresss ); // prettier-ignore ( /* uint80 roundID */, int answer, /*uint startedAt*/, /*uint timeStamp*/, /*uint80 answeredInRound*/ ) = priceFeed.latestRoundData(); return answer; } function getSeriesTotalLength() public view returns (uint256) { return seriesCounter; } function getSubPrizesDetail( uint256 seriesID ) public view returns (subPrize[] memory) { return ICHISeries[seriesID].subPrizes; } function getLastPrizeWinner( uint256 seriesID ) public view returns (address[] memory) { return ICHISeries[seriesID].lastPrizeOwner; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {ConfirmedOwnerWithProposal} from "./ConfirmedOwnerWithProposal.sol"; /// @title The ConfirmedOwner contract /// @notice A contract with helpers for basic contract ownership. contract ConfirmedOwner is ConfirmedOwnerWithProposal { constructor(address newOwner) ConfirmedOwnerWithProposal(newOwner, address(0)) {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {IOwnable} from "../interfaces/IOwnable.sol"; /// @title The ConfirmedOwner contract /// @notice A contract with helpers for basic contract ownership. contract ConfirmedOwnerWithProposal is IOwnable { address private s_owner; address private s_pendingOwner; event OwnershipTransferRequested(address indexed from, address indexed to); event OwnershipTransferred(address indexed from, address indexed to); constructor(address newOwner, address pendingOwner) { // solhint-disable-next-line gas-custom-errors require(newOwner != address(0), "Cannot set owner to zero"); s_owner = newOwner; if (pendingOwner != address(0)) { _transferOwnership(pendingOwner); } } /// @notice Allows an owner to begin transferring ownership to a new address. function transferOwnership(address to) public override onlyOwner { _transferOwnership(to); } /// @notice Allows an ownership transfer to be completed by the recipient. function acceptOwnership() external override { // solhint-disable-next-line gas-custom-errors require(msg.sender == s_pendingOwner, "Must be proposed owner"); address oldOwner = s_owner; s_owner = msg.sender; s_pendingOwner = address(0); emit OwnershipTransferred(oldOwner, msg.sender); } /// @notice Get the current owner function owner() public view override returns (address) { return s_owner; } /// @notice validate, transfer ownership, and emit relevant events function _transferOwnership(address to) private { // solhint-disable-next-line gas-custom-errors require(to != msg.sender, "Cannot transfer to self"); s_pendingOwner = to; emit OwnershipTransferRequested(s_owner, to); } /// @notice validate access function _validateOwnership() internal view { // solhint-disable-next-line gas-custom-errors require(msg.sender == s_owner, "Only callable by owner"); } /// @notice Reverts if called by anyone other than the contract owner. modifier onlyOwner() { _validateOwnership(); _; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // solhint-disable-next-line interface-starts-with-i interface AggregatorV3Interface { function decimals() external view returns (uint8); function description() external view returns (string memory); function version() external view returns (uint256); function getRoundData( uint80 _roundId ) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound); function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IOwnable { function owner() external returns (address); function transferOwnership(address recipient) external; function acceptOwnership() external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {VRFV2PlusClient} from "../libraries/VRFV2PlusClient.sol"; import {IVRFSubscriptionV2Plus} from "./IVRFSubscriptionV2Plus.sol"; // Interface that enables consumers of VRFCoordinatorV2Plus to be future-proof for upgrades // This interface is supported by subsequent versions of VRFCoordinatorV2Plus interface IVRFCoordinatorV2Plus is IVRFSubscriptionV2Plus { /** * @notice Request a set of random words. * @param req - a struct containing following fields for randomness request: * keyHash - Corresponds to a particular oracle job which uses * that key for generating the VRF proof. Different keyHash's have different gas price * ceilings, so you can select a specific one to bound your maximum per request cost. * subId - The ID of the VRF subscription. Must be funded * with the minimum subscription balance required for the selected keyHash. * requestConfirmations - How many blocks you'd like the * oracle to wait before responding to the request. See SECURITY CONSIDERATIONS * for why you may want to request more. The acceptable range is * [minimumRequestBlockConfirmations, 200]. * callbackGasLimit - How much gas you'd like to receive in your * fulfillRandomWords callback. Note that gasleft() inside fulfillRandomWords * may be slightly less than this amount because of gas used calling the function * (argument decoding etc.), so you may need to request slightly more than you expect * to have inside fulfillRandomWords. The acceptable range is * [0, maxGasLimit] * numWords - The number of uint256 random values you'd like to receive * in your fulfillRandomWords callback. Note these numbers are expanded in a * secure way by the VRFCoordinator from a single random value supplied by the oracle. * extraArgs - abi-encoded extra args * @return requestId - A unique identifier of the request. Can be used to match * a request to a response in fulfillRandomWords. */ function requestRandomWords(VRFV2PlusClient.RandomWordsRequest calldata req) external returns (uint256 requestId); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @notice The IVRFMigratableConsumerV2Plus interface defines the /// @notice method required to be implemented by all V2Plus consumers. /// @dev This interface is designed to be used in VRFConsumerBaseV2Plus. interface IVRFMigratableConsumerV2Plus { event CoordinatorSet(address vrfCoordinator); /// @notice Sets the VRF Coordinator address /// @notice This method should only be callable by the coordinator or contract owner function setCoordinator(address vrfCoordinator) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @notice The IVRFSubscriptionV2Plus interface defines the subscription /// @notice related methods implemented by the V2Plus coordinator. interface IVRFSubscriptionV2Plus { /** * @notice Add a consumer to a VRF subscription. * @param subId - ID of the subscription * @param consumer - New consumer which can use the subscription */ function addConsumer(uint256 subId, address consumer) external; /** * @notice Remove a consumer from a VRF subscription. * @param subId - ID of the subscription * @param consumer - Consumer to remove from the subscription */ function removeConsumer(uint256 subId, address consumer) external; /** * @notice Cancel a subscription * @param subId - ID of the subscription * @param to - Where to send the remaining LINK to */ function cancelSubscription(uint256 subId, address to) external; /** * @notice Accept subscription owner transfer. * @param subId - ID of the subscription * @dev will revert if original owner of subId has * not requested that msg.sender become the new owner. */ function acceptSubscriptionOwnerTransfer(uint256 subId) external; /** * @notice Request subscription owner transfer. * @param subId - ID of the subscription * @param newOwner - proposed new owner of the subscription */ function requestSubscriptionOwnerTransfer(uint256 subId, address newOwner) external; /** * @notice Create a VRF subscription. * @return subId - A unique subscription id. * @dev You can manage the consumer set dynamically with addConsumer/removeConsumer. * @dev Note to fund the subscription with LINK, use transferAndCall. For example * @dev LINKTOKEN.transferAndCall( * @dev address(COORDINATOR), * @dev amount, * @dev abi.encode(subId)); * @dev Note to fund the subscription with Native, use fundSubscriptionWithNative. Be sure * @dev to send Native with the call, for example: * @dev COORDINATOR.fundSubscriptionWithNative{value: amount}(subId); */ function createSubscription() external returns (uint256 subId); /** * @notice Get a VRF subscription. * @param subId - ID of the subscription * @return balance - LINK balance of the subscription in juels. * @return nativeBalance - native balance of the subscription in wei. * @return reqCount - Requests count of subscription. * @return owner - owner of the subscription. * @return consumers - list of consumer address which are able to use this subscription. */ function getSubscription( uint256 subId ) external view returns (uint96 balance, uint96 nativeBalance, uint64 reqCount, address owner, address[] memory consumers); /* * @notice Check to see if there exists a request commitment consumers * for all consumers and keyhashes for a given sub. * @param subId - ID of the subscription * @return true if there exists at least one unfulfilled request for the subscription, false * otherwise. */ function pendingRequestExists(uint256 subId) external view returns (bool); /** * @notice Paginate through all active VRF subscriptions. * @param startIndex index of the subscription to start from * @param maxCount maximum number of subscriptions to return, 0 to return all * @dev the order of IDs in the list is **not guaranteed**, therefore, if making successive calls, one * @dev should consider keeping the blockheight constant to ensure a holistic picture of the contract state */ function getActiveSubscriptionIds(uint256 startIndex, uint256 maxCount) external view returns (uint256[] memory); /** * @notice Fund a subscription with native. * @param subId - ID of the subscription * @notice This method expects msg.value to be greater than or equal to 0. */ function fundSubscriptionWithNative(uint256 subId) external payable; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; // End consumer library. library VRFV2PlusClient { // extraArgs will evolve to support new features bytes4 public constant EXTRA_ARGS_V1_TAG = bytes4(keccak256("VRF ExtraArgsV1")); struct ExtraArgsV1 { bool nativePayment; } struct RandomWordsRequest { bytes32 keyHash; uint256 subId; uint16 requestConfirmations; uint32 callbackGasLimit; uint32 numWords; bytes extraArgs; } function _argsToBytes(ExtraArgsV1 memory extraArgs) internal pure returns (bytes memory bts) { return abi.encodeWithSelector(EXTRA_ARGS_V1_TAG, extraArgs); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import {IVRFCoordinatorV2Plus} from "./interfaces/IVRFCoordinatorV2Plus.sol"; import {IVRFMigratableConsumerV2Plus} from "./interfaces/IVRFMigratableConsumerV2Plus.sol"; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; /** **************************************************************************** * @notice Interface for contracts using VRF randomness * ***************************************************************************** * @dev PURPOSE * * @dev Reggie the Random Oracle (not his real job) wants to provide randomness * @dev to Vera the verifier in such a way that Vera can be sure he's not * @dev making his output up to suit himself. Reggie provides Vera a public key * @dev to which he knows the secret key. Each time Vera provides a seed to * @dev Reggie, he gives back a value which is computed completely * @dev deterministically from the seed and the secret key. * * @dev Reggie provides a proof by which Vera can verify that the output was * @dev correctly computed once Reggie tells it to her, but without that proof, * @dev the output is indistinguishable to her from a uniform random sample * @dev from the output space. * * @dev The purpose of this contract is to make it easy for unrelated contracts * @dev to talk to Vera the verifier about the work Reggie is doing, to provide * @dev simple access to a verifiable source of randomness. It ensures 2 things: * @dev 1. The fulfillment came from the VRFCoordinatorV2Plus. * @dev 2. The consumer contract implements fulfillRandomWords. * ***************************************************************************** * @dev USAGE * * @dev Calling contracts must inherit from VRFConsumerBaseV2Plus, and can * @dev initialize VRFConsumerBaseV2Plus's attributes in their constructor as * @dev shown: * * @dev contract VRFConsumerV2Plus is VRFConsumerBaseV2Plus { * @dev constructor(<other arguments>, address _vrfCoordinator, address _subOwner) * @dev VRFConsumerBaseV2Plus(_vrfCoordinator, _subOwner) public { * @dev <initialization with other arguments goes here> * @dev } * @dev } * * @dev The oracle will have given you an ID for the VRF keypair they have * @dev committed to (let's call it keyHash). Create a subscription, fund it * @dev and your consumer contract as a consumer of it (see VRFCoordinatorInterface * @dev subscription management functions). * @dev Call requestRandomWords(keyHash, subId, minimumRequestConfirmations, * @dev callbackGasLimit, numWords, extraArgs), * @dev see (IVRFCoordinatorV2Plus for a description of the arguments). * * @dev Once the VRFCoordinatorV2Plus has received and validated the oracle's response * @dev to your request, it will call your contract's fulfillRandomWords method. * * @dev The randomness argument to fulfillRandomWords is a set of random words * @dev generated from your requestId and the blockHash of the request. * * @dev If your contract could have concurrent requests open, you can use the * @dev requestId returned from requestRandomWords to track which response is associated * @dev with which randomness request. * @dev See "SECURITY CONSIDERATIONS" for principles to keep in mind, * @dev if your contract could have multiple requests in flight simultaneously. * * @dev Colliding `requestId`s are cryptographically impossible as long as seeds * @dev differ. * * ***************************************************************************** * @dev SECURITY CONSIDERATIONS * * @dev A method with the ability to call your fulfillRandomness method directly * @dev could spoof a VRF response with any random value, so it's critical that * @dev it cannot be directly called by anything other than this base contract * @dev (specifically, by the VRFConsumerBaseV2Plus.rawFulfillRandomness method). * * @dev For your users to trust that your contract's random behavior is free * @dev from malicious interference, it's best if you can write it so that all * @dev behaviors implied by a VRF response are executed *during* your * @dev fulfillRandomness method. If your contract must store the response (or * @dev anything derived from it) and use it later, you must ensure that any * @dev user-significant behavior which depends on that stored value cannot be * @dev manipulated by a subsequent VRF request. * * @dev Similarly, both miners and the VRF oracle itself have some influence * @dev over the order in which VRF responses appear on the blockchain, so if * @dev your contract could have multiple VRF requests in flight simultaneously, * @dev you must ensure that the order in which the VRF responses arrive cannot * @dev be used to manipulate your contract's user-significant behavior. * * @dev Since the block hash of the block which contains the requestRandomness * @dev call is mixed into the input to the VRF *last*, a sufficiently powerful * @dev miner could, in principle, fork the blockchain to evict the block * @dev containing the request, forcing the request to be included in a * @dev different block with a different hash, and therefore a different input * @dev to the VRF. However, such an attack would incur a substantial economic * @dev cost. This cost scales with the number of blocks the VRF oracle waits * @dev until it calls responds to a request. It is for this reason that * @dev that you can signal to an oracle you'd like them to wait longer before * @dev responding to the request (however this is not enforced in the contract * @dev and so remains effective only in the case of unmodified oracle software). */ abstract contract VRFConsumerBaseV2Plus is IVRFMigratableConsumerV2Plus, ConfirmedOwner { error OnlyCoordinatorCanFulfill(address have, address want); error OnlyOwnerOrCoordinator(address have, address owner, address coordinator); error ZeroAddress(); // s_vrfCoordinator should be used by consumers to make requests to vrfCoordinator // so that coordinator reference is updated after migration IVRFCoordinatorV2Plus public s_vrfCoordinator; /** * @param _vrfCoordinator address of VRFCoordinator contract */ constructor(address _vrfCoordinator) ConfirmedOwner(msg.sender) { if (_vrfCoordinator == address(0)) { revert ZeroAddress(); } s_vrfCoordinator = IVRFCoordinatorV2Plus(_vrfCoordinator); } /** * @notice fulfillRandomness handles the VRF response. Your contract must * @notice implement it. See "SECURITY CONSIDERATIONS" above for important * @notice principles to keep in mind when implementing your fulfillRandomness * @notice method. * * @dev VRFConsumerBaseV2Plus expects its subcontracts to have a method with this * @dev signature, and will call it once it has verified the proof * @dev associated with the randomness. (It is triggered via a call to * @dev rawFulfillRandomness, below.) * * @param requestId The Id initially returned by requestRandomness * @param randomWords the VRF output expanded to the requested number of words */ // solhint-disable-next-line chainlink-solidity/prefix-internal-functions-with-underscore function fulfillRandomWords(uint256 requestId, uint256[] calldata randomWords) internal virtual; // rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF // proof. rawFulfillRandomness then calls fulfillRandomness, after validating // the origin of the call function rawFulfillRandomWords(uint256 requestId, uint256[] calldata randomWords) external { if (msg.sender != address(s_vrfCoordinator)) { revert OnlyCoordinatorCanFulfill(msg.sender, address(s_vrfCoordinator)); } fulfillRandomWords(requestId, randomWords); } /** * @inheritdoc IVRFMigratableConsumerV2Plus */ function setCoordinator(address _vrfCoordinator) external override onlyOwnerOrCoordinator { if (_vrfCoordinator == address(0)) { revert ZeroAddress(); } s_vrfCoordinator = IVRFCoordinatorV2Plus(_vrfCoordinator); emit CoordinatorSet(_vrfCoordinator); } modifier onlyOwnerOrCoordinator() { if (msg.sender != owner() && msg.sender != address(s_vrfCoordinator)) { revert OnlyOwnerOrCoordinator(msg.sender, owner(), address(s_vrfCoordinator)); } _; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ```solidity * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ```solidity * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules} * to enforce additional security measures for this role. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(account), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (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; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == _ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.4) (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; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; import "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toString(int256 value) internal pure returns (string memory) { return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value)))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT // 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; /** * @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); }
{ "optimizer": { "enabled": true, "runs": 200 }, "viaIR": true, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
[{"inputs":[{"internalType":"uint256","name":"subscriptionId","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyChoseWinner","type":"error"},{"inputs":[],"name":"AlreadyRefund","type":"error"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"GoodsAlreadyArrived","type":"error"},{"inputs":[],"name":"GoodsNotArrived","type":"error"},{"inputs":[],"name":"InsufficientCurrencyAllowance","type":"error"},{"inputs":[],"name":"InsufficientCurrencyBalance","type":"error"},{"inputs":[],"name":"InsufficientMaticSent","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"NotEnoughNFTsRemaining","type":"error"},{"inputs":[],"name":"NotEnoughTokensToReveal","type":"error"},{"inputs":[],"name":"NotSoldOutYet","type":"error"},{"inputs":[],"name":"NotTheTokenOwner","type":"error"},{"inputs":[{"internalType":"address","name":"have","type":"address"},{"internalType":"address","name":"want","type":"address"}],"name":"OnlyCoordinatorCanFulfill","type":"error"},{"inputs":[{"internalType":"address","name":"have","type":"address"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"coordinator","type":"address"}],"name":"OnlyOwnerOrCoordinator","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"SeriesIsRefund","type":"error"},{"inputs":[],"name":"SubprizeQuantityNotEqual","type":"error"},{"inputs":[],"name":"TokenAlreadyExchanged","type":"error"},{"inputs":[],"name":"TokenAlreadyRevealed","type":"error"},{"inputs":[],"name":"TokenDoesNotExist","type":"error"},{"inputs":[],"name":"TokenNotInTheSeries","type":"error"},{"inputs":[],"name":"TokenNotRevealed","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":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"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":"address","name":"vrfCoordinator","type":"address"}],"name":"CoordinatorSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"requestId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"seriesID","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"LastPrizeDraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"requestId","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"randomWord","type":"uint256[]"}],"name":"LastPrizeWinner","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"seriesID","type":"uint256"},{"indexed":false,"internalType":"string","name":"seriesName","type":"string"},{"indexed":false,"internalType":"uint256","name":"totalTicketNumbers","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"remainingTicketNumbers","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"priceInUSDTWei","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"priceInTWD","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isGoodsArrived","type":"bool"},{"indexed":false,"internalType":"uint256","name":"estimateDeliverTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"exchangeExpireTime","type":"uint256"},{"indexed":false,"internalType":"string","name":"exchangeTokenURI","type":"string"},{"indexed":false,"internalType":"string","name":"unrevealTokenURI","type":"string"},{"indexed":false,"internalType":"string","name":"revealTokenURI","type":"string"},{"indexed":false,"internalType":"string","name":"seriesMetaDataURI","type":"string"},{"indexed":false,"internalType":"address","name":"lastPrizeOwner","type":"address"},{"indexed":false,"internalType":"bool","name":"isRefund","type":"bool"},{"indexed":false,"internalType":"bool","name":"isPreOrder","type":"bool"}],"name":"NewSeries","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"seriesID","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"subPrizeID","type":"uint256"},{"indexed":false,"internalType":"string","name":"prizeGroup","type":"string"},{"indexed":false,"internalType":"string","name":"subPrizeName","type":"string"},{"indexed":false,"internalType":"uint256","name":"subPrizeRemainingQuantity","type":"uint256"}],"name":"NewSubPrize","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenID","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"seriesID","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenRevealedPrize","type":"uint256"},{"indexed":false,"internalType":"bool","name":"tokenExchange","type":"bool"},{"indexed":false,"internalType":"bool","name":"tokenRevealed","type":"bool"},{"indexed":false,"internalType":"address","name":"tokenOwner","type":"address"}],"name":"NewTicketStatus","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"OwnershipTransferRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"seriesID","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isRefund","type":"bool"}],"name":"RefundSeries","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"seriesID","type":"uint256"}],"name":"ResetSubPrize","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"requestId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"seriesID","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"randomWords","type":"uint256[]"}],"name":"RevealDrawFulfilled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"requestId","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"tokenIDs","type":"uint256[]"}],"name":"RevealDrawSent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"seriesID","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"subPrizeID","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"subPrizeRemainingQuantity","type":"uint256"}],"name":"UpdatePrize","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"seriesID","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isGoodsArrived","type":"bool"},{"indexed":false,"internalType":"uint256","name":"estimateDeliverTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"exchangeExpireTime","type":"uint256"},{"indexed":false,"internalType":"string","name":"exchangeTokenURI","type":"string"},{"indexed":false,"internalType":"string","name":"unrevealTokenURI","type":"string"},{"indexed":false,"internalType":"string","name":"revealTokenURI","type":"string"},{"indexed":false,"internalType":"string","name":"seriesMetaDataURI","type":"string"}],"name":"UpdateSeriesInformation","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"seriesID","type":"uint256"},{"indexed":false,"internalType":"address[]","name":"lastPrizeOwner","type":"address[]"}],"name":"UpdateSeriesLastPrizeOwner","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"seriesID","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"remainingTicketNumbers","type":"uint256"}],"name":"UpdateSeriesRemainingTicketNumbers","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenID","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"seriesID","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenRevealedPrize","type":"uint256"},{"indexed":false,"internalType":"bool","name":"tokenExchange","type":"bool"},{"indexed":false,"internalType":"bool","name":"tokenRevealed","type":"bool"}],"name":"UpdateTicketStatus","type":"event"},{"inputs":[],"name":"ADMINMINT_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"seriesID","type":"uint256"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"AdminMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"ICHISeries","outputs":[{"internalType":"string","name":"seriesName","type":"string"},{"internalType":"uint256","name":"totalTicketNumbers","type":"uint256"},{"internalType":"uint256","name":"remainingTicketNumbers","type":"uint256"},{"internalType":"uint256","name":"priceInUSDTWei","type":"uint256"},{"internalType":"bool","name":"isGoodsArrived","type":"bool"},{"internalType":"uint256","name":"estimateDeliverTime","type":"uint256"},{"internalType":"uint256","name":"exchangeExpireTime","type":"uint256"},{"internalType":"string","name":"exchangeTokenURI","type":"string"},{"internalType":"string","name":"unrevealTokenURI","type":"string"},{"internalType":"string","name":"revealTokenURI","type":"string"},{"internalType":"string","name":"seriesMetaDataURI","type":"string"},{"internalType":"uint256","name":"priceInTWD","type":"uint256"},{"internalType":"bool","name":"isRefund","type":"bool"},{"internalType":"bool","name":"isPreOrder","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATION_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"currencyToken","type":"address"},{"internalType":"address","name":"priceFeedAddress","type":"address"},{"internalType":"uint256","name":"customizedRateToUSDTinWei","type":"uint256"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"name":"addCurrencyToken","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":[{"internalType":"uint256","name":"seriesID","type":"uint256"},{"internalType":"uint32","name":"quantity","type":"uint32"}],"name":"chooseLastPrizeWinner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"seriesName","type":"string"},{"internalType":"uint256","name":"priceInUSDTWei","type":"uint256"},{"internalType":"uint256","name":"priceInTWD","type":"uint256"},{"internalType":"uint256","name":"estimateDeliverTime","type":"uint256"},{"internalType":"uint256","name":"totalPrizeQuantity","type":"uint256"},{"internalType":"bool","name":"isPreOrder","type":"bool"},{"internalType":"string","name":"exchangeTokenURI","type":"string"},{"internalType":"string","name":"unrevealTokenURI","type":"string"},{"internalType":"string","name":"revealTokenURI","type":"string"},{"internalType":"string","name":"seriesMetaDataURI","type":"string"}],"name":"createSeries","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"currencyList","outputs":[{"internalType":"address","name":"currencyToken","type":"address"},{"internalType":"address","name":"priceFeedAddress","type":"address"},{"internalType":"uint256","name":"customizedRateToUSDTinWei","type":"uint256"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIDs","type":"uint256[]"}],"name":"exchangePrize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"priceFeedAddresss","type":"address"}],"name":"getChainlinkDataFeedLatestAnswer","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"seriesID","type":"uint256"}],"name":"getLastPrizeWinner","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSeriesTotalLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"seriesID","type":"uint256"}],"name":"getSubPrizesDetail","outputs":[{"components":[{"internalType":"uint256","name":"subPrizeID","type":"uint256"},{"internalType":"string","name":"prizeGroup","type":"string"},{"internalType":"string","name":"subPrizeName","type":"string"},{"internalType":"uint256","name":"subPrizeRemainingQuantity","type":"uint256"}],"internalType":"struct DOUDOCHAIN.subPrize[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"seriesID","type":"uint256"}],"name":"goodsArrived","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"seriesID","type":"uint256"},{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"uint256","name":"CurrencyIndex","type":"uint256"}],"name":"mintByCurrency","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"seriesID","type":"uint256"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"mintByMatic","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"requestId","type":"uint256"},{"internalType":"uint256[]","name":"randomWords","type":"uint256[]"}],"name":"rawFulfillRandomWords","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"requestToLastPrizeToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"requestToRevealToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"requests","outputs":[{"internalType":"enum DOUDOCHAIN.Variable","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"seriesID","type":"uint256"},{"internalType":"uint256[]","name":"tokenIDs","type":"uint256[]"}],"name":"reveal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"s_vrfCoordinator","outputs":[{"internalType":"contract IVRFCoordinatorV2Plus","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"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":"uint256","name":"seriesID","type":"uint256"}],"name":"seriesRefund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"seriesTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vrfCoordinator","type":"address"}],"name":"setCoordinator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"ticketStatusDetail","outputs":[{"internalType":"uint256","name":"seriesID","type":"uint256"},{"internalType":"uint256","name":"tokenRevealedPrize","type":"uint256"},{"internalType":"bool","name":"tokenExchange","type":"bool"},{"internalType":"bool","name":"tokenRevealed","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"seriesID","type":"uint256"},{"internalType":"uint256","name":"estimateDeliverTime","type":"uint256"},{"internalType":"string","name":"exchangeTokenURI","type":"string"},{"internalType":"string","name":"unrevealTokenURI","type":"string"},{"internalType":"string","name":"revealTokenURI","type":"string"},{"internalType":"string","name":"seriesMetaDataURI","type":"string"}],"name":"updateSeriesInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"seriesID","type":"uint256"},{"components":[{"internalType":"uint256","name":"subPrizeID","type":"uint256"},{"internalType":"string","name":"prizeGroup","type":"string"},{"internalType":"string","name":"subPrizeName","type":"string"},{"internalType":"uint256","name":"subPrizeRemainingQuantity","type":"uint256"}],"internalType":"struct DOUDOCHAIN.subPrize[]","name":"subPrizes","type":"tuple[]"}],"name":"updateSeriesSubPrize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"currencyToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawCurrencyToken","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60a0346200055c57601f19620052d038819003601f818101841685019493926001600160401b0392858710848811176200047257808692604098895283396020958691810103126200055c5751916200005762000561565b93600a8552692227aaa227a1a420a4a760b11b868601526200007862000561565b926005845264444f55444f60d81b87850152855183811162000472576002546001978882811c9216801562000551575b8a83101462000451578184849311620004fa575b508990848311600114620004945760009262000488575b5050600019600383901b1c191690871b176002555b835192831162000472576003938454928784811c9416801562000467575b8985101462000451578383869511620003f7575b508892841160011462000393575060009262000387575b505060001982841b1c191690841b1790555b600080553315620003435773343300b5d84d444b2adc9116fef1bed02be49cf260018060a01b031933816008541617600855600a541617600a5581600b556403002625a065ffffffffffff19600e541617600e556000601555600d557f816bedba8a50b294e5cbd47842baf240c2385f2eaf719edbd4f250a137a8c89960805260008052600c918281528360002033600052815260ff8460002054161562000307575b7f20296b01d0b6bd176f0c1e29644934c0047abf080dae43609a1bbc09e39bafdb806000528382528460002033600052825260ff85600020541615620002c9575b507fd01d7f6f3b98c8ff4cbb99d207da8f806af0b2f8be9b5bb61dd74bf5550f329b92836000528082528460002033600052825260ff8560002054161562000289575b8451614d2e908162000582823960805181818161151701526124700152f35b83600052815283600020903360005252826000209060ff1982541617905533903390600080516020620052b0833981519152600080a4388080806200026a565b8060005283825284600020336000528252846000208360ff1982541617905533903390600080516020620052b0833981519152600080a43862000227565b6000805282815283600020336000528152836000208260ff1982541617905533336000600080516020620052b08339815191528180a4620001e6565b835162461bcd60e51b815260048101849052601860248201527f43616e6e6f7420736574206f776e657220746f207a65726f00000000000000006044820152606490fd5b01519050388062000131565b8794929192169185600052886000209260005b8a828210620003e05750508411620003c7575b505050811b01905562000143565b015160001983861b60f8161c19169055388080620003b9565b8385015186558a97909501949384019301620003a6565b909192935085600052886000208480870160051c8201928b881062000447575b9187968b92969594930160051c01915b828110620004375750506200011a565b600081558796508a910162000427565b9250819262000417565b634e487b7160e01b600052602260045260246000fd5b93607f169362000106565b634e487b7160e01b600052604160045260246000fd5b015190503880620000d3565b90858a94169160026000528b6000209260005b8d828210620004e35750508411620004c9575b505050811b01600255620000e8565b015160001960f88460031b161c19169055388080620004ba565b8385015186558d97909501949384019301620004a7565b9091506002600052896000208480850160051c8201928c861062000547575b918b91869594930160051c01915b82811062000537575050620000bc565b600081558594508b910162000527565b9250819262000519565b91607f1691620000a8565b600080fd5b60408051919082016001600160401b03811183821017620004725760405256fe6080604052600436101561001257600080fd5b60003560e01c806301ffc9a71461036757806306fdde0314610362578063081812fc1461035d578063095ea7b314610358578063178ebefa1461035357806318160ddd1461034e5780631fe543e31461034957806323b872dd14610344578063248a9ca31461033f57806326c049a51461033a5780632b14d65a146103355780632f2ff15d146103305780633214234a1461032b57806336568abe146103265780633ccfd60b146103215780633ce7d87e1461031c57806342842e0e14610317578063455e3a38146103125780634d96c8f21461030d5780634ec97ba1146103085780636262a4f5146103035780636352211e146102fe57806363d0eb35146102f957806370a08231146102f457806379ba5097146102ef5780637ede93fe146102ea578063812dd70c146102e557806381d12c58146102e0578063837a0fd6146102db5780638545d8df146102d657806386185a56146102d15780638da5cb5b146102cc5780638ea98117146102c757806390713123146102c257806391d14854146102bd57806395d89b41146102b85780639eccacf6146102b3578063a217fddf146102ae578063a22cb465146102a9578063b88d4fde146102a4578063b99a92151461029f578063be422c3d1461029a578063bfc7a4b014610295578063c87b56dd14610290578063d547741f1461028b578063e7078f9214610286578063e7282b0c14610281578063e985e9c51461027c578063eaf8ecaa14610277578063eec9adf214610272578063f0d053dc1461026d578063f151edc7146102685763f2fde38b1461026357600080fd5b612b17565b612a63565b612a00565b61284d565b61272c565b6126db565b61265a565b61263c565b6125fd565b6125ca565b6121d7565b61219e565b612180565b612126565b612095565b612062565b612039565b611f92565b611f40565b611dd1565b611d5c565b611d33565b611cbd565b611c82565b611bf9565b611bc1565b611aeb565b6118c9565b61180c565b6117e1565b6116f6565b6116c7565b61168c565b611660565b61138f565b61126f565b6111b7565b6110b7565b610f2d565b610e9b565b610e46565b610d7d565b610d36565b61092f565b610900565b6108ec565b6107b9565b610796565b610695565b6105de565b61055e565b610479565b610383565b6001600160e01b031981160361037e57565b600080fd5b3461037e57602036600319011261037e5760206004356103a28161036c565b63ffffffff60e01b166301ffc9a760e01b8114908190821561040c575b82156103fb575b82156103d9575b50506040519015158152f35b637965db0b60e01b14915081156103f3575b5038806103cd565b9050386103eb565b635b5e139f60e01b811492506103c6565b6380ac58cd60e01b811492506103bf565b60005b8381106104305750506000910152565b8181015183820152602001610420565b906020916104598151809281855285808601910161041d565b601f01601f1916010190565b906020610476928181520190610440565b90565b3461037e5760008060031936011261055b57604051908060025461049c81611952565b8085529160019180831690811561053157506001146104d6575b6104d2856104c681870382610fe4565b60405191829182610465565b0390f35b9250600283527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace5b8284106105195750505081016020016104c6826104d26104b6565b805460208587018101919091529093019281016104fe565b8695506104d2969350602092506104c694915060ff191682840152151560051b82010192936104b6565b80fd5b3461037e57602036600319011261037e5760043561057b816146b6565b156105a0576000526006602052602060018060a01b0360406000205416604051908152f35b6040516333d1c03960e21b8152600490fd5b600435906001600160a01b038216820361037e57565b602435906001600160a01b038216820361037e57565b604036600319011261037e576105f26105b2565b6024356001600160a01b038061060783614647565b1690813303610662575b600083815260066020526040812080546001600160a01b0319166001600160a01b0387161790559316907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258480a480f35b600082815260076020908152604080832033845290915290205460ff16610611576040516367d9dca160e11b8152600490fd5b3461037e57608036600319011261037e576106ae6105b2565b6106b66105c8565b906064359160ff831680930361037e576106ce612c94565b6040516106da81610fae565b60018060a01b03809316815282602082019216825260408101604435815260608201948552601654600160401b8110156107915780600161071e92016016556129aa565b92909261078c575182549085166001600160a01b03166001600160a01b031990911617825560ff936003936107749190516001850180546001600160a01b0319166001600160a01b039390921692909216179055565b5160028201550191511660ff19825416179055600080f35b613307565b610f98565b3461037e57600036600319011261037e5760206000546001549003604051908152f35b3461037e57604036600319011261037e576024356004356001600160401b0380831161037e573660238401121561037e57826004013590811161037e576024830192602436918360051b01011161037e57600a546001600160a01b03163381900361088a5750600092828452600f60205260ff6040852054166002811015610876578061084d575061084a92613eac565b80f35b80610859600192611ba1565b14610865575b50505080f35b61086e92614163565b38808061085f565b634e487b7160e01b85526021600452602485fd5b60405163073e64fd60e21b81523360048201526001600160a01b03919091166024820152604490fd5b0390fd5b606090600319011261037e576001600160a01b0390600435828116810361037e5791602435908116810361037e579060443590565b6108fe6108f8366108b7565b916146df565b005b3461037e57602036600319011261037e57600435600052600c6020526020600160406000200154604051908152f35b3461037e57606036600319011261037e576004803590602435610950613aff565b610964836000526010602052604060002090565b90610973600e83015460ff1690565b610cf25761098b6109856044356129aa565b50613b55565b916109a261099d606085015160ff1690565b613b96565b604080850180519195929115610ca8576109cb6109d3926109c6878a880154612f90565b612f90565b905190613a9f565b81516109f5906109e9906001600160a01b031681565b6001600160a01b031690565b8551636eb1769f60e11b81523388820190815230602082810191909152949285918391908290819060400103915afa8015610c39578391600091610c8b575b5010610c7b578051610a50906109e9906001600160a01b031681565b86516370a0823160e01b815233898201908152909185918391908290819060200103915afa8015610c39578391600091610c4e575b5010610c3e575160009392918291610adc9190610aac906109e9906001600160a01b031681565b88516323b872dd60e01b8152338b8201908152306020820152604081019390935296879391928492839160600190565b03925af1928315610c3957600393610c0b575b5050019283548211610bfd5750610b068133614b65565b60005b818110610b61575091610b5491610b427fa2f234689387b39c2cbd3e4e4f0dfa6d60e6e6881d8b131cf432bf2dd5c90ce1948354613abd565b80925551918291829190602083019252565b0390a26108fe6001600b55565b80600080516020614cd9833981519152610bf0610b8c610bf894610b8787600054613abd565b612fc1565b88610ba1826000526012602052604060002090565b55610bbf81610bba8b6000526011602052604060002090565b613aca565b8651908152602081018990526000604082018190526060820181905260808201523360a082015290819060c0820190565b0390a16132f8565b610b09565b825163bbb7402f60e01b8152fd5b81610c2a92903d10610c32575b610c228183610fe4565b810190613bc2565b503880610aef565b503d610c18565b613bb6565b855163d9641fe560e01b81528790fd5b610c6e9150853d8711610c74575b610c668183610fe4565b810190613ba7565b38610a85565b503d610c5c565b85516327c94fa560e01b81528790fd5b610ca29150853d8711610c7457610c668183610fe4565b38610a34565b50506020810151610ced90610cd390610cce906001600160a01b03166145c1565b6145c1565b612f3a565b610ce8610ce38689870154612f90565b612f59565b613a9f565b6109d3565b604051633f44049d60e01b81528390fd5b634e487b7160e01b600052603260045260246000fd5b8054821015610d315760005260206000200190600090565b610d03565b3461037e57604036600319011261037e5760243560043560005260116020526040600020805482101561037e57602091610d6f91610d19565b90546040519160031b1c8152f35b3461037e57604036600319011261037e57600435610d996105c8565b600091808352600c602052610db46001604085200154612dc7565b808352600c602090815260408085206001600160a01b0385166000908152925290205460ff1615610de3578280f35b808352600c602090815260408085206001600160a01b038516600090815292529020805460ff1916600117905533916001600160a01b0316907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8480a438808280f35b3461037e57602036600319011261037e5760043560005260126020526080604060002060ff815491600260018201549101549060405193845260208401528181161515604084015260081c1615156060820152f35b3461037e57604036600319011261037e57610eb46105c8565b336001600160a01b03821603610ed0576108fe90600435612e91565b60405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608490fd5b3461037e5760008060031936011261055b57610f47612bdb565b8080808047335af1610f576144f6565b5015610f605780f35b60405162461bcd60e51b815260206004820152601060248201526f2a3930b739b332b9103330b4b632b21760811b6044820152606490fd5b634e487b7160e01b600052604160045260246000fd5b608081019081106001600160401b0382111761079157604052565b602081019081106001600160401b0382111761079157604052565b90601f801991011681019081106001600160401b0382111761079157604052565b6040519061101282610fc9565b565b6040519060c082018281106001600160401b0382111761079157604052565b6001600160401b0381116107915760051b60200190565b6001600160401b03811161079157601f01601f191660200190565b9291926110718261104a565b9161107f6040519384610fe4565b82948184528183011161037e578281602093846000960137010152565b9080601f8301121561037e5781602061047693359101611065565b3461037e5760408060031936011261037e5760249081356001600160401b039283821161037e573660238301121561037e5781600401356110f781611033565b9361110481519586610fe4565b818552602095838787019360051b8601019436861161037e57848101935b868510611135576108fe8860043561368f565b843583811161037e5782016080602319823603011261037e5784519161115a83610fae565b878201358352604482013585811161037e5761117b9089369185010161109c565b8b84015260648201359285841161037e5760848c94936111a186958c369184010161109c565b8984015201356060820152815201940193611122565b6108fe6111c3366108b7565b90604051926111d184610fc9565b600084526148a6565b602080820190808352835180925260409283810182858560051b8401019601946000925b85841061120f575050505050505090565b909192939495968580600192603f198582030187528a5190815181526112546112448484015160808087860152840190610440565b888401518382038a850152610440565b916060809101519101529901940194019295949391906111fe565b3461037e5760208060031936011261037e5760049081356000526010815260409182600020908154916112a183611033565b936112ae86519586610fe4565b83855260009182528082208186015b8584106112d1578751806104d289826111da565b84836001928a516112e181610fae565b855481528b516112fe816112f781898b0161198c565b0382610fe4565b838201528b51611315816112f78160028b0161198c565b8c820152600386015460608201528152019201930192906112bd565b81601f8201121561037e5780359161134883611033565b926113566040519485610fe4565b808452602092838086019260051b82010192831161037e578301905b828210611380575050505090565b81358152908301908301611372565b3461037e5760408060031936011261037e576004908135906024356001600160401b03811161037e576113c59036908501611331565b916113da816000526010602052604060002090565b6113ef6113eb600583015460ff1690565b1590565b6116505783516113fe336145f6565b1061164057600e015460ff166116305760005b83518110156114ba57336114316109e961142b84886137f1565b51614631565b036114aa57611464600261145961144884886137f1565b516000526012602052604060002090565b015460081c60ff1690565b61149a578161147661144883876137f1565b540361148a57611485906132f8565b611411565b825163b8b30ccb60e01b81528590fd5b82516305a049a960e41b81528590fd5b825163ee83059d60e01b81528590fd5b5050600a54611585936020916114d8906001600160a01b03166109e9565b600d5491600e546115656114f0885163ffffffff1690565b61155863ffffffff61150c611503611005565b60008152613d0e565b94611515611014565b7f000000000000000000000000000000000000000000000000000000000000000081528a810199909952808a1c61ffff168b8a01521663ffffffff166060880152565b63ffffffff166080860152565b60a084015260008551809881958294634d8e1c2f60e11b84528301613bd7565b03925af1908115610c39577f768954f0fcad9ea6b99b1fb4128460d2a3823346589f54617b0dea7151a63f439360009261160c575b50611607906115dc846115d7856000526013602052604060002090565b613c51565b6115fd6115f384600052600f602052604060002090565b805460ff19169055565b5192839283613cca565b0390a1005b6116079192506116299060203d8111610c7457610c668183610fe4565b91906115ba565b8151633f44049d60e01b81528490fd5b825163f784e75f60e01b81528590fd5b8251637b5cbf5f60e11b81528590fd5b3461037e57602036600319011261037e5760043560005260146020526020604060002054604051908152f35b3461037e57600036600319011261037e5760206040517fd01d7f6f3b98c8ff4cbb99d207da8f806af0b2f8be9b5bb61dd74bf5550f329b8152f35b3461037e57602036600319011261037e5760206001600160a01b036116ed600435614647565b16604051908152f35b3461037e57602036600319011261037e57600435611712612c94565b611726816000526010602052604060002090565b600e81015460ff166117cf576005810190611742825460ff1690565b6117bd576117787f866c80811fbfd2e5bb71fab81328719eca06c4074dd9638080e605b00a4b7ecf92600160ff19825416179055565b42600682015561178742612fa3565b600782015561179542612fa3565b6117b8604051928392600c820191600b8101916009600a8301920190428761449a565b0390a2005b604051631a313d0760e21b8152600490fd5b6040516321472d0b60e01b8152600490fd5b3461037e57602036600319011261037e5760206118046117ff6105b2565b6145f6565b604051908152f35b3461037e5760008060031936011261055b576009546001600160a01b03908116330361188b576008546001600160a01b0316600880546001600160a01b0319163317905590600980546001600160a01b03191690553391167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b60405162461bcd60e51b815260206004820152601660248201527526bab9ba10313290383937b837b9b2b21037bbb732b960511b6044820152606490fd5b3461037e5760208060031936011261037e576119009060043560005260108152611907600860406000200160405193848092613dfb565b0383610fe4565b6040519181839283018184528251809152816040850193019160005b82811061193257505050500390f35b83516001600160a01b031685528695509381019392810192600101611923565b90600182811c92168015611982575b602083101461196c57565b634e487b7160e01b600052602260045260246000fd5b91607f1691611961565b906000929180549161199d83611952565b9182825260019384811690816000146119ff57506001146119bf575b50505050565b90919394506000526020928360002092846000945b8386106119eb5750505050010190388080806119b9565b8054858701830152940193859082016119d4565b9294505050602093945060ff191683830152151560051b010190388080806119b9565b90611012611900926040519384809261198c565b9993919b9e9d9b6110129d98611ad0986101a09d9860a08e611a8f611ae39f989b611ac19c611ab29b611a74611aa39b6101c0808852870190610440565b99602086015260408501526060840152608083019015159052565b015260c08d01528b820360e08d0152610440565b908982036101008b0152610440565b90878203610120890152610440565b90858203610140870152610440565b9761016084015261018083019015159052565b019015159052565b3461037e57602036600319011261037e576004356000526010602052604060002060018101611b1990611a22565b9060028101546003820154916004810154936005820154611b3a9060ff1690565b916006810154600782015460098301611b5290611a22565b611b5e600a8501611a22565b90611b6b600b8601611a22565b92611b78600c8701611a22565b94600d87015496600e0154986040519c8d9c8d9c8c60081c60ff169c60ff169b6104d29e611a36565b60021115611bab57565b634e487b7160e01b600052602160045260246000fd5b3461037e57602036600319011261037e57600435600052600f60205260ff604060002054166040516002821015611bab576020918152f35b3461037e5760c036600319011261037e576001600160401b0360443581811161037e57611c2a90369060040161109c565b60643582811161037e57611c4290369060040161109c565b60843583811161037e57611c5a90369060040161109c565b9060a43593841161037e57611c766108fe94369060040161109c565b92602435600435613581565b3461037e57600036600319011261037e5760206040517f20296b01d0b6bd176f0c1e29644934c0047abf080dae43609a1bbc09e39bafdb8152f35b3461037e57604036600319011261037e5760006020611cda6105b2565b611ce2612bdb565b60405163a9059cbb60e01b8152336004820152602480359082015292839160449183916001600160a01b03165af18015610c3957611d1c57005b6108fe9060203d8111610c3257610c228183610fe4565b3461037e57600036600319011261037e576008546040516001600160a01b039091168152602090f35b3461037e57602036600319011261037e57611d756105b2565b6008546001600160a01b03908116903382141580611dc3575b611d9b576108fe83612c2d565b60649250600a54166040519163061db9c160e01b835233600484015260248301526044820152fd5b5080600a5416331415611d8e565b3461037e57606036600319011261037e57611dea6105b2565b602435604435611df8612d72565b611e0c826000526010602052604060002090565b90600382019182548211611f2e57600e015460ff16611f1c57611e2f8185614b65565b600093845b828110611e8757505081611e6d611e81927fa2f234689387b39c2cbd3e4e4f0dfa6d60e6e6881d8b131cf432bf2dd5c90ce19454613abd565b809155604051918291829190602083019252565b0390a280f35b80600080516020614cd983398151915286611eaa611f1794610b87888c54613abd565b81611ebf826000526012602052604060002090565b55611ed881610bba846000526011602052604060002090565b60408051918252602082019290925260009181018290526060810182905260808101919091526001600160a01b03851660a08201528060c08101610bf0565b611e34565b604051633f44049d60e01b8152600490fd5b60405163bbb7402f60e01b8152600490fd5b3461037e57604036600319011261037e57602060ff611f86611f606105c8565b600435600052600c845260406000209060018060a01b0316600052602052604060002090565b54166040519015158152f35b3461037e5760008060031936011261055b576040519080600354611fb581611952565b808552916001918083169081156105315750600114611fde576104d2856104c681870382610fe4565b9250600383527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b5b8284106120215750505081016020016104c6826104d26104b6565b80546020858701810191909152909301928101612006565b3461037e57600036600319011261037e57600a546040516001600160a01b039091168152602090f35b3461037e57600036600319011261037e57602060405160008152f35b8015150361037e57565b60a435906110128261207e565b3461037e57604036600319011261037e576120ae6105b2565b602435906120bb8261207e565b3360009081526007602090815260408083206001600160a01b038516845290915290209115159160ff1981541660ff841617905560405191825260018060a01b0316907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a3005b608036600319011261037e5761213a6105b2565b6121426105c8565b606435916001600160401b03831161037e573660238401121561037e576121766108fe933690602481600401359101611065565b91604435916148a6565b3461037e57600036600319011261037e576020601554604051908152f35b3461037e57604036600319011261037e5760243560043560005260136020526040600020805482101561037e57602091610d6f91610d19565b3461037e5760408060031936011261037e576004356024359063ffffffff92838316830361037e57612207612c94565b61221b826000526010602052604060002090565b9260038401546125b957600884019384546125a857600e01549360ff851661259757612259612254856000526011602052604060002090565b613d47565b805160ff612265613d96565b9761227861227284613aae565b856137f1565b516122828a612fe9565b5260081c16612423577f69164982401e47b1c2fcc2bd71e4b2d963fc5114af49b6aa279cb869b190fb22975092857f322a0b91ae344fcae9bebd57220203818fa9bf2ab891c01fdf942ec22a1cf65d6123f07f71162e49c62fe91ab6262824bb1e9cc139a795bc8383413cd432de56db8639b795600080516020614cd98339815191528461232361142b6124169961231d6116079e9d613aae565b906137f1565b61232c81614a2c565b6123e261233a600054613aae565b9183612350846000526012602052604060002090565b55612372600161236a856000526012602052604060002090565b016103e79055565b61239b600261238b856000526012602052604060002090565b01805461ff001916610100179055565b6123a58187613dc0565b8c5192835260208301939093526103e7604083015260006060830152600160808301526001600160a01b0390921660a082015290819060c0820190565b0390a1875191829182613e41565b0390a283518681526020810187905263ffffffff90911660408201529081906060820190565b0390a15192839283613cca565b5050509091925060206124dd6000956124466109e9600a5460018060a01b031690565b90600d54906124b1600e549161246561245d611005565b8c8152613d0e565b9261246e611014565b7f000000000000000000000000000000000000000000000000000000000000000081528881019590955280881c61ffff168a8601521663ffffffff166060840152565b63ffffffff8616608083015260a08201528551978880948193634d8e1c2f60e11b835260048301613bd7565b03925af1908115610c39577f71162e49c62fe91ab6262824bb1e9cc139a795bc8383413cd432de56db8639b794600092612575575b5081928461252d611607946000526014602052604060002090565b5561255261254585600052600f602052604060002090565b805460ff19166001179055565b519384938491604091949363ffffffff9160608501968552602085015216910152565b61160792506125919060203d8111610c7457610c668183610fe4565b91612512565b8251633f44049d60e01b8152600490fd5b825163c8ba0a7b60e01b8152600490fd5b815163dbdb59c360e01b8152600490fd5b3461037e57602036600319011261037e576104d26125e960043561439e565b604051918291602083526020830190610440565b3461037e57604036600319011261037e576108fe60043561261c6105c8565b9080600052600c602052612637600160406000200154612dc7565b612e91565b3461037e57602036600319011261037e576020611804610cc96105b2565b3461037e57602036600319011261037e57600435612676612c94565b8060005260106020526040600020600e81019060ff8254166117cf576005015460ff166117bd57805460ff19166001179055604051600181527fb3e0a1ab7b74690c57eec0d3f968e19b6f60caec6a07628503a065a4798305c99080602081016117b8565b3461037e57604036600319011261037e57602060ff611f866126fb6105b2565b6127036105c8565b6001600160a01b0391821660009081526007865260408082209290931681526020919091522090565b60408060031936011261037e5760043560243591612748613aff565b61275c826000526010602052604060002090565b600e81015460ff1661283c5761278a612776610cce61453d565b610ce8610ce3876109c66004870154612f76565b341061282b57600301908154841161281b576127a68433614b65565b600093845b8181106127f15750916127e491610b427fa2f234689387b39c2cbd3e4e4f0dfa6d60e6e6881d8b131cf432bf2dd5c90ce1948354613abd565b0390a261084a6001600b55565b80600080516020614cd9833981519152610bf0610b8c61281694610b87878c54613abd565b6127ab565b5163bbb7402f60e01b8152600490fd5b81516317b3cb3760e31b8152600490fd5b8151633f44049d60e01b8152600490fd5b3461037e57602036600319011261037e57600480356001600160401b03811161037e5761287d9036908301611331565b9060005b82518110156108fe573361289b6109e961142b84876137f1565b0361299a5760026128b66113eb8261145961144886896137f1565b612989576128d3816128cb61144885886137f1565b015460ff1690565b61297857906128fa612973926128ec61144884886137f1565b01805460ff19166001179055565b7fef15b56ad10cecf7b64a12e2ec4c2576aa212c30f74f931937cb606fb7af48d861292582866137f1565b5161293361144884886137f1565b5490610bf06001612947611448878b6137f1565b015460405193849384608091949360019360a08301968352602083015260408201528260608201520152565b612881565b604051630576a14160e01b81528390fd5b60405163033fc78160e51b81528390fd5b5060405163ee83059d60e01b8152fd5b601654811015610d3157601660005260021b7fd833147d7dc355ba459fc788f669e58cfaf9dc25ddcd0702e87d69c7b51242890190600090565b8054821015610d315760005260206000209060021b0190600090565b3461037e57602036600319011261037e5760043560165481101561037e57612a296080916129aa565b5060018060a01b039081815416916001820154169060ff600360028301549201541691604051938452602084015260408301526060820152f35b3461037e5761014036600319011261037e5760046001600160401b03813581811161037e57612a95903690840161109c565b90612a9e612088565b60c43582811161037e57612ab5903690860161109c565b60e43583811161037e57612acc903690870161109c565b916101043584811161037e57612ae5903690880161109c565b936101243590811161037e576108fe96612b019136910161109c565b9460843590606435906044359060243590613221565b3461037e57602036600319011261037e57612b306105b2565b612b38612bdb565b6001600160a01b0316338114612b9657600980546001600160a01b03191682179055600854612b6f906001600160a01b03166109e9565b7fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae1278600080a3005b60405162461bcd60e51b815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c660000000000000000006044820152606490fd5b6008546001600160a01b03163303612bef57565b60405162461bcd60e51b815260206004820152601660248201527527b7363c9031b0b63630b1363290313c9037bbb732b960511b6044820152606490fd5b6001600160a01b03168015612c82576020817fd1a6a14209a385a964d036e404cb5cfb71f4000cdb03c9366292430787261be6926bffffffffffffffffffffffff60a01b600a541617600a55604051908152a1565b60405163d92e233d60e01b8152600490fd5b3360009081527fca4c450120a85f872b52d5a02308774861dce0f6fbb4824ab693f6a6bdef11bf602052604090205460ff1615612ccd57565b6108b36048612d5a612cde3361306f565b612d4c612ce96130ff565b6040519485937f416363657373436f6e74726f6c3a206163636f756e74200000000000000000006020860152612d2981518092602060378901910161041d565b84017001034b99036b4b9b9b4b733903937b6329607d1b60378201520190612e7a565b03601f198101835282610fe4565b60405162461bcd60e51b815291829160048301610465565b3360009081527f7596c25533a064a92e1e2ee4205607f4b1494865969267ec37b72ad860e48809602052604090205460ff1615612dab57565b6108b36048612d5a612dbc3361306f565b612d4c612ce9613190565b6000818152600c6020908152604080832033845290915290205460ff1615612dec5750565b612df53361306f565b612dfd612fce565b916030612e0984612fe9565b536078612e1584612ff6565b5360415b60018111612e38576108b36048612d5a85612d4c88612ce98815613024565b90600f8116906010821015610d3157612e75916f181899199a1a9b1b9c1cb0b131b232b360811b901a612e6b8487613006565b5360041c91613017565b612e19565b90612e8d6020928281519485920161041d565b0190565b600090808252600c60205260ff612ebd84604085209060018060a01b0316600052602052604060002090565b5416612ec857505050565b808252600c602090815260408084206001600160a01b038616600090815292529020805460ff1916905533926001600160a01b0316917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9080a4565b634e487b7160e01b600052601160045260246000fd5b906402540be40091828102928184041490151715612f5457565b612f24565b90670de0b6b3a764000091828102928184041490151715612f5457565b9064e8d4a5100091828102928184041490151715612f5457565b81810292918115918404141715612f5457565b90624f1a008201809211612f5457565b6001019081600111612f5457565b91908201809211612f5457565b60405190612fdb82610fae565b604282526060366020840137565b805115610d315760200190565b805160011015610d315760210190565b908151811015610d31570160200190565b8015612f54576000190190565b1561302b57565b606460405162461bcd60e51b815260206004820152602060248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b60405190606082018281106001600160401b0382111761079157604052602a8252604036602084013760306130a383612fe9565b5360786130af83612ff6565b536029905b600182116130c757610476915015613024565b600f8116906010821015610d31576130f9916f181899199a1a9b1b9c1cb0b131b232b360811b901a612e6b8486613006565b906130b4565b7f20296b01d0b6bd176f0c1e29644934c0047abf080dae43609a1bbc09e39bafdb613128612fce565b90603061313483612fe9565b53607861314083612ff6565b536041905b6001821161315857610476915015613024565b600f8116906010821015610d315761318a916f181899199a1a9b1b9c1cb0b131b232b360811b901a612e6b8486613006565b90613145565b7fd01d7f6f3b98c8ff4cbb99d207da8f806af0b2f8be9b5bb61dd74bf5550f329b6131b9612fce565b9060306131c583612fe9565b5360786131d183612ff6565b536041905b600182116131e957610476915015613024565b600f8116906010821015610d315761321b916f181899199a1a9b1b9c1cb0b131b232b360811b901a612e6b8486613006565b906131d6565b96939895929190979497613233612c94565b601554996132408b6132f8565b6015556132578b6000526010602052604060002090565b986132659060018b01613379565b6002890181905560038901556004880155600d87015560058601805460ff1916905580600687015561329690612fa3565b60078601556132a89060098601613379565b6132b590600a8501613379565b6132c290600b8401613379565b6132cf90600c8301613379565b600e01805460ff1916815590815461ff00191690151560081b61ff0016179055611012906134f3565b6000198114612f545760010190565b634e487b7160e01b600052600060045260246000fd5b818110613328575050565b6000815560010161331d565b9190601f811161334357505050565b611012926000526020600020906020601f840160051c8301931061336f575b601f0160051c019061331d565b9091508190613362565b91909182516001600160401b038111610791576133a08161339a8454611952565b84613334565b602080601f83116001146133dc5750819293946000926133d1575b50508160011b916000199060031b1c1916179055565b0151905038806133bb565b90601f198316956133f285600052602060002090565b926000905b88821061342f57505083600195969710613416575b505050811b019055565b015160001960f88460031b161c1916905538808061340c565b806001859682949686015181550195019301906133f7565b9c9b9994976110129b9760e08f6134cb996134da9c6134bc996101c09f9961347b6134ad9a996101e080885287019061198c565b986020860152604085015260608401526080830152600060a083015260c082015201528d61010081840391015261198c565b908b82036101208d015261198c565b908982036101408b015261198c565b9087820361016089015261198c565b94600061018082015260006101a0820152019015159052565b80600052601060205260406000206002810154600482015491600d81015491600682015491624f1a00830193848411612f54577faaef77581b53632bfed6063864a759eba927e76bcdb2a3bd0b7a1cb0e189e0f19561357c9360ff600e85015460081c1693604051978897600c830195600b840195600a8501958060016009880197018d613447565b0390a2565b9492909261358d612c94565b856000526010602052604060002094600586019260ff8454166117bd5761362161357c9461361a85600c8b8b60067f866c80811fbfd2e5bb71fab81328719eca06c4074dd9638080e605b00a4b7ecf9e01556135e88c612fa3565b60078201556135fa8b60098301613379565b61360787600a8301613379565b61361488600b8301613379565b01613379565b5460ff1690565b9461362b87612fa3565b6040519788978895926136819461366591613673946104769a989415158a5260208a0152604089015260e0606089015260e0880190610440565b908682036080880152610440565b9084820360a0860152610440565b9160c0818403910152610440565b91909161369a612c94565b6136ae816000526010602052604060002090565b916136bd600584015460ff1690565b6117bd57600091825b85518410156136f7576136eb6136f19160606136e2878a6137f1565b51015190612fc1565b936132f8565b926136c6565b9092509290926002820154036137df57613718613712613805565b82613962565b817f6583207d0c10464b1d228b352b0d6d790d77f4fae61e406c9b06bf6d8683edaa600080a260005b84518110156137d8578061376261375b6137d393886137f1565b5184613a29565b837f1db8c8af38ca030c75e0e2730c893856ee0d70f5001b47c6f836363c035a38a161378d83612fb3565b6020613799858b6137f1565b510151906137cb60408b60606137bd89846137b482866137f1565b510151936137f1565b510151915194859485613a56565b0390a26132f8565b613741565b5050509050565b604051633eb1097f60e11b8152600490fd5b8051821015610d315760209160051b010190565b60405161381181610fc9565b6000815290565b6138228154611952565b908161382c575050565b81601f6000931160011461383e575055565b90808391825261385d601f60208420940160051c84016001850161331d565b5555565b9080518255600190818301602080830151938451916001600160401b03831161079157613898836138928654611952565b86613334565b80601f84116001146138ed57509180809260609695946003986000946138e2575b50501b9160001990871b1c19161790555b6138db604082015160028601613379565b0151910155565b0151925038806138b9565b91939495601f19841661390587600052602060002090565b936000905b82821061394b5750509160039795939185606098969410613933575b505050811b0190556138ca565b015160001983891b60f8161c19169055388080613926565b80888697829497870151815501960194019061390a565b815191600160401b83116107915781548383558084106139c1575b50613992602080920192600052602060002090565b6000925b8484106139a4575050505050565b600483826139b56001945186613861565b01920193019290613996565b6001600160fe1b038181168203612f545784168403612f545760008381526020812091600290811b83019286821b015b838110613a005750505061397d565b808360049255613a1260018201613818565b613a1d838201613818565b836003820155016139f1565b8054600160401b81101561079157613a46916001820181556129e4565b91909161078c5761101291613861565b949392613a76606093613a84938852608060208901526080880190610440565b908682036040880152610440565b930152565b634e487b7160e01b600052601260045260246000fd5b8115613aa9570490565b613a89565b600019810191908211612f5457565b91908203918211612f5457565b8054600160401b81101561079157613ae791600182018155610d19565b819291549060031b91821b91600019901b1916179055565b6002600b5414613b10576002600b55565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b90604051613b6281610fae565b82546001600160a01b03908116825260018401541660208201526002830154604082015260039092015460ff166060830152565b60ff16604d8111612f5457600a0a90565b9081602091031261037e575190565b6040513d6000823e3d90fd5b9081602091031261037e57516104768161207e565b60e060a06104769360208452805160208501526020810151604085015261ffff604082015116606085015263ffffffff8060608301511660808601526080820151168285015201519160c0808201520190610440565b80546000825580613c3c575050565b6110129160005260206000209081019061331d565b8151916001600160401b03831161079157600160401b8311610791578154838355808410613cac575b50602080910191600052806000209060005b848110613c9a575050505050565b83518382015592810192600101613c8c565b613cc49083600052846020600020918201910161331d565b38613c7a565b9060609160408101918152602092816040858094015285518094520193019160005b828110613cfa575050505090565b835185529381019392810192600101613cec565b6040519063125fa26760e31b6020830152511515602482015260248152606081018181106001600160401b038211176107915760405290565b9060405191828154918282526020928383019160005283600020936000905b828210613d7c5750505061101292500383610fe4565b855484526001958601958895509381019390910190613d66565b60405190604082018281106001600160401b03821117610791576040526001825260203681840137565b8054600160401b81101561079157613ddd91600182018155610d19565b819291549060031b9160018060a01b03809116831b921b1916179055565b90815480825260208092019260005281600020916000905b828210613e21575050505090565b83546001600160a01b031685529384019360019384019390910190613e13565b906020610476928181520190613dfb565b81835290916001600160fb1b03831161037e5760209260051b809284830137010190565b6104769492606092825260208201528160408201520191613e52565b9190811015610d315760051b0190565b8115613aa9570690565b91929092613ec7612254846000526013602052604060002090565b613ee7613ed661144883612fe9565b546000526010602052604060002090565b90613ef461144882612fe9565b54937fe4e81d95bce696dbb0bdb2f89a5ec0eb634a4aada070ced6e92440c36ff35d0087604096613f2b8789519384938c85613e76565b0390a160009283908054905b8183106141205750505060005b82518110156140fd57613f5781846137f1565b519388613f8682613f80858a613f7a613ed68c6000526012602052604060002090565b95613e92565b35613ea2565b90600081545b8082106140b3575b505091613fd0613fc97fef15b56ad10cecf7b64a12e2ec4c2576aa212c30f74f931937cb606fb7af48d8936140ae96956129e4565b5091613aae565b966003820191613fe08354613aae565b835580546001613ffa846000526012602052604060002090565b0155614015600261238b846000526012602052604060002090565b7f33d188820018c7a1c3e4b1342648779a271a173948750992f3d897a58ea7446761406961404d846000526012602052604060002090565b54925494548d5186815260208101919091529081906040820190565b0390a2610bf0614083826000526012602052604060002090565b548b5192835260208301526040820192909252600060608201526001608082015290819060a0820190565b613f44565b90926140bf84846129e4565b5060038091015482106140ed576140e7916136eb916140de87876129e4565b50015490613abd565b90613f8c565b50613fd09150613fc99050613f94565b5095505050505061411b611012916000526013602052604060002090565b613c2d565b90919461413f61414591600361413689866129e4565b50015490612fc1565b956132f8565b9190613f37565b604090610476949281528160208201520191613e52565b9091614179826000526014602052604060002090565b549261418f846000526010602052604060002090565b936141a7612254826000526011602052604060002090565b805160009660080191875b8887821061424057505050509161423d9493917f322a0b91ae344fcae9bebd57220203818fa9bf2ab891c01fdf942ec22a1cf65d6142177f69164982401e47b1c2fcc2bd71e4b2d963fc5114af49b6aa279cb869b190fb229560405191829182613e41565b0390a261422a604051928392868461414c565b0390a16000526014602052604060002090565b55565b90600080516020614cd98339815191528661431793610bf061428861427861142b6142728f8f8a8e92613f8092613e92565b8a6137f1565b9261428284614a2c565b54613aae565b918361429e846000526012602052604060002090565b556142b8600161236a856000526012602052604060002090565b6142d1600261238b856000526012602052604060002090565b6142db818b613dc0565b60405193849384919260a091949360c0840195845260208401526103e760408401526000606084015260016080840152600180831b0316910152565b6141b2565b60009291815461432b81611952565b9260019180831690811561438357506001146143475750505050565b90919293945060005260209081600020906000915b85831061437257505050500190388080806119b9565b80548584015291830191810161435c565b60ff19168452505050811515909102019150388080806119b9565b6143aa6113eb826146b6565b614488576143c5613ed6826000526012602052604060002090565b906143df60026128cb836000526012602052604060002090565b156144275761442191612d4c61440e6001614407610476956000526012602052604060002090565b0154614c99565b604051948593600960208601910161431c565b90612e7a565b6144406002611459836000526012602052604060002090565b1561447b5761442191612d4c6144686001614407610476956000526012602052604060002090565b604051948593600b60208601910161431c565b50600a6104769101611a22565b60405163677510db60e11b8152600490fd5b9491936144cc6144e89461047698966144da9460018a5260208a0152604089015260e0606089015260e088019061198c565b90868203608088015261198c565b9084820360a086015261198c565b9160c081840391015261198c565b3d15614521573d906145078261104a565b916145156040519384610fe4565b82523d6000602084013e565b606090565b519069ffffffffffffffffffff8216820361037e57565b604051633fabe5a360e21b815260a081600481721382149eba3441043c1c66972b4772963f5d435afa908115610c3957600091614578575090565b9060a0823d82116145b9575b8161459160a09383610fe4565b8101031261055b57506145a381614526565b506145b5608060208301519201614526565b5090565b3d9150614584565b604051633fabe5a360e21b81529060a090829060049082906001600160a01b03165afa908115610c3957600091614578575090565b6001600160a01b0316801561461f5760005260056020526001600160401b036040600020541690565b6040516323d3ad8160e21b8152600490fd5b6001600160a01b039061464390614647565b1690565b8060009081548110614666575b604051636f96cda160e11b8152600490fd5b81526004906020918083526040928383205494600160e01b86161561468d57505050614654565b93929190935b85156146a157505050505090565b60001901808352818552838320549550614693565b600054811090816146c5575090565b90506000526004602052600160e01b604060002054161590565b906146e983614647565b6001600160a01b03838116928282168490036148955760008681526006602052604090208054909261472a6001600160a01b03881633908114908414171590565b614841575b821695861561482f576147829361476092614825575b506001600160a01b0316600090815260056020526040902090565b80546000190190556001600160a01b0316600090815260056020526040902090565b80546001019055600160e11b804260a01b8517176147aa866000526004602052604060002090565b558116156147db575b507fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4565b600184016147f3816000526004602052604060002090565b5415614800575b506147b3565b60005481146147fa5761481d906000526004602052604060002090565b5538806147fa565b6000905538614745565b604051633a954ecd60e21b8152600490fd5b61487e6113eb61361a336148678b60018060a01b03166000526007602052604060002090565b9060018060a01b0316600052602052604060002090565b1561472f57604051632ce44b5f60e11b8152600490fd5b60405162a1148160e81b8152600490fd5b9291906148b48282866146df565b803b6148c05750505050565b6148c993614a03565b156148d757388080806119b9565b6040516368d2bf6b60e11b8152600490fd5b9081602091031261037e57516104768161036c565b610476939260809260018060a01b031682526000602083015260408201528160608201520190610440565b6001600160a01b03918216815291166020820152604081019190915260806060820181905261047692910190610440565b61498360209160009394604051948580948193630a85bd0160e11b998a845233600485016148fe565b03926001600160a01b03165af1600091816149d3575b506149c5576149a66144f6565b805190816149c0576040516368d2bf6b60e11b8152600490fd5b602001fd5b6001600160e01b0319161490565b6149f591925060203d81116149fc575b6149ed8183610fe4565b8101906148e9565b9038614999565b503d6149e3565b92602091614983936000604051809681958294630a85bd0160e11b9a8b85523360048601614929565b604090815191614a3b83610fc9565b600080845280546001600160a01b038416825260056020526040822091949180546801000000000000000101905560008181526004602052604090206001600160a01b03851694904260a01b8617600160e11b179055600191828101957fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef82828a838180a484885b898103614b565750505015614b4657858755813b614ae5575b50505050505050565b9180805b614b06575b50505050505081540361055b57808080808080614adc565b15614b39575b86614b1e6113eb86848701968661495a565b614b285781614ae9565b85516368d2bf6b60e11b8152600490fd5b858310614b0c5780614aee565b8451622e076360e81b8152600490fd5b80848c858180a4018590614ac3565b60408051614b7281610fc9565b6000938482528454938115614c88576001600160a01b038116600090815260056020526040902080546801000000000000000184020190556000858152600460205260409020600192906001600160a01b038316904260a01b85841460e11b17821790558187019684807fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9280858d868180a4015b898103614c795750505015614b4657858755813b614c285750505050505050565b85039180805b614c4a5750505050505081540361055b57808080808080614adc565b15614c6c575b86614c626113eb86848701968661495a565b614b285781614c2e565b858310614c505780614aee565b80848c858180a4018590614c07565b835163b562e8dd60e01b8152600490fd5b9060405160a08101604052608081019260008452925b6000190192600a906030828206018553049283614caf57809350608091030191601f190191825256fe3aeb3f0a27eb3972142a5b5ef092cb3fb09577bf28719813314e8be2e5f3c9fba264697066735822122039b4db11733f0eb1d4c2bd61677f42b9d1a2dced2570a11f98388b2298fc091064736f6c634300081400332f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d3318d331ebc786c94a827536b8b53ee9776a169bd92fec24f35028dbbc5de3dc
Deployed Bytecode
0x6080604052600436101561001257600080fd5b60003560e01c806301ffc9a71461036757806306fdde0314610362578063081812fc1461035d578063095ea7b314610358578063178ebefa1461035357806318160ddd1461034e5780631fe543e31461034957806323b872dd14610344578063248a9ca31461033f57806326c049a51461033a5780632b14d65a146103355780632f2ff15d146103305780633214234a1461032b57806336568abe146103265780633ccfd60b146103215780633ce7d87e1461031c57806342842e0e14610317578063455e3a38146103125780634d96c8f21461030d5780634ec97ba1146103085780636262a4f5146103035780636352211e146102fe57806363d0eb35146102f957806370a08231146102f457806379ba5097146102ef5780637ede93fe146102ea578063812dd70c146102e557806381d12c58146102e0578063837a0fd6146102db5780638545d8df146102d657806386185a56146102d15780638da5cb5b146102cc5780638ea98117146102c757806390713123146102c257806391d14854146102bd57806395d89b41146102b85780639eccacf6146102b3578063a217fddf146102ae578063a22cb465146102a9578063b88d4fde146102a4578063b99a92151461029f578063be422c3d1461029a578063bfc7a4b014610295578063c87b56dd14610290578063d547741f1461028b578063e7078f9214610286578063e7282b0c14610281578063e985e9c51461027c578063eaf8ecaa14610277578063eec9adf214610272578063f0d053dc1461026d578063f151edc7146102685763f2fde38b1461026357600080fd5b612b17565b612a63565b612a00565b61284d565b61272c565b6126db565b61265a565b61263c565b6125fd565b6125ca565b6121d7565b61219e565b612180565b612126565b612095565b612062565b612039565b611f92565b611f40565b611dd1565b611d5c565b611d33565b611cbd565b611c82565b611bf9565b611bc1565b611aeb565b6118c9565b61180c565b6117e1565b6116f6565b6116c7565b61168c565b611660565b61138f565b61126f565b6111b7565b6110b7565b610f2d565b610e9b565b610e46565b610d7d565b610d36565b61092f565b610900565b6108ec565b6107b9565b610796565b610695565b6105de565b61055e565b610479565b610383565b6001600160e01b031981160361037e57565b600080fd5b3461037e57602036600319011261037e5760206004356103a28161036c565b63ffffffff60e01b166301ffc9a760e01b8114908190821561040c575b82156103fb575b82156103d9575b50506040519015158152f35b637965db0b60e01b14915081156103f3575b5038806103cd565b9050386103eb565b635b5e139f60e01b811492506103c6565b6380ac58cd60e01b811492506103bf565b60005b8381106104305750506000910152565b8181015183820152602001610420565b906020916104598151809281855285808601910161041d565b601f01601f1916010190565b906020610476928181520190610440565b90565b3461037e5760008060031936011261055b57604051908060025461049c81611952565b8085529160019180831690811561053157506001146104d6575b6104d2856104c681870382610fe4565b60405191829182610465565b0390f35b9250600283527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace5b8284106105195750505081016020016104c6826104d26104b6565b805460208587018101919091529093019281016104fe565b8695506104d2969350602092506104c694915060ff191682840152151560051b82010192936104b6565b80fd5b3461037e57602036600319011261037e5760043561057b816146b6565b156105a0576000526006602052602060018060a01b0360406000205416604051908152f35b6040516333d1c03960e21b8152600490fd5b600435906001600160a01b038216820361037e57565b602435906001600160a01b038216820361037e57565b604036600319011261037e576105f26105b2565b6024356001600160a01b038061060783614647565b1690813303610662575b600083815260066020526040812080546001600160a01b0319166001600160a01b0387161790559316907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258480a480f35b600082815260076020908152604080832033845290915290205460ff16610611576040516367d9dca160e11b8152600490fd5b3461037e57608036600319011261037e576106ae6105b2565b6106b66105c8565b906064359160ff831680930361037e576106ce612c94565b6040516106da81610fae565b60018060a01b03809316815282602082019216825260408101604435815260608201948552601654600160401b8110156107915780600161071e92016016556129aa565b92909261078c575182549085166001600160a01b03166001600160a01b031990911617825560ff936003936107749190516001850180546001600160a01b0319166001600160a01b039390921692909216179055565b5160028201550191511660ff19825416179055600080f35b613307565b610f98565b3461037e57600036600319011261037e5760206000546001549003604051908152f35b3461037e57604036600319011261037e576024356004356001600160401b0380831161037e573660238401121561037e57826004013590811161037e576024830192602436918360051b01011161037e57600a546001600160a01b03163381900361088a5750600092828452600f60205260ff6040852054166002811015610876578061084d575061084a92613eac565b80f35b80610859600192611ba1565b14610865575b50505080f35b61086e92614163565b38808061085f565b634e487b7160e01b85526021600452602485fd5b60405163073e64fd60e21b81523360048201526001600160a01b03919091166024820152604490fd5b0390fd5b606090600319011261037e576001600160a01b0390600435828116810361037e5791602435908116810361037e579060443590565b6108fe6108f8366108b7565b916146df565b005b3461037e57602036600319011261037e57600435600052600c6020526020600160406000200154604051908152f35b3461037e57606036600319011261037e576004803590602435610950613aff565b610964836000526010602052604060002090565b90610973600e83015460ff1690565b610cf25761098b6109856044356129aa565b50613b55565b916109a261099d606085015160ff1690565b613b96565b604080850180519195929115610ca8576109cb6109d3926109c6878a880154612f90565b612f90565b905190613a9f565b81516109f5906109e9906001600160a01b031681565b6001600160a01b031690565b8551636eb1769f60e11b81523388820190815230602082810191909152949285918391908290819060400103915afa8015610c39578391600091610c8b575b5010610c7b578051610a50906109e9906001600160a01b031681565b86516370a0823160e01b815233898201908152909185918391908290819060200103915afa8015610c39578391600091610c4e575b5010610c3e575160009392918291610adc9190610aac906109e9906001600160a01b031681565b88516323b872dd60e01b8152338b8201908152306020820152604081019390935296879391928492839160600190565b03925af1928315610c3957600393610c0b575b5050019283548211610bfd5750610b068133614b65565b60005b818110610b61575091610b5491610b427fa2f234689387b39c2cbd3e4e4f0dfa6d60e6e6881d8b131cf432bf2dd5c90ce1948354613abd565b80925551918291829190602083019252565b0390a26108fe6001600b55565b80600080516020614cd9833981519152610bf0610b8c610bf894610b8787600054613abd565b612fc1565b88610ba1826000526012602052604060002090565b55610bbf81610bba8b6000526011602052604060002090565b613aca565b8651908152602081018990526000604082018190526060820181905260808201523360a082015290819060c0820190565b0390a16132f8565b610b09565b825163bbb7402f60e01b8152fd5b81610c2a92903d10610c32575b610c228183610fe4565b810190613bc2565b503880610aef565b503d610c18565b613bb6565b855163d9641fe560e01b81528790fd5b610c6e9150853d8711610c74575b610c668183610fe4565b810190613ba7565b38610a85565b503d610c5c565b85516327c94fa560e01b81528790fd5b610ca29150853d8711610c7457610c668183610fe4565b38610a34565b50506020810151610ced90610cd390610cce906001600160a01b03166145c1565b6145c1565b612f3a565b610ce8610ce38689870154612f90565b612f59565b613a9f565b6109d3565b604051633f44049d60e01b81528390fd5b634e487b7160e01b600052603260045260246000fd5b8054821015610d315760005260206000200190600090565b610d03565b3461037e57604036600319011261037e5760243560043560005260116020526040600020805482101561037e57602091610d6f91610d19565b90546040519160031b1c8152f35b3461037e57604036600319011261037e57600435610d996105c8565b600091808352600c602052610db46001604085200154612dc7565b808352600c602090815260408085206001600160a01b0385166000908152925290205460ff1615610de3578280f35b808352600c602090815260408085206001600160a01b038516600090815292529020805460ff1916600117905533916001600160a01b0316907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8480a438808280f35b3461037e57602036600319011261037e5760043560005260126020526080604060002060ff815491600260018201549101549060405193845260208401528181161515604084015260081c1615156060820152f35b3461037e57604036600319011261037e57610eb46105c8565b336001600160a01b03821603610ed0576108fe90600435612e91565b60405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608490fd5b3461037e5760008060031936011261055b57610f47612bdb565b8080808047335af1610f576144f6565b5015610f605780f35b60405162461bcd60e51b815260206004820152601060248201526f2a3930b739b332b9103330b4b632b21760811b6044820152606490fd5b634e487b7160e01b600052604160045260246000fd5b608081019081106001600160401b0382111761079157604052565b602081019081106001600160401b0382111761079157604052565b90601f801991011681019081106001600160401b0382111761079157604052565b6040519061101282610fc9565b565b6040519060c082018281106001600160401b0382111761079157604052565b6001600160401b0381116107915760051b60200190565b6001600160401b03811161079157601f01601f191660200190565b9291926110718261104a565b9161107f6040519384610fe4565b82948184528183011161037e578281602093846000960137010152565b9080601f8301121561037e5781602061047693359101611065565b3461037e5760408060031936011261037e5760249081356001600160401b039283821161037e573660238301121561037e5781600401356110f781611033565b9361110481519586610fe4565b818552602095838787019360051b8601019436861161037e57848101935b868510611135576108fe8860043561368f565b843583811161037e5782016080602319823603011261037e5784519161115a83610fae565b878201358352604482013585811161037e5761117b9089369185010161109c565b8b84015260648201359285841161037e5760848c94936111a186958c369184010161109c565b8984015201356060820152815201940193611122565b6108fe6111c3366108b7565b90604051926111d184610fc9565b600084526148a6565b602080820190808352835180925260409283810182858560051b8401019601946000925b85841061120f575050505050505090565b909192939495968580600192603f198582030187528a5190815181526112546112448484015160808087860152840190610440565b888401518382038a850152610440565b916060809101519101529901940194019295949391906111fe565b3461037e5760208060031936011261037e5760049081356000526010815260409182600020908154916112a183611033565b936112ae86519586610fe4565b83855260009182528082208186015b8584106112d1578751806104d289826111da565b84836001928a516112e181610fae565b855481528b516112fe816112f781898b0161198c565b0382610fe4565b838201528b51611315816112f78160028b0161198c565b8c820152600386015460608201528152019201930192906112bd565b81601f8201121561037e5780359161134883611033565b926113566040519485610fe4565b808452602092838086019260051b82010192831161037e578301905b828210611380575050505090565b81358152908301908301611372565b3461037e5760408060031936011261037e576004908135906024356001600160401b03811161037e576113c59036908501611331565b916113da816000526010602052604060002090565b6113ef6113eb600583015460ff1690565b1590565b6116505783516113fe336145f6565b1061164057600e015460ff166116305760005b83518110156114ba57336114316109e961142b84886137f1565b51614631565b036114aa57611464600261145961144884886137f1565b516000526012602052604060002090565b015460081c60ff1690565b61149a578161147661144883876137f1565b540361148a57611485906132f8565b611411565b825163b8b30ccb60e01b81528590fd5b82516305a049a960e41b81528590fd5b825163ee83059d60e01b81528590fd5b5050600a54611585936020916114d8906001600160a01b03166109e9565b600d5491600e546115656114f0885163ffffffff1690565b61155863ffffffff61150c611503611005565b60008152613d0e565b94611515611014565b7f816bedba8a50b294e5cbd47842baf240c2385f2eaf719edbd4f250a137a8c89981528a810199909952808a1c61ffff168b8a01521663ffffffff166060880152565b63ffffffff166080860152565b60a084015260008551809881958294634d8e1c2f60e11b84528301613bd7565b03925af1908115610c39577f768954f0fcad9ea6b99b1fb4128460d2a3823346589f54617b0dea7151a63f439360009261160c575b50611607906115dc846115d7856000526013602052604060002090565b613c51565b6115fd6115f384600052600f602052604060002090565b805460ff19169055565b5192839283613cca565b0390a1005b6116079192506116299060203d8111610c7457610c668183610fe4565b91906115ba565b8151633f44049d60e01b81528490fd5b825163f784e75f60e01b81528590fd5b8251637b5cbf5f60e11b81528590fd5b3461037e57602036600319011261037e5760043560005260146020526020604060002054604051908152f35b3461037e57600036600319011261037e5760206040517fd01d7f6f3b98c8ff4cbb99d207da8f806af0b2f8be9b5bb61dd74bf5550f329b8152f35b3461037e57602036600319011261037e5760206001600160a01b036116ed600435614647565b16604051908152f35b3461037e57602036600319011261037e57600435611712612c94565b611726816000526010602052604060002090565b600e81015460ff166117cf576005810190611742825460ff1690565b6117bd576117787f866c80811fbfd2e5bb71fab81328719eca06c4074dd9638080e605b00a4b7ecf92600160ff19825416179055565b42600682015561178742612fa3565b600782015561179542612fa3565b6117b8604051928392600c820191600b8101916009600a8301920190428761449a565b0390a2005b604051631a313d0760e21b8152600490fd5b6040516321472d0b60e01b8152600490fd5b3461037e57602036600319011261037e5760206118046117ff6105b2565b6145f6565b604051908152f35b3461037e5760008060031936011261055b576009546001600160a01b03908116330361188b576008546001600160a01b0316600880546001600160a01b0319163317905590600980546001600160a01b03191690553391167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b60405162461bcd60e51b815260206004820152601660248201527526bab9ba10313290383937b837b9b2b21037bbb732b960511b6044820152606490fd5b3461037e5760208060031936011261037e576119009060043560005260108152611907600860406000200160405193848092613dfb565b0383610fe4565b6040519181839283018184528251809152816040850193019160005b82811061193257505050500390f35b83516001600160a01b031685528695509381019392810192600101611923565b90600182811c92168015611982575b602083101461196c57565b634e487b7160e01b600052602260045260246000fd5b91607f1691611961565b906000929180549161199d83611952565b9182825260019384811690816000146119ff57506001146119bf575b50505050565b90919394506000526020928360002092846000945b8386106119eb5750505050010190388080806119b9565b8054858701830152940193859082016119d4565b9294505050602093945060ff191683830152151560051b010190388080806119b9565b90611012611900926040519384809261198c565b9993919b9e9d9b6110129d98611ad0986101a09d9860a08e611a8f611ae39f989b611ac19c611ab29b611a74611aa39b6101c0808852870190610440565b99602086015260408501526060840152608083019015159052565b015260c08d01528b820360e08d0152610440565b908982036101008b0152610440565b90878203610120890152610440565b90858203610140870152610440565b9761016084015261018083019015159052565b019015159052565b3461037e57602036600319011261037e576004356000526010602052604060002060018101611b1990611a22565b9060028101546003820154916004810154936005820154611b3a9060ff1690565b916006810154600782015460098301611b5290611a22565b611b5e600a8501611a22565b90611b6b600b8601611a22565b92611b78600c8701611a22565b94600d87015496600e0154986040519c8d9c8d9c8c60081c60ff169c60ff169b6104d29e611a36565b60021115611bab57565b634e487b7160e01b600052602160045260246000fd5b3461037e57602036600319011261037e57600435600052600f60205260ff604060002054166040516002821015611bab576020918152f35b3461037e5760c036600319011261037e576001600160401b0360443581811161037e57611c2a90369060040161109c565b60643582811161037e57611c4290369060040161109c565b60843583811161037e57611c5a90369060040161109c565b9060a43593841161037e57611c766108fe94369060040161109c565b92602435600435613581565b3461037e57600036600319011261037e5760206040517f20296b01d0b6bd176f0c1e29644934c0047abf080dae43609a1bbc09e39bafdb8152f35b3461037e57604036600319011261037e5760006020611cda6105b2565b611ce2612bdb565b60405163a9059cbb60e01b8152336004820152602480359082015292839160449183916001600160a01b03165af18015610c3957611d1c57005b6108fe9060203d8111610c3257610c228183610fe4565b3461037e57600036600319011261037e576008546040516001600160a01b039091168152602090f35b3461037e57602036600319011261037e57611d756105b2565b6008546001600160a01b03908116903382141580611dc3575b611d9b576108fe83612c2d565b60649250600a54166040519163061db9c160e01b835233600484015260248301526044820152fd5b5080600a5416331415611d8e565b3461037e57606036600319011261037e57611dea6105b2565b602435604435611df8612d72565b611e0c826000526010602052604060002090565b90600382019182548211611f2e57600e015460ff16611f1c57611e2f8185614b65565b600093845b828110611e8757505081611e6d611e81927fa2f234689387b39c2cbd3e4e4f0dfa6d60e6e6881d8b131cf432bf2dd5c90ce19454613abd565b809155604051918291829190602083019252565b0390a280f35b80600080516020614cd983398151915286611eaa611f1794610b87888c54613abd565b81611ebf826000526012602052604060002090565b55611ed881610bba846000526011602052604060002090565b60408051918252602082019290925260009181018290526060810182905260808101919091526001600160a01b03851660a08201528060c08101610bf0565b611e34565b604051633f44049d60e01b8152600490fd5b60405163bbb7402f60e01b8152600490fd5b3461037e57604036600319011261037e57602060ff611f86611f606105c8565b600435600052600c845260406000209060018060a01b0316600052602052604060002090565b54166040519015158152f35b3461037e5760008060031936011261055b576040519080600354611fb581611952565b808552916001918083169081156105315750600114611fde576104d2856104c681870382610fe4565b9250600383527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b5b8284106120215750505081016020016104c6826104d26104b6565b80546020858701810191909152909301928101612006565b3461037e57600036600319011261037e57600a546040516001600160a01b039091168152602090f35b3461037e57600036600319011261037e57602060405160008152f35b8015150361037e57565b60a435906110128261207e565b3461037e57604036600319011261037e576120ae6105b2565b602435906120bb8261207e565b3360009081526007602090815260408083206001600160a01b038516845290915290209115159160ff1981541660ff841617905560405191825260018060a01b0316907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a3005b608036600319011261037e5761213a6105b2565b6121426105c8565b606435916001600160401b03831161037e573660238401121561037e576121766108fe933690602481600401359101611065565b91604435916148a6565b3461037e57600036600319011261037e576020601554604051908152f35b3461037e57604036600319011261037e5760243560043560005260136020526040600020805482101561037e57602091610d6f91610d19565b3461037e5760408060031936011261037e576004356024359063ffffffff92838316830361037e57612207612c94565b61221b826000526010602052604060002090565b9260038401546125b957600884019384546125a857600e01549360ff851661259757612259612254856000526011602052604060002090565b613d47565b805160ff612265613d96565b9761227861227284613aae565b856137f1565b516122828a612fe9565b5260081c16612423577f69164982401e47b1c2fcc2bd71e4b2d963fc5114af49b6aa279cb869b190fb22975092857f322a0b91ae344fcae9bebd57220203818fa9bf2ab891c01fdf942ec22a1cf65d6123f07f71162e49c62fe91ab6262824bb1e9cc139a795bc8383413cd432de56db8639b795600080516020614cd98339815191528461232361142b6124169961231d6116079e9d613aae565b906137f1565b61232c81614a2c565b6123e261233a600054613aae565b9183612350846000526012602052604060002090565b55612372600161236a856000526012602052604060002090565b016103e79055565b61239b600261238b856000526012602052604060002090565b01805461ff001916610100179055565b6123a58187613dc0565b8c5192835260208301939093526103e7604083015260006060830152600160808301526001600160a01b0390921660a082015290819060c0820190565b0390a1875191829182613e41565b0390a283518681526020810187905263ffffffff90911660408201529081906060820190565b0390a15192839283613cca565b5050509091925060206124dd6000956124466109e9600a5460018060a01b031690565b90600d54906124b1600e549161246561245d611005565b8c8152613d0e565b9261246e611014565b7f816bedba8a50b294e5cbd47842baf240c2385f2eaf719edbd4f250a137a8c89981528881019590955280881c61ffff168a8601521663ffffffff166060840152565b63ffffffff8616608083015260a08201528551978880948193634d8e1c2f60e11b835260048301613bd7565b03925af1908115610c39577f71162e49c62fe91ab6262824bb1e9cc139a795bc8383413cd432de56db8639b794600092612575575b5081928461252d611607946000526014602052604060002090565b5561255261254585600052600f602052604060002090565b805460ff19166001179055565b519384938491604091949363ffffffff9160608501968552602085015216910152565b61160792506125919060203d8111610c7457610c668183610fe4565b91612512565b8251633f44049d60e01b8152600490fd5b825163c8ba0a7b60e01b8152600490fd5b815163dbdb59c360e01b8152600490fd5b3461037e57602036600319011261037e576104d26125e960043561439e565b604051918291602083526020830190610440565b3461037e57604036600319011261037e576108fe60043561261c6105c8565b9080600052600c602052612637600160406000200154612dc7565b612e91565b3461037e57602036600319011261037e576020611804610cc96105b2565b3461037e57602036600319011261037e57600435612676612c94565b8060005260106020526040600020600e81019060ff8254166117cf576005015460ff166117bd57805460ff19166001179055604051600181527fb3e0a1ab7b74690c57eec0d3f968e19b6f60caec6a07628503a065a4798305c99080602081016117b8565b3461037e57604036600319011261037e57602060ff611f866126fb6105b2565b6127036105c8565b6001600160a01b0391821660009081526007865260408082209290931681526020919091522090565b60408060031936011261037e5760043560243591612748613aff565b61275c826000526010602052604060002090565b600e81015460ff1661283c5761278a612776610cce61453d565b610ce8610ce3876109c66004870154612f76565b341061282b57600301908154841161281b576127a68433614b65565b600093845b8181106127f15750916127e491610b427fa2f234689387b39c2cbd3e4e4f0dfa6d60e6e6881d8b131cf432bf2dd5c90ce1948354613abd565b0390a261084a6001600b55565b80600080516020614cd9833981519152610bf0610b8c61281694610b87878c54613abd565b6127ab565b5163bbb7402f60e01b8152600490fd5b81516317b3cb3760e31b8152600490fd5b8151633f44049d60e01b8152600490fd5b3461037e57602036600319011261037e57600480356001600160401b03811161037e5761287d9036908301611331565b9060005b82518110156108fe573361289b6109e961142b84876137f1565b0361299a5760026128b66113eb8261145961144886896137f1565b612989576128d3816128cb61144885886137f1565b015460ff1690565b61297857906128fa612973926128ec61144884886137f1565b01805460ff19166001179055565b7fef15b56ad10cecf7b64a12e2ec4c2576aa212c30f74f931937cb606fb7af48d861292582866137f1565b5161293361144884886137f1565b5490610bf06001612947611448878b6137f1565b015460405193849384608091949360019360a08301968352602083015260408201528260608201520152565b612881565b604051630576a14160e01b81528390fd5b60405163033fc78160e51b81528390fd5b5060405163ee83059d60e01b8152fd5b601654811015610d3157601660005260021b7fd833147d7dc355ba459fc788f669e58cfaf9dc25ddcd0702e87d69c7b51242890190600090565b8054821015610d315760005260206000209060021b0190600090565b3461037e57602036600319011261037e5760043560165481101561037e57612a296080916129aa565b5060018060a01b039081815416916001820154169060ff600360028301549201541691604051938452602084015260408301526060820152f35b3461037e5761014036600319011261037e5760046001600160401b03813581811161037e57612a95903690840161109c565b90612a9e612088565b60c43582811161037e57612ab5903690860161109c565b60e43583811161037e57612acc903690870161109c565b916101043584811161037e57612ae5903690880161109c565b936101243590811161037e576108fe96612b019136910161109c565b9460843590606435906044359060243590613221565b3461037e57602036600319011261037e57612b306105b2565b612b38612bdb565b6001600160a01b0316338114612b9657600980546001600160a01b03191682179055600854612b6f906001600160a01b03166109e9565b7fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae1278600080a3005b60405162461bcd60e51b815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c660000000000000000006044820152606490fd5b6008546001600160a01b03163303612bef57565b60405162461bcd60e51b815260206004820152601660248201527527b7363c9031b0b63630b1363290313c9037bbb732b960511b6044820152606490fd5b6001600160a01b03168015612c82576020817fd1a6a14209a385a964d036e404cb5cfb71f4000cdb03c9366292430787261be6926bffffffffffffffffffffffff60a01b600a541617600a55604051908152a1565b60405163d92e233d60e01b8152600490fd5b3360009081527fca4c450120a85f872b52d5a02308774861dce0f6fbb4824ab693f6a6bdef11bf602052604090205460ff1615612ccd57565b6108b36048612d5a612cde3361306f565b612d4c612ce96130ff565b6040519485937f416363657373436f6e74726f6c3a206163636f756e74200000000000000000006020860152612d2981518092602060378901910161041d565b84017001034b99036b4b9b9b4b733903937b6329607d1b60378201520190612e7a565b03601f198101835282610fe4565b60405162461bcd60e51b815291829160048301610465565b3360009081527f7596c25533a064a92e1e2ee4205607f4b1494865969267ec37b72ad860e48809602052604090205460ff1615612dab57565b6108b36048612d5a612dbc3361306f565b612d4c612ce9613190565b6000818152600c6020908152604080832033845290915290205460ff1615612dec5750565b612df53361306f565b612dfd612fce565b916030612e0984612fe9565b536078612e1584612ff6565b5360415b60018111612e38576108b36048612d5a85612d4c88612ce98815613024565b90600f8116906010821015610d3157612e75916f181899199a1a9b1b9c1cb0b131b232b360811b901a612e6b8487613006565b5360041c91613017565b612e19565b90612e8d6020928281519485920161041d565b0190565b600090808252600c60205260ff612ebd84604085209060018060a01b0316600052602052604060002090565b5416612ec857505050565b808252600c602090815260408084206001600160a01b038616600090815292529020805460ff1916905533926001600160a01b0316917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9080a4565b634e487b7160e01b600052601160045260246000fd5b906402540be40091828102928184041490151715612f5457565b612f24565b90670de0b6b3a764000091828102928184041490151715612f5457565b9064e8d4a5100091828102928184041490151715612f5457565b81810292918115918404141715612f5457565b90624f1a008201809211612f5457565b6001019081600111612f5457565b91908201809211612f5457565b60405190612fdb82610fae565b604282526060366020840137565b805115610d315760200190565b805160011015610d315760210190565b908151811015610d31570160200190565b8015612f54576000190190565b1561302b57565b606460405162461bcd60e51b815260206004820152602060248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b60405190606082018281106001600160401b0382111761079157604052602a8252604036602084013760306130a383612fe9565b5360786130af83612ff6565b536029905b600182116130c757610476915015613024565b600f8116906010821015610d31576130f9916f181899199a1a9b1b9c1cb0b131b232b360811b901a612e6b8486613006565b906130b4565b7f20296b01d0b6bd176f0c1e29644934c0047abf080dae43609a1bbc09e39bafdb613128612fce565b90603061313483612fe9565b53607861314083612ff6565b536041905b6001821161315857610476915015613024565b600f8116906010821015610d315761318a916f181899199a1a9b1b9c1cb0b131b232b360811b901a612e6b8486613006565b90613145565b7fd01d7f6f3b98c8ff4cbb99d207da8f806af0b2f8be9b5bb61dd74bf5550f329b6131b9612fce565b9060306131c583612fe9565b5360786131d183612ff6565b536041905b600182116131e957610476915015613024565b600f8116906010821015610d315761321b916f181899199a1a9b1b9c1cb0b131b232b360811b901a612e6b8486613006565b906131d6565b96939895929190979497613233612c94565b601554996132408b6132f8565b6015556132578b6000526010602052604060002090565b986132659060018b01613379565b6002890181905560038901556004880155600d87015560058601805460ff1916905580600687015561329690612fa3565b60078601556132a89060098601613379565b6132b590600a8501613379565b6132c290600b8401613379565b6132cf90600c8301613379565b600e01805460ff1916815590815461ff00191690151560081b61ff0016179055611012906134f3565b6000198114612f545760010190565b634e487b7160e01b600052600060045260246000fd5b818110613328575050565b6000815560010161331d565b9190601f811161334357505050565b611012926000526020600020906020601f840160051c8301931061336f575b601f0160051c019061331d565b9091508190613362565b91909182516001600160401b038111610791576133a08161339a8454611952565b84613334565b602080601f83116001146133dc5750819293946000926133d1575b50508160011b916000199060031b1c1916179055565b0151905038806133bb565b90601f198316956133f285600052602060002090565b926000905b88821061342f57505083600195969710613416575b505050811b019055565b015160001960f88460031b161c1916905538808061340c565b806001859682949686015181550195019301906133f7565b9c9b9994976110129b9760e08f6134cb996134da9c6134bc996101c09f9961347b6134ad9a996101e080885287019061198c565b986020860152604085015260608401526080830152600060a083015260c082015201528d61010081840391015261198c565b908b82036101208d015261198c565b908982036101408b015261198c565b9087820361016089015261198c565b94600061018082015260006101a0820152019015159052565b80600052601060205260406000206002810154600482015491600d81015491600682015491624f1a00830193848411612f54577faaef77581b53632bfed6063864a759eba927e76bcdb2a3bd0b7a1cb0e189e0f19561357c9360ff600e85015460081c1693604051978897600c830195600b840195600a8501958060016009880197018d613447565b0390a2565b9492909261358d612c94565b856000526010602052604060002094600586019260ff8454166117bd5761362161357c9461361a85600c8b8b60067f866c80811fbfd2e5bb71fab81328719eca06c4074dd9638080e605b00a4b7ecf9e01556135e88c612fa3565b60078201556135fa8b60098301613379565b61360787600a8301613379565b61361488600b8301613379565b01613379565b5460ff1690565b9461362b87612fa3565b6040519788978895926136819461366591613673946104769a989415158a5260208a0152604089015260e0606089015260e0880190610440565b908682036080880152610440565b9084820360a0860152610440565b9160c0818403910152610440565b91909161369a612c94565b6136ae816000526010602052604060002090565b916136bd600584015460ff1690565b6117bd57600091825b85518410156136f7576136eb6136f19160606136e2878a6137f1565b51015190612fc1565b936132f8565b926136c6565b9092509290926002820154036137df57613718613712613805565b82613962565b817f6583207d0c10464b1d228b352b0d6d790d77f4fae61e406c9b06bf6d8683edaa600080a260005b84518110156137d8578061376261375b6137d393886137f1565b5184613a29565b837f1db8c8af38ca030c75e0e2730c893856ee0d70f5001b47c6f836363c035a38a161378d83612fb3565b6020613799858b6137f1565b510151906137cb60408b60606137bd89846137b482866137f1565b510151936137f1565b510151915194859485613a56565b0390a26132f8565b613741565b5050509050565b604051633eb1097f60e11b8152600490fd5b8051821015610d315760209160051b010190565b60405161381181610fc9565b6000815290565b6138228154611952565b908161382c575050565b81601f6000931160011461383e575055565b90808391825261385d601f60208420940160051c84016001850161331d565b5555565b9080518255600190818301602080830151938451916001600160401b03831161079157613898836138928654611952565b86613334565b80601f84116001146138ed57509180809260609695946003986000946138e2575b50501b9160001990871b1c19161790555b6138db604082015160028601613379565b0151910155565b0151925038806138b9565b91939495601f19841661390587600052602060002090565b936000905b82821061394b5750509160039795939185606098969410613933575b505050811b0190556138ca565b015160001983891b60f8161c19169055388080613926565b80888697829497870151815501960194019061390a565b815191600160401b83116107915781548383558084106139c1575b50613992602080920192600052602060002090565b6000925b8484106139a4575050505050565b600483826139b56001945186613861565b01920193019290613996565b6001600160fe1b038181168203612f545784168403612f545760008381526020812091600290811b83019286821b015b838110613a005750505061397d565b808360049255613a1260018201613818565b613a1d838201613818565b836003820155016139f1565b8054600160401b81101561079157613a46916001820181556129e4565b91909161078c5761101291613861565b949392613a76606093613a84938852608060208901526080880190610440565b908682036040880152610440565b930152565b634e487b7160e01b600052601260045260246000fd5b8115613aa9570490565b613a89565b600019810191908211612f5457565b91908203918211612f5457565b8054600160401b81101561079157613ae791600182018155610d19565b819291549060031b91821b91600019901b1916179055565b6002600b5414613b10576002600b55565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b90604051613b6281610fae565b82546001600160a01b03908116825260018401541660208201526002830154604082015260039092015460ff166060830152565b60ff16604d8111612f5457600a0a90565b9081602091031261037e575190565b6040513d6000823e3d90fd5b9081602091031261037e57516104768161207e565b60e060a06104769360208452805160208501526020810151604085015261ffff604082015116606085015263ffffffff8060608301511660808601526080820151168285015201519160c0808201520190610440565b80546000825580613c3c575050565b6110129160005260206000209081019061331d565b8151916001600160401b03831161079157600160401b8311610791578154838355808410613cac575b50602080910191600052806000209060005b848110613c9a575050505050565b83518382015592810192600101613c8c565b613cc49083600052846020600020918201910161331d565b38613c7a565b9060609160408101918152602092816040858094015285518094520193019160005b828110613cfa575050505090565b835185529381019392810192600101613cec565b6040519063125fa26760e31b6020830152511515602482015260248152606081018181106001600160401b038211176107915760405290565b9060405191828154918282526020928383019160005283600020936000905b828210613d7c5750505061101292500383610fe4565b855484526001958601958895509381019390910190613d66565b60405190604082018281106001600160401b03821117610791576040526001825260203681840137565b8054600160401b81101561079157613ddd91600182018155610d19565b819291549060031b9160018060a01b03809116831b921b1916179055565b90815480825260208092019260005281600020916000905b828210613e21575050505090565b83546001600160a01b031685529384019360019384019390910190613e13565b906020610476928181520190613dfb565b81835290916001600160fb1b03831161037e5760209260051b809284830137010190565b6104769492606092825260208201528160408201520191613e52565b9190811015610d315760051b0190565b8115613aa9570690565b91929092613ec7612254846000526013602052604060002090565b613ee7613ed661144883612fe9565b546000526010602052604060002090565b90613ef461144882612fe9565b54937fe4e81d95bce696dbb0bdb2f89a5ec0eb634a4aada070ced6e92440c36ff35d0087604096613f2b8789519384938c85613e76565b0390a160009283908054905b8183106141205750505060005b82518110156140fd57613f5781846137f1565b519388613f8682613f80858a613f7a613ed68c6000526012602052604060002090565b95613e92565b35613ea2565b90600081545b8082106140b3575b505091613fd0613fc97fef15b56ad10cecf7b64a12e2ec4c2576aa212c30f74f931937cb606fb7af48d8936140ae96956129e4565b5091613aae565b966003820191613fe08354613aae565b835580546001613ffa846000526012602052604060002090565b0155614015600261238b846000526012602052604060002090565b7f33d188820018c7a1c3e4b1342648779a271a173948750992f3d897a58ea7446761406961404d846000526012602052604060002090565b54925494548d5186815260208101919091529081906040820190565b0390a2610bf0614083826000526012602052604060002090565b548b5192835260208301526040820192909252600060608201526001608082015290819060a0820190565b613f44565b90926140bf84846129e4565b5060038091015482106140ed576140e7916136eb916140de87876129e4565b50015490613abd565b90613f8c565b50613fd09150613fc99050613f94565b5095505050505061411b611012916000526013602052604060002090565b613c2d565b90919461413f61414591600361413689866129e4565b50015490612fc1565b956132f8565b9190613f37565b604090610476949281528160208201520191613e52565b9091614179826000526014602052604060002090565b549261418f846000526010602052604060002090565b936141a7612254826000526011602052604060002090565b805160009660080191875b8887821061424057505050509161423d9493917f322a0b91ae344fcae9bebd57220203818fa9bf2ab891c01fdf942ec22a1cf65d6142177f69164982401e47b1c2fcc2bd71e4b2d963fc5114af49b6aa279cb869b190fb229560405191829182613e41565b0390a261422a604051928392868461414c565b0390a16000526014602052604060002090565b55565b90600080516020614cd98339815191528661431793610bf061428861427861142b6142728f8f8a8e92613f8092613e92565b8a6137f1565b9261428284614a2c565b54613aae565b918361429e846000526012602052604060002090565b556142b8600161236a856000526012602052604060002090565b6142d1600261238b856000526012602052604060002090565b6142db818b613dc0565b60405193849384919260a091949360c0840195845260208401526103e760408401526000606084015260016080840152600180831b0316910152565b6141b2565b60009291815461432b81611952565b9260019180831690811561438357506001146143475750505050565b90919293945060005260209081600020906000915b85831061437257505050500190388080806119b9565b80548584015291830191810161435c565b60ff19168452505050811515909102019150388080806119b9565b6143aa6113eb826146b6565b614488576143c5613ed6826000526012602052604060002090565b906143df60026128cb836000526012602052604060002090565b156144275761442191612d4c61440e6001614407610476956000526012602052604060002090565b0154614c99565b604051948593600960208601910161431c565b90612e7a565b6144406002611459836000526012602052604060002090565b1561447b5761442191612d4c6144686001614407610476956000526012602052604060002090565b604051948593600b60208601910161431c565b50600a6104769101611a22565b60405163677510db60e11b8152600490fd5b9491936144cc6144e89461047698966144da9460018a5260208a0152604089015260e0606089015260e088019061198c565b90868203608088015261198c565b9084820360a086015261198c565b9160c081840391015261198c565b3d15614521573d906145078261104a565b916145156040519384610fe4565b82523d6000602084013e565b606090565b519069ffffffffffffffffffff8216820361037e57565b604051633fabe5a360e21b815260a081600481721382149eba3441043c1c66972b4772963f5d435afa908115610c3957600091614578575090565b9060a0823d82116145b9575b8161459160a09383610fe4565b8101031261055b57506145a381614526565b506145b5608060208301519201614526565b5090565b3d9150614584565b604051633fabe5a360e21b81529060a090829060049082906001600160a01b03165afa908115610c3957600091614578575090565b6001600160a01b0316801561461f5760005260056020526001600160401b036040600020541690565b6040516323d3ad8160e21b8152600490fd5b6001600160a01b039061464390614647565b1690565b8060009081548110614666575b604051636f96cda160e11b8152600490fd5b81526004906020918083526040928383205494600160e01b86161561468d57505050614654565b93929190935b85156146a157505050505090565b60001901808352818552838320549550614693565b600054811090816146c5575090565b90506000526004602052600160e01b604060002054161590565b906146e983614647565b6001600160a01b03838116928282168490036148955760008681526006602052604090208054909261472a6001600160a01b03881633908114908414171590565b614841575b821695861561482f576147829361476092614825575b506001600160a01b0316600090815260056020526040902090565b80546000190190556001600160a01b0316600090815260056020526040902090565b80546001019055600160e11b804260a01b8517176147aa866000526004602052604060002090565b558116156147db575b507fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4565b600184016147f3816000526004602052604060002090565b5415614800575b506147b3565b60005481146147fa5761481d906000526004602052604060002090565b5538806147fa565b6000905538614745565b604051633a954ecd60e21b8152600490fd5b61487e6113eb61361a336148678b60018060a01b03166000526007602052604060002090565b9060018060a01b0316600052602052604060002090565b1561472f57604051632ce44b5f60e11b8152600490fd5b60405162a1148160e81b8152600490fd5b9291906148b48282866146df565b803b6148c05750505050565b6148c993614a03565b156148d757388080806119b9565b6040516368d2bf6b60e11b8152600490fd5b9081602091031261037e57516104768161036c565b610476939260809260018060a01b031682526000602083015260408201528160608201520190610440565b6001600160a01b03918216815291166020820152604081019190915260806060820181905261047692910190610440565b61498360209160009394604051948580948193630a85bd0160e11b998a845233600485016148fe565b03926001600160a01b03165af1600091816149d3575b506149c5576149a66144f6565b805190816149c0576040516368d2bf6b60e11b8152600490fd5b602001fd5b6001600160e01b0319161490565b6149f591925060203d81116149fc575b6149ed8183610fe4565b8101906148e9565b9038614999565b503d6149e3565b92602091614983936000604051809681958294630a85bd0160e11b9a8b85523360048601614929565b604090815191614a3b83610fc9565b600080845280546001600160a01b038416825260056020526040822091949180546801000000000000000101905560008181526004602052604090206001600160a01b03851694904260a01b8617600160e11b179055600191828101957fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef82828a838180a484885b898103614b565750505015614b4657858755813b614ae5575b50505050505050565b9180805b614b06575b50505050505081540361055b57808080808080614adc565b15614b39575b86614b1e6113eb86848701968661495a565b614b285781614ae9565b85516368d2bf6b60e11b8152600490fd5b858310614b0c5780614aee565b8451622e076360e81b8152600490fd5b80848c858180a4018590614ac3565b60408051614b7281610fc9565b6000938482528454938115614c88576001600160a01b038116600090815260056020526040902080546801000000000000000184020190556000858152600460205260409020600192906001600160a01b038316904260a01b85841460e11b17821790558187019684807fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9280858d868180a4015b898103614c795750505015614b4657858755813b614c285750505050505050565b85039180805b614c4a5750505050505081540361055b57808080808080614adc565b15614c6c575b86614c626113eb86848701968661495a565b614b285781614c2e565b858310614c505780614aee565b80848c858180a4018590614c07565b835163b562e8dd60e01b8152600490fd5b9060405160a08101604052608081019260008452925b6000190192600a906030828206018553049283614caf57809350608091030191601f190191825256fe3aeb3f0a27eb3972142a5b5ef092cb3fb09577bf28719813314e8be2e5f3c9fba264697066735822122039b4db11733f0eb1d4c2bd61677f42b9d1a2dced2570a11f98388b2298fc091064736f6c63430008140033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
3318d331ebc786c94a827536b8b53ee9776a169bd92fec24f35028dbbc5de3dc
-----Decoded View---------------
Arg [0] : subscriptionId (uint256): 23111817221648295517350048475443130003226863946435352437437488584724450239452
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 3318d331ebc786c94a827536b8b53ee9776a169bd92fec24f35028dbbc5de3dc
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.