ERC-721
Overview
Max Total Supply
500 SUBURBS
Holders
179
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Balance
8 SUBURBSLoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
CryptoCitiesSuburbs
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 825 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT /* ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓▓▓▓▓▓▓▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒███▓▓▓▓▓███▓░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒██▓░░░░░▒██▓░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒██▓░░░░░▒██▓░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒██▓░░░░░▒██▓░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒██▓░░░░░▒███████████▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒██▓░░░░░▒██▓░░░░░▒██▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒██▓░░░░░▒██▓░░░░░▒██▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒██▓░░░░░▒██▓░░░░░▒██▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒██▓░░░░░▒██▓░░░░░▒██▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒██▓░░░░░▒██▓░░░░░▒██▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒██▓░░░░░▒██▓░░░░░▒██▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░▒██████████████████████████▒░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ */ pragma solidity ^0.8.17; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "operator-filter-registry-1.3.1/src/DefaultOperatorFilterer.sol"; import "./lib/auctions/DutchAuctionHouse.sol"; import "./lib/auctions/EnglishAuctionHouse.sol"; import "./lib/MerkleFourParams.sol"; import "./lib/IWCNFTErrorCodes.sol"; import "./lib/WCNFTToken.sol"; contract CryptoCitiesSuburbs is IWCNFTErrorCodes, ReentrancyGuard, DefaultOperatorFilterer, DutchAuctionHouse, EnglishAuctionHouse, MerkleFourParams, Ownable, WCNFTToken, ERC721 { // Structs struct City { uint256 id; uint256 numberOfSuburbs; uint256 minTokenId; uint256 maxTokenId; // inclusive string name; // e.g. Neo Tokyo string baseURIExtended; mapping(uint256 => Suburb) suburbs; // first Suburb has id 1 } struct Suburb { uint256 id; // 1, 2, 3... etc. local to each City, starts at 1 uint256 cityId; // parent City uint256 dutchAuctionId; // identifier of current DutchAuction, see DutchAuctionHouse.sol uint256 englishAuctionId; // identifier of current EnglishAuction, see EnglishAuctionHouse.sol uint256 firstTokenId; uint256 maxSupply; uint256 currentSupply; uint256 pricePerToken; uint256 allowListPricePerToken; bool allowListActive; bool saleActive; } // State vars uint256 public numberOfCities; uint256 public totalSupply; // cumulative over all cities and suburbs uint256 public maxDutchAuctionMints = 1; string private _baseURIOverride; // override per-City baseURIs address public immutable shareholderAddress; // map the Cities mapping(uint256 => City) public cities; // first City has id 1 /************************************************************************** * CUSTOM ERRORS */ /// unable to find the City for this token error CityNotFound(); /// cities and suburbs cannot be removed if they are not empty error CityOrSuburbNotEmpty(); /// action would exceed token or mint allowance error ExceedsMaximumTokensDuringDutchAuction(); /// action would exceed the maximum token supply of this Suburb error ExceedsSuburbMaximumSupply(); /// an invalid cityId has been requested error InvalidCityId(); /// cannot initialize a Suburb with zero supply error InvalidInputZeroSupply(); /// an invalid Suburb has been requested error InvalidSuburbId(); /// an invalid tokenId has been requested. Often it is out of bounds error InvalidTokenId(); /// only the most recent City can be modified error NotTheMostRecentCity(); /// only the most recent Suburb can be modified error NotTheMostRecentSuburb(); /// cannot add new City if previous has no suburbs. addSuburb or removeCity error PreviousCityHasNoSuburbs(); /// Refund unsuccessful error RefundFailed(); /// cannot complete request when a sale or allowlist is active error SaleIsActive(); /************************************************************************** * EVENTS */ /** * @dev emitted when a Dutch auction is created and assigned to a Suburb * @param cityId the City hosting the Dutch auction * @param suburbId the Suburb hosting the Dutch auction * @param dutchAuctionId auction ID, see {DutchAuctionHouse} */ event DutchAuctionCreatedInSuburb( uint256 indexed cityId, uint256 indexed suburbId, uint256 dutchAuctionId ); /** * @dev emitted when an English Auction is created and assigned to a Suburb * @param cityId the City hosting the Dutch auction * @param suburbId the Suburb hosting the Dutch auction * @param englishAuctionId auction ID, see EnglishAuctionHouse.sol */ event EnglishAuctionCreatedInSuburb( uint256 indexed cityId, uint256 indexed suburbId, uint256 englishAuctionId ); /************************************************************************** * CONSTRUCTOR */ /** * @dev CryptoSuburbs tokens represent lots belonging to SUBURBS of CITIES * @param shareholderAddress_ Recipient address for contract funds. */ constructor(address payable shareholderAddress_) ERC721("Suburbs", "SUBURBS") WCNFTToken() { if (shareholderAddress_ == address(0)) revert ZeroAddressProvided(); shareholderAddress = shareholderAddress_; } /************************************************************************** * GUARD FUNCTIONS */ /** * @dev reverts if the cityId or suburbId is invalid / does not exist * @param cityId city ID to query * @param suburbId suburb ID to query */ function _revertIfCityIdOrSuburbIdInvalid(uint256 cityId, uint256 suburbId) internal view { if (cityId == 0 || cityId > numberOfCities) revert InvalidCityId(); if (suburbId == 0 || suburbId > cities[cityId].numberOfSuburbs) { revert InvalidSuburbId(); } } /** * @dev reverts if the public sale or allow list is active in Suburb s * @param s Suburb to query */ function _revertIfAnySaleActive(Suburb storage s) internal view { if (s.saleActive) revert SaleIsActive(); if (s.allowListActive) revert AllowListIsActive(); } /** * @dev reverts if a Dutch auction or English Auction is active in Suburb s * @param s Suburb to query */ function _revertIfAnyAuctionActive(Suburb storage s) internal view { if (_checkDutchAuctionActive(s.dutchAuctionId)) { revert DutchAuctionIsActive(); } // revert if an EA is active, or is ended-but-not-settled if (_englishAuctionActiveNotSettled(s.englishAuctionId)) { revert EnglishAuctionIsNotComplete(); } } /************************************************************************** * SETUP FUNCTIONS - build cities and suburbs */ /** * @notice add a new City to the contract * @dev By adding a new City, the previous City is LOCKED and no more * suburbs can be added to it. * * New Cities are initialized without suburbs and without baseURI - these * must be added with addSuburb() and setBaseURI() * @param cityName A name for the City, e.g. "Neo Tokyo" * @return cityId id for the City - use in cities(cityId) to get City info */ function addCity(string calldata cityName) external onlyRole(SUPPORT_ROLE) returns (uint256) { // new ID number, start at 1 uint256 cityId = ++numberOfCities; if (cityId > 1 && cities[cityId - 1].numberOfSuburbs == 0) { revert PreviousCityHasNoSuburbs(); } // starting token ID for this City: refer to previous City // first token is ID 1 - consistent with cityId/suburbId uint256 startingTokenId = cities[cityId - 1].maxTokenId + 1; // make a new City struct and add it to cities City storage c = cities[cityId]; // init the City c.id = cityId; c.minTokenId = startingTokenId; c.maxTokenId = startingTokenId; // will increase when adding suburbs c.name = cityName; return cityId; } /** * @notice add a new Suburb to the current City under construction. * @dev Suburbs can only be added to the most recently added City * i.e. the City with the highest ID. * @param cityId_ the City to add a Suburb to. Must be the current City. * @param maxSupplyInSuburb the number of available tokens in this Suburb, * including all sale types. * @param pricePerToken_ price per token in wei, on the public sale. * @param allowListPricePerToken_ allowList price per token in wei. Set to * an arbitrary value if there will be no allow list sale for this Suburb. * @return newSuburbId ID for the newly created Suburb - use in * suburbs(cityId, suburbId) to get Suburb info. */ function addSuburb( uint256 cityId_, uint256 maxSupplyInSuburb, uint256 pricePerToken_, uint256 allowListPricePerToken_ ) external onlyRole(SUPPORT_ROLE) returns (uint256) { // Incrementing token IDs means suburbs can only be added to the most // recent City if (cityId_ != numberOfCities || cityId_ == 0) { revert NotTheMostRecentCity(); } if (maxSupplyInSuburb == 0) revert InvalidInputZeroSupply(); City storage c = cities[cityId_]; uint256 newSuburbId = ++c.numberOfSuburbs; // also increments storage // set the first and last token IDs in the new Suburb Suburb storage previousSub = c.suburbs[newSuburbId - 1]; uint256 firstTokenId_ = newSuburbId > 1 ? previousSub.firstTokenId + previousSub.maxSupply : c.minTokenId; // first Suburb, avoid setting first token as 0 uint256 highestTokenId = firstTokenId_ + maxSupplyInSuburb - 1; // update max token tracker in the City c.maxTokenId = highestTokenId; // init the new Suburb c.suburbs[newSuburbId] = Suburb({ id: newSuburbId, cityId: cityId_, firstTokenId: firstTokenId_, maxSupply: maxSupplyInSuburb, currentSupply: 0, pricePerToken: pricePerToken_, allowListPricePerToken: allowListPricePerToken_, dutchAuctionId: 0, englishAuctionId: 0, allowListActive: false, saleActive: false }); return newSuburbId; } /** * @dev If and only if the most recent City is EMPTY, it can be removed. * This will allow the previous City to add more Suburbs etc. * * Intended for accidentally added cities (e.g. multiple/stuck txs). * * User must confirm the cityId as a sanity check, even though it must be * the most recently constructed City. * * @param cityId the City to be removed. Must be the most recently * constructed City. */ function removeCity(uint256 cityId) external onlyRole(SUPPORT_ROLE) { // revert if not the most recent City if (cityId != numberOfCities || cityId == 0) { revert NotTheMostRecentCity(); } // revert if any suburbs have been built if (cities[cityId].numberOfSuburbs != 0) revert CityOrSuburbNotEmpty(); // clear the empty City and decrement City counter // nested suburbs mapping will not be cleared, but we know it is empty delete cities[cityId]; numberOfCities--; } /** * @dev If and only if a Suburb is EMPTY, it can be removed with this. * All sales must be closed and no tokens can have been minted from this * Suburb. * * Intended for accidentally added suburbs (e.g. multiple/stuck txs). * * User must confirm the cityId and suburbId as a sanity check, even * though they must be the most recently constructed City and Suburb. * * @param cityId the City where the Suburb is located. Must be the most * recently constructed City. * @param suburbId the Suburb ID to remove. Must be the most recently * constructed Suburb. */ function removeSuburb(uint256 cityId, uint256 suburbId) external onlyRole(SUPPORT_ROLE) { // revert if not the most recent City if (cityId != numberOfCities || cityId == 0) { revert NotTheMostRecentCity(); } City storage c = cities[cityId]; // revert if not the most recent Suburb in the City if (suburbId != c.numberOfSuburbs || suburbId == 0) { revert NotTheMostRecentSuburb(); } Suburb storage s = c.suburbs[suburbId]; // revert if any tokens have been sold if (s.currentSupply != 0) revert CityOrSuburbNotEmpty(); // revert if any sales are active _revertIfAnySaleActive(s); // revert if any auctions are active _revertIfAnyAuctionActive(s); // reset token range in City if (suburbId > 1) { c.maxTokenId -= s.maxSupply; } else { c.maxTokenId = c.minTokenId; // as if City was newly initialized } // clear the Suburb and decrement counter delete c.suburbs[suburbId]; c.numberOfSuburbs--; } /************************************************************************** * CITY ACCESS - get information about a City/Suburb */ /** * @notice return the cityId a token belongs to. Does not check if token * exists. * @param tokenId the token to search for * @return cityId the City containing tokenId */ function getCityId(uint256 tokenId) public view returns (uint256) { if (tokenId == 0) revert InvalidTokenId(); for (uint256 cityId = 1; cityId <= numberOfCities; ) { if (cities[cityId].maxTokenId >= tokenId) { return cityId; } unchecked { ++cityId; } } // should only revert if tokenId is out of range revert CityNotFound(); } /** * @notice get structured data for a Suburb. * Refer to Suburb struct layout for field ordering in returned tuple. * @param cityId the City containing suburbId * @param suburbId the suburbId within cityId * @return Suburb structured data for the Suburb */ function suburbs(uint256 cityId, uint256 suburbId) public view returns (Suburb memory) { return cities[cityId].suburbs[suburbId]; } /************************************************************************** * CITY ADMIN */ /** * @dev set the merkle root to govern all allow lists. Reset this for each new allow list sale. * @param merkleRoot_ the new merkle root */ function setAllowList(bytes32 merkleRoot_) external onlyRole(SUPPORT_ROLE) { _setAllowList(merkleRoot_); } /** * @dev start and stop the allow list sale for a Suburb. * Can be active at the same time as a public sale. * Cannot be active at the same time as an English or Dutch auction. * @param cityId the parent City of the Suburb with the allowlist * @param suburbId the Suburb hosting the allow list * @param allowListState "true" starts the sale, "false" stops the sale */ function setAllowListActive( uint256 cityId, uint256 suburbId, bool allowListState ) external onlyRole(SUPPORT_ROLE) { _revertIfCityIdOrSuburbIdInvalid(cityId, suburbId); Suburb storage s = cities[cityId].suburbs[suburbId]; _revertIfAnyAuctionActive(s); s.allowListActive = allowListState; } /** * @notice sets the base uri for a City * @dev this baseURI applies to all suburbs in a City * @param cityId identifier for the City * @param baseURI_ the base uri for the City */ function setBaseURI(uint256 cityId, string memory baseURI_) external onlyRole(SUPPORT_ROLE) { if (cityId == 0 || cityId > numberOfCities) revert InvalidCityId(); cities[cityId].baseURIExtended = baseURI_; } /** * @notice sets the base uri for ALL tokens, overriding City baseURIs. * @dev set this to override all the existing City-level baseURIs. The URI * set here must include all tokens in the collection. * To revert back to City-level baseURIs, set this to an empty string ("") * @param baseURI_ the base uri for the whole collection */ function setBaseURIOverride(string memory baseURI_) external onlyRole(SUPPORT_ROLE) { _baseURIOverride = baseURI_; } /** * @dev start and stop the public sale for a Suburb. * Can be active at the same time as an allow list sale. * Cannot be active at the same time as an English or Dutch auction. * @param cityId the parent City of the Suburb hosting the sale * @param suburbId the Suburb hosting the sale * @param saleState "true" starts the sale, "false" stops the sale */ function setSaleActive( uint256 cityId, uint256 suburbId, bool saleState ) external onlyRole(SUPPORT_ROLE) { _revertIfCityIdOrSuburbIdInvalid(cityId, suburbId); Suburb storage s = cities[cityId].suburbs[suburbId]; _revertIfAnyAuctionActive(s); s.saleActive = saleState; } /************************************************************************** * DUTCH AUCTIONS - create and manage Dutch auctions */ /** * @dev set up a Dutch auction for a Suburb. * This does not start the auction. * This will replace any existing auction details for this Suburb. * This cannot be called while a Dutch auction is active. * * The auction duration is computed from the start price, final price, * price step and time step. Before starting the auction, check the * duration is correct by calling * getDutchAuctionInfo(dutchAuctionId) * * @param cityId the parent City of the Suburb hosting the Dutch Auction * @param suburbId the Suburb to host the Dutch auction * @param startPriceInWei start price for the auction, in wei. * @param finalPriceInWei final price in wei. Lower than startPriceInWei. * @param priceStepInWei price decreases this amount of wei each time step. * @param timeStepInSeconds time between price decrease steps, in seconds. * @return dutchAuctionId the ID number associated with this auction. */ function createNewDutchAuction( uint256 cityId, uint256 suburbId, uint88 startPriceInWei, uint88 finalPriceInWei, uint88 priceStepInWei, uint80 timeStepInSeconds ) external onlyRole(SUPPORT_ROLE) returns (uint256) { _revertIfCityIdOrSuburbIdInvalid(cityId, suburbId); Suburb storage s = cities[cityId].suburbs[suburbId]; _revertIfAnyAuctionActive(s); // create the auction, see {DutchAuctionHouse} uint256 dutchAuctionID_ = _createNewDutchAuction( startPriceInWei, finalPriceInWei, priceStepInWei, timeStepInSeconds ); // store the auction ID s.dutchAuctionId = dutchAuctionID_; emit DutchAuctionCreatedInSuburb(cityId, suburbId, dutchAuctionID_); return dutchAuctionID_; } /** * @notice start a Dutch auction * @dev starts the most recently created Dutch auction in a Suburb. * If called on an auction which has been ended, this restarts the auction, * resetting price and timers. * * Before starting the Dutch auction, check the parameters are correct by * calling getDutchAuctionInfo(dutchAuctionId) * * @param cityId parent City of the auctioning Suburb * @param suburbId the Suburb hosting the Dutch auction */ function startDutchAuction(uint256 cityId, uint256 suburbId) external onlyRole(SUPPORT_ROLE) { Suburb storage s = cities[cityId].suburbs[suburbId]; _revertIfAnySaleActive(s); _revertIfAnyAuctionActive(s); _startDutchAuction(s.dutchAuctionId); } /** * @dev resume a stopped auction without resetting price and time counters * @param cityId parent City of the auctioning Suburb * @param suburbId the Suburb hosting the Dutch auction */ function resumeDutchAuction(uint256 cityId, uint256 suburbId) external onlyRole(SUPPORT_ROLE) { Suburb storage s = cities[cityId].suburbs[suburbId]; _revertIfAnySaleActive(s); _revertIfAnyAuctionActive(s); _resumeDutchAuction(s.dutchAuctionId); } /** * @dev end a Dutch auction * @param cityId parent City of the auctioning Suburb * @param suburbId the Suburb hosting the Dutch auction */ function endDutchAuction(uint256 cityId, uint256 suburbId) external onlyRole(SUPPORT_ROLE) { uint256 auctionId = cities[cityId].suburbs[suburbId].dutchAuctionId; _endDutchAuction(auctionId); } /** * @notice get the current Dutch auction id in a Suburb. Use this in * helper functions for Dutch auctions. Returns 0 if an invalid City or * Suburb is requested. * @param cityId parent City of the auctioning Suburb * @param suburbId the Suburb to query * @return dutchAuctionId identifier for the current Dutch auction */ function getDutchAuctionId(uint256 cityId, uint256 suburbId) external view returns (uint256) { return cities[cityId].suburbs[suburbId].dutchAuctionId; } /** * @dev set the maximum number of mints per wallet per Dutch Auction * @param maxMints maximum mints per wallet per Dutch Auction */ function setMaxDutchAuctionMints(uint256 maxMints) external onlyRole(SUPPORT_ROLE) { maxDutchAuctionMints = maxMints; } /************************************************************************** * ENGLISH AUCTIONS - create and manage English auctions */ /** * @dev set up a new English Auction (ascending price auction). This does * NOT start the auction. * * Start time and duration are set when auction is started with * startEnglishAuction(). * * outbidBuffer is to prevent 1 wei increments on the winning bid, and is * the minimum buffer new bids must exceed the current highest by. * * This will overwrite any unstarted English auctions in this Suburb. * * If any English auctions have been started in this Suburb, they must * be ended and settled before creating a new one. * * @param cityId parent City of the auctioning Suburb * @param suburbId Suburb to host the English Auction * @param lotSize_ number of tokens to be sold in one bundle in this auction * @param startingBidInWei_ starting bid in wei for the auction * @param outbidBufferInWei_ new bids must exceed current highest by this * @return auctionId id for the new English Auction */ function createNewEnglishAuction( uint256 cityId, uint256 suburbId, uint256 lotSize_, uint256 startingBidInWei_, uint256 outbidBufferInWei_ ) external onlyRole(SUPPORT_ROLE) returns (uint256) { _revertIfCityIdOrSuburbIdInvalid(cityId, suburbId); if (lotSize_ == 0) revert InvalidInputZeroSupply(); Suburb storage s = cities[cityId].suburbs[suburbId]; // English Auction sale check, included in _revertIfAnyAuctionActive() // cases: // ea not started >> continue >> overwrite the old one // ea started >> revert // ea ended && !settled >> revert // ea ended && settled >> continue >> overwrite the old one _revertIfAnyAuctionActive(s); // check there is supply available in this Suburb if (s.currentSupply + lotSize_ > s.maxSupply) { revert ExceedsSuburbMaximumSupply(); } // set up the English Auction uint256 newEnglishId = _setUpEnglishAuction( lotSize_, startingBidInWei_, outbidBufferInWei_ ); s.englishAuctionId = newEnglishId; emit EnglishAuctionCreatedInSuburb(cityId, suburbId, newEnglishId); return newEnglishId; } /** * @dev start an English Auction which has already been set up. It can be * started immediately, or some time in the future. When this has been * called, no other sales can be started until this English Auction ends * or is force-stopped. * @param cityId parent City of the auctioning Suburb * @param suburbId Suburb hosting the English Auction * @param startDelayInSeconds set 0 to start immediately, or delay the start * @param durationInSeconds the number of seconds the auction will run for */ function startEnglishAuction( uint256 cityId, uint256 suburbId, uint256 startDelayInSeconds, uint256 durationInSeconds ) external onlyRole(SUPPORT_ROLE) { Suburb storage s = cities[cityId].suburbs[suburbId]; // check all sales are inactive for this Suburb, before starting _revertIfAnySaleActive(s); _revertIfAnyAuctionActive(s); // recheck there is supply available for the lot size uint256 auctionId = s.englishAuctionId; if ( s.currentSupply + _englishAuctions[auctionId].lotSize > s.maxSupply ) { revert ExceedsSuburbMaximumSupply(); } _startEnglishAuction(auctionId, startDelayInSeconds, durationInSeconds); } /** * @dev marks an English Auction as settled and mints the winner's token(s) * @param cityId parent City of the auctioning Suburb * @param suburbId the Suburb hosting the English Auction */ function settleEnglishAuction(uint256 cityId, uint256 suburbId) external { Suburb storage s = cities[cityId].suburbs[suburbId]; uint256 auctionId = s.englishAuctionId; // auction ended/settled checks done in _markSettled() _markSettled(auctionId); // mint token to the winner address winner = _englishAuctions[auctionId].highestBidder; if (winner != address(0)) { uint256 numberOfTokens_ = _englishAuctions[auctionId].lotSize; // to prevent _safeMint() reverting maliciously and sticking the // contract, we do not check onERC721Received(). Contracts bidding // in this English Auction do so at their own risk and should // ensure they can use their tokens once received, e.g. using // {IERC721-safeTransferFrom} _mintInSuburb(s, winner, numberOfTokens_); } } /** * @dev force stop an English Auction, returns ETH to highest bidder, * the token is not sold. * Cannot do this within the final 2 hours of an auction. * @param cityId parent City of the auctioning Suburb * @param suburbId the Suburb hosting the English Auction */ function forceStopEnglishAuction(uint256 cityId, uint256 suburbId) external onlyRole(SUPPORT_ROLE) nonReentrant { Suburb storage s = cities[cityId].suburbs[suburbId]; uint256 auctionId = s.englishAuctionId; _forceStopEnglishAuction(auctionId); } /** * @notice get the current englishAuctionId in a Suburb. Use this in * helper functions for English auctions. * @param cityId parent City of the auctioning Suburb * @param suburbId the Suburb to query * @return englishAuctionId identifier for the active English Auction */ function getEnglishAuctionId(uint256 cityId, uint256 suburbId) external view returns (uint256) { return cities[cityId].suburbs[suburbId].englishAuctionId; } /** * @dev edit the maximum gas sent with refunds during an English Auction. * Gas limit initialized to 2300, but modifiable in case of future need. * * Refunds are sent when: * i) a high-bidder is outbid (their bid is returned) * ii) an English Auction is force-stopped (current leader is refunded) * * If this is set too low, all refunds using _gasLimitedCall() will * fail. * @param maxGas maximum gas units for the call */ function editMaxRefundGas(uint256 maxGas) external onlyRole(SUPPORT_ROLE) { _editMaxRefundGas(maxGas); } /************************************************************************** * MINT FUNCTIONS - mint tokens using each sale type */ /** * @notice mint tokens from a City-Suburb on the public sale. * @param cityId the City ID to mint from * @param suburbId the Suburb ID within cityId to mint from: 1, 2, 3... * @param numberOfTokens number of tokens to mint */ function mint( uint256 cityId, uint256 suburbId, uint256 numberOfTokens ) external payable { Suburb storage s = cities[cityId].suburbs[suburbId]; // check saleActive if (!s.saleActive) revert PublicSaleIsNotActive(); // check sent value is correct uint256 price = s.pricePerToken; if (msg.value != price * numberOfTokens) revert WrongETHValueSent(); _safeMintInSuburb(s, msg.sender, numberOfTokens); } /** * @notice mint tokens on the Allow List * @dev using {MerkleFourParams} to manage a multiparameter merkle tree * @param cityId the parent City of the Suburb to mint in * @param suburbId the Suburb to mint in * @param numberOfTokens how many tokens to mint * @param tokenQuotaInSuburb the total quota for this address in this * Suburb, regardless of the number minted so far * @param merkleProof merkle proof for this address and Suburb combo */ function mintAllowList( uint256 cityId, uint256 suburbId, uint256 numberOfTokens, uint256 tokenQuotaInSuburb, bytes32[] calldata merkleProof ) external payable { Suburb storage s = cities[cityId].suburbs[suburbId]; if (!s.allowListActive) revert AllowListIsNotActive(); // check minted quota uint256 claimed_ = getAllowListMinted(msg.sender, cityId, suburbId); if (claimed_ + numberOfTokens > tokenQuotaInSuburb) { revert ExceedsAllowListQuota(); } // check user is on allowlist and has their tokenQuotaInSuburb if ( !onAllowList( msg.sender, tokenQuotaInSuburb, cityId, suburbId, merkleProof ) ) { revert NotOnAllowList(); } // check the eth passed is correct for this Suburb if (msg.value != numberOfTokens * s.allowListPricePerToken) { revert WrongETHValueSent(); } // update allowlist minted for user _setAllowListMinted(msg.sender, cityId, suburbId, numberOfTokens); _safeMintInSuburb(s, msg.sender, numberOfTokens); } /** * @notice Mint tokens in the Dutch auction for any tier * @param cityId parent City of the auctioning Suburb * @param suburbId the Suburb hosting the Dutch auction * @param numberOfTokens The number of tokens to mint */ function mintDutch( uint256 cityId, uint256 suburbId, uint256 numberOfTokens ) external payable nonReentrant { Suburb storage s = cities[cityId].suburbs[suburbId]; uint256 auctionId = s.dutchAuctionId; DutchAuction storage da = _dutchAuctions[auctionId]; // check auction is active - see {DutchAuctionHouse} if (!da.auctionActive) revert DutchAuctionIsNotActive(); // check current price uint256 tokenPrice = getDutchAuctionPrice(auctionId); uint256 salePrice = tokenPrice * numberOfTokens; if (msg.value < salePrice) revert WrongETHValueSent(); // limit mints during price decline, unlimited at resting price if (tokenPrice > da.finalPrice) { if ( (getDutchAuctionMints(auctionId, msg.sender) + numberOfTokens) > maxDutchAuctionMints ) { revert ExceedsMaximumTokensDuringDutchAuction(); } // if resting price is already hit, this SSTORE is not needed _incrementDutchAuctionMints(auctionId, msg.sender, numberOfTokens); } _safeMintInSuburb(s, msg.sender, numberOfTokens); // refund if price declined before tx confirmed if (msg.value > salePrice) { uint256 refund = msg.value - salePrice; (bool success, ) = payable(msg.sender).call{value: refund}(""); if (!success) revert RefundFailed(); } } /** * @notice Bid on an English Auction for a Suburb. If you are the highest * bidder already, extra bids are added to your current bid. All bids are * final and cannot be revoked. * * NOTE: if bidding from a contract ensure it can use any tokens received. * This does not check onERC721Received(). * * @dev refunds previous highest bidder when new highest bid received. * @param cityId parent City of the auctioning Suburb * @param suburbId Suburb hosting the auction */ function bidEnglish(uint256 cityId, uint256 suburbId) external payable nonReentrant { uint256 auctionId = cities[cityId].suburbs[suburbId].englishAuctionId; _bidEnglish(auctionId); } /** * @dev mint reserve tokens to any address * @param cityId the City ID to mint from * @param suburbId the Suburb ID within cityId to mint from: 1, 2, 3... * @param to recipient address * @param numberOfTokens number of tokens to mint */ function devMint( uint256 cityId, uint256 suburbId, address to, uint256 numberOfTokens ) external onlyRole(SUPPORT_ROLE) { _revertIfCityIdOrSuburbIdInvalid(cityId, suburbId); Suburb storage s = cities[cityId].suburbs[suburbId]; _revertIfAnyAuctionActive(s); _safeMintInSuburb(s, to, numberOfTokens); } /************************************************************************** * OWNER FUNCTIONS */ /** * @dev withdraws ether from the contract to the shareholder address */ function withdraw() external onlyOwner nonReentrant { uint256 bal = address(this).balance; (bool success, ) = shareholderAddress.call{value: bal}(""); if (!success) revert WithdrawFailed(); } /************************************************************************** * INTERNAL MINT FUNCTIONS */ /** * @dev internal mint helper - check and update supply, then return the * next sequential ID to mint in the Suburb. * @param s the Suburb to mint in * @param quantity number of tokens to mint * @return nextId the next sequential ID to mint in the Suburb */ function _mintChecksEffectsNextId(Suburb storage s, uint256 quantity) internal returns (uint256) { if (quantity == 0) revert ZeroQuantityRequested(); // current supply check uint256 currentSupply_ = s.currentSupply; if (currentSupply_ + quantity > s.maxSupply) { revert ExceedsSuburbMaximumSupply(); } // effects s.currentSupply = currentSupply_ + quantity; totalSupply += quantity; // return uint256 nextId = s.firstTokenId + currentSupply_; return nextId; } /** * @dev internal mint function using {ERC721-_mint} i.e. NOT checking * {ERC721-onERC721Received}. * @param s the Suburb to mint in * @param receiver mint to this address * @param quantity number of tokens to mint */ function _mintInSuburb( Suburb storage s, address receiver, uint256 quantity ) internal { uint256 nextId = _mintChecksEffectsNextId(s, quantity); for (uint256 i; i < quantity; ) { _mint(receiver, nextId + i); unchecked { ++i; } } } /** * @dev internal mint function using {ERC721-_safeMint} * @param s the Suburb to mint in * @param receiver mint to this address * @param quantity number of tokens to mint */ function _safeMintInSuburb( Suburb storage s, address receiver, uint256 quantity ) internal { uint256 nextId = _mintChecksEffectsNextId(s, quantity); for (uint256 i; i < quantity; ) { _safeMint(receiver, nextId + i); unchecked { ++i; } } } /************************************************************************** * OVERRIDE SUPERS */ /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(WCNFTToken, ERC721) returns (bool) { return super.supportsInterface(interfaceId); } /** * @dev each City has its own baseURI. * Adapted from {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) revert InvalidTokenId(); string memory baseURI = _baseURIOverride; if (bytes(baseURI).length == 0) { uint256 cityId = getCityId(tokenId); baseURI = cities[cityId].baseURIExtended; if (bytes(baseURI).length == 0) { return ""; } } return string(abi.encodePacked(baseURI, Strings.toString(tokenId))); } /*************************************************************************** * Operator Filter */ function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) { super.setApprovalForAll(operator, approved); } function approve(address operator, uint256 tokenId) public override onlyAllowedOperatorApproval(operator) { super.approve(operator, tokenId); } function transferFrom( address from, address to, uint256 tokenId ) public override onlyAllowedOperator(from) { super.transferFrom(from, to, tokenId); } function safeTransferFrom( address from, address to, uint256 tokenId ) public override onlyAllowedOperator(from) { super.safeTransferFrom(from, to, tokenId); } function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory data ) public override onlyAllowedOperator(from) { super.safeTransferFrom(from, to, tokenId, data); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import {OperatorFilterer} from "./OperatorFilterer.sol"; /** * @title DefaultOperatorFilterer * @notice Inherits from OperatorFilterer and automatically subscribes to the default OpenSea subscription. */ abstract contract DefaultOperatorFilterer is OperatorFilterer { address constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6); constructor() OperatorFilterer(DEFAULT_SUBSCRIPTION, true) {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/common/ERC2981.sol) pragma solidity ^0.8.0; import "../../interfaces/IERC2981.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information. * * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first. * * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the * fee is specified in basis points by default. * * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported. * * _Available since v4.5._ */ abstract contract ERC2981 is IERC2981, ERC165 { struct RoyaltyInfo { address receiver; uint96 royaltyFraction; } RoyaltyInfo private _defaultRoyaltyInfo; mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) { return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId); } /** * @inheritdoc IERC2981 */ function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) { RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId]; if (royalty.receiver == address(0)) { royalty = _defaultRoyaltyInfo; } uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator(); return (royalty.receiver, royaltyAmount); } /** * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an * override. */ function _feeDenominator() internal pure virtual returns (uint96) { return 10000; } /** * @dev Sets the royalty information that all ids in this contract will default to. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: invalid receiver"); _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Removes default royalty information. */ function _deleteDefaultRoyalty() internal virtual { delete _defaultRoyaltyInfo; } /** * @dev Sets the royalty information for a specific token id, overriding the global default. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setTokenRoyalty( uint256 tokenId, address receiver, uint96 feeNumerator ) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: Invalid parameters"); _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Resets royalty information for the token id back to the global default. */ function _resetTokenRoyalty(uint256 tokenId) internal virtual { delete _tokenRoyaltyInfo[tokenId]; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import {IOperatorFilterRegistry} from "./IOperatorFilterRegistry.sol"; /** * @title OperatorFilterer * @notice Abstract contract whose constructor automatically registers and optionally subscribes to or copies another * registrant's entries in the OperatorFilterRegistry. * @dev This smart contract is meant to be inherited by token contracts so they can use the following: * - `onlyAllowedOperator` modifier for `transferFrom` and `safeTransferFrom` methods. * - `onlyAllowedOperatorApproval` modifier for `approve` and `setApprovalForAll` methods. */ abstract contract OperatorFilterer { error OperatorNotAllowed(address operator); IOperatorFilterRegistry public constant OPERATOR_FILTER_REGISTRY = IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E); constructor(address subscriptionOrRegistrantToCopy, bool subscribe) { // If an inheriting token contract is deployed to a network without the registry deployed, the modifier // will not revert, but the contract will need to be registered with the registry once it is deployed in // order for the modifier to filter addresses. if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) { if (subscribe) { OPERATOR_FILTER_REGISTRY.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy); } else { if (subscriptionOrRegistrantToCopy != address(0)) { OPERATOR_FILTER_REGISTRY.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy); } else { OPERATOR_FILTER_REGISTRY.register(address(this)); } } } } modifier onlyAllowedOperator(address from) virtual { // Allow spending tokens from addresses with balance // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred // from an EOA. if (from != msg.sender) { _checkFilterOperator(msg.sender); } _; } modifier onlyAllowedOperatorApproval(address operator) virtual { _checkFilterOperator(operator); _; } function _checkFilterOperator(address operator) internal view virtual { // Check registry code length to facilitate testing in environments without a deployed registry. if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) { if (!OPERATOR_FILTER_REGISTRY.isOperatorAllowed(address(this), operator)) { revert OperatorNotAllowed(operator); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; interface IOperatorFilterRegistry { function isOperatorAllowed(address registrant, address operator) external view returns (bool); function register(address registrant) external; function registerAndSubscribe(address registrant, address subscription) external; function registerAndCopyEntries(address registrant, address registrantToCopy) external; function unregister(address addr) external; function updateOperator(address registrant, address operator, bool filtered) external; function updateOperators(address registrant, address[] calldata operators, bool filtered) external; function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external; function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external; function subscribe(address registrant, address registrantToSubscribe) external; function unsubscribe(address registrant, bool copyExistingEntries) external; function subscriptionOf(address addr) external returns (address registrant); function subscribers(address registrant) external returns (address[] memory); function subscriberAt(address registrant, uint256 index) external returns (address); function copyEntriesOf(address registrant, address registrantToCopy) external; function isOperatorFiltered(address registrant, address operator) external returns (bool); function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool); function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool); function filteredOperators(address addr) external returns (address[] memory); function filteredCodeHashes(address addr) external returns (bytes32[] memory); function filteredOperatorAt(address registrant, uint256 index) external returns (address); function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32); function isRegistered(address addr) external returns (bool); function codeHashOf(address addr) external returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Tree proofs. * * The proofs can be generated using the JavaScript library * https://github.com/miguelmota/merkletreejs[merkletreejs]. * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled. * * See `test/utils/cryptography/MerkleProof.test.js` for some examples. * * WARNING: You should avoid using leaf values that are 64 bytes long prior to * hashing, or use a hash function other than keccak256 for hashing leaves. * This is because the concatenation of a sorted pair of internal nodes in * the merkle tree could be reinterpreted as a leaf value. */ library MerkleProof { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify( bytes32[] memory proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Calldata version of {verify} * * _Available since v4.7._ */ function verifyCalldata( bytes32[] calldata proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProofCalldata(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leafs & pre-images are assumed to be sorted. * * _Available since v4.4._ */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Calldata version of {processProof} * * _Available since v4.7._ */ function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Returns true if the `leaves` can be proved to be a part of a Merkle tree defined by * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}. * * _Available since v4.7._ */ function multiProofVerify( bytes32[] memory proof, bool[] memory proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProof(proof, proofFlags, leaves) == root; } /** * @dev Calldata version of {multiProofVerify} * * _Available since v4.7._ */ function multiProofVerifyCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProofCalldata(proof, proofFlags, leaves) == root; } /** * @dev Returns the root of a tree reconstructed from `leaves` and the sibling nodes in `proof`, * consuming from one or the other at each step according to the instructions given by * `proofFlags`. * * _Available since v4.7._ */ function processMultiProof( bytes32[] memory proof, bool[] memory proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the merkle tree. uint256 leavesLen = leaves.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof"); // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { return hashes[totalHashes - 1]; } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Calldata version of {processMultiProof} * * _Available since v4.7._ */ function processMultiProofCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the merkle tree. uint256 leavesLen = leaves.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof"); // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { return hashes[totalHashes - 1]; } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) { return a < b ? _efficientHash(a, b) : _efficientHash(b, a); } function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) { /// @solidity memory-safe-assembly assembly { mstore(0x00, a) mstore(0x20, b) value := keccak256(0x00, 0x40) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (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() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: address zero is not a valid owner"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: invalid token ID"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { _requireMinted(tokenId); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not token owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { _requireMinted(tokenId); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner nor approved"); _safeTransfer(from, to, tokenId, data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { address owner = ERC721.ownerOf(tokenId); return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits an {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits an {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Reverts if the `tokenId` has not been minted yet. */ function _requireMinted(uint256 tokenId) internal view virtual { require(_exists(tokenId), "ERC721: invalid token ID"); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * 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, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import "../IWCNFTErrorCodes.sol"; contract EnglishAuctionHouse is IWCNFTErrorCodes { struct EnglishAuction { uint256 lotSize; // number of tokens to be sold uint256 highestBid; // current highest bid, in WEI uint256 outbidBuffer; // new bids must exceed highestBid by this, in WEI uint256 startTime; // unix timestamp in seconds at start of the auction uint256 endTime; // unix timestamp in seconds at the end of the auction address highestBidder; // current highest bidder bool settled; // flag to mark the auction as settled } uint256 public numberOfEnglishAuctions; uint256 private constant _MAXIMUM_START_DELAY = 1 weeks; uint256 private constant _MAXIMUM_DURATION = 1 weeks; uint256 private constant _MINIMUM_DURATION = 1 hours; uint256 private constant _MINIMUM_TIME_BUFFER = 2 hours; // cannot stop auction within 2 hours of end uint256 private _maxRefundGas = 2300; // max gas sent with refunds mapping(uint256 => EnglishAuction) internal _englishAuctions; /************************************************************************** * CUSTOM ERRORS */ /// Bid must exceed the current highest bid, plus buffer price error BidTooLow(); /// Auctions cannot be stopped within 2 hours of their end time error CannotStopAuction(); /// attempting to initialize an auction that is already initialized error EnglishAuctionAlreadyInitialized(); /// requested English auction has ended error EnglishAuctionHasEnded(); /// The requested English auction is not currently accepting bids error EnglishAuctionIsNotBiddable(); /// The requested English auction is not ended and settled error EnglishAuctionIsNotComplete(); /// The requested English auction has already been settled error EnglishAuctionIsSettled(); /** * The requested English auction has not ended. It is not * necessarily active, as the start may be delayed */ error EnglishAuctionNotEnded(); /// Duration cannot exceed _MAXIMUM_DURATION error ExceedsMaximumDuration(); /// Cannot start too far in the future error ExceedsMaximumStartDelay(); /// Duration must exceed _MINIMUM_DURATION error InsufficientDuration(); /// The requested EnglishAuction does not exist in this contract error InvalidEnglishAuctionId(); /************************************************************************** * EVENTS */ /** * @dev emitted when an English auction is created * @param auctionId identifier for the English auction * @param lotSize number of tokens sold in this auction * @param startingBid initial bid in wei */ event EnglishAuctionCreated( uint256 indexed auctionId, uint256 lotSize, uint256 startingBid ); /** * @dev emitted when an English auction is started * @param auctionId identifier for the English auction * @param auctionStartTime unix timestamp in seconds of the auction start * @param auctionEndTime unix timestamp in seconds of the auction end */ event EnglishAuctionStarted( uint256 indexed auctionId, uint256 auctionStartTime, uint256 auctionEndTime ); /** * @dev emitted when an auction is settled * @param auctionId identifier for the English auction * @param salePrice strike price for the lot * @param lotSize number of tokens sold in this auction * @param winner address of the winning bidder */ event EnglishAuctionSettled( uint256 indexed auctionId, uint256 salePrice, uint256 lotSize, address winner ); /** * @dev emitted when an auction is force-stopped * @param auctionId identifier for the English auction * @param currentHighBidder address of the current leading bidder * @param currentHighestBid value in wei of the current highest bid */ event EnglishAuctionForceStopped( uint256 indexed auctionId, address currentHighBidder, uint256 currentHighestBid ); /** * @dev emitted when a new high bid is received * @param auctionId identifier for the English auction * @param bidder address of the new high bidder * @param bid value in wei of the new bid */ event NewHighBid( uint256 indexed auctionId, address indexed bidder, uint256 bid ); /** * @dev emitted when an auto refund fails * @param auctionId identifier for the English auction * @param recipient address of the user whose refund has been lodged * @param amount amount in wei of the refund */ event RefundLodged( uint256 indexed auctionId, address indexed recipient, uint256 amount ); /************************************************************************** * GUARD FUNCTIONS - replace modifiers */ /** * @dev reverts if a given English auction is not active * @param auctionId identifier for the English auction */ function _revertIfEnglishAuctionNotValid(uint256 auctionId) internal view { if (auctionId == 0 || auctionId > numberOfEnglishAuctions) { revert InvalidEnglishAuctionId(); } } /************************************************************************** * ADMIN FUNCTIONS - start, stop, edit, etc. */ /** * @dev edit the maximum gas sent with refunds during an English Auction. * Gas limit initialized to 2300, but modifiable in case of future need. * * Refunds are sent when: * i) a high-bidder is outbid (their bid is returned) * ii) an English Auction is force-stopped (current leader is refunded) * * If this is set too low, all refunds using _gasLimitedCall() will * fail. * @param maxGas maximum gas units for the call */ function _editMaxRefundGas(uint256 maxGas) internal { _maxRefundGas = maxGas; } /** * @dev set up a new English auction (ascending price auction). This does * NOT start the auction. * * Start time and duration are set when auction is started with * _startEnglishAuction(). * * outbidBuffer is to prevent 1 wei increments on the winning bid, and is * the minimum buffer new bids must exceed the current highest by. * * @param lotSize_ number of tokens to be sold in one bundle in this auction * @param startingBidInWei starting bid for the auction * @param outbidBufferInWei bids must exceed current highest by this price * @return auctionId sequential auction identifier, starting at 1. */ function _setUpEnglishAuction( uint256 lotSize_, uint256 startingBidInWei, uint256 outbidBufferInWei ) internal returns (uint256) { // set up new auction - auctionId initializes to 1 uint256 auctionId = ++numberOfEnglishAuctions; EnglishAuction storage ea = _englishAuctions[auctionId]; ea.lotSize = lotSize_; ea.highestBid = startingBidInWei; ea.outbidBuffer = outbidBufferInWei; emit EnglishAuctionCreated(auctionId, lotSize_, startingBidInWei); return auctionId; } /** * @dev start an English auction which has been set up already. * @param auctionId the auction to start * @param startDelayInSeconds set 0 to start immediately, or delay the start * @param durationInSeconds the number of seconds the auction will run for */ function _startEnglishAuction( uint256 auctionId, uint256 startDelayInSeconds, uint256 durationInSeconds ) internal { _revertIfEnglishAuctionNotValid(auctionId); EnglishAuction storage ea = _englishAuctions[auctionId]; // check the auction has not been initialized yet if (ea.startTime != 0 && ea.endTime != 0) { revert EnglishAuctionAlreadyInitialized(); } if (startDelayInSeconds > _MAXIMUM_START_DELAY) { revert ExceedsMaximumStartDelay(); } if (durationInSeconds < _MINIMUM_DURATION) { revert InsufficientDuration(); } if (durationInSeconds > _MAXIMUM_DURATION) { revert ExceedsMaximumDuration(); } // get the start time uint256 startTime_ = block.timestamp + startDelayInSeconds; uint256 endTime_ = startTime_ + durationInSeconds; ea.startTime = startTime_; ea.endTime = endTime_; emit EnglishAuctionStarted(auctionId, startTime_, endTime_); } /** * @dev force stop an English auction, useful if incorrect parameters * were set by mistake. To protect bidders, this cannot be used within 2 * hours of an auction's end time. * @param auctionId identifier for the auction */ function _forceStopEnglishAuction(uint256 auctionId) internal { _revertIfEnglishAuctionNotValid(auctionId); EnglishAuction storage ea = _englishAuctions[auctionId]; // if the auction has started, check there is longer than 2 hours left if (ea.endTime != 0) { if (block.timestamp >= ea.endTime) { revert EnglishAuctionHasEnded(); } if (block.timestamp > (ea.endTime - _MINIMUM_TIME_BUFFER)) { revert CannotStopAuction(); } } // end the auction ea.endTime = block.timestamp; ea.settled = true; // return eth to highest bidder address currentHighBidder = ea.highestBidder; uint256 currentBid = ea.highestBid; ea.highestBid = 0; if (currentHighBidder != address(0)) { bool refundSuccess = _gasLimitedCall(currentHighBidder, currentBid); if (!refundSuccess) { // register the failed refund emit RefundLodged(auctionId, currentHighBidder, currentBid); } } emit EnglishAuctionForceStopped( auctionId, currentHighBidder, currentBid ); } /** * @dev checks an auction has ended, then marks it as settled, emitting an * event. Set this when all accounting has been completed to block multiple * claims, e.g. the winner receives their token, all refunds are sent etc. * @param auctionId identifier for the auction */ function _markSettled(uint256 auctionId) internal { _revertIfEnglishAuctionNotValid(auctionId); if (!_englishAuctionEnded(auctionId)) { revert EnglishAuctionNotEnded(); } EnglishAuction storage ea = _englishAuctions[auctionId]; if (ea.settled) revert EnglishAuctionIsSettled(); ea.settled = true; emit EnglishAuctionSettled( auctionId, ea.highestBid, ea.lotSize, ea.highestBidder ); } /************************************************************************** * ACCESS FUNCTIONS - get information */ /** * @dev get structured information about an English auction. If all entries * are zero or false, the auction with this ID may not have been created. * @param auctionId the auction id to query * @return EnglishAuction structured information about the auction, * returned as a tuple. */ function getEnglishAuctionInfo(uint256 auctionId) public view returns (EnglishAuction memory) { return _englishAuctions[auctionId]; } /** * @notice get the minimum bid to become the highest bidder on * an English auction. This does not check if auction is active or ended. * @param auctionId identifier for the auction * @return minimumBid minimum bid to become the highest bidder */ function getEnglishAuctionMinimumBid(uint256 auctionId) public view returns (uint256) { _revertIfEnglishAuctionNotValid(auctionId); EnglishAuction storage ea = _englishAuctions[auctionId]; return ea.highestBid + ea.outbidBuffer; } /** * @dev return the time remaining in an English auction. * Does not check if the auction has been initialized and will * return 0 if it does not exist. * @param auctionId the auctionId to query * @return remainingTime the time remaining in seconds */ function getRemainingEnglishAuctionTime(uint256 auctionId) public view returns (uint256) { uint256 endTime_ = _englishAuctions[auctionId].endTime; uint256 remaining = endTime_ <= block.timestamp ? 0 : endTime_ - block.timestamp; return remaining; } /************************************************************************** * OPERATION */ /** * @notice bid on an English auction. If you are the highest bidder already * extra bids are added to your current bid. All bids are final and cannot * be revoked. * * NOTE: if bidding from a contract ensure it can use any tokens received. * This does not check onERC721Received(). * * @param auctionId identifier for the auction */ function _bidEnglish(uint256 auctionId) internal { _revertIfEnglishAuctionNotValid(auctionId); if (!englishAuctionBiddable(auctionId)) { revert EnglishAuctionIsNotBiddable(); } EnglishAuction storage ea = _englishAuctions[auctionId]; uint256 currentBid = ea.highestBid; address currentHighBidder = ea.highestBidder; /* * high bidder can add to their bid, * new bidders must exceed existing high bid + buffer */ if (msg.sender == currentHighBidder) { ea.highestBid = currentBid + msg.value; emit NewHighBid(auctionId, msg.sender, currentBid + msg.value); } else { // new bidder if (msg.value < currentBid + ea.outbidBuffer) { revert BidTooLow(); } else { // we have a new highest bid ea.highestBid = msg.value; ea.highestBidder = msg.sender; emit NewHighBid(auctionId, msg.sender, msg.value); // refund the previous highest bidder. // This must not revert due to the receiver. if (currentHighBidder != address(0)) { bool refundSuccess = _gasLimitedCall( currentHighBidder, currentBid ); if (!refundSuccess) { // register the failed refund emit RefundLodged( auctionId, currentHighBidder, currentBid ); } } } } } /** * @dev send ETH, limiting gas and not reverting on failure. * @param receiver transaction recipient * @param amount value to send * @return success true if transaction is successful, false otherwise */ function _gasLimitedCall(address receiver, uint256 amount) internal returns (bool) { (bool success, ) = receiver.call{value: amount, gas: _maxRefundGas}(""); return success; } /************************************************************************** * HELPERS */ /** * @dev returns true if an auction has been 'started' but has not ended. * The auction may be pending (start time has been set in the future) or * live-and-biddable (start time has passed and the auction is biddable). * @param auctionId identifier for the auction * @return active true (active / pending) or false (ended / not initialized) */ function englishAuctionActive(uint256 auctionId) public view returns (bool) { // if ea.endTime == 0 : auction has not been started >> false // if ea.endTime <= block.timestamp : auction has ended >> false // if ea.endTime > block.timestamp : auction is pending or live >> true return (_englishAuctions[auctionId].endTime > block.timestamp); } /** * @dev returns true if an auction is currently live-and-biddable * @param auctionId identifier for the auction * @return biddable true (live-and-biddable) or false (ended / not started) */ function englishAuctionBiddable(uint256 auctionId) public view returns (bool) { EnglishAuction storage ea = _englishAuctions[auctionId]; return ( ea.startTime <= block.timestamp && block.timestamp < ea.endTime ); } /** * @dev returns true if the requested auction has been settled, * false otherwise. * @param auctionId identifier for the auction */ function englishAuctionSettled(uint256 auctionId) public view returns (bool) { return _englishAuctions[auctionId].settled; } /** * @dev returns true if an auction has ended, false if it is still active, * or not initialized. * @param auctionId identifier for the auction * @return ended true (ended / non-existent) or false (active / yet-to-begin) */ function _englishAuctionEnded(uint256 auctionId) internal view returns (bool) { EnglishAuction storage ea = _englishAuctions[auctionId]; // if ea.endTime == 0 : auction never started / does not exist >> false // else : // if ea.endTime <= block.timestamp : auction has ended >> true // if ea.endTime > block.timestamp : auction still active >> false return (ea.endTime != 0 && ea.endTime <= block.timestamp); } /** * @dev returns true if the requested auction has been started but is NOT * settled. It may have ended, or may still be biddable but it has not * been settled. Returns false if auction has not started or if it has * been ended and settled. * @param auctionId identifier for the auction */ function _englishAuctionActiveNotSettled(uint256 auctionId) internal view returns (bool) { EnglishAuction storage ea = _englishAuctions[auctionId]; // if ea.endTime == 0 : auction never started / does not exist >> false // else: (the auction has been started) // if the auction is active >> true // if the auction is ended-but-not-settled >> true // if the auction is ended-and-settled >> false // if the auction is settled, it must already have ended return (ea.endTime != 0 && ea.settled == false); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; /** * @dev Utility contract for managing multiple allow lists under by the same * 4-parameter merkle root. * * Two keys are used to nest each allow list mint count. */ contract MerkleFourParams { bytes32 public merkleRoot; // merkle root governing all allow lists /** * @dev store the allow list mints per address, per two keys * we map: (address => (key1 => (key2 => minted))) */ mapping(address => mapping(uint256 => mapping(uint256 => uint256))) private _allowListMinted; bool internal _allowListActive = false; /************************************************************************** * CUSTOM ERRORS */ /// Attempted access while allow list is active error AllowListIsActive(); /// Attempted access to inactive presale error AllowListIsNotActive(); /// Exceeds allow list quota error ExceedsAllowListQuota(); /// Merkle proof and user do not resolve to merkleRoot error NotOnAllowList(); /************************************************************************** * EVENTS */ /** * @dev emitted when an account has claimed some tokens * @param account address of the claimer * @param key1 first key to the allow list * @param key2 second key to the allow list * @param amount number of tokens claimed in this transaction */ event Claimed( address indexed account, uint256 indexed key1, uint256 indexed key2, uint256 amount ); /** * @dev emitted when the merkle root changes * @param merkleRoot new merkle root */ event MerkleRootChanged(bytes32 merkleRoot); /** * @dev reverts when allow list is not active */ modifier isAllowListActive() virtual { if (!_allowListActive) revert AllowListIsNotActive(); _; } /** * @dev throws when number of tokens exceeds total token quota, for a * given 2-key combination. * @param to user address to query * @param numberOfTokens check if this many tokens are available * @param tokenQuota the user's initial token allowance * @param key1 first key to the allow list * @param key2 second key to the allow list */ modifier tokensAvailable( address to, uint256 numberOfTokens, uint256 tokenQuota, uint256 key1, uint256 key2 ) virtual { uint256 claimed = _allowListMinted[to][key1][key2]; if (claimed + numberOfTokens > tokenQuota) { revert ExceedsAllowListQuota(); } _; } /** * @dev throws when parameters sent by claimer are incorrect * @param claimer the claimer's address * @param tokenQuota initial token allowance for claimer * @param key1 first key to the allow list * @param key2 second key to the allow list * @param proof merkle proof */ modifier ableToClaim( address claimer, uint256 tokenQuota, uint256 key1, uint256 key2, bytes32[] memory proof ) virtual { if (!onAllowList(claimer, tokenQuota, key1, key2, proof)) { revert NotOnAllowList(); } _; } /** * @dev sets the state of the allow list */ function _setAllowListActive(bool allowListActive_) internal virtual { _allowListActive = allowListActive_; } /** * @dev sets the merkle root */ function _setAllowList(bytes32 merkleRoot_) internal virtual { merkleRoot = merkleRoot_; emit MerkleRootChanged(merkleRoot); } /** * @dev gets the number of tokens minted by an address for given keys * @param from the address to query * @param key1 first key to the allow list * @param key2 second key to the allow list * @return minted the number of items minted by the address */ function getAllowListMinted( address from, uint256 key1, uint256 key2 ) public view virtual returns (uint256) { return _allowListMinted[from][key1][key2]; } /** * @dev adds the number of tokens to an address's total for given keys * @param to the address to increment mints against * @param key1 first key to the allow list * @param key2 second key to the allow list * @param numberOfTokens the number of mints to increment */ function _setAllowListMinted( address to, uint256 key1, uint256 key2, uint256 numberOfTokens ) internal virtual { _allowListMinted[to][key1][key2] += numberOfTokens; emit Claimed(to, key1, key2, numberOfTokens); } /** * @dev checks if the claimer has a valid proof * @param claimer the claimer's address * @param tokenQuota initial allow list quota for claimer * @param key1 first key to the allow list * @param key2 second key to the allow list * @return valid true if the claimer has a valid proof for these arguments */ function onAllowList( address claimer, uint256 tokenQuota, uint256 key1, uint256 key2, bytes32[] memory proof ) public view returns (bool) { bytes32 leaf = keccak256( abi.encodePacked(claimer, tokenQuota, key1, key2) ); return MerkleProof.verify(proof, merkleRoot, leaf); } }
// 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 pragma solidity ^0.8.17; import "@openzeppelin/contracts/utils/math/Math.sol"; /** * @dev Allows derived contracts to implement multiple parallel Dutch auctions, * where the auction price decreases in steps. */ contract DutchAuctionHouse { struct DutchAuction { bool auctionActive; // flag to mark the auction active or inactive uint80 startTime; // set automatically when auction started uint80 duration; // time for price to drop from startPrice to finalPrice uint88 startPrice; // price declines from here uint88 finalPrice; // price rests here after declining uint88 priceStep; // price declines in this step size uint80 timeStepSeconds; // time between price drop steps } uint256 public numberOfDutchAuctions; // track number of auctions // Map auctionId => DutchAuction mapping(uint256 => DutchAuction) internal _dutchAuctions; // Track user mints per Dutch auction: // (auctionId => (address => mints)) mapping(uint256 => mapping(address => uint256)) private _dutchAuctionMints; /************************************************************************** * CUSTOM ERRORS */ /// The price and timestep parameters result in too great a duration error ComputedDurationOverflows(); /// Attempting to resume a Dutch auction that has not started error DutchAuctionHasNotStarted(); /// Attempted access to an active Dutch auction error DutchAuctionIsActive(); /// Attempted mint on an inactive Dutch auction error DutchAuctionIsNotActive(); /// Ensure auction prices, price steps and step interval are valid error InvalidDutchAuctionParameters(); /// This auctionId has not been initialised yet error NonExistentDutchAuctionID(); /************************************************************************** * EVENTS */ /** * @dev emitted when a Dutch auction is created * @param auctionId identifier for the Dutch auction */ event DutchAuctionCreated(uint256 auctionId); /** * @dev emitted when a Dutch auction starts * @param auctionId identifier for the Dutch auction * @param auctionStartTime unix timestamp in seconds of the auction start * @param auctionDuration auction duration in seconds */ event DutchAuctionStart( uint256 indexed auctionId, uint80 auctionStartTime, uint80 auctionDuration ); /** * @dev emitted when a Dutch auction ends * @param auctionId identifier for the Dutch auction * @param auctionEndTime unix timestamp in seconds of the auction end */ event DutchAuctionEnd(uint256 indexed auctionId, uint256 auctionEndTime); /************************************************************************** * GUARD FUNCTIONS */ /** * @dev reverts when an non-existent Dutch auction is requested * @param auctionId Dutch auction ID to query */ function _revertIfDutchAuctionDoesNotExist(uint256 auctionId) internal view { if (auctionId == 0 || auctionId > numberOfDutchAuctions) { revert NonExistentDutchAuctionID(); } } /************************************************************************** * FUNCTIONS */ /** * @dev get structured information about a Dutch auction, returned as tuple * @param auctionId the Dutch auctionId to query. * @return auctionInfo information about the Dutch auction, struct returned * as a tuple. See {struct DutchAuction} for details. */ function getDutchAuctionInfo(uint256 auctionId) public view returns (DutchAuction memory) { return _dutchAuctions[auctionId]; } /** * @notice get the number of mints by a user in a Dutch auction * @param auctionId the auction to query * @param user the minter address to query */ function getDutchAuctionMints(uint256 auctionId, address user) public view returns (uint256) { return _dutchAuctionMints[auctionId][user]; } /** * @dev calculates the current Dutch auction price. If not begun, returns * the start price. * @param auctionId Dutch auction ID to query. * @return price current price in wei */ function getDutchAuctionPrice(uint256 auctionId) public view returns (uint256) { _revertIfDutchAuctionDoesNotExist(auctionId); DutchAuction storage a = _dutchAuctions[auctionId]; uint256 elapsed = _getElapsedDutchAuctionTime(auctionId); if (elapsed >= a.duration) { return a.finalPrice; } // step function uint256 steps = elapsed / a.timeStepSeconds; uint256 auctionPriceDecrease = steps * a.priceStep; return a.startPrice - auctionPriceDecrease; } /** * @dev returns the remaining time until a Dutch auction's resting price is * hit. If the sale has not started yet, the auction duration is returned. * * Returning "0" shows the price has reached its final value - the auction * may still be biddable. * * Use _endDutchAuction() to stop the auction and prevent further bids. * * @param auctionId Dutch auction ID to query * @return remainingTime seconds until resting price is reached */ function getRemainingDutchAuctionTime(uint256 auctionId) public view returns (uint256) { _revertIfDutchAuctionDoesNotExist(auctionId); DutchAuction storage a = _dutchAuctions[auctionId]; if (a.startTime == 0) { // not started yet return a.duration; } else if (_getElapsedDutchAuctionTime(auctionId) >= a.duration) { // already at the resting price return 0; } return (a.startTime + a.duration) - block.timestamp; } /** * @notice check if the Dutch auction with ID auctionId is active * @param auctionId Dutch auction ID to query * @return bool true if the auction is active, false if not */ function _checkDutchAuctionActive(uint256 auctionId) internal view returns (bool) { return _dutchAuctions[auctionId].auctionActive; } /** * @dev initialise a new Dutch auction and return its ID * @param startPrice_ starting price in wei * @param finalPrice_ final resting price in wei * @param priceStep_ incremental price decrease in wei * @param timeStepSeconds_ time between each price decrease in seconds * @return newAuctionId the new Dutch auction ID */ function _createNewDutchAuction( uint88 startPrice_, uint88 finalPrice_, uint88 priceStep_, uint80 timeStepSeconds_ ) internal returns (uint256) { if ( startPrice_ < finalPrice_ || (startPrice_ - finalPrice_) < priceStep_ ) { revert InvalidDutchAuctionParameters(); } uint256 newAuctionID = ++numberOfDutchAuctions; // start with ID 1 // create and map a new DutchAuction DutchAuction storage newAuction = _dutchAuctions[newAuctionID]; newAuction.startPrice = startPrice_; newAuction.finalPrice = finalPrice_; newAuction.priceStep = priceStep_; newAuction.timeStepSeconds = timeStepSeconds_; uint256 duration = Math.ceilDiv( (startPrice_ - finalPrice_), priceStep_ ) * timeStepSeconds_; if (duration == 0) revert InvalidDutchAuctionParameters(); if (duration > type(uint80).max) revert ComputedDurationOverflows(); newAuction.duration = uint80(duration); emit DutchAuctionCreated(newAuctionID); return newAuctionID; } /** * @dev starts a Dutch auction and emits an event. * * If an auction has been ended with _endDutchAuction() this will reset the * auction and start it again with all of its initial arguments. * * @param auctionId ID of the Dutch auction to start */ function _startDutchAuction(uint256 auctionId) internal { _revertIfDutchAuctionDoesNotExist(auctionId); DutchAuction storage a = _dutchAuctions[auctionId]; if (a.auctionActive) revert DutchAuctionIsActive(); a.startTime = uint80(block.timestamp); a.auctionActive = true; emit DutchAuctionStart(auctionId, a.startTime, a.duration); } /** * @dev if a Dutch auction was paused using _endDutchAuction it can be * resumed with this function. No time is added to the duration so all * elapsed time during the pause is lost. * * To restart a stopped Dutch auction from the startPrice with its full * duration, use _startDutchAuction() again. * * @param auctionId ID of the Dutch auction to resume */ function _resumeDutchAuction(uint256 auctionId) internal { _revertIfDutchAuctionDoesNotExist(auctionId); DutchAuction storage a = _dutchAuctions[auctionId]; if (a.startTime == 0) revert DutchAuctionHasNotStarted(); if (a.auctionActive) revert DutchAuctionIsActive(); a.auctionActive = true; // resume the auction emit DutchAuctionStart(auctionId, a.startTime, a.duration); } /** * @dev ends a Dutch auction and emits an event * @param auctionId ID of the Dutch auction to end */ function _endDutchAuction(uint256 auctionId) internal { _revertIfDutchAuctionDoesNotExist(auctionId); if (!_dutchAuctions[auctionId].auctionActive) { revert DutchAuctionIsNotActive(); } _dutchAuctions[auctionId].auctionActive = false; emit DutchAuctionEnd(auctionId, block.timestamp); } /** * @dev returns the elapsed time since the start of a Dutch auction. * Does NOT check if the auction exists. * Returns 0 if the auction has not started or does not exist. * @param auctionId Dutch auction ID to query * @return elapsedTime elapsed seconds, or 0 if auction does not exist. */ function _getElapsedDutchAuctionTime(uint256 auctionId) internal view returns (uint256) { uint256 startTime_ = _dutchAuctions[auctionId].startTime; return startTime_ > 0 ? block.timestamp - startTime_ : 0; } /** * @notice set the mints for a user on a Dutch auction * @param auctionId the auction counter to modify * @param user the minter address to set * @param quantity increment the counter by this many */ function _incrementDutchAuctionMints( uint256 auctionId, address user, uint256 quantity ) internal { _dutchAuctionMints[auctionId][user] += quantity; } }
// 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.7.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: 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; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. It 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)`. // We also know that `k`, the position of the most significant bit, is such that `msb(a) = 2**k`. // This gives `2**k < a <= 2**(k+1)` → `2**(k/2) <= sqrt(a) < 2 ** (k/2+1)`. // Using an algorithm similar to the msb conmputation, we are able to compute `result = 2**(k/2)` which is a // good first aproximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1; uint256 x = a; if (x >> 128 > 0) { x >>= 128; result <<= 64; } if (x >> 64 > 0) { x >>= 64; result <<= 32; } if (x >> 32 > 0) { x >>= 32; result <<= 16; } if (x >> 16 > 0) { x >>= 16; result <<= 8; } if (x >> 8 > 0) { x >>= 8; result <<= 4; } if (x >> 4 > 0) { x >>= 4; result <<= 2; } if (x >> 2 > 0) { result <<= 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) { uint256 result = sqrt(a); if (rounding == Rounding.Up && result * result < a) { result += 1; } return result; } }
// 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 pragma solidity ^0.8.12; /** * @dev custom error codes common to many contracts are predefined here */ interface IWCNFTErrorCodes { /// Exceeds maximum tokens per transaction error ExceedsMaximumTokensPerTransaction(); /// Exceeds maximum supply error ExceedsMaximumSupply(); /// Exceeds maximum reserve supply error ExceedsReserveSupply(); /// Attempted access to inactive public sale error PublicSaleIsNotActive(); /// Failed withdrawal from contract error WithdrawFailed(); /// The wrong ETH value has been sent with a transaction error WrongETHValueSent(); /// The zero address 0x00..000 has been provided as an argument error ZeroAddressProvided(); /// A zero quantity cannot be requested here error ZeroQuantityRequested(); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.12; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/common/ERC2981.sol"; /** * @dev include SUPPORT_ROLE access control */ contract WCNFTAccessControl is AccessControl { bytes32 public constant SUPPORT_ROLE = keccak256("SUPPORT"); } /** * @dev collect common elements for multiple contracts. * Includes SUPPORT_ROLE access control and ERC2981 on chain royalty info. */ contract WCNFTToken is WCNFTAccessControl, Ownable, ERC2981 { constructor() { // set up roles _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); _grantRole(SUPPORT_ROLE, msg.sender); } /*************************************************************************** * Royalties */ /** * @dev See {ERC2981-_setDefaultRoyalty}. */ function setDefaultRoyalty(address receiver, uint96 feeNumerator) external onlyRole(SUPPORT_ROLE) { _setDefaultRoyalty(receiver, feeNumerator); } /** * @dev See {ERC2981-_deleteDefaultRoyalty}. */ function deleteDefaultRoyalty() external onlyRole(SUPPORT_ROLE) { _deleteDefaultRoyalty(); } /** * @dev See {ERC2981-_setTokenRoyalty}. */ function setTokenRoyalty( uint256 tokenId, address receiver, uint96 feeNumerator ) external onlyRole(SUPPORT_ROLE) { _setTokenRoyalty(tokenId, receiver, feeNumerator); } /** * @dev See {ERC2981-_resetTokenRoyalty}. */ function resetTokenRoyalty(uint256 tokenId) external onlyRole(SUPPORT_ROLE) { _resetTokenRoyalty(tokenId); } /*************************************************************************** * Overrides */ /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(AccessControl, ERC2981) returns (bool) { return super.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(uint160(account), 20), " 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 (last updated v4.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_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) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @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] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. * * _Available since v4.5._ */ interface IERC2981 is IERC165 { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be paid in that same unit of exchange. */ function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount); }
{ "optimizer": { "enabled": true, "runs": 825 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address payable","name":"shareholderAddress_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AllowListIsActive","type":"error"},{"inputs":[],"name":"AllowListIsNotActive","type":"error"},{"inputs":[],"name":"BidTooLow","type":"error"},{"inputs":[],"name":"CannotStopAuction","type":"error"},{"inputs":[],"name":"CityNotFound","type":"error"},{"inputs":[],"name":"CityOrSuburbNotEmpty","type":"error"},{"inputs":[],"name":"ComputedDurationOverflows","type":"error"},{"inputs":[],"name":"DutchAuctionHasNotStarted","type":"error"},{"inputs":[],"name":"DutchAuctionIsActive","type":"error"},{"inputs":[],"name":"DutchAuctionIsNotActive","type":"error"},{"inputs":[],"name":"EnglishAuctionAlreadyInitialized","type":"error"},{"inputs":[],"name":"EnglishAuctionHasEnded","type":"error"},{"inputs":[],"name":"EnglishAuctionIsNotBiddable","type":"error"},{"inputs":[],"name":"EnglishAuctionIsNotComplete","type":"error"},{"inputs":[],"name":"EnglishAuctionIsSettled","type":"error"},{"inputs":[],"name":"EnglishAuctionNotEnded","type":"error"},{"inputs":[],"name":"ExceedsAllowListQuota","type":"error"},{"inputs":[],"name":"ExceedsMaximumDuration","type":"error"},{"inputs":[],"name":"ExceedsMaximumStartDelay","type":"error"},{"inputs":[],"name":"ExceedsMaximumSupply","type":"error"},{"inputs":[],"name":"ExceedsMaximumTokensDuringDutchAuction","type":"error"},{"inputs":[],"name":"ExceedsMaximumTokensPerTransaction","type":"error"},{"inputs":[],"name":"ExceedsReserveSupply","type":"error"},{"inputs":[],"name":"ExceedsSuburbMaximumSupply","type":"error"},{"inputs":[],"name":"InsufficientDuration","type":"error"},{"inputs":[],"name":"InvalidCityId","type":"error"},{"inputs":[],"name":"InvalidDutchAuctionParameters","type":"error"},{"inputs":[],"name":"InvalidEnglishAuctionId","type":"error"},{"inputs":[],"name":"InvalidInputZeroSupply","type":"error"},{"inputs":[],"name":"InvalidSuburbId","type":"error"},{"inputs":[],"name":"InvalidTokenId","type":"error"},{"inputs":[],"name":"NonExistentDutchAuctionID","type":"error"},{"inputs":[],"name":"NotOnAllowList","type":"error"},{"inputs":[],"name":"NotTheMostRecentCity","type":"error"},{"inputs":[],"name":"NotTheMostRecentSuburb","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"OperatorNotAllowed","type":"error"},{"inputs":[],"name":"PreviousCityHasNoSuburbs","type":"error"},{"inputs":[],"name":"PublicSaleIsNotActive","type":"error"},{"inputs":[],"name":"RefundFailed","type":"error"},{"inputs":[],"name":"SaleIsActive","type":"error"},{"inputs":[],"name":"WithdrawFailed","type":"error"},{"inputs":[],"name":"WrongETHValueSent","type":"error"},{"inputs":[],"name":"ZeroAddressProvided","type":"error"},{"inputs":[],"name":"ZeroQuantityRequested","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"uint256","name":"key1","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"key2","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Claimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"auctionId","type":"uint256"}],"name":"DutchAuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"cityId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"suburbId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"dutchAuctionId","type":"uint256"}],"name":"DutchAuctionCreatedInSuburb","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"auctionId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"auctionEndTime","type":"uint256"}],"name":"DutchAuctionEnd","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"auctionId","type":"uint256"},{"indexed":false,"internalType":"uint80","name":"auctionStartTime","type":"uint80"},{"indexed":false,"internalType":"uint80","name":"auctionDuration","type":"uint80"}],"name":"DutchAuctionStart","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"auctionId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lotSize","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"startingBid","type":"uint256"}],"name":"EnglishAuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"cityId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"suburbId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"englishAuctionId","type":"uint256"}],"name":"EnglishAuctionCreatedInSuburb","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"auctionId","type":"uint256"},{"indexed":false,"internalType":"address","name":"currentHighBidder","type":"address"},{"indexed":false,"internalType":"uint256","name":"currentHighestBid","type":"uint256"}],"name":"EnglishAuctionForceStopped","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"auctionId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"salePrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lotSize","type":"uint256"},{"indexed":false,"internalType":"address","name":"winner","type":"address"}],"name":"EnglishAuctionSettled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"auctionId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"auctionStartTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"auctionEndTime","type":"uint256"}],"name":"EnglishAuctionStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"name":"MerkleRootChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"auctionId","type":"uint256"},{"indexed":true,"internalType":"address","name":"bidder","type":"address"},{"indexed":false,"internalType":"uint256","name":"bid","type":"uint256"}],"name":"NewHighBid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"auctionId","type":"uint256"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RefundLodged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_FILTER_REGISTRY","outputs":[{"internalType":"contract IOperatorFilterRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SUPPORT_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"cityName","type":"string"}],"name":"addCity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"cityId_","type":"uint256"},{"internalType":"uint256","name":"maxSupplyInSuburb","type":"uint256"},{"internalType":"uint256","name":"pricePerToken_","type":"uint256"},{"internalType":"uint256","name":"allowListPricePerToken_","type":"uint256"}],"name":"addSuburb","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"cityId","type":"uint256"},{"internalType":"uint256","name":"suburbId","type":"uint256"}],"name":"bidEnglish","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"cities","outputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"numberOfSuburbs","type":"uint256"},{"internalType":"uint256","name":"minTokenId","type":"uint256"},{"internalType":"uint256","name":"maxTokenId","type":"uint256"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"baseURIExtended","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"cityId","type":"uint256"},{"internalType":"uint256","name":"suburbId","type":"uint256"},{"internalType":"uint88","name":"startPriceInWei","type":"uint88"},{"internalType":"uint88","name":"finalPriceInWei","type":"uint88"},{"internalType":"uint88","name":"priceStepInWei","type":"uint88"},{"internalType":"uint80","name":"timeStepInSeconds","type":"uint80"}],"name":"createNewDutchAuction","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"cityId","type":"uint256"},{"internalType":"uint256","name":"suburbId","type":"uint256"},{"internalType":"uint256","name":"lotSize_","type":"uint256"},{"internalType":"uint256","name":"startingBidInWei_","type":"uint256"},{"internalType":"uint256","name":"outbidBufferInWei_","type":"uint256"}],"name":"createNewEnglishAuction","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"deleteDefaultRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"cityId","type":"uint256"},{"internalType":"uint256","name":"suburbId","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"numberOfTokens","type":"uint256"}],"name":"devMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"maxGas","type":"uint256"}],"name":"editMaxRefundGas","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"cityId","type":"uint256"},{"internalType":"uint256","name":"suburbId","type":"uint256"}],"name":"endDutchAuction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"auctionId","type":"uint256"}],"name":"englishAuctionActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"auctionId","type":"uint256"}],"name":"englishAuctionBiddable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"auctionId","type":"uint256"}],"name":"englishAuctionSettled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"cityId","type":"uint256"},{"internalType":"uint256","name":"suburbId","type":"uint256"}],"name":"forceStopEnglishAuction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"key1","type":"uint256"},{"internalType":"uint256","name":"key2","type":"uint256"}],"name":"getAllowListMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getCityId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"cityId","type":"uint256"},{"internalType":"uint256","name":"suburbId","type":"uint256"}],"name":"getDutchAuctionId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"auctionId","type":"uint256"}],"name":"getDutchAuctionInfo","outputs":[{"components":[{"internalType":"bool","name":"auctionActive","type":"bool"},{"internalType":"uint80","name":"startTime","type":"uint80"},{"internalType":"uint80","name":"duration","type":"uint80"},{"internalType":"uint88","name":"startPrice","type":"uint88"},{"internalType":"uint88","name":"finalPrice","type":"uint88"},{"internalType":"uint88","name":"priceStep","type":"uint88"},{"internalType":"uint80","name":"timeStepSeconds","type":"uint80"}],"internalType":"struct DutchAuctionHouse.DutchAuction","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"auctionId","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"getDutchAuctionMints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"auctionId","type":"uint256"}],"name":"getDutchAuctionPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"cityId","type":"uint256"},{"internalType":"uint256","name":"suburbId","type":"uint256"}],"name":"getEnglishAuctionId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"auctionId","type":"uint256"}],"name":"getEnglishAuctionInfo","outputs":[{"components":[{"internalType":"uint256","name":"lotSize","type":"uint256"},{"internalType":"uint256","name":"highestBid","type":"uint256"},{"internalType":"uint256","name":"outbidBuffer","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"address","name":"highestBidder","type":"address"},{"internalType":"bool","name":"settled","type":"bool"}],"internalType":"struct EnglishAuctionHouse.EnglishAuction","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"auctionId","type":"uint256"}],"name":"getEnglishAuctionMinimumBid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"auctionId","type":"uint256"}],"name":"getRemainingDutchAuctionTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"auctionId","type":"uint256"}],"name":"getRemainingEnglishAuctionTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxDutchAuctionMints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"merkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"cityId","type":"uint256"},{"internalType":"uint256","name":"suburbId","type":"uint256"},{"internalType":"uint256","name":"numberOfTokens","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"cityId","type":"uint256"},{"internalType":"uint256","name":"suburbId","type":"uint256"},{"internalType":"uint256","name":"numberOfTokens","type":"uint256"},{"internalType":"uint256","name":"tokenQuotaInSuburb","type":"uint256"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"}],"name":"mintAllowList","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"cityId","type":"uint256"},{"internalType":"uint256","name":"suburbId","type":"uint256"},{"internalType":"uint256","name":"numberOfTokens","type":"uint256"}],"name":"mintDutch","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numberOfCities","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numberOfDutchAuctions","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numberOfEnglishAuctions","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"claimer","type":"address"},{"internalType":"uint256","name":"tokenQuota","type":"uint256"},{"internalType":"uint256","name":"key1","type":"uint256"},{"internalType":"uint256","name":"key2","type":"uint256"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"onAllowList","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"cityId","type":"uint256"}],"name":"removeCity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"cityId","type":"uint256"},{"internalType":"uint256","name":"suburbId","type":"uint256"}],"name":"removeSuburb","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"resetTokenRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"cityId","type":"uint256"},{"internalType":"uint256","name":"suburbId","type":"uint256"}],"name":"resumeDutchAuction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"merkleRoot_","type":"bytes32"}],"name":"setAllowList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"cityId","type":"uint256"},{"internalType":"uint256","name":"suburbId","type":"uint256"},{"internalType":"bool","name":"allowListState","type":"bool"}],"name":"setAllowListActive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"cityId","type":"uint256"},{"internalType":"string","name":"baseURI_","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"baseURI_","type":"string"}],"name":"setBaseURIOverride","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"setDefaultRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"maxMints","type":"uint256"}],"name":"setMaxDutchAuctionMints","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"cityId","type":"uint256"},{"internalType":"uint256","name":"suburbId","type":"uint256"},{"internalType":"bool","name":"saleState","type":"bool"}],"name":"setSaleActive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"setTokenRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"cityId","type":"uint256"},{"internalType":"uint256","name":"suburbId","type":"uint256"}],"name":"settleEnglishAuction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"shareholderAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"cityId","type":"uint256"},{"internalType":"uint256","name":"suburbId","type":"uint256"}],"name":"startDutchAuction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"cityId","type":"uint256"},{"internalType":"uint256","name":"suburbId","type":"uint256"},{"internalType":"uint256","name":"startDelayInSeconds","type":"uint256"},{"internalType":"uint256","name":"durationInSeconds","type":"uint256"}],"name":"startEnglishAuction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"cityId","type":"uint256"},{"internalType":"uint256","name":"suburbId","type":"uint256"}],"name":"suburbs","outputs":[{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"cityId","type":"uint256"},{"internalType":"uint256","name":"dutchAuctionId","type":"uint256"},{"internalType":"uint256","name":"englishAuctionId","type":"uint256"},{"internalType":"uint256","name":"firstTokenId","type":"uint256"},{"internalType":"uint256","name":"maxSupply","type":"uint256"},{"internalType":"uint256","name":"currentSupply","type":"uint256"},{"internalType":"uint256","name":"pricePerToken","type":"uint256"},{"internalType":"uint256","name":"allowListPricePerToken","type":"uint256"},{"internalType":"bool","name":"allowListActive","type":"bool"},{"internalType":"bool","name":"saleActive","type":"bool"}],"internalType":"struct CryptoCitiesSuburbs.Suburb","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60a06040526108fc6005556009805460ff1916905560016016553480156200002657600080fd5b506040516200631f3803806200631f833981016040819052620000499162000390565b604051806040016040528060078152602001665375627572627360c81b815250604051806040016040528060078152602001665355425552425360c81b815250733cc6cdda760b79bafa08df41ecfa224f810dceb660018060008190555060006daaeb6d7670e522a718067333cd4e6001600160a01b03163b1115620001f85780156200014657604051633e9f1edf60e11b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e90637d3e3dbe906044015b600060405180830381600087803b1580156200012757600080fd5b505af11580156200013c573d6000803e3d6000fd5b50505050620001f8565b6001600160a01b03821615620001975760405163a0af290360e01b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e9063a0af2903906044016200010c565b604051632210724360e11b81523060048201526daaeb6d7670e522a718067333cd4e90634420e48690602401600060405180830381600087803b158015620001de57600080fd5b505af1158015620001f3573d6000803e3d6000fd5b505050505b506200020690503362000299565b62000213600033620002eb565b6200023f7fd8acb51ff3d48f690a25887aaf234c4ae5a66ab9839243cd8e2b639cade0663b33620002eb565b600e6200024d838262000467565b50600f6200025c828262000467565b5050506001600160a01b0381166200028757604051638474420160e01b815260040160405180910390fd5b6001600160a01b031660805262000533565b600b80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000828152600a602090815260408083206001600160a01b038516845290915290205460ff166200038c576000828152600a602090815260408083206001600160a01b03851684529091529020805460ff191660011790556200034b3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b600060208284031215620003a357600080fd5b81516001600160a01b0381168114620003bb57600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680620003ed57607f821691505b6020821081036200040e57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200046257600081815260208120601f850160051c810160208610156200043d5750805b601f850160051c820191505b818110156200045e5782815560010162000449565b5050505b505050565b81516001600160401b03811115620004835762000483620003c2565b6200049b81620004948454620003d8565b8462000414565b602080601f831160018114620004d35760008415620004ba5750858301515b600019600386901b1c1916600185901b1785556200045e565b600085815260208120601f198616915b828110156200050457888601518255948401946001909101908401620004e3565b5085821015620005235787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b608051615dc96200055660003960008181610cec0152611da50152615dc96000f3fe60806040526004361061053d5760003560e01c806370a08231116102af578063a22cb46511610179578063df1da92f116100d6578063f25562891161008a578063f53c30581161006f578063f53c305814611145578063f9af1faa14611165578063fe697bb81461118557600080fd5b8063f255628914611105578063f2fde38b1461112557600080fd5b8063e985e9c5116100bb578063e985e9c514611086578063eafb74a0146110cf578063f025b8fa146110e557600080fd5b8063df1da92f14611034578063e1a4b1b51461106657600080fd5b8063c4623c1d1161012d578063c87b56dd11610112578063c87b56dd14610fe1578063cd777ecf14611001578063d547741f1461101457600080fd5b8063c4623c1d14610fa1578063c687725e14610fc157600080fd5b8063aa1b103f1161015e578063aa1b103f14610e10578063b56d334014610e25578063b88d4fde14610f8157600080fd5b8063a22cb46514610dd0578063a9e17f8c14610df057600080fd5b806390b3ad7b1161022757806395059aa7116101db5780639b4fbc2a116101c05780639b4fbc2a14610d855780639d6cea5c14610da5578063a217fddf14610dbb57600080fd5b806395059aa714610d5057806395d89b4114610d7057600080fd5b8063943d40e71161020c578063943d40e714610cda578063947ac74d14610d0e57806394b059ab14610d2e57600080fd5b806390b3ad7b14610c5557806391d1485414610c9457600080fd5b806384584d071161027e5780638ab57f5e116102635780638ab57f5e14610bd85780638da5cb5b14610c175780638fc90cca14610c3557600080fd5b806384584d0714610b985780638a616bc014610bb857600080fd5b806370a0823114610b30578063715018a614610b505780637645726214610b655780637931070414610b7857600080fd5b80632eb4a7ab1161040b5780634f5399891161036857806365eef50f1161031c5780636a51b918116103015780636a51b91814610abe5780636c15e2e714610af05780637047845e14610b1057600080fd5b806365eef50f14610a88578063676314f214610a9e57600080fd5b80635944c7531161034d5780635944c75314610a285780636255446a14610a485780636352211e14610a6857600080fd5b80634f539989146109c55780635321290514610a0857600080fd5b80633b61bde2116103bf57806341f43434116103a457806341f434341461096357806342842e0e1461098557806346f0e23d146109a557600080fd5b80633b61bde21461092e5780633ccfd60b1461094e57600080fd5b806333cfcb9f116103f057806333cfcb9f146108ce5780633639f257146108ee57806336568abe1461090e57600080fd5b80632eb4a7ab146108985780632f2ff15d146108ae57600080fd5b8063175b86a1116104b957806323b872dd1161046d5780632492a5f5116104525780632492a5f5146107ff5780632a55205a1461081f5780632bc1e25a1461085e57600080fd5b806323b872dd146107af578063248a9ca3146107cf57600080fd5b80631a4122c31161049e5780631a4122c3146107145780631ffcb1961461073457806322ffcdf51461076157600080fd5b8063175b86a11461067d57806318160ddd146106fe57600080fd5b806306fdde0311610510578063095ea7b3116104f5578063095ea7b31461062a5780630aac14501461064a578063175b03b81461065d57600080fd5b806306fdde03146105d0578063081812fc146105f257600080fd5b806301ffc9a71461054257806302acc94b1461057757806304634d8d1461058c57806305d68dc9146105ac575b600080fd5b34801561054e57600080fd5b5061056261055d366004615092565b6111a5565b60405190151581526020015b60405180910390f35b61058a6105853660046150af565b6111b6565b005b34801561059857600080fd5b5061058a6105a7366004615113565b61123c565b3480156105b857600080fd5b506105c260145481565b60405190815260200161056e565b3480156105dc57600080fd5b506105e5611263565b60405161056e9190615196565b3480156105fe57600080fd5b5061061261060d3660046151a9565b6112f5565b6040516001600160a01b03909116815260200161056e565b34801561063657600080fd5b5061058a6106453660046151c2565b61131c565b61058a6106583660046150af565b611330565b34801561066957600080fd5b5061058a6106783660046151a9565b61151b565b34801561068957600080fd5b5061069d6106983660046151a9565b6115ed565b60405161056e9190600060e08201905082518252602083015160208301526040830151604083015260608301516060830152608083015160808301526001600160a01b0360a08401511660a083015260c0830151151560c083015292915050565b34801561070a57600080fd5b506105c260155481565b34801561072057600080fd5b5061058a61072f3660046151a9565b6116ac565b34801561074057600080fd5b5061075461074f3660046151ec565b6116d1565b60405161056e919061520e565b34801561076d57600080fd5b506105c261077c366004615294565b6001600160a01b038316600090815260086020908152604080832085845282528083208484529091529020549392505050565b3480156107bb57600080fd5b5061058a6107ca3660046152c7565b6117db565b3480156107db57600080fd5b506105c26107ea3660046151a9565b6000908152600a602052604090206001015490565b34801561080b57600080fd5b506105c261081a366004615303565b611806565b34801561082b57600080fd5b5061083f61083a3660046151ec565b611a21565b604080516001600160a01b03909316835260208301919091520161056e565b34801561086a57600080fd5b506105626108793660046151a9565b600090815260066020526040902060050154600160a01b900460ff1690565b3480156108a457600080fd5b506105c260075481565b3480156108ba57600080fd5b5061058a6108c9366004615335565b611adc565b3480156108da57600080fd5b5061058a6108e9366004615417565b611b01565b3480156108fa57600080fd5b5061058a610909366004615303565b611b60565b34801561091a57600080fd5b5061058a610929366004615335565b611c03565b34801561093a57600080fd5b506105c26109493660046151a9565b611c8b565b34801561095a57600080fd5b5061058a611d3c565b34801561096f57600080fd5b506106126daaeb6d7670e522a718067333cd4e81565b34801561099157600080fd5b5061058a6109a03660046152c7565b611e38565b3480156109b157600080fd5b5061058a6109c03660046151ec565b611e5d565b3480156109d157600080fd5b506105c26109e0366004615335565b60009182526003602090815260408084206001600160a01b0393909316845291905290205490565b348015610a1457600080fd5b5061058a610a233660046151ec565b611eb0565b348015610a3457600080fd5b5061058a610a4336600461545e565b611f1d565b348015610a5457600080fd5b5061058a610a6336600461549a565b611f40565b348015610a7457600080fd5b50610612610a833660046151a9565b611f64565b348015610a9457600080fd5b506105c260045481565b348015610aaa57600080fd5b506105c2610ab93660046151a9565b611fc9565b348015610aca57600080fd5b50610ade610ad93660046151a9565b611ff6565b60405161056e969594939291906154cf565b348015610afc57600080fd5b506105c2610b0b366004615519565b61213d565b348015610b1c57600080fd5b5061058a610b2b3660046151ec565b61223a565b348015610b3c57600080fd5b506105c2610b4b366004615554565b6123ab565b348015610b5c57600080fd5b5061058a612445565b61058a610b7336600461556f565b612459565b348015610b8457600080fd5b5061058a610b933660046151ec565b612593565b348015610ba457600080fd5b5061058a610bb33660046151a9565b612638565b348015610bc457600080fd5b5061058a610bd33660046151a9565b612659565b348015610be457600080fd5b506105c2610bf33660046151ec565b60009182526018602090815260408084209284526006909201905290206002015490565b348015610c2357600080fd5b50600b546001600160a01b0316610612565b348015610c4157600080fd5b506105c2610c50366004615621565b612683565b348015610c6157600080fd5b506105c2610c703660046151ec565b60009182526018602090815260408084209284526006909201905290206003015490565b348015610ca057600080fd5b50610562610caf366004615335565b6000918252600a602090815260408084206001600160a01b0393909316845291905290205460ff1690565b348015610ce657600080fd5b506106127f000000000000000000000000000000000000000000000000000000000000000081565b348015610d1a57600080fd5b506105c2610d293660046151a9565b61272d565b348015610d3a57600080fd5b506105c2600080516020615d7483398151915281565b348015610d5c57600080fd5b506105c2610d6b3660046151a9565b612762565b348015610d7c57600080fd5b506105e5612825565b348015610d9157600080fd5b5061058a610da03660046151a9565b612834565b348015610db157600080fd5b506105c260015481565b348015610dc757600080fd5b506105c2600081565b348015610ddc57600080fd5b5061058a610deb3660046156a5565b612852565b348015610dfc57600080fd5b5061058a610e0b3660046156dc565b612866565b348015610e1c57600080fd5b5061058a6128c5565b348015610e3157600080fd5b50610f06610e403660046151a9565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915250600090815260026020908152604091829020825160e081018452815460ff8116151582526001600160501b036101008204811694830194909452600160581b8082048516958301959095526001600160581b03600160a81b90910481166060830152600190920154808316608083015293840490911660a0820152600160b01b9092041660c082015290565b60405161056e9190600060e08201905082511515825260208301516001600160501b038082166020850152806040860151166040850152606085015191506001600160581b0380831660608601528060808701511660808601528060a08701511660a0860152508060c08601511660c0850152505092915050565b348015610f8d57600080fd5b5061058a610f9c366004615715565b6128ea565b348015610fad57600080fd5b5061058a610fbc366004615791565b612910565b348015610fcd57600080fd5b50610562610fdc3660046157ce565b612962565b348015610fed57600080fd5b506105e5610ffc3660046151a9565b6129cb565b61058a61100f3660046151ec565b612b9a565b34801561102057600080fd5b5061058a61102f366004615335565b612c24565b34801561104057600080fd5b5061056261104f3660046151a9565b600090815260066020526040902060040154421090565b34801561107257600080fd5b5061058a6110813660046156dc565b612c49565b34801561109257600080fd5b506105626110a13660046158a4565b6001600160a01b03918216600090815260136020908152604080832093909416825291909152205460ff1690565b3480156110db57600080fd5b506105c260165481565b3480156110f157600080fd5b506105c26111003660046158ce565b612caf565b34801561111157600080fd5b5061058a6111203660046151ec565b612d9c565b34801561113157600080fd5b5061058a611140366004615554565b612ddd565b34801561115157600080fd5b506105626111603660046151a9565b612e6a565b34801561117157600080fd5b506105c26111803660046151a9565b612e93565b34801561119157600080fd5b5061058a6111a03660046151ec565b612f02565b60006111b082612f55565b92915050565b600083815260186020908152604080832085845260060190915290206009810154610100900460ff166111fc5760405163e707b04f60e01b815260040160405180910390fd5b600781015461120b8382615956565b341461122a576040516352a8207f60e11b815260040160405180910390fd5b611235823385612f95565b5050505050565b600080516020615d7483398151915261125481612fc9565b61125e8383612fd3565b505050565b6060600e80546112729061596d565b80601f016020809104026020016040519081016040528092919081815260200182805461129e9061596d565b80156112eb5780601f106112c0576101008083540402835291602001916112eb565b820191906000526020600020905b8154815290600101906020018083116112ce57829003601f168201915b5050505050905090565b6000611300826130da565b506000908152601260205260409020546001600160a01b031690565b816113268161313e565b61125e83836131f7565b6002600054036113875760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b6002600081815584815260186020908152604080832086845260060182528083208085015480855294909252909120805491929160ff166113db5760405163120458fb60e21b815260040160405180910390fd5b60006113e683612762565b905060006113f48683615956565b905080341015611417576040516352a8207f60e11b815260040160405180910390fd5b60018301546001600160581b031682111561147e5760165460008581526003602090815260408083203384529091529020546114549088906159a7565b111561147357604051630d3e027960e21b815260040160405180910390fd5b61147e843388613307565b611489853388612f95565b8034111561150c57600061149d82346159ba565b604051909150600090339083908381818185875af1925050503d80600081146114e2576040519150601f19603f3d011682016040523d82523d6000602084013e6114e7565b606091505b505090508061150957604051633c31275160e21b815260040160405180910390fd5b50505b50506001600055505050505050565b600080516020615d7483398151915261153381612fc9565b60145482141580611542575081155b15611560576040516302312abf60e31b815260040160405180910390fd5b6000828152601860205260409020600101541561159057604051632f5b1a7b60e01b815260040160405180910390fd5b6000828152601860205260408120818155600181018290556002810182905560038101829055906115c4600483018261502e565b6115d260058301600061502e565b5050601480549060006115e4836159cd565b91905055505050565b6116386040518060e00160405280600081526020016000815260200160008152602001600081526020016000815260200160006001600160a01b031681526020016000151581525090565b50600090815260066020908152604091829020825160e0810184528154815260018201549281019290925260028101549282019290925260038201546060820152600482015460808201526005909101546001600160a01b03811660a0830152600160a01b900460ff16151560c082015290565b600080516020615d748339815191526116c481612fc9565b6116cd82600555565b5050565b6117326040518061016001604052806000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b5060009182526018602090815260408084209284526006928301825292839020835161016081018552815481526001820154928101929092526002810154938201939093526003830154606082015260048301546080820152600583015460a08201529082015460c0820152600782015460e082015260088201546101008083019190915260099092015460ff8082161515610120840152929004909116151561014082015290565b826001600160a01b03811633146117f5576117f53361313e565b611800848484613343565b50505050565b6000600080516020615d7483398151915261182081612fc9565b6014548614158061182f575085155b1561184d576040516302312abf60e31b815260040160405180910390fd5b8460000361186e57604051635d90204f60e01b815260040160405180910390fd5b60008681526018602052604081206001810180549192918290611890906159e4565b91829055509050600060068301816118a96001856159ba565b815260200190815260200160002090506000600183116118cd5783600201546118e1565b816005015482600401546118e191906159a7565b9050600060016118f18b846159a7565b6118fb91906159ba565b90508085600301819055506040518061016001604052808581526020018c815260200160008152602001600081526020018381526020018b8152602001600081526020018a815260200189815260200160001515815260200160001515815250856006016000868152602001908152602001600020600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004015560a0820151816005015560c0820151816006015560e0820151816007015561010082015181600801556101208201518160090160006101000a81548160ff0219169083151502179055506101408201518160090160016101000a81548160ff021916908315150217905550905050839650505050505050949350505050565b6000828152600d602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046bffffffffffffffffffffffff16928201929092528291611aa0575060408051808201909152600c546001600160a01b0381168252600160a01b90046bffffffffffffffffffffffff1660208201525b602081015160009061271090611ac4906bffffffffffffffffffffffff1687615956565b611ace9190615a13565b915196919550909350505050565b6000828152600a6020526040902060010154611af781612fc9565b61125e83836133bb565b600080516020615d74833981519152611b1981612fc9565b821580611b27575060145483115b15611b455760405163c5d6748560e01b815260040160405180910390fd5b60008381526018602052604090206005016118008382615a6d565b600080516020615d74833981519152611b7881612fc9565b60008581526018602090815260408083208784526006019091529020611b9d8161345d565b611ba6816134ae565b6003810154600582015460008281526006602081905260409091205490840154611bd091906159a7565b1115611bef57604051633b3c591f60e01b815260040160405180910390fd5b611bfa818686613514565b50505050505050565b6001600160a01b0381163314611c815760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c660000000000000000000000000000000000606482015260840161137e565b6116cd8282613638565b6000611c96826136bb565b6000828152600260205260408120805490916101009091046001600160501b03169003611cd45754600160581b90046001600160501b031692915050565b8054600160581b90046001600160501b0316611cef846136e7565b10611cfd5750600092915050565b80544290611d22906001600160501b03600160581b8204811691610100900416615b2d565b6001600160501b0316611d3591906159ba565b9392505050565b611d4461371a565b600260005403611d965760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161137e565b600260009081556040514791907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169083908381818185875af1925050503d8060008114611e08576040519150601f19603f3d011682016040523d82523d6000602084013e611e0d565b606091505b5050905080611e2f57604051631d42c86760e21b815260040160405180910390fd5b50506001600055565b826001600160a01b0381163314611e5257611e523361313e565b611800848484613774565b600080516020615d74833981519152611e7581612fc9565b60008381526018602090815260408083208584526006019091529020611e9a8161345d565b611ea3816134ae565b611800816002015461378f565b600082815260186020908152604080832084845260060190915290206003810154611eda8161385e565b6000818152600660205260409020600501546001600160a01b0316801561123557600082815260066020526040902054611f15848383613933565b505050505050565b600080516020615d74833981519152611f3581612fc9565b611800848484613967565b600080516020615d74833981519152611f5881612fc9565b601761125e8382615a6d565b6000818152601060205260408120546001600160a01b0316806111b05760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e2049440000000000000000604482015260640161137e565b6000611fd482613a7f565b600082815260066020526040902060028101546001820154611d3591906159a7565b60186020526000908152604090208054600182015460028301546003840154600485018054949593949293919261202c9061596d565b80601f01602080910402602001604051908101604052809291908181526020018280546120589061596d565b80156120a55780601f1061207a576101008083540402835291602001916120a5565b820191906000526020600020905b81548152906001019060200180831161208857829003601f168201915b5050505050908060050180546120ba9061596d565b80601f01602080910402602001604051908101604052809291908181526020018280546120e69061596d565b80156121335780601f1061210857610100808354040283529160200191612133565b820191906000526020600020905b81548152906001019060200180831161211657829003601f168201915b5050505050905086565b6000600080516020615d7483398151915261215781612fc9565b6121618787613aab565b8460000361218257604051635d90204f60e01b815260040160405180910390fd5b600087815260186020908152604080832089845260060190915290206121a7816134ae565b80600501548682600601546121bc91906159a7565b11156121db57604051633b3c591f60e01b815260040160405180910390fd5b60006121e8878787613b12565b905080826003018190555087897f6bb0b0603b5b6765f12d84f365201bbd0d6d673120c0422e47f44372317c04018360405161222691815260200190565b60405180910390a398975050505050505050565b600080516020615d7483398151915261225281612fc9565b60145483141580612261575082155b1561227f576040516302312abf60e31b815260040160405180910390fd5b600083815260186020526040902060018101548314158061229e575082155b156122bc5760405163073797b960e21b815260040160405180910390fd5b60008381526006808301602052604090912090810154156122f057604051632f5b1a7b60e01b815260040160405180910390fd5b6122f98161345d565b612302816134ae565b600184111561232e57806005015482600301600082825461232391906159ba565b909155506123399050565b600282015460038301555b60008481526006808401602052604082208281556001808201849055600282018490556003820184905560048201849055600582018490559181018390556007810183905560088101839055600901805461ffff19169055830180549161239f836159cd565b91905055505050505050565b60006001600160a01b0382166124295760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f74206120766160448201527f6c6964206f776e65720000000000000000000000000000000000000000000000606482015260840161137e565b506001600160a01b031660009081526011602052604090205490565b61244d61371a565b6124576000613b90565b565b60008681526018602090815260408083208884526006019091529020600981015460ff1661249a5760405163261a1a1d60e11b815260040160405180910390fd5b3360009081526008602090815260408083208a84528252808320898452909152902054846124c887836159a7565b11156124e75760405163328c427360e11b815260040160405180910390fd5b61252733868a8a88888080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061296292505050565b612544576040516360cea48b60e01b815260040160405180910390fd5b60088201546125539087615956565b3414612572576040516352a8207f60e11b815260040160405180910390fd5b61257e33898989613be2565b612589823388612f95565b5050505050505050565b600080516020615d748339815191526125ab81612fc9565b6002600054036125fd5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161137e565b600260009081558381526018602090815260408083208584526006019091529020600381015461262c81613c6f565b50506001600055505050565b600080516020615d7483398151915261265081612fc9565b6116cd82613dc4565b600080516020615d7483398151915261267181612fc9565b506000908152600d6020526040812055565b6000600080516020615d7483398151915261269d81612fc9565b6126a78888613aab565b60008881526018602090815260408083208a845260060190915290206126cc816134ae565b60006126da88888888613dff565b9050808260020181905550888a7fe91037e9a64d5a33b6276c52d32545ac65d9b04c62ead9c3caebf199be5c1fb08360405161271891815260200190565b60405180910390a39998505050505050505050565b60008181526006602052604081206004015481428211156127575761275242836159ba565b61275a565b60005b949350505050565b600061276d826136bb565b600082815260026020526040812090612785846136e7565b8254909150600160581b90046001600160501b031681106127b45750600101546001600160581b031692915050565b60018201546000906127d690600160b01b90046001600160501b031683615a13565b60018401549091506000906127fb90600160581b90046001600160581b031683615956565b845490915061281b908290600160a81b90046001600160581b03166159ba565b9695505050505050565b6060600f80546112729061596d565b600080516020615d7483398151915261284c81612fc9565b50601655565b8161285c8161313e565b61125e8383614010565b600080516020615d7483398151915261287e81612fc9565b6128888484613aab565b600084815260186020908152604080832086845260060190915290206128ad816134ae565b600901805460ff191692151592909217909155505050565b600080516020615d748339815191526128dd81612fc9565b6128e76000600c55565b50565b836001600160a01b0381163314612904576129043361313e565b6112358585858561401b565b600080516020615d7483398151915261292881612fc9565b6129328585613aab565b60008581526018602090815260408083208784526006019091529020612957816134ae565b611f15818585612f95565b6040516bffffffffffffffffffffffff19606087901b16602082015260348101859052605481018490526074810183905260009081906094016040516020818303038152906040528051906020012090506129c08360075483614094565b979650505050505050565b6000818152601060205260409020546060906001600160a01b0316612a03576040516307ed98ed60e31b815260040160405180910390fd5b600060178054612a129061596d565b80601f0160208091040260200160405190810160405280929190818152602001828054612a3e9061596d565b8015612a8b5780601f10612a6057610100808354040283529160200191612a8b565b820191906000526020600020905b815481529060010190602001808311612a6e57829003601f168201915b505050505090508051600003612b68576000612aa684612e93565b6000818152601860205260409020600501805491925090612ac69061596d565b80601f0160208091040260200160405190810160405280929190818152602001828054612af29061596d565b8015612b3f5780601f10612b1457610100808354040283529160200191612b3f565b820191906000526020600020905b815481529060010190602001808311612b2257829003601f168201915b505050505091508151600003612b6657505060408051602081019091526000815292915050565b505b80612b72846140aa565b604051602001612b83929190615b4d565b604051602081830303815290604052915050919050565b600260005403612bec5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161137e565b60026000908155828152601860209081526040808320848452600601909152902060030154612c1a816141ab565b5050600160005550565b6000828152600a6020526040902060010154612c3f81612fc9565b61125e8383613638565b600080516020615d74833981519152612c6181612fc9565b612c6b8484613aab565b60008481526018602090815260408083208684526006019091529020612c90816134ae565b60090180549215156101000261ff001990931692909217909155505050565b6000600080516020615d74833981519152612cc981612fc9565b6000601460008154612cda906159e4565b91829055509050600181118015612d11575060186000612cfb6001846159ba565b8152602001908152602001600020600101546000145b15612d2f576040516335f7682360e01b815260040160405180910390fd5b6000601881612d3f6001856159ba565b8152602001908152602001600020600301546001612d5d91906159a7565b6000838152601860205260409020838155600281018290556003810182905590915060048101612d8e878983615b7c565b5091935050505b5092915050565b600080516020615d74833981519152612db481612fc9565b600083815260186020908152604080832085845260060190915290206002015461180081614346565b612de561371a565b6001600160a01b038116612e615760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161137e565b6128e781613b90565b600081815260066020526040812060038101544210801590611d35575060040154421092915050565b600081600003612eb6576040516307ed98ed60e31b815260040160405180910390fd5b60015b6014548111612ee8576000818152601860205260409020600301548311612ee05792915050565b600101612eb9565b5060405163f706fc9f60e01b815260040160405180910390fd5b600080516020615d74833981519152612f1a81612fc9565b60008381526018602090815260408083208584526006019091529020612f3f8161345d565b612f48816134ae565b61180081600201546143d3565b60006001600160e01b031982166380ac58cd60e01b1480612f8657506001600160e01b03198216635b5e139f60e01b145b806111b057506111b082614486565b6000612fa18483614491565b905060005b8281101561123557612fc184612fbc83856159a7565b61452c565b600101612fa6565b6128e78133614546565b6127106bffffffffffffffffffffffff821611156130465760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b606482015260840161137e565b6001600160a01b03821661309c5760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c696420726563656976657200000000000000604482015260640161137e565b604080518082019091526001600160a01b039092168083526bffffffffffffffffffffffff9091166020909201829052600160a01b90910217600c55565b6000818152601060205260409020546001600160a01b03166128e75760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e2049440000000000000000604482015260640161137e565b6daaeb6d7670e522a718067333cd4e3b156128e757604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa1580156131ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131cf9190615c3c565b6128e757604051633b79c77360e21b81526001600160a01b038216600482015260240161137e565b600061320282611f64565b9050806001600160a01b0316836001600160a01b03160361326f5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b606482015260840161137e565b336001600160a01b038216148061328b575061328b81336110a1565b6132fd5760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c0000606482015260840161137e565b61125e83836145c6565b60008381526003602090815260408083206001600160a01b0386168452909152812080548392906133399084906159a7565b9091555050505050565b61334d3382614634565b6133b05760405162461bcd60e51b815260206004820152602e60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201526d1c881b9bdc88185c1c1c9bdd995960921b606482015260840161137e565b61125e8383836146b2565b6000828152600a602090815260408083206001600160a01b038516845290915290205460ff166116cd576000828152600a602090815260408083206001600160a01b03851684529091529020805460ff191660011790556134193390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6009810154610100900460ff161561348857604051631e386ed360e01b815260040160405180910390fd5b600981015460ff16156128e75760405163c2ef408160e01b815260040160405180910390fd5b6134cb816002015460009081526002602052604090205460ff1690565b156134e957604051630545584f60e11b815260040160405180910390fd5b6134f68160030154614866565b156128e757604051634936c2ef60e11b815260040160405180910390fd5b61351d83613a7f565b60008381526006602052604090206003810154158015906135415750600481015415155b1561355f5760405163292bb7cf60e21b815260040160405180910390fd5b62093a8083111561358357604051633ce3604b60e21b815260040160405180910390fd5b610e108210156135a6576040516363c0bec760e01b815260040160405180910390fd5b62093a808211156135ca5760405163fb8900e360e01b815260040160405180910390fd5b60006135d684426159a7565b905060006135e484836159a7565b6003840183905560048401819055604080518481526020810183905291925087917f511edb4a6af3416b7f150f186e558d42b05552ea1b9a9606f0ad477b0f32256c910160405180910390a2505050505050565b6000828152600a602090815260408083206001600160a01b038516845290915290205460ff16156116cd576000828152600a602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b8015806136c9575060015481115b156128e7576040516307aba75d60e11b815260040160405180910390fd5b60008181526002602052604081205461010090046001600160501b031680613710576000611d35565b611d3581426159ba565b600b546001600160a01b031633146124575760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161137e565b61125e838383604051806020016040528060008152506128ea565b613798816136bb565b6000818152600260205260408120805490916101009091046001600160501b031690036137d85760405163f6232b0760e01b815260040160405180910390fd5b805460ff16156137fb57604051630545584f60e11b815260040160405180910390fd5b805460ff1916600117808255604080516001600160501b03610100840481168252600160581b909304909216602083015283917f3dd6f7d6beabdcd7d826f806bc14ced3d89eee1a10fb91bf4ab62cb72096bfd691015b60405180910390a25050565b61386781613a7f565b61387081614897565b61388d5760405163f83bafdd60e01b815260040160405180910390fd5b60008181526006602052604090206005810154600160a01b900460ff16156138c857604051630dcc2dad60e11b815260040160405180910390fd5b600581018054600160a01b60ff60a01b19821617909155600182015482546040805192835260208301919091526001600160a01b039092169181019190915282907fa2579259b5a06a8f6ead1e02b398312c11af0121f9c9556cc0841916be0b7cb390606001613852565b600061393f8483614491565b905060005b828110156112355761395f8461395a83856159a7565b6148c0565b600101613944565b6127106bffffffffffffffffffffffff821611156139da5760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b606482015260840161137e565b6001600160a01b038216613a305760405162461bcd60e51b815260206004820152601b60248201527f455243323938313a20496e76616c696420706172616d65746572730000000000604482015260640161137e565b6040805180820182526001600160a01b0393841681526bffffffffffffffffffffffff92831660208083019182526000968752600d90529190942093519051909116600160a01b029116179055565b801580613a8d575060045481115b156128e7576040516391fce5a560e01b815260040160405180910390fd5b811580613ab9575060145482115b15613ad75760405163c5d6748560e01b815260040160405180910390fd5b801580613af4575060008281526018602052604090206001015481115b156116cd576040516332c099d760e21b815260040160405180910390fd5b600080600460008154613b24906159e4565b91829055506000818152600660209081526040918290208881556001810188905560028101879055825189815291820188905292935083917f327cb2e56a41786a1cfaae03a97e9ca3ecabbf9941aff17ed4f0a80b8fca0800910160405180910390a250949350505050565b600b80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b0384166000908152600860209081526040808320868452825280832085845290915281208054839290613c1d9084906159a7565b925050819055508183856001600160a01b03167f9cdcf2f7714cca3508c7f0110b04a90a80a3a8dd0e35de99689db74d28c5383e84604051613c6191815260200190565b60405180910390a450505050565b613c7881613a7f565b6000818152600660205260409020600481015415613ce65780600401544210613cb457604051634822878f60e11b815260040160405180910390fd5b611c208160040154613cc691906159ba565b421115613ce657604051634a915acf60e11b815260040160405180910390fd5b42600482015560058101805460ff60a01b198116600160a01b1790915560018201805460009091556001600160a01b03909116908115613d7a576000613d2c8383614a02565b905080613d7857826001600160a01b0316857f8d3e3ded3cadb12035d47e7502204f8ed462827897cea19d87edb5018f79f6a884604051613d6f91815260200190565b60405180910390a35b505b604080516001600160a01b03841681526020810183905285917f72a886201643b9489841df5cc56e0a993994e104f42a680bc0ff262187f47224910160405180910390a250505050565b60078190556040518181527f1b930366dfeaa7eb3b325021e4ae81e36527063452ee55b86c95f85b36f4c31c9060200160405180910390a150565b6000836001600160581b0316856001600160581b03161080613e3b57506001600160581b038316613e308587615c59565b6001600160581b0316105b15613e5957604051638496243f60e01b815260040160405180910390fd5b6000600160008154613e6a906159e4565b9182905550600081815260026020526040812080546001600160581b03808b16600160a81b0274ffffffffffffffffffffffffffffffffffffffffff9092169190911782556001820180546001600160501b038916600160b01b810275ffffffffffffffffffffffffffffffffffffffffffff8c8616600160581b027fffffffffffffffffffff00000000000000000000000000000000000000000000909416958e1695909517929092179390931617905592935091613f45613f2d898b615c59565b6001600160581b0316886001600160581b0316614a65565b613f4f9190615956565b905080600003613f7257604051638496243f60e01b815260040160405180910390fd5b6001600160501b03811115613f9a576040516317bb7d4d60e01b815260040160405180910390fd5b81547fffffffffffffffffffffff00000000000000000000ffffffffffffffffffffff16600160581b6001600160501b038316021782556040518381527ffe097cec24864832ed02f5d4830bf672deb9ef76ccbe80a6b9f29bc88cef92d89060200160405180910390a150909695505050505050565b6116cd338383614a9c565b6140253383614634565b6140885760405162461bcd60e51b815260206004820152602e60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201526d1c881b9bdc88185c1c1c9bdd995960921b606482015260840161137e565b61180084848484614b6a565b6000826140a18584614be8565b14949350505050565b6060816000036140d15750506040805180820190915260018152600360fc1b602082015290565b8160005b81156140fb57806140e5816159e4565b91506140f49050600a83615a13565b91506140d5565b60008167ffffffffffffffff81111561411657614116615358565b6040519080825280601f01601f191660200182016040528015614140576020820181803683370190505b5090505b841561275a576141556001836159ba565b9150614162600a86615c79565b61416d9060306159a7565b60f81b81838151811061418257614182615c8d565b60200101906001600160f81b031916908160001a9053506141a4600a86615a13565b9450614144565b6141b481613a7f565b6141bd81612e6a565b6141da576040516372a5c90560e11b815260040160405180910390fd5b6000818152600660205260409020600181015460058201546001600160a01b0316338190036142555761420d34836159a7565b600184015533847f07d37c2e9a86e2d409bb7091df87d2f7e11e429778143a2e963bf4aa35b4753261423f34866159a7565b60405190815260200160405180910390a3611800565b600283015461426490836159a7565b34101561428457604051635069375b60e11b815260040160405180910390fd5b34600184018190556005840180546001600160a01b031916339081179091556040519182529085907f07d37c2e9a86e2d409bb7091df87d2f7e11e429778143a2e963bf4aa35b475329060200160405180910390a36001600160a01b038116156118005760006142f48284614a02565b90508061123557816001600160a01b0316857f8d3e3ded3cadb12035d47e7502204f8ed462827897cea19d87edb5018f79f6a88560405161433791815260200190565b60405180910390a35050505050565b61434f816136bb565b60008181526002602052604090205460ff1661437e5760405163120458fb60e21b815260040160405180910390fd5b60008181526002602052604090819020805460ff191690555181907fff6385d17288634260669ad420ea388da7135ceaad9f3bed87b4b3d8461f01d8906143c89042815260200190565b60405180910390a250565b6143dc816136bb565b6000818152600260205260409020805460ff161561440d57604051630545584f60e11b815260040160405180910390fd5b805460016affffffffffffffffffffff19909116610100426001600160501b03908116820260ff191692909217929092178084556040805193820483168452600160581b909104909116602083015283917f3dd6f7d6beabdcd7d826f806bc14ced3d89eee1a10fb91bf4ab62cb72096bfd69101613852565b60006111b082614c35565b6000816000036144b457604051636f9ebeaf60e01b815260040160405180910390fd5b600683015460058401546144c884836159a7565b11156144e757604051633b3c591f60e01b815260040160405180910390fd5b6144f183826159a7565b8460060181905550826015600082825461450b91906159a7565b909155505060048401546000906145239083906159a7565b95945050505050565b6116cd828260405180602001604052806000815250614c5a565b6000828152600a602090815260408083206001600160a01b038516845290915290205460ff166116cd57614584816001600160a01b03166014614cd8565b61458f836020614cd8565b6040516020016145a0929190615ca3565b60408051601f198184030181529082905262461bcd60e51b825261137e91600401615196565b600081815260126020526040902080546001600160a01b0319166001600160a01b03841690811790915581906145fb82611f64565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008061464083611f64565b9050806001600160a01b0316846001600160a01b0316148061468757506001600160a01b0380821660009081526013602090815260408083209388168352929052205460ff165b8061275a5750836001600160a01b03166146a0846112f5565b6001600160a01b031614949350505050565b826001600160a01b03166146c582611f64565b6001600160a01b0316146147415760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201527f6f776e6572000000000000000000000000000000000000000000000000000000606482015260840161137e565b6001600160a01b0382166147a35760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161137e565b6147ae6000826145c6565b6001600160a01b03831660009081526011602052604081208054600192906147d79084906159ba565b90915550506001600160a01b03821660009081526011602052604081208054600192906148059084906159a7565b909155505060008181526010602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6000818152600660205260408120600481015415801590611d35575060050154600160a01b900460ff161592915050565b6000818152600660205260408120600481015415801590611d3557506004015442101592915050565b6001600160a01b0382166149165760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161137e565b6000818152601060205260409020546001600160a01b03161561497b5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161137e565b6001600160a01b03821660009081526011602052604081208054600192906149a49084906159a7565b909155505060008181526010602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b600080836001600160a01b03168360055490604051600060405180830381858888f193505050503d8060008114614a55576040519150601f19603f3d011682016040523d82523d6000602084013e614a5a565b606091505b509095945050505050565b60008215614a935781614a796001856159ba565b614a839190615a13565b614a8e9060016159a7565b611d35565b60009392505050565b816001600160a01b0316836001600160a01b031603614afd5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161137e565b6001600160a01b03838116600081815260136020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b614b758484846146b2565b614b8184848484614e81565b6118005760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606482015260840161137e565b600081815b8451811015614c2d57614c1982868381518110614c0c57614c0c615c8d565b6020026020010151614fca565b915080614c25816159e4565b915050614bed565b509392505050565b60006001600160e01b0319821663152a902d60e11b14806111b057506111b082614ff9565b614c6483836148c0565b614c716000848484614e81565b61125e5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606482015260840161137e565b60606000614ce7836002615956565b614cf29060026159a7565b67ffffffffffffffff811115614d0a57614d0a615358565b6040519080825280601f01601f191660200182016040528015614d34576020820181803683370190505b509050600360fc1b81600081518110614d4f57614d4f615c8d565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110614d7e57614d7e615c8d565b60200101906001600160f81b031916908160001a9053506000614da2846002615956565b614dad9060016159a7565b90505b6001811115614e32577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110614dee57614dee615c8d565b1a60f81b828281518110614e0457614e04615c8d565b60200101906001600160f81b031916908160001a90535060049490941c93614e2b816159cd565b9050614db0565b508315611d355760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161137e565b60006001600160a01b0384163b15614fc257604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290614ec5903390899088908890600401615d24565b6020604051808303816000875af1925050508015614f00575060408051601f3d908101601f19168201909252614efd91810190615d56565b60015b614fa8573d808015614f2e576040519150601f19603f3d011682016040523d82523d6000602084013e614f33565b606091505b508051600003614fa05760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606482015260840161137e565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061275a565b50600161275a565b6000818310614fe6576000828152602084905260409020611d35565b6000838152602083905260409020611d35565b60006001600160e01b03198216637965db0b60e01b14806111b057506301ffc9a760e01b6001600160e01b03198316146111b0565b50805461503a9061596d565b6000825580601f1061504a575050565b601f0160209004906000526020600020908101906128e791905b808211156150785760008155600101615064565b5090565b6001600160e01b0319811681146128e757600080fd5b6000602082840312156150a457600080fd5b8135611d358161507c565b6000806000606084860312156150c457600080fd5b505081359360208301359350604090920135919050565b80356001600160a01b03811681146150f257600080fd5b919050565b80356bffffffffffffffffffffffff811681146150f257600080fd5b6000806040838503121561512657600080fd5b61512f836150db565b915061513d602084016150f7565b90509250929050565b60005b83811015615161578181015183820152602001615149565b50506000910152565b60008151808452615182816020860160208601615146565b601f01601f19169290920160200192915050565b602081526000611d35602083018461516a565b6000602082840312156151bb57600080fd5b5035919050565b600080604083850312156151d557600080fd5b6151de836150db565b946020939093013593505050565b600080604083850312156151ff57600080fd5b50508035926020909101359150565b600061016082019050825182526020830151602083015260408301516040830152606083015160608301526080830151608083015260a083015160a083015260c083015160c083015260e083015160e0830152610100808401518184015250610120808401516152818285018215159052565b5050610140928301511515919092015290565b6000806000606084860312156152a957600080fd5b6152b2846150db565b95602085013595506040909401359392505050565b6000806000606084860312156152dc57600080fd5b6152e5846150db565b92506152f3602085016150db565b9150604084013590509250925092565b6000806000806080858703121561531957600080fd5b5050823594602084013594506040840135936060013592509050565b6000806040838503121561534857600080fd5b8235915061513d602084016150db565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561539757615397615358565b604052919050565b600067ffffffffffffffff8311156153b9576153b9615358565b6153cc601f8401601f191660200161536e565b90508281528383830111156153e057600080fd5b828260208301376000602084830101529392505050565b600082601f83011261540857600080fd5b611d358383356020850161539f565b6000806040838503121561542a57600080fd5b82359150602083013567ffffffffffffffff81111561544857600080fd5b615454858286016153f7565b9150509250929050565b60008060006060848603121561547357600080fd5b83359250615483602085016150db565b9150615491604085016150f7565b90509250925092565b6000602082840312156154ac57600080fd5b813567ffffffffffffffff8111156154c357600080fd5b61275a848285016153f7565b86815285602082015284604082015283606082015260c0608082015260006154fa60c083018561516a565b82810360a084015261550c818561516a565b9998505050505050505050565b600080600080600060a0868803121561553157600080fd5b505083359560208501359550604085013594606081013594506080013592509050565b60006020828403121561556657600080fd5b611d35826150db565b60008060008060008060a0878903121561558857600080fd5b86359550602087013594506040870135935060608701359250608087013567ffffffffffffffff808211156155bc57600080fd5b818901915089601f8301126155d057600080fd5b8135818111156155df57600080fd5b8a60208260051b85010111156155f457600080fd5b6020830194508093505050509295509295509295565b80356001600160581b03811681146150f257600080fd5b60008060008060008060c0878903121561563a57600080fd5b86359550602087013594506156516040880161560a565b935061565f6060880161560a565b925061566d6080880161560a565b915060a08701356001600160501b038116811461568957600080fd5b809150509295509295509295565b80151581146128e757600080fd5b600080604083850312156156b857600080fd5b6156c1836150db565b915060208301356156d181615697565b809150509250929050565b6000806000606084860312156156f157600080fd5b8335925060208401359150604084013561570a81615697565b809150509250925092565b6000806000806080858703121561572b57600080fd5b615734856150db565b9350615742602086016150db565b925060408501359150606085013567ffffffffffffffff81111561576557600080fd5b8501601f8101871361577657600080fd5b6157858782356020840161539f565b91505092959194509250565b600080600080608085870312156157a757600080fd5b84359350602085013592506157be604086016150db565b9396929550929360600135925050565b600080600080600060a086880312156157e657600080fd5b6157ef866150db565b945060208087013594506040870135935060608701359250608087013567ffffffffffffffff8082111561582257600080fd5b818901915089601f83011261583657600080fd5b81358181111561584857615848615358565b8060051b915061585984830161536e565b818152918301840191848101908c84111561587357600080fd5b938501935b8385101561589157843582529385019390850190615878565b8096505050505050509295509295909350565b600080604083850312156158b757600080fd5b6158c0836150db565b915061513d602084016150db565b600080602083850312156158e157600080fd5b823567ffffffffffffffff808211156158f957600080fd5b818501915085601f83011261590d57600080fd5b81358181111561591c57600080fd5b86602082850101111561592e57600080fd5b60209290920196919550909350505050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176111b0576111b0615940565b600181811c9082168061598157607f821691505b6020821081036159a157634e487b7160e01b600052602260045260246000fd5b50919050565b808201808211156111b0576111b0615940565b818103818111156111b0576111b0615940565b6000816159dc576159dc615940565b506000190190565b6000600182016159f6576159f6615940565b5060010190565b634e487b7160e01b600052601260045260246000fd5b600082615a2257615a226159fd565b500490565b601f82111561125e57600081815260208120601f850160051c81016020861015615a4e5750805b601f850160051c820191505b81811015611f1557828155600101615a5a565b815167ffffffffffffffff811115615a8757615a87615358565b615a9b81615a95845461596d565b84615a27565b602080601f831160018114615ad05760008415615ab85750858301515b600019600386901b1c1916600185901b178555611f15565b600085815260208120601f198616915b82811015615aff57888601518255948401946001909101908401615ae0565b5085821015615b1d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6001600160501b03818116838216019080821115612d9557612d95615940565b60008351615b5f818460208801615146565b835190830190615b73818360208801615146565b01949350505050565b67ffffffffffffffff831115615b9457615b94615358565b615ba883615ba2835461596d565b83615a27565b6000601f841160018114615bdc5760008515615bc45750838201355b600019600387901b1c1916600186901b178355611235565b600083815260209020601f19861690835b82811015615c0d5786850135825560209485019460019092019101615bed565b5086821015615c2a5760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b600060208284031215615c4e57600080fd5b8151611d3581615697565b6001600160581b03828116828216039080821115612d9557612d95615940565b600082615c8857615c886159fd565b500690565b634e487b7160e01b600052603260045260246000fd5b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351615cdb816017850160208801615146565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351615d18816028840160208801615146565b01602801949350505050565b60006001600160a01b0380871683528086166020840152508360408301526080606083015261281b608083018461516a565b600060208284031215615d6857600080fd5b8151611d358161507c56fed8acb51ff3d48f690a25887aaf234c4ae5a66ab9839243cd8e2b639cade0663ba26469706673582212201f7cc9ec80d1685ada26501b77831cfea9e78c90f16d5fc2c5bb97a1d558d08264736f6c63430008110033000000000000000000000000672bfe35158f490f40dab3bc9f9c08f70e2094e7
Deployed Bytecode
0x60806040526004361061053d5760003560e01c806370a08231116102af578063a22cb46511610179578063df1da92f116100d6578063f25562891161008a578063f53c30581161006f578063f53c305814611145578063f9af1faa14611165578063fe697bb81461118557600080fd5b8063f255628914611105578063f2fde38b1461112557600080fd5b8063e985e9c5116100bb578063e985e9c514611086578063eafb74a0146110cf578063f025b8fa146110e557600080fd5b8063df1da92f14611034578063e1a4b1b51461106657600080fd5b8063c4623c1d1161012d578063c87b56dd11610112578063c87b56dd14610fe1578063cd777ecf14611001578063d547741f1461101457600080fd5b8063c4623c1d14610fa1578063c687725e14610fc157600080fd5b8063aa1b103f1161015e578063aa1b103f14610e10578063b56d334014610e25578063b88d4fde14610f8157600080fd5b8063a22cb46514610dd0578063a9e17f8c14610df057600080fd5b806390b3ad7b1161022757806395059aa7116101db5780639b4fbc2a116101c05780639b4fbc2a14610d855780639d6cea5c14610da5578063a217fddf14610dbb57600080fd5b806395059aa714610d5057806395d89b4114610d7057600080fd5b8063943d40e71161020c578063943d40e714610cda578063947ac74d14610d0e57806394b059ab14610d2e57600080fd5b806390b3ad7b14610c5557806391d1485414610c9457600080fd5b806384584d071161027e5780638ab57f5e116102635780638ab57f5e14610bd85780638da5cb5b14610c175780638fc90cca14610c3557600080fd5b806384584d0714610b985780638a616bc014610bb857600080fd5b806370a0823114610b30578063715018a614610b505780637645726214610b655780637931070414610b7857600080fd5b80632eb4a7ab1161040b5780634f5399891161036857806365eef50f1161031c5780636a51b918116103015780636a51b91814610abe5780636c15e2e714610af05780637047845e14610b1057600080fd5b806365eef50f14610a88578063676314f214610a9e57600080fd5b80635944c7531161034d5780635944c75314610a285780636255446a14610a485780636352211e14610a6857600080fd5b80634f539989146109c55780635321290514610a0857600080fd5b80633b61bde2116103bf57806341f43434116103a457806341f434341461096357806342842e0e1461098557806346f0e23d146109a557600080fd5b80633b61bde21461092e5780633ccfd60b1461094e57600080fd5b806333cfcb9f116103f057806333cfcb9f146108ce5780633639f257146108ee57806336568abe1461090e57600080fd5b80632eb4a7ab146108985780632f2ff15d146108ae57600080fd5b8063175b86a1116104b957806323b872dd1161046d5780632492a5f5116104525780632492a5f5146107ff5780632a55205a1461081f5780632bc1e25a1461085e57600080fd5b806323b872dd146107af578063248a9ca3146107cf57600080fd5b80631a4122c31161049e5780631a4122c3146107145780631ffcb1961461073457806322ffcdf51461076157600080fd5b8063175b86a11461067d57806318160ddd146106fe57600080fd5b806306fdde0311610510578063095ea7b3116104f5578063095ea7b31461062a5780630aac14501461064a578063175b03b81461065d57600080fd5b806306fdde03146105d0578063081812fc146105f257600080fd5b806301ffc9a71461054257806302acc94b1461057757806304634d8d1461058c57806305d68dc9146105ac575b600080fd5b34801561054e57600080fd5b5061056261055d366004615092565b6111a5565b60405190151581526020015b60405180910390f35b61058a6105853660046150af565b6111b6565b005b34801561059857600080fd5b5061058a6105a7366004615113565b61123c565b3480156105b857600080fd5b506105c260145481565b60405190815260200161056e565b3480156105dc57600080fd5b506105e5611263565b60405161056e9190615196565b3480156105fe57600080fd5b5061061261060d3660046151a9565b6112f5565b6040516001600160a01b03909116815260200161056e565b34801561063657600080fd5b5061058a6106453660046151c2565b61131c565b61058a6106583660046150af565b611330565b34801561066957600080fd5b5061058a6106783660046151a9565b61151b565b34801561068957600080fd5b5061069d6106983660046151a9565b6115ed565b60405161056e9190600060e08201905082518252602083015160208301526040830151604083015260608301516060830152608083015160808301526001600160a01b0360a08401511660a083015260c0830151151560c083015292915050565b34801561070a57600080fd5b506105c260155481565b34801561072057600080fd5b5061058a61072f3660046151a9565b6116ac565b34801561074057600080fd5b5061075461074f3660046151ec565b6116d1565b60405161056e919061520e565b34801561076d57600080fd5b506105c261077c366004615294565b6001600160a01b038316600090815260086020908152604080832085845282528083208484529091529020549392505050565b3480156107bb57600080fd5b5061058a6107ca3660046152c7565b6117db565b3480156107db57600080fd5b506105c26107ea3660046151a9565b6000908152600a602052604090206001015490565b34801561080b57600080fd5b506105c261081a366004615303565b611806565b34801561082b57600080fd5b5061083f61083a3660046151ec565b611a21565b604080516001600160a01b03909316835260208301919091520161056e565b34801561086a57600080fd5b506105626108793660046151a9565b600090815260066020526040902060050154600160a01b900460ff1690565b3480156108a457600080fd5b506105c260075481565b3480156108ba57600080fd5b5061058a6108c9366004615335565b611adc565b3480156108da57600080fd5b5061058a6108e9366004615417565b611b01565b3480156108fa57600080fd5b5061058a610909366004615303565b611b60565b34801561091a57600080fd5b5061058a610929366004615335565b611c03565b34801561093a57600080fd5b506105c26109493660046151a9565b611c8b565b34801561095a57600080fd5b5061058a611d3c565b34801561096f57600080fd5b506106126daaeb6d7670e522a718067333cd4e81565b34801561099157600080fd5b5061058a6109a03660046152c7565b611e38565b3480156109b157600080fd5b5061058a6109c03660046151ec565b611e5d565b3480156109d157600080fd5b506105c26109e0366004615335565b60009182526003602090815260408084206001600160a01b0393909316845291905290205490565b348015610a1457600080fd5b5061058a610a233660046151ec565b611eb0565b348015610a3457600080fd5b5061058a610a4336600461545e565b611f1d565b348015610a5457600080fd5b5061058a610a6336600461549a565b611f40565b348015610a7457600080fd5b50610612610a833660046151a9565b611f64565b348015610a9457600080fd5b506105c260045481565b348015610aaa57600080fd5b506105c2610ab93660046151a9565b611fc9565b348015610aca57600080fd5b50610ade610ad93660046151a9565b611ff6565b60405161056e969594939291906154cf565b348015610afc57600080fd5b506105c2610b0b366004615519565b61213d565b348015610b1c57600080fd5b5061058a610b2b3660046151ec565b61223a565b348015610b3c57600080fd5b506105c2610b4b366004615554565b6123ab565b348015610b5c57600080fd5b5061058a612445565b61058a610b7336600461556f565b612459565b348015610b8457600080fd5b5061058a610b933660046151ec565b612593565b348015610ba457600080fd5b5061058a610bb33660046151a9565b612638565b348015610bc457600080fd5b5061058a610bd33660046151a9565b612659565b348015610be457600080fd5b506105c2610bf33660046151ec565b60009182526018602090815260408084209284526006909201905290206002015490565b348015610c2357600080fd5b50600b546001600160a01b0316610612565b348015610c4157600080fd5b506105c2610c50366004615621565b612683565b348015610c6157600080fd5b506105c2610c703660046151ec565b60009182526018602090815260408084209284526006909201905290206003015490565b348015610ca057600080fd5b50610562610caf366004615335565b6000918252600a602090815260408084206001600160a01b0393909316845291905290205460ff1690565b348015610ce657600080fd5b506106127f000000000000000000000000672bfe35158f490f40dab3bc9f9c08f70e2094e781565b348015610d1a57600080fd5b506105c2610d293660046151a9565b61272d565b348015610d3a57600080fd5b506105c2600080516020615d7483398151915281565b348015610d5c57600080fd5b506105c2610d6b3660046151a9565b612762565b348015610d7c57600080fd5b506105e5612825565b348015610d9157600080fd5b5061058a610da03660046151a9565b612834565b348015610db157600080fd5b506105c260015481565b348015610dc757600080fd5b506105c2600081565b348015610ddc57600080fd5b5061058a610deb3660046156a5565b612852565b348015610dfc57600080fd5b5061058a610e0b3660046156dc565b612866565b348015610e1c57600080fd5b5061058a6128c5565b348015610e3157600080fd5b50610f06610e403660046151a9565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915250600090815260026020908152604091829020825160e081018452815460ff8116151582526001600160501b036101008204811694830194909452600160581b8082048516958301959095526001600160581b03600160a81b90910481166060830152600190920154808316608083015293840490911660a0820152600160b01b9092041660c082015290565b60405161056e9190600060e08201905082511515825260208301516001600160501b038082166020850152806040860151166040850152606085015191506001600160581b0380831660608601528060808701511660808601528060a08701511660a0860152508060c08601511660c0850152505092915050565b348015610f8d57600080fd5b5061058a610f9c366004615715565b6128ea565b348015610fad57600080fd5b5061058a610fbc366004615791565b612910565b348015610fcd57600080fd5b50610562610fdc3660046157ce565b612962565b348015610fed57600080fd5b506105e5610ffc3660046151a9565b6129cb565b61058a61100f3660046151ec565b612b9a565b34801561102057600080fd5b5061058a61102f366004615335565b612c24565b34801561104057600080fd5b5061056261104f3660046151a9565b600090815260066020526040902060040154421090565b34801561107257600080fd5b5061058a6110813660046156dc565b612c49565b34801561109257600080fd5b506105626110a13660046158a4565b6001600160a01b03918216600090815260136020908152604080832093909416825291909152205460ff1690565b3480156110db57600080fd5b506105c260165481565b3480156110f157600080fd5b506105c26111003660046158ce565b612caf565b34801561111157600080fd5b5061058a6111203660046151ec565b612d9c565b34801561113157600080fd5b5061058a611140366004615554565b612ddd565b34801561115157600080fd5b506105626111603660046151a9565b612e6a565b34801561117157600080fd5b506105c26111803660046151a9565b612e93565b34801561119157600080fd5b5061058a6111a03660046151ec565b612f02565b60006111b082612f55565b92915050565b600083815260186020908152604080832085845260060190915290206009810154610100900460ff166111fc5760405163e707b04f60e01b815260040160405180910390fd5b600781015461120b8382615956565b341461122a576040516352a8207f60e11b815260040160405180910390fd5b611235823385612f95565b5050505050565b600080516020615d7483398151915261125481612fc9565b61125e8383612fd3565b505050565b6060600e80546112729061596d565b80601f016020809104026020016040519081016040528092919081815260200182805461129e9061596d565b80156112eb5780601f106112c0576101008083540402835291602001916112eb565b820191906000526020600020905b8154815290600101906020018083116112ce57829003601f168201915b5050505050905090565b6000611300826130da565b506000908152601260205260409020546001600160a01b031690565b816113268161313e565b61125e83836131f7565b6002600054036113875760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b6002600081815584815260186020908152604080832086845260060182528083208085015480855294909252909120805491929160ff166113db5760405163120458fb60e21b815260040160405180910390fd5b60006113e683612762565b905060006113f48683615956565b905080341015611417576040516352a8207f60e11b815260040160405180910390fd5b60018301546001600160581b031682111561147e5760165460008581526003602090815260408083203384529091529020546114549088906159a7565b111561147357604051630d3e027960e21b815260040160405180910390fd5b61147e843388613307565b611489853388612f95565b8034111561150c57600061149d82346159ba565b604051909150600090339083908381818185875af1925050503d80600081146114e2576040519150601f19603f3d011682016040523d82523d6000602084013e6114e7565b606091505b505090508061150957604051633c31275160e21b815260040160405180910390fd5b50505b50506001600055505050505050565b600080516020615d7483398151915261153381612fc9565b60145482141580611542575081155b15611560576040516302312abf60e31b815260040160405180910390fd5b6000828152601860205260409020600101541561159057604051632f5b1a7b60e01b815260040160405180910390fd5b6000828152601860205260408120818155600181018290556002810182905560038101829055906115c4600483018261502e565b6115d260058301600061502e565b5050601480549060006115e4836159cd565b91905055505050565b6116386040518060e00160405280600081526020016000815260200160008152602001600081526020016000815260200160006001600160a01b031681526020016000151581525090565b50600090815260066020908152604091829020825160e0810184528154815260018201549281019290925260028101549282019290925260038201546060820152600482015460808201526005909101546001600160a01b03811660a0830152600160a01b900460ff16151560c082015290565b600080516020615d748339815191526116c481612fc9565b6116cd82600555565b5050565b6117326040518061016001604052806000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b5060009182526018602090815260408084209284526006928301825292839020835161016081018552815481526001820154928101929092526002810154938201939093526003830154606082015260048301546080820152600583015460a08201529082015460c0820152600782015460e082015260088201546101008083019190915260099092015460ff8082161515610120840152929004909116151561014082015290565b826001600160a01b03811633146117f5576117f53361313e565b611800848484613343565b50505050565b6000600080516020615d7483398151915261182081612fc9565b6014548614158061182f575085155b1561184d576040516302312abf60e31b815260040160405180910390fd5b8460000361186e57604051635d90204f60e01b815260040160405180910390fd5b60008681526018602052604081206001810180549192918290611890906159e4565b91829055509050600060068301816118a96001856159ba565b815260200190815260200160002090506000600183116118cd5783600201546118e1565b816005015482600401546118e191906159a7565b9050600060016118f18b846159a7565b6118fb91906159ba565b90508085600301819055506040518061016001604052808581526020018c815260200160008152602001600081526020018381526020018b8152602001600081526020018a815260200189815260200160001515815260200160001515815250856006016000868152602001908152602001600020600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004015560a0820151816005015560c0820151816006015560e0820151816007015561010082015181600801556101208201518160090160006101000a81548160ff0219169083151502179055506101408201518160090160016101000a81548160ff021916908315150217905550905050839650505050505050949350505050565b6000828152600d602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046bffffffffffffffffffffffff16928201929092528291611aa0575060408051808201909152600c546001600160a01b0381168252600160a01b90046bffffffffffffffffffffffff1660208201525b602081015160009061271090611ac4906bffffffffffffffffffffffff1687615956565b611ace9190615a13565b915196919550909350505050565b6000828152600a6020526040902060010154611af781612fc9565b61125e83836133bb565b600080516020615d74833981519152611b1981612fc9565b821580611b27575060145483115b15611b455760405163c5d6748560e01b815260040160405180910390fd5b60008381526018602052604090206005016118008382615a6d565b600080516020615d74833981519152611b7881612fc9565b60008581526018602090815260408083208784526006019091529020611b9d8161345d565b611ba6816134ae565b6003810154600582015460008281526006602081905260409091205490840154611bd091906159a7565b1115611bef57604051633b3c591f60e01b815260040160405180910390fd5b611bfa818686613514565b50505050505050565b6001600160a01b0381163314611c815760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c660000000000000000000000000000000000606482015260840161137e565b6116cd8282613638565b6000611c96826136bb565b6000828152600260205260408120805490916101009091046001600160501b03169003611cd45754600160581b90046001600160501b031692915050565b8054600160581b90046001600160501b0316611cef846136e7565b10611cfd5750600092915050565b80544290611d22906001600160501b03600160581b8204811691610100900416615b2d565b6001600160501b0316611d3591906159ba565b9392505050565b611d4461371a565b600260005403611d965760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161137e565b600260009081556040514791907f000000000000000000000000672bfe35158f490f40dab3bc9f9c08f70e2094e76001600160a01b03169083908381818185875af1925050503d8060008114611e08576040519150601f19603f3d011682016040523d82523d6000602084013e611e0d565b606091505b5050905080611e2f57604051631d42c86760e21b815260040160405180910390fd5b50506001600055565b826001600160a01b0381163314611e5257611e523361313e565b611800848484613774565b600080516020615d74833981519152611e7581612fc9565b60008381526018602090815260408083208584526006019091529020611e9a8161345d565b611ea3816134ae565b611800816002015461378f565b600082815260186020908152604080832084845260060190915290206003810154611eda8161385e565b6000818152600660205260409020600501546001600160a01b0316801561123557600082815260066020526040902054611f15848383613933565b505050505050565b600080516020615d74833981519152611f3581612fc9565b611800848484613967565b600080516020615d74833981519152611f5881612fc9565b601761125e8382615a6d565b6000818152601060205260408120546001600160a01b0316806111b05760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e2049440000000000000000604482015260640161137e565b6000611fd482613a7f565b600082815260066020526040902060028101546001820154611d3591906159a7565b60186020526000908152604090208054600182015460028301546003840154600485018054949593949293919261202c9061596d565b80601f01602080910402602001604051908101604052809291908181526020018280546120589061596d565b80156120a55780601f1061207a576101008083540402835291602001916120a5565b820191906000526020600020905b81548152906001019060200180831161208857829003601f168201915b5050505050908060050180546120ba9061596d565b80601f01602080910402602001604051908101604052809291908181526020018280546120e69061596d565b80156121335780601f1061210857610100808354040283529160200191612133565b820191906000526020600020905b81548152906001019060200180831161211657829003601f168201915b5050505050905086565b6000600080516020615d7483398151915261215781612fc9565b6121618787613aab565b8460000361218257604051635d90204f60e01b815260040160405180910390fd5b600087815260186020908152604080832089845260060190915290206121a7816134ae565b80600501548682600601546121bc91906159a7565b11156121db57604051633b3c591f60e01b815260040160405180910390fd5b60006121e8878787613b12565b905080826003018190555087897f6bb0b0603b5b6765f12d84f365201bbd0d6d673120c0422e47f44372317c04018360405161222691815260200190565b60405180910390a398975050505050505050565b600080516020615d7483398151915261225281612fc9565b60145483141580612261575082155b1561227f576040516302312abf60e31b815260040160405180910390fd5b600083815260186020526040902060018101548314158061229e575082155b156122bc5760405163073797b960e21b815260040160405180910390fd5b60008381526006808301602052604090912090810154156122f057604051632f5b1a7b60e01b815260040160405180910390fd5b6122f98161345d565b612302816134ae565b600184111561232e57806005015482600301600082825461232391906159ba565b909155506123399050565b600282015460038301555b60008481526006808401602052604082208281556001808201849055600282018490556003820184905560048201849055600582018490559181018390556007810183905560088101839055600901805461ffff19169055830180549161239f836159cd565b91905055505050505050565b60006001600160a01b0382166124295760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f74206120766160448201527f6c6964206f776e65720000000000000000000000000000000000000000000000606482015260840161137e565b506001600160a01b031660009081526011602052604090205490565b61244d61371a565b6124576000613b90565b565b60008681526018602090815260408083208884526006019091529020600981015460ff1661249a5760405163261a1a1d60e11b815260040160405180910390fd5b3360009081526008602090815260408083208a84528252808320898452909152902054846124c887836159a7565b11156124e75760405163328c427360e11b815260040160405180910390fd5b61252733868a8a88888080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061296292505050565b612544576040516360cea48b60e01b815260040160405180910390fd5b60088201546125539087615956565b3414612572576040516352a8207f60e11b815260040160405180910390fd5b61257e33898989613be2565b612589823388612f95565b5050505050505050565b600080516020615d748339815191526125ab81612fc9565b6002600054036125fd5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161137e565b600260009081558381526018602090815260408083208584526006019091529020600381015461262c81613c6f565b50506001600055505050565b600080516020615d7483398151915261265081612fc9565b6116cd82613dc4565b600080516020615d7483398151915261267181612fc9565b506000908152600d6020526040812055565b6000600080516020615d7483398151915261269d81612fc9565b6126a78888613aab565b60008881526018602090815260408083208a845260060190915290206126cc816134ae565b60006126da88888888613dff565b9050808260020181905550888a7fe91037e9a64d5a33b6276c52d32545ac65d9b04c62ead9c3caebf199be5c1fb08360405161271891815260200190565b60405180910390a39998505050505050505050565b60008181526006602052604081206004015481428211156127575761275242836159ba565b61275a565b60005b949350505050565b600061276d826136bb565b600082815260026020526040812090612785846136e7565b8254909150600160581b90046001600160501b031681106127b45750600101546001600160581b031692915050565b60018201546000906127d690600160b01b90046001600160501b031683615a13565b60018401549091506000906127fb90600160581b90046001600160581b031683615956565b845490915061281b908290600160a81b90046001600160581b03166159ba565b9695505050505050565b6060600f80546112729061596d565b600080516020615d7483398151915261284c81612fc9565b50601655565b8161285c8161313e565b61125e8383614010565b600080516020615d7483398151915261287e81612fc9565b6128888484613aab565b600084815260186020908152604080832086845260060190915290206128ad816134ae565b600901805460ff191692151592909217909155505050565b600080516020615d748339815191526128dd81612fc9565b6128e76000600c55565b50565b836001600160a01b0381163314612904576129043361313e565b6112358585858561401b565b600080516020615d7483398151915261292881612fc9565b6129328585613aab565b60008581526018602090815260408083208784526006019091529020612957816134ae565b611f15818585612f95565b6040516bffffffffffffffffffffffff19606087901b16602082015260348101859052605481018490526074810183905260009081906094016040516020818303038152906040528051906020012090506129c08360075483614094565b979650505050505050565b6000818152601060205260409020546060906001600160a01b0316612a03576040516307ed98ed60e31b815260040160405180910390fd5b600060178054612a129061596d565b80601f0160208091040260200160405190810160405280929190818152602001828054612a3e9061596d565b8015612a8b5780601f10612a6057610100808354040283529160200191612a8b565b820191906000526020600020905b815481529060010190602001808311612a6e57829003601f168201915b505050505090508051600003612b68576000612aa684612e93565b6000818152601860205260409020600501805491925090612ac69061596d565b80601f0160208091040260200160405190810160405280929190818152602001828054612af29061596d565b8015612b3f5780601f10612b1457610100808354040283529160200191612b3f565b820191906000526020600020905b815481529060010190602001808311612b2257829003601f168201915b505050505091508151600003612b6657505060408051602081019091526000815292915050565b505b80612b72846140aa565b604051602001612b83929190615b4d565b604051602081830303815290604052915050919050565b600260005403612bec5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161137e565b60026000908155828152601860209081526040808320848452600601909152902060030154612c1a816141ab565b5050600160005550565b6000828152600a6020526040902060010154612c3f81612fc9565b61125e8383613638565b600080516020615d74833981519152612c6181612fc9565b612c6b8484613aab565b60008481526018602090815260408083208684526006019091529020612c90816134ae565b60090180549215156101000261ff001990931692909217909155505050565b6000600080516020615d74833981519152612cc981612fc9565b6000601460008154612cda906159e4565b91829055509050600181118015612d11575060186000612cfb6001846159ba565b8152602001908152602001600020600101546000145b15612d2f576040516335f7682360e01b815260040160405180910390fd5b6000601881612d3f6001856159ba565b8152602001908152602001600020600301546001612d5d91906159a7565b6000838152601860205260409020838155600281018290556003810182905590915060048101612d8e878983615b7c565b5091935050505b5092915050565b600080516020615d74833981519152612db481612fc9565b600083815260186020908152604080832085845260060190915290206002015461180081614346565b612de561371a565b6001600160a01b038116612e615760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161137e565b6128e781613b90565b600081815260066020526040812060038101544210801590611d35575060040154421092915050565b600081600003612eb6576040516307ed98ed60e31b815260040160405180910390fd5b60015b6014548111612ee8576000818152601860205260409020600301548311612ee05792915050565b600101612eb9565b5060405163f706fc9f60e01b815260040160405180910390fd5b600080516020615d74833981519152612f1a81612fc9565b60008381526018602090815260408083208584526006019091529020612f3f8161345d565b612f48816134ae565b61180081600201546143d3565b60006001600160e01b031982166380ac58cd60e01b1480612f8657506001600160e01b03198216635b5e139f60e01b145b806111b057506111b082614486565b6000612fa18483614491565b905060005b8281101561123557612fc184612fbc83856159a7565b61452c565b600101612fa6565b6128e78133614546565b6127106bffffffffffffffffffffffff821611156130465760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b606482015260840161137e565b6001600160a01b03821661309c5760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c696420726563656976657200000000000000604482015260640161137e565b604080518082019091526001600160a01b039092168083526bffffffffffffffffffffffff9091166020909201829052600160a01b90910217600c55565b6000818152601060205260409020546001600160a01b03166128e75760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e2049440000000000000000604482015260640161137e565b6daaeb6d7670e522a718067333cd4e3b156128e757604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa1580156131ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131cf9190615c3c565b6128e757604051633b79c77360e21b81526001600160a01b038216600482015260240161137e565b600061320282611f64565b9050806001600160a01b0316836001600160a01b03160361326f5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b606482015260840161137e565b336001600160a01b038216148061328b575061328b81336110a1565b6132fd5760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c0000606482015260840161137e565b61125e83836145c6565b60008381526003602090815260408083206001600160a01b0386168452909152812080548392906133399084906159a7565b9091555050505050565b61334d3382614634565b6133b05760405162461bcd60e51b815260206004820152602e60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201526d1c881b9bdc88185c1c1c9bdd995960921b606482015260840161137e565b61125e8383836146b2565b6000828152600a602090815260408083206001600160a01b038516845290915290205460ff166116cd576000828152600a602090815260408083206001600160a01b03851684529091529020805460ff191660011790556134193390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6009810154610100900460ff161561348857604051631e386ed360e01b815260040160405180910390fd5b600981015460ff16156128e75760405163c2ef408160e01b815260040160405180910390fd5b6134cb816002015460009081526002602052604090205460ff1690565b156134e957604051630545584f60e11b815260040160405180910390fd5b6134f68160030154614866565b156128e757604051634936c2ef60e11b815260040160405180910390fd5b61351d83613a7f565b60008381526006602052604090206003810154158015906135415750600481015415155b1561355f5760405163292bb7cf60e21b815260040160405180910390fd5b62093a8083111561358357604051633ce3604b60e21b815260040160405180910390fd5b610e108210156135a6576040516363c0bec760e01b815260040160405180910390fd5b62093a808211156135ca5760405163fb8900e360e01b815260040160405180910390fd5b60006135d684426159a7565b905060006135e484836159a7565b6003840183905560048401819055604080518481526020810183905291925087917f511edb4a6af3416b7f150f186e558d42b05552ea1b9a9606f0ad477b0f32256c910160405180910390a2505050505050565b6000828152600a602090815260408083206001600160a01b038516845290915290205460ff16156116cd576000828152600a602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b8015806136c9575060015481115b156128e7576040516307aba75d60e11b815260040160405180910390fd5b60008181526002602052604081205461010090046001600160501b031680613710576000611d35565b611d3581426159ba565b600b546001600160a01b031633146124575760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161137e565b61125e838383604051806020016040528060008152506128ea565b613798816136bb565b6000818152600260205260408120805490916101009091046001600160501b031690036137d85760405163f6232b0760e01b815260040160405180910390fd5b805460ff16156137fb57604051630545584f60e11b815260040160405180910390fd5b805460ff1916600117808255604080516001600160501b03610100840481168252600160581b909304909216602083015283917f3dd6f7d6beabdcd7d826f806bc14ced3d89eee1a10fb91bf4ab62cb72096bfd691015b60405180910390a25050565b61386781613a7f565b61387081614897565b61388d5760405163f83bafdd60e01b815260040160405180910390fd5b60008181526006602052604090206005810154600160a01b900460ff16156138c857604051630dcc2dad60e11b815260040160405180910390fd5b600581018054600160a01b60ff60a01b19821617909155600182015482546040805192835260208301919091526001600160a01b039092169181019190915282907fa2579259b5a06a8f6ead1e02b398312c11af0121f9c9556cc0841916be0b7cb390606001613852565b600061393f8483614491565b905060005b828110156112355761395f8461395a83856159a7565b6148c0565b600101613944565b6127106bffffffffffffffffffffffff821611156139da5760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b606482015260840161137e565b6001600160a01b038216613a305760405162461bcd60e51b815260206004820152601b60248201527f455243323938313a20496e76616c696420706172616d65746572730000000000604482015260640161137e565b6040805180820182526001600160a01b0393841681526bffffffffffffffffffffffff92831660208083019182526000968752600d90529190942093519051909116600160a01b029116179055565b801580613a8d575060045481115b156128e7576040516391fce5a560e01b815260040160405180910390fd5b811580613ab9575060145482115b15613ad75760405163c5d6748560e01b815260040160405180910390fd5b801580613af4575060008281526018602052604090206001015481115b156116cd576040516332c099d760e21b815260040160405180910390fd5b600080600460008154613b24906159e4565b91829055506000818152600660209081526040918290208881556001810188905560028101879055825189815291820188905292935083917f327cb2e56a41786a1cfaae03a97e9ca3ecabbf9941aff17ed4f0a80b8fca0800910160405180910390a250949350505050565b600b80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b0384166000908152600860209081526040808320868452825280832085845290915281208054839290613c1d9084906159a7565b925050819055508183856001600160a01b03167f9cdcf2f7714cca3508c7f0110b04a90a80a3a8dd0e35de99689db74d28c5383e84604051613c6191815260200190565b60405180910390a450505050565b613c7881613a7f565b6000818152600660205260409020600481015415613ce65780600401544210613cb457604051634822878f60e11b815260040160405180910390fd5b611c208160040154613cc691906159ba565b421115613ce657604051634a915acf60e11b815260040160405180910390fd5b42600482015560058101805460ff60a01b198116600160a01b1790915560018201805460009091556001600160a01b03909116908115613d7a576000613d2c8383614a02565b905080613d7857826001600160a01b0316857f8d3e3ded3cadb12035d47e7502204f8ed462827897cea19d87edb5018f79f6a884604051613d6f91815260200190565b60405180910390a35b505b604080516001600160a01b03841681526020810183905285917f72a886201643b9489841df5cc56e0a993994e104f42a680bc0ff262187f47224910160405180910390a250505050565b60078190556040518181527f1b930366dfeaa7eb3b325021e4ae81e36527063452ee55b86c95f85b36f4c31c9060200160405180910390a150565b6000836001600160581b0316856001600160581b03161080613e3b57506001600160581b038316613e308587615c59565b6001600160581b0316105b15613e5957604051638496243f60e01b815260040160405180910390fd5b6000600160008154613e6a906159e4565b9182905550600081815260026020526040812080546001600160581b03808b16600160a81b0274ffffffffffffffffffffffffffffffffffffffffff9092169190911782556001820180546001600160501b038916600160b01b810275ffffffffffffffffffffffffffffffffffffffffffff8c8616600160581b027fffffffffffffffffffff00000000000000000000000000000000000000000000909416958e1695909517929092179390931617905592935091613f45613f2d898b615c59565b6001600160581b0316886001600160581b0316614a65565b613f4f9190615956565b905080600003613f7257604051638496243f60e01b815260040160405180910390fd5b6001600160501b03811115613f9a576040516317bb7d4d60e01b815260040160405180910390fd5b81547fffffffffffffffffffffff00000000000000000000ffffffffffffffffffffff16600160581b6001600160501b038316021782556040518381527ffe097cec24864832ed02f5d4830bf672deb9ef76ccbe80a6b9f29bc88cef92d89060200160405180910390a150909695505050505050565b6116cd338383614a9c565b6140253383614634565b6140885760405162461bcd60e51b815260206004820152602e60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201526d1c881b9bdc88185c1c1c9bdd995960921b606482015260840161137e565b61180084848484614b6a565b6000826140a18584614be8565b14949350505050565b6060816000036140d15750506040805180820190915260018152600360fc1b602082015290565b8160005b81156140fb57806140e5816159e4565b91506140f49050600a83615a13565b91506140d5565b60008167ffffffffffffffff81111561411657614116615358565b6040519080825280601f01601f191660200182016040528015614140576020820181803683370190505b5090505b841561275a576141556001836159ba565b9150614162600a86615c79565b61416d9060306159a7565b60f81b81838151811061418257614182615c8d565b60200101906001600160f81b031916908160001a9053506141a4600a86615a13565b9450614144565b6141b481613a7f565b6141bd81612e6a565b6141da576040516372a5c90560e11b815260040160405180910390fd5b6000818152600660205260409020600181015460058201546001600160a01b0316338190036142555761420d34836159a7565b600184015533847f07d37c2e9a86e2d409bb7091df87d2f7e11e429778143a2e963bf4aa35b4753261423f34866159a7565b60405190815260200160405180910390a3611800565b600283015461426490836159a7565b34101561428457604051635069375b60e11b815260040160405180910390fd5b34600184018190556005840180546001600160a01b031916339081179091556040519182529085907f07d37c2e9a86e2d409bb7091df87d2f7e11e429778143a2e963bf4aa35b475329060200160405180910390a36001600160a01b038116156118005760006142f48284614a02565b90508061123557816001600160a01b0316857f8d3e3ded3cadb12035d47e7502204f8ed462827897cea19d87edb5018f79f6a88560405161433791815260200190565b60405180910390a35050505050565b61434f816136bb565b60008181526002602052604090205460ff1661437e5760405163120458fb60e21b815260040160405180910390fd5b60008181526002602052604090819020805460ff191690555181907fff6385d17288634260669ad420ea388da7135ceaad9f3bed87b4b3d8461f01d8906143c89042815260200190565b60405180910390a250565b6143dc816136bb565b6000818152600260205260409020805460ff161561440d57604051630545584f60e11b815260040160405180910390fd5b805460016affffffffffffffffffffff19909116610100426001600160501b03908116820260ff191692909217929092178084556040805193820483168452600160581b909104909116602083015283917f3dd6f7d6beabdcd7d826f806bc14ced3d89eee1a10fb91bf4ab62cb72096bfd69101613852565b60006111b082614c35565b6000816000036144b457604051636f9ebeaf60e01b815260040160405180910390fd5b600683015460058401546144c884836159a7565b11156144e757604051633b3c591f60e01b815260040160405180910390fd5b6144f183826159a7565b8460060181905550826015600082825461450b91906159a7565b909155505060048401546000906145239083906159a7565b95945050505050565b6116cd828260405180602001604052806000815250614c5a565b6000828152600a602090815260408083206001600160a01b038516845290915290205460ff166116cd57614584816001600160a01b03166014614cd8565b61458f836020614cd8565b6040516020016145a0929190615ca3565b60408051601f198184030181529082905262461bcd60e51b825261137e91600401615196565b600081815260126020526040902080546001600160a01b0319166001600160a01b03841690811790915581906145fb82611f64565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008061464083611f64565b9050806001600160a01b0316846001600160a01b0316148061468757506001600160a01b0380821660009081526013602090815260408083209388168352929052205460ff165b8061275a5750836001600160a01b03166146a0846112f5565b6001600160a01b031614949350505050565b826001600160a01b03166146c582611f64565b6001600160a01b0316146147415760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201527f6f776e6572000000000000000000000000000000000000000000000000000000606482015260840161137e565b6001600160a01b0382166147a35760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161137e565b6147ae6000826145c6565b6001600160a01b03831660009081526011602052604081208054600192906147d79084906159ba565b90915550506001600160a01b03821660009081526011602052604081208054600192906148059084906159a7565b909155505060008181526010602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6000818152600660205260408120600481015415801590611d35575060050154600160a01b900460ff161592915050565b6000818152600660205260408120600481015415801590611d3557506004015442101592915050565b6001600160a01b0382166149165760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161137e565b6000818152601060205260409020546001600160a01b03161561497b5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161137e565b6001600160a01b03821660009081526011602052604081208054600192906149a49084906159a7565b909155505060008181526010602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b600080836001600160a01b03168360055490604051600060405180830381858888f193505050503d8060008114614a55576040519150601f19603f3d011682016040523d82523d6000602084013e614a5a565b606091505b509095945050505050565b60008215614a935781614a796001856159ba565b614a839190615a13565b614a8e9060016159a7565b611d35565b60009392505050565b816001600160a01b0316836001600160a01b031603614afd5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161137e565b6001600160a01b03838116600081815260136020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b614b758484846146b2565b614b8184848484614e81565b6118005760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606482015260840161137e565b600081815b8451811015614c2d57614c1982868381518110614c0c57614c0c615c8d565b6020026020010151614fca565b915080614c25816159e4565b915050614bed565b509392505050565b60006001600160e01b0319821663152a902d60e11b14806111b057506111b082614ff9565b614c6483836148c0565b614c716000848484614e81565b61125e5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606482015260840161137e565b60606000614ce7836002615956565b614cf29060026159a7565b67ffffffffffffffff811115614d0a57614d0a615358565b6040519080825280601f01601f191660200182016040528015614d34576020820181803683370190505b509050600360fc1b81600081518110614d4f57614d4f615c8d565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110614d7e57614d7e615c8d565b60200101906001600160f81b031916908160001a9053506000614da2846002615956565b614dad9060016159a7565b90505b6001811115614e32577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110614dee57614dee615c8d565b1a60f81b828281518110614e0457614e04615c8d565b60200101906001600160f81b031916908160001a90535060049490941c93614e2b816159cd565b9050614db0565b508315611d355760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161137e565b60006001600160a01b0384163b15614fc257604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290614ec5903390899088908890600401615d24565b6020604051808303816000875af1925050508015614f00575060408051601f3d908101601f19168201909252614efd91810190615d56565b60015b614fa8573d808015614f2e576040519150601f19603f3d011682016040523d82523d6000602084013e614f33565b606091505b508051600003614fa05760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606482015260840161137e565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061275a565b50600161275a565b6000818310614fe6576000828152602084905260409020611d35565b6000838152602083905260409020611d35565b60006001600160e01b03198216637965db0b60e01b14806111b057506301ffc9a760e01b6001600160e01b03198316146111b0565b50805461503a9061596d565b6000825580601f1061504a575050565b601f0160209004906000526020600020908101906128e791905b808211156150785760008155600101615064565b5090565b6001600160e01b0319811681146128e757600080fd5b6000602082840312156150a457600080fd5b8135611d358161507c565b6000806000606084860312156150c457600080fd5b505081359360208301359350604090920135919050565b80356001600160a01b03811681146150f257600080fd5b919050565b80356bffffffffffffffffffffffff811681146150f257600080fd5b6000806040838503121561512657600080fd5b61512f836150db565b915061513d602084016150f7565b90509250929050565b60005b83811015615161578181015183820152602001615149565b50506000910152565b60008151808452615182816020860160208601615146565b601f01601f19169290920160200192915050565b602081526000611d35602083018461516a565b6000602082840312156151bb57600080fd5b5035919050565b600080604083850312156151d557600080fd5b6151de836150db565b946020939093013593505050565b600080604083850312156151ff57600080fd5b50508035926020909101359150565b600061016082019050825182526020830151602083015260408301516040830152606083015160608301526080830151608083015260a083015160a083015260c083015160c083015260e083015160e0830152610100808401518184015250610120808401516152818285018215159052565b5050610140928301511515919092015290565b6000806000606084860312156152a957600080fd5b6152b2846150db565b95602085013595506040909401359392505050565b6000806000606084860312156152dc57600080fd5b6152e5846150db565b92506152f3602085016150db565b9150604084013590509250925092565b6000806000806080858703121561531957600080fd5b5050823594602084013594506040840135936060013592509050565b6000806040838503121561534857600080fd5b8235915061513d602084016150db565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561539757615397615358565b604052919050565b600067ffffffffffffffff8311156153b9576153b9615358565b6153cc601f8401601f191660200161536e565b90508281528383830111156153e057600080fd5b828260208301376000602084830101529392505050565b600082601f83011261540857600080fd5b611d358383356020850161539f565b6000806040838503121561542a57600080fd5b82359150602083013567ffffffffffffffff81111561544857600080fd5b615454858286016153f7565b9150509250929050565b60008060006060848603121561547357600080fd5b83359250615483602085016150db565b9150615491604085016150f7565b90509250925092565b6000602082840312156154ac57600080fd5b813567ffffffffffffffff8111156154c357600080fd5b61275a848285016153f7565b86815285602082015284604082015283606082015260c0608082015260006154fa60c083018561516a565b82810360a084015261550c818561516a565b9998505050505050505050565b600080600080600060a0868803121561553157600080fd5b505083359560208501359550604085013594606081013594506080013592509050565b60006020828403121561556657600080fd5b611d35826150db565b60008060008060008060a0878903121561558857600080fd5b86359550602087013594506040870135935060608701359250608087013567ffffffffffffffff808211156155bc57600080fd5b818901915089601f8301126155d057600080fd5b8135818111156155df57600080fd5b8a60208260051b85010111156155f457600080fd5b6020830194508093505050509295509295509295565b80356001600160581b03811681146150f257600080fd5b60008060008060008060c0878903121561563a57600080fd5b86359550602087013594506156516040880161560a565b935061565f6060880161560a565b925061566d6080880161560a565b915060a08701356001600160501b038116811461568957600080fd5b809150509295509295509295565b80151581146128e757600080fd5b600080604083850312156156b857600080fd5b6156c1836150db565b915060208301356156d181615697565b809150509250929050565b6000806000606084860312156156f157600080fd5b8335925060208401359150604084013561570a81615697565b809150509250925092565b6000806000806080858703121561572b57600080fd5b615734856150db565b9350615742602086016150db565b925060408501359150606085013567ffffffffffffffff81111561576557600080fd5b8501601f8101871361577657600080fd5b6157858782356020840161539f565b91505092959194509250565b600080600080608085870312156157a757600080fd5b84359350602085013592506157be604086016150db565b9396929550929360600135925050565b600080600080600060a086880312156157e657600080fd5b6157ef866150db565b945060208087013594506040870135935060608701359250608087013567ffffffffffffffff8082111561582257600080fd5b818901915089601f83011261583657600080fd5b81358181111561584857615848615358565b8060051b915061585984830161536e565b818152918301840191848101908c84111561587357600080fd5b938501935b8385101561589157843582529385019390850190615878565b8096505050505050509295509295909350565b600080604083850312156158b757600080fd5b6158c0836150db565b915061513d602084016150db565b600080602083850312156158e157600080fd5b823567ffffffffffffffff808211156158f957600080fd5b818501915085601f83011261590d57600080fd5b81358181111561591c57600080fd5b86602082850101111561592e57600080fd5b60209290920196919550909350505050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176111b0576111b0615940565b600181811c9082168061598157607f821691505b6020821081036159a157634e487b7160e01b600052602260045260246000fd5b50919050565b808201808211156111b0576111b0615940565b818103818111156111b0576111b0615940565b6000816159dc576159dc615940565b506000190190565b6000600182016159f6576159f6615940565b5060010190565b634e487b7160e01b600052601260045260246000fd5b600082615a2257615a226159fd565b500490565b601f82111561125e57600081815260208120601f850160051c81016020861015615a4e5750805b601f850160051c820191505b81811015611f1557828155600101615a5a565b815167ffffffffffffffff811115615a8757615a87615358565b615a9b81615a95845461596d565b84615a27565b602080601f831160018114615ad05760008415615ab85750858301515b600019600386901b1c1916600185901b178555611f15565b600085815260208120601f198616915b82811015615aff57888601518255948401946001909101908401615ae0565b5085821015615b1d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6001600160501b03818116838216019080821115612d9557612d95615940565b60008351615b5f818460208801615146565b835190830190615b73818360208801615146565b01949350505050565b67ffffffffffffffff831115615b9457615b94615358565b615ba883615ba2835461596d565b83615a27565b6000601f841160018114615bdc5760008515615bc45750838201355b600019600387901b1c1916600186901b178355611235565b600083815260209020601f19861690835b82811015615c0d5786850135825560209485019460019092019101615bed565b5086821015615c2a5760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b600060208284031215615c4e57600080fd5b8151611d3581615697565b6001600160581b03828116828216039080821115612d9557612d95615940565b600082615c8857615c886159fd565b500690565b634e487b7160e01b600052603260045260246000fd5b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351615cdb816017850160208801615146565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351615d18816028840160208801615146565b01602801949350505050565b60006001600160a01b0380871683528086166020840152508360408301526080606083015261281b608083018461516a565b600060208284031215615d6857600080fd5b8151611d358161507c56fed8acb51ff3d48f690a25887aaf234c4ae5a66ab9839243cd8e2b639cade0663ba26469706673582212201f7cc9ec80d1685ada26501b77831cfea9e78c90f16d5fc2c5bb97a1d558d08264736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000672bfe35158f490f40dab3bc9f9c08f70e2094e7
-----Decoded View---------------
Arg [0] : shareholderAddress_ (address): 0x672bFe35158F490F40dab3Bc9F9c08f70e2094E7
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000672bfe35158f490f40dab3bc9f9c08f70e2094e7
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ 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.