Overview
TokenID
731
Total Transfers
-
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract
Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
LocalNounsToken
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT /* * Created by @eiba8884 */ pragma solidity ^0.8.6; import '@openzeppelin/contracts/utils/Strings.sol'; import './libs/ProviderTokenA2.sol'; import { INounsSeeder } from './localNouns/interfaces/INounsSeeder.sol'; import './localNouns/interfaces/IAssetProviderExMint.sol'; import './localNouns/interfaces/ILocalNounsToken.sol'; contract LocalNounsToken is ProviderTokenA2, ILocalNounsToken { using Strings for uint256; IAssetProviderExMint public assetProvider2; address public minter; mapping(uint256 => uint256[]) public tradePrefecture; // トレード先指定の都道府県 mapping(uint256 => address) public tradeAddress; // トレード先指定のアドレス address[] public royaltyAddresses; // ロイヤリティ送信先ウォレット mapping(address => uint256) public royaltyRatio; // ロイヤリティ送信先ウォレットごとの割合 uint256 royaltyRatioTotal; // royaltyRatioの合計(割戻用) bool public canSetApproval = false; // setApprovalForAll, approveの可否 uint256 public tradeRoyalty = 0.003 ether; // P2Pトレードのロイヤリティ uint256 public salesRoyaltyBasisPoint = 1000; // P2Pセールのロイヤリティ、購入価格の10% mapping(address => bool) public approveWhiteList; // Approveを許可するアドレスリスト constructor( IAssetProviderExMint _assetProvider, address _minter ) ProviderTokenA2(_assetProvider, 'Local Nouns', 'Local Nouns') { description = 'Local Nouns'; assetProvider2 = _assetProvider; minter = _minter; // ロイヤリティ送信先(コンストラクタではデプロイアドレス100%) royaltyAddresses = [msg.sender]; royaltyRatio[msg.sender] = 1; royaltyRatioTotal = 1; } function tokenName(uint256 _tokenId) internal pure override returns (string memory) { return string(abi.encodePacked('Local Nouns ', _tokenId.toString())); } function tokenURI(uint256 _tokenId) public view override returns (string memory) { require(_tokenId < _nextTokenId(), 'nonexistent token'); (string memory svgPart, string memory tag) = assetProvider2.generateSVGPart(_tokenId); bytes memory image = bytes(svgPart); return string( abi.encodePacked( 'data:application/json;base64,', Base64.encode( bytes( abi.encodePacked( '{"name":"', tokenName(_tokenId), '","description":"', description, '","attributes":[', generateTraits(_tokenId), '],"image":"data:image/svg+xml;base64,', image, '"}' ) ) ) ) ); } /** 都道府県番号を指定してミントします。 都道府県番号の下2桁=0を指定すると都道府県がランダムで選択されます。 都道府県番号の下3桁目以降はバージョン番号です。 ミント価格、ミント上限数は、Minterコントラクト側で制御するため、継承元のmintPrice, mintLimitは使用しません。 */ function mintSelectedPrefecture( address _to, uint256 _prefectureId, uint256 _amount ) public virtual returns (uint256 tokenId) { require(msg.sender == minter || msg.sender == owner(), 'Invalid sender'); require(_prefectureId % 100 <= 47, 'Invalid prefectureId'); // リエントランシー対策のため状態変更を先に実施 _safeMint(_to, _amount); uint256 startTokenId = _nextTokenId() - _amount; for (uint256 i = 0; i < _amount; i++) { assetProvider2.mint(_prefectureId, startTokenId + i); } return _nextTokenId() - 1; } function ownerMint( address[] memory _to, uint256[] memory _prefectureId, uint256[] memory _amount ) external onlyOwner returns (uint256 tokenId) { // 引数の整合性チェック require(_to.length == _prefectureId.length && _to.length == _amount.length, 'Invalid Arrays length'); for (uint256 i; i < _to.length; i++) { mintSelectedPrefecture(_to[i], _prefectureId[i], _amount[i]); } return _nextTokenId() - 1; } function mint() public payable override returns (uint256) { revert('Cannot use'); } function setMinter(address _minter) external onlyOwner { minter = _minter; } function setCanSetAproval(bool _canSetApproval) external onlyOwner { canSetApproval = _canSetApproval; } function setApproveWhiteList(address _address, bool approve) external onlyOwner { approveWhiteList[_address] = approve; } function setRoyaltyAddresses(address[] memory _addr, uint256[] memory ratio) external onlyOwner { // 引数の整合性チェック require(_addr.length == ratio.length, 'Invalid Arrays length'); royaltyAddresses = _addr; royaltyRatioTotal = 0; for (uint256 i = 0; i < _addr.length; i++) { royaltyRatio[_addr[i]] = ratio[i]; royaltyRatioTotal += ratio[i]; } } /** * @param _tokenId the token id for put on the trade list. * @param _prefectures prefectures that you want to trade. if you don't want specific prefecture, you don't need to set. * @param _tradeAddress the address only who can trade. */ function putTradeLocalNoun(uint256 _tokenId, uint256[] memory _prefectures, address _tradeAddress) public { for (uint256 i = 0; i < _prefectures.length; i++) { require(_prefectures[i] > 0 && _prefectures[i] <= 47, 'incorrect prefecutre id'); } super.putTrade(_tokenId, true); tradePrefecture[_tokenId] = _prefectures; if (_tradeAddress != address(0)) { tradeAddress[_tokenId] = _tradeAddress; } emit PutTradePrefecture(_tokenId, _prefectures, _tradeAddress); } function getTradePrefectureFor(uint256 _tokenId) public view returns (uint256[] memory) { return tradePrefecture[_tokenId]; } function cancelTradeLocalNoun(uint256 _tokenId) public { super.putTrade(_tokenId, false); uint256[] memory emptyArray; tradePrefecture[_tokenId] = emptyArray; tradeAddress[_tokenId] = address(0); emit CancelTradePrefecture(_tokenId); } function executeTradeLocalNoun(uint256 _myTokenId, uint256 _targetTokenId) public payable { require(msg.value >= tradeRoyalty, 'Insufficial royalty'); // tradeAddressがある場合はmsg.senderをチェック require( tradeAddress[_targetTokenId] == address(0) || msg.sender == tradeAddress[_targetTokenId], 'Limited address can trade' ); // tradePrefectureがない場合は、希望都道府県がないためチェック不要 if (tradePrefecture[_targetTokenId].length > 0) { uint256 myTokenIdPrefecture = assetProvider2.getPrefectureId(_myTokenId); bool isIncludesList = false; for (uint256 i = 0; i < tradePrefecture[_targetTokenId].length; i++) { if (myTokenIdPrefecture == tradePrefecture[_targetTokenId][i]) { isIncludesList = true; break; } } require(isIncludesList, 'unmatch to the wants list'); } super.executeTrade(_myTokenId, _targetTokenId); _processTradeRoyalty(msg.value); emit ExecuteTrade(_targetTokenId, ownerOf(_targetTokenId), _myTokenId, ownerOf(_myTokenId)); } function putTrade(uint256, bool) public pure override { revert('Cannot use'); } function executeTrade(uint256, uint256) public pure override { revert('Cannot use'); } function purchase(uint256 _tokenId, address _buyer, address _facilitator) external payable override { super._purchase(_tokenId, _buyer, _facilitator); emit Purchase(_tokenId, _buyer); } // transfer時はトレード解除 function _beforeTokenTransfers(address from, address to, uint256 startTokenId, uint256 quantity) internal override { uint256[] memory emptyArray; tradePrefecture[startTokenId] = emptyArray; tradeAddress[startTokenId] = address(0); super._beforeTokenTransfers(from, to, startTokenId, quantity); } function setTradeRoyalty(uint256 _royalty) external onlyOwner { tradeRoyalty = _royalty; } function setSalesRoyaltyBasisPoint(uint256 _bp) external onlyOwner { salesRoyaltyBasisPoint = _bp; } // pay royalties to admin here function _processRoyalty(uint _salesPrice, uint) internal override returns (uint256 royalty) { // royalty = (_salesPrice * 100) / 1000; // 10.0% royalty = (_salesPrice * salesRoyaltyBasisPoint) / 10000; _sendRoyalty(royalty); } // pay royalties to admin here function _processTradeRoyalty(uint _royalty) internal { _sendRoyalty(_royalty); } // send royalties to admin and developper function _sendRoyalty(uint _royalty) internal { for (uint256 i = 0; i < royaltyAddresses.length; i++) { _trySendRoyalty(royaltyAddresses[i], (_royalty * royaltyRatio[royaltyAddresses[i]]) / royaltyRatioTotal); } } function _trySendRoyalty(address to, uint amount) internal { (bool sent, ) = payable(to).call{ value: amount }(''); require(sent, 'Failed to send'); } function withdraw() external payable onlyOwner { _sendRoyalty(address(this).balance); } // 二重継承でエラーになるので個別関数を準備 function totalSupply2() public view returns (uint256) { return super.totalSupply(); } // 誰もがトークンを承認できないようにする function setApprovalForAll(address operator, bool approved) public override { require(canSetApproval || approveWhiteList[operator], 'Not allowed to set approval for all'); super.setApprovalForAll(operator, approved); } // 特定のトークンの承認も不可能にする function approve(address to, uint256 tokenId) public payable override { require(canSetApproval || approveWhiteList[to], 'Not allowed to approve'); super.approve(to, 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) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts 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 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 /** * This is a part of an effort to create a decentralized autonomous marketplace for digital assets, * which allows artists and developers to sell their arts and generative arts. * * Please see "https://fullyonchain.xyz/" for details. * * Created by Satoshi Nakajima (@snakajima) */ pragma solidity ^0.8.6; /** * IAssetProvider is the interface each asset provider implements. * We assume there are three types of asset providers. * 1. Static asset provider, which has a collection of assets (either in the storage or the code) and returns them. * 2. Generative provider, which dynamically (but deterministically from the seed) generates assets. * 3. Data visualizer, which generates assets based on various data on the blockchain. * * Note: Asset providers MUST implements IERC165 (supportsInterface method) as well. */ interface IAssetProvider { struct ProviderInfo { string key; // short and unique identifier of this provider (e.g., "asset") string name; // human readable display name (e.g., "Asset Store") IAssetProvider provider; } function getProviderInfo() external view returns(ProviderInfo memory); /** * This function returns SVGPart and the tag. The SVGPart consists of one or more SVG elements. * The tag specifies the identifier of the SVG element to be displayed (using <use> tag). * The tag is the combination of the provider key and assetId (e.e., "asset123") */ function generateSVGPart(uint256 _assetId) external view returns(string memory svgPart, string memory tag); /** * This is an optional function, which returns various traits of the image for ERC721 token. * Format: {"trait_type":"TRAIL_TYPE","value":"VALUE"},{...} */ function generateTraits(uint256 _assetId) external view returns (string memory); /** * This function returns the number of assets available from this provider. * If the total supply is 100, assetIds of available assets are 0,1,...99. * The generative providers may returns 0, which indicates the provider dynamically but * deterministically generates assets using the given assetId as the random seed. */ function totalSupply() external view returns(uint256); /** * Returns the onwer. The registration update is possible only if both contracts have the same owner. */ function getOwner() external view returns (address); /** * This function processes the royalty payment from the decentralized autonomous marketplace. */ function processPayout(uint256 _assetId) external payable; event Payout(string providerKey, uint256 assetId, address payable to, uint256 amount); } interface IAssetProviderEx is IAssetProvider { function generateSVGDocument(uint256 _assetId) external view returns(string memory document); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; /// @title Base64 /// @author Brecht Devos - <[email protected]> /// @notice Provides functions for encoding/decoding base64 library Base64 { string internal constant TABLE_ENCODE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; bytes internal constant TABLE_DECODE = hex"0000000000000000000000000000000000000000000000000000000000000000" hex"00000000000000000000003e0000003f3435363738393a3b3c3d000000000000" hex"00000102030405060708090a0b0c0d0e0f101112131415161718190000000000" hex"001a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132330000000000"; function encode(bytes memory data) internal pure returns (string memory) { if (data.length == 0) return ''; // load the table into memory string memory table = TABLE_ENCODE; // multiply by 4/3 rounded up uint256 encodedLen = 4 * ((data.length + 2) / 3); // add some extra buffer at the end required for the writing string memory result = new string(encodedLen + 32); assembly { // set the actual output length mstore(result, encodedLen) // prepare the lookup table let tablePtr := add(table, 1) // input ptr let dataPtr := data let endPtr := add(dataPtr, mload(data)) // result ptr, jump over length let resultPtr := add(result, 32) // run over the input, 3 bytes at a time for {} lt(dataPtr, endPtr) {} { // read 3 bytes dataPtr := add(dataPtr, 3) let input := mload(dataPtr) // write 4 characters mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F)))) resultPtr := add(resultPtr, 1) mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F)))) resultPtr := add(resultPtr, 1) mstore8(resultPtr, mload(add(tablePtr, and(shr( 6, input), 0x3F)))) resultPtr := add(resultPtr, 1) mstore8(resultPtr, mload(add(tablePtr, and( input, 0x3F)))) resultPtr := add(resultPtr, 1) } // padding with '=' switch mod(mload(data), 3) case 1 { mstore(sub(resultPtr, 2), shl(240, 0x3d3d)) } case 2 { mstore(sub(resultPtr, 1), shl(248, 0x3d)) } } return result; } function decode(string memory _data) internal pure returns (bytes memory) { bytes memory data = bytes(_data); if (data.length == 0) return new bytes(0); require(data.length % 4 == 0, "invalid base64 decoder input"); // load the table into memory bytes memory table = TABLE_DECODE; // every 4 characters represent 3 bytes uint256 decodedLen = (data.length / 4) * 3; // add some extra buffer at the end required for the writing bytes memory result = new bytes(decodedLen + 32); assembly { // padding with '=' let lastBytes := mload(add(data, mload(data))) if eq(and(lastBytes, 0xFF), 0x3d) { decodedLen := sub(decodedLen, 1) if eq(and(lastBytes, 0xFFFF), 0x3d3d) { decodedLen := sub(decodedLen, 1) } } // set the actual output length mstore(result, decodedLen) // prepare the lookup table let tablePtr := add(table, 1) // input ptr let dataPtr := data let endPtr := add(dataPtr, mload(data)) // result ptr, jump over length let resultPtr := add(result, 32) // run over the input, 4 characters at a time for {} lt(dataPtr, endPtr) {} { // read 4 characters dataPtr := add(dataPtr, 4) let input := mload(dataPtr) // write 3 bytes let output := add( add( shl(18, and(mload(add(tablePtr, and(shr(24, input), 0xFF))), 0xFF)), shl(12, and(mload(add(tablePtr, and(shr(16, input), 0xFF))), 0xFF))), add( shl( 6, and(mload(add(tablePtr, and(shr( 8, input), 0xFF))), 0xFF)), and(mload(add(tablePtr, and( input , 0xFF))), 0xFF) ) ) mstore(resultPtr, shl(232, output)) resultPtr := add(resultPtr, 3) } } return result; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.6; // import { Ownable } from '@openzeppelin/contracts/access/Ownable.sol'; // import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import '../packages/ERC721P2P/ERC721AP2PTradable.sol'; import { Base64 } from 'base64-sol/base64.sol'; import '@openzeppelin/contracts/utils/Strings.sol'; import 'assetprovider.sol/IAssetProvider.sol'; /** * ProviderToken is an abstract implentation of ERC721, which is built on top of an asset provider. * The specified asset provider is responsible in providing images for NFTs in SVG format, * which turns them into fully on-chain NFTs. * * When implementing the mint method, and it should call processPayout method of the asset provider like this: * * provider.processPayout{value:msg.value}(assetId) * */ abstract contract ProviderTokenA2 is ERC721AP2PTradable { using Strings for uint256; using Strings for uint16; // To be specified by the concrete contract string public description; uint public mintPrice; uint public mintLimit; IAssetProvider public assetProvider; constructor( IAssetProvider _assetProvider, string memory _title, string memory _shortTitle ) ERC721A(_title, _shortTitle) { assetProvider = _assetProvider; } function setAssetProvider(IAssetProvider _assetProvider) external onlyOwner { assetProvider = _assetProvider; // upgradable } function setDescription(string memory _description) external onlyOwner { description = _description; } function setMintPrice(uint256 _price) external onlyOwner { mintPrice = _price; } function setMintLimit(uint256 _limit) external onlyOwner { mintLimit = _limit; } string constant SVGHeader = '<svg viewBox="0 0 1024 1024' '" xmlns="http://www.w3.org/2000/svg">\n' '<defs>\n'; /* * A function of IAssetStoreToken interface. * It generates SVG with the specified style, using the given "SVG Part". */ function generateSVG(uint256 _assetId) internal view returns (string memory) { // Constants of non-value type not yet implemented by Solidity (string memory svgPart, string memory tag) = assetProvider.generateSVGPart(_assetId); return string( abi.encodePacked( SVGHeader, svgPart, '</defs>\n' '<use href="#', tag, '" />\n' '</svg>\n' ) ); } /** * @notice A distinct Uniform Resource Identifier (URI) for a given asset. * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 _tokenId) public view virtual override returns (string memory) { require(_exists(_tokenId), 'ProviderToken.tokenURI: nonexistent token'); bytes memory image = bytes(generateSVG(_tokenId)); return string( abi.encodePacked( 'data:application/json;base64,', Base64.encode( bytes( abi.encodePacked( '{"name":"', tokenName(_tokenId), '","description":"', description, '","attributes":[', generateTraits(_tokenId), '],"image":"data:image/svg+xml;base64,', Base64.encode(image), '"}' ) ) ) ) ); } function tokenName(uint256 _tokenId) internal view virtual returns (string memory) { return _tokenId.toString(); } /** * For non-free minting, * 1. Override this method * 2. Check for the required payment, by calling mintPriceFor() * 3. Call the processPayout method of the asset provider with appropriate value */ function mint() public payable virtual returns (uint256 tokenId) { require(_nextTokenId() < mintLimit, 'Sold out'); _safeMint(msg.sender, 1); return _nextTokenId() - 1; } /** * The concreate contract may override to offer custom pricing, * such as token-gated discount. */ function mintPriceFor(address) public view virtual returns (uint256) { return mintPrice; } function totalSupply() public view override returns (uint256) { return _nextTokenId(); } function generateTraits(uint256 _tokenId) internal view returns (bytes memory traits) { traits = bytes(assetProvider.generateTraits(_tokenId)); } function debugTokenURI(uint256 _tokenId) public view returns (string memory uri, uint256 gas) { gas = gasleft(); uri = tokenURI(_tokenId); gas -= gasleft(); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.6; import 'assetprovider.sol/IAssetProvider.sol'; interface IAssetProviderExMint is IAssetProvider { function mint(uint256 prefectureId, uint256 _assetId) external returns (uint256); function getPrefectureId(uint256 prefectureId) external returns (uint256); }
// SPDX-License-Identifier: GPL-3.0 /// @title Interface for NounsSeeder /********************************* * ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ * * ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ * * ░░░░░░█████████░░█████████░░░ * * ░░░░░░██░░░████░░██░░░████░░░ * * ░░██████░░░████████░░░████░░░ * * ░░██░░██░░░████░░██░░░████░░░ * * ░░██░░██░░░████░░██░░░████░░░ * * ░░░░░░█████████░░█████████░░░ * * ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ * * ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ * *********************************/ pragma solidity ^0.8.6; interface ILocalNounsToken { function mintSelectedPrefecture(address to, uint256 prefectureId, uint256 _amount) external returns (uint256 tokenId); function setMinter(address _minter) external; // iLocalNounsTokenでERC721のtotalSupplyを使用したいけど、二重継承でエラーになるので個別関数を準備 function totalSupply2() external returns (uint256); // Fires when the owner puts the trade event PutTradePrefecture(uint256 indexed tokenId, uint256[] _prefectures, address _tradeAddress); // Fires when the owner cancel the trade event CancelTradePrefecture(uint256 indexed tokenId); // Fires when the purchase executed event Purchase(uint256 indexed tokenId, address _buyer); // Fires when the trade executed event ExecuteTrade(uint256 indexed targetTokenId, address _lister, uint256 indexed ownedTokenId, address _executer); }
// SPDX-License-Identifier: GPL-3.0 /// @title Common interface for NounsDescriptor versions, as used by NounsToken and NounsSeeder. /********************************* * ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ * * ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ * * ░░░░░░█████████░░█████████░░░ * * ░░░░░░██░░░████░░██░░░████░░░ * * ░░██████░░░████████░░░████░░░ * * ░░██░░██░░░████░░██░░░████░░░ * * ░░██░░██░░░████░░██░░░████░░░ * * ░░░░░░█████████░░█████████░░░ * * ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ * * ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ * *********************************/ pragma solidity ^0.8.6; import { INounsSeeder } from './INounsSeeder.sol'; interface INounsDescriptorMinimal { /// /// USED BY TOKEN /// function tokenURI(uint256 tokenId, INounsSeeder.Seed memory seed) external view returns (string memory); function dataURI(uint256 tokenId, INounsSeeder.Seed memory seed) external view returns (string memory); /// /// USED BY SEEDER /// function backgroundCount() external view returns (uint256); function bodyCount() external view returns (uint256); function accessoryCount() external view returns (uint256); function accessoryCountInPrefecture(uint256 prefectureId) external view returns (uint256); function accessoryInPrefecture(uint256 prefectureId, uint256 seqNo) external view returns (uint256); function headCount() external view returns (uint256); function headCountInPrefecture(uint256 prefectureId) external view returns (uint256); function headInPrefecture(uint256 prefectureId, uint256 seqNo) external view returns (uint256); function glassesCount() external view returns (uint256); }
// SPDX-License-Identifier: GPL-3.0 /// @title Interface for NounsSeeder /********************************* * ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ * * ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ * * ░░░░░░█████████░░█████████░░░ * * ░░░░░░██░░░████░░██░░░████░░░ * * ░░██████░░░████████░░░████░░░ * * ░░██░░██░░░████░░██░░░████░░░ * * ░░██░░██░░░████░░██░░░████░░░ * * ░░░░░░█████████░░█████████░░░ * * ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ * * ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ * *********************************/ pragma solidity ^0.8.6; import { INounsDescriptorMinimal } from './INounsDescriptorMinimal.sol'; interface INounsSeeder { struct Seed { uint48 background; uint48 body; uint48 accessory; uint48 head; uint48 glasses; } function generateSeed(uint256 nounId, INounsDescriptorMinimal descriptor) external view returns (Seed memory); }
// 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); } function _transfer( address from, address to, uint256 tokenId ) internal virtual { 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); }
// SPDX-License-Identifier: MIT /** * Inherits ERC721 as an extension * Please see "https://hackmd.io/@snakajima/BJqG3fkSo" for details. */ pragma solidity ^0.8.6; import './IERC721P2P.sol'; import { Ownable } from '@openzeppelin/contracts/access/Ownable.sol'; import './erc721a/extensions/ERC721AQueryable.sol'; abstract contract ERC721AP2P is IERC721P2PCore, ERC721A, Ownable { mapping(uint256 => uint256) prices; function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC721P2PCore).interfaceId || super.supportsInterface(interfaceId); } function setPriceOf(uint256 _tokenId, uint256 _price) public override { require(ownerOf(_tokenId) == msg.sender, 'Only the onwer can set the price'); prices[_tokenId] = _price; emit SetPrice(_tokenId, _price); } function getPriceOf(uint256 _tokenId) external view override returns (uint256) { return prices[_tokenId]; } function purchase(uint256 _tokenId, address _buyer, address _facilitator) external payable virtual { _purchase(_tokenId, _buyer, _facilitator); } function _purchase(uint256 _tokenId, address _buyer, address _facilitator) internal { uint256 price = prices[_tokenId]; require(price > 0, 'Token is not on sale'); require(msg.value >= price, 'Not enough fund'); uint256 comission = _processSalesCommission(msg.value, _facilitator); uint256 royalty = _processRoyalty(msg.value, _tokenId); address tokenOwner = ownerOf(_tokenId); address payable payableTo = payable(tokenOwner); payableTo.transfer(msg.value - comission - royalty); prices[_tokenId] = 0; // not on sale any more _transfer(tokenOwner, _buyer, _tokenId); // transferFrom(tokenOwner, _buyer, _tokenId); } // 2.5% to the facilitator (marketplace) function _processSalesCommission( uint _salesPrice, address _facilitator ) internal virtual returns (uint256 comission) { if (_facilitator != address(0)) { comission = (_salesPrice * 25) / 1000; // 2.5% address payable payableTo = payable(_facilitator); payableTo.transfer(comission); } } // Subclass needs to override to pay royalties to creator(s) here function _processRoyalty(uint _salesPrice, uint _tokenId) internal virtual returns (uint256 royalty) { /* royalty = _salesPrice * 50 / 1000; // 5.0% address payable payableTo = payable(address(_creator)); payableTo.transfer(royalty); */ } function acceptOffer(uint256 _tokenId, IERC721Marketplace _dealer, uint256 _price) external override { setPriceOf(_tokenId, _price); _dealer.acceptOffer(this, _tokenId, _price); } }
// SPDX-License-Identifier: MIT /** * Inherits ERC721 as an extension * Please see "https://hackmd.io/@snakajima/BJqG3fkSo" for details. */ pragma solidity ^0.8.6; import './IERC721P2PTradable.sol'; import './ERC721AP2P.sol'; abstract contract ERC721AP2PTradable is IERC721P2PTradableCore, ERC721AP2P { // onTradeList (tokenId => trade on/off) mapping(uint256 => bool) public trades; function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC721P2PTradableCore).interfaceId || super.supportsInterface(interfaceId); } function putTrade(uint256 _tokenId, bool _isOnTrade) public virtual { require(ownerOf(_tokenId) == msg.sender, 'Only the onwer can trade'); trades[_tokenId] = _isOnTrade; emit PutTrade(_tokenId, _isOnTrade); } function executeTrade(uint256 _myTokenId, uint256 _targetTokenId) public virtual { require(ownerOf(_myTokenId) == msg.sender, 'Only the onwer can trade'); require(trades[_targetTokenId] == true, 'TargetTokenId is not on trade'); address targetTokenOwner = ownerOf(_targetTokenId); _transfer(msg.sender, targetTokenOwner, _myTokenId); _transfer(targetTokenOwner, msg.sender, _targetTokenId); } // transfer時はセール、トレード解除 function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual override { trades[startTokenId] = false; // not trade any more prices[startTokenId] = 0; // not on sale any more super._beforeTokenTransfers(from, to, startTokenId, quantity); } }
// SPDX-License-Identifier: MIT /** * This is a part of an effort to update ERC271 so that the sales transaction * becomes decentralized and trustless, which makes it possible to enforce * royalities without relying on marketplaces. * * Please see "https://hackmd.io/@snakajima/BJqG3fkSo" for details. * * Created by Satoshi Nakajima (@snakajima) */ pragma solidity ^0.8.6; import '@openzeppelin/contracts/token/ERC721/IERC721.sol'; interface IERC721Marketplace { // Make an offer to a specific token function makeAnOffer(IERC721P2PCore _contract, uint256 _tokenId, uint256 _price) external payable; // Withdraw an offer to a specific token (onlyOfferMaker) function withdrawAnOffer(IERC721P2PCore _contract, uint256 _tokenId) external; // Get the current offer to the specifiedToken function getTheBestOffer(IERC721P2PCore _contract, uint256 _tokenId) external view returns (uint256, address); // It will call the purchase method of _contract with the specified amount of payment. function acceptOffer(IERC721P2PCore _contract, uint256 _tokenId, uint256 _price) external; } interface IERC721P2PCore { // Set the price of the specified token (onlyTokenOwner) function setPriceOf(uint256 _tokenId, uint256 _price) external; // Get the current price of the specified token function getPriceOf(uint256 _tokenId) external view returns (uint256); // It will transfer the token and distribute the money, including royalties function purchase(uint256 _tokenId, address _buyer, address _facilitator) external payable; // It sets the price and calls the acceptOffer method of _dealer (onlyTokenOwner) function acceptOffer(uint256 _tokenId, IERC721Marketplace _dealer, uint256 _price) external; // Fires when the owner sets the price event SetPrice(uint256 indexed tokenId, uint256 price); } // deprecated interface IERC721P2P is IERC721P2PCore, IERC721 { }
// SPDX-License-Identifier: MIT /** * This is a part of an effort to update ERC271 so that the sales transaction * becomes decentralized and trustless, which makes it possible to enforce * royalities without relying on marketplaces. * * Please see "https://hackmd.io/@snakajima/BJqG3fkSo" for details. * * Created by Satoshi Nakajima (@snakajima) */ pragma solidity ^0.8.6; import '@openzeppelin/contracts/token/ERC721/IERC721.sol'; import './IERC721P2P.sol'; interface IERC721P2PTradableCore { // Put the specified token to trade list(onlyTokenOwner) function putTrade(uint256 _tokenId, bool _isOnTrade) external; // Trade the specified tokens (onlyTokenOwner) function executeTrade(uint256 _myTokenId, uint256 _targetTokenId) external; // Fires when the owner puts the trade event PutTrade(uint256 indexed tokenId, bool _isOnTrade); } // deprecated interface IERC721P2PTradable is IERC721P2PTradableCore, IERC721P2P { }
{ "optimizer": { "enabled": true, "runs": 200, "details": { "yulDetails": { "optimizerSteps": "u" } } }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract IAssetProviderExMint","name":"_assetProvider","type":"address"},{"internalType":"address","name":"_minter","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","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":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"CancelTradePrefecture","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":true,"internalType":"uint256","name":"targetTokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"_lister","type":"address"},{"indexed":true,"internalType":"uint256","name":"ownedTokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"_executer","type":"address"}],"name":"ExecuteTrade","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"_buyer","type":"address"}],"name":"Purchase","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"bool","name":"_isOnTrade","type":"bool"}],"name":"PutTrade","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"_prefectures","type":"uint256[]"},{"indexed":false,"internalType":"address","name":"_tradeAddress","type":"address"}],"name":"PutTradePrefecture","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"}],"name":"SetPrice","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"contract IERC721Marketplace","name":"_dealer","type":"address"},{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"acceptOffer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"approveWhiteList","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"assetProvider","outputs":[{"internalType":"contract IAssetProvider","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"assetProvider2","outputs":[{"internalType":"contract IAssetProviderExMint","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"canSetApproval","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"cancelTradeLocalNoun","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"debugTokenURI","outputs":[{"internalType":"string","name":"uri","type":"string"},{"internalType":"uint256","name":"gas","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"description","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"executeTrade","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_myTokenId","type":"uint256"},{"internalType":"uint256","name":"_targetTokenId","type":"uint256"}],"name":"executeTradeLocalNoun","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getPriceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getTradePrefectureFor","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"mintLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mintPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"mintPriceFor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_prefectureId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"mintSelectedPrefecture","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"minter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_to","type":"address[]"},{"internalType":"uint256[]","name":"_prefectureId","type":"uint256[]"},{"internalType":"uint256[]","name":"_amount","type":"uint256[]"}],"name":"ownerMint","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"nonpayable","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"},{"internalType":"address","name":"_buyer","type":"address"},{"internalType":"address","name":"_facilitator","type":"address"}],"name":"purchase","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bool","name":"","type":"bool"}],"name":"putTrade","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256[]","name":"_prefectures","type":"uint256[]"},{"internalType":"address","name":"_tradeAddress","type":"address"}],"name":"putTradeLocalNoun","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"royaltyAddresses","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"royaltyRatio","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":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"salesRoyaltyBasisPoint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"},{"internalType":"bool","name":"approve","type":"bool"}],"name":"setApproveWhiteList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IAssetProvider","name":"_assetProvider","type":"address"}],"name":"setAssetProvider","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_canSetApproval","type":"bool"}],"name":"setCanSetAproval","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_description","type":"string"}],"name":"setDescription","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_limit","type":"uint256"}],"name":"setMintLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"setMintPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_minter","type":"address"}],"name":"setMinter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"setPriceOf","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_addr","type":"address[]"},{"internalType":"uint256[]","name":"ratio","type":"uint256[]"}],"name":"setRoyaltyAddresses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_bp","type":"uint256"}],"name":"setSalesRoyaltyBasisPoint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_royalty","type":"uint256"}],"name":"setTradeRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply2","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tradeAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"tradePrefecture","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tradeRoyalty","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"trades","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":[],"name":"withdraw","outputs":[],"stateMutability":"payable","type":"function"}]
Contract Creation Code
60806040526016805460ff19169055660aa87bee5380006017556103e86018553480156200002c57600080fd5b50604051620040ce380380620040ce8339810160408190526200004f91620002aa565b604080518082018252600b8082526a4c6f63616c204e6f756e7360a81b602080840182905284518086019095529184529083015283918181600262000095838262000400565b506003620000a4828262000400565b50506000805550620000b63362000178565b5050600e80546001600160a01b0319166001600160a01b039290921691909117905560408051808201909152600b8082526a4c6f63616c204e6f756e7360a81b60208301529062000108908262000400565b50600f80546001600160a01b038085166001600160a01b0319928316179092556010805492841692909116919091179055604080516020810190915233815262000157906013906001620001ca565b505033600090815260146020526040902060019081905560155550620004cc565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b82805482825590600052602060002090810192821562000222579160200282015b828111156200022257825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190620001eb565b506200023092915062000234565b5090565b5b8082111562000230576000815560010162000235565b60006001600160a01b0382165b92915050565b600062000258826200024b565b62000276816200025e565b81146200028257600080fd5b50565b805162000258816200026b565b62000276816200024b565b8051620002588162000292565b60008060408385031215620002c257620002c2600080fd5b6000620002d0858562000285565b9250506020620002e3858286016200029d565b9150509250929050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052602260045260246000fd5b6002810460018216806200032e57607f821691505b60208210810362000343576200034362000303565b50919050565b600062000258620003578381565b90565b620003658362000349565b81546008840282811b60001990911b908116901990911617825550505050565b6000620003948184846200035a565b505050565b81811015620003b857620003af60008262000385565b60010162000399565b5050565b601f82111562000394576000818152602090206020601f85010481016020851015620003e55750805b620003f96020601f86010483018262000399565b5050505050565b81516001600160401b038111156200041c576200041c620002ed565b62000428825462000319565b62000435828285620003bc565b506020601f8211600181146200046d5760008315620004545750848201515b600019600885021c1981166002850217855550620003f9565b600084815260208120601f198516915b828110156200049f57878501518255602094850194600190920191016200047d565b5084821015620004bd5783870151600019601f87166008021c191681555b50505050600202600101905550565b613bf280620004dc6000396000f3fe60806040526004361061038c5760003560e01c806370a08231116101dc578063a370f7d711610102578063dc49f204116100a0578063f4a0a5281161006f578063f4a0a52814610a2a578063fba49e4f14610a4a578063fca3b5aa14610a6a578063ff7047aa14610a8a57600080fd5b8063dc49f204146109b0578063e4f71a00146109ca578063e985e9c5146109ea578063f2fde38b14610a0a57600080fd5b8063b88d4fde116100dc578063b88d4fde1461091f578063c669df6d14610932578063c87b56dd14610962578063cc44ab411461098257600080fd5b8063a370f7d7146108b2578063b212cfc7146108d2578063b54b4fb9146108f257600080fd5b80639048ec0a1161017a57806396178c201161014957806396178c2014610525578063996517cf1461085c5780639e6a1d7d14610872578063a22cb4651461089257600080fd5b80639048ec0a146107f157806390c3f38f146108075780639589d7b91461082757806395d89b411461084757600080fd5b80637e4f8669116101b65780637e4f8669146107805780638c402078146107a05780638da5cb5b146107b35780638dac5864146107d157600080fd5b806370a0823114610736578063715018a6146107565780637284e4161461076b57600080fd5b806323c563ab116102c15780633ccfd60b1161025f5780635975814e1161022e5780635975814e146106c55780636352211e146106e557806367008d77146107055780636817c76c1461072057600080fd5b80633ccfd60b1461065d57806342842e0e14610665578063476bf00d146106785780634d1317571461069857600080fd5b80632dbdaf6e1161029b5780632dbdaf6e146105ea57806335a05ad51461060a57806337fbf5781461062a5780633b7f8f151461064a57600080fd5b806323c563ab1461057d57806326df5b351461059d57806326fbd1d6146105ca57600080fd5b806311d7ef261161032e578063163999a611610308578063163999a61461050557806318160ddd146105255780631e6c598e1461053a57806323b872dd1461056a57600080fd5b806311d7ef26146104a55780631249c58b146104db5780631346d8ea146104e357600080fd5b8063075461721161036a578063075461721461041657806307f0bac114610443578063081812fc14610470578063095ea7b31461049057600080fd5b806301ffc9a71461039157806305503088146103c757806306fdde03146103f4575b600080fd5b34801561039d57600080fd5b506103b16103ac36600461286c565b610aa0565b6040516103be9190612897565b60405180910390f35b3480156103d357600080fd5b506103e76103e2366004612a51565b610acb565b6040516103be9190612af4565b34801561040057600080fd5b50610409610ba1565b6040516103be9190612b58565b34801561042257600080fd5b50601054610436906001600160a01b031681565b6040516103be9190612b72565b34801561044f57600080fd5b506103e761045e366004612b80565b60146020526000908152604090205481565b34801561047c57600080fd5b5061043661048b366004612ba1565b610c33565b6104a361049e366004612bc2565b610c77565b005b3480156104b157600080fd5b506104366104c0366004612ba1565b6012602052600090815260409020546001600160a01b031681565b6103e7610cca565b3480156104ef57600080fd5b506103e76104fe366004612b80565b50600c5490565b34801561051157600080fd5b506104a3610520366004612bff565b610ce4565b34801561053157600080fd5b506000546103e7565b34801561054657600080fd5b506103b1610555366004612ba1565b600a6020526000908152604090205460ff1681565b6104a3610578366004612c65565b610dd6565b34801561058957600080fd5b506104a3610598366004612ba1565b610f7b565b3480156105a957600080fd5b50600f546105bd906001600160a01b031681565b6040516103be9190612ced565b3480156105d657600080fd5b506104a36105e5366004612cfb565b610f88565b3480156105f657600080fd5b506104a3610605366004612d30565b610fa0565b34801561061657600080fd5b50610436610625366004612ba1565b610fd3565b34801561063657600080fd5b506103e7610645366004612d63565b610ffd565b6104a3610658366004612d98565b611145565b6104a361118d565b6104a3610673366004612c65565b6111a0565b34801561068457600080fd5b506104a3610693366004612ba1565b6111bb565b3480156106a457600080fd5b506106b86106b3366004612ba1565b6111c8565b6040516103be9190612e3c565b3480156106d157600080fd5b506104a36106e0366004612e4d565b61122a565b3480156106f157600080fd5b50610436610700366004612ba1565b61133c565b34801561071157600080fd5b506104a36105e5366004612e9c565b34801561072c57600080fd5b506103e7600c5481565b34801561074257600080fd5b506103e7610751366004612b80565b611347565b34801561076257600080fd5b506104a3611395565b34801561077757600080fd5b506104096113a7565b34801561078c57600080fd5b506104a361079b366004612ebe565b611435565b6104a36107ae366004612cfb565b611450565b3480156107bf57600080fd5b506008546001600160a01b0316610436565b3480156107dd57600080fd5b506104a36107ec366004612ba1565b61163b565b3480156107fd57600080fd5b506103e760185481565b34801561081357600080fd5b506104a3610822366004612f6d565b6116ae565b34801561083357600080fd5b506104a3610842366004612fc6565b6116c2565b34801561085357600080fd5b50610409611733565b34801561086857600080fd5b506103e7600d5481565b34801561087e57600080fd5b506104a361088d366004612ba1565b611742565b34801561089e57600080fd5b506104a36108ad366004612d30565b61174f565b3480156108be57600080fd5b50600e546105bd906001600160a01b031681565b3480156108de57600080fd5b506104a36108ed366004612ffb565b61179e565b3480156108fe57600080fd5b506103e761090d366004612ba1565b60009081526009602052604090205490565b6104a361092d36600461301c565b6117c8565b34801561093e57600080fd5b506103b161094d366004612b80565b60196020526000908152604090205460ff1681565b34801561096e57600080fd5b5061040961097d366004612ba1565b611812565b34801561098e57600080fd5b506109a261099d366004612ba1565b611923565b6040516103be92919061309a565b3480156109bc57600080fd5b506016546103b19060ff1681565b3480156109d657600080fd5b506103e76109e5366004612cfb565b611947565b3480156109f657600080fd5b506103b1610a053660046130ba565b611978565b348015610a1657600080fd5b506104a3610a25366004612b80565b6119a6565b348015610a3657600080fd5b506104a3610a45366004612ba1565b6119e0565b348015610a5657600080fd5b506104a3610a65366004612cfb565b6119ed565b348015610a7657600080fd5b506104a3610a85366004612b80565b611a6c565b348015610a9657600080fd5b506103e760175481565b60006001600160e01b031982166341fb5ca160e01b1480610ac55750610ac582611a96565b92915050565b6000610ad5611abb565b82518451148015610ae7575081518451145b610b0c5760405162461bcd60e51b8152600401610b0390613117565b60405180910390fd5b60005b8451811015610b8157610b6e858281518110610b2d57610b2d613127565b6020026020010151858381518110610b4757610b47613127565b6020026020010151858481518110610b6157610b61613127565b6020026020010151610ffd565b5080610b7981613153565b915050610b0f565b506001610b8d60005490565b610b97919061316c565b90505b9392505050565b606060028054610bb090613195565b80601f0160208091040260200160405190810160405280929190818152602001828054610bdc90613195565b8015610c295780601f10610bfe57610100808354040283529160200191610c29565b820191906000526020600020905b815481529060010190602001808311610c0c57829003601f168201915b5050505050905090565b6000610c3e82611ae5565b610c5b576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b60165460ff1680610ca057506001600160a01b03821660009081526019602052604090205460ff165b610cbc5760405162461bcd60e51b8152600401610b03906131ec565b610cc68282611b0c565b5050565b600060405162461bcd60e51b8152600401610b039061321b565b610cec611abb565b8051825114610d0d5760405162461bcd60e51b8152600401610b0390613117565b8151610d20906013906020850190612795565b50600060158190555b8251811015610dd157818181518110610d4457610d44613127565b602002602001015160146000858481518110610d6257610d62613127565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002081905550818181518110610da057610da0613127565b602002602001015160156000828254610db9919061322b565b90915550819050610dc981613153565b915050610d29565b505050565b6000610de182611bac565b9050836001600160a01b0316816001600160a01b031614610e145760405162a1148160e81b815260040160405180910390fd5b60008281526006602052604090208054338082146001600160a01b03881690911417610e6157610e448633611978565b610e6157604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516610e8857604051633a954ecd60e21b815260040160405180910390fd5b610e958686866001611c13565b8015610ea057600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040812091909155600160e11b84169003610f3257600184016000818152600460205260408120549003610f30576000548114610f305760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050505050565b610f83611abb565b601755565b60405162461bcd60e51b8152600401610b039061321b565b610fa8611abb565b6001600160a01b03919091166000908152601960205260409020805460ff1916911515919091179055565b60138181548110610fe357600080fd5b6000918252602090912001546001600160a01b0316905081565b6010546000906001600160a01b031633148061102357506008546001600160a01b031633145b61103f5760405162461bcd60e51b8152600401610b0390613261565b602f61104c606485613287565b111561106a5760405162461bcd60e51b8152600401610b03906132c4565b6110748483611c63565b60008261108060005490565b61108a919061316c565b905060005b8381101561112657600f546001600160a01b0316631b2ef1ca866110b3848661322b565b6040518363ffffffff1660e01b81526004016110d09291906132d4565b6020604051808303816000875af11580156110ef573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061111391906132fa565b508061111e81613153565b91505061108f565b50600161113260005490565b61113c919061316c565b95945050505050565b611150838383611c7d565b827f6b8e277b5ac199aea04139b79dce59b078ad22c9648f1bd3083495991809b770836040516111809190612b72565b60405180910390a2505050565b611195611abb565b61119e47611d62565b565b610dd1838383604051806020016040528060008152506117c8565b6111c3611abb565b601855565b60008181526011602090815260409182902080548351818402810184019094528084526060939283018282801561121e57602002820191906000526020600020905b81548152602001906001019080831161120a575b50505050509050919050565b60005b82518110156112a757600083828151811061124a5761124a613127565b60200260200101511180156112795750602f83828151811061126e5761126e613127565b602002602001015111155b6112955760405162461bcd60e51b8152600401610b039061334d565b8061129f81613153565b91505061122d565b506112b3836001611e0d565b600083815260116020908152604090912083516112d2928501906127fa565b506001600160a01b0381161561130a57600083815260126020526040902080546001600160a01b0319166001600160a01b0383161790555b827fc02d04215aef5676b10fa9457659d93003c9f8e4b6e36600757e93351ea663be838360405161118092919061335d565b6000610ac582611bac565b60006001600160a01b038216611370576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b61139d611abb565b61119e6000611e89565b600b80546113b490613195565b80601f01602080910402602001604051908101604052809291908181526020018280546113e090613195565b801561142d5780601f106114025761010080835404028352916020019161142d565b820191906000526020600020905b81548152906001019060200180831161141057829003601f168201915b505050505081565b61143d611abb565b6016805460ff1916911515919091179055565b6017543410156114725760405162461bcd60e51b8152600401610b03906133a5565b6000818152601260205260409020546001600160a01b031615806114ac57506000818152601260205260409020546001600160a01b031633145b6114c85760405162461bcd60e51b8152600401610b03906133e7565b600081815260116020526040902054156115d957600f5460405163957b3b2360e01b81526000916001600160a01b03169063957b3b239061150d908690600401612af4565b6020604051808303816000875af115801561152c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061155091906132fa565b90506000805b6000848152601160205260409020548110156115b857600084815260116020526040902080548290811061158c5761158c613127565b906000526020600020015483036115a657600191506115b8565b806115b081613153565b915050611556565b50806115d65760405162461bcd60e51b8152600401610b0390613429565b50505b6115e38282611edb565b6115ec34611f61565b81817fddecc862fea6282d99f164d7510d91c195d3e279c98fc7e31b9f81db472d80146116188461133c565b6116218661133c565b60405161162f929190613439565b60405180910390a35050565b611646816000611e0d565b6000818152601160205260409020606080519091611666916080906127fa565b5060008281526012602052604080822080546001600160a01b03191690555183917f28dad92e7cc5308a2998d22449801e54e49034de5d8586493e68e8a24ac2d41691a25050565b6116b6611abb565b600b610cc682826134ea565b6116cc83826119ed565b604051633c6fc81760e01b81526001600160a01b03831690633c6fc817906116fc903090879086906004016135a9565b600060405180830381600087803b15801561171657600080fd5b505af115801561172a573d6000803e3d6000fd5b50505050505050565b606060038054610bb090613195565b61174a611abb565b600d55565b60165460ff168061177857506001600160a01b03821660009081526019602052604090205460ff165b6117945760405162461bcd60e51b8152600401610b0390613611565b610cc68282611f6a565b6117a6611abb565b600e80546001600160a01b0319166001600160a01b0392909216919091179055565b6117d3848484610dd6565b6001600160a01b0383163b1561180c576117ef84848484611fcd565b61180c576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b606061181d60005490565b821061183b5760405162461bcd60e51b8152600401610b0390613647565b600f546040516371f9278160e11b815260009182916001600160a01b039091169063e3f24f0290611870908790600401612af4565b600060405180830381865afa15801561188d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526118b591908101906136af565b9092509050816118fa6118c7866120b9565b600b6118d2886120ea565b846040516020016118e694939291906137a9565b604051602081830303815290604052612160565b60405160200161190a9190613863565b6040516020818303038152906040529350505050919050565b606060005a905061193383611812565b91505a611940908261316c565b9050915091565b6011602052816000526040600020818154811061196357600080fd5b90600052602060002001600091509150505481565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b6119ae611abb565b6001600160a01b0381166119d45760405162461bcd60e51b8152600401610b03906138d8565b6119dd81611e89565b50565b6119e8611abb565b600c55565b336119f78361133c565b6001600160a01b031614611a1d5760405162461bcd60e51b8152600401610b0390613918565b600082815260096020526040908190208290555182907ff9317dc3bc6dda0e00e43855c2c30847aeafb8dcea9d2ce86e9ce7a83d549f0190611a60908490612af4565b60405180910390a25050565b611a74611abb565b601080546001600160a01b0319166001600160a01b0392909216919091179055565b60006001600160e01b0319821663700cc4ad60e11b1480610ac55750610ac5826122c4565b6008546001600160a01b0316331461119e5760405162461bcd60e51b8152600401610b0390613958565b6000805482108015610ac5575050600090815260046020526040902054600160e01b161590565b6000611b178261133c565b9050336001600160a01b03821614611b5057611b338133611978565b611b50576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b600081600054811015611bfa5760008181526004602052604081205490600160e01b82169003611bf8575b80600003610b9a575060001901600081815260046020526040902054611bd7565b505b604051636f96cda160e11b815260040160405180910390fd5b6000828152601160205260409020606080519091611c33916080906127fa565b50600083815260126020526040902080546001600160a01b0319169055611c5c85858585612312565b5050505050565b610cc682826040518060200160405280600081525061233d565b60008381526009602052604090205480611ca95760405162461bcd60e51b8152600401610b0390613991565b80341015611cc95760405162461bcd60e51b8152600401610b03906139c5565b6000611cd534846123a3565b90506000611ce3348761240f565b90506000611cf08761133c565b9050806001600160a01b0381166108fc84611d0b873461316c565b611d15919061316c565b6040518115909202916000818181858888f19350505050158015611d3d573d6000803e3d6000fd5b50600088815260096020526040812055611d5882888a612437565b5050505050505050565b60005b601354811015610cc657611dfb60138281548110611d8557611d85613127565b9060005260206000200160009054906101000a90046001600160a01b03166015546014600060138681548110611dbd57611dbd613127565b60009182526020808320909101546001600160a01b03168352820192909252604001902054611dec90866139d5565b611df691906139ec565b6124ac565b80611e0581613153565b915050611d65565b33611e178361133c565b6001600160a01b031614611e3d5760405162461bcd60e51b8152600401610b0390613a32565b6000828152600a602052604090819020805460ff19168315151790555182907f0931e6600146b3ef83884d0f5e5c304a68cbc6c0ebba0617323021751e9a791790611a60908490612897565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b33611ee58361133c565b6001600160a01b031614611f0b5760405162461bcd60e51b8152600401610b0390613a32565b6000818152600a602052604090205460ff161515600114611f3e5760405162461bcd60e51b8152600401610b0390613a74565b6000611f498261133c565b9050611f56338285612437565b610dd1813384612437565b6119dd81611d62565b3360008181526007602090815260408083206001600160a01b038716808552925291829020805460ff191685151517905590519091907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319061162f908590612897565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290612002903390899088908890600401613a84565b6020604051808303816000875af192505050801561203d575060408051601f3d908101601f1916820190925261203a91810190613ad3565b60015b61209b573d80801561206b576040519150601f19603f3d011682016040523d82523d6000602084013e612070565b606091505b508051600003612093576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b60606120c48261251f565b6040516020016120d49190613af4565b6040516020818303038152906040529050919050565b600e546040516379b92f2760e01b81526060916001600160a01b0316906379b92f279061211b908590600401612af4565b600060405180830381865afa158015612138573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610ac59190810190613b0f565b6060815160000361217f57505060408051602081019091526000815290565b6000604051806060016040528060408152602001613b7d60409139905060006003845160026121ae919061322b565b6121b891906139ec565b6121c39060046139d5565b905060006121d282602061322b565b6001600160401b038111156121e9576121e96128a5565b6040519080825280601f01601f191660200182016040528015612213576020820181803683370190505b509050818152600183018586518101602084015b8183101561227f576003830192508251603f8160121c168501518253600182019150603f81600c1c168501518253600182019150603f8160061c168501518253600182019150603f8116850151825350600101612227565b60038951066001811461229957600281146122aa576122b6565b613d3d60f01b6001198301526122b6565b603d60f81b6000198301525b509398975050505050505050565b60006301ffc9a760e01b6001600160e01b0319831614806122f557506380ac58cd60e01b6001600160e01b03198316145b80610ac55750506001600160e01b031916635b5e139f60e01b1490565b6000828152600a60209081526040808320805460ff19169055600990915281205561180c8484848484565b61234783836125b2565b6001600160a01b0383163b15610dd1576000548281035b6123716000868380600101945086611fcd565b61238e576040516368d2bf6b60e11b815260040160405180910390fd5b81811061235e578160005414611c5c57600080fd5b60006001600160a01b03821615610ac5576103e86123c28460196139d5565b6123cc91906139ec565b60405190915082906001600160a01b0382169083156108fc029084906000818181858888f19350505050158015612407573d6000803e3d6000fd5b505092915050565b60006127106018548461242291906139d5565b61242c91906139ec565b9050610ac581611d62565b600061244282611bac565b9050836001600160a01b0316816001600160a01b0316146124755760405162a1148160e81b815260040160405180910390fd5b600082815260066020526040902080546001600160a01b038516610e8857604051633a954ecd60e21b815260040160405180910390fd5b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146124f9576040519150601f19603f3d011682016040523d82523d6000602084013e6124fe565b606091505b5050905080610dd15760405162461bcd60e51b8152600401610b0390613b6c565b6060600061252c836126bd565b60010190506000816001600160401b0381111561254b5761254b6128a5565b6040519080825280601f01601f191660200182016040528015612575576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461257f575b509392505050565b60008054908290036125d75760405163b562e8dd60e01b815260040160405180910390fd5b6125e46000848385611c13565b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b178317905582840190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b81811461269357808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a460010161265b565b50816000036126b457604051622e076360e81b815260040160405180910390fd5b60005550505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106126fc5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310612728576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061274657662386f26fc10000830492506010015b6305f5e100831061275e576305f5e100830492506008015b612710831061277257612710830492506004015b60648310612784576064830492506002015b600a8310610ac55760010192915050565b8280548282559060005260206000209081019282156127ea579160200282015b828111156127ea57825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906127b5565b506127f6929150612835565b5090565b8280548282559060005260206000209081019282156127ea579160200282015b828111156127ea57825182559160200191906001019061281a565b5b808211156127f65760008155600101612836565b6001600160e01b031981165b81146119dd57600080fd5b8035610ac58161284a565b60006020828403121561288157612881600080fd5b60006120b18484612861565b8015155b82525050565b60208101610ac5828461288d565b634e487b7160e01b600052604160045260246000fd5b601f19601f83011681018181106001600160401b03821117156128e0576128e06128a5565b6040525050565b60006128f260405190565b90506128fe82826128bb565b919050565b60006001600160401b0382111561291c5761291c6128a5565b5060209081020190565b60006001600160a01b038216610ac5565b61285681612926565b8035610ac581612937565b600061295e61295984612903565b6128e7565b8381529050602080820190840283018581111561297d5761297d600080fd5b835b8181101561299f576129918782612940565b83526020928301920161297f565b5050509392505050565b600082601f8301126129bd576129bd600080fd5b81356120b184826020860161294b565b80612856565b8035610ac5816129cd565b60006129ec61295984612903565b83815290506020808201908402830185811115612a0b57612a0b600080fd5b835b8181101561299f57612a1f87826129d3565b835260209283019201612a0d565b600082601f830112612a4157612a41600080fd5b81356120b18482602086016129de565b600080600060608486031215612a6957612a69600080fd5b83356001600160401b03811115612a8257612a82600080fd5b612a8e868287016129a9565b93505060208401356001600160401b03811115612aad57612aad600080fd5b612ab986828701612a2d565b92505060408401356001600160401b03811115612ad857612ad8600080fd5b612ae486828701612a2d565b9150509250925092565b80612891565b60208101610ac58284612aee565b60005b83811015612b1d578181015183820152602001612b05565b50506000910152565b6000612b30825190565b808452602084019350612b47818560208601612b02565b601f01601f19169290920192915050565b60208082528101610b9a8184612b26565b61289181612926565b60208101610ac58284612b69565b600060208284031215612b9557612b95600080fd5b60006120b18484612940565b600060208284031215612bb657612bb6600080fd5b60006120b184846129d3565b60008060408385031215612bd857612bd8600080fd5b6000612be48585612940565b9250506020612bf5858286016129d3565b9150509250929050565b60008060408385031215612c1557612c15600080fd5b82356001600160401b03811115612c2e57612c2e600080fd5b612c3a858286016129a9565b92505060208301356001600160401b03811115612c5957612c59600080fd5b612bf585828601612a2d565b600080600060608486031215612c7d57612c7d600080fd5b6000612c898686612940565b9350506020612c9a86828701612940565b9250506040612ae4868287016129d3565b6000610ac56001600160a01b038316612cc2565b90565b6001600160a01b031690565b6000610ac582612cab565b6000610ac582612cce565b61289181612cd9565b60208101610ac58284612ce4565b60008060408385031215612d1157612d11600080fd5b6000612be485856129d3565b801515612856565b8035610ac581612d1d565b60008060408385031215612d4657612d46600080fd5b6000612d528585612940565b9250506020612bf585828601612d25565b600080600060608486031215612d7b57612d7b600080fd5b6000612d878686612940565b9350506020612c9a868287016129d3565b600080600060608486031215612db057612db0600080fd5b6000612dbc86866129d3565b9350506020612dcd86828701612940565b9250506040612ae486828701612940565b612de88282612aee565b5060200190565b60200190565b6000612dff825190565b808452602093840193830160005b82811015612e32578151612e218782612dde565b965050602082019150600101612e0d565b5093949350505050565b60208082528101610b9a8184612df5565b600080600060608486031215612e6557612e65600080fd5b6000612e7186866129d3565b93505060208401356001600160401b03811115612e9057612e90600080fd5b612dcd86828701612a2d565b60008060408385031215612eb257612eb2600080fd5b6000612d5285856129d3565b600060208284031215612ed357612ed3600080fd5b60006120b18484612d25565b60006001600160401b03821115612ef857612ef86128a5565b601f19601f83011660200192915050565b82818337506000910152565b6000612f2361295984612edf565b905082815260208101848484011115612f3e57612f3e600080fd5b6125aa848285612f09565b600082601f830112612f5d57612f5d600080fd5b81356120b1848260208601612f15565b600060208284031215612f8257612f82600080fd5b81356001600160401b03811115612f9b57612f9b600080fd5b6120b184828501612f49565b6000610ac582612926565b61285681612fa7565b8035610ac581612fb2565b600080600060608486031215612fde57612fde600080fd5b6000612fea86866129d3565b9350506020612c9a86828701612fbb565b60006020828403121561301057613010600080fd5b60006120b18484612fbb565b6000806000806080858703121561303557613035600080fd5b60006130418787612940565b945050602061305287828801612940565b9350506040613063878288016129d3565b92505060608501356001600160401b0381111561308257613082600080fd5b61308e87828801612f49565b91505092959194509250565b604080825281016130ab8185612b26565b9050610b9a6020830184612aee565b600080604083850312156130d0576130d0600080fd5b60006130dc8585612940565b9250506020612bf585828601612940565b601581526020810174092dcecc2d8d2c84082e4e4c2f2e640d8cadccee8d605b1b81529050612def565b60208082528101610ac5816130ed565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016131655761316561313d565b5060010190565b81810381811115610ac557610ac561313d565b634e487b7160e01b600052602260045260246000fd5b6002810460018216806131a957607f821691505b6020821081036131bb576131bb61317f565b50919050565b6016815260208101754e6f7420616c6c6f77656420746f20617070726f766560501b81529050612def565b60208082528101610ac5816131c1565b600a8152602081016943616e6e6f742075736560b01b81529050612def565b60208082528101610ac5816131fc565b80820180821115610ac557610ac561313d565b600e8152602081016d24b73b30b634b21039b2b73232b960911b81529050612def565b60208082528101610ac58161323e565b634e487b7160e01b600052601260045260246000fd5b60008261329657613296613271565b500690565b601481526020810173125b9d985b1a59081c1c99599958dd1d5c99525960621b81529050612def565b60208082528101610ac58161329b565b604081016132e28285612aee565b610b9a6020830184612aee565b8051610ac5816129cd565b60006020828403121561330f5761330f600080fd5b60006120b184846132ef565b60178152602081017f696e636f7272656374207072656665637574726520696400000000000000000081529050612def565b60208082528101610ac58161331b565b6040808252810161336e8185612df5565b9050610b9a6020830184612b69565b601381526020810172496e73756666696369616c20726f79616c747960681b81529050612def565b60208082528101610ac58161337d565b60198152602081017f4c696d6974656420616464726573732063616e2074726164650000000000000081529050612def565b60208082528101610ac5816133b5565b60198152602081017f756e6d6174636820746f207468652077616e7473206c6973740000000000000081529050612def565b60208082528101610ac5816133f7565b604081016134478285612b69565b610b9a6020830184612b69565b6000610ac5612cbf8381565b61346983613454565b81546008840282811b60001990911b908116901990911617825550505050565b6000610dd1818484613460565b81811015610cc6576134a9600082613489565b600101613496565b601f821115610dd1576000818152602090206020601f850104810160208510156134d85750805b611c5c6020601f860104830182613496565b81516001600160401b03811115613503576135036128a5565b61350d8254613195565b6135188282856134b1565b506020601f82116001811461354d57600083156135355750848201515b600019600885021c1981166002850217855550611c5c565b600084815260208120601f198516915b8281101561357d578785015182556020948501946001909201910161355d565b508482101561359a5783870151600019601f87166008021c191681555b50505050600202600101905550565b606081016135b78286612ce4565b6135c46020830185612aee565b6120b16040830184612aee565b60238152602081017f4e6f7420616c6c6f77656420746f2073657420617070726f76616c20666f7220815262185b1b60ea1b602082015290505b60400190565b60208082528101610ac5816135d1565b6011815260208101703737b732bc34b9ba32b73a103a37b5b2b760791b81529050612def565b60208082528101610ac581613621565b600061366561295984612edf565b90508281526020810184848401111561368057613680600080fd5b6125aa848285612b02565b600082601f83011261369f5761369f600080fd5b81516120b1848260208601613657565b600080604083850312156136c5576136c5600080fd5b82516001600160401b038111156136de576136de600080fd5b6136ea8582860161368b565b92505060208301516001600160401b0381111561370957613709600080fd5b612bf58582860161368b565b600061371f825190565b61372d818560208601612b02565b9290920192915050565b6000815461374481613195565b60018216801561375b5760018114613770576137a0565b60ff19831686528115158202860193506137a0565b60008581526020902060005b838110156137985781548882015260019091019060200161377c565b505081860193505b50505092915050565b683d913730b6b2911d1160b91b81526009016137c58186613715565b701116113232b9b1b934b83a34b7b7111d1160791b815260110190506137eb8185613737565b6f222c2261747472696275746573223a5b60801b815260100190506138108184613715565b7f5d2c22696d616765223a22646174613a696d6167652f7376672b786d6c3b62618152641cd94d8d0b60da1b602082015260250190506138508183613715565b61227d60f01b815290506002810161113c565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000008152601d81015b9050610ac58183613715565b60268152602081017f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181526564647265737360d01b6020820152905061360b565b60208082528101610ac581613897565b60208082527f4f6e6c7920746865206f6e7765722063616e20736574207468652070726963659101908152612def565b60208082528101610ac5816138e8565b60208082527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65729101908152612def565b60208082528101610ac581613928565b601481526020810173546f6b656e206973206e6f74206f6e2073616c6560601b81529050612def565b60208082528101610ac581613968565b600f8152602081016e139bdd08195b9bdd59da08199d5b99608a1b81529050612def565b60208082528101610ac5816139a1565b8181028115828204841417610ac557610ac561313d565b6000826139fb576139fb613271565b500490565b60188152602081017f4f6e6c7920746865206f6e7765722063616e207472616465000000000000000081529050612def565b60208082528101610ac581613a00565b601d8152602081017f546172676574546f6b656e4964206973206e6f74206f6e20747261646500000081529050612def565b60208082528101610ac581613a42565b60808101613a928287612b69565b613a9f6020830186612b69565b613aac6040830185612aee565b8181036060830152613abe8184612b26565b9695505050505050565b8051610ac58161284a565b600060208284031215613ae857613ae8600080fd5b60006120b18484613ac8565b6b02637b1b0b6102737bab739960a51b8152600c810161388b565b600060208284031215613b2457613b24600080fd5b81516001600160401b03811115613b3d57613b3d600080fd5b6120b18482850161368b565b600e8152602081016d11985a5b1959081d1bc81cd95b9960921b81529050612def565b60208082528101610ac581613b4956fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa2646970667358221220c28ba246d4801dfd371d57e87ae46783f4b344443a5253c5f07910e32cfa0c5e64736f6c63430008110033000000000000000000000000b1b709a43446ce2045125b4f1e7d2e9ec5317397000000000000000000000000a0b9d89f6d17658eaa71fc0b916fccb248340382
Deployed Bytecode
0x60806040526004361061038c5760003560e01c806370a08231116101dc578063a370f7d711610102578063dc49f204116100a0578063f4a0a5281161006f578063f4a0a52814610a2a578063fba49e4f14610a4a578063fca3b5aa14610a6a578063ff7047aa14610a8a57600080fd5b8063dc49f204146109b0578063e4f71a00146109ca578063e985e9c5146109ea578063f2fde38b14610a0a57600080fd5b8063b88d4fde116100dc578063b88d4fde1461091f578063c669df6d14610932578063c87b56dd14610962578063cc44ab411461098257600080fd5b8063a370f7d7146108b2578063b212cfc7146108d2578063b54b4fb9146108f257600080fd5b80639048ec0a1161017a57806396178c201161014957806396178c2014610525578063996517cf1461085c5780639e6a1d7d14610872578063a22cb4651461089257600080fd5b80639048ec0a146107f157806390c3f38f146108075780639589d7b91461082757806395d89b411461084757600080fd5b80637e4f8669116101b65780637e4f8669146107805780638c402078146107a05780638da5cb5b146107b35780638dac5864146107d157600080fd5b806370a0823114610736578063715018a6146107565780637284e4161461076b57600080fd5b806323c563ab116102c15780633ccfd60b1161025f5780635975814e1161022e5780635975814e146106c55780636352211e146106e557806367008d77146107055780636817c76c1461072057600080fd5b80633ccfd60b1461065d57806342842e0e14610665578063476bf00d146106785780634d1317571461069857600080fd5b80632dbdaf6e1161029b5780632dbdaf6e146105ea57806335a05ad51461060a57806337fbf5781461062a5780633b7f8f151461064a57600080fd5b806323c563ab1461057d57806326df5b351461059d57806326fbd1d6146105ca57600080fd5b806311d7ef261161032e578063163999a611610308578063163999a61461050557806318160ddd146105255780631e6c598e1461053a57806323b872dd1461056a57600080fd5b806311d7ef26146104a55780631249c58b146104db5780631346d8ea146104e357600080fd5b8063075461721161036a578063075461721461041657806307f0bac114610443578063081812fc14610470578063095ea7b31461049057600080fd5b806301ffc9a71461039157806305503088146103c757806306fdde03146103f4575b600080fd5b34801561039d57600080fd5b506103b16103ac36600461286c565b610aa0565b6040516103be9190612897565b60405180910390f35b3480156103d357600080fd5b506103e76103e2366004612a51565b610acb565b6040516103be9190612af4565b34801561040057600080fd5b50610409610ba1565b6040516103be9190612b58565b34801561042257600080fd5b50601054610436906001600160a01b031681565b6040516103be9190612b72565b34801561044f57600080fd5b506103e761045e366004612b80565b60146020526000908152604090205481565b34801561047c57600080fd5b5061043661048b366004612ba1565b610c33565b6104a361049e366004612bc2565b610c77565b005b3480156104b157600080fd5b506104366104c0366004612ba1565b6012602052600090815260409020546001600160a01b031681565b6103e7610cca565b3480156104ef57600080fd5b506103e76104fe366004612b80565b50600c5490565b34801561051157600080fd5b506104a3610520366004612bff565b610ce4565b34801561053157600080fd5b506000546103e7565b34801561054657600080fd5b506103b1610555366004612ba1565b600a6020526000908152604090205460ff1681565b6104a3610578366004612c65565b610dd6565b34801561058957600080fd5b506104a3610598366004612ba1565b610f7b565b3480156105a957600080fd5b50600f546105bd906001600160a01b031681565b6040516103be9190612ced565b3480156105d657600080fd5b506104a36105e5366004612cfb565b610f88565b3480156105f657600080fd5b506104a3610605366004612d30565b610fa0565b34801561061657600080fd5b50610436610625366004612ba1565b610fd3565b34801561063657600080fd5b506103e7610645366004612d63565b610ffd565b6104a3610658366004612d98565b611145565b6104a361118d565b6104a3610673366004612c65565b6111a0565b34801561068457600080fd5b506104a3610693366004612ba1565b6111bb565b3480156106a457600080fd5b506106b86106b3366004612ba1565b6111c8565b6040516103be9190612e3c565b3480156106d157600080fd5b506104a36106e0366004612e4d565b61122a565b3480156106f157600080fd5b50610436610700366004612ba1565b61133c565b34801561071157600080fd5b506104a36105e5366004612e9c565b34801561072c57600080fd5b506103e7600c5481565b34801561074257600080fd5b506103e7610751366004612b80565b611347565b34801561076257600080fd5b506104a3611395565b34801561077757600080fd5b506104096113a7565b34801561078c57600080fd5b506104a361079b366004612ebe565b611435565b6104a36107ae366004612cfb565b611450565b3480156107bf57600080fd5b506008546001600160a01b0316610436565b3480156107dd57600080fd5b506104a36107ec366004612ba1565b61163b565b3480156107fd57600080fd5b506103e760185481565b34801561081357600080fd5b506104a3610822366004612f6d565b6116ae565b34801561083357600080fd5b506104a3610842366004612fc6565b6116c2565b34801561085357600080fd5b50610409611733565b34801561086857600080fd5b506103e7600d5481565b34801561087e57600080fd5b506104a361088d366004612ba1565b611742565b34801561089e57600080fd5b506104a36108ad366004612d30565b61174f565b3480156108be57600080fd5b50600e546105bd906001600160a01b031681565b3480156108de57600080fd5b506104a36108ed366004612ffb565b61179e565b3480156108fe57600080fd5b506103e761090d366004612ba1565b60009081526009602052604090205490565b6104a361092d36600461301c565b6117c8565b34801561093e57600080fd5b506103b161094d366004612b80565b60196020526000908152604090205460ff1681565b34801561096e57600080fd5b5061040961097d366004612ba1565b611812565b34801561098e57600080fd5b506109a261099d366004612ba1565b611923565b6040516103be92919061309a565b3480156109bc57600080fd5b506016546103b19060ff1681565b3480156109d657600080fd5b506103e76109e5366004612cfb565b611947565b3480156109f657600080fd5b506103b1610a053660046130ba565b611978565b348015610a1657600080fd5b506104a3610a25366004612b80565b6119a6565b348015610a3657600080fd5b506104a3610a45366004612ba1565b6119e0565b348015610a5657600080fd5b506104a3610a65366004612cfb565b6119ed565b348015610a7657600080fd5b506104a3610a85366004612b80565b611a6c565b348015610a9657600080fd5b506103e760175481565b60006001600160e01b031982166341fb5ca160e01b1480610ac55750610ac582611a96565b92915050565b6000610ad5611abb565b82518451148015610ae7575081518451145b610b0c5760405162461bcd60e51b8152600401610b0390613117565b60405180910390fd5b60005b8451811015610b8157610b6e858281518110610b2d57610b2d613127565b6020026020010151858381518110610b4757610b47613127565b6020026020010151858481518110610b6157610b61613127565b6020026020010151610ffd565b5080610b7981613153565b915050610b0f565b506001610b8d60005490565b610b97919061316c565b90505b9392505050565b606060028054610bb090613195565b80601f0160208091040260200160405190810160405280929190818152602001828054610bdc90613195565b8015610c295780601f10610bfe57610100808354040283529160200191610c29565b820191906000526020600020905b815481529060010190602001808311610c0c57829003601f168201915b5050505050905090565b6000610c3e82611ae5565b610c5b576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b60165460ff1680610ca057506001600160a01b03821660009081526019602052604090205460ff165b610cbc5760405162461bcd60e51b8152600401610b03906131ec565b610cc68282611b0c565b5050565b600060405162461bcd60e51b8152600401610b039061321b565b610cec611abb565b8051825114610d0d5760405162461bcd60e51b8152600401610b0390613117565b8151610d20906013906020850190612795565b50600060158190555b8251811015610dd157818181518110610d4457610d44613127565b602002602001015160146000858481518110610d6257610d62613127565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002081905550818181518110610da057610da0613127565b602002602001015160156000828254610db9919061322b565b90915550819050610dc981613153565b915050610d29565b505050565b6000610de182611bac565b9050836001600160a01b0316816001600160a01b031614610e145760405162a1148160e81b815260040160405180910390fd5b60008281526006602052604090208054338082146001600160a01b03881690911417610e6157610e448633611978565b610e6157604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516610e8857604051633a954ecd60e21b815260040160405180910390fd5b610e958686866001611c13565b8015610ea057600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040812091909155600160e11b84169003610f3257600184016000818152600460205260408120549003610f30576000548114610f305760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050505050565b610f83611abb565b601755565b60405162461bcd60e51b8152600401610b039061321b565b610fa8611abb565b6001600160a01b03919091166000908152601960205260409020805460ff1916911515919091179055565b60138181548110610fe357600080fd5b6000918252602090912001546001600160a01b0316905081565b6010546000906001600160a01b031633148061102357506008546001600160a01b031633145b61103f5760405162461bcd60e51b8152600401610b0390613261565b602f61104c606485613287565b111561106a5760405162461bcd60e51b8152600401610b03906132c4565b6110748483611c63565b60008261108060005490565b61108a919061316c565b905060005b8381101561112657600f546001600160a01b0316631b2ef1ca866110b3848661322b565b6040518363ffffffff1660e01b81526004016110d09291906132d4565b6020604051808303816000875af11580156110ef573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061111391906132fa565b508061111e81613153565b91505061108f565b50600161113260005490565b61113c919061316c565b95945050505050565b611150838383611c7d565b827f6b8e277b5ac199aea04139b79dce59b078ad22c9648f1bd3083495991809b770836040516111809190612b72565b60405180910390a2505050565b611195611abb565b61119e47611d62565b565b610dd1838383604051806020016040528060008152506117c8565b6111c3611abb565b601855565b60008181526011602090815260409182902080548351818402810184019094528084526060939283018282801561121e57602002820191906000526020600020905b81548152602001906001019080831161120a575b50505050509050919050565b60005b82518110156112a757600083828151811061124a5761124a613127565b60200260200101511180156112795750602f83828151811061126e5761126e613127565b602002602001015111155b6112955760405162461bcd60e51b8152600401610b039061334d565b8061129f81613153565b91505061122d565b506112b3836001611e0d565b600083815260116020908152604090912083516112d2928501906127fa565b506001600160a01b0381161561130a57600083815260126020526040902080546001600160a01b0319166001600160a01b0383161790555b827fc02d04215aef5676b10fa9457659d93003c9f8e4b6e36600757e93351ea663be838360405161118092919061335d565b6000610ac582611bac565b60006001600160a01b038216611370576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b61139d611abb565b61119e6000611e89565b600b80546113b490613195565b80601f01602080910402602001604051908101604052809291908181526020018280546113e090613195565b801561142d5780601f106114025761010080835404028352916020019161142d565b820191906000526020600020905b81548152906001019060200180831161141057829003601f168201915b505050505081565b61143d611abb565b6016805460ff1916911515919091179055565b6017543410156114725760405162461bcd60e51b8152600401610b03906133a5565b6000818152601260205260409020546001600160a01b031615806114ac57506000818152601260205260409020546001600160a01b031633145b6114c85760405162461bcd60e51b8152600401610b03906133e7565b600081815260116020526040902054156115d957600f5460405163957b3b2360e01b81526000916001600160a01b03169063957b3b239061150d908690600401612af4565b6020604051808303816000875af115801561152c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061155091906132fa565b90506000805b6000848152601160205260409020548110156115b857600084815260116020526040902080548290811061158c5761158c613127565b906000526020600020015483036115a657600191506115b8565b806115b081613153565b915050611556565b50806115d65760405162461bcd60e51b8152600401610b0390613429565b50505b6115e38282611edb565b6115ec34611f61565b81817fddecc862fea6282d99f164d7510d91c195d3e279c98fc7e31b9f81db472d80146116188461133c565b6116218661133c565b60405161162f929190613439565b60405180910390a35050565b611646816000611e0d565b6000818152601160205260409020606080519091611666916080906127fa565b5060008281526012602052604080822080546001600160a01b03191690555183917f28dad92e7cc5308a2998d22449801e54e49034de5d8586493e68e8a24ac2d41691a25050565b6116b6611abb565b600b610cc682826134ea565b6116cc83826119ed565b604051633c6fc81760e01b81526001600160a01b03831690633c6fc817906116fc903090879086906004016135a9565b600060405180830381600087803b15801561171657600080fd5b505af115801561172a573d6000803e3d6000fd5b50505050505050565b606060038054610bb090613195565b61174a611abb565b600d55565b60165460ff168061177857506001600160a01b03821660009081526019602052604090205460ff165b6117945760405162461bcd60e51b8152600401610b0390613611565b610cc68282611f6a565b6117a6611abb565b600e80546001600160a01b0319166001600160a01b0392909216919091179055565b6117d3848484610dd6565b6001600160a01b0383163b1561180c576117ef84848484611fcd565b61180c576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b606061181d60005490565b821061183b5760405162461bcd60e51b8152600401610b0390613647565b600f546040516371f9278160e11b815260009182916001600160a01b039091169063e3f24f0290611870908790600401612af4565b600060405180830381865afa15801561188d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526118b591908101906136af565b9092509050816118fa6118c7866120b9565b600b6118d2886120ea565b846040516020016118e694939291906137a9565b604051602081830303815290604052612160565b60405160200161190a9190613863565b6040516020818303038152906040529350505050919050565b606060005a905061193383611812565b91505a611940908261316c565b9050915091565b6011602052816000526040600020818154811061196357600080fd5b90600052602060002001600091509150505481565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b6119ae611abb565b6001600160a01b0381166119d45760405162461bcd60e51b8152600401610b03906138d8565b6119dd81611e89565b50565b6119e8611abb565b600c55565b336119f78361133c565b6001600160a01b031614611a1d5760405162461bcd60e51b8152600401610b0390613918565b600082815260096020526040908190208290555182907ff9317dc3bc6dda0e00e43855c2c30847aeafb8dcea9d2ce86e9ce7a83d549f0190611a60908490612af4565b60405180910390a25050565b611a74611abb565b601080546001600160a01b0319166001600160a01b0392909216919091179055565b60006001600160e01b0319821663700cc4ad60e11b1480610ac55750610ac5826122c4565b6008546001600160a01b0316331461119e5760405162461bcd60e51b8152600401610b0390613958565b6000805482108015610ac5575050600090815260046020526040902054600160e01b161590565b6000611b178261133c565b9050336001600160a01b03821614611b5057611b338133611978565b611b50576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b600081600054811015611bfa5760008181526004602052604081205490600160e01b82169003611bf8575b80600003610b9a575060001901600081815260046020526040902054611bd7565b505b604051636f96cda160e11b815260040160405180910390fd5b6000828152601160205260409020606080519091611c33916080906127fa565b50600083815260126020526040902080546001600160a01b0319169055611c5c85858585612312565b5050505050565b610cc682826040518060200160405280600081525061233d565b60008381526009602052604090205480611ca95760405162461bcd60e51b8152600401610b0390613991565b80341015611cc95760405162461bcd60e51b8152600401610b03906139c5565b6000611cd534846123a3565b90506000611ce3348761240f565b90506000611cf08761133c565b9050806001600160a01b0381166108fc84611d0b873461316c565b611d15919061316c565b6040518115909202916000818181858888f19350505050158015611d3d573d6000803e3d6000fd5b50600088815260096020526040812055611d5882888a612437565b5050505050505050565b60005b601354811015610cc657611dfb60138281548110611d8557611d85613127565b9060005260206000200160009054906101000a90046001600160a01b03166015546014600060138681548110611dbd57611dbd613127565b60009182526020808320909101546001600160a01b03168352820192909252604001902054611dec90866139d5565b611df691906139ec565b6124ac565b80611e0581613153565b915050611d65565b33611e178361133c565b6001600160a01b031614611e3d5760405162461bcd60e51b8152600401610b0390613a32565b6000828152600a602052604090819020805460ff19168315151790555182907f0931e6600146b3ef83884d0f5e5c304a68cbc6c0ebba0617323021751e9a791790611a60908490612897565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b33611ee58361133c565b6001600160a01b031614611f0b5760405162461bcd60e51b8152600401610b0390613a32565b6000818152600a602052604090205460ff161515600114611f3e5760405162461bcd60e51b8152600401610b0390613a74565b6000611f498261133c565b9050611f56338285612437565b610dd1813384612437565b6119dd81611d62565b3360008181526007602090815260408083206001600160a01b038716808552925291829020805460ff191685151517905590519091907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319061162f908590612897565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290612002903390899088908890600401613a84565b6020604051808303816000875af192505050801561203d575060408051601f3d908101601f1916820190925261203a91810190613ad3565b60015b61209b573d80801561206b576040519150601f19603f3d011682016040523d82523d6000602084013e612070565b606091505b508051600003612093576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b60606120c48261251f565b6040516020016120d49190613af4565b6040516020818303038152906040529050919050565b600e546040516379b92f2760e01b81526060916001600160a01b0316906379b92f279061211b908590600401612af4565b600060405180830381865afa158015612138573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610ac59190810190613b0f565b6060815160000361217f57505060408051602081019091526000815290565b6000604051806060016040528060408152602001613b7d60409139905060006003845160026121ae919061322b565b6121b891906139ec565b6121c39060046139d5565b905060006121d282602061322b565b6001600160401b038111156121e9576121e96128a5565b6040519080825280601f01601f191660200182016040528015612213576020820181803683370190505b509050818152600183018586518101602084015b8183101561227f576003830192508251603f8160121c168501518253600182019150603f81600c1c168501518253600182019150603f8160061c168501518253600182019150603f8116850151825350600101612227565b60038951066001811461229957600281146122aa576122b6565b613d3d60f01b6001198301526122b6565b603d60f81b6000198301525b509398975050505050505050565b60006301ffc9a760e01b6001600160e01b0319831614806122f557506380ac58cd60e01b6001600160e01b03198316145b80610ac55750506001600160e01b031916635b5e139f60e01b1490565b6000828152600a60209081526040808320805460ff19169055600990915281205561180c8484848484565b61234783836125b2565b6001600160a01b0383163b15610dd1576000548281035b6123716000868380600101945086611fcd565b61238e576040516368d2bf6b60e11b815260040160405180910390fd5b81811061235e578160005414611c5c57600080fd5b60006001600160a01b03821615610ac5576103e86123c28460196139d5565b6123cc91906139ec565b60405190915082906001600160a01b0382169083156108fc029084906000818181858888f19350505050158015612407573d6000803e3d6000fd5b505092915050565b60006127106018548461242291906139d5565b61242c91906139ec565b9050610ac581611d62565b600061244282611bac565b9050836001600160a01b0316816001600160a01b0316146124755760405162a1148160e81b815260040160405180910390fd5b600082815260066020526040902080546001600160a01b038516610e8857604051633a954ecd60e21b815260040160405180910390fd5b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146124f9576040519150601f19603f3d011682016040523d82523d6000602084013e6124fe565b606091505b5050905080610dd15760405162461bcd60e51b8152600401610b0390613b6c565b6060600061252c836126bd565b60010190506000816001600160401b0381111561254b5761254b6128a5565b6040519080825280601f01601f191660200182016040528015612575576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461257f575b509392505050565b60008054908290036125d75760405163b562e8dd60e01b815260040160405180910390fd5b6125e46000848385611c13565b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b178317905582840190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b81811461269357808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a460010161265b565b50816000036126b457604051622e076360e81b815260040160405180910390fd5b60005550505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106126fc5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310612728576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061274657662386f26fc10000830492506010015b6305f5e100831061275e576305f5e100830492506008015b612710831061277257612710830492506004015b60648310612784576064830492506002015b600a8310610ac55760010192915050565b8280548282559060005260206000209081019282156127ea579160200282015b828111156127ea57825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906127b5565b506127f6929150612835565b5090565b8280548282559060005260206000209081019282156127ea579160200282015b828111156127ea57825182559160200191906001019061281a565b5b808211156127f65760008155600101612836565b6001600160e01b031981165b81146119dd57600080fd5b8035610ac58161284a565b60006020828403121561288157612881600080fd5b60006120b18484612861565b8015155b82525050565b60208101610ac5828461288d565b634e487b7160e01b600052604160045260246000fd5b601f19601f83011681018181106001600160401b03821117156128e0576128e06128a5565b6040525050565b60006128f260405190565b90506128fe82826128bb565b919050565b60006001600160401b0382111561291c5761291c6128a5565b5060209081020190565b60006001600160a01b038216610ac5565b61285681612926565b8035610ac581612937565b600061295e61295984612903565b6128e7565b8381529050602080820190840283018581111561297d5761297d600080fd5b835b8181101561299f576129918782612940565b83526020928301920161297f565b5050509392505050565b600082601f8301126129bd576129bd600080fd5b81356120b184826020860161294b565b80612856565b8035610ac5816129cd565b60006129ec61295984612903565b83815290506020808201908402830185811115612a0b57612a0b600080fd5b835b8181101561299f57612a1f87826129d3565b835260209283019201612a0d565b600082601f830112612a4157612a41600080fd5b81356120b18482602086016129de565b600080600060608486031215612a6957612a69600080fd5b83356001600160401b03811115612a8257612a82600080fd5b612a8e868287016129a9565b93505060208401356001600160401b03811115612aad57612aad600080fd5b612ab986828701612a2d565b92505060408401356001600160401b03811115612ad857612ad8600080fd5b612ae486828701612a2d565b9150509250925092565b80612891565b60208101610ac58284612aee565b60005b83811015612b1d578181015183820152602001612b05565b50506000910152565b6000612b30825190565b808452602084019350612b47818560208601612b02565b601f01601f19169290920192915050565b60208082528101610b9a8184612b26565b61289181612926565b60208101610ac58284612b69565b600060208284031215612b9557612b95600080fd5b60006120b18484612940565b600060208284031215612bb657612bb6600080fd5b60006120b184846129d3565b60008060408385031215612bd857612bd8600080fd5b6000612be48585612940565b9250506020612bf5858286016129d3565b9150509250929050565b60008060408385031215612c1557612c15600080fd5b82356001600160401b03811115612c2e57612c2e600080fd5b612c3a858286016129a9565b92505060208301356001600160401b03811115612c5957612c59600080fd5b612bf585828601612a2d565b600080600060608486031215612c7d57612c7d600080fd5b6000612c898686612940565b9350506020612c9a86828701612940565b9250506040612ae4868287016129d3565b6000610ac56001600160a01b038316612cc2565b90565b6001600160a01b031690565b6000610ac582612cab565b6000610ac582612cce565b61289181612cd9565b60208101610ac58284612ce4565b60008060408385031215612d1157612d11600080fd5b6000612be485856129d3565b801515612856565b8035610ac581612d1d565b60008060408385031215612d4657612d46600080fd5b6000612d528585612940565b9250506020612bf585828601612d25565b600080600060608486031215612d7b57612d7b600080fd5b6000612d878686612940565b9350506020612c9a868287016129d3565b600080600060608486031215612db057612db0600080fd5b6000612dbc86866129d3565b9350506020612dcd86828701612940565b9250506040612ae486828701612940565b612de88282612aee565b5060200190565b60200190565b6000612dff825190565b808452602093840193830160005b82811015612e32578151612e218782612dde565b965050602082019150600101612e0d565b5093949350505050565b60208082528101610b9a8184612df5565b600080600060608486031215612e6557612e65600080fd5b6000612e7186866129d3565b93505060208401356001600160401b03811115612e9057612e90600080fd5b612dcd86828701612a2d565b60008060408385031215612eb257612eb2600080fd5b6000612d5285856129d3565b600060208284031215612ed357612ed3600080fd5b60006120b18484612d25565b60006001600160401b03821115612ef857612ef86128a5565b601f19601f83011660200192915050565b82818337506000910152565b6000612f2361295984612edf565b905082815260208101848484011115612f3e57612f3e600080fd5b6125aa848285612f09565b600082601f830112612f5d57612f5d600080fd5b81356120b1848260208601612f15565b600060208284031215612f8257612f82600080fd5b81356001600160401b03811115612f9b57612f9b600080fd5b6120b184828501612f49565b6000610ac582612926565b61285681612fa7565b8035610ac581612fb2565b600080600060608486031215612fde57612fde600080fd5b6000612fea86866129d3565b9350506020612c9a86828701612fbb565b60006020828403121561301057613010600080fd5b60006120b18484612fbb565b6000806000806080858703121561303557613035600080fd5b60006130418787612940565b945050602061305287828801612940565b9350506040613063878288016129d3565b92505060608501356001600160401b0381111561308257613082600080fd5b61308e87828801612f49565b91505092959194509250565b604080825281016130ab8185612b26565b9050610b9a6020830184612aee565b600080604083850312156130d0576130d0600080fd5b60006130dc8585612940565b9250506020612bf585828601612940565b601581526020810174092dcecc2d8d2c84082e4e4c2f2e640d8cadccee8d605b1b81529050612def565b60208082528101610ac5816130ed565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016131655761316561313d565b5060010190565b81810381811115610ac557610ac561313d565b634e487b7160e01b600052602260045260246000fd5b6002810460018216806131a957607f821691505b6020821081036131bb576131bb61317f565b50919050565b6016815260208101754e6f7420616c6c6f77656420746f20617070726f766560501b81529050612def565b60208082528101610ac5816131c1565b600a8152602081016943616e6e6f742075736560b01b81529050612def565b60208082528101610ac5816131fc565b80820180821115610ac557610ac561313d565b600e8152602081016d24b73b30b634b21039b2b73232b960911b81529050612def565b60208082528101610ac58161323e565b634e487b7160e01b600052601260045260246000fd5b60008261329657613296613271565b500690565b601481526020810173125b9d985b1a59081c1c99599958dd1d5c99525960621b81529050612def565b60208082528101610ac58161329b565b604081016132e28285612aee565b610b9a6020830184612aee565b8051610ac5816129cd565b60006020828403121561330f5761330f600080fd5b60006120b184846132ef565b60178152602081017f696e636f7272656374207072656665637574726520696400000000000000000081529050612def565b60208082528101610ac58161331b565b6040808252810161336e8185612df5565b9050610b9a6020830184612b69565b601381526020810172496e73756666696369616c20726f79616c747960681b81529050612def565b60208082528101610ac58161337d565b60198152602081017f4c696d6974656420616464726573732063616e2074726164650000000000000081529050612def565b60208082528101610ac5816133b5565b60198152602081017f756e6d6174636820746f207468652077616e7473206c6973740000000000000081529050612def565b60208082528101610ac5816133f7565b604081016134478285612b69565b610b9a6020830184612b69565b6000610ac5612cbf8381565b61346983613454565b81546008840282811b60001990911b908116901990911617825550505050565b6000610dd1818484613460565b81811015610cc6576134a9600082613489565b600101613496565b601f821115610dd1576000818152602090206020601f850104810160208510156134d85750805b611c5c6020601f860104830182613496565b81516001600160401b03811115613503576135036128a5565b61350d8254613195565b6135188282856134b1565b506020601f82116001811461354d57600083156135355750848201515b600019600885021c1981166002850217855550611c5c565b600084815260208120601f198516915b8281101561357d578785015182556020948501946001909201910161355d565b508482101561359a5783870151600019601f87166008021c191681555b50505050600202600101905550565b606081016135b78286612ce4565b6135c46020830185612aee565b6120b16040830184612aee565b60238152602081017f4e6f7420616c6c6f77656420746f2073657420617070726f76616c20666f7220815262185b1b60ea1b602082015290505b60400190565b60208082528101610ac5816135d1565b6011815260208101703737b732bc34b9ba32b73a103a37b5b2b760791b81529050612def565b60208082528101610ac581613621565b600061366561295984612edf565b90508281526020810184848401111561368057613680600080fd5b6125aa848285612b02565b600082601f83011261369f5761369f600080fd5b81516120b1848260208601613657565b600080604083850312156136c5576136c5600080fd5b82516001600160401b038111156136de576136de600080fd5b6136ea8582860161368b565b92505060208301516001600160401b0381111561370957613709600080fd5b612bf58582860161368b565b600061371f825190565b61372d818560208601612b02565b9290920192915050565b6000815461374481613195565b60018216801561375b5760018114613770576137a0565b60ff19831686528115158202860193506137a0565b60008581526020902060005b838110156137985781548882015260019091019060200161377c565b505081860193505b50505092915050565b683d913730b6b2911d1160b91b81526009016137c58186613715565b701116113232b9b1b934b83a34b7b7111d1160791b815260110190506137eb8185613737565b6f222c2261747472696275746573223a5b60801b815260100190506138108184613715565b7f5d2c22696d616765223a22646174613a696d6167652f7376672b786d6c3b62618152641cd94d8d0b60da1b602082015260250190506138508183613715565b61227d60f01b815290506002810161113c565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000008152601d81015b9050610ac58183613715565b60268152602081017f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181526564647265737360d01b6020820152905061360b565b60208082528101610ac581613897565b60208082527f4f6e6c7920746865206f6e7765722063616e20736574207468652070726963659101908152612def565b60208082528101610ac5816138e8565b60208082527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65729101908152612def565b60208082528101610ac581613928565b601481526020810173546f6b656e206973206e6f74206f6e2073616c6560601b81529050612def565b60208082528101610ac581613968565b600f8152602081016e139bdd08195b9bdd59da08199d5b99608a1b81529050612def565b60208082528101610ac5816139a1565b8181028115828204841417610ac557610ac561313d565b6000826139fb576139fb613271565b500490565b60188152602081017f4f6e6c7920746865206f6e7765722063616e207472616465000000000000000081529050612def565b60208082528101610ac581613a00565b601d8152602081017f546172676574546f6b656e4964206973206e6f74206f6e20747261646500000081529050612def565b60208082528101610ac581613a42565b60808101613a928287612b69565b613a9f6020830186612b69565b613aac6040830185612aee565b8181036060830152613abe8184612b26565b9695505050505050565b8051610ac58161284a565b600060208284031215613ae857613ae8600080fd5b60006120b18484613ac8565b6b02637b1b0b6102737bab739960a51b8152600c810161388b565b600060208284031215613b2457613b24600080fd5b81516001600160401b03811115613b3d57613b3d600080fd5b6120b18482850161368b565b600e8152602081016d11985a5b1959081d1bc81cd95b9960921b81529050612def565b60208082528101610ac581613b4956fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa2646970667358221220c28ba246d4801dfd371d57e87ae46783f4b344443a5253c5f07910e32cfa0c5e64736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000b1b709a43446ce2045125b4f1e7d2e9ec5317397000000000000000000000000a0b9d89f6d17658eaa71fc0b916fccb248340382
-----Decoded View---------------
Arg [0] : _assetProvider (address): 0xb1B709a43446cE2045125B4F1e7D2e9eC5317397
Arg [1] : _minter (address): 0xA0B9D89F6d17658EAA71fC0b916fCCB248340382
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000b1b709a43446ce2045125b4f1e7d2e9ec5317397
Arg [1] : 000000000000000000000000a0b9d89f6d17658eaa71fc0b916fccb248340382
Loading...
Loading
Loading...
Loading
[ 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.