ERC-721
Overview
Max Total Supply
204 SINRA
Holders
191
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Balance
1 SINRALoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Source Code Verified (Exact Match)
Contract Name:
Sinra
Compiler Version
v0.8.18+commit.87f61d96
Optimization Enabled:
Yes with 1000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.18; import "erc721a/contracts/ERC721A.sol"; import "erc721a/contracts/extensions/ERC721AQueryable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/token/common/ERC2981.sol"; import "./libraries/Utils.sol"; import "./Types.sol"; import "./Authorizable.sol"; contract Sinra is Authorizable, ERC2981, ERC721A, ERC721AQueryable, ReentrancyGuard { // ============================================================= // STORAGE // ============================================================= /** * @notice Maximum amount for each batch */ uint256 public maxBatch; /** * @notice Base token URI */ string public baseURI; // -------------Organization------- /** * @notice Mapping project ID => organization ID */ mapping(uint256 => uint256) public organizationIdOf; /** * @notice Mapping organization ID => organization address */ mapping(uint256 => address) public organizationAddressOf; /** * @notice Mapping organization ID => royalty receipt address */ mapping(uint256 => address) public receiptAddressOf; // -------------Project------------ /** * @notice Mapping monitoring cycle ID => project ID */ mapping(uint256 => uint256) public projectIdOf; /** * @notice Mapping project ID => project code */ mapping(uint256 => string) private _projectCodeOf; /** * @notice Mapping project ID => royalty percent */ mapping(uint256 => uint96) public royaltyPercentOf; // -----------Monitoring Cycle---------- /** * @notice Mapping token ID => monitoring cycle ID */ mapping(uint256 => uint256) public monitoringCycleIdOf; /** * @notice Mapping project ID => (monitoring cycle ID => monitoring cycle code mapping) */ mapping(uint256 => mapping(uint256 => string)) public monitoringCodeOf; // ---------Token----------- /** * @notice Mapping token ID => purchased amount */ mapping(uint256 => uint256) public purchasedVolumeOf; /** * @notice Mapping token ID => token status */ mapping(uint256 => TokenStatus) private _statusOf; /** * @notice Mapping signature => is used */ mapping(bytes => bool) public isUsedSignature; // ============================================================= // EVENTS // ============================================================= /** * @notice Emit event when contract is deployed */ event Deployed(address owner, string tokenName, string symbol); /** * @notice Emit event when minting a token */ event Mint(address to, uint256 tokenId, bytes signature); /** * @notice Emit event when minting batch of tokens */ event MintBatch(uint256[] tokenIds); /** * @notice Emit event when setting base URI */ event SetBaseURI(string oldBaseURI, string newBaseURI); /** * @notice Emit event when setting status of a token */ event SetStatus(uint256 indexed tokenId, TokenStatus previousStatus, TokenStatus status); /** * @notice Emit event when setting batch of token statuses */ event SetBatchOfStatuses(uint256[] tokenIds, TokenStatus[] previousStatues, TokenStatus[] statuses); /** * @notice Emit event when setting new max batch */ event SetMaxBatch(uint256 oldMaxBatch, uint256 newMaxBatch); /** * @notice Emit event when setting organization information */ event SetOrganizationInfo(uint256 organizationId, address organizationAddress, address receiptAddress); /** * @notice Emit event when updating organization information */ event UpdateOrganizationInfo(uint256 organizationId, address previousReceiptAddress, address newReceiptAddress); /** * @notice Emit event when setting project information */ event SetProjectInfo( uint256 organizationId, uint256 projectId, uint96 feeNumerator, string code ); /** * @notice Emit event when setting monitoring cycle information */ event SetMonitoringCycleInfo( uint256 projectId, uint256 monitoringCycleId, string code ); /** * @notice Emit event when burning a token */ event Burn(address owner, uint256 tokenId); // ============================================================= // CONSTRUCTOR // ============================================================= /** * @notice Init contract * * @dev Setting states initial when deploying contract and only be called once * * Name Meaning * @param _owner Contract owner address * @param _tokenName Token name * @param _symbol Token symbol * @param _maxBatch Maximum amout of each minting batch * * Emit event {Deployed} */ constructor( address _owner, string memory _tokenName, string memory _symbol, uint256 _maxBatch ) ERC721A(_tokenName, _symbol) { maxBatch = _maxBatch; transferOwnership(_owner); emit Deployed(_owner, _tokenName, _symbol); } // ============================================================= // OVERRIDE FUNCTIONS // ============================================================= /** * @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. * * Due to removal of OpenZeppelin, using super.supportsInterface in the function override may not work. * Source: https://chiru-labs.github.io/ERC721A/#/migration?id=supportsinterface */ function supportsInterface( bytes4 interfaceId ) public view override(ERC2981, IERC721A, ERC721A) returns (bool) { // Supports the following `interfaceId`s: // - IERC165: 0x01ffc9a7 // - IERC721: 0x80ac58cd // - IERC721Metadata: 0x5b5e139f // - IERC2981: 0x2a55205a return ERC721A.supportsInterface(interfaceId) || ERC2981.supportsInterface(interfaceId); } /** * @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 ) override internal virtual { if (from != address(0) && to != address(0)) { require(_statusOf[startTokenId] == TokenStatus.Valid, "Invalid status"); } super._beforeTokenTransfers(from, to, startTokenId, quantity); } /** * @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() override internal view virtual returns (string memory) { return baseURI; } // ============================================================= // SETTING STORAGE OPERATIONS // ============================================================= /** * @notice Set new maximum amout for each batch * * @dev Only admin can call this function * * Name Meaning * @param _maxBatch New maximum amount for each patch that want to set * * Emit event {SetMaxBatch} */ function setMaxBatch(uint256 _maxBatch) external onlyAdmin { require(_maxBatch > 0, "Invalid max batch"); uint256 oldMaxBatch = maxBatch; maxBatch = _maxBatch; emit SetMaxBatch(oldMaxBatch, maxBatch); } /** * @notice Set base token URI * * @dev Only admin can call this function * * Name Meaning * @param _baseUri New base URI */ function setBaseURI(string memory _baseUri) external onlyAdmin { string memory oldBaseURI = baseURI; baseURI = _baseUri; emit SetBaseURI(oldBaseURI, baseURI); } // ============================================================= // REFLECT DATA OPERATIONS // ============================================================= /** * @notice Set organization information when publishing a organization * * @dev Anyone can call this function * * Requirements: * - `_signature` is signed by verifier * * Name Meaning * @param _organizationId Organization ID * @param _organizationAddress Organization address * @param _receiptAddress Royalty receipt address * @param _nonce Unique parameter * @param _signature Signature that signed by verifier * * emit event {SetOrganizationInfo} */ function setOrganizationInfo( uint256 _organizationId, address _organizationAddress, address _receiptAddress, string memory _nonce, bytes memory _signature ) external { require(!isUsedSignature[_signature], "Invalid signature"); require(_receiptAddress != address(0), "Invalid address"); bytes32 _hash = keccak256(abi.encodePacked( _organizationId, _organizationAddress, _receiptAddress, _nonce )); require(Utils.verifySignature(_hash, _signature, verifier), "Invalid signature"); receiptAddressOf[_organizationId] = _receiptAddress; organizationAddressOf[_organizationId] = _organizationAddress; isUsedSignature[_signature] = true; emit SetOrganizationInfo(_organizationId, _organizationAddress, _receiptAddress); } /** * @notice Update organization info * * @dev Caller is `_organizationId` organization can call this function * * Name Meaning * @param _organizationId Organization ID * @param _receiptAddress Royalty receipt address * * emit event {UpdateOrganizationInfo} */ function updateOrganizationInfo(uint256 _organizationId, address _receiptAddress) external { require( organizationAddressOf[_organizationId] == _msgSender(), "Caller is not organization" ); require(_receiptAddress != address(0), "Invalid address"); address previousReceiptAddress = receiptAddressOf[_organizationId]; receiptAddressOf[_organizationId] = _receiptAddress; emit UpdateOrganizationInfo(_organizationId, previousReceiptAddress, _receiptAddress); } /** * @notice Set project information when publishing a project * * @dev Only `_organizationId` organization can call this function * * Name Meaning * @param _organizationId Organization ID * @param _projectId Project ID * @param _code Organization code - Project code * @param _royaltyPercent Royalty percent * * emit event {SetProjectInfo} */ function setProjectInfo( uint256 _organizationId, uint256 _projectId, string memory _code, uint96 _royaltyPercent ) external { require(organizationAddressOf[_organizationId] == _msgSender(), "Caller is not organization"); organizationIdOf[_projectId] = _organizationId; _projectCodeOf[_projectId] = _code; royaltyPercentOf[_projectId] = _royaltyPercent; emit SetProjectInfo( _organizationId , _projectId, _royaltyPercent, _code ); } /** * @notice Set monitoring cycle information when selling a monitoring cycle * * @dev Only organization who belongs to `_projectId` project can call this function * * Name Meaning * @param _projectId Project ID * @param _monitoringCycleId Monitoring cycle ID * @param _code Monitoring cycle code * * Emit event {SetMonitoringCycleInfo} */ function setMonitoringCycleInfo( uint256 _projectId, uint256 _monitoringCycleId, string memory _code ) external { uint256 organizationId = organizationIdOf[_projectId]; require( _msgSender() == organizationAddressOf[organizationId], "Caller is not organization" ); monitoringCodeOf[_projectId][_monitoringCycleId] = _code; projectIdOf[_monitoringCycleId] = _projectId; emit SetMonitoringCycleInfo(_projectId, _monitoringCycleId, _code); } // ============================================================= // SETTING TOKEN OPERATIONS // ============================================================= /** * @notice Set status of token by token ID * * Requirements: * - Caller is organization which the `_tokenId` token belongs to * * Name Meaning * @param _tokenId Token ID * @param _status New token status * * emit event {SetStatus} */ function setStatus(uint256 _tokenId, TokenStatus _status) external { require(_exists(_tokenId), "Nonexistent token"); uint256 organizationId = organizationIdOf[projectIdOf[monitoringCycleIdOf[_tokenId]]]; require( _msgSender() == organizationAddressOf[organizationId], "Caller is not organization" ); TokenStatus previousStatus = _statusOf[_tokenId]; _statusOf[_tokenId] = _status; emit SetStatus(_tokenId, previousStatus, _status); } /** * @notice Set batch of token statuses * * @dev Only organization which the `_tokenIds` token belongs to * * Requirements: * - Length of `_tokenIds` and `_statuses` are less than or equal `maxBatch` and consistent * * Name Meaning * @param _tokenIds Token IDs * @param _statuses Token statuses * * Emit event {SetBatchOfStatuses} */ function setBatchOfTokenStatuses(uint256[] memory _tokenIds, TokenStatus[] memory _statuses) external { uint256 length = _tokenIds.length; require(length > 0 && length <= maxBatch, "Invalid length"); require(length == _statuses.length, "Inconsistent length"); uint256 _organizationId = organizationIdOf[projectIdOf[monitoringCycleIdOf[_tokenIds[0]]]]; require( _msgSender() == organizationAddressOf[_organizationId], "Caller is not organization" ); TokenStatus[] memory previousStatuses = new TokenStatus[](length); for (uint256 i = 0; i < length; i++) { require(_exists(_tokenIds[i]), "Nonexistent token"); previousStatuses[i] = _statusOf[_tokenIds[i]]; _statusOf[_tokenIds[i]] = _statuses[i]; } emit SetBatchOfStatuses(_tokenIds, previousStatuses, _statuses); } // ============================================================= // MINT OPERATIONS // ============================================================= /** * @notice Store token information and mint a token * * @dev Save token information and mint a token * * Name Meaning * @param _params.to Recipient address * @param _params.volume Purchased volume * @param _params.monitoringCycleId Monitoring cycle ID */ function _handleMint(MintParams memory _params) private { uint256 nextId = _nextTokenId(); monitoringCycleIdOf[nextId] = _params.monitoringCycleId; purchasedVolumeOf[nextId] = _params.volume; _safeMint(_params.to, 1); } /** * @notice Mint a token with ETH by an organization admin * * @dev Caller is organization who belongs to `_params.monitoringCycleId` monitoring cycle * * Name Meaning * @param _to Recipient address * @param _monitoringCycleId Monitoring cycle ID * @param _price Amount of money that need to mint token * @param _volume Purchased volume * * Emit event {Mint} */ function mintWithEthByAdmin( address _to, uint256 _monitoringCycleId, uint256 _price, uint256 _volume ) external payable nonReentrant { uint256 organizationId = organizationIdOf[projectIdOf[_monitoringCycleId]]; require( _msgSender() == organizationAddressOf[organizationId], "Caller is not organization" ); require(msg.value == _price, "Invalid value"); uint256 nextId = _nextTokenId(); monitoringCycleIdOf[nextId] = _monitoringCycleId; purchasedVolumeOf[nextId] = _volume; _safeMint(_to, 1); Utils.transferEth(receiptAddressOf[organizationId], _price); emit Mint(_to, currentId(), ""); } /** * @notice Mint a token with ERC-20 by an organization admin * * @dev Caller is organization who belongs to `_params.monitoringCycleId` monitoring cycle * * Name Meaning * @param _to Recipient address * @param _paymentToken Payment token address * @param _monitoringCycleId Monitoring cycle ID * @param _price Amount of money that need to mint token * @param _volume Purchased volume * * Emit event {Mint} */ function mintWithErc20ByAdmin( address _to, address _paymentToken, uint256 _monitoringCycleId, uint256 _price, uint256 _volume ) external nonReentrant { uint256 organizationId = organizationIdOf[projectIdOf[_monitoringCycleId]]; require( _msgSender() == organizationAddressOf[organizationId], "Caller is not organization" ); uint256 tokenId = _nextTokenId(); monitoringCycleIdOf[tokenId] = _monitoringCycleId; purchasedVolumeOf[tokenId] = _volume; _safeMint(_to, 1); Utils.transferErc20( _msgSender(), receiptAddressOf[organizationId], _paymentToken, _price ); emit Mint(_to, currentId(), ""); } /** * @notice Mint a token by an admin without payment * * @dev * - Caller is organization who belongs to `_monitoringCycleId` monitoring cycle * - No need to transfer NFT price to receipt address * * Name Meaning * @param _to Recipient address * @param _volume Purchased volume * @param _monitoringCycleId Monitoring cycle ID * * Emit event {Mint} */ function mintWithoutPayment( address _to, uint256 _volume, uint256 _monitoringCycleId ) external nonReentrant { uint256 organizationId = organizationIdOf[projectIdOf[_monitoringCycleId]]; require( _msgSender() == organizationAddressOf[organizationId], "Caller is not organization" ); uint256 tokenId = _nextTokenId(); monitoringCycleIdOf[tokenId] = _monitoringCycleId; purchasedVolumeOf[tokenId] = _volume; _safeMint(_to, 1); emit Mint(_to, tokenId, ""); } /** * @notice Mint a token with ETH by a user * * @dev Anyone can call this function * * Requirements * - `_signature` is signed by verifier * * Name Meaning * @param _params.to Recipient address * @param _params.price Amount of money that need to mint token * @param _params.volume Purchased volume * @param _params.nonce Unique param * @param _params.monitoringCycleId Monitoring cycle ID * @param _params.expiredTime Expired time of signature * @param _signature Signature * * Emit event {Mint} */ function mintWithEthByUser( MintParams memory _params, bytes memory _signature ) external payable nonReentrant { uint256 organizationId = organizationIdOf[projectIdOf[_params.monitoringCycleId]]; require(!isUsedSignature[_signature], "Invalid signature"); require(msg.value == _params.price, "Invalid value"); require(_params.expiredTime >= block.timestamp, "Expired signature"); bytes32 _message = keccak256(abi.encodePacked( _params.to, _params.paymentToken, _params.nonce, _params.monitoringCycleId, _params.price, _params.volume, _params.expiredTime )); require(Utils.verifySignature(_message, _signature, verifier), "Invalid signature"); isUsedSignature[_signature] = true; _handleMint(_params); Utils.transferEth( receiptAddressOf[organizationId], _params.price ); emit Mint(_params.to, currentId(), _signature); } /** * @notice Mint a token with ERC-20 by a user * * @dev Anyone can call this function * * Requirements * - `_signature` is signed by verifier * * Name Meaning * @param _params.to Recipient address * @param _params.paymentToken Payment token address * @param _params.price Amount of money that need to mint token * @param _params.volume Purchased volume * @param _params.nonce Unique param * @param _params.monitoringCycleId Monitoring cycle ID * @param _params.expiredTime Expired time of signature * @param _signature Signature * * Emit event {Mint} */ function mintWithErc20ByUser( MintParams memory _params, bytes memory _signature ) external nonReentrant { require(!isUsedSignature[_signature], "Invalid signature"); require(_params.expiredTime >= block.timestamp, "Expired signature"); bytes32 _message = keccak256(abi.encodePacked( _params.to, _params.paymentToken, _params.nonce, _params.monitoringCycleId, _params.price, _params.volume, _params.expiredTime )); require(Utils.verifySignature(_message, _signature, verifier), "Invalid signature"); isUsedSignature[_signature] = true; _handleMint(_params); Utils.transferErc20( _params.to, receiptAddressOf[organizationIdOf[projectIdOf[_params.monitoringCycleId]]], _params.paymentToken, _params.price ); emit Mint(_params.to, currentId(), _signature); } /** * @notice Mint batch of tokens with ETH * * @dev Caller is organization who belongs to `_params[].monitoringCycleId` monitoring cycle * * Name Meaning * @param _params[].to Recipient address * @param _params[].price Amount of money that need to mint token * @param _params[].volume Purchased volume * @param _params[].monitoringCycleId Monitoring cycle ID * * Emit event {MintBatch} */ function mintBatchWithEth( MintBatchParams[] memory _params ) external payable nonReentrant { uint256 length = _params.length; require(length > 0 && length <= maxBatch, "Invalid length"); uint256 _organizationId = organizationIdOf[projectIdOf[_params[0].monitoringCycleId]]; require( _msgSender() == organizationAddressOf[_organizationId], "Caller is not organization" ); uint256 totalPrice = 0; uint256[] memory tokenIds = new uint256[](length); for (uint256 i = 0; i < length; i++) { totalPrice += _params[i].price; uint256 tokenId = _nextTokenId(); tokenIds[i] = tokenId; monitoringCycleIdOf[tokenId] = _params[i].monitoringCycleId; purchasedVolumeOf[tokenId] = _params[i].volume; _safeMint(_params[i].to, 1); } require(msg.value == totalPrice, "Invalid value"); Utils.transferEth(receiptAddressOf[_organizationId], totalPrice); emit MintBatch(tokenIds); } /** * @notice Mint batch of tokens with ERC-20 * * @dev Caller is organization who belongs to `_params[].monitoringCycleId` monitoring cycle * * Name Meaning * @param _paymentToken Payment token address * @param _params[].to Recipient address * @param _params[].price Amount of money that need to mint token * @param _params[].volume Purchased volume * @param _params[].monitoringCycleId Monitoring cycle ID * * Emit event {MintBatch} */ function mintBatchWithErc20( address _paymentToken, MintBatchParams[] memory _params ) external nonReentrant { uint256 length = _params.length; require(length > 0 && length <= maxBatch, "Invalid length"); uint256 _organizationId = organizationIdOf[projectIdOf[_params[0].monitoringCycleId]]; require( _msgSender() == organizationAddressOf[_organizationId], "Caller is not organization" ); uint256 totalPrice = 0; uint256[] memory tokenIds = new uint256[](length); for (uint256 i = 0; i < length; i++) { totalPrice += _params[i].price; uint256 tokenId = _nextTokenId(); tokenIds[i] = tokenId; monitoringCycleIdOf[tokenId] = _params[i].monitoringCycleId; purchasedVolumeOf[tokenId] = _params[i].volume; _safeMint(_params[i].to, 1); } Utils.transferErc20( _msgSender(), receiptAddressOf[_organizationId], _paymentToken, totalPrice ); emit MintBatch(tokenIds); } /** * @notice Mint batch of tokens without payment * * @dev * - Caller is organization who belongs to `_params[].monitoringCycleId` monitoring cycles * - No need to transfer NFTs price to receipt wallet * * Name Meaning * @param _params[].to Recipient address * @param _params[].volume Purchased volume * @param _params[].monitoringCycleId Monitoring cycle ID * * Emit event {MintBatch} */ function mintBatchWithoutPayment(MintBatchParams[] memory _params) external nonReentrant { uint256 length = _params.length; require(length > 0 && length <= maxBatch, "Invalid length"); uint256 _organizationId = organizationIdOf[projectIdOf[_params[0].monitoringCycleId]]; require( _msgSender() == organizationAddressOf[_organizationId], "Caller is not organization" ); uint256[] memory tokenIds = new uint256[](length); for (uint256 i = 0; i < length; i++) { uint256 tokenId = _nextTokenId(); tokenIds[i] = tokenId; monitoringCycleIdOf[tokenId] = _params[i].monitoringCycleId; purchasedVolumeOf[tokenId] = _params[i].volume; _safeMint(_params[i].to, 1); } emit MintBatch(tokenIds); } // ============================================================= // TOKEN COUNTING OPERATIONS // ============================================================= /** * @dev See {ERC721A-_startTokenId}. */ function _startTokenId() override internal view virtual returns (uint256) { return 1; } /** * @dev Returns the latest token ID */ function currentId() public view returns (uint256) { return _nextTokenId() - _startTokenId(); } // ============================================================= // GETTING TOKEN INFORMATION OPERATIONS // ============================================================= /** * @inheritdoc IERC2981 */ function royaltyInfo(uint256 tokenId, uint256 salePrice) override public view virtual returns (address, uint256) { uint256 projectId = projectIdOf[monitoringCycleIdOf[tokenId]]; uint96 percent = royaltyPercentOf[projectId]; address receiver = receiptAddressOf[organizationIdOf[projectId]]; uint256 royaltyAmount = (salePrice * percent) / _feeDenominator(); return (receiver, royaltyAmount); } /** * @dev Returns the Uniform Resource Identifier (URI) for `_tokenId` token. */ function tokenURI( uint256 _tokenId ) public view virtual override(IERC721A, ERC721A) returns (string memory) { if (!_exists(_tokenId)) revert URIQueryForNonexistentToken(); string memory _baseUri = _baseURI(); return bytes(_baseUri).length != 0 ? string(abi.encodePacked(_baseUri, _toString(_tokenId), ".json")) : ""; } /** * @dev Returns status of `_tokenId` token */ function statusOf(uint256 _tokenId) public view returns (TokenStatus) { if (!_exists(_tokenId)) revert URIQueryForNonexistentToken(); return _statusOf[_tokenId]; } /** * @dev Returns NFT code of `_tokenId` token (Organization code - Project code - Monitoring cycle code) */ function projectCodeOf(uint256 _tokenId) public view returns (string memory) { if (!_exists(_tokenId)) revert URIQueryForNonexistentToken(); uint256 monitoringCycleId = monitoringCycleIdOf[_tokenId]; uint256 projectId = projectIdOf[monitoringCycleId]; return string( abi.encodePacked( _projectCodeOf[projectIdOf[monitoringCycleId]], "-", monitoringCodeOf[projectId][monitoringCycleId] ) ); } // ============================================================= // BURN OPERATIONS // ============================================================= /** * @notice Burn (destroy) a token * * Requirements: * - `tokenId` must exist * * Name Meaning * @param tokenId Token ID * * Emit {Burn} */ function burn(uint256 tokenId) external { delete monitoringCycleIdOf[tokenId]; delete purchasedVolumeOf[tokenId]; delete _statusOf[tokenId]; _burn(tokenId, true); emit Burn(_msgSender(), tokenId); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.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. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling 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.9.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. * * _Available since v4.5._ */ interface IERC2981 is IERC165 { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be paid in that same unit of exchange. */ function royaltyInfo( uint256 tokenId, uint256 salePrice ) external view returns (address receiver, uint256 royaltyAmount); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == _ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/common/ERC2981.sol) pragma solidity ^0.8.0; import "../../interfaces/IERC2981.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information. * * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first. * * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the * fee is specified in basis points by default. * * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported. * * _Available since v4.5._ */ abstract contract ERC2981 is IERC2981, ERC165 { struct RoyaltyInfo { address receiver; uint96 royaltyFraction; } RoyaltyInfo private _defaultRoyaltyInfo; mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) { return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId); } /** * @inheritdoc IERC2981 */ function royaltyInfo(uint256 tokenId, uint256 salePrice) public view virtual override returns (address, uint256) { RoyaltyInfo memory royalty = _tokenRoyaltyInfo[tokenId]; if (royalty.receiver == address(0)) { royalty = _defaultRoyaltyInfo; } uint256 royaltyAmount = (salePrice * royalty.royaltyFraction) / _feeDenominator(); return (royalty.receiver, royaltyAmount); } /** * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an * override. */ function _feeDenominator() internal pure virtual returns (uint96) { return 10000; } /** * @dev Sets the royalty information that all ids in this contract will default to. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: invalid receiver"); _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Removes default royalty information. */ function _deleteDefaultRoyalty() internal virtual { delete _defaultRoyaltyInfo; } /** * @dev Sets the royalty information for a specific token id, overriding the global default. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: Invalid parameters"); _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Resets royalty information for the token id back to the global default. */ function _resetTokenRoyalty(uint256 tokenId) internal virtual { delete _tokenRoyaltyInfo[tokenId]; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to * 0 before setting it to a non-zero value. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [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://consensys.net/diligence/blog/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.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.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 message) { // 32 is the length in bytes of hash, // enforced by the type signature above /// @solidity memory-safe-assembly assembly { mstore(0x00, "\x19Ethereum Signed Message:\n32") mstore(0x1c, hash) message := keccak256(0x00, 0x3c) } } /** * @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 data) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(ptr, "\x19\x01") mstore(add(ptr, 0x02), domainSeparator) mstore(add(ptr, 0x22), structHash) data := keccak256(ptr, 0x42) } } /** * @dev Returns an Ethereum Signed Data with intended validator, created from a * `validator` and `data` according to the version 0 of EIP-191. * * See {recover}. */ function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x00", validator, data)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; import "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toString(int256 value) internal pure returns (string memory) { return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value)))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } }
//SPDX-License-Identifier: MIT pragma solidity 0.8.18; import "@openzeppelin/contracts/access/Ownable.sol"; contract Authorizable is Ownable { /** * @notice admin address is Admin address */ address public admin; /** * @notice verifier address is Verifier address */ address public verifier; /** * @notice Emit event when set an address to a admin */ event SetAdmin(address indexed oldAdmin, address indexed newAdmin); /** * @notice Emit event when set an address to a verififer */ event SetVerifier(address indexed oldVerifier, address indexed newVerifier); modifier onlyAdmin() { require(_msgSender() == admin, "Ownable: Caller is not admin"); _; } /** * @notice Set address to an admin * @param _account New amin address that want to set * * Emit event {SetAdmin} */ function setAdmin(address _account) external onlyOwner { require(_account != address(0), "Ownable: Invalid address"); address oldAdmin = admin; admin = _account; emit SetAdmin(oldAdmin, admin); } /** * @notice Set address to a verifier * @param _account New verifier address that want to set * * Emit event {SetVerifier} */ function setVerifier(address _account) external onlyAdmin { require(_account != address(0), "Ownable: Invalid address"); address oldVerifier = verifier; verifier = _account; emit SetVerifier(oldVerifier, verifier); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.18; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/Address.sol"; library Utils { using ECDSA for bytes32; using SafeERC20 for IERC20; using Address for address payable; /** * @notice Verify signature * * @dev Utility function * * Name Meaning * @param _message Message hash * @param _signature Signature * * @return Check if signature is signed by verifier */ function verifySignature(bytes32 _message, bytes memory _signature, address _verifier) internal pure returns (bool) { bytes32 ethSignedMessageHash = _message.toEthSignedMessageHash(); return ethSignedMessageHash.recover(_signature) == _verifier; } /** * @notice Transfer native token * * @dev Utility function * * Name Meaning * @param _to Recipient address * @param _amount Amount of native token */ function transferEth(address _to, uint256 _amount) internal { payable(_to).sendValue(_amount); } /** * @notice Transfer ERC-20 token * * @dev Utility function * * Name Meaning * @param _from Sender address * @param _to Recipient address * @param _amount Amount of ERC-20 token */ function transferErc20(address _from, address _to, address _paymentToken, uint256 _amount) internal { //slither-disable-next-line arbitrary-send-erc20 IERC20(_paymentToken).safeTransferFrom(_from, _to, _amount); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.18; struct MintParams { address to; // Recipient address address paymentToken; // Payment token address string nonce; // Unique parameter uint256 monitoringCycleId; // Monitoring cycle ID uint256 price; // NFT price uint256 volume; // Purchased volume uint256 expiredTime; // Expired time of signature } struct MintBatchParams { address to; uint256 monitoringCycleId; uint256 price; uint256 volume; } enum TokenStatus { Valid, // Project not applied, Project applied, project certified Revoked, Retired, Expired }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721A.sol'; /** * @dev Interface of ERC721 token receiver. */ interface ERC721A__IERC721Receiver { function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } /** * @title ERC721A * * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721) * Non-Fungible Token Standard, including the Metadata extension. * Optimized for lower gas during batch mints. * * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...) * starting from `_startTokenId()`. * * Assumptions: * * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256). */ contract ERC721A is IERC721A { // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364). struct TokenApprovalRef { address value; } // ============================================================= // CONSTANTS // ============================================================= // Mask of an entry in packed address data. uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1; // The bit position of `numberMinted` in packed address data. uint256 private constant _BITPOS_NUMBER_MINTED = 64; // The bit position of `numberBurned` in packed address data. uint256 private constant _BITPOS_NUMBER_BURNED = 128; // The bit position of `aux` in packed address data. uint256 private constant _BITPOS_AUX = 192; // Mask of all 256 bits in packed address data except the 64 bits for `aux`. uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1; // The bit position of `startTimestamp` in packed ownership. uint256 private constant _BITPOS_START_TIMESTAMP = 160; // The bit mask of the `burned` bit in packed ownership. uint256 private constant _BITMASK_BURNED = 1 << 224; // The bit position of the `nextInitialized` bit in packed ownership. uint256 private constant _BITPOS_NEXT_INITIALIZED = 225; // The bit mask of the `nextInitialized` bit in packed ownership. uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225; // The bit position of `extraData` in packed ownership. uint256 private constant _BITPOS_EXTRA_DATA = 232; // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`. uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1; // The mask of the lower 160 bits for addresses. uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1; // The maximum `quantity` that can be minted with {_mintERC2309}. // This limit is to prevent overflows on the address data entries. // For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309} // is required to cause an overflow, which is unrealistic. uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000; // The `Transfer` event signature is given by: // `keccak256(bytes("Transfer(address,address,uint256)"))`. bytes32 private constant _TRANSFER_EVENT_SIGNATURE = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; // ============================================================= // STORAGE // ============================================================= // The next token ID to be minted. uint256 private _currentIndex; // The number of tokens burned. uint256 private _burnCounter; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. // See {_packedOwnershipOf} implementation for details. // // Bits Layout: // - [0..159] `addr` // - [160..223] `startTimestamp` // - [224] `burned` // - [225] `nextInitialized` // - [232..255] `extraData` mapping(uint256 => uint256) private _packedOwnerships; // Mapping owner address to address data. // // Bits Layout: // - [0..63] `balance` // - [64..127] `numberMinted` // - [128..191] `numberBurned` // - [192..255] `aux` mapping(address => uint256) private _packedAddressData; // Mapping from token ID to approved address. mapping(uint256 => TokenApprovalRef) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; // ============================================================= // CONSTRUCTOR // ============================================================= constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; _currentIndex = _startTokenId(); } // ============================================================= // TOKEN COUNTING OPERATIONS // ============================================================= /** * @dev Returns the starting token ID. * To change the starting token ID, please override this function. */ function _startTokenId() internal view virtual returns (uint256) { return 0; } /** * @dev Returns the next token ID to be minted. */ function _nextTokenId() internal view virtual returns (uint256) { return _currentIndex; } /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() public view virtual override returns (uint256) { // Counter underflow is impossible as _burnCounter cannot be incremented // more than `_currentIndex - _startTokenId()` times. unchecked { return _currentIndex - _burnCounter - _startTokenId(); } } /** * @dev Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view virtual returns (uint256) { // Counter underflow is impossible as `_currentIndex` does not decrement, // and it is initialized to `_startTokenId()`. unchecked { return _currentIndex - _startTokenId(); } } /** * @dev Returns the total number of tokens burned. */ function _totalBurned() internal view virtual returns (uint256) { return _burnCounter; } // ============================================================= // ADDRESS DATA OPERATIONS // ============================================================= /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) public view virtual override returns (uint256) { if (owner == address(0)) revert BalanceQueryForZeroAddress(); return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens minted by `owner`. */ function _numberMinted(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens burned by or on behalf of `owner`. */ function _numberBurned(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). */ function _getAux(address owner) internal view returns (uint64) { return uint64(_packedAddressData[owner] >> _BITPOS_AUX); } /** * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). * If there are multiple variables, please pack them into a uint64. */ function _setAux(address owner, uint64 aux) internal virtual { uint256 packed = _packedAddressData[owner]; uint256 auxCasted; // Cast `aux` with assembly to avoid redundant masking. assembly { auxCasted := aux } packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX); _packedAddressData[owner] = packed; } // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { // The interface IDs are constants representing the first 4 bytes // of the XOR of all function selectors in the interface. // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165) // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`) return interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165. interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721. interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata. } // ============================================================= // IERC721Metadata // ============================================================= /** * @dev Returns the token collection name. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the token collection symbol. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : ''; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, it can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ''; } // ============================================================= // OWNERSHIPS OPERATIONS // ============================================================= /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { return address(uint160(_packedOwnershipOf(tokenId))); } /** * @dev Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around over time. */ function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnershipOf(tokenId)); } /** * @dev Returns the unpacked `TokenOwnership` struct at `index`. */ function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnerships[index]); } /** * @dev Initializes the ownership slot minted at `index` for efficiency purposes. */ function _initializeOwnershipAt(uint256 index) internal virtual { if (_packedOwnerships[index] == 0) { _packedOwnerships[index] = _packedOwnershipOf(index); } } /** * Returns the packed ownership data of `tokenId`. */ function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) { uint256 curr = tokenId; unchecked { if (_startTokenId() <= curr) if (curr < _currentIndex) { uint256 packed = _packedOwnerships[curr]; // If not burned. if (packed & _BITMASK_BURNED == 0) { // Invariant: // There will always be an initialized ownership slot // (i.e. `ownership.addr != address(0) && ownership.burned == false`) // before an unintialized ownership slot // (i.e. `ownership.addr == address(0) && ownership.burned == false`) // Hence, `curr` will not underflow. // // We can directly compare the packed value. // If the address is zero, packed will be zero. while (packed == 0) { packed = _packedOwnerships[--curr]; } return packed; } } } revert OwnerQueryForNonexistentToken(); } /** * @dev Returns the unpacked `TokenOwnership` struct from `packed`. */ function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) { ownership.addr = address(uint160(packed)); ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP); ownership.burned = packed & _BITMASK_BURNED != 0; ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA); } /** * @dev Packs ownership data into a single uint256. */ function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`. result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags)) } } /** * @dev Returns the `nextInitialized` flag set if `quantity` equals 1. */ function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) { // For branchless setting of the `nextInitialized` flag. assembly { // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`. result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1)) } } // ============================================================= // APPROVAL OPERATIONS // ============================================================= /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the * zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) public payable virtual override { address owner = ownerOf(tokenId); if (_msgSenderERC721A() != owner) if (!isApprovedForAll(owner, _msgSenderERC721A())) { revert ApprovalCallerNotOwnerNorApproved(); } _tokenApprovals[tokenId].value = to; emit Approval(owner, to, tokenId); } /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken(); return _tokenApprovals[tokenId].value; } /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} * for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool approved) public virtual override { _operatorApprovals[_msgSenderERC721A()][operator] = approved; emit ApprovalForAll(_msgSenderERC721A(), operator, approved); } /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted. See {_mint}. */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _startTokenId() <= tokenId && tokenId < _currentIndex && // If within bounds, _packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned. } /** * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`. */ function _isSenderApprovedOrOwner( address approvedAddress, address owner, address msgSender ) private pure returns (bool result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean. msgSender := and(msgSender, _BITMASK_ADDRESS) // `msgSender == owner || msgSender == approvedAddress`. result := or(eq(msgSender, owner), eq(msgSender, approvedAddress)) } } /** * @dev Returns the storage slot and value for the approved address of `tokenId`. */ function _getApprovedSlotAndAddress(uint256 tokenId) private view returns (uint256 approvedAddressSlot, address approvedAddress) { TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId]; // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`. assembly { approvedAddressSlot := tokenApproval.slot approvedAddress := sload(approvedAddressSlot) } } // ============================================================= // TRANSFER OPERATIONS // ============================================================= /** * @dev Transfers `tokenId` from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) public payable virtual override { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner(); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); if (to == address(0)) revert TransferToZeroAddress(); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // We can directly increment and decrement the balances. --_packedAddressData[from]; // Updates: `balance -= 1`. ++_packedAddressData[to]; // Updates: `balance += 1`. // Updates: // - `address` to the next owner. // - `startTimestamp` to the timestamp of transfering. // - `burned` to `false`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _packOwnershipData( to, _BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public payable virtual override { safeTransferFrom(from, to, tokenId, ''); } /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public payable virtual override { transferFrom(from, to, tokenId); if (to.code.length != 0) if (!_checkContractOnERC721Received(from, to, tokenId, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } /** * @dev Hook that is called before a set of serially-ordered token IDs * are about to be transferred. This includes minting. * And also called before burning one token. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token IDs * have been transferred. This includes minting. * And also called after one token has been burned. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been * transferred to `to`. * - When `from` is zero, `tokenId` has been minted for `to`. * - When `to` is zero, `tokenId` has been burned by `from`. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract. * * `from` - Previous owner of the given token ID. * `to` - Target address that will receive the token. * `tokenId` - Token ID to be transferred. * `_data` - Optional data to send along with the call. * * Returns whether the call correctly returned the expected magic value. */ function _checkContractOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns ( bytes4 retval ) { return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert TransferToNonERC721ReceiverImplementer(); } else { assembly { revert(add(32, reason), mload(reason)) } } } } // ============================================================= // MINT OPERATIONS // ============================================================= /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event for each mint. */ function _mint(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // `balance` and `numberMinted` have a maximum limit of 2**64. // `tokenId` has a maximum limit of 2**256. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); uint256 toMasked; uint256 end = startTokenId + quantity; // Use assembly to loop and emit the `Transfer` event for gas savings. // The duplicated `log4` removes an extra check and reduces stack juggling. // The assembly, together with the surrounding Solidity code, have been // delicately arranged to nudge the compiler into producing optimized opcodes. assembly { // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. toMasked := and(to, _BITMASK_ADDRESS) // Emit the `Transfer` event. log4( 0, // Start of data (0, since no data). 0, // End of data (0, since no data). _TRANSFER_EVENT_SIGNATURE, // Signature. 0, // `address(0)`. toMasked, // `to`. startTokenId // `tokenId`. ) // The `iszero(eq(,))` check ensures that large values of `quantity` // that overflows uint256 will make the loop run out of gas. // The compiler will optimize the `iszero` away for performance. for { let tokenId := add(startTokenId, 1) } iszero(eq(tokenId, end)) { tokenId := add(tokenId, 1) } { // Emit the `Transfer` event. Similar to above. log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId) } } if (toMasked == 0) revert MintToZeroAddress(); _currentIndex = end; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * This function is intended for efficient minting only during contract creation. * * It emits only one {ConsecutiveTransfer} as defined in * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309), * instead of a sequence of {Transfer} event(s). * * Calling this function outside of contract creation WILL make your contract * non-compliant with the ERC721 standard. * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309 * {ConsecutiveTransfer} event is only permissible during contract creation. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {ConsecutiveTransfer} event. */ function _mintERC2309(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are unrealistic due to the above check for `quantity` to be below the limit. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to); _currentIndex = startTokenId + quantity; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * See {_mint}. * * Emits a {Transfer} event for each mint. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal virtual { _mint(to, quantity); unchecked { if (to.code.length != 0) { uint256 end = _currentIndex; uint256 index = end - quantity; do { if (!_checkContractOnERC721Received(address(0), to, index++, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } while (index < end); // Reentrancy protection. if (_currentIndex != end) revert(); } } } /** * @dev Equivalent to `_safeMint(to, quantity, '')`. */ function _safeMint(address to, uint256 quantity) internal virtual { _safeMint(to, quantity, ''); } // ============================================================= // BURN OPERATIONS // ============================================================= /** * @dev Equivalent to `_burn(tokenId, false)`. */ function _burn(uint256 tokenId) internal virtual { _burn(tokenId, false); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId, bool approvalCheck) internal virtual { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); address from = address(uint160(prevOwnershipPacked)); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); if (approvalCheck) { // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); } _beforeTokenTransfers(from, address(0), tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // Updates: // - `balance -= 1`. // - `numberBurned += 1`. // // We can directly decrement the balance, and increment the number burned. // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`. _packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1; // Updates: // - `address` to the last owner. // - `startTimestamp` to the timestamp of burning. // - `burned` to `true`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _packOwnershipData( from, (_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, address(0), tokenId); _afterTokenTransfers(from, address(0), tokenId, 1); // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times. unchecked { _burnCounter++; } } // ============================================================= // EXTRA DATA OPERATIONS // ============================================================= /** * @dev Directly sets the extra data for the ownership data `index`. */ function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual { uint256 packed = _packedOwnerships[index]; if (packed == 0) revert OwnershipNotInitializedForExtraData(); uint256 extraDataCasted; // Cast `extraData` with assembly to avoid redundant masking. assembly { extraDataCasted := extraData } packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA); _packedOwnerships[index] = packed; } /** * @dev Called during each token transfer to set the 24bit `extraData` field. * Intended to be overridden by the cosumer contract. * * `previousExtraData` - the value of `extraData` before transfer. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _extraData( address from, address to, uint24 previousExtraData ) internal view virtual returns (uint24) {} /** * @dev Returns the next extra data for the packed ownership data. * The returned result is shifted into position. */ function _nextExtraData( address from, address to, uint256 prevOwnershipPacked ) private view returns (uint256) { uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA); return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA; } // ============================================================= // OTHER OPERATIONS // ============================================================= /** * @dev Returns the message sender (defaults to `msg.sender`). * * If you are writing GSN compatible contracts, you need to override this function. */ function _msgSenderERC721A() internal view virtual returns (address) { return msg.sender; } /** * @dev Converts a uint256 to its ASCII string decimal representation. */ function _toString(uint256 value) internal pure virtual returns (string memory str) { assembly { // The maximum value of a uint256 contains 78 digits (1 byte per digit), but // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned. // We will need 1 word for the trailing zeros padding, 1 word for the length, // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0. let m := add(mload(0x40), 0xa0) // Update the free memory pointer to allocate. mstore(0x40, m) // Assign the `str` to the end. str := sub(m, 0x20) // Zeroize the slot after the string. mstore(str, 0) // Cache the end of the memory to calculate the length later. let end := str // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. // prettier-ignore for { let temp := value } 1 {} { str := sub(str, 1) // Write the character to the pointer. // The ASCII index of the '0' character is 48. mstore8(str, add(48, mod(temp, 10))) // Keep dividing `temp` until zero. temp := div(temp, 10) // prettier-ignore if iszero(temp) { break } } let length := sub(end, str) // Move the pointer 32 bytes leftwards to make room for the length. str := sub(str, 0x20) // Store the length. mstore(str, length) } } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721AQueryable.sol'; import '../ERC721A.sol'; /** * @title ERC721AQueryable. * * @dev ERC721A subclass with convenience query functions. */ abstract contract ERC721AQueryable is ERC721A, IERC721AQueryable { /** * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting. * * If the `tokenId` is out of bounds: * * - `addr = address(0)` * - `startTimestamp = 0` * - `burned = false` * - `extraData = 0` * * If the `tokenId` is burned: * * - `addr = <Address of owner before token was burned>` * - `startTimestamp = <Timestamp when token was burned>` * - `burned = true` * - `extraData = <Extra data when token was burned>` * * Otherwise: * * - `addr = <Address of owner>` * - `startTimestamp = <Timestamp of start of ownership>` * - `burned = false` * - `extraData = <Extra data at start of ownership>` */ function explicitOwnershipOf(uint256 tokenId) public view virtual override returns (TokenOwnership memory) { TokenOwnership memory ownership; if (tokenId < _startTokenId() || tokenId >= _nextTokenId()) { return ownership; } ownership = _ownershipAt(tokenId); if (ownership.burned) { return ownership; } return _ownershipOf(tokenId); } /** * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order. * See {ERC721AQueryable-explicitOwnershipOf} */ function explicitOwnershipsOf(uint256[] calldata tokenIds) external view virtual override returns (TokenOwnership[] memory) { unchecked { uint256 tokenIdsLength = tokenIds.length; TokenOwnership[] memory ownerships = new TokenOwnership[](tokenIdsLength); for (uint256 i; i != tokenIdsLength; ++i) { ownerships[i] = explicitOwnershipOf(tokenIds[i]); } return ownerships; } } /** * @dev Returns an array of token IDs owned by `owner`, * in the range [`start`, `stop`) * (i.e. `start <= tokenId < stop`). * * This function allows for tokens to be queried if the collection * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}. * * Requirements: * * - `start < stop` */ function tokensOfOwnerIn( address owner, uint256 start, uint256 stop ) external view virtual override returns (uint256[] memory) { unchecked { if (start >= stop) revert InvalidQueryRange(); uint256 tokenIdsIdx; uint256 stopLimit = _nextTokenId(); // Set `start = max(start, _startTokenId())`. if (start < _startTokenId()) { start = _startTokenId(); } // Set `stop = min(stop, stopLimit)`. if (stop > stopLimit) { stop = stopLimit; } uint256 tokenIdsMaxLength = balanceOf(owner); // Set `tokenIdsMaxLength = min(balanceOf(owner), stop - start)`, // to cater for cases where `balanceOf(owner)` is too big. if (start < stop) { uint256 rangeLength = stop - start; if (rangeLength < tokenIdsMaxLength) { tokenIdsMaxLength = rangeLength; } } else { tokenIdsMaxLength = 0; } uint256[] memory tokenIds = new uint256[](tokenIdsMaxLength); if (tokenIdsMaxLength == 0) { return tokenIds; } // We need to call `explicitOwnershipOf(start)`, // because the slot at `start` may not be initialized. TokenOwnership memory ownership = explicitOwnershipOf(start); address currOwnershipAddr; // If the starting slot exists (i.e. not burned), initialize `currOwnershipAddr`. // `ownership.address` will not be zero, as `start` is clamped to the valid token ID range. if (!ownership.burned) { currOwnershipAddr = ownership.addr; } for (uint256 i = start; i != stop && tokenIdsIdx != tokenIdsMaxLength; ++i) { ownership = _ownershipAt(i); if (ownership.burned) { continue; } if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; } if (currOwnershipAddr == owner) { tokenIds[tokenIdsIdx++] = i; } } // Downsize the array to fit. assembly { mstore(tokenIds, tokenIdsIdx) } return tokenIds; } } /** * @dev Returns an array of token IDs owned by `owner`. * * This function scans the ownership mapping and is O(`totalSupply`) in complexity. * It is meant to be called off-chain. * * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into * multiple smaller scans if the collection is large enough to cause * an out-of-gas error (10K collections should be fine). */ function tokensOfOwner(address owner) external view virtual override returns (uint256[] memory) { unchecked { uint256 tokenIdsIdx; address currOwnershipAddr; uint256 tokenIdsLength = balanceOf(owner); uint256[] memory tokenIds = new uint256[](tokenIdsLength); TokenOwnership memory ownership; for (uint256 i = _startTokenId(); tokenIdsIdx != tokenIdsLength; ++i) { ownership = _ownershipAt(i); if (ownership.burned) { continue; } if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; } if (currOwnershipAddr == owner) { tokenIds[tokenIdsIdx++] = i; } } return tokenIds; } } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import '../IERC721A.sol'; /** * @dev Interface of ERC721AQueryable. */ interface IERC721AQueryable is IERC721A { /** * Invalid query range (`start` >= `stop`). */ error InvalidQueryRange(); /** * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting. * * If the `tokenId` is out of bounds: * * - `addr = address(0)` * - `startTimestamp = 0` * - `burned = false` * - `extraData = 0` * * If the `tokenId` is burned: * * - `addr = <Address of owner before token was burned>` * - `startTimestamp = <Timestamp when token was burned>` * - `burned = true` * - `extraData = <Extra data when token was burned>` * * Otherwise: * * - `addr = <Address of owner>` * - `startTimestamp = <Timestamp of start of ownership>` * - `burned = false` * - `extraData = <Extra data at start of ownership>` */ function explicitOwnershipOf(uint256 tokenId) external view returns (TokenOwnership memory); /** * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order. * See {ERC721AQueryable-explicitOwnershipOf} */ function explicitOwnershipsOf(uint256[] memory tokenIds) external view returns (TokenOwnership[] memory); /** * @dev Returns an array of token IDs owned by `owner`, * in the range [`start`, `stop`) * (i.e. `start <= tokenId < stop`). * * This function allows for tokens to be queried if the collection * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}. * * Requirements: * * - `start < stop` */ function tokensOfOwnerIn( address owner, uint256 start, uint256 stop ) external view returns (uint256[] memory); /** * @dev Returns an array of token IDs owned by `owner`. * * This function scans the ownership mapping and is O(`totalSupply`) in complexity. * It is meant to be called off-chain. * * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into * multiple smaller scans if the collection is large enough to cause * an out-of-gas error (10K collections should be fine). */ function tokensOfOwner(address owner) external view returns (uint256[] memory); }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; /** * @dev Interface of ERC721A. */ interface IERC721A { /** * The caller must own the token or be an approved operator. */ error ApprovalCallerNotOwnerNorApproved(); /** * The token does not exist. */ error ApprovalQueryForNonexistentToken(); /** * Cannot query the balance for the zero address. */ error BalanceQueryForZeroAddress(); /** * Cannot mint to the zero address. */ error MintToZeroAddress(); /** * The quantity of tokens minted must be more than zero. */ error MintZeroQuantity(); /** * The token does not exist. */ error OwnerQueryForNonexistentToken(); /** * The caller must own the token or be an approved operator. */ error TransferCallerNotOwnerNorApproved(); /** * The token must be owned by `from`. */ error TransferFromIncorrectOwner(); /** * Cannot safely transfer to a contract that does not implement the * ERC721Receiver interface. */ error TransferToNonERC721ReceiverImplementer(); /** * Cannot transfer to the zero address. */ error TransferToZeroAddress(); /** * The token does not exist. */ error URIQueryForNonexistentToken(); /** * The `quantity` minted with ERC2309 exceeds the safety limit. */ error MintERC2309QuantityExceedsLimit(); /** * The `extraData` cannot be set on an unintialized ownership slot. */ error OwnershipNotInitializedForExtraData(); // ============================================================= // STRUCTS // ============================================================= struct TokenOwnership { // The address of the owner. address addr; // Stores the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}. uint24 extraData; } // ============================================================= // TOKEN COUNTERS // ============================================================= /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() external view returns (uint256); // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); // ============================================================= // IERC721 // ============================================================= /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables * (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, * checking first that contract recipients are aware of the ERC721 protocol * to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move * this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external payable; /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external payable; /** * @dev Transfers `tokenId` from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} * whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external payable; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the * zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external payable; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} * for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) external view returns (bool); // ============================================================= // IERC721Metadata // ============================================================= /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); // ============================================================= // IERC2309 // ============================================================= /** * @dev Emitted when tokens in `fromTokenId` to `toTokenId` * (inclusive) is transferred from `from` to `to`, as defined in the * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard. * * See {_mintERC2309} for more details. */ event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to); }
{ "optimizer": { "enabled": true, "runs": 1000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"string","name":"_tokenName","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint256","name":"_maxBatch","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"InvalidQueryRange","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"ConsecutiveTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"string","name":"tokenName","type":"string"},{"indexed":false,"internalType":"string","name":"symbol","type":"string"}],"name":"Deployed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"signature","type":"bytes"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"MintBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldAdmin","type":"address"},{"indexed":true,"internalType":"address","name":"newAdmin","type":"address"}],"name":"SetAdmin","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"oldBaseURI","type":"string"},{"indexed":false,"internalType":"string","name":"newBaseURI","type":"string"}],"name":"SetBaseURI","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"indexed":false,"internalType":"enum TokenStatus[]","name":"previousStatues","type":"uint8[]"},{"indexed":false,"internalType":"enum TokenStatus[]","name":"statuses","type":"uint8[]"}],"name":"SetBatchOfStatuses","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldMaxBatch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newMaxBatch","type":"uint256"}],"name":"SetMaxBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"projectId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"monitoringCycleId","type":"uint256"},{"indexed":false,"internalType":"string","name":"code","type":"string"}],"name":"SetMonitoringCycleInfo","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"organizationId","type":"uint256"},{"indexed":false,"internalType":"address","name":"organizationAddress","type":"address"},{"indexed":false,"internalType":"address","name":"receiptAddress","type":"address"}],"name":"SetOrganizationInfo","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"organizationId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"projectId","type":"uint256"},{"indexed":false,"internalType":"uint96","name":"feeNumerator","type":"uint96"},{"indexed":false,"internalType":"string","name":"code","type":"string"}],"name":"SetProjectInfo","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"enum TokenStatus","name":"previousStatus","type":"uint8"},{"indexed":false,"internalType":"enum TokenStatus","name":"status","type":"uint8"}],"name":"SetStatus","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldVerifier","type":"address"},{"indexed":true,"internalType":"address","name":"newVerifier","type":"address"}],"name":"SetVerifier","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"organizationId","type":"uint256"},{"indexed":false,"internalType":"address","name":"previousReceiptAddress","type":"address"},{"indexed":false,"internalType":"address","name":"newReceiptAddress","type":"address"}],"name":"UpdateOrganizationInfo","type":"event"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"explicitOwnershipOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"},{"internalType":"uint24","name":"extraData","type":"uint24"}],"internalType":"struct IERC721A.TokenOwnership","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"explicitOwnershipsOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"},{"internalType":"uint24","name":"extraData","type":"uint24"}],"internalType":"struct IERC721A.TokenOwnership[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"","type":"bytes"}],"name":"isUsedSignature","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxBatch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_paymentToken","type":"address"},{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"monitoringCycleId","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"volume","type":"uint256"}],"internalType":"struct MintBatchParams[]","name":"_params","type":"tuple[]"}],"name":"mintBatchWithErc20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"monitoringCycleId","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"volume","type":"uint256"}],"internalType":"struct MintBatchParams[]","name":"_params","type":"tuple[]"}],"name":"mintBatchWithEth","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"monitoringCycleId","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"volume","type":"uint256"}],"internalType":"struct MintBatchParams[]","name":"_params","type":"tuple[]"}],"name":"mintBatchWithoutPayment","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"address","name":"_paymentToken","type":"address"},{"internalType":"uint256","name":"_monitoringCycleId","type":"uint256"},{"internalType":"uint256","name":"_price","type":"uint256"},{"internalType":"uint256","name":"_volume","type":"uint256"}],"name":"mintWithErc20ByAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"paymentToken","type":"address"},{"internalType":"string","name":"nonce","type":"string"},{"internalType":"uint256","name":"monitoringCycleId","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"volume","type":"uint256"},{"internalType":"uint256","name":"expiredTime","type":"uint256"}],"internalType":"struct MintParams","name":"_params","type":"tuple"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"mintWithErc20ByUser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_monitoringCycleId","type":"uint256"},{"internalType":"uint256","name":"_price","type":"uint256"},{"internalType":"uint256","name":"_volume","type":"uint256"}],"name":"mintWithEthByAdmin","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"paymentToken","type":"address"},{"internalType":"string","name":"nonce","type":"string"},{"internalType":"uint256","name":"monitoringCycleId","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"volume","type":"uint256"},{"internalType":"uint256","name":"expiredTime","type":"uint256"}],"internalType":"struct MintParams","name":"_params","type":"tuple"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"mintWithEthByUser","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_volume","type":"uint256"},{"internalType":"uint256","name":"_monitoringCycleId","type":"uint256"}],"name":"mintWithoutPayment","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"monitoringCodeOf","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"monitoringCycleIdOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"organizationAddressOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"organizationIdOf","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":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"projectCodeOf","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"projectIdOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"purchasedVolumeOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"receiptAddressOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"royaltyPercentOf","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"setAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_baseUri","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"enum TokenStatus[]","name":"_statuses","type":"uint8[]"}],"name":"setBatchOfTokenStatuses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxBatch","type":"uint256"}],"name":"setMaxBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_projectId","type":"uint256"},{"internalType":"uint256","name":"_monitoringCycleId","type":"uint256"},{"internalType":"string","name":"_code","type":"string"}],"name":"setMonitoringCycleInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_organizationId","type":"uint256"},{"internalType":"address","name":"_organizationAddress","type":"address"},{"internalType":"address","name":"_receiptAddress","type":"address"},{"internalType":"string","name":"_nonce","type":"string"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"setOrganizationInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_organizationId","type":"uint256"},{"internalType":"uint256","name":"_projectId","type":"uint256"},{"internalType":"string","name":"_code","type":"string"},{"internalType":"uint96","name":"_royaltyPercent","type":"uint96"}],"name":"setProjectInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"enum TokenStatus","name":"_status","type":"uint8"}],"name":"setStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"setVerifier","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"statusOf","outputs":[{"internalType":"enum TokenStatus","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"tokensOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"stop","type":"uint256"}],"name":"tokensOfOwnerIn","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_organizationId","type":"uint256"},{"internalType":"address","name":"_receiptAddress","type":"address"}],"name":"updateOrganizationInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"verifier","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b5060405162005c4d38038062005c4d8339810160408190526200003491620002c0565b82826200004133620000c2565b60076200004f8382620003e1565b5060086200005e8282620003e1565b50600160055550506001600d55600e8190556200007b8462000112565b7fd29cbc69afa114986c0019e941d2815933173004ff6fa4993814db1ac13c929d848484604051620000b093929190620004db565b60405180910390a15050505062000515565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6200011c62000195565b6001600160a01b038116620001875760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6200019281620000c2565b50565b6000546001600160a01b03163314620001f15760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016200017e565b565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620002265781810151838201526020016200020c565b50506000910152565b600082601f8301126200024157600080fd5b81516001600160401b03808211156200025e576200025e620001f3565b604051601f8301601f19908116603f01168101908282118183101715620002895762000289620001f3565b81604052838152866020858801011115620002a357600080fd5b620002b684602083016020890162000209565b9695505050505050565b60008060008060808587031215620002d757600080fd5b84516001600160a01b0381168114620002ef57600080fd5b60208601519094506001600160401b03808211156200030d57600080fd5b6200031b888389016200022f565b945060408701519150808211156200033257600080fd5b5062000341878288016200022f565b606096909601519497939650505050565b600181811c908216806200036757607f821691505b6020821081036200038857634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620003dc57600081815260208120601f850160051c81016020861015620003b75750805b601f850160051c820191505b81811015620003d857828155600101620003c3565b5050505b505050565b81516001600160401b03811115620003fd57620003fd620001f3565b62000415816200040e845462000352565b846200038e565b602080601f8311600181146200044d5760008415620004345750858301515b600019600386901b1c1916600185901b178555620003d8565b600085815260208120601f198616915b828110156200047e578886015182559484019460019091019084016200045d565b50858210156200049d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60008151808452620004c781602086016020860162000209565b601f01601f19169290920160200192915050565b6001600160a01b03841681526060602082018190526000906200050190830185620004ad565b8281036040840152620002b68185620004ad565b61572880620005256000396000f3fe6080604052600436106103765760003560e01c80636c0360eb116101d1578063b7d1202211610102578063ce7139a4116100a0578063e2f422491161006f578063e2f4224914610ac6578063e985e9c514610ae6578063f2fde38b14610b2f578063f851a44014610b4f57600080fd5b8063ce7139a414610a51578063ceb23acd14610a71578063d896dd6414610a91578063e00dd16114610ab157600080fd5b8063ba209be2116100dc578063ba209be2146109b7578063bdad4455146109e4578063c23dc68f14610a04578063c87b56dd14610a3157600080fd5b8063b7d1202214610939578063b8111dad1461094c578063b88d4fde146109a457600080fd5b80638da5cb5b1161016f57806399a2557a1161014957806399a2557a146108ac578063a22cb465146108cc578063ace05658146108ec578063ad35efd41461090c57600080fd5b80638da5cb5b1461083e57806390c3ad091461085c57806395d89b411461089757600080fd5b8063715018a6116101ab578063715018a6146107995780637a07c33d146107ae5780637d6939a2146107e45780638462151c1461081157600080fd5b80636c0360eb14610744578063704b6c021461075957806370a082311461077957600080fd5b8063300b23d8116102ab57806352235dab116102495780635bbb2177116102235780635bbb2177146106c15780636352211e146106ee57806366ca73061461070e57806367765b871461072e57600080fd5b806352235dab1461064b5780635437988d1461068157806355f804b3146106a157600080fd5b806342966c681161028557806342966c68146105d8578063434f8fd4146105f85780634a1a169514610618578063517d7a091461063857600080fd5b8063300b23d814610585578063328fd5dc146105a557806342842e0e146105c557600080fd5b8063144f43791161031857806323b872dd116102f257806323b872dd146104e657806325a969df146104f95780632a55205a146105265780632b7ac3f31461056557600080fd5b8063144f43791461047257806318160ddd14610492578063214469f5146104b957600080fd5b8063081812fc11610354578063081812fc146103e7578063095ea7b31461041f5780630ab29341146104325780630fdaf3771461045257600080fd5b806301ffc9a71461037b57806306fdde03146103b0578063072c79c8146103d2575b600080fd5b34801561038757600080fd5b5061039b61039636600461462f565b610b6f565b60405190151581526020015b60405180910390f35b3480156103bc57600080fd5b506103c5610b8f565b6040516103a7919061469c565b6103e56103e036600461482c565b610c21565b005b3480156103f357600080fd5b50610407610402366004614861565b610f3b565b6040516001600160a01b0390911681526020016103a7565b6103e561042d36600461487a565b610f98565b34801561043e57600080fd5b506103e561044d366004614914565b611051565b34801561045e57600080fd5b506103e561046d366004614964565b611134565b34801561047e57600080fd5b506103e561048d366004614a01565b611251565b34801561049e57600080fd5b5060065460055403600019015b6040519081526020016103a7565b3480156104c557600080fd5b506104ab6104d4366004614861565b60166020526000908152604090205481565b6103e56104f4366004614aba565b6115c1565b34801561050557600080fd5b506104ab610514366004614861565b60136020526000908152604090205481565b34801561053257600080fd5b50610546610541366004614af6565b6117a4565b604080516001600160a01b0390931683526020830191909152016103a7565b34801561057157600080fd5b50600254610407906001600160a01b031681565b34801561059157600080fd5b506103e56105a0366004614861565b611821565b3480156105b157600080fd5b506103e56105c0366004614b18565b61191a565b6103e56105d3366004614aba565b611b2b565b3480156105e457600080fd5b506103e56105f3366004614861565b611b4b565b34801561060457600080fd5b506103e5610613366004614ba7565b611bc9565b34801561062457600080fd5b506103e5610633366004614bda565b611cda565b6103e5610646366004614c1e565b611f9f565b34801561065757600080fd5b50610407610666366004614861565b6011602052600090815260409020546001600160a01b031681565b34801561068d57600080fd5b506103e561069c366004614c57565b612122565b3480156106ad57600080fd5b506103e56106bc366004614c72565b61222d565b3480156106cd57600080fd5b506106e16106dc366004614ca7565b612361565b6040516103a79190614d1c565b3480156106fa57600080fd5b50610407610709366004614861565b61242d565b34801561071a57600080fd5b506103e5610729366004614d99565b612438565b34801561073a57600080fd5b506104ab600e5481565b34801561075057600080fd5b506103c5612676565b34801561076557600080fd5b506103e5610774366004614c57565b612704565b34801561078557600080fd5b506104ab610794366004614c57565b6127b4565b3480156107a557600080fd5b506103e561281c565b3480156107ba57600080fd5b506104076107c9366004614861565b6012602052600090815260409020546001600160a01b031681565b3480156107f057600080fd5b506104ab6107ff366004614861565b60106020526000908152604090205481565b34801561081d57600080fd5b5061083161082c366004614c57565b612830565b6040516103a79190614ea8565b34801561084a57600080fd5b506000546001600160a01b0316610407565b34801561086857600080fd5b5061039b610877366004614c72565b8051602081830181018051601a8252928201919093012091525460ff1681565b3480156108a357600080fd5b506103c5612934565b3480156108b857600080fd5b506108316108c7366004614ba7565b612943565b3480156108d857600080fd5b506103e56108e7366004614ec9565b612ae4565b3480156108f857600080fd5b506103e561090736600461482c565b612b50565b34801561091857600080fd5b5061092c610927366004614861565b612dc1565b6040516103a79190614f38565b6103e5610947366004614d99565b612dff565b34801561095857600080fd5b50610987610967366004614861565b6015602052600090815260409020546bffffffffffffffffffffffff1681565b6040516bffffffffffffffffffffffff90911681526020016103a7565b6103e56109b2366004614f46565b613080565b3480156109c357600080fd5b506104ab6109d2366004614861565b60186020526000908152604090205481565b3480156109f057600080fd5b506103c56109ff366004614861565b6130c4565b348015610a1057600080fd5b50610a24610a1f366004614861565b61314d565b6040516103a79190614fae565b348015610a3d57600080fd5b506103c5610a4c366004614861565b6131d5565b348015610a5d57600080fd5b506103e5610a6c366004614ff3565b613258565b348015610a7d57600080fd5b506103e5610a8c366004615040565b61339e565b348015610a9d57600080fd5b506103e5610aac3660046150b4565b61347f565b348015610abd57600080fd5b506104ab6135c8565b348015610ad257600080fd5b506103c5610ae1366004614af6565b6135de565b348015610af257600080fd5b5061039b610b013660046150d7565b6001600160a01b039182166000908152600c6020908152604080832093909416825291909152205460ff1690565b348015610b3b57600080fd5b506103e5610b4a366004614c57565b613602565b348015610b5b57600080fd5b50600154610407906001600160a01b031681565b6000610b7a8261368f565b80610b895750610b898261370f565b92915050565b606060078054610b9e90615101565b80601f0160208091040260200160405190810160405280929190818152602001828054610bca90615101565b8015610c175780601f10610bec57610100808354040283529160200191610c17565b820191906000526020600020905b815481529060010190602001808311610bfa57829003601f168201915b5050505050905090565b610c2961375d565b80518015801590610c3c5750600e548111155b610c7e5760405162461bcd60e51b815260206004820152600e60248201526d092dcecc2d8d2c840d8cadccee8d60931b60448201526064015b60405180910390fd5b6000601060006013600086600081518110610c9b57610c9b61513b565b60200260200101516020015181526020019081526020016000205481526020019081526020016000205490506011600082815260200190815260200160002060009054906101000a90046001600160a01b03166001600160a01b0316610cfe3390565b6001600160a01b031614610d425760405162461bcd60e51b815260206004820152601a60248201526000805160206156d38339815191526044820152606401610c75565b6000808367ffffffffffffffff811115610d5e57610d5e6146af565b604051908082528060200260200182016040528015610d87578160200160208202803683370190505b50905060005b84811015610e9157858181518110610da757610da761513b565b60200260200101516040015183610dbe9190615167565b92506000610dcb60055490565b905080838381518110610de057610de061513b565b602002602001018181525050868281518110610dfe57610dfe61513b565b6020026020010151602001516016600083815260200190815260200160002081905550868281518110610e3357610e3361513b565b6020026020010151606001516018600083815260200190815260200160002081905550610e7e878381518110610e6b57610e6b61513b565b60200260200101516000015160016137b6565b5080610e898161517a565b915050610d8d565b50813414610ed15760405162461bcd60e51b815260206004820152600d60248201526c496e76616c69642076616c756560981b6044820152606401610c75565b600083815260126020526040902054610ef3906001600160a01b0316836137d0565b7f7fb9423fc0c061f94269225144532964c522dc9c8a78b929a620296b506b206a81604051610f229190614ea8565b60405180910390a150505050610f386001600d55565b50565b6000610f46826137e3565b610f7c576040517fcf4700e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506000908152600b60205260409020546001600160a01b031690565b6000610fa38261242d565b9050336001600160a01b03821614610ff557610fbf8133610b01565b610ff5576040517fcfb3b94200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600b602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6000838152601060209081526040808320548084526011909252909120546001600160a01b0316336001600160a01b0316146110bd5760405162461bcd60e51b815260206004820152601a60248201526000805160206156d38339815191526044820152606401610c75565b600084815260176020908152604080832086845290915290206110e083826151d9565b5060008381526013602052604090819020859055517f6a8fcae9caff40f5a9b57fe6363a62bf5110a5b7226ffa1ab411e7d469857a9e9061112690869086908690615299565b60405180910390a150505050565b6000828152601160205260409020546001600160a01b031633146111885760405162461bcd60e51b815260206004820152601a60248201526000805160206156d38339815191526044820152606401610c75565b6001600160a01b0381166111de5760405162461bcd60e51b815260206004820152600f60248201527f496e76616c6964206164647265737300000000000000000000000000000000006044820152606401610c75565b60008281526012602090815260409182902080546001600160a01b038581166001600160a01b0319831681179093558451878152911692810183905292830152907f15c353f11e484a1bc8e008fa8cf27ced61391887c912c9b8e5006a904cb4bf899060600160405180910390a1505050565b815180158015906112645750600e548111155b6112a15760405162461bcd60e51b815260206004820152600e60248201526d092dcecc2d8d2c840d8cadccee8d60931b6044820152606401610c75565b815181146112f15760405162461bcd60e51b815260206004820152601360248201527f496e636f6e73697374656e74206c656e677468000000000000000000000000006044820152606401610c75565b6000601060006013600060166000896000815181106113125761131261513b565b602002602001015181526020019081526020016000205481526020019081526020016000205481526020019081526020016000205490506011600082815260200190815260200160002060009054906101000a90046001600160a01b03166001600160a01b03166113803390565b6001600160a01b0316146113c45760405162461bcd60e51b815260206004820152601a60248201526000805160206156d38339815191526044820152606401610c75565b60008267ffffffffffffffff8111156113df576113df6146af565b604051908082528060200260200182016040528015611408578160200160208202803683370190505b50905060005b8381101561157e5761143886828151811061142b5761142b61513b565b60200260200101516137e3565b6114845760405162461bcd60e51b815260206004820152601160248201527f4e6f6e6578697374656e7420746f6b656e0000000000000000000000000000006044820152606401610c75565b6019600087838151811061149a5761149a61513b565b6020026020010151815260200190815260200160002060009054906101000a900460ff168282815181106114d0576114d061513b565b602002602001019060038111156114e9576114e9614f00565b908160038111156114fc576114fc614f00565b815250508481815181106115125761151261513b565b6020026020010151601960008884815181106115305761153061513b565b6020026020010151815260200190815260200160002060006101000a81548160ff0219169083600381111561156757611567614f00565b0217905550806115768161517a565b91505061140e565b507ff5f903bac2b9f936199a68eb2ceab266d4d530a0841f12b61de2c8f41a0e408a8582866040516115b2939291906152f8565b60405180910390a15050505050565b60006115cc82613818565b9050836001600160a01b0316816001600160a01b031614611619576040517fa114810000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600b6020526040902080546116458187335b6001600160a01b039081169116811491141790565b611670576116538633610b01565b61167057604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b0385166116b0576040517fea553b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6116bd86868660016138a0565b80156116c857600082555b6001600160a01b038681166000908152600a60205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260096020526040812091909155600160e11b8416900361175a576001840160008181526009602052604081205490036117585760055481146117585760008181526009602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b505050505050565b6000828152601660209081526040808320548352601382528083205480845260158352818420546010845282852054855260129093529083205483926bffffffffffffffffffffffff16906001600160a01b031683612710611806848961533b565b6118109190615352565b9195509093505050505b9250929050565b6001546001600160a01b0316336001600160a01b0316146118845760405162461bcd60e51b815260206004820152601c60248201527f4f776e61626c653a2043616c6c6572206973206e6f742061646d696e000000006044820152606401610c75565b600081116118d45760405162461bcd60e51b815260206004820152601160248201527f496e76616c6964206d61782062617463680000000000000000000000000000006044820152606401610c75565b600e80549082905560408051828152602081018490527fb2db87a3616f65c2d37334618af1f0b8ecb48cb11d9b7c25c3d1380d1c24c03e91015b60405180910390a15050565b601a8160405161192a9190615374565b9081526040519081900360200190205460ff161561197e5760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964207369676e617475726560781b6044820152606401610c75565b6001600160a01b0383166119d45760405162461bcd60e51b815260206004820152600f60248201527f496e76616c6964206164647265737300000000000000000000000000000000006044820152606401610c75565b6000858585856040516020016119ed9493929190615390565b60408051601f198184030181529190528051602090910120600254909150611a2190829084906001600160a01b031661393a565b611a615760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964207369676e617475726560781b6044820152606401610c75565b600086815260126020908152604080832080546001600160a01b03808a166001600160a01b03199283161790925560119093529281902080549389169390921692909217905551600190601a90611ab9908590615374565b9081526040805160209281900383018120805460ff1916941515949094179093558883526001600160a01b0380891692840192909252908616908201527fd0dd49be4ec013b76bda245b475030e37b32f2a86f5b767262f1cf77648362ea9060600160405180910390a1505050505050565b611b4683838360405180602001604052806000815250613080565b505050565b60008181526016602090815260408083208390556018825280832083905560199091529020805460ff19169055611b83816001613990565b7fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca533604080516001600160a01b039092168252602082018490520160405180910390a150565b611bd161375d565b600081815260136020908152604080832054835260108252808320548084526011909252909120546001600160a01b0316336001600160a01b031614611c475760405162461bcd60e51b815260206004820152601a60248201526000805160206156d38339815191526044820152606401610c75565b6000611c5260055490565b6000818152601660209081526040808320879055601890915290208590559050611c7d8560016137b6565b604080516001600160a01b038716815260208101839052606081830181905260009082015290517f13b4590e2f417016fce3f02298116b2ad6220e5ee149b4c55d2f1d9f501276239181900360800190a15050611b466001600d55565b611ce261375d565b80518015801590611cf55750600e548111155b611d325760405162461bcd60e51b815260206004820152600e60248201526d092dcecc2d8d2c840d8cadccee8d60931b6044820152606401610c75565b6000601060006013600086600081518110611d4f57611d4f61513b565b60200260200101516020015181526020019081526020016000205481526020019081526020016000205490506011600082815260200190815260200160002060009054906101000a90046001600160a01b03166001600160a01b0316611db23390565b6001600160a01b031614611df65760405162461bcd60e51b815260206004820152601a60248201526000805160206156d38339815191526044820152606401610c75565b6000808367ffffffffffffffff811115611e1257611e126146af565b604051908082528060200260200182016040528015611e3b578160200160208202803683370190505b50905060005b84811015611f3257858181518110611e5b57611e5b61513b565b60200260200101516040015183611e729190615167565b92506000611e7f60055490565b905080838381518110611e9457611e9461513b565b602002602001018181525050868281518110611eb257611eb261513b565b6020026020010151602001516016600083815260200190815260200160002081905550868281518110611ee757611ee761513b565b6020026020010151606001516018600083815260200190815260200160002081905550611f1f878381518110610e6b57610e6b61513b565b5080611f2a8161517a565b915050611e41565b50611f56336000858152601260205260409020546001600160a01b03168885613b02565b7f7fb9423fc0c061f94269225144532964c522dc9c8a78b929a620296b506b206a81604051611f859190614ea8565b60405180910390a150505050611f9b6001600d55565b5050565b611fa761375d565b600083815260136020908152604080832054835260108252808320548084526011909252909120546001600160a01b0316336001600160a01b03161461201d5760405162461bcd60e51b815260206004820152601a60248201526000805160206156d38339815191526044820152606401610c75565b82341461205c5760405162461bcd60e51b815260206004820152600d60248201526c496e76616c69642076616c756560981b6044820152606401610c75565b600061206760055490565b60008181526016602090815260408083208990556018909152902084905590506120928660016137b6565b6000828152601260205260409020546120b4906001600160a01b0316856137d0565b7f13b4590e2f417016fce3f02298116b2ad6220e5ee149b4c55d2f1d9f50127623866120de6135c8565b604080516001600160a01b0390931683526020830191909152606090820181905260009082015260800160405180910390a1505061211c6001600d55565b50505050565b6001546001600160a01b0316336001600160a01b0316146121855760405162461bcd60e51b815260206004820152601c60248201527f4f776e61626c653a2043616c6c6572206973206e6f742061646d696e000000006044820152606401610c75565b6001600160a01b0381166121db5760405162461bcd60e51b815260206004820152601860248201527f4f776e61626c653a20496e76616c6964206164647265737300000000000000006044820152606401610c75565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907fece0bf81fd8f6889c8c3a1f3b057df878a9e1a0501fd4d62c77822fe3570d28f90600090a35050565b6001546001600160a01b0316336001600160a01b0316146122905760405162461bcd60e51b815260206004820152601c60248201527f4f776e61626c653a2043616c6c6572206973206e6f742061646d696e000000006044820152606401610c75565b6000600f805461229f90615101565b80601f01602080910402602001604051908101604052809291908181526020018280546122cb90615101565b80156123185780601f106122ed57610100808354040283529160200191612318565b820191906000526020600020905b8154815290600101906020018083116122fb57829003601f168201915b5050505050905081600f908161232e91906151d9565b507fc73341c723fd9197b17090f0c077cf2bbe4d89f2f7d71969b3a7e5c50d570a3881600f60405161190e9291906153dd565b60608160008167ffffffffffffffff81111561237f5761237f6146af565b6040519080825280602002602001820160405280156123d157816020015b60408051608081018252600080825260208083018290529282018190526060820152825260001990920191018161239d5790505b50905060005b828114612424576123ff8686838181106123f3576123f361513b565b9050602002013561314d565b8282815181106124115761241161513b565b60209081029190910101526001016123d7565b50949350505050565b6000610b8982613818565b61244061375d565b601a816040516124509190615374565b9081526040519081900360200190205460ff16156124a45760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964207369676e617475726560781b6044820152606401610c75565b428260c0015110156124f85760405162461bcd60e51b815260206004820152601160248201527f45787069726564207369676e61747572650000000000000000000000000000006044820152606401610c75565b81516020808401516040808601516060870151608088015160a089015160c08a0151945160009861252d989097969101615478565b60408051601f19818403018152919052805160209091012060025490915061256190829084906001600160a01b031661393a565b6125a15760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964207369676e617475726560781b6044820152606401610c75565b6001601a836040516125b39190615374565b908152604051908190036020019020805491151560ff199092169190911790556125dc83613b17565b82516060840151600090815260136020908152604080832054835260108252808320548352601282529091205490850151608086015161262793926001600160a01b03169190613b02565b82517f13b4590e2f417016fce3f02298116b2ad6220e5ee149b4c55d2f1d9f50127623906126536135c8565b84604051612663939291906154d7565b60405180910390a150611f9b6001600d55565b600f805461268390615101565b80601f01602080910402602001604051908101604052809291908181526020018280546126af90615101565b80156126fc5780601f106126d1576101008083540402835291602001916126fc565b820191906000526020600020905b8154815290600101906020018083116126df57829003601f168201915b505050505081565b61270c613b5a565b6001600160a01b0381166127625760405162461bcd60e51b815260206004820152601860248201527f4f776e61626c653a20496e76616c6964206164647265737300000000000000006044820152606401610c75565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f848ac24ab84501710d6631faab117b66b79aba7ec6f7778cf3bcff428c1a4efc90600090a35050565b60006001600160a01b0382166127f6576040517f8f4eb60400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506001600160a01b03166000908152600a602052604090205467ffffffffffffffff1690565b612824613b5a565b61282e6000613bb4565b565b60606000806000612840856127b4565b905060008167ffffffffffffffff81111561285d5761285d6146af565b604051908082528060200260200182016040528015612886578160200160208202803683370190505b5060408051608081018252600080825260208201819052918101829052606081019190915290915060015b838614612928576128c181613c04565b915081604001516129205781516001600160a01b0316156128e157815194505b876001600160a01b0316856001600160a01b03160361292057808387806001019850815181106129135761291361513b565b6020026020010181815250505b6001016128b1565b50909695505050505050565b606060088054610b9e90615101565b606081831061297e576040517f32c1995a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008061298a60055490565b9050600185101561299a57600194505b808411156129a6578093505b60006129b1876127b4565b9050848610156129d057858503818110156129ca578091505b506129d4565b5060005b60008167ffffffffffffffff8111156129ef576129ef6146af565b604051908082528060200260200182016040528015612a18578160200160208202803683370190505b50905081600003612a2e579350612add92505050565b6000612a398861314d565b905060008160400151612a4a575080515b885b888114158015612a5c5750848714155b15612ad157612a6a81613c04565b92508260400151612ac95782516001600160a01b031615612a8a57825191505b8a6001600160a01b0316826001600160a01b031603612ac95780848880600101995081518110612abc57612abc61513b565b6020026020010181815250505b600101612a4c565b50505092835250909150505b9392505050565b336000818152600c602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b612b5861375d565b80518015801590612b6b5750600e548111155b612ba85760405162461bcd60e51b815260206004820152600e60248201526d092dcecc2d8d2c840d8cadccee8d60931b6044820152606401610c75565b6000601060006013600086600081518110612bc557612bc561513b565b60200260200101516020015181526020019081526020016000205481526020019081526020016000205490506011600082815260200190815260200160002060009054906101000a90046001600160a01b03166001600160a01b0316612c283390565b6001600160a01b031614612c6c5760405162461bcd60e51b815260206004820152601a60248201526000805160206156d38339815191526044820152606401610c75565b60008267ffffffffffffffff811115612c8757612c876146af565b604051908082528060200260200182016040528015612cb0578160200160208202803683370190505b50905060005b83811015612d7c576000612cc960055490565b905080838381518110612cde57612cde61513b565b602002602001018181525050858281518110612cfc57612cfc61513b565b6020026020010151602001516016600083815260200190815260200160002081905550858281518110612d3157612d3161513b565b6020026020010151606001516018600083815260200190815260200160002081905550612d69868381518110610e6b57610e6b61513b565b5080612d748161517a565b915050612cb6565b507f7fb9423fc0c061f94269225144532964c522dc9c8a78b929a620296b506b206a81604051612dac9190614ea8565b60405180910390a1505050610f386001600d55565b6000612dcc826137e3565b612de957604051630a14c4b560e41b815260040160405180910390fd5b5060009081526019602052604090205460ff1690565b612e0761375d565b60608201516000908152601360209081526040808320548352601090915290819020549051601a90612e3a908490615374565b9081526040519081900360200190205460ff1615612e8e5760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964207369676e617475726560781b6044820152606401610c75565b82608001513414612ed15760405162461bcd60e51b815260206004820152600d60248201526c496e76616c69642076616c756560981b6044820152606401610c75565b428360c001511015612f255760405162461bcd60e51b815260206004820152601160248201527f45787069726564207369676e61747572650000000000000000000000000000006044820152606401610c75565b82516020808501516040808701516060880151608089015160a08a015160c08b01519451600098612f5a989097969101615478565b60408051601f198184030181529190528051602090910120600254909150612f8e90829085906001600160a01b031661393a565b612fce5760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964207369676e617475726560781b6044820152606401610c75565b6001601a84604051612fe09190615374565b908152604051908190036020019020805491151560ff1990921691909117905561300984613b17565b6000828152601260205260409020546080850151613030916001600160a01b0316906137d0565b83517f13b4590e2f417016fce3f02298116b2ad6220e5ee149b4c55d2f1d9f501276239061305c6135c8565b8560405161306c939291906154d7565b60405180910390a15050611f9b6001600d55565b61308b8484846115c1565b6001600160a01b0383163b1561211c576130a784848484613c83565b61211c576040516368d2bf6b60e11b815260040160405180910390fd5b60606130cf826137e3565b6130ec57604051630a14c4b560e41b815260040160405180910390fd5b6000828152601660209081526040808320548084526013835281842054808552601484528285206017855283862083875285529483902092519194909361313593919201615572565b60405160208183030381529060405292505050919050565b60408051608081018252600080825260208201819052918101829052606081019190915260408051608081018252600080825260208201819052918101829052606081019190915260018310806131a657506005548310155b156131b15792915050565b6131ba83613c04565b90508060400151156131cc5792915050565b612add83613d6f565b60606131e0826137e3565b6131fd57604051630a14c4b560e41b815260040160405180910390fd5b6000613207613de7565b905080516000036132275760405180602001604052806000815250612add565b8061323184613df6565b6040516020016132429291906155ae565b6040516020818303038152906040529392505050565b61326061375d565b600083815260136020908152604080832054835260108252808320548084526011909252909120546001600160a01b0316336001600160a01b0316146132d65760405162461bcd60e51b815260206004820152601a60248201526000805160206156d38339815191526044820152606401610c75565b60006132e160055490565b600081815260166020908152604080832089905560189091529020849055905061330c8760016137b6565b61332f336000848152601260205260409020546001600160a01b03168887613b02565b7f13b4590e2f417016fce3f02298116b2ad6220e5ee149b4c55d2f1d9f50127623876133596135c8565b604080516001600160a01b0390931683526020830191909152606090820181905260009082015260800160405180910390a150506133976001600d55565b5050505050565b6000848152601160205260409020546001600160a01b031633146133f25760405162461bcd60e51b815260206004820152601a60248201526000805160206156d38339815191526044820152606401610c75565b60008381526010602090815260408083208790556014909152902061341783826151d9565b506000838152601560205260409081902080546bffffffffffffffffffffffff19166bffffffffffffffffffffffff8416179055517f983fefe131e437096c7ade0c9efa7bbf062258ee8e64fc74491e817deea4ffcb90611126908690869085908790615605565b613488826137e3565b6134d45760405162461bcd60e51b815260206004820152601160248201527f4e6f6e6578697374656e7420746f6b656e0000000000000000000000000000006044820152606401610c75565b60008281526016602090815260408083205483526013825280832054835260108252808320548084526011909252909120546001600160a01b0316336001600160a01b0316146135545760405162461bcd60e51b815260206004820152601a60248201526000805160206156d38339815191526044820152606401610c75565b6000838152601960205260409020805460ff811691849160ff1916600183600381111561358357613583614f00565b0217905550837f4a7f5026fdf684730d67591b542eff7f8d27a94fee277f7b599b7844ef2eac2082856040516135ba929190615638565b60405180910390a250505050565b600060016005546135d99190615653565b905090565b60176020908152600092835260408084209091529082529020805461268390615101565b61360a613b5a565b6001600160a01b0381166136865760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610c75565b610f3881613bb4565b60006301ffc9a760e01b6001600160e01b0319831614806136d957507f80ac58cd000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b80610b895750506001600160e01b0319167f5b5e139f000000000000000000000000000000000000000000000000000000001490565b60006001600160e01b031982167f2a55205a000000000000000000000000000000000000000000000000000000001480610b8957506301ffc9a760e01b6001600160e01b0319831614610b89565b6002600d54036137af5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610c75565b6002600d55565b611f9b828260405180602001604052806000815250613e3a565b611f9b6001600160a01b03831682613ea0565b6000816001111580156137f7575060055482105b8015610b89575050600090815260096020526040902054600160e01b161590565b6000818060011161386e5760055481101561386e5760008181526009602052604081205490600160e01b8216900361386c575b80600003612add57506000190160008181526009602052604090205461384b565b505b6040517fdf2d9b4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038416158015906138c057506001600160a01b03831615155b156139355760008281526019602052604081205460ff1660038111156138e8576138e8614f00565b146139355760405162461bcd60e51b815260206004820152600e60248201527f496e76616c6964207374617475730000000000000000000000000000000000006044820152606401610c75565b61211c565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000006000908152601c849052603c81206001600160a01b03831661397d8286613fb9565b6001600160a01b03161495945050505050565b600061399b83613818565b9050806000806139b9866000908152600b6020526040902080549091565b9150915084156139f9576139ce818433611630565b6139f9576139dc8333610b01565b6139f957604051632ce44b5f60e11b815260040160405180910390fd5b613a078360008860016138a0565b8015613a1257600082555b6001600160a01b0383166000818152600a6020526040902080546fffffffffffffffffffffffffffffffff0190554260a01b177c030000000000000000000000000000000000000000000000000000000017600087815260096020526040812091909155600160e11b85169003613ab957600186016000818152600960205260408120549003613ab7576005548114613ab75760008181526009602052604090208590555b505b60405186906000906001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a4505060068054600101905550505050565b61211c6001600160a01b038316858584613fdd565b6000613b2260055490565b606083015160008281526016602090815260408083209390935560a08601516018909152919020558251909150611f9b9060016137b6565b6000546001600160a01b0316331461282e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c75565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b604080516080810182526000808252602082018190529181018290526060810191909152600082815260096020526040902054610b8990604080516080810182526001600160a01b038316815260a083901c67ffffffffffffffff166020820152600160e01b831615159181019190915260e89190911c606082015290565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290613cb8903390899088908890600401615666565b6020604051808303816000875af1925050508015613cf3575060408051601f3d908101601f19168201909252613cf091810190615698565b60015b613d51573d808015613d21576040519150601f19603f3d011682016040523d82523d6000602084013e613d26565b606091505b508051600003613d49576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b604080516080810182526000808252602082018190529181018290526060810191909152610b89613d9f83613818565b604080516080810182526001600160a01b038316815260a083901c67ffffffffffffffff166020820152600160e01b831615159181019190915260e89190911c606082015290565b6060600f8054610b9e90615101565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a900480613e105750819003601f19909101908152919050565b613e448383614065565b6001600160a01b0383163b15611b46576005548281035b613e6e6000868380600101945086613c83565b613e8b576040516368d2bf6b60e11b815260040160405180910390fd5b818110613e5b57816005541461339757600080fd5b80471015613ef05760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610c75565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114613f3d576040519150601f19603f3d011682016040523d82523d6000602084013e613f42565b606091505b5050905080611b465760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610c75565b6000806000613fc885856141a3565b91509150613fd5816141e5565b509392505050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017905261211c90859061434a565b60055460008290036140a3576040517fb562e8dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6140b060008483856138a0565b6001600160a01b0383166000818152600a602090815260408083208054680100000000000000018802019055848352600990915281206001851460e11b4260a01b178317905582840190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b81811461415f57808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4600101614127565b508160000361419a576040517f2e07630000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60055550505050565b60008082516041036141d95760208301516040840151606085015160001a6141cd87828585614432565b9450945050505061181a565b5060009050600261181a565b60008160048111156141f9576141f9614f00565b036142015750565b600181600481111561421557614215614f00565b036142625760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610c75565b600281600481111561427657614276614f00565b036142c35760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610c75565b60038160048111156142d7576142d7614f00565b03610f385760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610c75565b600061439f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166144f69092919063ffffffff16565b90508051600014806143c05750808060200190518101906143c091906156b5565b611b465760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610c75565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561446957506000905060036144ed565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156144bd573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166144e6576000600192509250506144ed565b9150600090505b94509492505050565b6060613d67848460008585600080866001600160a01b0316858760405161451d9190615374565b60006040518083038185875af1925050503d806000811461455a576040519150601f19603f3d011682016040523d82523d6000602084013e61455f565b606091505b50915091506145708783838761457b565b979650505050505050565b606083156145ea5782516000036145e3576001600160a01b0385163b6145e35760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610c75565b5081613d67565b613d6783838151156145ff5781518083602001fd5b8060405162461bcd60e51b8152600401610c75919061469c565b6001600160e01b031981168114610f3857600080fd5b60006020828403121561464157600080fd5b8135612add81614619565b60005b8381101561466757818101518382015260200161464f565b50506000910152565b6000815180845261468881602086016020860161464c565b601f01601f19169290920160200192915050565b602081526000612add6020830184614670565b634e487b7160e01b600052604160045260246000fd5b6040516080810167ffffffffffffffff811182821017156146e8576146e86146af565b60405290565b60405160e0810167ffffffffffffffff811182821017156146e8576146e86146af565b604051601f8201601f1916810167ffffffffffffffff8111828210171561473a5761473a6146af565b604052919050565b600067ffffffffffffffff82111561475c5761475c6146af565b5060051b60200190565b80356001600160a01b038116811461477d57600080fd5b919050565b600082601f83011261479357600080fd5b813560206147a86147a383614742565b614711565b82815260079290921b840181019181810190868411156147c757600080fd5b8286015b8481101561482157608081890312156147e45760008081fd5b6147ec6146c5565b6147f582614766565b8152818501358582015260408083013590820152606080830135908201528352918301916080016147cb565b509695505050505050565b60006020828403121561483e57600080fd5b813567ffffffffffffffff81111561485557600080fd5b613d6784828501614782565b60006020828403121561487357600080fd5b5035919050565b6000806040838503121561488d57600080fd5b61489683614766565b946020939093013593505050565b600082601f8301126148b557600080fd5b813567ffffffffffffffff8111156148cf576148cf6146af565b6148e2601f8201601f1916602001614711565b8181528460208386010111156148f757600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121561492957600080fd5b8335925060208401359150604084013567ffffffffffffffff81111561494e57600080fd5b61495a868287016148a4565b9150509250925092565b6000806040838503121561497757600080fd5b8235915061498760208401614766565b90509250929050565b80356004811061477d57600080fd5b600082601f8301126149b057600080fd5b813560206149c06147a383614742565b82815260059290921b840181019181810190868411156149df57600080fd5b8286015b84811015614821576149f481614990565b83529183019183016149e3565b60008060408385031215614a1457600080fd5b823567ffffffffffffffff80821115614a2c57600080fd5b818501915085601f830112614a4057600080fd5b81356020614a506147a383614742565b82815260059290921b84018101918181019089841115614a6f57600080fd5b948201945b83861015614a8d57853582529482019490820190614a74565b96505086013592505080821115614aa357600080fd5b50614ab08582860161499f565b9150509250929050565b600080600060608486031215614acf57600080fd5b614ad884614766565b9250614ae660208501614766565b9150604084013590509250925092565b60008060408385031215614b0957600080fd5b50508035926020909101359150565b600080600080600060a08688031215614b3057600080fd5b85359450614b4060208701614766565b9350614b4e60408701614766565b9250606086013567ffffffffffffffff80821115614b6b57600080fd5b614b7789838a016148a4565b93506080880135915080821115614b8d57600080fd5b50614b9a888289016148a4565b9150509295509295909350565b600080600060608486031215614bbc57600080fd5b614bc584614766565b95602085013595506040909401359392505050565b60008060408385031215614bed57600080fd5b614bf683614766565b9150602083013567ffffffffffffffff811115614c1257600080fd5b614ab085828601614782565b60008060008060808587031215614c3457600080fd5b614c3d85614766565b966020860135965060408601359560600135945092505050565b600060208284031215614c6957600080fd5b612add82614766565b600060208284031215614c8457600080fd5b813567ffffffffffffffff811115614c9b57600080fd5b613d67848285016148a4565b60008060208385031215614cba57600080fd5b823567ffffffffffffffff80821115614cd257600080fd5b818501915085601f830112614ce657600080fd5b813581811115614cf557600080fd5b8660208260051b8501011115614d0a57600080fd5b60209290920196919550909350505050565b6020808252825182820181905260009190848201906040850190845b8181101561292857614d868385516001600160a01b03815116825267ffffffffffffffff602082015116602083015260408101511515604083015262ffffff60608201511660608301525050565b9284019260809290920191600101614d38565b60008060408385031215614dac57600080fd5b823567ffffffffffffffff80821115614dc457600080fd5b9084019060e08287031215614dd857600080fd5b614de06146ee565b614de983614766565b8152614df760208401614766565b6020820152604083013582811115614e0e57600080fd5b614e1a888286016148a4565b604083015250606083013560608201526080830135608082015260a083013560a082015260c083013560c0820152809450506020850135915080821115614e6057600080fd5b50614ab0858286016148a4565b600081518084526020808501945080840160005b83811015614e9d57815187529582019590820190600101614e81565b509495945050505050565b602081526000612add6020830184614e6d565b8015158114610f3857600080fd5b60008060408385031215614edc57600080fd5b614ee583614766565b91506020830135614ef581614ebb565b809150509250929050565b634e487b7160e01b600052602160045260246000fd5b60048110614f3457634e487b7160e01b600052602160045260246000fd5b9052565b60208101610b898284614f16565b60008060008060808587031215614f5c57600080fd5b614f6585614766565b9350614f7360208601614766565b925060408501359150606085013567ffffffffffffffff811115614f9657600080fd5b614fa2878288016148a4565b91505092959194509250565b81516001600160a01b0316815260208083015167ffffffffffffffff169082015260408083015115159082015260608083015162ffffff169082015260808101610b89565b600080600080600060a0868803121561500b57600080fd5b61501486614766565b945061502260208701614766565b94979496505050506040830135926060810135926080909101359150565b6000806000806080858703121561505657600080fd5b8435935060208501359250604085013567ffffffffffffffff81111561507b57600080fd5b615087878288016148a4565b92505060608501356bffffffffffffffffffffffff811681146150a957600080fd5b939692955090935050565b600080604083850312156150c757600080fd5b8235915061498760208401614990565b600080604083850312156150ea57600080fd5b6150f383614766565b915061498760208401614766565b600181811c9082168061511557607f821691505b60208210810361513557634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b80820180821115610b8957610b89615151565b60006001820161518c5761518c615151565b5060010190565b601f821115611b4657600081815260208120601f850160051c810160208610156151ba5750805b601f850160051c820191505b8181101561179c578281556001016151c6565b815167ffffffffffffffff8111156151f3576151f36146af565b615207816152018454615101565b84615193565b602080601f83116001811461523c57600084156152245750858301515b600019600386901b1c1916600185901b17855561179c565b600085815260208120601f198616915b8281101561526b5788860151825594840194600190910190840161524c565b50858210156152895787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b8381528260208201526060604082015260006152b86060830184614670565b95945050505050565b600081518084526020808501945080840160005b83811015614e9d576152e8878351614f16565b95820195908201906001016152d5565b60608152600061530b6060830186614e6d565b828103602084015261531d81866152c1565b9050828103604084015261533181856152c1565b9695505050505050565b8082028115828204841417610b8957610b89615151565b60008261536f57634e487b7160e01b600052601260045260246000fd5b500490565b6000825161538681846020870161464c565b9190910192915050565b84815260006bffffffffffffffffffffffff19808660601b166020840152808560601b1660348401525082516153cd81604885016020870161464c565b9190910160480195945050505050565b6040815260006153f06040830185614670565b6020838203818501526000855461540681615101565b80855260018281168015615421576001811461543b57615469565b60ff1984168787015282151560051b870186019450615469565b896000528560002060005b84811015615461578154898201890152908301908701615446565b880187019550505b50929998505050505050505050565b60006bffffffffffffffffffffffff19808a60601b168352808960601b1660148401525086516154af816028850160208b0161464c565b90910160288101959095525060488401929092526068830152608882015260a8019392505050565b6001600160a01b03841681528260208201526060604082015260006152b86060830184614670565b6000815461550c81615101565b60018281168015615524576001811461553957615568565b60ff1984168752821515830287019450615568565b8560005260208060002060005b8581101561555f5781548a820152908401908201615546565b50505082870194505b5050505092915050565b600061557e82856154ff565b7f2d0000000000000000000000000000000000000000000000000000000000000081526152b860018201856154ff565b600083516155c081846020880161464c565b8351908301906155d481836020880161464c565b7f2e6a736f6e0000000000000000000000000000000000000000000000000000009101908152600501949350505050565b8481528360208201526bffffffffffffffffffffffff831660408201526080606082015260006153316080830184614670565b604081016156468285614f16565b612add6020830184614f16565b81810381811115610b8957610b89615151565b60006001600160a01b038087168352808616602084015250836040830152608060608301526153316080830184614670565b6000602082840312156156aa57600080fd5b8151612add81614619565b6000602082840312156156c757600080fd5b8151612add81614ebb56fe43616c6c6572206973206e6f74206f7267616e697a6174696f6e000000000000a2646970667358221220cc4cf12c3a9748a2b23a278c0907a9f34feb6131228393de1cbf1967d7443b3664736f6c63430008120033000000000000000000000000897f103257e51fb643536099477d07070fdbf5e3000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000000553696e7261000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000553494e5241000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x6080604052600436106103765760003560e01c80636c0360eb116101d1578063b7d1202211610102578063ce7139a4116100a0578063e2f422491161006f578063e2f4224914610ac6578063e985e9c514610ae6578063f2fde38b14610b2f578063f851a44014610b4f57600080fd5b8063ce7139a414610a51578063ceb23acd14610a71578063d896dd6414610a91578063e00dd16114610ab157600080fd5b8063ba209be2116100dc578063ba209be2146109b7578063bdad4455146109e4578063c23dc68f14610a04578063c87b56dd14610a3157600080fd5b8063b7d1202214610939578063b8111dad1461094c578063b88d4fde146109a457600080fd5b80638da5cb5b1161016f57806399a2557a1161014957806399a2557a146108ac578063a22cb465146108cc578063ace05658146108ec578063ad35efd41461090c57600080fd5b80638da5cb5b1461083e57806390c3ad091461085c57806395d89b411461089757600080fd5b8063715018a6116101ab578063715018a6146107995780637a07c33d146107ae5780637d6939a2146107e45780638462151c1461081157600080fd5b80636c0360eb14610744578063704b6c021461075957806370a082311461077957600080fd5b8063300b23d8116102ab57806352235dab116102495780635bbb2177116102235780635bbb2177146106c15780636352211e146106ee57806366ca73061461070e57806367765b871461072e57600080fd5b806352235dab1461064b5780635437988d1461068157806355f804b3146106a157600080fd5b806342966c681161028557806342966c68146105d8578063434f8fd4146105f85780634a1a169514610618578063517d7a091461063857600080fd5b8063300b23d814610585578063328fd5dc146105a557806342842e0e146105c557600080fd5b8063144f43791161031857806323b872dd116102f257806323b872dd146104e657806325a969df146104f95780632a55205a146105265780632b7ac3f31461056557600080fd5b8063144f43791461047257806318160ddd14610492578063214469f5146104b957600080fd5b8063081812fc11610354578063081812fc146103e7578063095ea7b31461041f5780630ab29341146104325780630fdaf3771461045257600080fd5b806301ffc9a71461037b57806306fdde03146103b0578063072c79c8146103d2575b600080fd5b34801561038757600080fd5b5061039b61039636600461462f565b610b6f565b60405190151581526020015b60405180910390f35b3480156103bc57600080fd5b506103c5610b8f565b6040516103a7919061469c565b6103e56103e036600461482c565b610c21565b005b3480156103f357600080fd5b50610407610402366004614861565b610f3b565b6040516001600160a01b0390911681526020016103a7565b6103e561042d36600461487a565b610f98565b34801561043e57600080fd5b506103e561044d366004614914565b611051565b34801561045e57600080fd5b506103e561046d366004614964565b611134565b34801561047e57600080fd5b506103e561048d366004614a01565b611251565b34801561049e57600080fd5b5060065460055403600019015b6040519081526020016103a7565b3480156104c557600080fd5b506104ab6104d4366004614861565b60166020526000908152604090205481565b6103e56104f4366004614aba565b6115c1565b34801561050557600080fd5b506104ab610514366004614861565b60136020526000908152604090205481565b34801561053257600080fd5b50610546610541366004614af6565b6117a4565b604080516001600160a01b0390931683526020830191909152016103a7565b34801561057157600080fd5b50600254610407906001600160a01b031681565b34801561059157600080fd5b506103e56105a0366004614861565b611821565b3480156105b157600080fd5b506103e56105c0366004614b18565b61191a565b6103e56105d3366004614aba565b611b2b565b3480156105e457600080fd5b506103e56105f3366004614861565b611b4b565b34801561060457600080fd5b506103e5610613366004614ba7565b611bc9565b34801561062457600080fd5b506103e5610633366004614bda565b611cda565b6103e5610646366004614c1e565b611f9f565b34801561065757600080fd5b50610407610666366004614861565b6011602052600090815260409020546001600160a01b031681565b34801561068d57600080fd5b506103e561069c366004614c57565b612122565b3480156106ad57600080fd5b506103e56106bc366004614c72565b61222d565b3480156106cd57600080fd5b506106e16106dc366004614ca7565b612361565b6040516103a79190614d1c565b3480156106fa57600080fd5b50610407610709366004614861565b61242d565b34801561071a57600080fd5b506103e5610729366004614d99565b612438565b34801561073a57600080fd5b506104ab600e5481565b34801561075057600080fd5b506103c5612676565b34801561076557600080fd5b506103e5610774366004614c57565b612704565b34801561078557600080fd5b506104ab610794366004614c57565b6127b4565b3480156107a557600080fd5b506103e561281c565b3480156107ba57600080fd5b506104076107c9366004614861565b6012602052600090815260409020546001600160a01b031681565b3480156107f057600080fd5b506104ab6107ff366004614861565b60106020526000908152604090205481565b34801561081d57600080fd5b5061083161082c366004614c57565b612830565b6040516103a79190614ea8565b34801561084a57600080fd5b506000546001600160a01b0316610407565b34801561086857600080fd5b5061039b610877366004614c72565b8051602081830181018051601a8252928201919093012091525460ff1681565b3480156108a357600080fd5b506103c5612934565b3480156108b857600080fd5b506108316108c7366004614ba7565b612943565b3480156108d857600080fd5b506103e56108e7366004614ec9565b612ae4565b3480156108f857600080fd5b506103e561090736600461482c565b612b50565b34801561091857600080fd5b5061092c610927366004614861565b612dc1565b6040516103a79190614f38565b6103e5610947366004614d99565b612dff565b34801561095857600080fd5b50610987610967366004614861565b6015602052600090815260409020546bffffffffffffffffffffffff1681565b6040516bffffffffffffffffffffffff90911681526020016103a7565b6103e56109b2366004614f46565b613080565b3480156109c357600080fd5b506104ab6109d2366004614861565b60186020526000908152604090205481565b3480156109f057600080fd5b506103c56109ff366004614861565b6130c4565b348015610a1057600080fd5b50610a24610a1f366004614861565b61314d565b6040516103a79190614fae565b348015610a3d57600080fd5b506103c5610a4c366004614861565b6131d5565b348015610a5d57600080fd5b506103e5610a6c366004614ff3565b613258565b348015610a7d57600080fd5b506103e5610a8c366004615040565b61339e565b348015610a9d57600080fd5b506103e5610aac3660046150b4565b61347f565b348015610abd57600080fd5b506104ab6135c8565b348015610ad257600080fd5b506103c5610ae1366004614af6565b6135de565b348015610af257600080fd5b5061039b610b013660046150d7565b6001600160a01b039182166000908152600c6020908152604080832093909416825291909152205460ff1690565b348015610b3b57600080fd5b506103e5610b4a366004614c57565b613602565b348015610b5b57600080fd5b50600154610407906001600160a01b031681565b6000610b7a8261368f565b80610b895750610b898261370f565b92915050565b606060078054610b9e90615101565b80601f0160208091040260200160405190810160405280929190818152602001828054610bca90615101565b8015610c175780601f10610bec57610100808354040283529160200191610c17565b820191906000526020600020905b815481529060010190602001808311610bfa57829003601f168201915b5050505050905090565b610c2961375d565b80518015801590610c3c5750600e548111155b610c7e5760405162461bcd60e51b815260206004820152600e60248201526d092dcecc2d8d2c840d8cadccee8d60931b60448201526064015b60405180910390fd5b6000601060006013600086600081518110610c9b57610c9b61513b565b60200260200101516020015181526020019081526020016000205481526020019081526020016000205490506011600082815260200190815260200160002060009054906101000a90046001600160a01b03166001600160a01b0316610cfe3390565b6001600160a01b031614610d425760405162461bcd60e51b815260206004820152601a60248201526000805160206156d38339815191526044820152606401610c75565b6000808367ffffffffffffffff811115610d5e57610d5e6146af565b604051908082528060200260200182016040528015610d87578160200160208202803683370190505b50905060005b84811015610e9157858181518110610da757610da761513b565b60200260200101516040015183610dbe9190615167565b92506000610dcb60055490565b905080838381518110610de057610de061513b565b602002602001018181525050868281518110610dfe57610dfe61513b565b6020026020010151602001516016600083815260200190815260200160002081905550868281518110610e3357610e3361513b565b6020026020010151606001516018600083815260200190815260200160002081905550610e7e878381518110610e6b57610e6b61513b565b60200260200101516000015160016137b6565b5080610e898161517a565b915050610d8d565b50813414610ed15760405162461bcd60e51b815260206004820152600d60248201526c496e76616c69642076616c756560981b6044820152606401610c75565b600083815260126020526040902054610ef3906001600160a01b0316836137d0565b7f7fb9423fc0c061f94269225144532964c522dc9c8a78b929a620296b506b206a81604051610f229190614ea8565b60405180910390a150505050610f386001600d55565b50565b6000610f46826137e3565b610f7c576040517fcf4700e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506000908152600b60205260409020546001600160a01b031690565b6000610fa38261242d565b9050336001600160a01b03821614610ff557610fbf8133610b01565b610ff5576040517fcfb3b94200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600b602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6000838152601060209081526040808320548084526011909252909120546001600160a01b0316336001600160a01b0316146110bd5760405162461bcd60e51b815260206004820152601a60248201526000805160206156d38339815191526044820152606401610c75565b600084815260176020908152604080832086845290915290206110e083826151d9565b5060008381526013602052604090819020859055517f6a8fcae9caff40f5a9b57fe6363a62bf5110a5b7226ffa1ab411e7d469857a9e9061112690869086908690615299565b60405180910390a150505050565b6000828152601160205260409020546001600160a01b031633146111885760405162461bcd60e51b815260206004820152601a60248201526000805160206156d38339815191526044820152606401610c75565b6001600160a01b0381166111de5760405162461bcd60e51b815260206004820152600f60248201527f496e76616c6964206164647265737300000000000000000000000000000000006044820152606401610c75565b60008281526012602090815260409182902080546001600160a01b038581166001600160a01b0319831681179093558451878152911692810183905292830152907f15c353f11e484a1bc8e008fa8cf27ced61391887c912c9b8e5006a904cb4bf899060600160405180910390a1505050565b815180158015906112645750600e548111155b6112a15760405162461bcd60e51b815260206004820152600e60248201526d092dcecc2d8d2c840d8cadccee8d60931b6044820152606401610c75565b815181146112f15760405162461bcd60e51b815260206004820152601360248201527f496e636f6e73697374656e74206c656e677468000000000000000000000000006044820152606401610c75565b6000601060006013600060166000896000815181106113125761131261513b565b602002602001015181526020019081526020016000205481526020019081526020016000205481526020019081526020016000205490506011600082815260200190815260200160002060009054906101000a90046001600160a01b03166001600160a01b03166113803390565b6001600160a01b0316146113c45760405162461bcd60e51b815260206004820152601a60248201526000805160206156d38339815191526044820152606401610c75565b60008267ffffffffffffffff8111156113df576113df6146af565b604051908082528060200260200182016040528015611408578160200160208202803683370190505b50905060005b8381101561157e5761143886828151811061142b5761142b61513b565b60200260200101516137e3565b6114845760405162461bcd60e51b815260206004820152601160248201527f4e6f6e6578697374656e7420746f6b656e0000000000000000000000000000006044820152606401610c75565b6019600087838151811061149a5761149a61513b565b6020026020010151815260200190815260200160002060009054906101000a900460ff168282815181106114d0576114d061513b565b602002602001019060038111156114e9576114e9614f00565b908160038111156114fc576114fc614f00565b815250508481815181106115125761151261513b565b6020026020010151601960008884815181106115305761153061513b565b6020026020010151815260200190815260200160002060006101000a81548160ff0219169083600381111561156757611567614f00565b0217905550806115768161517a565b91505061140e565b507ff5f903bac2b9f936199a68eb2ceab266d4d530a0841f12b61de2c8f41a0e408a8582866040516115b2939291906152f8565b60405180910390a15050505050565b60006115cc82613818565b9050836001600160a01b0316816001600160a01b031614611619576040517fa114810000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600b6020526040902080546116458187335b6001600160a01b039081169116811491141790565b611670576116538633610b01565b61167057604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b0385166116b0576040517fea553b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6116bd86868660016138a0565b80156116c857600082555b6001600160a01b038681166000908152600a60205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260096020526040812091909155600160e11b8416900361175a576001840160008181526009602052604081205490036117585760055481146117585760008181526009602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b505050505050565b6000828152601660209081526040808320548352601382528083205480845260158352818420546010845282852054855260129093529083205483926bffffffffffffffffffffffff16906001600160a01b031683612710611806848961533b565b6118109190615352565b9195509093505050505b9250929050565b6001546001600160a01b0316336001600160a01b0316146118845760405162461bcd60e51b815260206004820152601c60248201527f4f776e61626c653a2043616c6c6572206973206e6f742061646d696e000000006044820152606401610c75565b600081116118d45760405162461bcd60e51b815260206004820152601160248201527f496e76616c6964206d61782062617463680000000000000000000000000000006044820152606401610c75565b600e80549082905560408051828152602081018490527fb2db87a3616f65c2d37334618af1f0b8ecb48cb11d9b7c25c3d1380d1c24c03e91015b60405180910390a15050565b601a8160405161192a9190615374565b9081526040519081900360200190205460ff161561197e5760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964207369676e617475726560781b6044820152606401610c75565b6001600160a01b0383166119d45760405162461bcd60e51b815260206004820152600f60248201527f496e76616c6964206164647265737300000000000000000000000000000000006044820152606401610c75565b6000858585856040516020016119ed9493929190615390565b60408051601f198184030181529190528051602090910120600254909150611a2190829084906001600160a01b031661393a565b611a615760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964207369676e617475726560781b6044820152606401610c75565b600086815260126020908152604080832080546001600160a01b03808a166001600160a01b03199283161790925560119093529281902080549389169390921692909217905551600190601a90611ab9908590615374565b9081526040805160209281900383018120805460ff1916941515949094179093558883526001600160a01b0380891692840192909252908616908201527fd0dd49be4ec013b76bda245b475030e37b32f2a86f5b767262f1cf77648362ea9060600160405180910390a1505050505050565b611b4683838360405180602001604052806000815250613080565b505050565b60008181526016602090815260408083208390556018825280832083905560199091529020805460ff19169055611b83816001613990565b7fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca533604080516001600160a01b039092168252602082018490520160405180910390a150565b611bd161375d565b600081815260136020908152604080832054835260108252808320548084526011909252909120546001600160a01b0316336001600160a01b031614611c475760405162461bcd60e51b815260206004820152601a60248201526000805160206156d38339815191526044820152606401610c75565b6000611c5260055490565b6000818152601660209081526040808320879055601890915290208590559050611c7d8560016137b6565b604080516001600160a01b038716815260208101839052606081830181905260009082015290517f13b4590e2f417016fce3f02298116b2ad6220e5ee149b4c55d2f1d9f501276239181900360800190a15050611b466001600d55565b611ce261375d565b80518015801590611cf55750600e548111155b611d325760405162461bcd60e51b815260206004820152600e60248201526d092dcecc2d8d2c840d8cadccee8d60931b6044820152606401610c75565b6000601060006013600086600081518110611d4f57611d4f61513b565b60200260200101516020015181526020019081526020016000205481526020019081526020016000205490506011600082815260200190815260200160002060009054906101000a90046001600160a01b03166001600160a01b0316611db23390565b6001600160a01b031614611df65760405162461bcd60e51b815260206004820152601a60248201526000805160206156d38339815191526044820152606401610c75565b6000808367ffffffffffffffff811115611e1257611e126146af565b604051908082528060200260200182016040528015611e3b578160200160208202803683370190505b50905060005b84811015611f3257858181518110611e5b57611e5b61513b565b60200260200101516040015183611e729190615167565b92506000611e7f60055490565b905080838381518110611e9457611e9461513b565b602002602001018181525050868281518110611eb257611eb261513b565b6020026020010151602001516016600083815260200190815260200160002081905550868281518110611ee757611ee761513b565b6020026020010151606001516018600083815260200190815260200160002081905550611f1f878381518110610e6b57610e6b61513b565b5080611f2a8161517a565b915050611e41565b50611f56336000858152601260205260409020546001600160a01b03168885613b02565b7f7fb9423fc0c061f94269225144532964c522dc9c8a78b929a620296b506b206a81604051611f859190614ea8565b60405180910390a150505050611f9b6001600d55565b5050565b611fa761375d565b600083815260136020908152604080832054835260108252808320548084526011909252909120546001600160a01b0316336001600160a01b03161461201d5760405162461bcd60e51b815260206004820152601a60248201526000805160206156d38339815191526044820152606401610c75565b82341461205c5760405162461bcd60e51b815260206004820152600d60248201526c496e76616c69642076616c756560981b6044820152606401610c75565b600061206760055490565b60008181526016602090815260408083208990556018909152902084905590506120928660016137b6565b6000828152601260205260409020546120b4906001600160a01b0316856137d0565b7f13b4590e2f417016fce3f02298116b2ad6220e5ee149b4c55d2f1d9f50127623866120de6135c8565b604080516001600160a01b0390931683526020830191909152606090820181905260009082015260800160405180910390a1505061211c6001600d55565b50505050565b6001546001600160a01b0316336001600160a01b0316146121855760405162461bcd60e51b815260206004820152601c60248201527f4f776e61626c653a2043616c6c6572206973206e6f742061646d696e000000006044820152606401610c75565b6001600160a01b0381166121db5760405162461bcd60e51b815260206004820152601860248201527f4f776e61626c653a20496e76616c6964206164647265737300000000000000006044820152606401610c75565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907fece0bf81fd8f6889c8c3a1f3b057df878a9e1a0501fd4d62c77822fe3570d28f90600090a35050565b6001546001600160a01b0316336001600160a01b0316146122905760405162461bcd60e51b815260206004820152601c60248201527f4f776e61626c653a2043616c6c6572206973206e6f742061646d696e000000006044820152606401610c75565b6000600f805461229f90615101565b80601f01602080910402602001604051908101604052809291908181526020018280546122cb90615101565b80156123185780601f106122ed57610100808354040283529160200191612318565b820191906000526020600020905b8154815290600101906020018083116122fb57829003601f168201915b5050505050905081600f908161232e91906151d9565b507fc73341c723fd9197b17090f0c077cf2bbe4d89f2f7d71969b3a7e5c50d570a3881600f60405161190e9291906153dd565b60608160008167ffffffffffffffff81111561237f5761237f6146af565b6040519080825280602002602001820160405280156123d157816020015b60408051608081018252600080825260208083018290529282018190526060820152825260001990920191018161239d5790505b50905060005b828114612424576123ff8686838181106123f3576123f361513b565b9050602002013561314d565b8282815181106124115761241161513b565b60209081029190910101526001016123d7565b50949350505050565b6000610b8982613818565b61244061375d565b601a816040516124509190615374565b9081526040519081900360200190205460ff16156124a45760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964207369676e617475726560781b6044820152606401610c75565b428260c0015110156124f85760405162461bcd60e51b815260206004820152601160248201527f45787069726564207369676e61747572650000000000000000000000000000006044820152606401610c75565b81516020808401516040808601516060870151608088015160a089015160c08a0151945160009861252d989097969101615478565b60408051601f19818403018152919052805160209091012060025490915061256190829084906001600160a01b031661393a565b6125a15760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964207369676e617475726560781b6044820152606401610c75565b6001601a836040516125b39190615374565b908152604051908190036020019020805491151560ff199092169190911790556125dc83613b17565b82516060840151600090815260136020908152604080832054835260108252808320548352601282529091205490850151608086015161262793926001600160a01b03169190613b02565b82517f13b4590e2f417016fce3f02298116b2ad6220e5ee149b4c55d2f1d9f50127623906126536135c8565b84604051612663939291906154d7565b60405180910390a150611f9b6001600d55565b600f805461268390615101565b80601f01602080910402602001604051908101604052809291908181526020018280546126af90615101565b80156126fc5780601f106126d1576101008083540402835291602001916126fc565b820191906000526020600020905b8154815290600101906020018083116126df57829003601f168201915b505050505081565b61270c613b5a565b6001600160a01b0381166127625760405162461bcd60e51b815260206004820152601860248201527f4f776e61626c653a20496e76616c6964206164647265737300000000000000006044820152606401610c75565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f848ac24ab84501710d6631faab117b66b79aba7ec6f7778cf3bcff428c1a4efc90600090a35050565b60006001600160a01b0382166127f6576040517f8f4eb60400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506001600160a01b03166000908152600a602052604090205467ffffffffffffffff1690565b612824613b5a565b61282e6000613bb4565b565b60606000806000612840856127b4565b905060008167ffffffffffffffff81111561285d5761285d6146af565b604051908082528060200260200182016040528015612886578160200160208202803683370190505b5060408051608081018252600080825260208201819052918101829052606081019190915290915060015b838614612928576128c181613c04565b915081604001516129205781516001600160a01b0316156128e157815194505b876001600160a01b0316856001600160a01b03160361292057808387806001019850815181106129135761291361513b565b6020026020010181815250505b6001016128b1565b50909695505050505050565b606060088054610b9e90615101565b606081831061297e576040517f32c1995a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008061298a60055490565b9050600185101561299a57600194505b808411156129a6578093505b60006129b1876127b4565b9050848610156129d057858503818110156129ca578091505b506129d4565b5060005b60008167ffffffffffffffff8111156129ef576129ef6146af565b604051908082528060200260200182016040528015612a18578160200160208202803683370190505b50905081600003612a2e579350612add92505050565b6000612a398861314d565b905060008160400151612a4a575080515b885b888114158015612a5c5750848714155b15612ad157612a6a81613c04565b92508260400151612ac95782516001600160a01b031615612a8a57825191505b8a6001600160a01b0316826001600160a01b031603612ac95780848880600101995081518110612abc57612abc61513b565b6020026020010181815250505b600101612a4c565b50505092835250909150505b9392505050565b336000818152600c602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b612b5861375d565b80518015801590612b6b5750600e548111155b612ba85760405162461bcd60e51b815260206004820152600e60248201526d092dcecc2d8d2c840d8cadccee8d60931b6044820152606401610c75565b6000601060006013600086600081518110612bc557612bc561513b565b60200260200101516020015181526020019081526020016000205481526020019081526020016000205490506011600082815260200190815260200160002060009054906101000a90046001600160a01b03166001600160a01b0316612c283390565b6001600160a01b031614612c6c5760405162461bcd60e51b815260206004820152601a60248201526000805160206156d38339815191526044820152606401610c75565b60008267ffffffffffffffff811115612c8757612c876146af565b604051908082528060200260200182016040528015612cb0578160200160208202803683370190505b50905060005b83811015612d7c576000612cc960055490565b905080838381518110612cde57612cde61513b565b602002602001018181525050858281518110612cfc57612cfc61513b565b6020026020010151602001516016600083815260200190815260200160002081905550858281518110612d3157612d3161513b565b6020026020010151606001516018600083815260200190815260200160002081905550612d69868381518110610e6b57610e6b61513b565b5080612d748161517a565b915050612cb6565b507f7fb9423fc0c061f94269225144532964c522dc9c8a78b929a620296b506b206a81604051612dac9190614ea8565b60405180910390a1505050610f386001600d55565b6000612dcc826137e3565b612de957604051630a14c4b560e41b815260040160405180910390fd5b5060009081526019602052604090205460ff1690565b612e0761375d565b60608201516000908152601360209081526040808320548352601090915290819020549051601a90612e3a908490615374565b9081526040519081900360200190205460ff1615612e8e5760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964207369676e617475726560781b6044820152606401610c75565b82608001513414612ed15760405162461bcd60e51b815260206004820152600d60248201526c496e76616c69642076616c756560981b6044820152606401610c75565b428360c001511015612f255760405162461bcd60e51b815260206004820152601160248201527f45787069726564207369676e61747572650000000000000000000000000000006044820152606401610c75565b82516020808501516040808701516060880151608089015160a08a015160c08b01519451600098612f5a989097969101615478565b60408051601f198184030181529190528051602090910120600254909150612f8e90829085906001600160a01b031661393a565b612fce5760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964207369676e617475726560781b6044820152606401610c75565b6001601a84604051612fe09190615374565b908152604051908190036020019020805491151560ff1990921691909117905561300984613b17565b6000828152601260205260409020546080850151613030916001600160a01b0316906137d0565b83517f13b4590e2f417016fce3f02298116b2ad6220e5ee149b4c55d2f1d9f501276239061305c6135c8565b8560405161306c939291906154d7565b60405180910390a15050611f9b6001600d55565b61308b8484846115c1565b6001600160a01b0383163b1561211c576130a784848484613c83565b61211c576040516368d2bf6b60e11b815260040160405180910390fd5b60606130cf826137e3565b6130ec57604051630a14c4b560e41b815260040160405180910390fd5b6000828152601660209081526040808320548084526013835281842054808552601484528285206017855283862083875285529483902092519194909361313593919201615572565b60405160208183030381529060405292505050919050565b60408051608081018252600080825260208201819052918101829052606081019190915260408051608081018252600080825260208201819052918101829052606081019190915260018310806131a657506005548310155b156131b15792915050565b6131ba83613c04565b90508060400151156131cc5792915050565b612add83613d6f565b60606131e0826137e3565b6131fd57604051630a14c4b560e41b815260040160405180910390fd5b6000613207613de7565b905080516000036132275760405180602001604052806000815250612add565b8061323184613df6565b6040516020016132429291906155ae565b6040516020818303038152906040529392505050565b61326061375d565b600083815260136020908152604080832054835260108252808320548084526011909252909120546001600160a01b0316336001600160a01b0316146132d65760405162461bcd60e51b815260206004820152601a60248201526000805160206156d38339815191526044820152606401610c75565b60006132e160055490565b600081815260166020908152604080832089905560189091529020849055905061330c8760016137b6565b61332f336000848152601260205260409020546001600160a01b03168887613b02565b7f13b4590e2f417016fce3f02298116b2ad6220e5ee149b4c55d2f1d9f50127623876133596135c8565b604080516001600160a01b0390931683526020830191909152606090820181905260009082015260800160405180910390a150506133976001600d55565b5050505050565b6000848152601160205260409020546001600160a01b031633146133f25760405162461bcd60e51b815260206004820152601a60248201526000805160206156d38339815191526044820152606401610c75565b60008381526010602090815260408083208790556014909152902061341783826151d9565b506000838152601560205260409081902080546bffffffffffffffffffffffff19166bffffffffffffffffffffffff8416179055517f983fefe131e437096c7ade0c9efa7bbf062258ee8e64fc74491e817deea4ffcb90611126908690869085908790615605565b613488826137e3565b6134d45760405162461bcd60e51b815260206004820152601160248201527f4e6f6e6578697374656e7420746f6b656e0000000000000000000000000000006044820152606401610c75565b60008281526016602090815260408083205483526013825280832054835260108252808320548084526011909252909120546001600160a01b0316336001600160a01b0316146135545760405162461bcd60e51b815260206004820152601a60248201526000805160206156d38339815191526044820152606401610c75565b6000838152601960205260409020805460ff811691849160ff1916600183600381111561358357613583614f00565b0217905550837f4a7f5026fdf684730d67591b542eff7f8d27a94fee277f7b599b7844ef2eac2082856040516135ba929190615638565b60405180910390a250505050565b600060016005546135d99190615653565b905090565b60176020908152600092835260408084209091529082529020805461268390615101565b61360a613b5a565b6001600160a01b0381166136865760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610c75565b610f3881613bb4565b60006301ffc9a760e01b6001600160e01b0319831614806136d957507f80ac58cd000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b80610b895750506001600160e01b0319167f5b5e139f000000000000000000000000000000000000000000000000000000001490565b60006001600160e01b031982167f2a55205a000000000000000000000000000000000000000000000000000000001480610b8957506301ffc9a760e01b6001600160e01b0319831614610b89565b6002600d54036137af5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610c75565b6002600d55565b611f9b828260405180602001604052806000815250613e3a565b611f9b6001600160a01b03831682613ea0565b6000816001111580156137f7575060055482105b8015610b89575050600090815260096020526040902054600160e01b161590565b6000818060011161386e5760055481101561386e5760008181526009602052604081205490600160e01b8216900361386c575b80600003612add57506000190160008181526009602052604090205461384b565b505b6040517fdf2d9b4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038416158015906138c057506001600160a01b03831615155b156139355760008281526019602052604081205460ff1660038111156138e8576138e8614f00565b146139355760405162461bcd60e51b815260206004820152600e60248201527f496e76616c6964207374617475730000000000000000000000000000000000006044820152606401610c75565b61211c565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000006000908152601c849052603c81206001600160a01b03831661397d8286613fb9565b6001600160a01b03161495945050505050565b600061399b83613818565b9050806000806139b9866000908152600b6020526040902080549091565b9150915084156139f9576139ce818433611630565b6139f9576139dc8333610b01565b6139f957604051632ce44b5f60e11b815260040160405180910390fd5b613a078360008860016138a0565b8015613a1257600082555b6001600160a01b0383166000818152600a6020526040902080546fffffffffffffffffffffffffffffffff0190554260a01b177c030000000000000000000000000000000000000000000000000000000017600087815260096020526040812091909155600160e11b85169003613ab957600186016000818152600960205260408120549003613ab7576005548114613ab75760008181526009602052604090208590555b505b60405186906000906001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a4505060068054600101905550505050565b61211c6001600160a01b038316858584613fdd565b6000613b2260055490565b606083015160008281526016602090815260408083209390935560a08601516018909152919020558251909150611f9b9060016137b6565b6000546001600160a01b0316331461282e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c75565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b604080516080810182526000808252602082018190529181018290526060810191909152600082815260096020526040902054610b8990604080516080810182526001600160a01b038316815260a083901c67ffffffffffffffff166020820152600160e01b831615159181019190915260e89190911c606082015290565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290613cb8903390899088908890600401615666565b6020604051808303816000875af1925050508015613cf3575060408051601f3d908101601f19168201909252613cf091810190615698565b60015b613d51573d808015613d21576040519150601f19603f3d011682016040523d82523d6000602084013e613d26565b606091505b508051600003613d49576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b604080516080810182526000808252602082018190529181018290526060810191909152610b89613d9f83613818565b604080516080810182526001600160a01b038316815260a083901c67ffffffffffffffff166020820152600160e01b831615159181019190915260e89190911c606082015290565b6060600f8054610b9e90615101565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a900480613e105750819003601f19909101908152919050565b613e448383614065565b6001600160a01b0383163b15611b46576005548281035b613e6e6000868380600101945086613c83565b613e8b576040516368d2bf6b60e11b815260040160405180910390fd5b818110613e5b57816005541461339757600080fd5b80471015613ef05760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610c75565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114613f3d576040519150601f19603f3d011682016040523d82523d6000602084013e613f42565b606091505b5050905080611b465760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610c75565b6000806000613fc885856141a3565b91509150613fd5816141e5565b509392505050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017905261211c90859061434a565b60055460008290036140a3576040517fb562e8dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6140b060008483856138a0565b6001600160a01b0383166000818152600a602090815260408083208054680100000000000000018802019055848352600990915281206001851460e11b4260a01b178317905582840190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b81811461415f57808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4600101614127565b508160000361419a576040517f2e07630000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60055550505050565b60008082516041036141d95760208301516040840151606085015160001a6141cd87828585614432565b9450945050505061181a565b5060009050600261181a565b60008160048111156141f9576141f9614f00565b036142015750565b600181600481111561421557614215614f00565b036142625760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610c75565b600281600481111561427657614276614f00565b036142c35760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610c75565b60038160048111156142d7576142d7614f00565b03610f385760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610c75565b600061439f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166144f69092919063ffffffff16565b90508051600014806143c05750808060200190518101906143c091906156b5565b611b465760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610c75565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561446957506000905060036144ed565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156144bd573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166144e6576000600192509250506144ed565b9150600090505b94509492505050565b6060613d67848460008585600080866001600160a01b0316858760405161451d9190615374565b60006040518083038185875af1925050503d806000811461455a576040519150601f19603f3d011682016040523d82523d6000602084013e61455f565b606091505b50915091506145708783838761457b565b979650505050505050565b606083156145ea5782516000036145e3576001600160a01b0385163b6145e35760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610c75565b5081613d67565b613d6783838151156145ff5781518083602001fd5b8060405162461bcd60e51b8152600401610c75919061469c565b6001600160e01b031981168114610f3857600080fd5b60006020828403121561464157600080fd5b8135612add81614619565b60005b8381101561466757818101518382015260200161464f565b50506000910152565b6000815180845261468881602086016020860161464c565b601f01601f19169290920160200192915050565b602081526000612add6020830184614670565b634e487b7160e01b600052604160045260246000fd5b6040516080810167ffffffffffffffff811182821017156146e8576146e86146af565b60405290565b60405160e0810167ffffffffffffffff811182821017156146e8576146e86146af565b604051601f8201601f1916810167ffffffffffffffff8111828210171561473a5761473a6146af565b604052919050565b600067ffffffffffffffff82111561475c5761475c6146af565b5060051b60200190565b80356001600160a01b038116811461477d57600080fd5b919050565b600082601f83011261479357600080fd5b813560206147a86147a383614742565b614711565b82815260079290921b840181019181810190868411156147c757600080fd5b8286015b8481101561482157608081890312156147e45760008081fd5b6147ec6146c5565b6147f582614766565b8152818501358582015260408083013590820152606080830135908201528352918301916080016147cb565b509695505050505050565b60006020828403121561483e57600080fd5b813567ffffffffffffffff81111561485557600080fd5b613d6784828501614782565b60006020828403121561487357600080fd5b5035919050565b6000806040838503121561488d57600080fd5b61489683614766565b946020939093013593505050565b600082601f8301126148b557600080fd5b813567ffffffffffffffff8111156148cf576148cf6146af565b6148e2601f8201601f1916602001614711565b8181528460208386010111156148f757600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121561492957600080fd5b8335925060208401359150604084013567ffffffffffffffff81111561494e57600080fd5b61495a868287016148a4565b9150509250925092565b6000806040838503121561497757600080fd5b8235915061498760208401614766565b90509250929050565b80356004811061477d57600080fd5b600082601f8301126149b057600080fd5b813560206149c06147a383614742565b82815260059290921b840181019181810190868411156149df57600080fd5b8286015b84811015614821576149f481614990565b83529183019183016149e3565b60008060408385031215614a1457600080fd5b823567ffffffffffffffff80821115614a2c57600080fd5b818501915085601f830112614a4057600080fd5b81356020614a506147a383614742565b82815260059290921b84018101918181019089841115614a6f57600080fd5b948201945b83861015614a8d57853582529482019490820190614a74565b96505086013592505080821115614aa357600080fd5b50614ab08582860161499f565b9150509250929050565b600080600060608486031215614acf57600080fd5b614ad884614766565b9250614ae660208501614766565b9150604084013590509250925092565b60008060408385031215614b0957600080fd5b50508035926020909101359150565b600080600080600060a08688031215614b3057600080fd5b85359450614b4060208701614766565b9350614b4e60408701614766565b9250606086013567ffffffffffffffff80821115614b6b57600080fd5b614b7789838a016148a4565b93506080880135915080821115614b8d57600080fd5b50614b9a888289016148a4565b9150509295509295909350565b600080600060608486031215614bbc57600080fd5b614bc584614766565b95602085013595506040909401359392505050565b60008060408385031215614bed57600080fd5b614bf683614766565b9150602083013567ffffffffffffffff811115614c1257600080fd5b614ab085828601614782565b60008060008060808587031215614c3457600080fd5b614c3d85614766565b966020860135965060408601359560600135945092505050565b600060208284031215614c6957600080fd5b612add82614766565b600060208284031215614c8457600080fd5b813567ffffffffffffffff811115614c9b57600080fd5b613d67848285016148a4565b60008060208385031215614cba57600080fd5b823567ffffffffffffffff80821115614cd257600080fd5b818501915085601f830112614ce657600080fd5b813581811115614cf557600080fd5b8660208260051b8501011115614d0a57600080fd5b60209290920196919550909350505050565b6020808252825182820181905260009190848201906040850190845b8181101561292857614d868385516001600160a01b03815116825267ffffffffffffffff602082015116602083015260408101511515604083015262ffffff60608201511660608301525050565b9284019260809290920191600101614d38565b60008060408385031215614dac57600080fd5b823567ffffffffffffffff80821115614dc457600080fd5b9084019060e08287031215614dd857600080fd5b614de06146ee565b614de983614766565b8152614df760208401614766565b6020820152604083013582811115614e0e57600080fd5b614e1a888286016148a4565b604083015250606083013560608201526080830135608082015260a083013560a082015260c083013560c0820152809450506020850135915080821115614e6057600080fd5b50614ab0858286016148a4565b600081518084526020808501945080840160005b83811015614e9d57815187529582019590820190600101614e81565b509495945050505050565b602081526000612add6020830184614e6d565b8015158114610f3857600080fd5b60008060408385031215614edc57600080fd5b614ee583614766565b91506020830135614ef581614ebb565b809150509250929050565b634e487b7160e01b600052602160045260246000fd5b60048110614f3457634e487b7160e01b600052602160045260246000fd5b9052565b60208101610b898284614f16565b60008060008060808587031215614f5c57600080fd5b614f6585614766565b9350614f7360208601614766565b925060408501359150606085013567ffffffffffffffff811115614f9657600080fd5b614fa2878288016148a4565b91505092959194509250565b81516001600160a01b0316815260208083015167ffffffffffffffff169082015260408083015115159082015260608083015162ffffff169082015260808101610b89565b600080600080600060a0868803121561500b57600080fd5b61501486614766565b945061502260208701614766565b94979496505050506040830135926060810135926080909101359150565b6000806000806080858703121561505657600080fd5b8435935060208501359250604085013567ffffffffffffffff81111561507b57600080fd5b615087878288016148a4565b92505060608501356bffffffffffffffffffffffff811681146150a957600080fd5b939692955090935050565b600080604083850312156150c757600080fd5b8235915061498760208401614990565b600080604083850312156150ea57600080fd5b6150f383614766565b915061498760208401614766565b600181811c9082168061511557607f821691505b60208210810361513557634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b80820180821115610b8957610b89615151565b60006001820161518c5761518c615151565b5060010190565b601f821115611b4657600081815260208120601f850160051c810160208610156151ba5750805b601f850160051c820191505b8181101561179c578281556001016151c6565b815167ffffffffffffffff8111156151f3576151f36146af565b615207816152018454615101565b84615193565b602080601f83116001811461523c57600084156152245750858301515b600019600386901b1c1916600185901b17855561179c565b600085815260208120601f198616915b8281101561526b5788860151825594840194600190910190840161524c565b50858210156152895787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b8381528260208201526060604082015260006152b86060830184614670565b95945050505050565b600081518084526020808501945080840160005b83811015614e9d576152e8878351614f16565b95820195908201906001016152d5565b60608152600061530b6060830186614e6d565b828103602084015261531d81866152c1565b9050828103604084015261533181856152c1565b9695505050505050565b8082028115828204841417610b8957610b89615151565b60008261536f57634e487b7160e01b600052601260045260246000fd5b500490565b6000825161538681846020870161464c565b9190910192915050565b84815260006bffffffffffffffffffffffff19808660601b166020840152808560601b1660348401525082516153cd81604885016020870161464c565b9190910160480195945050505050565b6040815260006153f06040830185614670565b6020838203818501526000855461540681615101565b80855260018281168015615421576001811461543b57615469565b60ff1984168787015282151560051b870186019450615469565b896000528560002060005b84811015615461578154898201890152908301908701615446565b880187019550505b50929998505050505050505050565b60006bffffffffffffffffffffffff19808a60601b168352808960601b1660148401525086516154af816028850160208b0161464c565b90910160288101959095525060488401929092526068830152608882015260a8019392505050565b6001600160a01b03841681528260208201526060604082015260006152b86060830184614670565b6000815461550c81615101565b60018281168015615524576001811461553957615568565b60ff1984168752821515830287019450615568565b8560005260208060002060005b8581101561555f5781548a820152908401908201615546565b50505082870194505b5050505092915050565b600061557e82856154ff565b7f2d0000000000000000000000000000000000000000000000000000000000000081526152b860018201856154ff565b600083516155c081846020880161464c565b8351908301906155d481836020880161464c565b7f2e6a736f6e0000000000000000000000000000000000000000000000000000009101908152600501949350505050565b8481528360208201526bffffffffffffffffffffffff831660408201526080606082015260006153316080830184614670565b604081016156468285614f16565b612add6020830184614f16565b81810381811115610b8957610b89615151565b60006001600160a01b038087168352808616602084015250836040830152608060608301526153316080830184614670565b6000602082840312156156aa57600080fd5b8151612add81614619565b6000602082840312156156c757600080fd5b8151612add81614ebb56fe43616c6c6572206973206e6f74206f7267616e697a6174696f6e000000000000a2646970667358221220cc4cf12c3a9748a2b23a278c0907a9f34feb6131228393de1cbf1967d7443b3664736f6c63430008120033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000897f103257e51fb643536099477d07070fdbf5e3000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000000553696e7261000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000553494e5241000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _owner (address): 0x897f103257e51fB643536099477d07070FDBF5E3
Arg [1] : _tokenName (string): Sinra
Arg [2] : _symbol (string): SINRA
Arg [3] : _maxBatch (uint256): 50
-----Encoded View---------------
8 Constructor Arguments found :
Arg [0] : 000000000000000000000000897f103257e51fb643536099477d07070fdbf5e3
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [2] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000032
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [5] : 53696e7261000000000000000000000000000000000000000000000000000000
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [7] : 53494e5241000000000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.