Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Initialize | 17264704 | 700 days ago | IN | 0 ETH | 0.04523855 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
Collection
Compiler Version
v0.8.18+commit.87f61d96
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.13; /** █████ ╨████████▀ ▌██████▌┌──└▌█████ █████ ▐▀█████ ╫█████ █████ ╙████▌ ▄▀█████ ▀ █████▌ ╟████ █████ █████ ⌐ █████▄ ▌ █████ ╟████ █████ █████ ▌ █████ ╫ █████ ╟████ █████ ▄████ ▌ █████ ╓─ ▀█████ ╟████ █████╥╥╥╥╥▄███ ▐ ▓█████ ▌ █████▄ ╟████ █████ ─█████ ▀ █████▄ ▓ █████ ╟████ █████ █████ ▓ █████ ▄ █████ ╟████ ▓▌ █████ █████▌ ╫ └█████ ╓▌ ██████ ╟████ █▌ █████ █████▀ ╓▀ ██████ ╓█ █████▄ ╟████ ███▌ █████ █████ ▄█ █████▄ ,█████▌ ,███████ ▄██████▄ ,█████▌ ███████ █████╨ ,█████▌ ,███████ └└└└└└└└ └└└└└└└└└└ └└└└└└└└└└┌─┌└└└└└└└ └└└└└└└└└└──└└─ └└└└└└└─ └└└└└└└└└└ */ import {AccessControlEnumerable} from "openzeppelin-contracts/access/AccessControlEnumerable.sol"; import {Ownable} from "openzeppelin-contracts/access/Ownable.sol"; import {ERC721AUpgradeable} from "erc721a/ERC721AUpgradeable.sol"; import {ECDSA} from "openzeppelin-contracts/utils/cryptography/ECDSA.sol"; import {Initializable} from "openzeppelin-contracts-upgradeable/proxy/utils/Initializable.sol"; import {IERC2981} from "openzeppelin-contracts/interfaces/IERC2981.sol"; import {OperatorFiltererUpgradeable} from "operator-filter-registry/upgradeable/OperatorFiltererUpgradeable.sol"; import {IAlbaDelegate} from "./IAlbaDelegate.sol"; import {IPaymentSplitter} from "./IPaymentSplitter.sol"; import {CollectionConfig, SaleConfig, RoyaltyConfig, SaleType} from "./Types.sol"; /** * @title Collection * @notice The Alba Collection contract. * @dev This contract uses `ERC721AUpgradeable`, but that is because it is deployed as a minimal proxy * to a base collection for implementation. This contract itself is *not* upgradeable. */ contract Collection is Initializable, ERC721AUpgradeable, OperatorFiltererUpgradeable, Ownable, AccessControlEnumerable { bytes32 public constant ROLE_MANAGER = keccak256("ROLE_MANAGER"); bytes32 public constant ROLE_ARTIST = keccak256("ROLE_ARTIST"); // Differentiate signature type uint8 private constant SIG_TYPE_RESERVED = 0xFF; error InvalidConfiguration(); error InvalidPayment(); error TooManyMintsRequested(); error InsufficientTokensRemanining(); error SaleNotActive(); error NoRebateAvailable(); error UnknownToken(); error Unauthorized(); error InvalidRoyaltyPercentage(); error PaymentFailed(); error AuctionStillActive(); error HoFNotAvailable(); event SaleFinished(); event RebateClaimed(address claimer, address recipient, uint256 amount); event PaymentFlushed(uint256 amount); event PaymentsClaimed(address user); event AlbaEjected(); IAlbaDelegate public albaDelegate; SaleConfig public saleConfig; CollectionConfig public collectionConfig; RoyaltyConfig public royaltyConfig; // Location of primary sale payment splitter. address payable public paymentSplitter; // Location of secondary sale payment splitter. address payable public paymentSplitterRoyalties; /* Mint mechanics */ // Flag to indicate that the sale has been closed. // This is different to selling out or the auction ending. // It is only used when the sale is explcitly closed by the artist. bool public isSaleClosed; // Keeps track of the number of reserved tokens minted (keyed by message hash) mapping(bytes32 => uint256) private numReserveMintedFrom; // Tracks the total number of reserve mints to ensure we don't mint more than the max. // This allows us to overallocate reserves if we want to. uint256 public numReservedMinted; // Tracks the number of retained tokens minted by the artist. uint256 public numRetainedMinted; // Tracks if the Hall of Fame piece has been minted. bool public isHofMinted; /* Auction specific properties */ // Final price used for rebates. uint256 public finalSalePrice; // Number of _potential_ 'rebate mints' i.e. mints which might be eligible for a rebate. uint256 private numRebateMints; // Purchase prices used to compute rebates. mapping(address => uint256[]) public mintPrices; // Modifiers modifier tokenExists(uint256 tokenId) { if (!_exists(tokenId)) revert UnknownToken(); _; } modifier managerOrArtist() { if (!hasRole(ROLE_MANAGER, msg.sender) && !hasRole(ROLE_ARTIST, msg.sender)) revert Unauthorized(); _; } modifier onlyArtist() { if (!hasRole(ROLE_ARTIST, msg.sender)) revert Unauthorized(); _; } modifier artistOrAlbaReceiver() { if (!hasRole(ROLE_ARTIST, msg.sender) && msg.sender != albaDelegate.getAlbaFeeReceiver()) revert Unauthorized(); _; } modifier onlyManager() { if (!hasRole(ROLE_MANAGER, msg.sender)) revert Unauthorized(); _; } modifier mintingActive() { if (isSaleClosed || block.timestamp < saleConfig.startTime) revert SaleNotActive(); _; } modifier onlyAlbaReceiver() { if (msg.sender != albaDelegate.getAlbaFeeReceiver()) revert Unauthorized(); _; } function initialize( IAlbaDelegate _albaDelegate, CollectionConfig memory _config, SaleConfig memory _saleConfig, RoyaltyConfig memory _royaltyConfig, address albaManager, address artist ) public initializerERC721A initializer { __ERC721A_init(_config.name, _config.token); _setupRole(DEFAULT_ADMIN_ROLE, albaManager); _setupRole(ROLE_MANAGER, albaManager); _setupRole(ROLE_ARTIST, artist); albaDelegate = _albaDelegate; collectionConfig = _config; saleConfig = _saleConfig; royaltyConfig = _royaltyConfig; _validateSaleConfig(saleConfig); // Split all sales between the artist and Alba. address albaReceiver = _albaDelegate.getAlbaFeeReceiver(); _setupPrimarySplitter(artist, albaReceiver, _royaltyConfig); _setupSecondarySplitter(artist, albaReceiver, _royaltyConfig); // If we are enforcing royalties, then we need to setup the operator filterer. // If the contract is deployed without royalties, this must be configured manually // in the registry at a later date. if (_royaltyConfig.enforceRoyalties) { __OperatorFilterer_init(_albaDelegate.operatorFilterSubscription(), true); } // Make the artist the owner of the contract. // Note that this leaves in place the manager role for the Alba // platform to continue to manage the contract. This will let // Alba make changes to the contract in the future, such as replacing // the delegate to fix issues or change things like the way on-chain // HTML is built. // To remove Alba's managaer role, see `assumeTotalOwnership`. _transferOwnership(artist); } // Minting /** * @notice Mint a number of tokens to a user. * @param collectionId The collection ID. * @param user The user to mint to. * @param num The number of tokens to mint. * @param nonce The nonce to use for the signature. * @param signature The signature to verify. * @dev We use a signature to verify the mints. This gives us an opportunity to * prevent bots. */ function mint( bytes16 collectionId, address user, uint16 num, uint32 nonce, bytes calldata signature ) external payable mintingActive { // Max mints do not include reserved mints. uint256 publicMinted = _salePiecesMinted() - numReservedMinted; uint256 publicLimit = saleConfig.maxSalePieces - saleConfig.numReserved; if (publicMinted + num > publicLimit) revert InsufficientTokensRemanining(); albaDelegate.verifyMint(collectionId, user, num, nonce, signature); _mintInternal({user: user, num: num, isReserve: false}); } function mintReserved( bytes16 collectionId, address user, uint16 num, uint16 maxMints, uint32 nonce, bytes calldata signature ) external payable mintingActive { // Ensure signature is valid bytes32 message = _reserveMessage(collectionId, user, maxMints, nonce); albaDelegate.verifyMintReserve(message, signature); if (num + numReserveMintedFrom[message] > maxMints) revert TooManyMintsRequested(); if (numReservedMinted + num > saleConfig.numReserved) revert InsufficientTokensRemanining(); if (_salePiecesMinted() + num > saleConfig.maxSalePieces) revert InsufficientTokensRemanining(); // Record how many reserved mints have been made from this address numReserveMintedFrom[message] += num; numReservedMinted += num; _mintInternal({user: user, num: num, isReserve: true}); } /** * @notice Mints tokens for the artist only. * @dev This does not call mintInternal because these mints are completely separate from the sale. * They can happen at any time, cost nothing, and are only limited by the number of tokens * in the configuration. */ function mintRetained(uint16 num) external onlyArtist { if (numRetainedMinted + num > saleConfig.numRetained) revert InsufficientTokensRemanining(); numRetainedMinted += num; _mint(msg.sender, num); } /** * @notice Mints the hall of fame piece. * This is a special piece for the Alba gallery, used to share and exhibit the work. * This can be called by Alba, even if the contract is fully owned by the artist. */ function mintHallOfFame(address to) external onlyAlbaReceiver { if (isHofMinted) { revert HoFNotAvailable(); } isHofMinted = true; _mint(to, 1); } /** * @dev Internal mint function. * This does the standard checks and records generic information about the sale. * It also controls the auction mechanics. * Callers must verify that the mint signature is valid before using this function. * Any extra money sent for the mints is kept by the contract, though will be returned * as part of the rebate if the rebate is enabled. We do this to avoid issues with * continuous auctions where the price may change between when the transaction is sent and * included in a block. * NOTE: It is important to understand that reserve mints can happen after the _auction_ * has finished. This means that mints _may_ happen after the final price is set. However, * reserve mints cannot _set_ the final price. */ function _mintInternal(address user, uint256 num, bool isReserve) private { uint256 price = _getPrice(); if (msg.value < num * price) revert InvalidPayment(); // We don't want to wait for all reserves to mint to 'sell out', as they may be // held for a long time. However, we still treat the mints the same as public ones // (i.e. eligible for rebate if applicable). if (!isReserve) { uint256 publicMinted = _salePiecesMinted() - numReservedMinted; uint256 publicPieceLimit = saleConfig.maxSalePieces - saleConfig.numReserved; // If the final price is not already set, then set it if we've sold out if (finalSalePrice == 0 && publicMinted + num == publicPieceLimit) { finalSalePrice = price; emit SaleFinished(); } } // If the auction has a rebate and the resting price has not been discovered, // record the price paid for each mint. // Record that these mints are 'rebate mints' so we know how much money // to flush later on. if (saleConfig.hasRebate && finalSalePrice == 0 && price > saleConfig.finalPrice) { for (uint256 i = 0; i < num; i++) { mintPrices[user].push(price); } numRebateMints += num; } // Do the mint _mint(user, num); // Send the payment on to the splitter. // If there is a rebate, the value will stay in the contract waiting to be claimed. // However, once the auction is finished, we know that the mint price is always // the final price, so we can send the payment on to the splitter immediately. This // removes the need for having the artist flush the payment more than once, and subsequently // we don't need to keep track of which mints are already accounted for in the flushing // process. // We send the payment directly if: // 1. There is no rebate on the sale // 2. The final price is not 0 (i.e. the sale has finished) // 3. The price paid is not the final price (i.e. the auction is still ongoing) // 4. The auction has finished - this case ensures we send value after the auction is there's no sellout. if (!saleConfig.hasRebate || finalSalePrice != 0 || price == saleConfig.finalPrice || _hasAuctionFinished()) { (bool success, ) = paymentSplitter.call{value: msg.value}(""); if (!success) revert PaymentFailed(); } } /** * @notice Returns the number of reserves used by the given user. */ function reservesUsed( bytes16 collectionId, address user, uint16 maxMints, uint32 nonce ) external view returns (uint256) { bytes32 message = _reserveMessage(collectionId, user, maxMints, nonce); return numReserveMintedFrom[message]; } /** * @notice Returns the message that is used for reserve mints. * @dev This can be used to verify signatures as well as check the number of mints used. * We prepend a type byte before the collectionID to ensure that we don't have any overlapping * signatures (without this the params may be identical to the public mint signature). This is * in place of the typed signature EIP which we should upgrade to ideally. */ function _reserveMessage( bytes16 collectionId, address user, uint16 maxMints, uint32 nonce ) internal view returns (bytes32) { return ECDSA.toEthSignedMessageHash( keccak256(abi.encodePacked(SIG_TYPE_RESERVED, collectionId, user, maxMints, nonce, block.chainid)) ); } // Auction functions /** * @notice Returns the number of pieces that have been minted in the sale. * This exludes the artist 'retained' mints, but does include the reserved mints. */ function _salePiecesMinted() internal view returns (uint256) { return totalSupply() - numRetainedMinted; } /** * @notice Returns true if the auction has finished. * Note that the auction finishing is not the same as the sale finishing. * The auction finishes when the price stops changing, but the sale can * continue after that indefinitely until stopped by the artist. */ function _hasAuctionFinished() internal view returns (bool) { return block.timestamp >= saleConfig.auctionEndTime; } function getPrice() external view returns (uint256) { return _getPrice(); } /** * @notice Returns the current price of the sale. * @dev Wrapper for different pricing strategies based on sale type. */ function _getPrice() internal view returns (uint256) { if (saleConfig.saleType == SaleType.FixedPrice) { return saleConfig.initialPrice; } if (block.timestamp <= saleConfig.startTime) { return saleConfig.initialPrice; } if (finalSalePrice != 0) { return finalSalePrice; } if (saleConfig.saleType == SaleType.TieredDutchAuction) { return _getPriceTieredDA(); } if (saleConfig.saleType == SaleType.ContinuousDutchAuction) { return _getPriceContinuousDA(); } revert InvalidConfiguration(); } /** * @notice Returns the current price of the sale using a tiered dutch auction pricing strategy. * @dev This works by computing the tier that the sale is currently in based on * the 'decay period', and then using that bucket to compute the price based on the amount * of decay per bucket. Note that the decay rate is defined as the number of basis points * from the original price, and does not change over time. * For example, a decay rate of 1000 bases points means that the price will decay by 10% of * the initial price per bucket. If the price starts at 1 ether, the price will hit 0 ether * after 10 buckets. */ function _getPriceTieredDA() internal view returns (uint256) { uint256 bucket = (block.timestamp - saleConfig.startTime) / saleConfig.decayPeriodSeconds; uint256 delta = (saleConfig.decayRateBasisPoints * bucket * saleConfig.initialPrice) / 10000; uint256 maxDelta = saleConfig.initialPrice - saleConfig.finalPrice; if (delta > maxDelta) { return saleConfig.finalPrice; } return saleConfig.initialPrice - delta; } /** * @notice Returns the current price of the sale using a continuous dutch auction pricing strategy. * @dev This works by computing the time elapsed since the start of the auction, and then interpolating * the price based on the initial price and the final price. The interpolation is linear. */ function _getPriceContinuousDA() internal view returns (uint256) { uint256 priceDifference = saleConfig.initialPrice - saleConfig.finalPrice; uint256 timeDifference = saleConfig.auctionEndTime - saleConfig.startTime; uint256 timeElapsed = block.timestamp - saleConfig.startTime; uint256 delta = (priceDifference * timeElapsed) / timeDifference; uint256 maxDelta = saleConfig.initialPrice - saleConfig.finalPrice; if (delta > maxDelta) { return saleConfig.finalPrice; } return saleConfig.initialPrice - delta; } /** * @notice Allows users to claim a rebate if applicable. * @dev Rebates are only available if the sale has a rebate, and if: * - The auction period has finished, or * - The sale has finished (sold out). * If the sale has finished, the rebate is calculated based on the final price paid. * otherwise, it's based on the final price of the auction. */ function claimRebate(address payable recipient) external { uint256 totalRebate = getRebateAmount(msg.sender); if (totalRebate == 0) { revert NoRebateAvailable(); } delete (mintPrices[msg.sender]); // External call, ensure rebate is marked as claimed before calling for reentrancy. (bool success, ) = recipient.call{value: totalRebate}(""); require(success, "Transfer failed"); emit RebateClaimed(msg.sender, recipient, totalRebate); } /** * @notice Returns the amount of rebate that a user is eligible for. */ function getRebateAmount(address user) public view returns (uint256) { // Auction not over yet and no sellout, means you can't claim yet // as we don't know the final price. if (!_hasAuctionFinished() && finalSalePrice == 0) { return 0; } uint256[] memory amountsPaid = mintPrices[user]; // We reuse this storage slot to indicate that the rebate has been claimed. if (amountsPaid.length == 0) { return 0; } uint256 restingPrice = finalSalePrice > 0 ? finalSalePrice : saleConfig.finalPrice; uint256 totalRebate = 0; for (uint256 i = 0; i < amountsPaid.length; i++) { if (amountsPaid[i] > restingPrice) { totalRebate += amountsPaid[i] - restingPrice; } } return totalRebate; } // ERC721 /// @notice Returns the URI for token metadata. function tokenURI(uint256 tokenId) public view override tokenExists(tokenId) returns (string memory) { return albaDelegate.tokenURI(tokenId, collectionConfig.slug); } function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) { super.setApprovalForAll(operator, approved); } function approve(address operator, uint256 tokenId) public payable override onlyAllowedOperatorApproval(operator) { super.approve(operator, tokenId); } function transferFrom(address from, address to, uint256 tokenId) public payable override onlyAllowedOperator(from) { super.transferFrom(from, to, tokenId); } function safeTransferFrom( address from, address to, uint256 tokenId ) public payable override onlyAllowedOperator(from) { super.safeTransferFrom(from, to, tokenId); } function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory data ) public payable override onlyAllowedOperator(from) { super.safeTransferFrom(from, to, tokenId, data); } // ERC165 function supportsInterface( bytes4 interfaceId ) public view virtual override(ERC721AUpgradeable, AccessControlEnumerable) returns (bool) { return ERC721AUpgradeable.supportsInterface(interfaceId) || AccessControlEnumerable.supportsInterface(interfaceId) || interfaceId == type(IERC2981).interfaceId; } // ERC2981 + Payments function royaltyInfo(uint256, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount) { royaltyAmount = (salePrice / 10000) * royaltyConfig.royaltyBasisPoints; receiver = paymentSplitterRoyalties; } /** * @notice Returns the amount of payments that can be claimed by the user. * @dev The uses msg.sender so can be called by the artist or by Alba. */ function availablePayments() public view returns (uint256) { return IPaymentSplitter(paymentSplitter).releasable(msg.sender) + IPaymentSplitter(paymentSplitterRoyalties).releasable(msg.sender); } /** * Setup the primary sales splitter. * @dev We create a splitter for a single user if there's no fee. This is less efficient than just using * the artist's address, but it provides consistent UX, and we'll be using this for charity splits even * if there's no Alba fee in the future. */ function _setupPrimarySplitter(address artist, address alba, RoyaltyConfig memory conf) internal { if (conf.albaPrimaryFeeBasisPoints == 0) { address[] memory payeesSingle = new address[](1); payeesSingle[0] = payable(artist); uint256[] memory sharesSingle = new uint256[](1); sharesSingle[0] = 10000; paymentSplitter = payable(albaDelegate.paymentSplitterFactory().deploy(payeesSingle, sharesSingle)); return; } address[] memory payees = new address[](2); payees[0] = payable(artist); payees[1] = payable(alba); uint256[] memory shares = new uint256[](2); shares[0] = 10000 - conf.albaPrimaryFeeBasisPoints; shares[1] = conf.albaPrimaryFeeBasisPoints; paymentSplitter = payable(albaDelegate.paymentSplitterFactory().deploy(payees, shares)); } /** * Setup the secondary sales splitter. * @dev Note that it is possible that the artist chooses to not _enforce_ royalties, but we still setup * a split contract in case they change that directly in the filter registry later on. */ function _setupSecondarySplitter(address artist, address alba, RoyaltyConfig memory conf) internal { if (conf.albaSecondaryFeeBasisPoints == 0) { // Otherwise, we need to create a single user splitter. address[] memory payeesSingle = new address[](1); payeesSingle[0] = payable(artist); uint256[] memory sharesSingle = new uint256[](1); sharesSingle[0] = 10000; paymentSplitterRoyalties = payable( albaDelegate.paymentSplitterFactory().deploy(payeesSingle, sharesSingle) ); return; } // Otherwise, we need to create a splitter for the artist and Alba. address[] memory payees = new address[](2); payees[0] = payable(artist); payees[1] = payable(alba); uint256[] memory shares = new uint256[](2); shares[0] = 10000 - conf.albaSecondaryFeeBasisPoints; shares[1] = conf.albaSecondaryFeeBasisPoints; paymentSplitterRoyalties = payable(albaDelegate.paymentSplitterFactory().deploy(payees, shares)); } // 721 On-chain Extensions /** * @notice Returns the seed of a token. * @dev The seed is computed from the seed of the batch in which the given * token was minted. */ function tokenSeed(uint256 tokenId) public view tokenExists(tokenId) returns (bytes32) { uint24 batchSeed = _ownershipOf(tokenId).extraData; return keccak256(abi.encodePacked(address(this), batchSeed, tokenId)); } /** * @notice Computes a pseudorandom seed for a mint batch. * @dev Even though this process can be gamed in principle, it is extremly * difficult to do so in practise. Therefore we can still rely on this to * derive fair seeds. */ function _computeBatchSeed(address to) private view returns (uint24) { return uint24( bytes3(keccak256(abi.encodePacked(block.timestamp, block.difficulty, blockhash(block.number - 1), to))) ); } /** * @dev sets the batch seed on mint. */ function _extraData( address from, address to, uint24 previousExtraData ) internal view virtual override returns (uint24) { // if minting, compute a batch seed if (from == address(0)) { return _computeBatchSeed(to); } // else return the current value return previousExtraData; } /** * @notice Returns the HTML to render a token. * @dev This includes all dependencies and the collection script to allow for rendering of the piece * directly in the browser, with no external dependencies. */ function tokenHTML(uint256 tokenId) public view tokenExists(tokenId) returns (string memory) { return string( albaDelegate.tokenHTML( collectionConfig.uuid, tokenId, tokenSeed(tokenId), collectionConfig.dependencies ) ); } // Admin functions /** * @notice Sets the delegate for this collection. */ function setDelegate(IAlbaDelegate newDelegate) external onlyManager { albaDelegate = newDelegate; } /** * @notice Sets the royalty percentage, in basis points */ function setRoyalyPercentage(uint16 newRoyaltyBasisPoints) external managerOrArtist { if (newRoyaltyBasisPoints > 10000) { revert InvalidRoyaltyPercentage(); } royaltyConfig.royaltyBasisPoints = newRoyaltyBasisPoints; } /** * @notice Validate a given sale config. * @dev Note that the validation here is minimal, and only checks for invariants which * would break the contract rather than things which are likely not desired. E.g. (1 second auctions). * We do this to allow for maximum flexibility with use cases in the future. * The Alba backend will do validation before deployment for those other cases. */ function _validateSaleConfig(SaleConfig memory sc) internal view { if (sc.numReserved > sc.maxSalePieces) revert InvalidConfiguration(); // Ensure the start time is not in the past. if (sc.startTime <= block.timestamp) { revert InvalidConfiguration(); } // Validation for fixed price if (sc.saleType == SaleType.FixedPrice) { if (sc.hasRebate || sc.auctionEndTime != 0) { revert InvalidConfiguration(); } } // Validation for auction config if (sc.saleType != SaleType.FixedPrice) { if (sc.auctionEndTime == 0 || sc.auctionEndTime <= sc.startTime) { revert InvalidConfiguration(); } if (sc.initialPrice <= sc.finalPrice) { revert InvalidConfiguration(); } if (sc.saleType == SaleType.TieredDutchAuction) { if (sc.decayRateBasisPoints == 0 || sc.decayRateBasisPoints > 10000) { revert InvalidConfiguration(); } } // Can't have only reserved pieces in an auction because reserves are not used // to set the final price. Must use fixed price sale for this. if (sc.numReserved >= sc.maxSalePieces) { revert InvalidConfiguration(); } } } /** * @notice Change the auction times for the sale. This can only be called before the * sale has started. This can be used to postpone the sale, or to change the auction * end time. * @param newStartTime The new start time for the sale. * @param newEndTime The new end time for the sale. This should be 0 for fixed price sales. */ function changeAuctionTimes(uint40 newStartTime, uint40 newEndTime) external managerOrArtist { // Ensure auction has not already started. if (block.timestamp >= saleConfig.startTime) { revert InvalidConfiguration(); } saleConfig.startTime = newStartTime; saleConfig.auctionEndTime = newEndTime; _validateSaleConfig(saleConfig); } /** * @notice Close the sale. * The auctionEndTime parameter of the config only describes when the price in * the auction will stop changing, but does not stop the sale from continuing. * This function can be called by the manager or the artist to stop the sale entirely. * Warning: this is permanent, and cannot be undone. * @dev We don't need to set the finalSalePrice here, because price will have always * settled at the auction end price. */ function closeSale() external managerOrArtist { if (block.timestamp < saleConfig.startTime) { revert SaleNotActive(); } // If the auction has an end time, then don't allow closing the sale until // that end time has been reached. if (block.timestamp < saleConfig.auctionEndTime) { revert AuctionStillActive(); } // Set the sale as closed. isSaleClosed = true; emit SaleFinished(); } /** * @notice Returns the amount of payments that can be flushed to the splitter. * Note that this is only applicable for rebate auctions which have finished. */ function flushablePayments() public view returns (uint256) { if (!saleConfig.hasRebate || !_hasAuctionFinished() || numRebateMints == 0) { return 0; } uint256 finalValue = finalSalePrice != 0 ? finalSalePrice : saleConfig.finalPrice; return numRebateMints * finalValue; } /** * @notice Allow the artist to flush the funds to the payment splitter. * @dev For FixedPrice sales, the payment is sent directly to the splitter on each mint. * For auctions, the payment is initially buffered in the contract so that rebates can be * claimed. We don't know the final price until a sell-out or the auction ends. * For simplicity we wait until the end of the auction to allow the artist to flush the funds. * At the end of the auction, any subsequent mints will be sent directly to the splitter as * we know the final price already. * Note that by the time the flush is called, the users may not have claimed their rebates. * So to ensure we don't flush too much, we need to store the number of 'rebateMints' i.e. * mints which have a *potential* to collect a rebate. We can't use the total number of mints * because some of these may have been sold at the final price, and therefore don't have a rebate, * and some may be free retained mints. */ function flushPaymentToSplitter() public managerOrArtist { // Fixed price sales push to splitter on each mint. if (saleConfig.saleType == SaleType.FixedPrice) { revert InvalidConfiguration(); } // For simplicity, we require that the auction has finished. // This ensures that either 'finalSalePrice' is set due to a sellout, OR // any remaining sales will be at the resting price. We therefore know that // futher mints are sent to the splitter directly, and we can flush based // on the number of (poential) 'rebate mints'. if (!_hasAuctionFinished()) { revert AuctionStillActive(); } if (numRebateMints == 0) { revert InvalidConfiguration(); // Close enough } uint256 finalValue = finalSalePrice != 0 ? finalSalePrice : saleConfig.finalPrice; uint256 totalValue = numRebateMints * finalValue; // Set the pending rebates to 0, so that we can't flush twice. numRebateMints = 0; (bool success, ) = paymentSplitter.call{value: totalValue}(""); if (!success) revert PaymentFailed(); emit PaymentFlushed(totalValue); } /** * @notice Convenience function to claim all payments. * @dev This can be used by both the artist and Alba to claim their payments. * When upgraded to 4.8.X, we can use the `releasable` function to check payments * for the specific caller rather than just checking the balance. */ function claimPayments() public artistOrAlbaReceiver { IPaymentSplitter splitter = IPaymentSplitter(paymentSplitter); IPaymentSplitter splitterRoyalties = IPaymentSplitter(paymentSplitterRoyalties); bool claimed = false; if (splitter.releasable(msg.sender) > 0) { IPaymentSplitter(paymentSplitter).release(payable(msg.sender)); claimed = true; } if (splitterRoyalties.releasable(msg.sender) > 0) { IPaymentSplitter(paymentSplitterRoyalties).release(payable(msg.sender)); claimed = true; } if (claimed) { emit PaymentsClaimed(msg.sender); } } /** * @notice Allow the artist to assume complete control of the contract. * The artist owns the contract at deployment time by default, but Alba * is retained as a manager to allow */ function assumeTotalOwnership() external onlyOwner { address currentManager = getRoleMember(ROLE_MANAGER, 0); // Make the artist the admin of all roles. _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); // Make the artist a manager. _grantRole(ROLE_MANAGER, msg.sender); // Revoke the existing manager from roles. _revokeRole(ROLE_MANAGER, currentManager); _revokeRole(DEFAULT_ADMIN_ROLE, currentManager); emit AlbaEjected(); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library ERC721AStorage { // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364). struct TokenApprovalRef { address value; } struct Layout { // ============================================================= // STORAGE // ============================================================= // The next token ID to be minted. uint256 _currentIndex; // The number of tokens burned. uint256 _burnCounter; // Token name string _name; // Token symbol string _symbol; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. // See {_packedOwnershipOf} implementation for details. // // Bits Layout: // - [0..159] `addr` // - [160..223] `startTimestamp` // - [224] `burned` // - [225] `nextInitialized` // - [232..255] `extraData` mapping(uint256 => uint256) _packedOwnerships; // Mapping owner address to address data. // // Bits Layout: // - [0..63] `balance` // - [64..127] `numberMinted` // - [128..191] `numberBurned` // - [192..255] `aux` mapping(address => uint256) _packedAddressData; // Mapping from token ID to approved address. mapping(uint256 => ERC721AStorage.TokenApprovalRef) _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) _operatorApprovals; } bytes32 internal constant STORAGE_SLOT = keccak256('ERC721A.contracts.storage.ERC721A'); function layout() internal pure returns (Layout storage l) { bytes32 slot = STORAGE_SLOT; assembly { l.slot := slot } } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721AUpgradeable.sol'; import {ERC721AStorage} from './ERC721AStorage.sol'; import './ERC721A__Initializable.sol'; /** * @dev Interface of ERC721 token receiver. */ interface ERC721A__IERC721ReceiverUpgradeable { function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } /** * @title ERC721A * * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721) * Non-Fungible Token Standard, including the Metadata extension. * Optimized for lower gas during batch mints. * * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...) * starting from `_startTokenId()`. * * Assumptions: * * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256). */ contract ERC721AUpgradeable is ERC721A__Initializable, IERC721AUpgradeable { using ERC721AStorage for ERC721AStorage.Layout; // ============================================================= // CONSTANTS // ============================================================= // Mask of an entry in packed address data. uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1; // The bit position of `numberMinted` in packed address data. uint256 private constant _BITPOS_NUMBER_MINTED = 64; // The bit position of `numberBurned` in packed address data. uint256 private constant _BITPOS_NUMBER_BURNED = 128; // The bit position of `aux` in packed address data. uint256 private constant _BITPOS_AUX = 192; // Mask of all 256 bits in packed address data except the 64 bits for `aux`. uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1; // The bit position of `startTimestamp` in packed ownership. uint256 private constant _BITPOS_START_TIMESTAMP = 160; // The bit mask of the `burned` bit in packed ownership. uint256 private constant _BITMASK_BURNED = 1 << 224; // The bit position of the `nextInitialized` bit in packed ownership. uint256 private constant _BITPOS_NEXT_INITIALIZED = 225; // The bit mask of the `nextInitialized` bit in packed ownership. uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225; // The bit position of `extraData` in packed ownership. uint256 private constant _BITPOS_EXTRA_DATA = 232; // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`. uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1; // The mask of the lower 160 bits for addresses. uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1; // The maximum `quantity` that can be minted with {_mintERC2309}. // This limit is to prevent overflows on the address data entries. // For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309} // is required to cause an overflow, which is unrealistic. uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000; // The `Transfer` event signature is given by: // `keccak256(bytes("Transfer(address,address,uint256)"))`. bytes32 private constant _TRANSFER_EVENT_SIGNATURE = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; // ============================================================= // CONSTRUCTOR // ============================================================= function __ERC721A_init(string memory name_, string memory symbol_) internal onlyInitializingERC721A { __ERC721A_init_unchained(name_, symbol_); } function __ERC721A_init_unchained(string memory name_, string memory symbol_) internal onlyInitializingERC721A { ERC721AStorage.layout()._name = name_; ERC721AStorage.layout()._symbol = symbol_; ERC721AStorage.layout()._currentIndex = _startTokenId(); } // ============================================================= // TOKEN COUNTING OPERATIONS // ============================================================= /** * @dev Returns the starting token ID. * To change the starting token ID, please override this function. */ function _startTokenId() internal view virtual returns (uint256) { return 0; } /** * @dev Returns the next token ID to be minted. */ function _nextTokenId() internal view virtual returns (uint256) { return ERC721AStorage.layout()._currentIndex; } /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() public view virtual override returns (uint256) { // Counter underflow is impossible as _burnCounter cannot be incremented // more than `_currentIndex - _startTokenId()` times. unchecked { return ERC721AStorage.layout()._currentIndex - ERC721AStorage.layout()._burnCounter - _startTokenId(); } } /** * @dev Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view virtual returns (uint256) { // Counter underflow is impossible as `_currentIndex` does not decrement, // and it is initialized to `_startTokenId()`. unchecked { return ERC721AStorage.layout()._currentIndex - _startTokenId(); } } /** * @dev Returns the total number of tokens burned. */ function _totalBurned() internal view virtual returns (uint256) { return ERC721AStorage.layout()._burnCounter; } // ============================================================= // ADDRESS DATA OPERATIONS // ============================================================= /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) public view virtual override returns (uint256) { if (owner == address(0)) revert BalanceQueryForZeroAddress(); return ERC721AStorage.layout()._packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens minted by `owner`. */ function _numberMinted(address owner) internal view returns (uint256) { return (ERC721AStorage.layout()._packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens burned by or on behalf of `owner`. */ function _numberBurned(address owner) internal view returns (uint256) { return (ERC721AStorage.layout()._packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). */ function _getAux(address owner) internal view returns (uint64) { return uint64(ERC721AStorage.layout()._packedAddressData[owner] >> _BITPOS_AUX); } /** * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). * If there are multiple variables, please pack them into a uint64. */ function _setAux(address owner, uint64 aux) internal virtual { uint256 packed = ERC721AStorage.layout()._packedAddressData[owner]; uint256 auxCasted; // Cast `aux` with assembly to avoid redundant masking. assembly { auxCasted := aux } packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX); ERC721AStorage.layout()._packedAddressData[owner] = packed; } // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { // The interface IDs are constants representing the first 4 bytes // of the XOR of all function selectors in the interface. // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165) // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`) return interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165. interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721. interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata. } // ============================================================= // IERC721Metadata // ============================================================= /** * @dev Returns the token collection name. */ function name() public view virtual override returns (string memory) { return ERC721AStorage.layout()._name; } /** * @dev Returns the token collection symbol. */ function symbol() public view virtual override returns (string memory) { return ERC721AStorage.layout()._symbol; } /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : ''; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, it can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ''; } // ============================================================= // OWNERSHIPS OPERATIONS // ============================================================= /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { return address(uint160(_packedOwnershipOf(tokenId))); } /** * @dev Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around over time. */ function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnershipOf(tokenId)); } /** * @dev Returns the unpacked `TokenOwnership` struct at `index`. */ function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(ERC721AStorage.layout()._packedOwnerships[index]); } /** * @dev Initializes the ownership slot minted at `index` for efficiency purposes. */ function _initializeOwnershipAt(uint256 index) internal virtual { if (ERC721AStorage.layout()._packedOwnerships[index] == 0) { ERC721AStorage.layout()._packedOwnerships[index] = _packedOwnershipOf(index); } } /** * Returns the packed ownership data of `tokenId`. */ function _packedOwnershipOf(uint256 tokenId) private view returns (uint256 packed) { if (_startTokenId() <= tokenId) { packed = ERC721AStorage.layout()._packedOwnerships[tokenId]; // If not burned. if (packed & _BITMASK_BURNED == 0) { // If the data at the starting slot does not exist, start the scan. if (packed == 0) { if (tokenId >= ERC721AStorage.layout()._currentIndex) revert OwnerQueryForNonexistentToken(); // Invariant: // There will always be an initialized ownership slot // (i.e. `ownership.addr != address(0) && ownership.burned == false`) // before an unintialized ownership slot // (i.e. `ownership.addr == address(0) && ownership.burned == false`) // Hence, `tokenId` will not underflow. // // We can directly compare the packed value. // If the address is zero, packed will be zero. for (;;) { unchecked { packed = ERC721AStorage.layout()._packedOwnerships[--tokenId]; } if (packed == 0) continue; return packed; } } // Otherwise, the data exists and is not burned. We can skip the scan. // This is possible because we have already achieved the target condition. // This saves 2143 gas on transfers of initialized tokens. return packed; } } revert OwnerQueryForNonexistentToken(); } /** * @dev Returns the unpacked `TokenOwnership` struct from `packed`. */ function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) { ownership.addr = address(uint160(packed)); ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP); ownership.burned = packed & _BITMASK_BURNED != 0; ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA); } /** * @dev Packs ownership data into a single uint256. */ function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`. result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags)) } } /** * @dev Returns the `nextInitialized` flag set if `quantity` equals 1. */ function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) { // For branchless setting of the `nextInitialized` flag. assembly { // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`. result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1)) } } // ============================================================= // APPROVAL OPERATIONS // ============================================================= /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. See {ERC721A-_approve}. * * Requirements: * * - The caller must own the token or be an approved operator. */ function approve(address to, uint256 tokenId) public payable virtual override { _approve(to, tokenId, true); } /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken(); return ERC721AStorage.layout()._tokenApprovals[tokenId].value; } /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} * for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool approved) public virtual override { ERC721AStorage.layout()._operatorApprovals[_msgSenderERC721A()][operator] = approved; emit ApprovalForAll(_msgSenderERC721A(), operator, approved); } /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return ERC721AStorage.layout()._operatorApprovals[owner][operator]; } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted. See {_mint}. */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _startTokenId() <= tokenId && tokenId < ERC721AStorage.layout()._currentIndex && // If within bounds, ERC721AStorage.layout()._packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned. } /** * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`. */ function _isSenderApprovedOrOwner( address approvedAddress, address owner, address msgSender ) private pure returns (bool result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean. msgSender := and(msgSender, _BITMASK_ADDRESS) // `msgSender == owner || msgSender == approvedAddress`. result := or(eq(msgSender, owner), eq(msgSender, approvedAddress)) } } /** * @dev Returns the storage slot and value for the approved address of `tokenId`. */ function _getApprovedSlotAndAddress(uint256 tokenId) private view returns (uint256 approvedAddressSlot, address approvedAddress) { ERC721AStorage.TokenApprovalRef storage tokenApproval = ERC721AStorage.layout()._tokenApprovals[tokenId]; // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`. assembly { approvedAddressSlot := tokenApproval.slot approvedAddress := sload(approvedAddressSlot) } } // ============================================================= // TRANSFER OPERATIONS // ============================================================= /** * @dev Transfers `tokenId` from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) public payable virtual override { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner(); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); if (to == address(0)) revert TransferToZeroAddress(); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // We can directly increment and decrement the balances. --ERC721AStorage.layout()._packedAddressData[from]; // Updates: `balance -= 1`. ++ERC721AStorage.layout()._packedAddressData[to]; // Updates: `balance += 1`. // Updates: // - `address` to the next owner. // - `startTimestamp` to the timestamp of transfering. // - `burned` to `false`. // - `nextInitialized` to `true`. ERC721AStorage.layout()._packedOwnerships[tokenId] = _packOwnershipData( to, _BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (ERC721AStorage.layout()._packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != ERC721AStorage.layout()._currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. ERC721AStorage.layout()._packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public payable virtual override { safeTransferFrom(from, to, tokenId, ''); } /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public payable virtual override { transferFrom(from, to, tokenId); if (to.code.length != 0) if (!_checkContractOnERC721Received(from, to, tokenId, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } /** * @dev Hook that is called before a set of serially-ordered token IDs * are about to be transferred. This includes minting. * And also called before burning one token. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token IDs * have been transferred. This includes minting. * And also called after one token has been burned. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been * transferred to `to`. * - When `from` is zero, `tokenId` has been minted for `to`. * - When `to` is zero, `tokenId` has been burned by `from`. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract. * * `from` - Previous owner of the given token ID. * `to` - Target address that will receive the token. * `tokenId` - Token ID to be transferred. * `_data` - Optional data to send along with the call. * * Returns whether the call correctly returned the expected magic value. */ function _checkContractOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { try ERC721A__IERC721ReceiverUpgradeable(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns (bytes4 retval) { return retval == ERC721A__IERC721ReceiverUpgradeable(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert TransferToNonERC721ReceiverImplementer(); } else { assembly { revert(add(32, reason), mload(reason)) } } } } // ============================================================= // MINT OPERATIONS // ============================================================= /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event for each mint. */ function _mint(address to, uint256 quantity) internal virtual { uint256 startTokenId = ERC721AStorage.layout()._currentIndex; if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // `balance` and `numberMinted` have a maximum limit of 2**64. // `tokenId` has a maximum limit of 2**256. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. ERC721AStorage.layout()._packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. ERC721AStorage.layout()._packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); uint256 toMasked; uint256 end = startTokenId + quantity; // Use assembly to loop and emit the `Transfer` event for gas savings. // The duplicated `log4` removes an extra check and reduces stack juggling. // The assembly, together with the surrounding Solidity code, have been // delicately arranged to nudge the compiler into producing optimized opcodes. assembly { // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. toMasked := and(to, _BITMASK_ADDRESS) // Emit the `Transfer` event. log4( 0, // Start of data (0, since no data). 0, // End of data (0, since no data). _TRANSFER_EVENT_SIGNATURE, // Signature. 0, // `address(0)`. toMasked, // `to`. startTokenId // `tokenId`. ) // The `iszero(eq(,))` check ensures that large values of `quantity` // that overflows uint256 will make the loop run out of gas. // The compiler will optimize the `iszero` away for performance. for { let tokenId := add(startTokenId, 1) } iszero(eq(tokenId, end)) { tokenId := add(tokenId, 1) } { // Emit the `Transfer` event. Similar to above. log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId) } } if (toMasked == 0) revert MintToZeroAddress(); ERC721AStorage.layout()._currentIndex = end; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * This function is intended for efficient minting only during contract creation. * * It emits only one {ConsecutiveTransfer} as defined in * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309), * instead of a sequence of {Transfer} event(s). * * Calling this function outside of contract creation WILL make your contract * non-compliant with the ERC721 standard. * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309 * {ConsecutiveTransfer} event is only permissible during contract creation. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {ConsecutiveTransfer} event. */ function _mintERC2309(address to, uint256 quantity) internal virtual { uint256 startTokenId = ERC721AStorage.layout()._currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are unrealistic due to the above check for `quantity` to be below the limit. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. ERC721AStorage.layout()._packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. ERC721AStorage.layout()._packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to); ERC721AStorage.layout()._currentIndex = startTokenId + quantity; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * See {_mint}. * * Emits a {Transfer} event for each mint. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal virtual { _mint(to, quantity); unchecked { if (to.code.length != 0) { uint256 end = ERC721AStorage.layout()._currentIndex; uint256 index = end - quantity; do { if (!_checkContractOnERC721Received(address(0), to, index++, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } while (index < end); // Reentrancy protection. if (ERC721AStorage.layout()._currentIndex != end) revert(); } } } /** * @dev Equivalent to `_safeMint(to, quantity, '')`. */ function _safeMint(address to, uint256 quantity) internal virtual { _safeMint(to, quantity, ''); } // ============================================================= // APPROVAL OPERATIONS // ============================================================= /** * @dev Equivalent to `_approve(to, tokenId, false)`. */ function _approve(address to, uint256 tokenId) internal virtual { _approve(to, tokenId, false); } /** * @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: * * - `tokenId` must exist. * * Emits an {Approval} event. */ function _approve( address to, uint256 tokenId, bool approvalCheck ) internal virtual { address owner = ownerOf(tokenId); if (approvalCheck) if (_msgSenderERC721A() != owner) if (!isApprovedForAll(owner, _msgSenderERC721A())) { revert ApprovalCallerNotOwnerNorApproved(); } ERC721AStorage.layout()._tokenApprovals[tokenId].value = to; emit Approval(owner, to, tokenId); } // ============================================================= // BURN OPERATIONS // ============================================================= /** * @dev Equivalent to `_burn(tokenId, false)`. */ function _burn(uint256 tokenId) internal virtual { _burn(tokenId, false); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId, bool approvalCheck) internal virtual { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); address from = address(uint160(prevOwnershipPacked)); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); if (approvalCheck) { // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); } _beforeTokenTransfers(from, address(0), tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // Updates: // - `balance -= 1`. // - `numberBurned += 1`. // // We can directly decrement the balance, and increment the number burned. // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`. ERC721AStorage.layout()._packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1; // Updates: // - `address` to the last owner. // - `startTimestamp` to the timestamp of burning. // - `burned` to `true`. // - `nextInitialized` to `true`. ERC721AStorage.layout()._packedOwnerships[tokenId] = _packOwnershipData( from, (_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (ERC721AStorage.layout()._packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != ERC721AStorage.layout()._currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. ERC721AStorage.layout()._packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, address(0), tokenId); _afterTokenTransfers(from, address(0), tokenId, 1); // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times. unchecked { ERC721AStorage.layout()._burnCounter++; } } // ============================================================= // EXTRA DATA OPERATIONS // ============================================================= /** * @dev Directly sets the extra data for the ownership data `index`. */ function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual { uint256 packed = ERC721AStorage.layout()._packedOwnerships[index]; if (packed == 0) revert OwnershipNotInitializedForExtraData(); uint256 extraDataCasted; // Cast `extraData` with assembly to avoid redundant masking. assembly { extraDataCasted := extraData } packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA); ERC721AStorage.layout()._packedOwnerships[index] = packed; } /** * @dev Called during each token transfer to set the 24bit `extraData` field. * Intended to be overridden by the cosumer contract. * * `previousExtraData` - the value of `extraData` before transfer. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _extraData( address from, address to, uint24 previousExtraData ) internal view virtual returns (uint24) {} /** * @dev Returns the next extra data for the packed ownership data. * The returned result is shifted into position. */ function _nextExtraData( address from, address to, uint256 prevOwnershipPacked ) private view returns (uint256) { uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA); return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA; } // ============================================================= // OTHER OPERATIONS // ============================================================= /** * @dev Returns the message sender (defaults to `msg.sender`). * * If you are writing GSN compatible contracts, you need to override this function. */ function _msgSenderERC721A() internal view virtual returns (address) { return msg.sender; } /** * @dev Converts a uint256 to its ASCII string decimal representation. */ function _toString(uint256 value) internal pure virtual returns (string memory str) { assembly { // The maximum value of a uint256 contains 78 digits (1 byte per digit), but // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned. // We will need 1 word for the trailing zeros padding, 1 word for the length, // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0. let m := add(mload(0x40), 0xa0) // Update the free memory pointer to allocate. mstore(0x40, m) // Assign the `str` to the end. str := sub(m, 0x20) // Zeroize the slot after the string. mstore(str, 0) // Cache the end of the memory to calculate the length later. let end := str // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. // prettier-ignore for { let temp := value } 1 {} { str := sub(str, 1) // Write the character to the pointer. // The ASCII index of the '0' character is 48. mstore8(str, add(48, mod(temp, 10))) // Keep dividing `temp` until zero. temp := div(temp, 10) // prettier-ignore if iszero(temp) { break } } let length := sub(end, str) // Move the pointer 32 bytes leftwards to make room for the length. str := sub(str, 0x20) // Store the length. mstore(str, length) } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev This is a base contract to aid in writing upgradeable diamond facet contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. */ import {ERC721A__InitializableStorage} from './ERC721A__InitializableStorage.sol'; abstract contract ERC721A__Initializable { using ERC721A__InitializableStorage for ERC721A__InitializableStorage.Layout; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializerERC721A() { // If the contract is initializing we ignore whether _initialized is set in order to support multiple // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the // contract may have been reentered. require( ERC721A__InitializableStorage.layout()._initializing ? _isConstructor() : !ERC721A__InitializableStorage.layout()._initialized, 'ERC721A__Initializable: contract is already initialized' ); bool isTopLevelCall = !ERC721A__InitializableStorage.layout()._initializing; if (isTopLevelCall) { ERC721A__InitializableStorage.layout()._initializing = true; ERC721A__InitializableStorage.layout()._initialized = true; } _; if (isTopLevelCall) { ERC721A__InitializableStorage.layout()._initializing = false; } } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} modifier, directly or indirectly. */ modifier onlyInitializingERC721A() { require( ERC721A__InitializableStorage.layout()._initializing, 'ERC721A__Initializable: contract is not initializing' ); _; } /// @dev Returns true if and only if the function is running in the constructor function _isConstructor() private view returns (bool) { // extcodesize checks the size of the code stored in an address, and // address returns the current address. Since the code is still not // deployed when running a constructor, any checks on its code size will // yield zero, making it an effective way to detect if a contract is // under construction or not. address self = address(this); uint256 cs; assembly { cs := extcodesize(self) } return cs == 0; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev This is a base storage for the initialization function for upgradeable diamond facet contracts **/ library ERC721A__InitializableStorage { struct Layout { /* * Indicates that the contract has been initialized. */ bool _initialized; /* * Indicates that the contract is in the process of being initialized. */ bool _initializing; } bytes32 internal constant STORAGE_SLOT = keccak256('ERC721A.contracts.storage.initializable.facet'); function layout() internal pure returns (Layout storage l) { bytes32 slot = STORAGE_SLOT; assembly { l.slot := slot } } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; /** * @dev Interface of ERC721A. */ interface IERC721AUpgradeable { /** * The caller must own the token or be an approved operator. */ error ApprovalCallerNotOwnerNorApproved(); /** * The token does not exist. */ error ApprovalQueryForNonexistentToken(); /** * Cannot query the balance for the zero address. */ error BalanceQueryForZeroAddress(); /** * Cannot mint to the zero address. */ error MintToZeroAddress(); /** * The quantity of tokens minted must be more than zero. */ error MintZeroQuantity(); /** * The token does not exist. */ error OwnerQueryForNonexistentToken(); /** * The caller must own the token or be an approved operator. */ error TransferCallerNotOwnerNorApproved(); /** * The token must be owned by `from`. */ error TransferFromIncorrectOwner(); /** * Cannot safely transfer to a contract that does not implement the * ERC721Receiver interface. */ error TransferToNonERC721ReceiverImplementer(); /** * Cannot transfer to the zero address. */ error TransferToZeroAddress(); /** * The token does not exist. */ error URIQueryForNonexistentToken(); /** * The `quantity` minted with ERC2309 exceeds the safety limit. */ error MintERC2309QuantityExceedsLimit(); /** * The `extraData` cannot be set on an unintialized ownership slot. */ error OwnershipNotInitializedForExtraData(); // ============================================================= // STRUCTS // ============================================================= struct TokenOwnership { // The address of the owner. address addr; // Stores the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}. uint24 extraData; } // ============================================================= // TOKEN COUNTERS // ============================================================= /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() external view returns (uint256); // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); // ============================================================= // IERC721 // ============================================================= /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables * (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, * checking first that contract recipients are aware of the ERC721 protocol * to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move * this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external payable; /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external payable; /** * @dev Transfers `tokenId` from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} * whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external payable; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the * zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external payable; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} * for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) external view returns (bool); // ============================================================= // IERC721Metadata // ============================================================= /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); // ============================================================= // IERC2309 // ============================================================= /** * @dev Emitted when tokens in `fromTokenId` to `toTokenId` * (inclusive) is transferred from `from` to `to`, as defined in the * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard. * * See {_mintERC2309} for more details. */ event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to); }
// SPDX-License-Identifier: MIT // Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier) pragma solidity >=0.8.0 <0.9.0; interface IPaymentSplitterFactory { /// @notice Deploys a minimal contract proxy to a PaymentSplitter. function deploy(address[] memory payees, uint256[] memory shares) external returns (address); /** @notice Deploys a minimal contract proxy to a PaymentSplitter, at a deterministic address. @dev Use predictDeploymentAddress() with the same salt to predit the address before calling deployDeterministic(). See OpenZeppelin's proxy/Clones.sol for details and caveats, primarily that this will revert if a salt is reused. */ function deployDeterministic( bytes32 salt, address[] memory payees, uint256[] memory shares ) external returns (address); /** @notice Returns the address at which a new PaymentSplitter will be deployed if using the same salt as passed to this function. */ function predictDeploymentAddress(bytes32 salt) external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(account), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControlEnumerable.sol"; import "./AccessControl.sol"; import "../utils/structs/EnumerableSet.sol"; /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl { using EnumerableSet for EnumerableSet.AddressSet; mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) { return _roleMembers[role].at(index); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) { return _roleMembers[role].length(); } /** * @dev Overload {_grantRole} to track enumerable memberships */ function _grantRole(bytes32 role, address account) internal virtual override { super._grantRole(role, account); _roleMembers[role].add(account); } /** * @dev Overload {_revokeRole} to track enumerable memberships */ function _revokeRole(bytes32 role, address account) internal virtual override { super._revokeRole(role, account); _roleMembers[role].remove(account); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerable is IAccessControl { /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) external view returns (address); /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. * * _Available since v4.5._ */ interface IERC2981 is IERC165 { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be paid in that same unit of exchange. */ function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values in the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; interface IOperatorFilterRegistry { /** * @notice Returns true if operator is not filtered for a given token, either by address or codeHash. Also returns * true if supplied registrant address is not registered. */ function isOperatorAllowed(address registrant, address operator) external view returns (bool); /** * @notice Registers an address with the registry. May be called by address itself or by EIP-173 owner. */ function register(address registrant) external; /** * @notice Registers an address with the registry and "subscribes" to another address's filtered operators and codeHashes. */ function registerAndSubscribe(address registrant, address subscription) external; /** * @notice Registers an address with the registry and copies the filtered operators and codeHashes from another * address without subscribing. */ function registerAndCopyEntries(address registrant, address registrantToCopy) external; /** * @notice Unregisters an address with the registry and removes its subscription. May be called by address itself or by EIP-173 owner. * Note that this does not remove any filtered addresses or codeHashes. * Also note that any subscriptions to this registrant will still be active and follow the existing filtered addresses and codehashes. */ function unregister(address addr) external; /** * @notice Update an operator address for a registered address - when filtered is true, the operator is filtered. */ function updateOperator(address registrant, address operator, bool filtered) external; /** * @notice Update multiple operators for a registered address - when filtered is true, the operators will be filtered. Reverts on duplicates. */ function updateOperators(address registrant, address[] calldata operators, bool filtered) external; /** * @notice Update a codeHash for a registered address - when filtered is true, the codeHash is filtered. */ function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external; /** * @notice Update multiple codeHashes for a registered address - when filtered is true, the codeHashes will be filtered. Reverts on duplicates. */ function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external; /** * @notice Subscribe an address to another registrant's filtered operators and codeHashes. Will remove previous * subscription if present. * Note that accounts with subscriptions may go on to subscribe to other accounts - in this case, * subscriptions will not be forwarded. Instead the former subscription's existing entries will still be * used. */ function subscribe(address registrant, address registrantToSubscribe) external; /** * @notice Unsubscribe an address from its current subscribed registrant, and optionally copy its filtered operators and codeHashes. */ function unsubscribe(address registrant, bool copyExistingEntries) external; /** * @notice Get the subscription address of a given registrant, if any. */ function subscriptionOf(address addr) external returns (address registrant); /** * @notice Get the set of addresses subscribed to a given registrant. * Note that order is not guaranteed as updates are made. */ function subscribers(address registrant) external returns (address[] memory); /** * @notice Get the subscriber at a given index in the set of addresses subscribed to a given registrant. * Note that order is not guaranteed as updates are made. */ function subscriberAt(address registrant, uint256 index) external returns (address); /** * @notice Copy filtered operators and codeHashes from a different registrantToCopy to addr. */ function copyEntriesOf(address registrant, address registrantToCopy) external; /** * @notice Returns true if operator is filtered by a given address or its subscription. */ function isOperatorFiltered(address registrant, address operator) external returns (bool); /** * @notice Returns true if the hash of an address's code is filtered by a given address or its subscription. */ function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool); /** * @notice Returns true if a codeHash is filtered by a given address or its subscription. */ function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool); /** * @notice Returns a list of filtered operators for a given address or its subscription. */ function filteredOperators(address addr) external returns (address[] memory); /** * @notice Returns the set of filtered codeHashes for a given address or its subscription. * Note that order is not guaranteed as updates are made. */ function filteredCodeHashes(address addr) external returns (bytes32[] memory); /** * @notice Returns the filtered operator at the given index of the set of filtered operators for a given address or * its subscription. * Note that order is not guaranteed as updates are made. */ function filteredOperatorAt(address registrant, uint256 index) external returns (address); /** * @notice Returns the filtered codeHash at the given index of the list of filtered codeHashes for a given address or * its subscription. * Note that order is not guaranteed as updates are made. */ function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32); /** * @notice Returns true if an address has registered */ function isRegistered(address addr) external returns (bool); /** * @dev Convenience method to compute the code hash of an arbitrary contract */ function codeHashOf(address addr) external returns (bytes32); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import {IOperatorFilterRegistry} from "../IOperatorFilterRegistry.sol"; import {Initializable} from "openzeppelin-contracts-upgradeable/proxy/utils/Initializable.sol"; /** * @title OperatorFiltererUpgradeable * @notice Abstract contract whose constructor automatically registers and optionally subscribes to or copies another * registrant's entries in the OperatorFilterRegistry when the init function is called. * @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 OperatorFiltererUpgradeable is Initializable { /// @notice Emitted when an operator is not allowed. error OperatorNotAllowed(address operator); IOperatorFilterRegistry constant OPERATOR_FILTER_REGISTRY = IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E); /// @dev The upgradeable initialize function that should be called when the contract is being upgraded. function __OperatorFilterer_init(address subscriptionOrRegistrantToCopy, bool subscribe) internal onlyInitializing { // 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 (!OPERATOR_FILTER_REGISTRY.isRegistered(address(this))) { 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)); } } } } } /** * @dev A helper modifier to check if the operator is allowed. */ 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); } _; } /** * @dev A helper modifier to check if the operator approval is allowed. */ modifier onlyAllowedOperatorApproval(address operator) virtual { _checkFilterOperator(operator); _; } /** * @dev A helper function to check if the operator is allowed. */ 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) { // under normal circumstances, this function will revert rather than return false, but inheriting or // upgraded contracts may specify their own OperatorFilterRegistry implementations, which may behave // differently if (!OPERATOR_FILTER_REGISTRY.isOperatorAllowed(address(this), operator)) { revert OperatorNotAllowed(operator); } } } }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.13; import {IPaymentSplitterFactory} from "ethier/factories/IPaymentSplitterFactory.sol"; interface IAlbaDelegate { function tokenURI(uint256 tokenId, string memory slug) external view returns (string memory); function verifyMintReserve(bytes32 message, bytes calldata signature) external view; function verifyMint( bytes16 collectionId, address user, uint16 num, uint32 nonce, bytes calldata signature ) external view; function tokenHTML( bytes16 uuid, uint256 tokenId, bytes32 seed, bytes16[] memory deps ) external view returns (bytes memory); function paymentSplitterFactory() external view returns (IPaymentSplitterFactory); function operatorFilterSubscription() external view returns (address); function getAlbaFeeReceiver() external view returns (address); }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.13; interface IPaymentSplitter { function releasable(address account) external view returns (uint256); function release(address payable account) external; }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.13; struct CollectionConfig { bytes16 uuid; string name; string token; string slug; bytes16[] dependencies; } enum SaleType { FixedPrice, TieredDutchAuction, ContinuousDutchAuction } struct SaleConfig { SaleType saleType; uint32 maxSalePieces; // Maximum number of pieces to sell (including reserves) uint32 numReserved; // Number of pieces to reserve for specific wallets uint16 numRetained; // Number of pieces to retain for the artist uint40 startTime; // Sale start time uint40 auctionEndTime; // Sale doesn't stop here, but price decay stops. Needed for rebate if non-sellout. uint16 decayPeriodSeconds; // Period at which price decays uint24 decayRateBasisPoints; // Rate at which price decays bool hasRebate; // Whether or not to give a rebate to resting price uint256 initialPrice; // Starting price for Dutch Auction uint256 finalPrice; // Ending price for Dutch Auction } struct RoyaltyConfig { uint16 albaPrimaryFeeBasisPoints; // Share of primary sales to Alba (basis points) uint16 albaSecondaryFeeBasisPoints; // Share of secondary sales to Alba (basis points) uint16 royaltyBasisPoints; // Total % of royalties for sales bool enforceRoyalties; // Should use OperatorFilterer to enforce royalties? } struct StoredScript { string fileName; uint256 wrappedLength; }
{ "remappings": [ "@openzeppelin/=lib/openzeppelin-contracts/", "ERC721A-Upgradeable/=lib/ERC721A-Upgradeable/contracts/", "ERC721A/=lib/ERC721A/contracts/", "ds-test/=lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "erc721a/=lib/ERC721A-Upgradeable/contracts/", "ethfs/=lib/ethfs/packages/contracts/src/", "ethier/=lib/ethier/contracts/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", "openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/", "openzeppelin/=lib/ethfs/packages/contracts/lib/openzeppelin-contracts/contracts/", "operator-filter-registry/=lib/operator-filter-registry/src/", "scripty.sol/=lib/scripty.sol/contracts/", "scripty/=lib/scripty.sol/contracts/scripty/", "solady/=lib/ethfs/packages/contracts/lib/solady/src/", "solmate/=lib/ethfs/packages/contracts/lib/solady/lib/solmate/src/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"AuctionStillActive","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"HoFNotAvailable","type":"error"},{"inputs":[],"name":"InsufficientTokensRemanining","type":"error"},{"inputs":[],"name":"InvalidConfiguration","type":"error"},{"inputs":[],"name":"InvalidPayment","type":"error"},{"inputs":[],"name":"InvalidRoyaltyPercentage","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"NoRebateAvailable","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"OperatorNotAllowed","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"PaymentFailed","type":"error"},{"inputs":[],"name":"SaleNotActive","type":"error"},{"inputs":[],"name":"TooManyMintsRequested","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"inputs":[],"name":"UnknownToken","type":"error"},{"anonymous":false,"inputs":[],"name":"AlbaEjected","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"ConsecutiveTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PaymentFlushed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"}],"name":"PaymentsClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"claimer","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RebateClaimed","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":[],"name":"SaleFinished","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":"ROLE_ARTIST","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ROLE_MANAGER","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"albaDelegate","outputs":[{"internalType":"contract IAlbaDelegate","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"assumeTotalOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"availablePayments","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint40","name":"newStartTime","type":"uint40"},{"internalType":"uint40","name":"newEndTime","type":"uint40"}],"name":"changeAuctionTimes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimPayments","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"recipient","type":"address"}],"name":"claimRebate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"closeSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"collectionConfig","outputs":[{"internalType":"bytes16","name":"uuid","type":"bytes16"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"token","type":"string"},{"internalType":"string","name":"slug","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"finalSalePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"flushPaymentToSplitter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"flushablePayments","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":[],"name":"getPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getRebateAmount","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":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IAlbaDelegate","name":"_albaDelegate","type":"address"},{"components":[{"internalType":"bytes16","name":"uuid","type":"bytes16"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"token","type":"string"},{"internalType":"string","name":"slug","type":"string"},{"internalType":"bytes16[]","name":"dependencies","type":"bytes16[]"}],"internalType":"struct CollectionConfig","name":"_config","type":"tuple"},{"components":[{"internalType":"enum SaleType","name":"saleType","type":"uint8"},{"internalType":"uint32","name":"maxSalePieces","type":"uint32"},{"internalType":"uint32","name":"numReserved","type":"uint32"},{"internalType":"uint16","name":"numRetained","type":"uint16"},{"internalType":"uint40","name":"startTime","type":"uint40"},{"internalType":"uint40","name":"auctionEndTime","type":"uint40"},{"internalType":"uint16","name":"decayPeriodSeconds","type":"uint16"},{"internalType":"uint24","name":"decayRateBasisPoints","type":"uint24"},{"internalType":"bool","name":"hasRebate","type":"bool"},{"internalType":"uint256","name":"initialPrice","type":"uint256"},{"internalType":"uint256","name":"finalPrice","type":"uint256"}],"internalType":"struct SaleConfig","name":"_saleConfig","type":"tuple"},{"components":[{"internalType":"uint16","name":"albaPrimaryFeeBasisPoints","type":"uint16"},{"internalType":"uint16","name":"albaSecondaryFeeBasisPoints","type":"uint16"},{"internalType":"uint16","name":"royaltyBasisPoints","type":"uint16"},{"internalType":"bool","name":"enforceRoyalties","type":"bool"}],"internalType":"struct RoyaltyConfig","name":"_royaltyConfig","type":"tuple"},{"internalType":"address","name":"albaManager","type":"address"},{"internalType":"address","name":"artist","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isHofMinted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isSaleClosed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes16","name":"collectionId","type":"bytes16"},{"internalType":"address","name":"user","type":"address"},{"internalType":"uint16","name":"num","type":"uint16"},{"internalType":"uint32","name":"nonce","type":"uint32"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"mintHallOfFame","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"mintPrices","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes16","name":"collectionId","type":"bytes16"},{"internalType":"address","name":"user","type":"address"},{"internalType":"uint16","name":"num","type":"uint16"},{"internalType":"uint16","name":"maxMints","type":"uint16"},{"internalType":"uint32","name":"nonce","type":"uint32"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"mintReserved","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint16","name":"num","type":"uint16"}],"name":"mintRetained","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numReservedMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numRetainedMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paymentSplitter","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paymentSplitterRoyalties","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes16","name":"collectionId","type":"bytes16"},{"internalType":"address","name":"user","type":"address"},{"internalType":"uint16","name":"maxMints","type":"uint16"},{"internalType":"uint32","name":"nonce","type":"uint32"}],"name":"reservesUsed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"royaltyConfig","outputs":[{"internalType":"uint16","name":"albaPrimaryFeeBasisPoints","type":"uint16"},{"internalType":"uint16","name":"albaSecondaryFeeBasisPoints","type":"uint16"},{"internalType":"uint16","name":"royaltyBasisPoints","type":"uint16"},{"internalType":"bool","name":"enforceRoyalties","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"royaltyAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"saleConfig","outputs":[{"internalType":"enum SaleType","name":"saleType","type":"uint8"},{"internalType":"uint32","name":"maxSalePieces","type":"uint32"},{"internalType":"uint32","name":"numReserved","type":"uint32"},{"internalType":"uint16","name":"numRetained","type":"uint16"},{"internalType":"uint40","name":"startTime","type":"uint40"},{"internalType":"uint40","name":"auctionEndTime","type":"uint40"},{"internalType":"uint16","name":"decayPeriodSeconds","type":"uint16"},{"internalType":"uint24","name":"decayRateBasisPoints","type":"uint24"},{"internalType":"bool","name":"hasRebate","type":"bool"},{"internalType":"uint256","name":"initialPrice","type":"uint256"},{"internalType":"uint256","name":"finalPrice","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IAlbaDelegate","name":"newDelegate","type":"address"}],"name":"setDelegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"newRoyaltyBasisPoints","type":"uint16"}],"name":"setRoyalyPercentage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenHTML","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenSeed","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b506200001d3362000023565b6200007e565b600080546001600160a01b038381166201000081810262010000600160b01b0319851617855560405193049190911692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a35050565b615b9c806200008e6000396000f3fe6080604052600436106103975760003560e01c80638c1478a2116101dc578063b88d4fde11610102578063d547741f116100a0578063ee55efee1161006f578063ee55efee14610b09578063ef9b54cf14610b1e578063f2fde38b14610b38578063f5b944eb14610b5857600080fd5b8063d547741f14610a89578063e756d96914610aa9578063e985e9c514610ac9578063ed4a6b0c14610ae957600080fd5b8063c87b56dd116100dc578063c87b56dd14610a16578063ca15c87314610a36578063ca5eb5e114610a56578063d2e8281f14610a7657600080fd5b8063b88d4fde146109ce578063bb011cbb146109e1578063bf964b4e146109f657600080fd5b80639acd26d51161017a578063b189c7e811610149578063b189c7e814610916578063b45e01e914610984578063b630aebd14610999578063b79bebaf146109ae57600080fd5b80639acd26d5146108b6578063a217fddf146108cc578063a22cb465146108e1578063a404d7941461090157600080fd5b806390aa0b0f116101b657806390aa0b0f146107ce57806391d148541461086c57806395d89b411461088c57806398d5fdca146108a157600080fd5b80638c1478a2146107745780638da5cb5b1461078a5780639010d07c146107ae57600080fd5b80632f2ff15d116102c1578063620f0a2c1161025f578063715018a61161022e578063715018a61461070c578063774c96ce146107215780637ea249ad146107345780637ec9704f1461075457600080fd5b8063620f0a2c146106875780636352211e146106a75780636b34d725146106c757806370a08231146106ec57600080fd5b806337fe26b91161029b57806337fe26b91461061e57806339fd52c31461063e57806342842e0e146106545780635f5168361461066757600080fd5b80632f2ff15d146105be578063357b6217146105de57806336568abe146105fe57600080fd5b8063165b98db11610339578063248a9ca311610308578063248a9ca31461051957806325ed09e71461054a5780632a55205a1461055f5780632c316c1d1461059e57600080fd5b8063165b98db146104b057806318160ddd146104d05780631e1a268b146104e557806323b872dd1461050657600080fd5b806306fdde031161037557806306fdde0314610423578063081812fc14610445578063095ea7b31461047d578063146bc04e1461049057600080fd5b806301ffc9a71461039c57806303366c41146103d15780630404997c14610401575b600080fd5b3480156103a857600080fd5b506103bc6103b7366004614a12565b610b7a565b60405190151581526020015b60405180910390f35b3480156103dd57600080fd5b506103f3600080516020615b2783398151915281565b6040519081526020016103c8565b34801561040d57600080fd5b5061042161041c366004614dca565b610bb5565b005b34801561042f57600080fd5b50610438611296565b6040516103c89190614f5f565b34801561045157600080fd5b50610465610460366004614f72565b611331565b6040516001600160a01b0390911681526020016103c8565b61042161048b366004614f8b565b61137e565b34801561049c57600080fd5b506104216104ab366004614fb7565b611397565b3480156104bc57600080fd5b506104216104cb366004614fb7565b6114c1565b3480156104dc57600080fd5b506103f36115aa565b3480156104f157600080fd5b50600e546103bc90600160a01b900460ff1681565b610421610514366004614fd4565b6115c9565b34801561052557600080fd5b506103f3610534366004614f72565b6000908152600160208190526040909120015490565b34801561055657600080fd5b506103f36115f4565b34801561056b57600080fd5b5061057f61057a366004615015565b6116dc565b604080516001600160a01b0390931683526020830191909152016103c8565b3480156105aa57600080fd5b506104216105b9366004615037565b61171c565b3480156105ca57600080fd5b506104216105d9366004615052565b6117ba565b3480156105ea57600080fd5b506104216105f9366004615037565b6117e0565b34801561060a57600080fd5b50610421610619366004615052565b611882565b34801561062a57600080fd5b506103f3610639366004615082565b611900565b34801561064a57600080fd5b506103f360105481565b610421610662366004614fd4565b61192a565b34801561067357600080fd5b506103f3610682366004614f72565b61194f565b34801561069357600080fd5b506104216106a23660046150d8565b6119df565b3480156106b357600080fd5b506104656106c2366004614f72565b611ad2565b3480156106d357600080fd5b506106dc611add565b6040516103c8949392919061510b565b3480156106f857600080fd5b506103f3610707366004614fb7565b611c95565b34801561071857600080fd5b50610421611cfd565b61042161072f36600461519c565b611d11565b34801561074057600080fd5b506103f361074f366004614f8b565b611ef0565b34801561076057600080fd5b506103f361076f366004614fb7565b611f21565b34801561078057600080fd5b506103f360135481565b34801561079657600080fd5b506000546201000090046001600160a01b0316610465565b3480156107ba57600080fd5b506104656107c9366004615015565b61205d565b3480156107da57600080fd5b506004546005546006546108559260ff8082169363ffffffff6101008404811694600160281b85049091169361ffff600160481b820481169464ffffffffff600160581b8404811695600160801b850490911694600160a81b85049093169362ffffff600160b81b82041693600160d01b909104909216918b565b6040516103c89b9a9998979695949392919061524a565b34801561087857600080fd5b506103bc610887366004615052565b61207c565b34801561089857600080fd5b506104386120a7565b3480156108ad57600080fd5b506103f36120bf565b3480156108c257600080fd5b506103f360115481565b3480156108d857600080fd5b506103f3600081565b3480156108ed57600080fd5b506104216108fc3660046152d1565b6120c9565b34801561090d57600080fd5b506104216120dd565b34801561092257600080fd5b50600c546109549061ffff80821691620100008104821691640100000000820416906601000000000000900460ff1684565b6040516103c8949392919061ffff9485168152928416602084015292166040820152901515606082015260800190565b34801561099057600080fd5b506103f3612174565b3480156109a557600080fd5b506104216121e3565b3480156109ba57600080fd5b506104386109c9366004614f72565b612498565b6104216109dc3660046152ff565b612551565b3480156109ed57600080fd5b5061042161257e565b348015610a0257600080fd5b50600e54610465906001600160a01b031681565b348015610a2257600080fd5b50610438610a31366004614f72565b612739565b348015610a4257600080fd5b506103f3610a51366004614f72565b612795565b348015610a6257600080fd5b50610421610a71366004614fb7565b6127ac565b610421610a8436600461537e565b612802565b348015610a9557600080fd5b50610421610aa4366004615052565b612935565b348015610ab557600080fd5b50600354610465906001600160a01b031681565b348015610ad557600080fd5b506103bc610ae4366004615405565b61295b565b348015610af557600080fd5b50600d54610465906001600160a01b031681565b348015610b1557600080fd5b50610421612998565b348015610b2a57600080fd5b506012546103bc9060ff1681565b348015610b4457600080fd5b50610421610b53366004614fb7565b612a8f565b348015610b6457600080fd5b506103f3600080516020615b0783398151915281565b6000610b8582612b05565b80610b945750610b9482612b53565b80610baf57506001600160e01b0319821663152a902d60e11b145b92915050565b600080516020615b4783398151915254610100900460ff16610bea57600080516020615b478339815191525460ff1615610bee565b303b155b610c655760405162461bcd60e51b815260206004820152603760248201527f455243373231415f5f496e697469616c697a61626c653a20636f6e747261637460448201527f20697320616c726561647920696e697469616c697a656400000000000000000060648201526084015b60405180910390fd5b600080516020615b4783398151915254610100900460ff16158015610ca157600080516020615b47833981519152805461ffff19166101011790555b600054610100900460ff1615808015610cc15750600054600160ff909116105b80610cdb5750303b158015610cdb575060005460ff166001145b610d3e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610c5c565b6000805460ff191660011790558015610d61576000805461ff0019166101001790555b610d7387602001518860400151612b78565b610d7e600085612bb6565b610d96600080516020615b0783398151915285612bb6565b610dae600080516020615b2783398151915284612bb6565b600380546001600160a01b0319166001600160a01b038a161790558651600780546001600160801b03191660809290921c9190911781556020880151889190600890610dfa90826154ad565b5060408201516002820190610e0f90826154ad565b5060608201516003820190610e2490826154ad565b5060808201518051610e4091600484019160209091019061491b565b5050865160048054899350909190829060ff19166001836002811115610e6857610e68615234565b021790555060208201518160000160016101000a81548163ffffffff021916908363ffffffff16021790555060408201518160000160056101000a81548163ffffffff021916908363ffffffff16021790555060608201518160000160096101000a81548161ffff021916908361ffff160217905550608082015181600001600b6101000a81548164ffffffffff021916908364ffffffffff16021790555060a08201518160000160106101000a81548164ffffffffff021916908364ffffffffff16021790555060c08201518160000160156101000a81548161ffff021916908361ffff16021790555060e08201518160000160176101000a81548162ffffff021916908362ffffff16021790555061010082015181600001601a6101000a81548160ff0219169083151502179055506101208201518160010155610140820151816002015590505084600c60008201518160000160006101000a81548161ffff021916908361ffff16021790555060208201518160000160026101000a81548161ffff021916908361ffff16021790555060408201518160000160046101000a81548161ffff021916908361ffff16021790555060608201518160000160066101000a81548160ff02191690831515021790555090505061112b6004604051806101600160405290816000820160009054906101000a900460ff16600281111561107657611076615234565b600281111561108757611087615234565b8152815461010080820463ffffffff9081166020850152600160281b8304166040840152600160481b820461ffff9081166060850152600160581b830464ffffffffff9081166080860152600160801b84041660a0850152600160a81b83041660c0840152600160b81b820462ffffff1660e0840152600160d01b90910460ff16151590820152600182015461012082015260029091015461014090910152612bc0565b6000886001600160a01b0316637a69a41b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561116b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061118f919061556c565b905061119c848288612d8f565b6111a7848288613025565b85606001511561121d5761121d896001600160a01b0316633859ac146040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111f2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611216919061556c565b60016132c0565b611226846134ab565b50801561126d576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50801561128d57600080516020615b47833981519152805461ff00191690555b50505050505050565b60606112a0613506565b60020180546112ae90615433565b80601f01602080910402602001604051908101604052809291908181526020018280546112da90615433565b80156113275780601f106112fc57610100808354040283529160200191611327565b820191906000526020600020905b81548152906001019060200180831161130a57829003601f168201915b5050505050905090565b600061133c8261352a565b611359576040516333d1c03960e21b815260040160405180910390fd5b611361613506565b60009283526006016020525060409020546001600160a01b031690565b8161138881613566565b611392838361361f565b505050565b60006113a233611f21565b9050806000036113c557604051631b33a9b960e11b815260040160405180910390fd5b3360009081526015602052604081206113dd916149cd565b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461142a576040519150601f19603f3d011682016040523d82523d6000602084013e61142f565b606091505b50509050806114725760405162461bcd60e51b815260206004820152600f60248201526e151c985b9cd9995c8819985a5b1959608a1b6044820152606401610c5c565b604080513381526001600160a01b03851660208201529081018390527f6d8c333bddf62a96b71c9e7d33a50120f1a1a46c94289b529f813a6ec3fbc488906060015b60405180910390a1505050565b600360009054906101000a90046001600160a01b03166001600160a01b0316637a69a41b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611514573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611538919061556c565b6001600160a01b0316336001600160a01b031614611568576040516282b42960e81b815260040160405180910390fd5b60125460ff161561158c57604051634b77cb0b60e11b815260040160405180910390fd5b6012805460ff191660019081179091556115a790829061362b565b50565b6000806115b5613506565b600101546115c1613506565b540303919050565b826001600160a01b03811633146115e3576115e333613566565b6115ee848484613785565b50505050565b600e546040516351fc756760e11b81523360048201526000916001600160a01b03169063a3f8eace90602401602060405180830381865afa15801561163d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116619190615589565b600d546040516351fc756760e11b81523360048201526001600160a01b039091169063a3f8eace90602401602060405180830381865afa1580156116a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116cd9190615589565b6116d791906155b8565b905090565b600c546000908190640100000000900461ffff166116fc612710856155cb565b61170691906155ed565b600e546001600160a01b03169590945092505050565b611734600080516020615b278339815191523361207c565b611750576040516282b42960e81b815260040160405180910390fd5b60045460115461ffff600160481b90920482169161177191908416906155b8565b111561179057604051630f196e0f60e21b815260040160405180910390fd5b8061ffff16601160008282546117a691906155b8565b909155506115a790503361ffff831661362b565b600082815260016020819052604090912001546117d681613996565b61139283836139a0565b6117f8600080516020615b078339815191523361207c565b15801561181a5750611818600080516020615b278339815191523361207c565b155b15611837576040516282b42960e81b815260040160405180910390fd5b6127108161ffff16111561185e5760405163134aed6960e21b815260040160405180910390fd5b600c805461ffff9092166401000000000265ffff0000000019909216919091179055565b6001600160a01b03811633146118f25760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610c5c565b6118fc82826139c2565b5050565b60008061190f868686866139e4565b6000908152600f60205260409020549150505b949350505050565b826001600160a01b03811633146119445761194433613566565b6115ee848484613ac3565b60008161195b8161352a565b61197857604051638698bf3760e01b815260040160405180910390fd5b600061198384613ade565b6060908101516040513090921b6001600160601b031916602083015260e881901b6001600160e81b0319166034830152603782018690529150605701604051602081830303815290604052805190602001209250505b50919050565b6119f7600080516020615b078339815191523361207c565b158015611a195750611a17600080516020615b278339815191523361207c565b155b15611a36576040516282b42960e81b815260040160405180910390fd5b600454600160581b900464ffffffffff164210611a665760405163c52a9bd360e01b815260040160405180910390fd5b6004805464ffffffffff838116600160801b0264ffffffffff60801b19918616600160581b029190911669ffffffffffffffffffff60581b1990921691909117178082556040805161016081019091526118fc929091829060ff16600281111561107657611076615234565b6000610baf82613b55565b600780546008805460809290921b9291611af690615433565b80601f0160208091040260200160405190810160405280929190818152602001828054611b2290615433565b8015611b6f5780601f10611b4457610100808354040283529160200191611b6f565b820191906000526020600020905b815481529060010190602001808311611b5257829003601f168201915b505050505090806002018054611b8490615433565b80601f0160208091040260200160405190810160405280929190818152602001828054611bb090615433565b8015611bfd5780601f10611bd257610100808354040283529160200191611bfd565b820191906000526020600020905b815481529060010190602001808311611be057829003601f168201915b505050505090806003018054611c1290615433565b80601f0160208091040260200160405190810160405280929190818152602001828054611c3e90615433565b8015611c8b5780601f10611c6057610100808354040283529160200191611c8b565b820191906000526020600020905b815481529060010190602001808311611c6e57829003601f168201915b5050505050905084565b60006001600160a01b038216611cbe576040516323d3ad8160e21b815260040160405180910390fd5b6001600160401b03611cce613506565b6005016000846001600160a01b03166001600160a01b0316815260200190815260200160002054169050919050565b611d05613bfa565b611d0f60006134ab565b565b600e54600160a01b900460ff1680611d385750600454600160581b900464ffffffffff1642105b15611d565760405163b7b2409760e01b815260040160405180910390fd5b6000611d64888887876139e4565b60035460405163cb3f5efd60e01b81529192506001600160a01b03169063cb3f5efd90611d999084908790879060040161562d565b60006040518083038186803b158015611db157600080fd5b505afa158015611dc5573d6000803e3d6000fd5b5050506000828152600f602052604090205461ffff8088169250611deb919089166155b8565b1115611e0a5760405163342e754760e21b815260040160405180910390fd5b600454601054600160281b90910463ffffffff1690611e2e9061ffff8916906155b8565b1115611e4d57604051630f196e0f60e21b815260040160405180910390fd5b600454610100900463ffffffff1661ffff8716611e68613c5b565b611e7291906155b8565b1115611e9157604051630f196e0f60e21b815260040160405180910390fd5b6000818152600f60205260408120805461ffff89169290611eb39084906155b8565b925050819055508561ffff1660106000828254611ed091906155b8565b90915550611ee690508761ffff88166001613c72565b5050505050505050565b60156020528160005260406000208181548110611f0c57600080fd5b90600052602060002001600091509150505481565b600454600090600160801b900464ffffffffff1642108015611f435750601354155b15611f5057506000919050565b6001600160a01b038216600090815260156020908152604080832080548251818502810185019093528083529192909190830182828015611fb057602002820191906000526020600020905b815481526020019060010190808311611f9c575b505050505090508051600003611fc95750600092915050565b60008060135411611fdc57600654611fe0565b6013545b90506000805b8351811015612054578284828151811061200257612002615647565b60200260200101511115612042578284828151811061202357612023615647565b6020026020010151612035919061565d565b61203f90836155b8565b91505b8061204c81615670565b915050611fe6565b50949350505050565b60008281526002602052604081206120759083613e94565b9392505050565b60009182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606120b1613506565b60030180546112ae90615433565b60006116d7613ea0565b816120d381613566565b6113928383613f58565b6120e5613bfa565b6000612100600080516020615b07833981519152600061205d565b905061210d6000336139a0565b612125600080516020615b07833981519152336139a0565b61213d600080516020615b07833981519152826139c2565b6121486000826139c2565b6040517f6040e61f478cab6309d426e690027716f353f33e0c0a2e00637aad97a55aa40a90600090a150565b600454600090600160d01b900460ff16158061219f5750600454600160801b900464ffffffffff1642105b806121aa5750601454155b156121b55750600090565b60006013546000036121c9576006546121cd565b6013545b9050806014546121dd91906155ed565b91505090565b6121fb600080516020615b278339815191523361207c565b1580156122905750600360009054906101000a90046001600160a01b03166001600160a01b0316637a69a41b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612256573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061227a919061556c565b6001600160a01b0316336001600160a01b031614155b156122ad576040516282b42960e81b815260040160405180910390fd5b600d54600e546040516351fc756760e11b81523360048201526001600160a01b0392831692909116906000908190849063a3f8eace90602401602060405180830381865afa158015612303573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123279190615589565b111561238f57600d54604051631916558760e01b81523360048201526001600160a01b0390911690631916558790602401600060405180830381600087803b15801561237257600080fd5b505af1158015612386573d6000803e3d6000fd5b50505050600190505b6040516351fc756760e11b81523360048201526000906001600160a01b0384169063a3f8eace90602401602060405180830381865afa1580156123d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123fa9190615589565b111561246257600e54604051631916558760e01b81523360048201526001600160a01b0390911690631916558790602401600060405180830381600087803b15801561244557600080fd5b505af1158015612459573d6000803e3d6000fd5b50505050600190505b8015611392576040513381527f836402fd424dcec85f03f28fb7dc44e2ae89c8cf97d1b0c6e0297da8123e627d906020016114b4565b6060816124a48161352a565b6124c157604051638698bf3760e01b815260040160405180910390fd5b6003546007546001600160a01b039091169063e6ecd1bb9060801b856124e68161194f565b6040516001600160e01b031960e086901b16815261250c93929190600b90600401615689565b600060405180830381865afa158015612529573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612075919081019061578d565b836001600160a01b038116331461256b5761256b33613566565b61257785858585613fd5565b5050505050565b612596600080516020615b078339815191523361207c565b1580156125b857506125b6600080516020615b278339815191523361207c565b155b156125d5576040516282b42960e81b815260040160405180910390fd5b600060045460ff1660028111156125ee576125ee615234565b0361260c5760405163c52a9bd360e01b815260040160405180910390fd5b600454600160801b900464ffffffffff1642101561263d57604051630ca00c6160e01b815260040160405180910390fd5b6014546000036126605760405163c52a9bd360e01b815260040160405180910390fd5b600060135460000361267457600654612678565b6013545b905060008160145461268a91906155ed565b60006014819055600d5460405192935090916001600160a01b039091169083908381818185875af1925050503d80600081146126e2576040519150601f19603f3d011682016040523d82523d6000602084013e6126e7565b606091505b5050905080612709576040516307a4ced160e51b815260040160405180910390fd5b6040518281527f89b30d91afe451fad93250252429a175014da30702be5cdcba095813737baabc906020016114b4565b6060816127458161352a565b61276257604051638698bf3760e01b815260040160405180910390fd5b6003546040516310773d1560e21b81526001600160a01b03909116906341dcf4549061250c908690600a906004016157d5565b6000818152600260205260408120610baf90614019565b6127c4600080516020615b078339815191523361207c565b6127e0576040516282b42960e81b815260040160405180910390fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b600e54600160a01b900460ff16806128295750600454600160581b900464ffffffffff1642105b156128475760405163b7b2409760e01b815260040160405180910390fd5b6000601054612854613c5b565b61285e919061565d565b6004549091506000906128859063ffffffff600160281b8204811691610100900416615868565b63ffffffff1690508061289c61ffff8816846155b8565b11156128bb57604051630f196e0f60e21b815260040160405180910390fd5b60035460405163031ffc5160e51b81526001600160a01b03909116906363ff8a20906128f5908b908b908b908b908b908b90600401615885565b60006040518083038186803b15801561290d57600080fd5b505afa158015612921573d6000803e3d6000fd5b50505050611ee6878761ffff166000613c72565b6000828152600160208190526040909120015461295181613996565b61139283836139c2565b6000612965613506565b6001600160a01b039384166000908152600791909101602090815260408083209490951682529290925250205460ff1690565b6129b0600080516020615b078339815191523361207c565b1580156129d257506129d0600080516020615b278339815191523361207c565b155b156129ef576040516282b42960e81b815260040160405180910390fd5b600454600160581b900464ffffffffff16421015612a205760405163b7b2409760e01b815260040160405180910390fd5b600454600160801b900464ffffffffff16421015612a5157604051630ca00c6160e01b815260040160405180910390fd5b600e805460ff60a01b1916600160a01b1790556040517f0734f1adc097bd79a3404c9d255d53ced9e8fef12f9718038823aa8265e51c3490600090a1565b612a97613bfa565b6001600160a01b038116612afc5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610c5c565b6115a7816134ab565b60006301ffc9a760e01b6001600160e01b031983161480612b3657506380ac58cd60e01b6001600160e01b03198316145b80610baf5750506001600160e01b031916635b5e139f60e01b1490565b60006001600160e01b03198216635a05180f60e01b1480610baf5750610baf82614023565b600080516020615b4783398151915254610100900460ff16612bac5760405162461bcd60e51b8152600401610c5c906158dc565b6118fc8282614058565b6118fc82826139a0565b806020015163ffffffff16816040015163ffffffff161115612bf55760405163c52a9bd360e01b815260040160405180910390fd5b42816080015164ffffffffff1611612c205760405163c52a9bd360e01b815260040160405180910390fd5b600081516002811115612c3557612c35615234565b03612c735780610100015180612c55575060a081015164ffffffffff1615155b15612c735760405163c52a9bd360e01b815260040160405180910390fd5b600081516002811115612c8857612c88615234565b146115a75760a081015164ffffffffff161580612cbb5750806080015164ffffffffff168160a0015164ffffffffff1611155b15612cd95760405163c52a9bd360e01b815260040160405180910390fd5b80610140015181610120015111612d035760405163c52a9bd360e01b815260040160405180910390fd5b600181516002811115612d1857612d18615234565b03612d5b5760e081015162ffffff161580612d3d57506127108160e0015162ffffff16115b15612d5b5760405163c52a9bd360e01b815260040160405180910390fd5b806020015163ffffffff16816040015163ffffffff16106115a75760405163c52a9bd360e01b815260040160405180910390fd5b805161ffff16600003612f3357604080516001808252818301909252600091602080830190803683370190505090508381600081518110612dd257612dd2615647565b6001600160a01b03929092166020928302919091019091015260408051600180825281830190925260009181602001602082028036833701905050905061271081600081518110612e2557612e25615647565b6020908102919091018101919091526003546040805163e1bce05f60e01b815290516001600160a01b039092169263e1bce05f926004808401938290030181865afa158015612e78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e9c919061556c565b6001600160a01b0316634f62f4d183836040518363ffffffff1660e01b8152600401612ec9929190615930565b6020604051808303816000875af1158015612ee8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f0c919061556c565b600d80546001600160a01b0319166001600160a01b03929092169190911790555050505050565b6040805160028082526060820183526000926020830190803683370190505090508381600081518110612f6857612f68615647565b60200260200101906001600160a01b031690816001600160a01b0316815250508281600181518110612f9c57612f9c615647565b6001600160a01b03929092166020928302919091018201526040805160028082526060820183526000939192909183019080368337019050508351909150612fe6906127106159b4565b61ffff1681600081518110612ffd57612ffd615647565b602002602001018181525050826000015161ffff1681600181518110612e2557612e25615647565b806020015161ffff166000036131cc5760408051600180825281830190925260009160208083019080368337019050509050838160008151811061306b5761306b615647565b6001600160a01b039290921660209283029190910190910152604080516001808252818301909252600091816020016020820280368337019050509050612710816000815181106130be576130be615647565b6020908102919091018101919091526003546040805163e1bce05f60e01b815290516001600160a01b039092169263e1bce05f926004808401938290030181865afa158015613111573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613135919061556c565b6001600160a01b0316634f62f4d183836040518363ffffffff1660e01b8152600401613162929190615930565b6020604051808303816000875af1158015613181573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131a5919061556c565b600e80546001600160a01b0319166001600160a01b03929092169190911790555050505050565b604080516002808252606082018352600092602083019080368337019050509050838160008151811061320157613201615647565b60200260200101906001600160a01b031690816001600160a01b031681525050828160018151811061323557613235615647565b6001600160a01b039290921660209283029190910182015260408051600280825260608201835260009391929091830190803683375050506020840151909150613281906127106159b4565b61ffff168160008151811061329857613298615647565b602002602001018181525050826020015161ffff16816001815181106130be576130be615647565b600054610100900460ff1661332b5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610c5c565b6daaeb6d7670e522a718067333cd4e3b156118fc5760405163c3c5a54760e01b81523060048201526daaeb6d7670e522a718067333cd4e9063c3c5a547906024016020604051808303816000875af115801561338b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133af91906159cf565b6118fc57801561342b57604051633e9f1edf60e11b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e90637d3e3dbe906044015b600060405180830381600087803b15801561340f57600080fd5b505af1158015613423573d6000803e3d6000fd5b505050505050565b6001600160a01b0382161561347a5760405163a0af290360e01b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e9063a0af2903906044016133f5565b604051632210724360e11b81523060048201526daaeb6d7670e522a718067333cd4e90634420e486906024016133f5565b600080546001600160a01b038381166201000081810262010000600160b01b0319851617855560405193049190911692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a35050565b7f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c4090565b6000613534613506565b5482108015610baf5750600160e01b61354b613506565b60008481526004919091016020526040902054161592915050565b6daaeb6d7670e522a718067333cd4e3b156115a757604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa1580156135d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135f791906159cf565b6115a757604051633b79c77360e21b81526001600160a01b0382166004820152602401610c5c565b6118fc828260016140cb565b6000613635613506565b549050600082900361365a5760405163b562e8dd60e01b815260040160405180910390fd5b68010000000000000001820261366e613506565b6001600160a01b03851660009081526005919091016020526040812080549092019091556136c09084906136a3908281614180565b6001851460e11b174260a01b176001600160a01b03919091161790565b6136c8613506565b600083815260049190910160205260408120919091556001600160a01b0384169083830190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b81811461375257808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a460010161371a565b508160000361377357604051622e076360e81b815260040160405180910390fd5b8061377c613506565b55506113929050565b600061379082613b55565b9050836001600160a01b0316816001600160a01b0316146137c35760405162a1148160e81b815260040160405180910390fd5b6000806137cf846141a3565b915091506137f481876137df3390565b6001600160a01b039081169116811491141790565b61381f57613802863361295b565b61381f57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b03851661384657604051633a954ecd60e21b815260040160405180910390fd5b801561385157600082555b613859613506565b6001600160a01b0387166000908152600591909101602052604090208054600019019055613885613506565b6001600160a01b038616600090815260059190910160205260409020805460010190556138d2856138b7888287614180565b600160e11b174260a01b176001600160a01b03919091161790565b6138da613506565b60008681526004919091016020526040812091909155600160e11b841690036139505760018401613909613506565b60008281526004919091016020526040812054900361394e5761392a613506565b54811461394e578361393a613506565b600083815260049190910160205260409020555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4613423565b6115a781336141cb565b6139aa8282614224565b6000828152600260205260409020611392908261428f565b6139cc82826142a4565b6000828152600260205260409020611392908261430b565b6040516001600160f81b031960208201526001600160801b0319851660218201526001600160601b0319606085901b1660318201526001600160f01b031960f084901b1660458201526001600160e01b031960e083901b16604782015246604b820152600090613aba90606b01604051602081830303815290604052805190602001206040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b95945050505050565b61139283838360405180602001604052806000815250612551565b604080516080810182526000808252602082018190529181018290526060810191909152610baf613b0e83613b55565b604080516080810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b831615159181019190915260e89190911c606082015290565b6000613b5f613506565b600083815260049190910160205260408120549150600160e01b82169003613be15780600003613bdc57613b91613506565b548210613bb157604051636f96cda160e11b815260040160405180910390fd5b613bb9613506565b600019909201600081815260049390930160205260409092205490508015613bb1575b919050565b604051636f96cda160e11b815260040160405180910390fd5b6000546001600160a01b0362010000909104163314611d0f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c5c565b6000601154613c686115aa565b6116d7919061565d565b6000613c7c613ea0565b9050613c8881846155ed565b341015613ca85760405163078d696560e31b815260040160405180910390fd5b81613d44576000601054613cba613c5b565b613cc4919061565d565b600454909150600090613ceb9063ffffffff600160281b8204811691610100900416615868565b63ffffffff1690506013546000148015613d0d575080613d0b86846155b8565b145b15613d415760138390556040517f0734f1adc097bd79a3404c9d255d53ced9e8fef12f9718038823aa8265e51c3490600090a15b50505b600454600160d01b900460ff168015613d5d5750601354155b8015613d6a575060065481115b15613dd05760005b83811015613db7576001600160a01b03851660009081526015602090815260408220805460018101825590835291200182905580613daf81615670565b915050613d72565b508260146000828254613dca91906155b8565b90915550505b613dda848461362b565b600454600160d01b900460ff161580613df4575060135415155b80613e00575060065481145b80613e1b5750600454600160801b900464ffffffffff164210155b156115ee57600d546040516000916001600160a01b03169034908381818185875af1925050503d8060008114613e6d576040519150601f19603f3d011682016040523d82523d6000602084013e613e72565b606091505b5050905080612577576040516307a4ced160e51b815260040160405180910390fd5b60006120758383614320565b60008060045460ff166002811115613eba57613eba615234565b03613ec6575060055490565b600454600160581b900464ffffffffff164211613ee4575060055490565b60135415613ef3575060135490565b600160045460ff166002811115613f0c57613f0c615234565b03613f19576116d761434a565b600260045460ff166002811115613f3257613f32615234565b03613f3f576116d76143fd565b60405163c52a9bd360e01b815260040160405180910390fd5b80613f61613506565b336000818152600792909201602090815260408084206001600160a01b03881680865290835293819020805460ff19169515159590951790945592518415158152919290917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b613fe08484846115c9565b6001600160a01b0383163b156115ee57613ffc848484846144bd565b6115ee576040516368d2bf6b60e11b815260040160405180910390fd5b6000610baf825490565b60006001600160e01b03198216637965db0b60e01b1480610baf57506301ffc9a760e01b6001600160e01b0319831614610baf565b600080516020615b4783398151915254610100900460ff1661408c5760405162461bcd60e51b8152600401610c5c906158dc565b81614095613506565b600201906140a390826154ad565b50806140ad613506565b600301906140bb90826154ad565b5060006140c6613506565b555050565b60006140d683611ad2565b9050811561411557336001600160a01b03821614614115576140f8813361295b565b614115576040516367d9dca160e11b815260040160405180910390fd5b8361411e613506565b6000858152600691909101602052604080822080546001600160a01b0319166001600160a01b0394851617905551859287811692908516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259190a450505050565b600060e882811c906141938686846145a5565b62ffffff16901b95945050505050565b60008060006141b0613506565b60009485526006016020525050604090912080549092909150565b6141d5828261207c565b6118fc576141e2816145cc565b6141ed8360206145de565b6040516020016141fe9291906159ec565b60408051601f198184030181529082905262461bcd60e51b8252610c5c91600401614f5f565b61422e828261207c565b6118fc5760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b6000612075836001600160a01b038416614779565b6142ae828261207c565b156118fc5760008281526001602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000612075836001600160a01b0384166147c8565b600082600001828154811061433757614337615647565b9060005260206000200154905092915050565b6004546000908190600160a81b810461ffff169061437690600160581b900464ffffffffff164261565d565b61438091906155cb565b60055460045491925060009161271091906143a8908590600160b81b900462ffffff166155ed565b6143b291906155ed565b6143bc91906155cb565b6006546005549192506000916143d2919061565d565b9050808211156143e757505060065492915050565b6005546143f590839061565d565b935050505090565b6006546005546000918291614412919061565d565b60045490915060009061443c9064ffffffffff600160581b8204811691600160801b900416615a61565b60045464ffffffffff918216925060009161445f91600160581b9004164261565d565b905060008261446e83866155ed565b61447891906155cb565b60065460055491925060009161448e919061565d565b9050808211156144a5575050600654949350505050565b6005546144b390839061565d565b9550505050505090565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a02906144f2903390899088908890600401615a7f565b6020604051808303816000875af192505050801561452d575060408051601f3d908101601f1916820190925261452a91810190615abc565b60015b61458b573d80801561455b576040519150601f19603f3d011682016040523d82523d6000602084013e614560565b606091505b508051600003614583576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611922565b60006001600160a01b0384166145c5576145be836148bb565b9050612075565b5092915050565b6060610baf6001600160a01b03831660145b606060006145ed8360026155ed565b6145f89060026155b8565b6001600160401b0381111561460f5761460f614a44565b6040519080825280601f01601f191660200182016040528015614639576020820181803683370190505b509050600360fc1b8160008151811061465457614654615647565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061468357614683615647565b60200101906001600160f81b031916908160001a90535060006146a78460026155ed565b6146b29060016155b8565b90505b600181111561472a576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106146e6576146e6615647565b1a60f81b8282815181106146fc576146fc615647565b60200101906001600160f81b031916908160001a90535060049490941c9361472381615ad9565b90506146b5565b5083156120755760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610c5c565b60008181526001830160205260408120546147c057508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610baf565b506000610baf565b600081815260018301602052604081205480156148b15760006147ec60018361565d565b85549091506000906148009060019061565d565b905081811461486557600086600001828154811061482057614820615647565b906000526020600020015490508087600001848154811061484357614843615647565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061487657614876615af0565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610baf565b6000915050610baf565b600042446148ca60014361565d565b6040805160208101949094528301919091524060608083019190915283901b6001600160601b03191660808201526094016040516020818303038152906040528051906020012060e81c9050919050565b828054828255906000526020600020906001016002900481019282156149bd5791602002820160005b8382111561498857835183826101000a8154816001600160801b03021916908360801c02179055509260200192601001602081600f01049283019260010302614944565b80156149bb5782816101000a8154906001600160801b030219169055601001602081600f01049283019260010302614988565b505b506149c99291506149e7565b5090565b50805460008255906000526020600020908101906115a791905b5b808211156149c957600081556001016149e8565b6001600160e01b0319811681146115a757600080fd5b600060208284031215614a2457600080fd5b8135612075816149fc565b6001600160a01b03811681146115a757600080fd5b634e487b7160e01b600052604160045260246000fd5b60405161016081016001600160401b0381118282101715614a7d57614a7d614a44565b60405290565b60405160a081016001600160401b0381118282101715614a7d57614a7d614a44565b604051601f8201601f191681016001600160401b0381118282101715614acd57614acd614a44565b604052919050565b80356001600160801b031981168114613bdc57600080fd5b60006001600160401b03821115614b0657614b06614a44565b50601f01601f191660200190565b6000614b27614b2284614aed565b614aa5565b9050828152838383011115614b3b57600080fd5b828260208301376000602084830101529392505050565b600082601f830112614b6357600080fd5b61207583833560208501614b14565b600082601f830112614b8357600080fd5b813560206001600160401b03821115614b9e57614b9e614a44565b8160051b614bad828201614aa5565b9283528481018201928281019087851115614bc757600080fd5b83870192505b84831015614bed57614bde83614ad5565b82529183019190830190614bcd565b979650505050505050565b803560038110613bdc57600080fd5b803563ffffffff81168114613bdc57600080fd5b803561ffff81168114613bdc57600080fd5b803564ffffffffff81168114613bdc57600080fd5b803562ffffff81168114613bdc57600080fd5b80151581146115a757600080fd5b8035613bdc81614c55565b60006101608284031215614c8157600080fd5b614c89614a5a565b9050614c9482614bf8565b8152614ca260208301614c07565b6020820152614cb360408301614c07565b6040820152614cc460608301614c1b565b6060820152614cd560808301614c2d565b6080820152614ce660a08301614c2d565b60a0820152614cf760c08301614c1b565b60c0820152614d0860e08301614c42565b60e0820152610100614d1b818401614c63565b9082015261012082810135908201526101409182013591810191909152919050565b600060808284031215614d4f57600080fd5b604051608081018181106001600160401b0382111715614d7157614d71614a44565b604052905080614d8083614c1b565b8152614d8e60208401614c1b565b6020820152614d9f60408401614c1b565b60408201526060830135614db281614c55565b6060919091015292915050565b8035613bdc81614a2f565b6000806000806000806102608789031215614de457600080fd5b8635614def81614a2f565b955060208701356001600160401b0380821115614e0b57600080fd5b9088019060a0828b031215614e1f57600080fd5b614e27614a83565b614e3083614ad5565b8152602083013582811115614e4457600080fd5b614e508c828601614b52565b602083015250604083013582811115614e6857600080fd5b614e748c828601614b52565b604083015250606083013582811115614e8c57600080fd5b614e988c828601614b52565b606083015250608083013582811115614eb057600080fd5b614ebc8c828601614b72565b608083015250809750505050614ed58860408901614c6e565b9350614ee5886101a08901614d3d565b9250614ef46102208801614dbf565b9150614f036102408801614dbf565b90509295509295509295565b60005b83811015614f2a578181015183820152602001614f12565b50506000910152565b60008151808452614f4b816020860160208601614f0f565b601f01601f19169290920160200192915050565b6020815260006120756020830184614f33565b600060208284031215614f8457600080fd5b5035919050565b60008060408385031215614f9e57600080fd5b8235614fa981614a2f565b946020939093013593505050565b600060208284031215614fc957600080fd5b813561207581614a2f565b600080600060608486031215614fe957600080fd5b8335614ff481614a2f565b9250602084013561500481614a2f565b929592945050506040919091013590565b6000806040838503121561502857600080fd5b50508035926020909101359150565b60006020828403121561504957600080fd5b61207582614c1b565b6000806040838503121561506557600080fd5b82359150602083013561507781614a2f565b809150509250929050565b6000806000806080858703121561509857600080fd5b6150a185614ad5565b935060208501356150b181614a2f565b92506150bf60408601614c1b565b91506150cd60608601614c07565b905092959194509250565b600080604083850312156150eb57600080fd5b6150f483614c2d565b915061510260208401614c2d565b90509250929050565b6001600160801b03198516815260806020820152600061512e6080830186614f33565b82810360408401526151408186614f33565b90508281036060840152614bed8185614f33565b60008083601f84011261516657600080fd5b5081356001600160401b0381111561517d57600080fd5b60208301915083602082850101111561519557600080fd5b9250929050565b600080600080600080600060c0888a0312156151b757600080fd5b6151c088614ad5565b965060208801356151d081614a2f565b95506151de60408901614c1b565b94506151ec60608901614c1b565b93506151fa60808901614c07565b925060a08801356001600160401b0381111561521557600080fd5b6152218a828b01615154565b989b979a50959850939692959293505050565b634e487b7160e01b600052602160045260246000fd5b610160810160038d1061526d57634e487b7160e01b600052602160045260246000fd5b9b815263ffffffff9a8b16602082015298909916604089015261ffff968716606089015264ffffffffff95861660808901529390941660a0870152931660c085015262ffffff90921660e08401521515610100830152610120820152610140015290565b600080604083850312156152e457600080fd5b82356152ef81614a2f565b9150602083013561507781614c55565b6000806000806080858703121561531557600080fd5b843561532081614a2f565b9350602085013561533081614a2f565b92506040850135915060608501356001600160401b0381111561535257600080fd5b8501601f8101871361536357600080fd5b61537287823560208401614b14565b91505092959194509250565b60008060008060008060a0878903121561539757600080fd5b6153a087614ad5565b955060208701356153b081614a2f565b94506153be60408801614c1b565b93506153cc60608801614c07565b925060808701356001600160401b038111156153e757600080fd5b6153f389828a01615154565b979a9699509497509295939492505050565b6000806040838503121561541857600080fd5b823561542381614a2f565b9150602083013561507781614a2f565b600181811c9082168061544757607f821691505b6020821081036119d957634e487b7160e01b600052602260045260246000fd5b601f82111561139257600081815260208120601f850160051c8101602086101561548e5750805b601f850160051c820191505b818110156134235782815560010161549a565b81516001600160401b038111156154c6576154c6614a44565b6154da816154d48454615433565b84615467565b602080601f83116001811461550f57600084156154f75750858301515b600019600386901b1c1916600185901b178555613423565b600085815260208120601f198616915b8281101561553e5788860151825594840194600190910190840161551f565b508582101561555c5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60006020828403121561557e57600080fd5b815161207581614a2f565b60006020828403121561559b57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610baf57610baf6155a2565b6000826155e857634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417610baf57610baf6155a2565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b838152604060208201526000613aba604083018486615604565b634e487b7160e01b600052603260045260246000fd5b81810381811115610baf57610baf6155a2565b600060018201615682576156826155a2565b5060010190565b600060808083016001600160801b0319808916855260208881870152604088818801528460608801528388546156c3818790815260200190565b60008b81526020812097509092505b600182818301106156e3575061570d565b87546001600160801b0319818b1b81168652908816168685015290960195918301916002016156d2565b9554958181101561572f576001600160801b031987891b168352918401916001015b8181101561574b576001600160801b0319878716168352918401915b50909c9b505050505050505050505050565b600061576b614b2284614aed565b905082815283838301111561577f57600080fd5b612075836020830184614f0f565b60006020828403121561579f57600080fd5b81516001600160401b038111156157b557600080fd5b8201601f810184136157c657600080fd5b6119228482516020840161575d565b82815260006020604081840152600084546157ef81615433565b8060408701526060600180841660008114615811576001811461582b57615859565b60ff1985168984015283151560051b890183019550615859565b896000528660002060005b858110156158515781548b8201860152908301908801615836565b8a0184019650505b50939998505050505050505050565b63ffffffff8281168282160390808211156145c5576145c56155a2565b6001600160801b0319871681526001600160a01b038616602082015261ffff8516604082015263ffffffff8416606082015260a0608082018190526000906158d09083018486615604565b98975050505050505050565b60208082526034908201527f455243373231415f5f496e697469616c697a61626c653a20636f6e7472616374604082015273206973206e6f7420696e697469616c697a696e6760601b606082015260800190565b604080825283519082018190526000906020906060840190828701845b828110156159725781516001600160a01b03168452928401929084019060010161594d565b5050508381038285015284518082528583019183019060005b818110156159a75783518352928401929184019160010161598b565b5090979650505050505050565b61ffff8281168282160390808211156145c5576145c56155a2565b6000602082840312156159e157600080fd5b815161207581614c55565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351615a24816017850160208801614f0f565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351615a55816028840160208801614f0f565b01602801949350505050565b64ffffffffff8281168282160390808211156145c5576145c56155a2565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090615ab290830184614f33565b9695505050505050565b600060208284031215615ace57600080fd5b8151612075816149fc565b600081615ae857615ae86155a2565b506000190190565b634e487b7160e01b600052603160045260246000fdfef206625bad3d9112d5609b8d356e6fbd514cd1f69980d4ce2b3e6e68e1789ace63680df430131e002a919e96864c2a88aef0a4ae2b002894ffc3d31894db09c4ee151c8401928dc223602bb187aff91b9a56c7cae5476ef1b3287b085a16c85fa26469706673582212200ac9f51042c4aee870d0f8e2584631aeaf0c9e3ecedd1bc2371d4148ddf99eae64736f6c63430008120033
Deployed Bytecode
0x6080604052600436106103975760003560e01c80638c1478a2116101dc578063b88d4fde11610102578063d547741f116100a0578063ee55efee1161006f578063ee55efee14610b09578063ef9b54cf14610b1e578063f2fde38b14610b38578063f5b944eb14610b5857600080fd5b8063d547741f14610a89578063e756d96914610aa9578063e985e9c514610ac9578063ed4a6b0c14610ae957600080fd5b8063c87b56dd116100dc578063c87b56dd14610a16578063ca15c87314610a36578063ca5eb5e114610a56578063d2e8281f14610a7657600080fd5b8063b88d4fde146109ce578063bb011cbb146109e1578063bf964b4e146109f657600080fd5b80639acd26d51161017a578063b189c7e811610149578063b189c7e814610916578063b45e01e914610984578063b630aebd14610999578063b79bebaf146109ae57600080fd5b80639acd26d5146108b6578063a217fddf146108cc578063a22cb465146108e1578063a404d7941461090157600080fd5b806390aa0b0f116101b657806390aa0b0f146107ce57806391d148541461086c57806395d89b411461088c57806398d5fdca146108a157600080fd5b80638c1478a2146107745780638da5cb5b1461078a5780639010d07c146107ae57600080fd5b80632f2ff15d116102c1578063620f0a2c1161025f578063715018a61161022e578063715018a61461070c578063774c96ce146107215780637ea249ad146107345780637ec9704f1461075457600080fd5b8063620f0a2c146106875780636352211e146106a75780636b34d725146106c757806370a08231146106ec57600080fd5b806337fe26b91161029b57806337fe26b91461061e57806339fd52c31461063e57806342842e0e146106545780635f5168361461066757600080fd5b80632f2ff15d146105be578063357b6217146105de57806336568abe146105fe57600080fd5b8063165b98db11610339578063248a9ca311610308578063248a9ca31461051957806325ed09e71461054a5780632a55205a1461055f5780632c316c1d1461059e57600080fd5b8063165b98db146104b057806318160ddd146104d05780631e1a268b146104e557806323b872dd1461050657600080fd5b806306fdde031161037557806306fdde0314610423578063081812fc14610445578063095ea7b31461047d578063146bc04e1461049057600080fd5b806301ffc9a71461039c57806303366c41146103d15780630404997c14610401575b600080fd5b3480156103a857600080fd5b506103bc6103b7366004614a12565b610b7a565b60405190151581526020015b60405180910390f35b3480156103dd57600080fd5b506103f3600080516020615b2783398151915281565b6040519081526020016103c8565b34801561040d57600080fd5b5061042161041c366004614dca565b610bb5565b005b34801561042f57600080fd5b50610438611296565b6040516103c89190614f5f565b34801561045157600080fd5b50610465610460366004614f72565b611331565b6040516001600160a01b0390911681526020016103c8565b61042161048b366004614f8b565b61137e565b34801561049c57600080fd5b506104216104ab366004614fb7565b611397565b3480156104bc57600080fd5b506104216104cb366004614fb7565b6114c1565b3480156104dc57600080fd5b506103f36115aa565b3480156104f157600080fd5b50600e546103bc90600160a01b900460ff1681565b610421610514366004614fd4565b6115c9565b34801561052557600080fd5b506103f3610534366004614f72565b6000908152600160208190526040909120015490565b34801561055657600080fd5b506103f36115f4565b34801561056b57600080fd5b5061057f61057a366004615015565b6116dc565b604080516001600160a01b0390931683526020830191909152016103c8565b3480156105aa57600080fd5b506104216105b9366004615037565b61171c565b3480156105ca57600080fd5b506104216105d9366004615052565b6117ba565b3480156105ea57600080fd5b506104216105f9366004615037565b6117e0565b34801561060a57600080fd5b50610421610619366004615052565b611882565b34801561062a57600080fd5b506103f3610639366004615082565b611900565b34801561064a57600080fd5b506103f360105481565b610421610662366004614fd4565b61192a565b34801561067357600080fd5b506103f3610682366004614f72565b61194f565b34801561069357600080fd5b506104216106a23660046150d8565b6119df565b3480156106b357600080fd5b506104656106c2366004614f72565b611ad2565b3480156106d357600080fd5b506106dc611add565b6040516103c8949392919061510b565b3480156106f857600080fd5b506103f3610707366004614fb7565b611c95565b34801561071857600080fd5b50610421611cfd565b61042161072f36600461519c565b611d11565b34801561074057600080fd5b506103f361074f366004614f8b565b611ef0565b34801561076057600080fd5b506103f361076f366004614fb7565b611f21565b34801561078057600080fd5b506103f360135481565b34801561079657600080fd5b506000546201000090046001600160a01b0316610465565b3480156107ba57600080fd5b506104656107c9366004615015565b61205d565b3480156107da57600080fd5b506004546005546006546108559260ff8082169363ffffffff6101008404811694600160281b85049091169361ffff600160481b820481169464ffffffffff600160581b8404811695600160801b850490911694600160a81b85049093169362ffffff600160b81b82041693600160d01b909104909216918b565b6040516103c89b9a9998979695949392919061524a565b34801561087857600080fd5b506103bc610887366004615052565b61207c565b34801561089857600080fd5b506104386120a7565b3480156108ad57600080fd5b506103f36120bf565b3480156108c257600080fd5b506103f360115481565b3480156108d857600080fd5b506103f3600081565b3480156108ed57600080fd5b506104216108fc3660046152d1565b6120c9565b34801561090d57600080fd5b506104216120dd565b34801561092257600080fd5b50600c546109549061ffff80821691620100008104821691640100000000820416906601000000000000900460ff1684565b6040516103c8949392919061ffff9485168152928416602084015292166040820152901515606082015260800190565b34801561099057600080fd5b506103f3612174565b3480156109a557600080fd5b506104216121e3565b3480156109ba57600080fd5b506104386109c9366004614f72565b612498565b6104216109dc3660046152ff565b612551565b3480156109ed57600080fd5b5061042161257e565b348015610a0257600080fd5b50600e54610465906001600160a01b031681565b348015610a2257600080fd5b50610438610a31366004614f72565b612739565b348015610a4257600080fd5b506103f3610a51366004614f72565b612795565b348015610a6257600080fd5b50610421610a71366004614fb7565b6127ac565b610421610a8436600461537e565b612802565b348015610a9557600080fd5b50610421610aa4366004615052565b612935565b348015610ab557600080fd5b50600354610465906001600160a01b031681565b348015610ad557600080fd5b506103bc610ae4366004615405565b61295b565b348015610af557600080fd5b50600d54610465906001600160a01b031681565b348015610b1557600080fd5b50610421612998565b348015610b2a57600080fd5b506012546103bc9060ff1681565b348015610b4457600080fd5b50610421610b53366004614fb7565b612a8f565b348015610b6457600080fd5b506103f3600080516020615b0783398151915281565b6000610b8582612b05565b80610b945750610b9482612b53565b80610baf57506001600160e01b0319821663152a902d60e11b145b92915050565b600080516020615b4783398151915254610100900460ff16610bea57600080516020615b478339815191525460ff1615610bee565b303b155b610c655760405162461bcd60e51b815260206004820152603760248201527f455243373231415f5f496e697469616c697a61626c653a20636f6e747261637460448201527f20697320616c726561647920696e697469616c697a656400000000000000000060648201526084015b60405180910390fd5b600080516020615b4783398151915254610100900460ff16158015610ca157600080516020615b47833981519152805461ffff19166101011790555b600054610100900460ff1615808015610cc15750600054600160ff909116105b80610cdb5750303b158015610cdb575060005460ff166001145b610d3e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610c5c565b6000805460ff191660011790558015610d61576000805461ff0019166101001790555b610d7387602001518860400151612b78565b610d7e600085612bb6565b610d96600080516020615b0783398151915285612bb6565b610dae600080516020615b2783398151915284612bb6565b600380546001600160a01b0319166001600160a01b038a161790558651600780546001600160801b03191660809290921c9190911781556020880151889190600890610dfa90826154ad565b5060408201516002820190610e0f90826154ad565b5060608201516003820190610e2490826154ad565b5060808201518051610e4091600484019160209091019061491b565b5050865160048054899350909190829060ff19166001836002811115610e6857610e68615234565b021790555060208201518160000160016101000a81548163ffffffff021916908363ffffffff16021790555060408201518160000160056101000a81548163ffffffff021916908363ffffffff16021790555060608201518160000160096101000a81548161ffff021916908361ffff160217905550608082015181600001600b6101000a81548164ffffffffff021916908364ffffffffff16021790555060a08201518160000160106101000a81548164ffffffffff021916908364ffffffffff16021790555060c08201518160000160156101000a81548161ffff021916908361ffff16021790555060e08201518160000160176101000a81548162ffffff021916908362ffffff16021790555061010082015181600001601a6101000a81548160ff0219169083151502179055506101208201518160010155610140820151816002015590505084600c60008201518160000160006101000a81548161ffff021916908361ffff16021790555060208201518160000160026101000a81548161ffff021916908361ffff16021790555060408201518160000160046101000a81548161ffff021916908361ffff16021790555060608201518160000160066101000a81548160ff02191690831515021790555090505061112b6004604051806101600160405290816000820160009054906101000a900460ff16600281111561107657611076615234565b600281111561108757611087615234565b8152815461010080820463ffffffff9081166020850152600160281b8304166040840152600160481b820461ffff9081166060850152600160581b830464ffffffffff9081166080860152600160801b84041660a0850152600160a81b83041660c0840152600160b81b820462ffffff1660e0840152600160d01b90910460ff16151590820152600182015461012082015260029091015461014090910152612bc0565b6000886001600160a01b0316637a69a41b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561116b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061118f919061556c565b905061119c848288612d8f565b6111a7848288613025565b85606001511561121d5761121d896001600160a01b0316633859ac146040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111f2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611216919061556c565b60016132c0565b611226846134ab565b50801561126d576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50801561128d57600080516020615b47833981519152805461ff00191690555b50505050505050565b60606112a0613506565b60020180546112ae90615433565b80601f01602080910402602001604051908101604052809291908181526020018280546112da90615433565b80156113275780601f106112fc57610100808354040283529160200191611327565b820191906000526020600020905b81548152906001019060200180831161130a57829003601f168201915b5050505050905090565b600061133c8261352a565b611359576040516333d1c03960e21b815260040160405180910390fd5b611361613506565b60009283526006016020525060409020546001600160a01b031690565b8161138881613566565b611392838361361f565b505050565b60006113a233611f21565b9050806000036113c557604051631b33a9b960e11b815260040160405180910390fd5b3360009081526015602052604081206113dd916149cd565b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461142a576040519150601f19603f3d011682016040523d82523d6000602084013e61142f565b606091505b50509050806114725760405162461bcd60e51b815260206004820152600f60248201526e151c985b9cd9995c8819985a5b1959608a1b6044820152606401610c5c565b604080513381526001600160a01b03851660208201529081018390527f6d8c333bddf62a96b71c9e7d33a50120f1a1a46c94289b529f813a6ec3fbc488906060015b60405180910390a1505050565b600360009054906101000a90046001600160a01b03166001600160a01b0316637a69a41b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611514573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611538919061556c565b6001600160a01b0316336001600160a01b031614611568576040516282b42960e81b815260040160405180910390fd5b60125460ff161561158c57604051634b77cb0b60e11b815260040160405180910390fd5b6012805460ff191660019081179091556115a790829061362b565b50565b6000806115b5613506565b600101546115c1613506565b540303919050565b826001600160a01b03811633146115e3576115e333613566565b6115ee848484613785565b50505050565b600e546040516351fc756760e11b81523360048201526000916001600160a01b03169063a3f8eace90602401602060405180830381865afa15801561163d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116619190615589565b600d546040516351fc756760e11b81523360048201526001600160a01b039091169063a3f8eace90602401602060405180830381865afa1580156116a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116cd9190615589565b6116d791906155b8565b905090565b600c546000908190640100000000900461ffff166116fc612710856155cb565b61170691906155ed565b600e546001600160a01b03169590945092505050565b611734600080516020615b278339815191523361207c565b611750576040516282b42960e81b815260040160405180910390fd5b60045460115461ffff600160481b90920482169161177191908416906155b8565b111561179057604051630f196e0f60e21b815260040160405180910390fd5b8061ffff16601160008282546117a691906155b8565b909155506115a790503361ffff831661362b565b600082815260016020819052604090912001546117d681613996565b61139283836139a0565b6117f8600080516020615b078339815191523361207c565b15801561181a5750611818600080516020615b278339815191523361207c565b155b15611837576040516282b42960e81b815260040160405180910390fd5b6127108161ffff16111561185e5760405163134aed6960e21b815260040160405180910390fd5b600c805461ffff9092166401000000000265ffff0000000019909216919091179055565b6001600160a01b03811633146118f25760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610c5c565b6118fc82826139c2565b5050565b60008061190f868686866139e4565b6000908152600f60205260409020549150505b949350505050565b826001600160a01b03811633146119445761194433613566565b6115ee848484613ac3565b60008161195b8161352a565b61197857604051638698bf3760e01b815260040160405180910390fd5b600061198384613ade565b6060908101516040513090921b6001600160601b031916602083015260e881901b6001600160e81b0319166034830152603782018690529150605701604051602081830303815290604052805190602001209250505b50919050565b6119f7600080516020615b078339815191523361207c565b158015611a195750611a17600080516020615b278339815191523361207c565b155b15611a36576040516282b42960e81b815260040160405180910390fd5b600454600160581b900464ffffffffff164210611a665760405163c52a9bd360e01b815260040160405180910390fd5b6004805464ffffffffff838116600160801b0264ffffffffff60801b19918616600160581b029190911669ffffffffffffffffffff60581b1990921691909117178082556040805161016081019091526118fc929091829060ff16600281111561107657611076615234565b6000610baf82613b55565b600780546008805460809290921b9291611af690615433565b80601f0160208091040260200160405190810160405280929190818152602001828054611b2290615433565b8015611b6f5780601f10611b4457610100808354040283529160200191611b6f565b820191906000526020600020905b815481529060010190602001808311611b5257829003601f168201915b505050505090806002018054611b8490615433565b80601f0160208091040260200160405190810160405280929190818152602001828054611bb090615433565b8015611bfd5780601f10611bd257610100808354040283529160200191611bfd565b820191906000526020600020905b815481529060010190602001808311611be057829003601f168201915b505050505090806003018054611c1290615433565b80601f0160208091040260200160405190810160405280929190818152602001828054611c3e90615433565b8015611c8b5780601f10611c6057610100808354040283529160200191611c8b565b820191906000526020600020905b815481529060010190602001808311611c6e57829003601f168201915b5050505050905084565b60006001600160a01b038216611cbe576040516323d3ad8160e21b815260040160405180910390fd5b6001600160401b03611cce613506565b6005016000846001600160a01b03166001600160a01b0316815260200190815260200160002054169050919050565b611d05613bfa565b611d0f60006134ab565b565b600e54600160a01b900460ff1680611d385750600454600160581b900464ffffffffff1642105b15611d565760405163b7b2409760e01b815260040160405180910390fd5b6000611d64888887876139e4565b60035460405163cb3f5efd60e01b81529192506001600160a01b03169063cb3f5efd90611d999084908790879060040161562d565b60006040518083038186803b158015611db157600080fd5b505afa158015611dc5573d6000803e3d6000fd5b5050506000828152600f602052604090205461ffff8088169250611deb919089166155b8565b1115611e0a5760405163342e754760e21b815260040160405180910390fd5b600454601054600160281b90910463ffffffff1690611e2e9061ffff8916906155b8565b1115611e4d57604051630f196e0f60e21b815260040160405180910390fd5b600454610100900463ffffffff1661ffff8716611e68613c5b565b611e7291906155b8565b1115611e9157604051630f196e0f60e21b815260040160405180910390fd5b6000818152600f60205260408120805461ffff89169290611eb39084906155b8565b925050819055508561ffff1660106000828254611ed091906155b8565b90915550611ee690508761ffff88166001613c72565b5050505050505050565b60156020528160005260406000208181548110611f0c57600080fd5b90600052602060002001600091509150505481565b600454600090600160801b900464ffffffffff1642108015611f435750601354155b15611f5057506000919050565b6001600160a01b038216600090815260156020908152604080832080548251818502810185019093528083529192909190830182828015611fb057602002820191906000526020600020905b815481526020019060010190808311611f9c575b505050505090508051600003611fc95750600092915050565b60008060135411611fdc57600654611fe0565b6013545b90506000805b8351811015612054578284828151811061200257612002615647565b60200260200101511115612042578284828151811061202357612023615647565b6020026020010151612035919061565d565b61203f90836155b8565b91505b8061204c81615670565b915050611fe6565b50949350505050565b60008281526002602052604081206120759083613e94565b9392505050565b60009182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606120b1613506565b60030180546112ae90615433565b60006116d7613ea0565b816120d381613566565b6113928383613f58565b6120e5613bfa565b6000612100600080516020615b07833981519152600061205d565b905061210d6000336139a0565b612125600080516020615b07833981519152336139a0565b61213d600080516020615b07833981519152826139c2565b6121486000826139c2565b6040517f6040e61f478cab6309d426e690027716f353f33e0c0a2e00637aad97a55aa40a90600090a150565b600454600090600160d01b900460ff16158061219f5750600454600160801b900464ffffffffff1642105b806121aa5750601454155b156121b55750600090565b60006013546000036121c9576006546121cd565b6013545b9050806014546121dd91906155ed565b91505090565b6121fb600080516020615b278339815191523361207c565b1580156122905750600360009054906101000a90046001600160a01b03166001600160a01b0316637a69a41b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612256573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061227a919061556c565b6001600160a01b0316336001600160a01b031614155b156122ad576040516282b42960e81b815260040160405180910390fd5b600d54600e546040516351fc756760e11b81523360048201526001600160a01b0392831692909116906000908190849063a3f8eace90602401602060405180830381865afa158015612303573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123279190615589565b111561238f57600d54604051631916558760e01b81523360048201526001600160a01b0390911690631916558790602401600060405180830381600087803b15801561237257600080fd5b505af1158015612386573d6000803e3d6000fd5b50505050600190505b6040516351fc756760e11b81523360048201526000906001600160a01b0384169063a3f8eace90602401602060405180830381865afa1580156123d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123fa9190615589565b111561246257600e54604051631916558760e01b81523360048201526001600160a01b0390911690631916558790602401600060405180830381600087803b15801561244557600080fd5b505af1158015612459573d6000803e3d6000fd5b50505050600190505b8015611392576040513381527f836402fd424dcec85f03f28fb7dc44e2ae89c8cf97d1b0c6e0297da8123e627d906020016114b4565b6060816124a48161352a565b6124c157604051638698bf3760e01b815260040160405180910390fd5b6003546007546001600160a01b039091169063e6ecd1bb9060801b856124e68161194f565b6040516001600160e01b031960e086901b16815261250c93929190600b90600401615689565b600060405180830381865afa158015612529573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612075919081019061578d565b836001600160a01b038116331461256b5761256b33613566565b61257785858585613fd5565b5050505050565b612596600080516020615b078339815191523361207c565b1580156125b857506125b6600080516020615b278339815191523361207c565b155b156125d5576040516282b42960e81b815260040160405180910390fd5b600060045460ff1660028111156125ee576125ee615234565b0361260c5760405163c52a9bd360e01b815260040160405180910390fd5b600454600160801b900464ffffffffff1642101561263d57604051630ca00c6160e01b815260040160405180910390fd5b6014546000036126605760405163c52a9bd360e01b815260040160405180910390fd5b600060135460000361267457600654612678565b6013545b905060008160145461268a91906155ed565b60006014819055600d5460405192935090916001600160a01b039091169083908381818185875af1925050503d80600081146126e2576040519150601f19603f3d011682016040523d82523d6000602084013e6126e7565b606091505b5050905080612709576040516307a4ced160e51b815260040160405180910390fd5b6040518281527f89b30d91afe451fad93250252429a175014da30702be5cdcba095813737baabc906020016114b4565b6060816127458161352a565b61276257604051638698bf3760e01b815260040160405180910390fd5b6003546040516310773d1560e21b81526001600160a01b03909116906341dcf4549061250c908690600a906004016157d5565b6000818152600260205260408120610baf90614019565b6127c4600080516020615b078339815191523361207c565b6127e0576040516282b42960e81b815260040160405180910390fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b600e54600160a01b900460ff16806128295750600454600160581b900464ffffffffff1642105b156128475760405163b7b2409760e01b815260040160405180910390fd5b6000601054612854613c5b565b61285e919061565d565b6004549091506000906128859063ffffffff600160281b8204811691610100900416615868565b63ffffffff1690508061289c61ffff8816846155b8565b11156128bb57604051630f196e0f60e21b815260040160405180910390fd5b60035460405163031ffc5160e51b81526001600160a01b03909116906363ff8a20906128f5908b908b908b908b908b908b90600401615885565b60006040518083038186803b15801561290d57600080fd5b505afa158015612921573d6000803e3d6000fd5b50505050611ee6878761ffff166000613c72565b6000828152600160208190526040909120015461295181613996565b61139283836139c2565b6000612965613506565b6001600160a01b039384166000908152600791909101602090815260408083209490951682529290925250205460ff1690565b6129b0600080516020615b078339815191523361207c565b1580156129d257506129d0600080516020615b278339815191523361207c565b155b156129ef576040516282b42960e81b815260040160405180910390fd5b600454600160581b900464ffffffffff16421015612a205760405163b7b2409760e01b815260040160405180910390fd5b600454600160801b900464ffffffffff16421015612a5157604051630ca00c6160e01b815260040160405180910390fd5b600e805460ff60a01b1916600160a01b1790556040517f0734f1adc097bd79a3404c9d255d53ced9e8fef12f9718038823aa8265e51c3490600090a1565b612a97613bfa565b6001600160a01b038116612afc5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610c5c565b6115a7816134ab565b60006301ffc9a760e01b6001600160e01b031983161480612b3657506380ac58cd60e01b6001600160e01b03198316145b80610baf5750506001600160e01b031916635b5e139f60e01b1490565b60006001600160e01b03198216635a05180f60e01b1480610baf5750610baf82614023565b600080516020615b4783398151915254610100900460ff16612bac5760405162461bcd60e51b8152600401610c5c906158dc565b6118fc8282614058565b6118fc82826139a0565b806020015163ffffffff16816040015163ffffffff161115612bf55760405163c52a9bd360e01b815260040160405180910390fd5b42816080015164ffffffffff1611612c205760405163c52a9bd360e01b815260040160405180910390fd5b600081516002811115612c3557612c35615234565b03612c735780610100015180612c55575060a081015164ffffffffff1615155b15612c735760405163c52a9bd360e01b815260040160405180910390fd5b600081516002811115612c8857612c88615234565b146115a75760a081015164ffffffffff161580612cbb5750806080015164ffffffffff168160a0015164ffffffffff1611155b15612cd95760405163c52a9bd360e01b815260040160405180910390fd5b80610140015181610120015111612d035760405163c52a9bd360e01b815260040160405180910390fd5b600181516002811115612d1857612d18615234565b03612d5b5760e081015162ffffff161580612d3d57506127108160e0015162ffffff16115b15612d5b5760405163c52a9bd360e01b815260040160405180910390fd5b806020015163ffffffff16816040015163ffffffff16106115a75760405163c52a9bd360e01b815260040160405180910390fd5b805161ffff16600003612f3357604080516001808252818301909252600091602080830190803683370190505090508381600081518110612dd257612dd2615647565b6001600160a01b03929092166020928302919091019091015260408051600180825281830190925260009181602001602082028036833701905050905061271081600081518110612e2557612e25615647565b6020908102919091018101919091526003546040805163e1bce05f60e01b815290516001600160a01b039092169263e1bce05f926004808401938290030181865afa158015612e78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e9c919061556c565b6001600160a01b0316634f62f4d183836040518363ffffffff1660e01b8152600401612ec9929190615930565b6020604051808303816000875af1158015612ee8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f0c919061556c565b600d80546001600160a01b0319166001600160a01b03929092169190911790555050505050565b6040805160028082526060820183526000926020830190803683370190505090508381600081518110612f6857612f68615647565b60200260200101906001600160a01b031690816001600160a01b0316815250508281600181518110612f9c57612f9c615647565b6001600160a01b03929092166020928302919091018201526040805160028082526060820183526000939192909183019080368337019050508351909150612fe6906127106159b4565b61ffff1681600081518110612ffd57612ffd615647565b602002602001018181525050826000015161ffff1681600181518110612e2557612e25615647565b806020015161ffff166000036131cc5760408051600180825281830190925260009160208083019080368337019050509050838160008151811061306b5761306b615647565b6001600160a01b039290921660209283029190910190910152604080516001808252818301909252600091816020016020820280368337019050509050612710816000815181106130be576130be615647565b6020908102919091018101919091526003546040805163e1bce05f60e01b815290516001600160a01b039092169263e1bce05f926004808401938290030181865afa158015613111573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613135919061556c565b6001600160a01b0316634f62f4d183836040518363ffffffff1660e01b8152600401613162929190615930565b6020604051808303816000875af1158015613181573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131a5919061556c565b600e80546001600160a01b0319166001600160a01b03929092169190911790555050505050565b604080516002808252606082018352600092602083019080368337019050509050838160008151811061320157613201615647565b60200260200101906001600160a01b031690816001600160a01b031681525050828160018151811061323557613235615647565b6001600160a01b039290921660209283029190910182015260408051600280825260608201835260009391929091830190803683375050506020840151909150613281906127106159b4565b61ffff168160008151811061329857613298615647565b602002602001018181525050826020015161ffff16816001815181106130be576130be615647565b600054610100900460ff1661332b5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610c5c565b6daaeb6d7670e522a718067333cd4e3b156118fc5760405163c3c5a54760e01b81523060048201526daaeb6d7670e522a718067333cd4e9063c3c5a547906024016020604051808303816000875af115801561338b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133af91906159cf565b6118fc57801561342b57604051633e9f1edf60e11b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e90637d3e3dbe906044015b600060405180830381600087803b15801561340f57600080fd5b505af1158015613423573d6000803e3d6000fd5b505050505050565b6001600160a01b0382161561347a5760405163a0af290360e01b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e9063a0af2903906044016133f5565b604051632210724360e11b81523060048201526daaeb6d7670e522a718067333cd4e90634420e486906024016133f5565b600080546001600160a01b038381166201000081810262010000600160b01b0319851617855560405193049190911692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a35050565b7f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c4090565b6000613534613506565b5482108015610baf5750600160e01b61354b613506565b60008481526004919091016020526040902054161592915050565b6daaeb6d7670e522a718067333cd4e3b156115a757604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa1580156135d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135f791906159cf565b6115a757604051633b79c77360e21b81526001600160a01b0382166004820152602401610c5c565b6118fc828260016140cb565b6000613635613506565b549050600082900361365a5760405163b562e8dd60e01b815260040160405180910390fd5b68010000000000000001820261366e613506565b6001600160a01b03851660009081526005919091016020526040812080549092019091556136c09084906136a3908281614180565b6001851460e11b174260a01b176001600160a01b03919091161790565b6136c8613506565b600083815260049190910160205260408120919091556001600160a01b0384169083830190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b81811461375257808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a460010161371a565b508160000361377357604051622e076360e81b815260040160405180910390fd5b8061377c613506565b55506113929050565b600061379082613b55565b9050836001600160a01b0316816001600160a01b0316146137c35760405162a1148160e81b815260040160405180910390fd5b6000806137cf846141a3565b915091506137f481876137df3390565b6001600160a01b039081169116811491141790565b61381f57613802863361295b565b61381f57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b03851661384657604051633a954ecd60e21b815260040160405180910390fd5b801561385157600082555b613859613506565b6001600160a01b0387166000908152600591909101602052604090208054600019019055613885613506565b6001600160a01b038616600090815260059190910160205260409020805460010190556138d2856138b7888287614180565b600160e11b174260a01b176001600160a01b03919091161790565b6138da613506565b60008681526004919091016020526040812091909155600160e11b841690036139505760018401613909613506565b60008281526004919091016020526040812054900361394e5761392a613506565b54811461394e578361393a613506565b600083815260049190910160205260409020555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4613423565b6115a781336141cb565b6139aa8282614224565b6000828152600260205260409020611392908261428f565b6139cc82826142a4565b6000828152600260205260409020611392908261430b565b6040516001600160f81b031960208201526001600160801b0319851660218201526001600160601b0319606085901b1660318201526001600160f01b031960f084901b1660458201526001600160e01b031960e083901b16604782015246604b820152600090613aba90606b01604051602081830303815290604052805190602001206040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b95945050505050565b61139283838360405180602001604052806000815250612551565b604080516080810182526000808252602082018190529181018290526060810191909152610baf613b0e83613b55565b604080516080810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b831615159181019190915260e89190911c606082015290565b6000613b5f613506565b600083815260049190910160205260408120549150600160e01b82169003613be15780600003613bdc57613b91613506565b548210613bb157604051636f96cda160e11b815260040160405180910390fd5b613bb9613506565b600019909201600081815260049390930160205260409092205490508015613bb1575b919050565b604051636f96cda160e11b815260040160405180910390fd5b6000546001600160a01b0362010000909104163314611d0f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c5c565b6000601154613c686115aa565b6116d7919061565d565b6000613c7c613ea0565b9050613c8881846155ed565b341015613ca85760405163078d696560e31b815260040160405180910390fd5b81613d44576000601054613cba613c5b565b613cc4919061565d565b600454909150600090613ceb9063ffffffff600160281b8204811691610100900416615868565b63ffffffff1690506013546000148015613d0d575080613d0b86846155b8565b145b15613d415760138390556040517f0734f1adc097bd79a3404c9d255d53ced9e8fef12f9718038823aa8265e51c3490600090a15b50505b600454600160d01b900460ff168015613d5d5750601354155b8015613d6a575060065481115b15613dd05760005b83811015613db7576001600160a01b03851660009081526015602090815260408220805460018101825590835291200182905580613daf81615670565b915050613d72565b508260146000828254613dca91906155b8565b90915550505b613dda848461362b565b600454600160d01b900460ff161580613df4575060135415155b80613e00575060065481145b80613e1b5750600454600160801b900464ffffffffff164210155b156115ee57600d546040516000916001600160a01b03169034908381818185875af1925050503d8060008114613e6d576040519150601f19603f3d011682016040523d82523d6000602084013e613e72565b606091505b5050905080612577576040516307a4ced160e51b815260040160405180910390fd5b60006120758383614320565b60008060045460ff166002811115613eba57613eba615234565b03613ec6575060055490565b600454600160581b900464ffffffffff164211613ee4575060055490565b60135415613ef3575060135490565b600160045460ff166002811115613f0c57613f0c615234565b03613f19576116d761434a565b600260045460ff166002811115613f3257613f32615234565b03613f3f576116d76143fd565b60405163c52a9bd360e01b815260040160405180910390fd5b80613f61613506565b336000818152600792909201602090815260408084206001600160a01b03881680865290835293819020805460ff19169515159590951790945592518415158152919290917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b613fe08484846115c9565b6001600160a01b0383163b156115ee57613ffc848484846144bd565b6115ee576040516368d2bf6b60e11b815260040160405180910390fd5b6000610baf825490565b60006001600160e01b03198216637965db0b60e01b1480610baf57506301ffc9a760e01b6001600160e01b0319831614610baf565b600080516020615b4783398151915254610100900460ff1661408c5760405162461bcd60e51b8152600401610c5c906158dc565b81614095613506565b600201906140a390826154ad565b50806140ad613506565b600301906140bb90826154ad565b5060006140c6613506565b555050565b60006140d683611ad2565b9050811561411557336001600160a01b03821614614115576140f8813361295b565b614115576040516367d9dca160e11b815260040160405180910390fd5b8361411e613506565b6000858152600691909101602052604080822080546001600160a01b0319166001600160a01b0394851617905551859287811692908516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259190a450505050565b600060e882811c906141938686846145a5565b62ffffff16901b95945050505050565b60008060006141b0613506565b60009485526006016020525050604090912080549092909150565b6141d5828261207c565b6118fc576141e2816145cc565b6141ed8360206145de565b6040516020016141fe9291906159ec565b60408051601f198184030181529082905262461bcd60e51b8252610c5c91600401614f5f565b61422e828261207c565b6118fc5760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b6000612075836001600160a01b038416614779565b6142ae828261207c565b156118fc5760008281526001602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000612075836001600160a01b0384166147c8565b600082600001828154811061433757614337615647565b9060005260206000200154905092915050565b6004546000908190600160a81b810461ffff169061437690600160581b900464ffffffffff164261565d565b61438091906155cb565b60055460045491925060009161271091906143a8908590600160b81b900462ffffff166155ed565b6143b291906155ed565b6143bc91906155cb565b6006546005549192506000916143d2919061565d565b9050808211156143e757505060065492915050565b6005546143f590839061565d565b935050505090565b6006546005546000918291614412919061565d565b60045490915060009061443c9064ffffffffff600160581b8204811691600160801b900416615a61565b60045464ffffffffff918216925060009161445f91600160581b9004164261565d565b905060008261446e83866155ed565b61447891906155cb565b60065460055491925060009161448e919061565d565b9050808211156144a5575050600654949350505050565b6005546144b390839061565d565b9550505050505090565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a02906144f2903390899088908890600401615a7f565b6020604051808303816000875af192505050801561452d575060408051601f3d908101601f1916820190925261452a91810190615abc565b60015b61458b573d80801561455b576040519150601f19603f3d011682016040523d82523d6000602084013e614560565b606091505b508051600003614583576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611922565b60006001600160a01b0384166145c5576145be836148bb565b9050612075565b5092915050565b6060610baf6001600160a01b03831660145b606060006145ed8360026155ed565b6145f89060026155b8565b6001600160401b0381111561460f5761460f614a44565b6040519080825280601f01601f191660200182016040528015614639576020820181803683370190505b509050600360fc1b8160008151811061465457614654615647565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061468357614683615647565b60200101906001600160f81b031916908160001a90535060006146a78460026155ed565b6146b29060016155b8565b90505b600181111561472a576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106146e6576146e6615647565b1a60f81b8282815181106146fc576146fc615647565b60200101906001600160f81b031916908160001a90535060049490941c9361472381615ad9565b90506146b5565b5083156120755760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610c5c565b60008181526001830160205260408120546147c057508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610baf565b506000610baf565b600081815260018301602052604081205480156148b15760006147ec60018361565d565b85549091506000906148009060019061565d565b905081811461486557600086600001828154811061482057614820615647565b906000526020600020015490508087600001848154811061484357614843615647565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061487657614876615af0565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610baf565b6000915050610baf565b600042446148ca60014361565d565b6040805160208101949094528301919091524060608083019190915283901b6001600160601b03191660808201526094016040516020818303038152906040528051906020012060e81c9050919050565b828054828255906000526020600020906001016002900481019282156149bd5791602002820160005b8382111561498857835183826101000a8154816001600160801b03021916908360801c02179055509260200192601001602081600f01049283019260010302614944565b80156149bb5782816101000a8154906001600160801b030219169055601001602081600f01049283019260010302614988565b505b506149c99291506149e7565b5090565b50805460008255906000526020600020908101906115a791905b5b808211156149c957600081556001016149e8565b6001600160e01b0319811681146115a757600080fd5b600060208284031215614a2457600080fd5b8135612075816149fc565b6001600160a01b03811681146115a757600080fd5b634e487b7160e01b600052604160045260246000fd5b60405161016081016001600160401b0381118282101715614a7d57614a7d614a44565b60405290565b60405160a081016001600160401b0381118282101715614a7d57614a7d614a44565b604051601f8201601f191681016001600160401b0381118282101715614acd57614acd614a44565b604052919050565b80356001600160801b031981168114613bdc57600080fd5b60006001600160401b03821115614b0657614b06614a44565b50601f01601f191660200190565b6000614b27614b2284614aed565b614aa5565b9050828152838383011115614b3b57600080fd5b828260208301376000602084830101529392505050565b600082601f830112614b6357600080fd5b61207583833560208501614b14565b600082601f830112614b8357600080fd5b813560206001600160401b03821115614b9e57614b9e614a44565b8160051b614bad828201614aa5565b9283528481018201928281019087851115614bc757600080fd5b83870192505b84831015614bed57614bde83614ad5565b82529183019190830190614bcd565b979650505050505050565b803560038110613bdc57600080fd5b803563ffffffff81168114613bdc57600080fd5b803561ffff81168114613bdc57600080fd5b803564ffffffffff81168114613bdc57600080fd5b803562ffffff81168114613bdc57600080fd5b80151581146115a757600080fd5b8035613bdc81614c55565b60006101608284031215614c8157600080fd5b614c89614a5a565b9050614c9482614bf8565b8152614ca260208301614c07565b6020820152614cb360408301614c07565b6040820152614cc460608301614c1b565b6060820152614cd560808301614c2d565b6080820152614ce660a08301614c2d565b60a0820152614cf760c08301614c1b565b60c0820152614d0860e08301614c42565b60e0820152610100614d1b818401614c63565b9082015261012082810135908201526101409182013591810191909152919050565b600060808284031215614d4f57600080fd5b604051608081018181106001600160401b0382111715614d7157614d71614a44565b604052905080614d8083614c1b565b8152614d8e60208401614c1b565b6020820152614d9f60408401614c1b565b60408201526060830135614db281614c55565b6060919091015292915050565b8035613bdc81614a2f565b6000806000806000806102608789031215614de457600080fd5b8635614def81614a2f565b955060208701356001600160401b0380821115614e0b57600080fd5b9088019060a0828b031215614e1f57600080fd5b614e27614a83565b614e3083614ad5565b8152602083013582811115614e4457600080fd5b614e508c828601614b52565b602083015250604083013582811115614e6857600080fd5b614e748c828601614b52565b604083015250606083013582811115614e8c57600080fd5b614e988c828601614b52565b606083015250608083013582811115614eb057600080fd5b614ebc8c828601614b72565b608083015250809750505050614ed58860408901614c6e565b9350614ee5886101a08901614d3d565b9250614ef46102208801614dbf565b9150614f036102408801614dbf565b90509295509295509295565b60005b83811015614f2a578181015183820152602001614f12565b50506000910152565b60008151808452614f4b816020860160208601614f0f565b601f01601f19169290920160200192915050565b6020815260006120756020830184614f33565b600060208284031215614f8457600080fd5b5035919050565b60008060408385031215614f9e57600080fd5b8235614fa981614a2f565b946020939093013593505050565b600060208284031215614fc957600080fd5b813561207581614a2f565b600080600060608486031215614fe957600080fd5b8335614ff481614a2f565b9250602084013561500481614a2f565b929592945050506040919091013590565b6000806040838503121561502857600080fd5b50508035926020909101359150565b60006020828403121561504957600080fd5b61207582614c1b565b6000806040838503121561506557600080fd5b82359150602083013561507781614a2f565b809150509250929050565b6000806000806080858703121561509857600080fd5b6150a185614ad5565b935060208501356150b181614a2f565b92506150bf60408601614c1b565b91506150cd60608601614c07565b905092959194509250565b600080604083850312156150eb57600080fd5b6150f483614c2d565b915061510260208401614c2d565b90509250929050565b6001600160801b03198516815260806020820152600061512e6080830186614f33565b82810360408401526151408186614f33565b90508281036060840152614bed8185614f33565b60008083601f84011261516657600080fd5b5081356001600160401b0381111561517d57600080fd5b60208301915083602082850101111561519557600080fd5b9250929050565b600080600080600080600060c0888a0312156151b757600080fd5b6151c088614ad5565b965060208801356151d081614a2f565b95506151de60408901614c1b565b94506151ec60608901614c1b565b93506151fa60808901614c07565b925060a08801356001600160401b0381111561521557600080fd5b6152218a828b01615154565b989b979a50959850939692959293505050565b634e487b7160e01b600052602160045260246000fd5b610160810160038d1061526d57634e487b7160e01b600052602160045260246000fd5b9b815263ffffffff9a8b16602082015298909916604089015261ffff968716606089015264ffffffffff95861660808901529390941660a0870152931660c085015262ffffff90921660e08401521515610100830152610120820152610140015290565b600080604083850312156152e457600080fd5b82356152ef81614a2f565b9150602083013561507781614c55565b6000806000806080858703121561531557600080fd5b843561532081614a2f565b9350602085013561533081614a2f565b92506040850135915060608501356001600160401b0381111561535257600080fd5b8501601f8101871361536357600080fd5b61537287823560208401614b14565b91505092959194509250565b60008060008060008060a0878903121561539757600080fd5b6153a087614ad5565b955060208701356153b081614a2f565b94506153be60408801614c1b565b93506153cc60608801614c07565b925060808701356001600160401b038111156153e757600080fd5b6153f389828a01615154565b979a9699509497509295939492505050565b6000806040838503121561541857600080fd5b823561542381614a2f565b9150602083013561507781614a2f565b600181811c9082168061544757607f821691505b6020821081036119d957634e487b7160e01b600052602260045260246000fd5b601f82111561139257600081815260208120601f850160051c8101602086101561548e5750805b601f850160051c820191505b818110156134235782815560010161549a565b81516001600160401b038111156154c6576154c6614a44565b6154da816154d48454615433565b84615467565b602080601f83116001811461550f57600084156154f75750858301515b600019600386901b1c1916600185901b178555613423565b600085815260208120601f198616915b8281101561553e5788860151825594840194600190910190840161551f565b508582101561555c5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60006020828403121561557e57600080fd5b815161207581614a2f565b60006020828403121561559b57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610baf57610baf6155a2565b6000826155e857634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417610baf57610baf6155a2565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b838152604060208201526000613aba604083018486615604565b634e487b7160e01b600052603260045260246000fd5b81810381811115610baf57610baf6155a2565b600060018201615682576156826155a2565b5060010190565b600060808083016001600160801b0319808916855260208881870152604088818801528460608801528388546156c3818790815260200190565b60008b81526020812097509092505b600182818301106156e3575061570d565b87546001600160801b0319818b1b81168652908816168685015290960195918301916002016156d2565b9554958181101561572f576001600160801b031987891b168352918401916001015b8181101561574b576001600160801b0319878716168352918401915b50909c9b505050505050505050505050565b600061576b614b2284614aed565b905082815283838301111561577f57600080fd5b612075836020830184614f0f565b60006020828403121561579f57600080fd5b81516001600160401b038111156157b557600080fd5b8201601f810184136157c657600080fd5b6119228482516020840161575d565b82815260006020604081840152600084546157ef81615433565b8060408701526060600180841660008114615811576001811461582b57615859565b60ff1985168984015283151560051b890183019550615859565b896000528660002060005b858110156158515781548b8201860152908301908801615836565b8a0184019650505b50939998505050505050505050565b63ffffffff8281168282160390808211156145c5576145c56155a2565b6001600160801b0319871681526001600160a01b038616602082015261ffff8516604082015263ffffffff8416606082015260a0608082018190526000906158d09083018486615604565b98975050505050505050565b60208082526034908201527f455243373231415f5f496e697469616c697a61626c653a20636f6e7472616374604082015273206973206e6f7420696e697469616c697a696e6760601b606082015260800190565b604080825283519082018190526000906020906060840190828701845b828110156159725781516001600160a01b03168452928401929084019060010161594d565b5050508381038285015284518082528583019183019060005b818110156159a75783518352928401929184019160010161598b565b5090979650505050505050565b61ffff8281168282160390808211156145c5576145c56155a2565b6000602082840312156159e157600080fd5b815161207581614c55565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351615a24816017850160208801614f0f565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351615a55816028840160208801614f0f565b01602801949350505050565b64ffffffffff8281168282160390808211156145c5576145c56155a2565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090615ab290830184614f33565b9695505050505050565b600060208284031215615ace57600080fd5b8151612075816149fc565b600081615ae857615ae86155a2565b506000190190565b634e487b7160e01b600052603160045260246000fdfef206625bad3d9112d5609b8d356e6fbd514cd1f69980d4ce2b3e6e68e1789ace63680df430131e002a919e96864c2a88aef0a4ae2b002894ffc3d31894db09c4ee151c8401928dc223602bb187aff91b9a56c7cae5476ef1b3287b085a16c85fa26469706673582212200ac9f51042c4aee870d0f8e2584631aeaf0c9e3ecedd1bc2371d4148ddf99eae64736f6c63430008120033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.