ERC-721
Overview
Max Total Supply
2,190 TACTICALGEAR
Holders
145
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Balance
1 TACTICALGEARLoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
TacticalGear
Compiler Version
v0.8.13+commit.abaa5c0e
Optimization Enabled:
Yes with 10 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/utils/math/SafeMath.sol'; import '@openzeppelin/contracts/utils/Base64.sol'; import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol'; import '@openzeppelin/contracts/utils/Strings.sol'; import 'erc721a/contracts/extensions/ERC721AQueryable.sol'; import 'erc721a/contracts/extensions/IERC721AQueryable.sol'; import './Library.sol'; import './interfaces/IForgedGear.sol'; import './interfaces/IAssets.sol'; import './interfaces/IKeys.sol'; import './interfaces/ITacticalGear.sol'; import './interfaces/ILibrary.sol'; import './opensea-enforcer/DefaultOperatorFilterer.sol'; contract TacticalGear is ERC721AQueryable, Ownable, DefaultOperatorFilterer { using SafeMath for uint256; uint256 public constant PRICE = 0.025 ether; uint256 public constant ITEMS_PER_PACK = 6; uint256 public constant MAX_SUPPLY = 4444 * ITEMS_PER_PACK; uint256 public constant MAX_PACKS_PER_MINT = 10; bool public isPresale = true; bool public isDealerAvailable = false; address signerAddress; mapping(uint256 => ITacticalGear.Item) private items; mapping(uint256 => string) private prefixes; mapping(uint256 => string) private suffixes; mapping(uint256 => string) private r0n1; mapping(address => uint256) private allowListMints; uint256 private itemsLength; uint256 private prefixesLength; uint256 private suffixesLength; uint256 private r0n1Length; mapping(uint256 => uint256) private tokenToItemIndex; mapping(uint256 => uint256) private tokenToMintedAt; // contract references IAssets private assets; IForgedGear private forgedGear; IKeys private keysContract; IERC721Enumerable private oniContract; constructor( string memory name, string memory symbol, address assetsAddress, address oniAddress ) ERC721A(name, symbol) { assets = IAssets(assetsAddress); oniContract = IERC721Enumerable(oniAddress); } modifier onlyInternalOrForged() { bool isInternal = msg.sender == address(this); bool isForgedContract = msg.sender == address(forgedGear); require(isInternal || isForgedContract, 'Unknown caller'); _; } function isFromForgedContract() internal view returns (bool) { return msg.sender == address(forgedGear); } function freeMint( uint256 packs, uint256 max, bytes calldata signature ) external { require(isPresale, 'Presale ended'); require(isValidSignature(signerAddress, max, packs, signature), 'Invalid signature'); require(allowListMints[_msgSender()] + packs <= max, 'You have reached the limit'); allowListMints[_msgSender()] += packs; mint(packs); } function publicMint(uint256 packs) external payable { require(oniContract.balanceOf(msg.sender) != 0, 'Should own at least one 0n1'); require(msg.value == packs * PRICE, 'Invalid amount of ETH'); mint(packs); } function mint(uint256 packs) internal { require(isDealerAvailable, 'The dealer is not available'); require(packs <= MAX_PACKS_PER_MINT, 'Cannot mint that many at once'); require(totalSupply().add(packs * ITEMS_PER_PACK) <= MAX_SUPPLY, 'Not enough left to mint'); tokenToMintedAt[_nextTokenId()] = block.timestamp; _safeMint(msg.sender, packs * ITEMS_PER_PACK); } function burn(uint256[] calldata tokenIds) internal { uint256 itemIndex1 = getItemIndex(tokenIds[0]); uint256 itemIndex2 = getItemIndex(tokenIds[1]); uint256 itemIndex3 = getItemIndex(tokenIds[2]); require(itemIndex1 == itemIndex2 && itemIndex1 == itemIndex3, 'All items should be of equal type'); for (uint256 i = 0; i <= 2; i++) { require(ownerOf(tokenIds[i]) == _msgSender(), 'Not your gear'); _burn(tokenIds[i]); } } function forgeGear(uint256[] calldata tokenIds) public { require(tokenIds.length == 3, 'Need three items to forge'); burn(tokenIds); forgedGear.forge(_msgSender(), tokenIds[0]); } function forgeKey(uint256[] calldata tokenIds) public { require(tokenIds.length == 3, 'Need three items to forge'); burn(tokenIds); keysContract.forge(_msgSender()); } function transferAll(address to) public { uint256 balanceOf = this.balanceOf(_msgSender()); uint256[] memory tokensOfOwner = this.tokensOfOwner(_msgSender()); for (uint256 i = 0; i < balanceOf; i++) { super.safeTransferFrom(_msgSender(), to, tokensOfOwner[i]); } } function completedAllowListMints(address _address) public view returns (uint256) { return allowListMints[_address]; } function getMintedAt(uint256 tokenId) private view returns (uint256) { for (uint256 i = tokenId; i >= 0; i--) { if (tokenToMintedAt[i] != 0) { return tokenToMintedAt[tokenId]; } } return 0; } function getItemIndex(uint256 tokenId) private view returns (uint256) { uint256 seed = getMintedAt(tokenId); uint256 rand = Library.random('item', seed + tokenId); return rand % itemsLength; } function getItem(uint256 tokenId) external view onlyInternalOrForged returns (ITacticalGear.Item memory) { return items[getItemIndex(tokenId)]; } function getPrefix(uint256 tokenId) external view onlyInternalOrForged returns (string memory) { bool isForged = isFromForgedContract(); uint256 seed = isForged ? forgedGear.getForgedAt(tokenId) : getMintedAt(tokenId); uint256 rand = Library.random('prefix', seed + tokenId); return prefixes[rand % prefixesLength]; } function getSuffix(uint256 tokenId) external view onlyInternalOrForged returns (string memory) { bool isForged = isFromForgedContract(); uint256 seed = isForged ? forgedGear.getForgedAt(tokenId) : getMintedAt(tokenId); uint256 rand = Library.random('suffix', seed + tokenId); return suffixes[rand % suffixesLength]; } function hasR0N1(uint256 tokenId) external view onlyInternalOrForged returns (bool) { string memory name = this.getItem(tokenId).name; for (uint256 i = 0; i < r0n1Length; i++) { if (Library.isEqualStrings(r0n1[i], string(abi.encodePacked('R0N1 ', name)))) { uint256 rand = Library.random('r0n1', getItemIndex(tokenId) + tokenId); return rand % uint256(7) == uint256(0); } } return false; } function getGear(uint256 tokenId) external view returns (ITacticalGear.TacticalGear memory) { require(_exists(tokenId), 'Token does not exist'); string memory name = this.getItem(tokenId).name; string memory suffix = this.getSuffix(tokenId); string memory category = this.getItem(tokenId).category; return ITacticalGear.TacticalGear({ fullName: string(abi.encodePacked(name, ' ', suffix)), name: name, category: category, suffix: suffix }); } function getImage(uint256 tokenId) public view returns (string memory) { require(_exists(tokenId), 'Token does not exist'); return Library.getImage(ILibrary.ImageInput(assets.getAsset(this.getItem(tokenId).name), '', '', false, false)); } function getCardImage(uint256 tokenId) public view returns (string memory) { require(_exists(tokenId), 'Token does not exist'); return Library.getCardImage( ILibrary.CardImageInput( this.getItem(tokenId).name, '', this.getSuffix(tokenId), assets.getAsset(this.getItem(tokenId).name), assets.getAsset(string(abi.encodePacked('R0N1 ', this.getItem(tokenId).name))), assets.getAsset(this.getSuffix(tokenId)), '', false, false, assets.getAsset('card'), assets.getAsset('font') ) ); } function tokenURI(uint256 tokenId) public view override(ERC721A, IERC721A) returns (string memory) { require(_exists(tokenId), 'Token does not exist'); return Library.getMetadata(this.getItem(tokenId), this.getSuffix(tokenId), '', false, false, getCardImage(tokenId)); } function setItems(string[][] calldata _items) public onlyOwner { itemsLength = _items.length; for (uint256 i = 0; i < _items.length; i++) { items[i] = ITacticalGear.Item({ category: _items[i][0], name: _items[i][1] }); } } function setSuffixes(string[] calldata _suffixes) public onlyOwner { suffixesLength = _suffixes.length; for (uint256 i = 0; i < _suffixes.length; i++) { suffixes[i] = _suffixes[i]; } } function setPrefixes(string[] calldata _prefixes) public onlyOwner { prefixesLength = _prefixes.length; for (uint256 i = 0; i < _prefixes.length; i++) { prefixes[i] = _prefixes[i]; } } function setR0n1(string[] calldata _r0n1) public onlyOwner { r0n1Length = _r0n1.length; for (uint256 i = 0; i < _r0n1.length; i++) { r0n1[i] = _r0n1[i]; } } function setForgedGearContract(address _forgedGear) public onlyOwner { forgedGear = IForgedGear(_forgedGear); } function setKeysContract(address _keysContract) public onlyOwner { keysContract = IKeys(_keysContract); } function setPresale(bool _presale) public onlyOwner { isPresale = _presale; } function setIsDealerAvailable(bool _isDealerAvailable) public onlyOwner { isDealerAvailable = _isDealerAvailable; } function setSignerAddress(address _signerAddress) public onlyOwner { signerAddress = _signerAddress; } function isValidSignature( address signer, uint256 max, uint256 amount, bytes calldata signature ) private view returns (bool) { return signer == ECDSA.recover(keccak256(abi.encodePacked(_msgSender(), max, amount)), signature); } function withdraw() external onlyOwner { uint256 balance = address(this).balance; payable(_msgSender()).transfer(balance); } // OpenSea Enforcer functions function setApprovalForAll(address operator, bool approved) public override(ERC721A, IERC721A) onlyAllowedOperatorApproval(operator) { super.setApprovalForAll(operator, approved); } function transferFrom( address from, address to, uint256 tokenId ) public payable override(ERC721A, IERC721A) onlyAllowedOperator(from) { super.transferFrom(from, to, tokenId); } function safeTransferFrom( address from, address to, uint256 tokenId ) public payable override(ERC721A, IERC721A) onlyAllowedOperator(from) { super.safeTransferFrom(from, to, tokenId); } function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory data ) public payable override(ERC721A, IERC721A) onlyAllowedOperator(from) { super.safeTransferFrom(from, to, tokenId, data); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Base64.sol) pragma solidity ^0.8.0; /** * @dev Provides a set of functions to operate with Base64 strings. * * _Available since v4.5._ */ library Base64 { /** * @dev Base64 Encoding/Decoding Table */ string internal constant _TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; /** * @dev Converts a `bytes` to its Bytes64 `string` representation. */ function encode(bytes memory data) internal pure returns (string memory) { /** * Inspired by Brecht Devos (Brechtpd) implementation - MIT licence * https://github.com/Brechtpd/base64/blob/e78d9fd951e7b0977ddca77d92dc85183770daf4/base64.sol */ if (data.length == 0) return ""; // Loads the table into memory string memory table = _TABLE; // Encoding takes 3 bytes chunks of binary data from `bytes` data parameter // and split into 4 numbers of 6 bits. // The final Base64 length should be `bytes` data length multiplied by 4/3 rounded up // - `data.length + 2` -> Round up // - `/ 3` -> Number of 3-bytes chunks // - `4 *` -> 4 characters for each chunk string memory result = new string(4 * ((data.length + 2) / 3)); /// @solidity memory-safe-assembly assembly { // Prepare the lookup table (skip the first "length" byte) let tablePtr := add(table, 1) // Prepare result pointer, jump over length let resultPtr := add(result, 32) // Run over the input, 3 bytes at a time for { let dataPtr := data let endPtr := add(data, mload(data)) } lt(dataPtr, endPtr) { } { // Advance 3 bytes dataPtr := add(dataPtr, 3) let input := mload(dataPtr) // To write each character, shift the 3 bytes (18 bits) chunk // 4 times in blocks of 6 bits for each character (18, 12, 6, 0) // and apply logical AND with 0x3F which is the number of // the previous character in the ASCII table prior to the Base64 Table // The result is then added to the table to get the character to write, // and finally write it in the result pointer but with a left shift // of 256 (1 byte) - 8 (1 ASCII char) = 248 bits mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F)))) resultPtr := add(resultPtr, 1) // Advance mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F)))) resultPtr := add(resultPtr, 1) // Advance mstore8(resultPtr, mload(add(tablePtr, and(shr(6, input), 0x3F)))) resultPtr := add(resultPtr, 1) // Advance mstore8(resultPtr, mload(add(tablePtr, and(input, 0x3F)))) resultPtr := add(resultPtr, 1) // Advance } // When data `bytes` is not exactly 3 bytes long // it is padded with `=` characters at the end switch mod(mload(data), 3) case 1 { mstore8(sub(resultPtr, 1), 0x3d) mstore8(sub(resultPtr, 2), 0x3d) } case 2 { mstore8(sub(resultPtr, 1), 0x3d) } } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT // 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 pragma solidity ^0.8.13; import '@openzeppelin/contracts/utils/Base64.sol'; import '@openzeppelin/contracts/utils/Strings.sol'; import '@openzeppelin/contracts/utils/cryptography/ECDSA.sol'; import './interfaces/ITacticalGear.sol'; import './interfaces/ILibrary.sol'; library Library { function calculateFontSize(string memory text) internal pure returns (string memory) { uint256 maxSize = 33; uint256 baseSize = 4; uint256 size = baseSize; uint256 length = bytes(text).length; if (length > maxSize) { size = 3; } return string(abi.encodePacked(Strings.toString(size), 'px')); } function random(string memory name, uint256 seed) internal pure returns (uint256) { return uint256(keccak256(abi.encodePacked(name, seed))); } function isEqualStrings(string memory stringA, string memory stringB) internal pure returns (bool) { return keccak256(abi.encodePacked(stringA)) == keccak256(abi.encodePacked(stringB)); } function getMetadata( ITacticalGear.Item memory item, string memory suffix, string memory prefix, bool isForged, bool hasR0N1, string memory image ) internal pure returns (string memory) { string memory name = item.name; string memory category = item.category; // prettier-ignore string memory metadata = string( abi.encodePacked( '{', isForged ? string(abi.encodePacked('"name": "', prefix, ' ', name, ' ', suffix, '",')) : string(abi.encodePacked('"name": "', name, ' ', suffix, '",')), '"description": "It got empty in the vents after 0BER1N had gone missing. The need for weapons and armor is now greater than it ever was.",', '"attributes": [', abi.encodePacked( '{"trait_type": "Name", "value": "', name, '"},', isForged ? string(abi.encodePacked('{"trait_type": "Prefix", "value": "', prefix, '"},')) : '', '{"trait_type": "Suffix", "value": "', suffix, '"},', '{"trait_type": "Category", "value": "', category, '"}', isForged && hasR0N1 ? string(abi.encodePacked(',{"trait_type": "Extra", "value": "', hasR0N1 ? 'R0N1' : 'None', '"}')) : '' ), '],', '"image": "', image, '"' '}' ) ); return string(abi.encodePacked('data:application/json;base64,', Base64.encode(bytes(metadata)))); } function getImage(ILibrary.ImageInput memory data) internal pure returns (string memory) { bytes memory svg = bytes( abi.encodePacked( "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:xhtml='http://www.w3.org/1999/xhtml' width='640' height='640' preserveAspectRatio='xMidYMid meet' viewBox='0 0 64 64' style='stroke-width:0; background-color:hsl(0,0%,0%); margin: auto;height: -webkit-fill-available'>", "<style type='text/css'>.pixelated { image-rendering: pixelated; }</style>", abi.encodePacked( data.hasR0N1 ? Library.foreignImage('0', '0', '64', '64', data.r0n1Graphic) : '', Library.foreignImage('0', '0', '64', '64', data.itemGraphic), data.isForged ? Library.foreignImage('0', '0', '64', '64', data.prefixGraphic) : '' ), '</svg>' ) ); return string(abi.encodePacked('data:image/svg+xml;base64,', Base64.encode(svg))); } function getCardImage(ILibrary.CardImageInput memory data) internal pure returns (string memory) { // prettier-ignore bytes memory svg = bytes( abi.encodePacked( "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:xhtml='http://www.w3.org/1999/xhtml' width='760' height='1140' preserveAspectRatio='xMidYMid meet' viewBox='0 0 76 114' style='stroke-width:0; background-color:hsl(0,0%,0%); margin: auto;height: -webkit-fill-available'>", abi.encodePacked( "<style type='text/css'>", "@font-face { font-family: GearFont; src: url('", data.font, "'); }", ".pixelated { image-rendering: pixelated; }", ".name { font-family: GearFont; font-size: ", Library.calculateFontSize(string(abi.encodePacked(data.name, ' ', data.suffix))), "; text-transform: uppercase; fill: black; }", "</style>" ), "<rect width='100%' height='100%' x='0' y='0' fill='#887e88' />", abi.encodePacked( data.hasR0N1 ? Library.foreignImage('6', '18', '64', '64', data.r0n1Graphic) : '', Library.foreignImage('0', '0', '76', '114', data.cardGraphic), Library.foreignImage('6', '18', '64', '64', data.itemGraphic), Library.foreignImage('30', '0', '16', '12', data.suffixGraphic), data.isForged ? Library.foreignImage('6', '18', '64', '64', data.prefixGraphic) : '' ), data.isForged ? string(abi.encodePacked( "<text x='50%' y='103.50' text-anchor='middle' dominant-baseline='bottom' class='name'>", data.prefix, "</text>", "<text x='50%' y='106.75' text-anchor='middle' dominant-baseline='top' class='name'>", abi.encodePacked(data.name, " ", data.suffix), "</text>" )) : string( abi.encodePacked( "<text x='50%' y='104.50' text-anchor='middle' dominant-baseline='middle' class='name'>", abi.encodePacked(data.name, ' ', data.suffix), '</text>' ) ), '</svg>' ) ); return string(abi.encodePacked('data:image/svg+xml;base64,', Base64.encode(svg))); } function foreignImage( string memory x, string memory y, string memory width, string memory height, string memory img ) internal pure returns (string memory) { // prettier-ignore return string( ( abi.encodePacked( "<foreignObject x='", x, "' y='", y, "' width='", width, "' height='", height, "'>", "<xhtml:img class='pixelated' width='100%' height='100%' src='", img, "'/>", '</foreignObject>' ) ) ); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import '@openzeppelin/contracts/token/ERC721/IERC721.sol'; interface IForgedGear is IERC721 { struct ForgedGear { string fullName; string name; string category; string prefix; string suffix; bool isForged; string extra; } function forge(address to, uint256 tokenId) external; function getForgedAt(uint256 tokenId) external view returns (uint256); function getForgedGear(uint256 tokenId) external view returns (ForgedGear memory); function getImage(uint256 tokenId) external view returns (string memory); function getCardImage(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; interface IAssets { function getAsset(string calldata _name) external view returns (string memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import '@openzeppelin/contracts/token/ERC721/IERC721.sol'; interface IKeys is IERC721 { function forge(address to) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import 'erc721a/contracts/extensions/IERC721AQueryable.sol'; interface ITacticalGear is IERC721AQueryable { struct Item { string category; string name; } struct TacticalGear { string fullName; string name; string category; string suffix; } function getItem(uint256 tokenId) external view returns (Item memory); function getPrefix(uint256 tokenId) external view returns (string memory); function getSuffix(uint256 tokenId) external view returns (string memory); function hasR0N1(uint256 tokenId) external view returns (bool); function getGear(uint256 tokenId) external view returns (TacticalGear memory); function getImage(uint256 tokenId) external view returns (string memory); function getCardImage(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; interface ILibrary { struct CardImageInput { string name; string prefix; string suffix; string itemGraphic; string prefixGraphic; string suffixGraphic; string r0n1Graphic; bool isForged; bool hasR0N1; string cardGraphic; string font; } struct ImageInput { string itemGraphic; string prefixGraphic; string r0n1Graphic; bool isForged; bool hasR0N1; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import { OperatorFilterer } from './OperatorFilterer.sol'; /** * @title DefaultOperatorFilterer * @notice Inherits from OperatorFilterer and automatically subscribes to the default OpenSea subscription. */ abstract contract DefaultOperatorFilterer is OperatorFilterer { address constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6); constructor() OperatorFilterer(DEFAULT_SUBSCRIPTION, true) {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.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/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721A.sol'; /** * @dev Interface of ERC721 token receiver. */ interface ERC721A__IERC721Receiver { function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } /** * @title ERC721A * * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721) * Non-Fungible Token Standard, including the Metadata extension. * Optimized for lower gas during batch mints. * * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...) * starting from `_startTokenId()`. * * Assumptions: * * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256). */ contract ERC721A is IERC721A { // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364). struct TokenApprovalRef { address value; } // ============================================================= // CONSTANTS // ============================================================= // Mask of an entry in packed address data. uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1; // The bit position of `numberMinted` in packed address data. uint256 private constant _BITPOS_NUMBER_MINTED = 64; // The bit position of `numberBurned` in packed address data. uint256 private constant _BITPOS_NUMBER_BURNED = 128; // The bit position of `aux` in packed address data. uint256 private constant _BITPOS_AUX = 192; // Mask of all 256 bits in packed address data except the 64 bits for `aux`. uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1; // The bit position of `startTimestamp` in packed ownership. uint256 private constant _BITPOS_START_TIMESTAMP = 160; // The bit mask of the `burned` bit in packed ownership. uint256 private constant _BITMASK_BURNED = 1 << 224; // The bit position of the `nextInitialized` bit in packed ownership. uint256 private constant _BITPOS_NEXT_INITIALIZED = 225; // The bit mask of the `nextInitialized` bit in packed ownership. uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225; // The bit position of `extraData` in packed ownership. uint256 private constant _BITPOS_EXTRA_DATA = 232; // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`. uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1; // The mask of the lower 160 bits for addresses. uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1; // The maximum `quantity` that can be minted with {_mintERC2309}. // This limit is to prevent overflows on the address data entries. // For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309} // is required to cause an overflow, which is unrealistic. uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000; // The `Transfer` event signature is given by: // `keccak256(bytes("Transfer(address,address,uint256)"))`. bytes32 private constant _TRANSFER_EVENT_SIGNATURE = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; // ============================================================= // STORAGE // ============================================================= // The next token ID to be minted. uint256 private _currentIndex; // The number of tokens burned. uint256 private _burnCounter; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. // See {_packedOwnershipOf} implementation for details. // // Bits Layout: // - [0..159] `addr` // - [160..223] `startTimestamp` // - [224] `burned` // - [225] `nextInitialized` // - [232..255] `extraData` mapping(uint256 => uint256) private _packedOwnerships; // Mapping owner address to address data. // // Bits Layout: // - [0..63] `balance` // - [64..127] `numberMinted` // - [128..191] `numberBurned` // - [192..255] `aux` mapping(address => uint256) private _packedAddressData; // Mapping from token ID to approved address. mapping(uint256 => TokenApprovalRef) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; // ============================================================= // CONSTRUCTOR // ============================================================= constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; _currentIndex = _startTokenId(); } // ============================================================= // TOKEN COUNTING OPERATIONS // ============================================================= /** * @dev Returns the starting token ID. * To change the starting token ID, please override this function. */ function _startTokenId() internal view virtual returns (uint256) { return 0; } /** * @dev Returns the next token ID to be minted. */ function _nextTokenId() internal view virtual returns (uint256) { return _currentIndex; } /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() public view virtual override returns (uint256) { // Counter underflow is impossible as _burnCounter cannot be incremented // more than `_currentIndex - _startTokenId()` times. unchecked { return _currentIndex - _burnCounter - _startTokenId(); } } /** * @dev Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view virtual returns (uint256) { // Counter underflow is impossible as `_currentIndex` does not decrement, // and it is initialized to `_startTokenId()`. unchecked { return _currentIndex - _startTokenId(); } } /** * @dev Returns the total number of tokens burned. */ function _totalBurned() internal view virtual returns (uint256) { return _burnCounter; } // ============================================================= // ADDRESS DATA OPERATIONS // ============================================================= /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) public view virtual override returns (uint256) { if (owner == address(0)) revert BalanceQueryForZeroAddress(); return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens minted by `owner`. */ function _numberMinted(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens burned by or on behalf of `owner`. */ function _numberBurned(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). */ function _getAux(address owner) internal view returns (uint64) { return uint64(_packedAddressData[owner] >> _BITPOS_AUX); } /** * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). * If there are multiple variables, please pack them into a uint64. */ function _setAux(address owner, uint64 aux) internal virtual { uint256 packed = _packedAddressData[owner]; uint256 auxCasted; // Cast `aux` with assembly to avoid redundant masking. assembly { auxCasted := aux } packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX); _packedAddressData[owner] = packed; } // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { // The interface IDs are constants representing the first 4 bytes // of the XOR of all function selectors in the interface. // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165) // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`) return interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165. interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721. interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata. } // ============================================================= // IERC721Metadata // ============================================================= /** * @dev Returns the token collection name. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the token collection symbol. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : ''; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, it can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ''; } // ============================================================= // OWNERSHIPS OPERATIONS // ============================================================= /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { return address(uint160(_packedOwnershipOf(tokenId))); } /** * @dev Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around over time. */ function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnershipOf(tokenId)); } /** * @dev Returns the unpacked `TokenOwnership` struct at `index`. */ function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnerships[index]); } /** * @dev Initializes the ownership slot minted at `index` for efficiency purposes. */ function _initializeOwnershipAt(uint256 index) internal virtual { if (_packedOwnerships[index] == 0) { _packedOwnerships[index] = _packedOwnershipOf(index); } } /** * Returns the packed ownership data of `tokenId`. */ function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) { uint256 curr = tokenId; unchecked { if (_startTokenId() <= curr) if (curr < _currentIndex) { uint256 packed = _packedOwnerships[curr]; // If not burned. if (packed & _BITMASK_BURNED == 0) { // Invariant: // There will always be an initialized ownership slot // (i.e. `ownership.addr != address(0) && ownership.burned == false`) // before an unintialized ownership slot // (i.e. `ownership.addr == address(0) && ownership.burned == false`) // Hence, `curr` will not underflow. // // We can directly compare the packed value. // If the address is zero, packed will be zero. while (packed == 0) { packed = _packedOwnerships[--curr]; } return packed; } } } revert OwnerQueryForNonexistentToken(); } /** * @dev Returns the unpacked `TokenOwnership` struct from `packed`. */ function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) { ownership.addr = address(uint160(packed)); ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP); ownership.burned = packed & _BITMASK_BURNED != 0; ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA); } /** * @dev Packs ownership data into a single uint256. */ function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`. result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags)) } } /** * @dev Returns the `nextInitialized` flag set if `quantity` equals 1. */ function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) { // For branchless setting of the `nextInitialized` flag. assembly { // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`. result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1)) } } // ============================================================= // APPROVAL OPERATIONS // ============================================================= /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the * zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) public payable virtual override { address owner = ownerOf(tokenId); if (_msgSenderERC721A() != owner) if (!isApprovedForAll(owner, _msgSenderERC721A())) { revert ApprovalCallerNotOwnerNorApproved(); } _tokenApprovals[tokenId].value = to; emit Approval(owner, to, tokenId); } /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken(); return _tokenApprovals[tokenId].value; } /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} * for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool approved) public virtual override { _operatorApprovals[_msgSenderERC721A()][operator] = approved; emit ApprovalForAll(_msgSenderERC721A(), operator, approved); } /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted. See {_mint}. */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _startTokenId() <= tokenId && tokenId < _currentIndex && // If within bounds, _packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned. } /** * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`. */ function _isSenderApprovedOrOwner( address approvedAddress, address owner, address msgSender ) private pure returns (bool result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean. msgSender := and(msgSender, _BITMASK_ADDRESS) // `msgSender == owner || msgSender == approvedAddress`. result := or(eq(msgSender, owner), eq(msgSender, approvedAddress)) } } /** * @dev Returns the storage slot and value for the approved address of `tokenId`. */ function _getApprovedSlotAndAddress(uint256 tokenId) private view returns (uint256 approvedAddressSlot, address approvedAddress) { TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId]; // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`. assembly { approvedAddressSlot := tokenApproval.slot approvedAddress := sload(approvedAddressSlot) } } // ============================================================= // TRANSFER OPERATIONS // ============================================================= /** * @dev Transfers `tokenId` from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) public payable virtual override { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner(); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); if (to == address(0)) revert TransferToZeroAddress(); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // We can directly increment and decrement the balances. --_packedAddressData[from]; // Updates: `balance -= 1`. ++_packedAddressData[to]; // Updates: `balance += 1`. // Updates: // - `address` to the next owner. // - `startTimestamp` to the timestamp of transfering. // - `burned` to `false`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _packOwnershipData( to, _BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public payable virtual override { safeTransferFrom(from, to, tokenId, ''); } /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public payable virtual override { transferFrom(from, to, tokenId); if (to.code.length != 0) if (!_checkContractOnERC721Received(from, to, tokenId, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } /** * @dev Hook that is called before a set of serially-ordered token IDs * are about to be transferred. This includes minting. * And also called before burning one token. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token IDs * have been transferred. This includes minting. * And also called after one token has been burned. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been * transferred to `to`. * - When `from` is zero, `tokenId` has been minted for `to`. * - When `to` is zero, `tokenId` has been burned by `from`. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract. * * `from` - Previous owner of the given token ID. * `to` - Target address that will receive the token. * `tokenId` - Token ID to be transferred. * `_data` - Optional data to send along with the call. * * Returns whether the call correctly returned the expected magic value. */ function _checkContractOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns ( bytes4 retval ) { return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert TransferToNonERC721ReceiverImplementer(); } else { assembly { revert(add(32, reason), mload(reason)) } } } } // ============================================================= // MINT OPERATIONS // ============================================================= /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event for each mint. */ function _mint(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // `balance` and `numberMinted` have a maximum limit of 2**64. // `tokenId` has a maximum limit of 2**256. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); uint256 toMasked; uint256 end = startTokenId + quantity; // Use assembly to loop and emit the `Transfer` event for gas savings. // The duplicated `log4` removes an extra check and reduces stack juggling. // The assembly, together with the surrounding Solidity code, have been // delicately arranged to nudge the compiler into producing optimized opcodes. assembly { // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. toMasked := and(to, _BITMASK_ADDRESS) // Emit the `Transfer` event. log4( 0, // Start of data (0, since no data). 0, // End of data (0, since no data). _TRANSFER_EVENT_SIGNATURE, // Signature. 0, // `address(0)`. toMasked, // `to`. startTokenId // `tokenId`. ) // The `iszero(eq(,))` check ensures that large values of `quantity` // that overflows uint256 will make the loop run out of gas. // The compiler will optimize the `iszero` away for performance. for { let tokenId := add(startTokenId, 1) } iszero(eq(tokenId, end)) { tokenId := add(tokenId, 1) } { // Emit the `Transfer` event. Similar to above. log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId) } } if (toMasked == 0) revert MintToZeroAddress(); _currentIndex = end; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * This function is intended for efficient minting only during contract creation. * * It emits only one {ConsecutiveTransfer} as defined in * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309), * instead of a sequence of {Transfer} event(s). * * Calling this function outside of contract creation WILL make your contract * non-compliant with the ERC721 standard. * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309 * {ConsecutiveTransfer} event is only permissible during contract creation. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {ConsecutiveTransfer} event. */ function _mintERC2309(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are unrealistic due to the above check for `quantity` to be below the limit. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to); _currentIndex = startTokenId + quantity; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * See {_mint}. * * Emits a {Transfer} event for each mint. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal virtual { _mint(to, quantity); unchecked { if (to.code.length != 0) { uint256 end = _currentIndex; uint256 index = end - quantity; do { if (!_checkContractOnERC721Received(address(0), to, index++, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } while (index < end); // Reentrancy protection. if (_currentIndex != end) revert(); } } } /** * @dev Equivalent to `_safeMint(to, quantity, '')`. */ function _safeMint(address to, uint256 quantity) internal virtual { _safeMint(to, quantity, ''); } // ============================================================= // BURN OPERATIONS // ============================================================= /** * @dev Equivalent to `_burn(tokenId, false)`. */ function _burn(uint256 tokenId) internal virtual { _burn(tokenId, false); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId, bool approvalCheck) internal virtual { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); address from = address(uint160(prevOwnershipPacked)); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); if (approvalCheck) { // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); } _beforeTokenTransfers(from, address(0), tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // Updates: // - `balance -= 1`. // - `numberBurned += 1`. // // We can directly decrement the balance, and increment the number burned. // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`. _packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1; // Updates: // - `address` to the last owner. // - `startTimestamp` to the timestamp of burning. // - `burned` to `true`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _packOwnershipData( from, (_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, address(0), tokenId); _afterTokenTransfers(from, address(0), tokenId, 1); // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times. unchecked { _burnCounter++; } } // ============================================================= // EXTRA DATA OPERATIONS // ============================================================= /** * @dev Directly sets the extra data for the ownership data `index`. */ function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual { uint256 packed = _packedOwnerships[index]; if (packed == 0) revert OwnershipNotInitializedForExtraData(); uint256 extraDataCasted; // Cast `extraData` with assembly to avoid redundant masking. assembly { extraDataCasted := extraData } packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA); _packedOwnerships[index] = packed; } /** * @dev Called during each token transfer to set the 24bit `extraData` field. * Intended to be overridden by the cosumer contract. * * `previousExtraData` - the value of `extraData` before transfer. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _extraData( address from, address to, uint24 previousExtraData ) internal view virtual returns (uint24) {} /** * @dev Returns the next extra data for the packed ownership data. * The returned result is shifted into position. */ function _nextExtraData( address from, address to, uint256 prevOwnershipPacked ) private view returns (uint256) { uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA); return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA; } // ============================================================= // OTHER OPERATIONS // ============================================================= /** * @dev Returns the message sender (defaults to `msg.sender`). * * If you are writing GSN compatible contracts, you need to override this function. */ function _msgSenderERC721A() internal view virtual returns (address) { return msg.sender; } /** * @dev Converts a uint256 to its ASCII string decimal representation. */ function _toString(uint256 value) internal pure virtual returns (string memory str) { assembly { // The maximum value of a uint256 contains 78 digits (1 byte per digit), but // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned. // We will need 1 word for the trailing zeros padding, 1 word for the length, // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0. let m := add(mload(0x40), 0xa0) // Update the free memory pointer to allocate. mstore(0x40, m) // Assign the `str` to the end. str := sub(m, 0x20) // Zeroize the slot after the string. mstore(str, 0) // Cache the end of the memory to calculate the length later. let end := str // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. // prettier-ignore for { let temp := value } 1 {} { str := sub(str, 1) // Write the character to the pointer. // The ASCII index of the '0' character is 48. mstore8(str, add(48, mod(temp, 10))) // Keep dividing `temp` until zero. temp := div(temp, 10) // prettier-ignore if iszero(temp) { break } } let length := sub(end, str) // Move the pointer 32 bytes leftwards to make room for the length. str := sub(str, 0x20) // Store the length. mstore(str, length) } } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; /** * @dev Interface of ERC721A. */ interface IERC721A { /** * The caller must own the token or be an approved operator. */ error ApprovalCallerNotOwnerNorApproved(); /** * The token does not exist. */ error ApprovalQueryForNonexistentToken(); /** * Cannot query the balance for the zero address. */ error BalanceQueryForZeroAddress(); /** * Cannot mint to the zero address. */ error MintToZeroAddress(); /** * The quantity of tokens minted must be more than zero. */ error MintZeroQuantity(); /** * The token does not exist. */ error OwnerQueryForNonexistentToken(); /** * The caller must own the token or be an approved operator. */ error TransferCallerNotOwnerNorApproved(); /** * The token must be owned by `from`. */ error TransferFromIncorrectOwner(); /** * Cannot safely transfer to a contract that does not implement the * ERC721Receiver interface. */ error TransferToNonERC721ReceiverImplementer(); /** * Cannot transfer to the zero address. */ error TransferToZeroAddress(); /** * The token does not exist. */ error URIQueryForNonexistentToken(); /** * The `quantity` minted with ERC2309 exceeds the safety limit. */ error MintERC2309QuantityExceedsLimit(); /** * The `extraData` cannot be set on an unintialized ownership slot. */ error OwnershipNotInitializedForExtraData(); // ============================================================= // STRUCTS // ============================================================= struct TokenOwnership { // The address of the owner. address addr; // Stores the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}. uint24 extraData; } // ============================================================= // TOKEN COUNTERS // ============================================================= /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() external view returns (uint256); // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); // ============================================================= // IERC721 // ============================================================= /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables * (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, * checking first that contract recipients are aware of the ERC721 protocol * to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move * this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external payable; /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external payable; /** * @dev Transfers `tokenId` from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} * whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external payable; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the * zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external payable; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} * for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) external view returns (bool); // ============================================================= // IERC721Metadata // ============================================================= /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); // ============================================================= // IERC2309 // ============================================================= /** * @dev Emitted when tokens in `fromTokenId` to `toTokenId` * (inclusive) is transferred from `from` to `to`, as defined in the * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard. * * See {_mintERC2309} for more details. */ event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import { IOperatorFilterRegistry } from './IOperatorFilterRegistry.sol'; /** * @title OperatorFilterer * @notice Abstract contract whose constructor automatically registers and optionally subscribes to or copies another * registrant's entries in the OperatorFilterRegistry. * @dev This smart contract is meant to be inherited by token contracts so they can use the following: * - `onlyAllowedOperator` modifier for `transferFrom` and `safeTransferFrom` methods. * - `onlyAllowedOperatorApproval` modifier for `approve` and `setApprovalForAll` methods. */ abstract contract OperatorFilterer { error OperatorNotAllowed(address operator); IOperatorFilterRegistry public constant OPERATOR_FILTER_REGISTRY = IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E); constructor(address subscriptionOrRegistrantToCopy, bool subscribe) { // If an inheriting token contract is deployed to a network without the registry deployed, the modifier // will not revert, but the contract will need to be registered with the registry once it is deployed in // order for the modifier to filter addresses. if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) { if (subscribe) { OPERATOR_FILTER_REGISTRY.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy); } else { if (subscriptionOrRegistrantToCopy != address(0)) { OPERATOR_FILTER_REGISTRY.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy); } else { OPERATOR_FILTER_REGISTRY.register(address(this)); } } } } modifier onlyAllowedOperator(address from) virtual { // Allow spending tokens from addresses with balance // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred // from an EOA. if (from != msg.sender) { _checkFilterOperator(msg.sender); } _; } modifier onlyAllowedOperatorApproval(address operator) virtual { _checkFilterOperator(operator); _; } function _checkFilterOperator(address operator) internal view virtual { // Check registry code length to facilitate testing in environments without a deployed registry. if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) { if (!OPERATOR_FILTER_REGISTRY.isOperatorAllowed(address(this), operator)) { revert OperatorNotAllowed(operator); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; interface IOperatorFilterRegistry { function isOperatorAllowed(address registrant, address operator) external view returns (bool); function register(address registrant) external; function registerAndSubscribe(address registrant, address subscription) external; function registerAndCopyEntries(address registrant, address registrantToCopy) external; function unregister(address addr) external; function updateOperator( address registrant, address operator, bool filtered ) external; function updateOperators( address registrant, address[] calldata operators, bool filtered ) external; function updateCodeHash( address registrant, bytes32 codehash, bool filtered ) external; function updateCodeHashes( address registrant, bytes32[] calldata codeHashes, bool filtered ) external; function subscribe(address registrant, address registrantToSubscribe) external; function unsubscribe(address registrant, bool copyExistingEntries) external; function subscriptionOf(address addr) external returns (address registrant); function subscribers(address registrant) external returns (address[] memory); function subscriberAt(address registrant, uint256 index) external returns (address); function copyEntriesOf(address registrant, address registrantToCopy) external; function isOperatorFiltered(address registrant, address operator) external returns (bool); function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool); function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool); function filteredOperators(address addr) external returns (address[] memory); function filteredCodeHashes(address addr) external returns (bytes32[] memory); function filteredOperatorAt(address registrant, uint256 index) external returns (address); function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32); function isRegistered(address addr) external returns (bool); function codeHashOf(address addr) external returns (bytes32); }
{ "optimizer": { "enabled": true, "runs": 10 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"address","name":"assetsAddress","type":"address"},{"internalType":"address","name":"oniAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"InvalidQueryRange","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"OperatorNotAllowed","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":"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":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"ITEMS_PER_PACK","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_PACKS_PER_MINT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_FILTER_REGISTRY","outputs":[{"internalType":"contract IOperatorFilterRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRICE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"completedAllowListMints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"explicitOwnershipOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"},{"internalType":"uint24","name":"extraData","type":"uint24"}],"internalType":"struct IERC721A.TokenOwnership","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"explicitOwnershipsOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"},{"internalType":"uint24","name":"extraData","type":"uint24"}],"internalType":"struct IERC721A.TokenOwnership[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"forgeGear","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"forgeKey","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"packs","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"freeMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getCardImage","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getGear","outputs":[{"components":[{"internalType":"string","name":"fullName","type":"string"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"category","type":"string"},{"internalType":"string","name":"suffix","type":"string"}],"internalType":"struct ITacticalGear.TacticalGear","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getImage","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getItem","outputs":[{"components":[{"internalType":"string","name":"category","type":"string"},{"internalType":"string","name":"name","type":"string"}],"internalType":"struct ITacticalGear.Item","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getPrefix","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getSuffix","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"hasR0N1","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isDealerAvailable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isPresale","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"packs","type":"uint256"}],"name":"publicMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_forgedGear","type":"address"}],"name":"setForgedGearContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_isDealerAvailable","type":"bool"}],"name":"setIsDealerAvailable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string[][]","name":"_items","type":"string[][]"}],"name":"setItems","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_keysContract","type":"address"}],"name":"setKeysContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string[]","name":"_prefixes","type":"string[]"}],"name":"setPrefixes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_presale","type":"bool"}],"name":"setPresale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string[]","name":"_r0n1","type":"string[]"}],"name":"setR0n1","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_signerAddress","type":"address"}],"name":"setSignerAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string[]","name":"_suffixes","type":"string[]"}],"name":"setSuffixes","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":[{"internalType":"address","name":"owner","type":"address"}],"name":"tokensOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"stop","type":"uint256"}],"name":"tokensOfOwnerIn","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"transferAll","outputs":[],"stateMutability":"nonpayable","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":"nonpayable","type":"function"}]
Contract Creation Code
60806040526008805461ffff60a01b1916600160a01b1790553480156200002557600080fd5b50604051620060b1380380620060b18339810160408190526200004891620003ff565b733cc6cdda760b79bafa08df41ecfa224f810dceb6600185858160029080519060200190620000799291906200026f565b5080516200008f9060039060208401906200026f565b50506000805550620000a1336200021d565b6daaeb6d7670e522a718067333cd4e3b15620001e65780156200013457604051633e9f1edf60e11b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e90637d3e3dbe906044015b600060405180830381600087803b1580156200011557600080fd5b505af11580156200012a573d6000803e3d6000fd5b50505050620001e6565b6001600160a01b03821615620001855760405163a0af290360e01b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e9063a0af290390604401620000fa565b604051632210724360e11b81523060048201526daaeb6d7670e522a718067333cd4e90634420e48690602401600060405180830381600087803b158015620001cc57600080fd5b505af1158015620001e1573d6000803e3d6000fd5b505050505b5050601580546001600160a01b039384166001600160a01b0319918216179091556018805492909316911617905550620004ca9050565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b8280546200027d906200048e565b90600052602060002090601f016020900481019282620002a15760008555620002ec565b82601f10620002bc57805160ff1916838001178555620002ec565b82800160010185558215620002ec579182015b82811115620002ec578251825591602001919060010190620002cf565b50620002fa929150620002fe565b5090565b5b80821115620002fa5760008155600101620002ff565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200033d57600080fd5b81516001600160401b03808211156200035a576200035a62000315565b604051601f8301601f19908116603f0116810190828211818310171562000385576200038562000315565b81604052838152602092508683858801011115620003a257600080fd5b600091505b83821015620003c65785820183015181830184015290820190620003a7565b83821115620003d85760008385830101525b9695505050505050565b80516001600160a01b0381168114620003fa57600080fd5b919050565b600080600080608085870312156200041657600080fd5b84516001600160401b03808211156200042e57600080fd5b6200043c888389016200032b565b955060208701519150808211156200045357600080fd5b5062000462878288016200032b565b9350506200047360408601620003e2565b91506200048360608601620003e2565b905092959194509250565b600181811c90821680620004a357607f821691505b602082108103620004c457634e487b7160e01b600052602260045260246000fd5b50919050565b615bd780620004da6000396000f3fe6080604052600436106102445760003560e01c806301ffc9a714610249578063046dc1661461027e57806306fdde03146102a0578063081812fc146102c2578063095ea7b3146102ef57806318160ddd146103025780631c9848c114610325578063207f32421461034557806322ca5aeb1461036557806323b872dd146103855780632607aafa146103985780632c60b29b146103b85780632ce64201146103cd5780632dafdd87146104035780632db11544146104235780633129e7731461043657806332cb6b0c146104635780633ccfd60b1461047857806341f434341461048d57806342842e0e146104af57806350e08459146104c25780635454d388146104e25780635bbb21771461050f5780636352211e1461053c5780636a3ef3801461055c5780636c0ab2be1461057c5780636c10e5681461059c578063701a6b77146105bc57806370a08231146105dd578063715018a6146105fd57806376c2f611146106125780638462151c146106275780638ac06d39146106545780638b89ad89146106745780638d859f3e146106945780638da5cb5b146106af5780638de30be0146106c45780639414b902146106e457806395364a841461070457806395d89b411461072557806399a2557a1461073a578063a22cb4651461075a578063a3a7e7f31461077a578063a67fdc731461079a578063b88d4fde146107ba578063c23dc68f146107cd578063c54e73e3146107fa578063c87b56dd1461081a578063e985e9c51461083a578063ea2cfe2214610883578063f2fde38b146108a3575b600080fd5b34801561025557600080fd5b506102696102643660046142eb565b6108c3565b60405190151581526020015b60405180910390f35b34801561028a57600080fd5b5061029e610299366004614324565b610915565b005b3480156102ac57600080fd5b506102b561093f565b6040516102759190614397565b3480156102ce57600080fd5b506102e26102dd3660046143aa565b6109d1565b60405161027591906143c3565b61029e6102fd3660046143d7565b610a15565b34801561030e57600080fd5b50600154600054035b604051908152602001610275565b34801561033157600080fd5b5061029e610340366004614445565b610ab5565b34801561035157600080fd5b5061029e610360366004614486565b610b4c565b34801561037157600080fd5b5061029e610380366004614445565b610c8a565b61029e610393366004614505565b610e04565b3480156103a457600080fd5b506102b56103b33660046143aa565b610e29565b3480156103c457600080fd5b50610317600a81565b3480156103d957600080fd5b506103176103e8366004614324565b6001600160a01b03166000908152600e602052604090205490565b34801561040f57600080fd5b5061029e61041e366004614445565b610f7d565b61029e6104313660046143aa565b611006565b34801561044257600080fd5b506104566104513660046143aa565b611127565b6040516102759190614541565b34801561046f57600080fd5b506103176112c6565b34801561048457600080fd5b5061029e6112d6565b34801561049957600080fd5b506102e26daaeb6d7670e522a718067333cd4e81565b61029e6104bd366004614505565b611311565b3480156104ce57600080fd5b5061029e6104dd366004614445565b611336565b3480156104ee57600080fd5b506105026104fd3660046143aa565b61139e565b6040516102759190614583565b34801561051b57600080fd5b5061052f61052a366004614445565b611578565b6040516102759190614634565b34801561054857600080fd5b506102e26105573660046143aa565b61162a565b34801561056857600080fd5b506102b56105773660046143aa565b611635565b34801561058857600080fd5b5061029e610597366004614684565b6117ea565b3480156105a857600080fd5b5061029e6105b7366004614445565b611810565b3480156105c857600080fd5b5060085461026990600160a81b900460ff1681565b3480156105e957600080fd5b506103176105f8366004614324565b611878565b34801561060957600080fd5b5061029e6118c6565b34801561061e57600080fd5b50610317600681565b34801561063357600080fd5b50610647610642366004614324565b6118da565b60405161027591906146a1565b34801561066057600080fd5b5061029e61066f366004614324565b6119c0565b34801561068057600080fd5b506102b561068f3660046143aa565b6119ea565b3480156106a057600080fd5b506103176658d15e1762800081565b3480156106bb57600080fd5b506102e2611f2b565b3480156106d057600080fd5b5061029e6106df366004614445565b611f3a565b3480156106f057600080fd5b506102b56106ff3660046143aa565b611fa2565b34801561071057600080fd5b5060085461026990600160a01b900460ff1681565b34801561073157600080fd5b506102b56120af565b34801561074657600080fd5b506106476107553660046146d9565b6120be565b34801561076657600080fd5b5061029e61077536600461470c565b612237565b34801561078657600080fd5b5061029e610795366004614324565b61224b565b3480156107a657600080fd5b506102696107b53660046143aa565b612361565b61029e6107c83660046147b0565b612549565b3480156107d957600080fd5b506107ed6107e83660046143aa565b612576565b604051610275919061485a565b34801561080657600080fd5b5061029e610815366004614684565b6125b9565b34801561082657600080fd5b506102b56108353660046143aa565b6125df565b34801561084657600080fd5b50610269610855366004614868565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b34801561088f57600080fd5b5061029e61089e366004614324565b6126f2565b3480156108af57600080fd5b5061029e6108be366004614324565b61271c565b60006301ffc9a760e01b6001600160e01b0319831614806108f457506380ac58cd60e01b6001600160e01b03198316145b8061090f5750635b5e139f60e01b6001600160e01b03198316145b92915050565b61091d612792565b600980546001600160a01b0319166001600160a01b0392909216919091179055565b60606002805461094e9061489b565b80601f016020809104026020016040519081016040528092919081815260200182805461097a9061489b565b80156109c75780601f1061099c576101008083540402835291602001916109c7565b820191906000526020600020905b8154815290600101906020018083116109aa57829003601f168201915b5050505050905090565b60006109dc826127f1565b6109f9576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b6000610a208261162a565b9050336001600160a01b03821614610a5957610a3c8133610855565b610a59576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b60038114610ade5760405162461bcd60e51b8152600401610ad5906148d5565b60405180910390fd5b610ae88282612818565b6017546001600160a01b0316634e5a5178336040518263ffffffff1660e01b8152600401610b1691906143c3565b600060405180830381600087803b158015610b3057600080fd5b505af1158015610b44573d6000803e3d6000fd5b505050505050565b600854600160a01b900460ff16610b955760405162461bcd60e51b815260206004820152600d60248201526c141c995cd85b1948195b991959609a1b6044820152606401610ad5565b600954610bae906001600160a01b03168486858561297c565b610bee5760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964207369676e617475726560781b6044820152606401610ad5565b336000908152600e60205260409020548390610c0b90869061491e565b1115610c565760405162461bcd60e51b815260206004820152601a602482015279165bdd481a185d99481c995858da1959081d1a19481b1a5b5a5d60321b6044820152606401610ad5565b336000908152600e602052604081208054869290610c7590849061491e565b90915550610c84905084612a1c565b50505050565b610c92612792565b600f81905560005b81811015610dff576040518060400160405280848484818110610cbf57610cbf614936565b9050602002810190610cd1919061494c565b6000818110610ce257610ce2614936565b9050602002810190610cf49190614995565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250602001848484818110610d4057610d40614936565b9050602002810190610d52919061494c565b6001818110610d6357610d63614936565b9050602002810190610d759190614995565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920182905250939094525050838152600a6020908152604090912083518051919350610dcf9284929101906141a1565b506020828101518051610de892600185019201906141a1565b509050508080610df7906149db565b915050610c9a565b505050565b826001600160a01b0381163314610e1e57610e1e33612b67565b610c84848484612c17565b6060610e34826127f1565b610e505760405162461bcd60e51b8152600401610ad5906149f4565b6040805160a0810191829052601554633129e77360e01b90925260a4810184905261090f9181906001600160a01b031663cd5286d030633129e77360c48501600060405180830381865afa158015610eac573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610ed49190810190614a67565b602001516040518263ffffffff1660e01b8152600401610ef49190614397565b600060405180830381865afa158015610f11573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610f399190810190614b0d565b815260200160405180602001604052806000815250815260200160405180602001604052806000815250815260200160001515815260200160001515815250612da4565b60038114610f9d5760405162461bcd60e51b8152600401610ad5906148d5565b610fa78282612818565b6016546001600160a01b031663641cc9d43384846000818110610fcc57610fcc614936565b6040516001600160e01b031960e087901b1681526001600160a01b0390941660048501526020029190910135602483015250604401610b16565b6018546040516370a0823160e01b81526001600160a01b03909116906370a08231906110369033906004016143c3565b602060405180830381865afa158015611053573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110779190614b41565b6000036110c45760405162461bcd60e51b815260206004820152601b60248201527a53686f756c64206f776e206174206c65617374206f6e6520306e3160281b6044820152606401610ad5565b6110d56658d15e1762800082614b5a565b341461111b5760405162461bcd60e51b8152602060048201526015602482015274092dcecc2d8d2c840c2dadeeadce840decc408aa89605b1b6044820152606401610ad5565b61112481612a1c565b50565b604080518082019091526060808252602082015260165433308114916001600160a01b03161481806111565750805b6111725760405162461bcd60e51b8152600401610ad590614b79565b600a600061117f86612fb9565b81526020019081526020016000206040518060400160405290816000820180546111a89061489b565b80601f01602080910402602001604051908101604052809291908181526020018280546111d49061489b565b80156112215780601f106111f657610100808354040283529160200191611221565b820191906000526020600020905b81548152906001019060200180831161120457829003601f168201915b5050505050815260200160018201805461123a9061489b565b80601f01602080910402602001604051908101604052809291908181526020018280546112669061489b565b80156112b35780601f10611288576101008083540402835291602001916112b3565b820191906000526020600020905b81548152906001019060200180831161129657829003601f168201915b50505050508152505092505b5050919050565b6112d3600661115c614b5a565b81565b6112de612792565b6040514790339082156108fc029083906000818181858888f1935050505015801561130d573d6000803e3d6000fd5b5050565b826001600160a01b038116331461132b5761132b33612b67565b610c8484848461300d565b61133e612792565b601081905560005b81811015610dff5782828281811061136057611360614936565b90506020028101906113729190614995565b6000838152600b6020526040902061138b929091614225565b5080611396816149db565b915050611346565b6113c96040518060800160405280606081526020016060815260200160608152602001606081525090565b6113d2826127f1565b6113ee5760405162461bcd60e51b8152600401610ad5906149f4565b604051633129e77360e01b8152600481018390526000903090633129e77390602401600060405180830381865afa15801561142d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526114559190810190614a67565b6020015160405162d47de760e71b8152600481018590529091506000903090636a3ef38090602401600060405180830381865afa15801561149a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526114c29190810190614b0d565b604051633129e77360e01b8152600481018690529091506000903090633129e77390602401600060405180830381865afa158015611504573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261152c9190810190614a67565b5160408051608081019091529091508061154a858560a08401614bbd565b6040516020818303038152906040528152602001848152602001828152602001838152509350505050919050565b6060816000816001600160401b0381111561159557611595614743565b6040519080825280602002602001820160405280156115ce57816020015b6115bb614299565b8152602001906001900390816115b35790505b50905060005b828114611621576115fc8686838181106115f0576115f0614936565b90506020020135612576565b82828151811061160e5761160e614936565b60209081029190910101526001016115d4565b50949350505050565b600061090f82613028565b60165460609033308114916001600160a01b03161481806116535750805b61166f5760405162461bcd60e51b8152600401610ad590614b79565b600061167961308f565b90506000816116905761168b866130a0565b6116fc565b601654604051622f0dad60e91b8152600481018890526001600160a01b0390911690635e1b5a0090602401602060405180830381865afa1580156116d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116fc9190614b41565b90506000611733604051806040016040528060068152602001650e6eaccccd2f60d31b815250888461172e919061491e565b6130de565b9050600c6000601154836117479190614c0f565b815260200190815260200160002080546117609061489b565b80601f016020809104026020016040519081016040528092919081815260200182805461178c9061489b565b80156117d95780601f106117ae576101008083540402835291602001916117d9565b820191906000526020600020905b8154815290600101906020018083116117bc57829003601f168201915b505050505095505050505050919050565b6117f2612792565b60088054911515600160a81b0260ff60a81b19909216919091179055565b611818612792565b601181905560005b81811015610dff5782828281811061183a5761183a614936565b905060200281019061184c9190614995565b6000838152600c60205260409020611865929091614225565b5080611870816149db565b915050611820565b60006001600160a01b0382166118a1576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b6118ce612792565b6118d86000613112565b565b606060008060006118ea85611878565b90506000816001600160401b0381111561190657611906614743565b60405190808252806020026020018201604052801561192f578160200160208202803683370190505b50905061193a614299565b60005b8386146119b45761194d81613164565b915081604001516119ac5781516001600160a01b03161561196d57815194505b876001600160a01b0316856001600160a01b0316036119ac578083878060010198508151811061199f5761199f614936565b6020026020010181815250505b60010161193d565b50909695505050505050565b6119c8612792565b601780546001600160a01b0319166001600160a01b0392909216919091179055565b60606119f5826127f1565b611a115760405162461bcd60e51b8152600401610ad5906149f4565b60408051610160810191829052633129e77360e01b909152610164810183905261090f908030633129e7736101848301600060405180830381865afa158015611a5e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611a869190810190614a67565b602001518152602001604051806020016040528060008152508152602001306001600160a01b0316636a3ef380866040518263ffffffff1660e01b8152600401611ad291815260200190565b600060405180830381865afa158015611aef573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611b179190810190614b0d565b8152601554604051633129e77360e01b8152600481018790526020909201916001600160a01b039091169063cd5286d0903090633129e77390602401600060405180830381865afa158015611b70573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611b989190810190614a67565b602001516040518263ffffffff1660e01b8152600401611bb89190614397565b600060405180830381865afa158015611bd5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611bfd9190810190614b0d565b8152601554604051633129e77360e01b8152600481018790526020909201916001600160a01b039091169063cd5286d0903090633129e77390602401600060405180830381865afa158015611c56573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611c7e9190810190614a67565b60200151604051602001611c929190614c23565b6040516020818303038152906040526040518263ffffffff1660e01b8152600401611cbd9190614397565b600060405180830381865afa158015611cda573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611d029190810190614b0d565b815260155460405162d47de760e71b8152600481018790526020909201916001600160a01b039091169063cd5286d0903090636a3ef38090602401600060405180830381865afa158015611d5a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611d829190810190614b0d565b6040518263ffffffff1660e01b8152600401611d9e9190614397565b600060405180830381865afa158015611dbb573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611de39190810190614b0d565b8152604080516020818101835260008083529084019190915281830181905260608301526015549051630cd5286d60e41b81526080909201916001600160a01b039091169063cd5286d090611e539060040160208082526004908201526318d85c9960e21b604082015260600190565b600060405180830381865afa158015611e70573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611e989190810190614b0d565b8152601554604051630cd5286d60e41b815260206004808301829052602483015263199bdb9d60e21b6044830152909201916001600160a01b039091169063cd5286d090606401600060405180830381865afa158015611efc573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611f249190810190614b0d565b9052613184565b6008546001600160a01b031690565b611f42612792565b601281905560005b81811015610dff57828282818110611f6457611f64614936565b9050602002810190611f769190614995565b6000838152600d60205260409020611f8f929091614225565b5080611f9a816149db565b915050611f4a565b60165460609033308114916001600160a01b0316148180611fc05750805b611fdc5760405162461bcd60e51b8152600401610ad590614b79565b6000611fe661308f565b9050600081611ffd57611ff8866130a0565b612069565b601654604051622f0dad60e91b8152600481018890526001600160a01b0390911690635e1b5a0090602401602060405180830381865afa158015612045573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120699190614b41565b9050600061209b604051806040016040528060068152602001650e0e4caccd2f60d31b815250888461172e919061491e565b9050600b6000601054836117479190614c0f565b60606003805461094e9061489b565b60608183106120e057604051631960ccad60e11b815260040160405180910390fd5b6000806120ec60005490565b9050808411156120fa578093505b600061210587611878565b905084861015612124578585038181101561211e578091505b50612128565b5060005b6000816001600160401b0381111561214257612142614743565b60405190808252806020026020018201604052801561216b578160200160208202803683370190505b5090508160000361218157935061223092505050565b600061218c88612576565b90506000816040015161219d575080515b885b8881141580156121af5750848714155b15612224576121bd81613164565b9250826040015161221c5782516001600160a01b0316156121dd57825191505b8a6001600160a01b0316826001600160a01b03160361221c578084888060010199508151811061220f5761220f614936565b6020026020010181815250505b60010161219f565b50505092835250909150505b9392505050565b8161224181612b67565b610dff8383613547565b6040516370a0823160e01b815260009030906370a08231906122719033906004016143c3565b602060405180830381865afa15801561228e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122b29190614b41565b9050600030638462151c336040518263ffffffff1660e01b81526004016122d991906143c3565b600060405180830381865afa1580156122f6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261231e9190810190614c50565b905060005b82811015610c845761234f338584848151811061234257612342614936565b602002602001015161300d565b80612359816149db565b915050612323565b60165460009033308114916001600160a01b031614818061237f5750805b61239b5760405162461bcd60e51b8152600401610ad590614b79565b604051633129e77360e01b8152600481018590526000903090633129e77390602401600060405180830381865afa1580156123da573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526124029190810190614a67565b60200151905060005b60125481101561253d576000818152600d6020526040902080546124d691906124339061489b565b80601f016020809104026020016040519081016040528092919081815260200182805461245f9061489b565b80156124ac5780601f10612481576101008083540402835291602001916124ac565b820191906000526020600020905b81548152906001019060200180831161248f57829003601f168201915b5050505050836040516020016124c29190614c23565b6040516020818303038152906040526135b3565b1561252b5760006125116040518060400160405280600481526020016372306e3160e01b815250886125078a612fb9565b61172e919061491e565b90506000612520600783614c0f565b1495505050506112bf565b80612535816149db565b91505061240b565b50600095945050505050565b836001600160a01b03811633146125635761256333612b67565b61256f8585858561360c565b5050505050565b61257e614299565b612586614299565b60005483106125955792915050565b61259e83613164565b90508060400151156125b05792915050565b61223083613650565b6125c1612792565b60088054911515600160a01b0260ff60a01b19909216919091179055565b60606125ea826127f1565b6126065760405162461bcd60e51b8152600401610ad5906149f4565b604051633129e77360e01b81526004810183905261090f903090633129e77390602401600060405180830381865afa158015612646573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261266e9190810190614a67565b60405162d47de760e71b8152600481018590523090636a3ef38090602401600060405180830381865afa1580156126a9573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526126d19190810190614b0d565b604051806020016040528060008152506000806126ed886119ea565b613669565b6126fa612792565b601680546001600160a01b0319166001600160a01b0392909216919091179055565b612724612792565b6001600160a01b0381166127895760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610ad5565b61112481613112565b3361279b611f2b565b6001600160a01b0316146118d85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ad5565b600080548210801561090f575050600090815260046020526040902054600160e01b161590565b600061283c8383600081811061283057612830614936565b90506020020135612fb9565b905060006128568484600181811061283057612830614936565b905060006128708585600281811061283057612830614936565b9050818314801561288057508083145b6128d65760405162461bcd60e51b815260206004820152602160248201527f416c6c206974656d732073686f756c64206265206f6620657175616c207479706044820152606560f81b6064820152608401610ad5565b60005b60028111610b4457336129038787848181106128f7576128f7614936565b9050602002013561162a565b6001600160a01b0316146129495760405162461bcd60e51b815260206004820152600d60248201526c2737ba103cb7bab91033b2b0b960991b6044820152606401610ad5565b61296a86868381811061295e5761295e614936565b90506020020135613809565b80612974816149db565b9150506128d9565b60006129fd3360405160609190911b6001600160601b031916602082015260348101879052605481018690526074016040516020818303038152906040528051906020012084848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061381492505050565b6001600160a01b0316866001600160a01b031614905095945050505050565b600854600160a81b900460ff16612a735760405162461bcd60e51b815260206004820152601b60248201527a546865206465616c6572206973206e6f7420617661696c61626c6560281b6044820152606401610ad5565b600a811115612ac45760405162461bcd60e51b815260206004820152601d60248201527f43616e6e6f74206d696e742074686174206d616e79206174206f6e63650000006044820152606401610ad5565b612ad1600661115c614b5a565b612aec612adf600684614b5a565b6001546000540390613838565b1115612b345760405162461bcd60e51b8152602060048201526017602482015276139bdd08195b9bdd59da081b19599d081d1bc81b5a5b9d604a1b6044820152606401610ad5565b4260146000612b4260005490565b815260208101919091526040016000205561112433612b62600684614b5a565b613844565b6daaeb6d7670e522a718067333cd4e3b1561112457604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015612bd4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bf89190614cf5565b6111245780604051633b79c77360e21b8152600401610ad591906143c3565b6000612c2282613028565b9050836001600160a01b0316816001600160a01b031614612c555760405162a1148160e81b815260040160405180910390fd5b60008281526006602052604090208054612c818187335b6001600160a01b039081169116811491141790565b612cac57612c8f8633610855565b612cac57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516612cd357604051633a954ecd60e21b815260040160405180910390fd5b8015612cde57600082555b6001600160a01b03868116600090815260056020526040808220805460001901905591871681522080546001019055612d1b85600160e11b61385e565b600085815260046020526040812091909155600160e11b84169003612d7057600184016000818152600460205260408120549003612d6e576000548114612d6e5760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b0316600080516020615b6283398151915260405160405180910390a4610b44565b606060008260800151612dc65760405180602001604052806000815250612e3d565b612e3d604051806040016040528060018152602001600360fc1b815250604051806040016040528060018152602001600360fc1b815250604051806040016040528060028152602001610d8d60f21b815250604051806040016040528060028152602001610d8d60f21b8152508760400151613873565b612eb4604051806040016040528060018152602001600360fc1b815250604051806040016040528060018152602001600360fc1b815250604051806040016040528060028152602001610d8d60f21b815250604051806040016040528060028152602001610d8d60f21b8152508860000151613873565b8460600151612ed25760405180602001604052806000815250612f49565b612f49604051806040016040528060018152602001600360fc1b815250604051806040016040528060018152602001600360fc1b815250604051806040016040528060028152602001610d8d60f21b815250604051806040016040528060028152602001610d8d60f21b8152508960200151613873565b604051602001612f5b93929190614d12565b60408051601f1981840301815290829052612f7891602001614d55565b6040516020818303038152906040529050612f92816138a8565b604051602001612fa29190614f0e565b604051602081830303815290604052915050919050565b600080612fc5836130a0565b90506000612ff5604051806040016040528060048152602001636974656d60e01b815250858461172e919061491e565b9050600f54816130059190614c0f565b949350505050565b610dff83838360405180602001604052806000815250612549565b6000816000548110156130765760008181526004602052604081205490600160e01b82169003613074575b80600003612230575060001901600081815260046020526040902054613053565b505b604051636f96cda160e11b815260040160405180910390fd5b6016546001600160a01b0316331490565b6000815b600081815260146020526040902054156130cc57505060009081526014602052604090205490565b806130d681614f50565b9150506130a4565b600082826040516020016130f3929190614f67565b60408051601f1981840301815291905280516020909101209392505050565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b61316c614299565b60008281526004602052604090205461090f906139fa565b606060008261014001516131c0846000015185604001516040516020016131ac929190614bbd565b604051602081830303815290604052613a3d565b6040516020016131d1929190614f89565b6040516020818303038152906040528361010001516131ff5760405180602001604052806000815250613277565b613277604051806040016040528060018152602001601b60f91b81525060405180604001604052806002815260200161062760f31b815250604051806040016040528060028152602001610d8d60f21b815250604051806040016040528060028152602001610d8d60f21b8152508860c00151613873565b6132f0604051806040016040528060018152602001600360fc1b815250604051806040016040528060018152602001600360fc1b815250604051806040016040528060028152602001611b9b60f11b815250604051806040016040528060038152602001620c4c4d60ea1b815250896101200151613873565b613368604051806040016040528060018152602001601b60f91b81525060405180604001604052806002815260200161062760f31b815250604051806040016040528060028152602001610d8d60f21b815250604051806040016040528060028152602001610d8d60f21b8152508a60600151613873565b6133e060405180604001604052806002815260200161033360f41b815250604051806040016040528060018152602001600360fc1b81525060405180604001604052806002815260200161189b60f11b81525060405180604001604052806002815260200161189960f11b8152508b60a00151613873565b8760e001516133fe5760405180602001604052806000815250613476565b613476604051806040016040528060018152602001601b60f91b81525060405180604001604052806002815260200161062760f31b815250604051806040016040528060028152602001610d8d60f21b815250604051806040016040528060028152602001610d8d60f21b8152508c60800151613873565b60405160200161348a9594939291906150e8565b6040516020818303038152906040528460e001516134eb57845160408087015190516134ba929190602001614bbd565b60408051601f19818403018152908290526134d791602001615153565b604051602081830303815290604052613535565b6020808601518651604080890151905192936135079301614bbd565b60408051601f198184030181529082905261352592916020016151dc565b6040516020818303038152906040525b604051602001612f78939291906152d0565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6000816040516020016135c69190615486565b60405160208183030381529060405280519060200120836040516020016135ed9190615486565b6040516020818303038152906040528051906020012014905092915050565b613617848484610e04565b6001600160a01b0383163b15610c845761363384848484613a8a565b610c84576040516368d2bf6b60e11b815260040160405180910390fd5b613658614299565b61090f61366483613028565b6139fa565b60208601518651606091906000866136a257828960405160200161368e9291906154a2565b6040516020818303038152906040526136c7565b87838a6040516020016136b793929190615503565b6040516020818303038152906040525b83886136e25760405180602001604052806000815250613703565b896040516020016136f39190615582565b6040516020818303038152906040525b8b858b801561370f57508a5b613728576040518060200160405280600081525061378d565b8a61374f57604051806040016040528060048152602001634e6f6e6560e01b81525061376d565b6040518060400160405280600481526020016352304e3160e01b8152505b60405160200161377d91906155e0565b6040516020818303038152906040525b6040516020016137a195949392919061563d565b60408051601f19818403018152908290526137c19291889060200161574b565b60405160208183030381529060405290506137db816138a8565b6040516020016137eb919061587e565b60405160208183030381529060405293505050509695505050505050565b611124816000613b75565b60008060006138238585613ca7565b9150915061383081613cec565b509392505050565b6000612230828461491e565b61130d828260405180602001604052806000815250613e31565b4260a01b176001600160a01b03919091161790565b6060858585858560405160200161388e9594939291906158c3565b604051602081830303815290604052905095945050505050565b606081516000036138c757505060408051602081019091526000815290565b6000604051806060016040528060408152602001615b0260409139905060006003845160026138f6919061491e565b6139009190615a01565b61390b906004614b5a565b6001600160401b0381111561392257613922614743565b6040519080825280601f01601f19166020018201604052801561394c576020820181803683370190505b509050600182016020820185865187015b808210156139b8576003820191508151603f8160121c168501518453600184019350603f81600c1c168501518453600184019350603f8160061c168501518453600184019350603f811685015184535060018301925061395d565b50506003865106600181146139d457600281146139e7576139ef565b603d6001830353603d60028303536139ef565b603d60018303535b509195945050505050565b613a02614299565b6001600160a01b03821681526001600160401b0360a083901c166020820152600160e01b82161515604082015260e89190911c606082015290565b8051606090602190600490819083811115613a5757600391505b613a6082613e97565b604051602001613a709190615a15565b604051602081830303815290604052945050505050919050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290613abf903390899088908890600401615a3b565b6020604051808303816000875af1925050508015613afa575060408051601f3d908101601f19168201909252613af791810190615a6e565b60015b613b58573d808015613b28576040519150601f19603f3d011682016040523d82523d6000602084013e613b2d565b606091505b508051600003613b50576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b6000613b8083613028565b905080600080613b9e86600090815260066020526040902080549091565b915091508415613bde57613bb3818433612c6c565b613bde57613bc18333610855565b613bde57604051632ce44b5f60e11b815260040160405180910390fd5b8015613be957600082555b6001600160a01b038316600090815260056020526040902080546001600160801b03019055613c1c83600360e01b61385e565b600087815260046020526040812091909155600160e11b85169003613c7157600186016000818152600460205260408120549003613c6f576000548114613c6f5760008181526004602052604090208590555b505b60405186906000906001600160a01b03861690600080516020615b62833981519152908390a45050600180548101905550505050565b6000808251604103613cdd5760208301516040840151606085015160001a613cd187828585613f29565b94509450505050613ce5565b506000905060025b9250929050565b6000816004811115613d0057613d00615a8b565b03613d085750565b6001816004811115613d1c57613d1c615a8b565b03613d645760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b6044820152606401610ad5565b6002816004811115613d7857613d78615a8b565b03613dc55760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610ad5565b6003816004811115613dd957613dd9615a8b565b036111245760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610ad5565b613e3b8383613fe3565b6001600160a01b0383163b15610dff576000548281035b613e656000868380600101945086613a8a565b613e82576040516368d2bf6b60e11b815260040160405180910390fd5b818110613e5257816000541461256f57600080fd5b60606000613ea4836140cb565b60010190506000816001600160401b03811115613ec357613ec3614743565b6040519080825280601f01601f191660200182016040528015613eed576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084613ef757509392505050565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b03831115613f565750600090506003613fda565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613faa573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116613fd357600060019250925050613fda565b9150600090505b94509492505050565b60008054908290036140085760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b038316600090815260056020526040902080546001600160401b01840201905561403f836001841460e11b61385e565b6000828152600460205260408120919091556001600160a01b038416908383019083908390600080516020615b628339815191528180a4600183015b8181146140a15780836000600080516020615b62833981519152600080a460010161407b565b50816000036140c257604051622e076360e81b815260040160405180910390fd5b60005550505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b831061410a5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6904ee2d6d415b85acef8160201b8310614134576904ee2d6d415b85acef8160201b830492506020015b662386f26fc10000831061415257662386f26fc10000830492506010015b6305f5e100831061416a576305f5e100830492506008015b612710831061417e57612710830492506004015b60648310614190576064830492506002015b600a831061090f5760010192915050565b8280546141ad9061489b565b90600052602060002090601f0160209004810192826141cf5760008555614215565b82601f106141e857805160ff1916838001178555614215565b82800160010185558215614215579182015b828111156142155782518255916020019190600101906141fa565b506142219291506142c0565b5090565b8280546142319061489b565b90600052602060002090601f0160209004810192826142535760008555614215565b82601f1061426c5782800160ff19823516178555614215565b82800160010185558215614215579182015b8281111561421557823582559160200191906001019061427e565b60408051608081018252600080825260208201819052918101829052606081019190915290565b5b8082111561422157600081556001016142c1565b6001600160e01b03198116811461112457600080fd5b6000602082840312156142fd57600080fd5b8135612230816142d5565b80356001600160a01b038116811461431f57600080fd5b919050565b60006020828403121561433657600080fd5b61223082614308565b60005b8381101561435a578181015183820152602001614342565b83811115610c845750506000910152565b6000815180845261438381602086016020860161433f565b601f01601f19169290920160200192915050565b602081526000612230602083018461436b565b6000602082840312156143bc57600080fd5b5035919050565b6001600160a01b0391909116815260200190565b600080604083850312156143ea57600080fd5b6143f383614308565b946020939093013593505050565b60008083601f84011261441357600080fd5b5081356001600160401b0381111561442a57600080fd5b6020830191508360208260051b8501011115613ce557600080fd5b6000806020838503121561445857600080fd5b82356001600160401b0381111561446e57600080fd5b61447a85828601614401565b90969095509350505050565b6000806000806060858703121561449c57600080fd5b843593506020850135925060408501356001600160401b03808211156144c157600080fd5b818701915087601f8301126144d557600080fd5b8135818111156144e457600080fd5b8860208285010111156144f657600080fd5b95989497505060200194505050565b60008060006060848603121561451a57600080fd5b61452384614308565b925061453160208501614308565b9150604084013590509250925092565b60208152600082516040602084015261455d606084018261436b565b90506020840151601f1984830301604085015261457a828261436b565b95945050505050565b60208152600082516080602084015261459f60a084018261436b565b90506020840151601f19808584030160408601526145bd838361436b565b925060408601519150808584030160608601526145da838361436b565b925060608601519150808584030160808601525061457a828261436b565b80516001600160a01b031682526020808201516001600160401b03169083015260408082015115159083015260609081015162ffffff16910152565b6020808252825182820181905260009190848201906040850190845b818110156119b4576146638385516145f8565b9284019260809290920191600101614650565b801515811461112457600080fd5b60006020828403121561469657600080fd5b813561223081614676565b6020808252825182820181905260009190848201906040850190845b818110156119b4578351835292840192918401916001016146bd565b6000806000606084860312156146ee57600080fd5b6146f784614308565b95602085013595506040909401359392505050565b6000806040838503121561471f57600080fd5b61472883614308565b9150602083013561473881614676565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561478157614781614743565b604052919050565b60006001600160401b038211156147a2576147a2614743565b50601f01601f191660200190565b600080600080608085870312156147c657600080fd5b6147cf85614308565b93506147dd60208601614308565b92506040850135915060608501356001600160401b038111156147ff57600080fd5b8501601f8101871361481057600080fd5b803561482361481e82614789565b614759565b81815288602083850101111561483857600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b6080810161090f82846145f8565b6000806040838503121561487b57600080fd5b61488483614308565b915061489260208401614308565b90509250929050565b600181811c908216806148af57607f821691505b6020821081036148cf57634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252601990820152784e656564207468726565206974656d7320746f20666f72676560381b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000821982111561493157614931614908565b500190565b634e487b7160e01b600052603260045260246000fd5b6000808335601e1984360301811261496357600080fd5b8301803591506001600160401b0382111561497d57600080fd5b6020019150600581901b3603821315613ce557600080fd5b6000808335601e198436030181126149ac57600080fd5b8301803591506001600160401b038211156149c657600080fd5b602001915036819003821315613ce557600080fd5b6000600182016149ed576149ed614908565b5060010190565b602080825260149082015273151bdad95b88191bd95cc81b9bdd08195e1a5cdd60621b604082015260600190565b600082601f830112614a3357600080fd5b8151614a4161481e82614789565b818152846020838601011115614a5657600080fd5b61300582602083016020870161433f565b600060208284031215614a7957600080fd5b81516001600160401b0380821115614a9057600080fd5b9083019060408286031215614aa457600080fd5b604051604081018181108382111715614abf57614abf614743565b604052825182811115614ad157600080fd5b614add87828601614a22565b825250602083015182811115614af257600080fd5b614afe87828601614a22565b60208301525095945050505050565b600060208284031215614b1f57600080fd5b81516001600160401b03811115614b3557600080fd5b61300584828501614a22565b600060208284031215614b5357600080fd5b5051919050565b6000816000190483118215151615614b7457614b74614908565b500290565b6020808252600e908201526d2ab735b737bbb71031b0b63632b960911b604082015260600190565b60008151614bb381856020860161433f565b9290920192915050565b60008351614bcf81846020880161433f565b600160fd1b9083019081528351614bed81600184016020880161433f565b01600101949350505050565b634e487b7160e01b600052601260045260246000fd5b600082614c1e57614c1e614bf9565b500690565b64029182718960dd1b815260008251614c4381600585016020870161433f565b9190910160050192915050565b60006020808385031215614c6357600080fd5b82516001600160401b0380821115614c7a57600080fd5b818501915085601f830112614c8e57600080fd5b815181811115614ca057614ca0614743565b8060051b9150614cb1848301614759565b8181529183018401918481019088841115614ccb57600080fd5b938501935b83851015614ce957845182529385019390850190614cd0565b98975050505050505050565b600060208284031215614d0757600080fd5b815161223081614676565b60008451614d2481846020890161433f565b845190830190614d3881836020890161433f565b8451910190614d4b81836020880161433f565b0195945050505050565b600080516020615ae28339815191528152600080516020615b428339815191526020820152600080516020615aa28339815191526040820152600080516020615ac283398151915260608201527f313939392f7868746d6c272077696474683d2736343027206865696768743d2760808201527f36343027207072657365727665417370656374526174696f3d27784d6964594d60a08201527f6964206d656574272076696577426f783d27302030203634203634272073747960c08201527f6c653d277374726f6b652d77696474683a303b206261636b67726f756e642d6360e08201527f6f6c6f723a68736c28302c30252c3025293b206d617267696e3a206175746f3b6101008201527f6865696768743a202d7765626b69742d66696c6c2d617661696c61626c65273e6101208201527f3c7374796c6520747970653d27746578742f637373273e2e706978656c6174656101408201527f64207b20696d6167652d72656e646572696e673a20706978656c617465643b20610160820152683e9e17b9ba3cb6329f60b91b6101808201526000612230614efc610189840185614ba1565b651e17b9bb339f60d11b815260060190565b7919185d184e9a5b5859d94bdcdd99cade1b5b0ed8985cd94d8d0b60321b815260008251614f4381601a85016020870161433f565b91909101601a0192915050565b600081614f5f57614f5f614908565b506000190190565b60008351614f7981846020880161433f565b9190910191825250602001919050565b761e39ba3cb632903a3cb8329e93ba32bc3a17b1b9b9939f60491b81527f40666f6e742d66616365207b20666f6e742d66616d696c793a2047656172466f60178201526d6e743b207372633a2075726c282760901b603782015260008351614ff881604585016020880161433f565b6427293b207d60d81b6045918401918201527f2e706978656c61746564207b20696d6167652d72656e646572696e673a207069604a8201526978656c617465643b207d60b01b606a8201527f2e6e616d65207b20666f6e742d66616d696c793a2047656172466f6e743b2066607482015269037b73a16b9b4bd329d160b51b6094820152835161508f81609e84016020880161433f565b7f3b20746578742d7472616e73666f726d3a207570706572636173653b2066696c9101609e8101919091526a6c3a20626c61636b3b207d60a81b60be820152671e17b9ba3cb6329f60c11b60c982015260d1810161457a565b600086516150fa818460208b0161433f565b86519083019061510e818360208b0161433f565b8651910190615121818360208a0161433f565b855191019061513481836020890161433f565b845191019061514781836020880161433f565b01979650505050505050565b7f3c7465787420783d273530252720793d273130342e35302720746578742d616e8152600080516020615b8283398151915260208201527513b6b4b2323632939031b630b9b99e93b730b6b2939f60511b6040820152600082516151be81605685016020870161433f565b661e17ba32bc3a1f60c91b6056939091019283015250605d01919050565b7f3c7465787420783d273530252720793d273130332e35302720746578742d616e81526000600080516020615b828339815191528060208401527513b137ba3a37b6939031b630b9b99e93b730b6b2939f60511b6040840152845161524881605686016020890161433f565b8084019050661e17ba32bc3a1f60c91b8060568301527f3c7465787420783d273530252720793d273130362e37352720746578742d616e605d83015282607d8301527213ba37b8139031b630b9b99e93b730b6b2939f60691b609d830152855192506152bb8360b084016020890161433f565b910160b081019190915260b701949350505050565b600080516020615ae28339815191528152600080516020615b428339815191526020820152600080516020615aa28339815191526040820152600080516020615ac283398151915260608201527f313939392f7868746d6c272077696474683d2737363027206865696768743d2760808201527f3131343027207072657365727665417370656374526174696f3d27784d69645960a08201527f4d6964206d656574272076696577426f783d273020302037362031313427207360c08201527f74796c653d277374726f6b652d77696474683a303b206261636b67726f756e6460e08201527f2d636f6c6f723a68736c28302c30252c3025293b206d617267696e3a206175746101008201527f6f3b6865696768743a202d7765626b69742d66696c6c2d617661696c61626c6561012082015261139f60f11b610140820152600061457a614efc61548061547a61542b61014287018a614ba1565b7f3c726563742077696474683d273130302527206865696768743d27313030252781527f20783d27302720793d2730272066696c6c3d272338383765383827202f3e00006020820152603e0190565b87614ba1565b85614ba1565b6000825161549881846020870161433f565b9190910192915050565b68113730b6b2911d101160b91b815282516000906154c781600985016020880161433f565b600160fd1b60099184019182015283516154e881600a84016020880161433f565b61088b60f21b600a9290910191820152600c01949350505050565b68113730b6b2911d101160b91b8152835160009061552881600985016020890161433f565b8083019050600160fd1b806009830152855161554b81600a850160208a0161433f565b600a920191820152835161556681600b84016020880161433f565b61088b60f21b600b9290910191820152600d0195945050505050565b7f7b2274726169745f74797065223a2022507265666978222c202276616c7565228152621d101160e91b6020820152600082516155c681602385016020870161433f565b62089f4b60ea1b6023939091019283015250602601919050565b7f2c7b2274726169745f74797065223a20224578747261222c202276616c7565228152621d101160e91b60208201526000825161562481602385016020870161433f565b61227d60f01b6023939091019283015250602501919050565b7f7b2274726169745f74797065223a20224e616d65222c202276616c7565223a208152601160f91b60208201526000865161567f816021850160208b0161433f565b62089f4b60ea1b602191840191820181905287516156a4816024850160208c0161433f565b7f7b2274726169745f74797065223a2022537566666978222c202276616c75652260249390910192830152621d101160e91b604483015286516156ee816047850160208b0161433f565b60479201918201527f7b2274726169745f74797065223a202243617465676f7279222c202276616c75604a8201526432911d101160d91b606a820152614ce961548061573d606f840188614ba1565b61227d60f01b815260020190565b607b60f81b81526000845161576781600185016020890161433f565b7f226465736372697074696f6e223a2022497420676f7420656d70747920696e206001918401918201527f7468652076656e74732061667465722030424552314e2068616420676f6e652060218201527f6d697373696e672e20546865206e65656420666f7220776561706f6e7320616e60418201527f642061726d6f72206973206e6f772067726561746572207468616e20697420656061820152691d995c881dd85ccb888b60b21b60818201526e2261747472696275746573223a205b60881b608b820152845161584181609a84016020890161433f565b61174b60f21b9101609a810191909152691134b6b0b3b2911d101160b11b609c82015261587461573d60a6830186614ba1565b9695505050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000008152600082516158b681601d85016020870161433f565b91909101601d0192915050565b713c666f726569676e4f626a65637420783d2760701b81526000865160206158f18260128601838c0161433f565b642720793d2760d81b60129285019283015287516159158160178501848c0161433f565b68272077696474683d2760b81b60179390910192830152865161593d81838501848b0161433f565b6927206865696768743d2760b01b920181810192909252855161596681602a850189850161433f565b61139f60f11b602a9390910192830152507f3c7868746d6c3a696d6720636c6173733d27706978656c617465642720776964602c8201527f74683d273130302527206865696768743d273130302527207372633d27000000604c820152614ce96159e56159d66069840187614ba1565b6213979f60e91b815260030190565b6f1e17b337b932b4b3b727b13532b1ba1f60811b815260100190565b600082615a1057615a10614bf9565b500490565b60008251615a2781846020870161433f565b610e0f60f31b920191825250600201919050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906158749083018461436b565b600060208284031215615a8057600080fd5b8151612230816142d5565b634e487b7160e01b600052602160045260246000fdfe6b3d27687474703a2f2f7777772e77332e6f72672f313939392f786c696e6b2720786d6c6e733a7868746d6c3d27687474703a2f2f7777772e77332e6f72672f3c7376672076657273696f6e3d27312e312720786d6c6e733d27687474703a2f4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f2f7777772e77332e6f72672f323030302f7376672720786d6c6e733a786c696eddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef63686f723d276d6964646c652720646f6d696e616e742d626173656c696e653da26469706673582212208312c2835886e4ee17ae141ac387dc03a2b0e0979bbb6ded3ae2c48fb1feb56664736f6c634300080d0033000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000008948ea37a3121f2419e2f83a7bd2c35daf611d730000000000000000000000003bf2922f4520a8ba0c2efc3d2a1539678dad5e9d0000000000000000000000000000000000000000000000000000000000000011546163746963616c20304e312047656172000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c544143544943414c474541520000000000000000000000000000000000000000
Deployed Bytecode
0x6080604052600436106102445760003560e01c806301ffc9a714610249578063046dc1661461027e57806306fdde03146102a0578063081812fc146102c2578063095ea7b3146102ef57806318160ddd146103025780631c9848c114610325578063207f32421461034557806322ca5aeb1461036557806323b872dd146103855780632607aafa146103985780632c60b29b146103b85780632ce64201146103cd5780632dafdd87146104035780632db11544146104235780633129e7731461043657806332cb6b0c146104635780633ccfd60b1461047857806341f434341461048d57806342842e0e146104af57806350e08459146104c25780635454d388146104e25780635bbb21771461050f5780636352211e1461053c5780636a3ef3801461055c5780636c0ab2be1461057c5780636c10e5681461059c578063701a6b77146105bc57806370a08231146105dd578063715018a6146105fd57806376c2f611146106125780638462151c146106275780638ac06d39146106545780638b89ad89146106745780638d859f3e146106945780638da5cb5b146106af5780638de30be0146106c45780639414b902146106e457806395364a841461070457806395d89b411461072557806399a2557a1461073a578063a22cb4651461075a578063a3a7e7f31461077a578063a67fdc731461079a578063b88d4fde146107ba578063c23dc68f146107cd578063c54e73e3146107fa578063c87b56dd1461081a578063e985e9c51461083a578063ea2cfe2214610883578063f2fde38b146108a3575b600080fd5b34801561025557600080fd5b506102696102643660046142eb565b6108c3565b60405190151581526020015b60405180910390f35b34801561028a57600080fd5b5061029e610299366004614324565b610915565b005b3480156102ac57600080fd5b506102b561093f565b6040516102759190614397565b3480156102ce57600080fd5b506102e26102dd3660046143aa565b6109d1565b60405161027591906143c3565b61029e6102fd3660046143d7565b610a15565b34801561030e57600080fd5b50600154600054035b604051908152602001610275565b34801561033157600080fd5b5061029e610340366004614445565b610ab5565b34801561035157600080fd5b5061029e610360366004614486565b610b4c565b34801561037157600080fd5b5061029e610380366004614445565b610c8a565b61029e610393366004614505565b610e04565b3480156103a457600080fd5b506102b56103b33660046143aa565b610e29565b3480156103c457600080fd5b50610317600a81565b3480156103d957600080fd5b506103176103e8366004614324565b6001600160a01b03166000908152600e602052604090205490565b34801561040f57600080fd5b5061029e61041e366004614445565b610f7d565b61029e6104313660046143aa565b611006565b34801561044257600080fd5b506104566104513660046143aa565b611127565b6040516102759190614541565b34801561046f57600080fd5b506103176112c6565b34801561048457600080fd5b5061029e6112d6565b34801561049957600080fd5b506102e26daaeb6d7670e522a718067333cd4e81565b61029e6104bd366004614505565b611311565b3480156104ce57600080fd5b5061029e6104dd366004614445565b611336565b3480156104ee57600080fd5b506105026104fd3660046143aa565b61139e565b6040516102759190614583565b34801561051b57600080fd5b5061052f61052a366004614445565b611578565b6040516102759190614634565b34801561054857600080fd5b506102e26105573660046143aa565b61162a565b34801561056857600080fd5b506102b56105773660046143aa565b611635565b34801561058857600080fd5b5061029e610597366004614684565b6117ea565b3480156105a857600080fd5b5061029e6105b7366004614445565b611810565b3480156105c857600080fd5b5060085461026990600160a81b900460ff1681565b3480156105e957600080fd5b506103176105f8366004614324565b611878565b34801561060957600080fd5b5061029e6118c6565b34801561061e57600080fd5b50610317600681565b34801561063357600080fd5b50610647610642366004614324565b6118da565b60405161027591906146a1565b34801561066057600080fd5b5061029e61066f366004614324565b6119c0565b34801561068057600080fd5b506102b561068f3660046143aa565b6119ea565b3480156106a057600080fd5b506103176658d15e1762800081565b3480156106bb57600080fd5b506102e2611f2b565b3480156106d057600080fd5b5061029e6106df366004614445565b611f3a565b3480156106f057600080fd5b506102b56106ff3660046143aa565b611fa2565b34801561071057600080fd5b5060085461026990600160a01b900460ff1681565b34801561073157600080fd5b506102b56120af565b34801561074657600080fd5b506106476107553660046146d9565b6120be565b34801561076657600080fd5b5061029e61077536600461470c565b612237565b34801561078657600080fd5b5061029e610795366004614324565b61224b565b3480156107a657600080fd5b506102696107b53660046143aa565b612361565b61029e6107c83660046147b0565b612549565b3480156107d957600080fd5b506107ed6107e83660046143aa565b612576565b604051610275919061485a565b34801561080657600080fd5b5061029e610815366004614684565b6125b9565b34801561082657600080fd5b506102b56108353660046143aa565b6125df565b34801561084657600080fd5b50610269610855366004614868565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b34801561088f57600080fd5b5061029e61089e366004614324565b6126f2565b3480156108af57600080fd5b5061029e6108be366004614324565b61271c565b60006301ffc9a760e01b6001600160e01b0319831614806108f457506380ac58cd60e01b6001600160e01b03198316145b8061090f5750635b5e139f60e01b6001600160e01b03198316145b92915050565b61091d612792565b600980546001600160a01b0319166001600160a01b0392909216919091179055565b60606002805461094e9061489b565b80601f016020809104026020016040519081016040528092919081815260200182805461097a9061489b565b80156109c75780601f1061099c576101008083540402835291602001916109c7565b820191906000526020600020905b8154815290600101906020018083116109aa57829003601f168201915b5050505050905090565b60006109dc826127f1565b6109f9576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b6000610a208261162a565b9050336001600160a01b03821614610a5957610a3c8133610855565b610a59576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b60038114610ade5760405162461bcd60e51b8152600401610ad5906148d5565b60405180910390fd5b610ae88282612818565b6017546001600160a01b0316634e5a5178336040518263ffffffff1660e01b8152600401610b1691906143c3565b600060405180830381600087803b158015610b3057600080fd5b505af1158015610b44573d6000803e3d6000fd5b505050505050565b600854600160a01b900460ff16610b955760405162461bcd60e51b815260206004820152600d60248201526c141c995cd85b1948195b991959609a1b6044820152606401610ad5565b600954610bae906001600160a01b03168486858561297c565b610bee5760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964207369676e617475726560781b6044820152606401610ad5565b336000908152600e60205260409020548390610c0b90869061491e565b1115610c565760405162461bcd60e51b815260206004820152601a602482015279165bdd481a185d99481c995858da1959081d1a19481b1a5b5a5d60321b6044820152606401610ad5565b336000908152600e602052604081208054869290610c7590849061491e565b90915550610c84905084612a1c565b50505050565b610c92612792565b600f81905560005b81811015610dff576040518060400160405280848484818110610cbf57610cbf614936565b9050602002810190610cd1919061494c565b6000818110610ce257610ce2614936565b9050602002810190610cf49190614995565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250602001848484818110610d4057610d40614936565b9050602002810190610d52919061494c565b6001818110610d6357610d63614936565b9050602002810190610d759190614995565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920182905250939094525050838152600a6020908152604090912083518051919350610dcf9284929101906141a1565b506020828101518051610de892600185019201906141a1565b509050508080610df7906149db565b915050610c9a565b505050565b826001600160a01b0381163314610e1e57610e1e33612b67565b610c84848484612c17565b6060610e34826127f1565b610e505760405162461bcd60e51b8152600401610ad5906149f4565b6040805160a0810191829052601554633129e77360e01b90925260a4810184905261090f9181906001600160a01b031663cd5286d030633129e77360c48501600060405180830381865afa158015610eac573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610ed49190810190614a67565b602001516040518263ffffffff1660e01b8152600401610ef49190614397565b600060405180830381865afa158015610f11573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610f399190810190614b0d565b815260200160405180602001604052806000815250815260200160405180602001604052806000815250815260200160001515815260200160001515815250612da4565b60038114610f9d5760405162461bcd60e51b8152600401610ad5906148d5565b610fa78282612818565b6016546001600160a01b031663641cc9d43384846000818110610fcc57610fcc614936565b6040516001600160e01b031960e087901b1681526001600160a01b0390941660048501526020029190910135602483015250604401610b16565b6018546040516370a0823160e01b81526001600160a01b03909116906370a08231906110369033906004016143c3565b602060405180830381865afa158015611053573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110779190614b41565b6000036110c45760405162461bcd60e51b815260206004820152601b60248201527a53686f756c64206f776e206174206c65617374206f6e6520306e3160281b6044820152606401610ad5565b6110d56658d15e1762800082614b5a565b341461111b5760405162461bcd60e51b8152602060048201526015602482015274092dcecc2d8d2c840c2dadeeadce840decc408aa89605b1b6044820152606401610ad5565b61112481612a1c565b50565b604080518082019091526060808252602082015260165433308114916001600160a01b03161481806111565750805b6111725760405162461bcd60e51b8152600401610ad590614b79565b600a600061117f86612fb9565b81526020019081526020016000206040518060400160405290816000820180546111a89061489b565b80601f01602080910402602001604051908101604052809291908181526020018280546111d49061489b565b80156112215780601f106111f657610100808354040283529160200191611221565b820191906000526020600020905b81548152906001019060200180831161120457829003601f168201915b5050505050815260200160018201805461123a9061489b565b80601f01602080910402602001604051908101604052809291908181526020018280546112669061489b565b80156112b35780601f10611288576101008083540402835291602001916112b3565b820191906000526020600020905b81548152906001019060200180831161129657829003601f168201915b50505050508152505092505b5050919050565b6112d3600661115c614b5a565b81565b6112de612792565b6040514790339082156108fc029083906000818181858888f1935050505015801561130d573d6000803e3d6000fd5b5050565b826001600160a01b038116331461132b5761132b33612b67565b610c8484848461300d565b61133e612792565b601081905560005b81811015610dff5782828281811061136057611360614936565b90506020028101906113729190614995565b6000838152600b6020526040902061138b929091614225565b5080611396816149db565b915050611346565b6113c96040518060800160405280606081526020016060815260200160608152602001606081525090565b6113d2826127f1565b6113ee5760405162461bcd60e51b8152600401610ad5906149f4565b604051633129e77360e01b8152600481018390526000903090633129e77390602401600060405180830381865afa15801561142d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526114559190810190614a67565b6020015160405162d47de760e71b8152600481018590529091506000903090636a3ef38090602401600060405180830381865afa15801561149a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526114c29190810190614b0d565b604051633129e77360e01b8152600481018690529091506000903090633129e77390602401600060405180830381865afa158015611504573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261152c9190810190614a67565b5160408051608081019091529091508061154a858560a08401614bbd565b6040516020818303038152906040528152602001848152602001828152602001838152509350505050919050565b6060816000816001600160401b0381111561159557611595614743565b6040519080825280602002602001820160405280156115ce57816020015b6115bb614299565b8152602001906001900390816115b35790505b50905060005b828114611621576115fc8686838181106115f0576115f0614936565b90506020020135612576565b82828151811061160e5761160e614936565b60209081029190910101526001016115d4565b50949350505050565b600061090f82613028565b60165460609033308114916001600160a01b03161481806116535750805b61166f5760405162461bcd60e51b8152600401610ad590614b79565b600061167961308f565b90506000816116905761168b866130a0565b6116fc565b601654604051622f0dad60e91b8152600481018890526001600160a01b0390911690635e1b5a0090602401602060405180830381865afa1580156116d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116fc9190614b41565b90506000611733604051806040016040528060068152602001650e6eaccccd2f60d31b815250888461172e919061491e565b6130de565b9050600c6000601154836117479190614c0f565b815260200190815260200160002080546117609061489b565b80601f016020809104026020016040519081016040528092919081815260200182805461178c9061489b565b80156117d95780601f106117ae576101008083540402835291602001916117d9565b820191906000526020600020905b8154815290600101906020018083116117bc57829003601f168201915b505050505095505050505050919050565b6117f2612792565b60088054911515600160a81b0260ff60a81b19909216919091179055565b611818612792565b601181905560005b81811015610dff5782828281811061183a5761183a614936565b905060200281019061184c9190614995565b6000838152600c60205260409020611865929091614225565b5080611870816149db565b915050611820565b60006001600160a01b0382166118a1576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b6118ce612792565b6118d86000613112565b565b606060008060006118ea85611878565b90506000816001600160401b0381111561190657611906614743565b60405190808252806020026020018201604052801561192f578160200160208202803683370190505b50905061193a614299565b60005b8386146119b45761194d81613164565b915081604001516119ac5781516001600160a01b03161561196d57815194505b876001600160a01b0316856001600160a01b0316036119ac578083878060010198508151811061199f5761199f614936565b6020026020010181815250505b60010161193d565b50909695505050505050565b6119c8612792565b601780546001600160a01b0319166001600160a01b0392909216919091179055565b60606119f5826127f1565b611a115760405162461bcd60e51b8152600401610ad5906149f4565b60408051610160810191829052633129e77360e01b909152610164810183905261090f908030633129e7736101848301600060405180830381865afa158015611a5e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611a869190810190614a67565b602001518152602001604051806020016040528060008152508152602001306001600160a01b0316636a3ef380866040518263ffffffff1660e01b8152600401611ad291815260200190565b600060405180830381865afa158015611aef573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611b179190810190614b0d565b8152601554604051633129e77360e01b8152600481018790526020909201916001600160a01b039091169063cd5286d0903090633129e77390602401600060405180830381865afa158015611b70573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611b989190810190614a67565b602001516040518263ffffffff1660e01b8152600401611bb89190614397565b600060405180830381865afa158015611bd5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611bfd9190810190614b0d565b8152601554604051633129e77360e01b8152600481018790526020909201916001600160a01b039091169063cd5286d0903090633129e77390602401600060405180830381865afa158015611c56573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611c7e9190810190614a67565b60200151604051602001611c929190614c23565b6040516020818303038152906040526040518263ffffffff1660e01b8152600401611cbd9190614397565b600060405180830381865afa158015611cda573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611d029190810190614b0d565b815260155460405162d47de760e71b8152600481018790526020909201916001600160a01b039091169063cd5286d0903090636a3ef38090602401600060405180830381865afa158015611d5a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611d829190810190614b0d565b6040518263ffffffff1660e01b8152600401611d9e9190614397565b600060405180830381865afa158015611dbb573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611de39190810190614b0d565b8152604080516020818101835260008083529084019190915281830181905260608301526015549051630cd5286d60e41b81526080909201916001600160a01b039091169063cd5286d090611e539060040160208082526004908201526318d85c9960e21b604082015260600190565b600060405180830381865afa158015611e70573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611e989190810190614b0d565b8152601554604051630cd5286d60e41b815260206004808301829052602483015263199bdb9d60e21b6044830152909201916001600160a01b039091169063cd5286d090606401600060405180830381865afa158015611efc573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611f249190810190614b0d565b9052613184565b6008546001600160a01b031690565b611f42612792565b601281905560005b81811015610dff57828282818110611f6457611f64614936565b9050602002810190611f769190614995565b6000838152600d60205260409020611f8f929091614225565b5080611f9a816149db565b915050611f4a565b60165460609033308114916001600160a01b0316148180611fc05750805b611fdc5760405162461bcd60e51b8152600401610ad590614b79565b6000611fe661308f565b9050600081611ffd57611ff8866130a0565b612069565b601654604051622f0dad60e91b8152600481018890526001600160a01b0390911690635e1b5a0090602401602060405180830381865afa158015612045573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120699190614b41565b9050600061209b604051806040016040528060068152602001650e0e4caccd2f60d31b815250888461172e919061491e565b9050600b6000601054836117479190614c0f565b60606003805461094e9061489b565b60608183106120e057604051631960ccad60e11b815260040160405180910390fd5b6000806120ec60005490565b9050808411156120fa578093505b600061210587611878565b905084861015612124578585038181101561211e578091505b50612128565b5060005b6000816001600160401b0381111561214257612142614743565b60405190808252806020026020018201604052801561216b578160200160208202803683370190505b5090508160000361218157935061223092505050565b600061218c88612576565b90506000816040015161219d575080515b885b8881141580156121af5750848714155b15612224576121bd81613164565b9250826040015161221c5782516001600160a01b0316156121dd57825191505b8a6001600160a01b0316826001600160a01b03160361221c578084888060010199508151811061220f5761220f614936565b6020026020010181815250505b60010161219f565b50505092835250909150505b9392505050565b8161224181612b67565b610dff8383613547565b6040516370a0823160e01b815260009030906370a08231906122719033906004016143c3565b602060405180830381865afa15801561228e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122b29190614b41565b9050600030638462151c336040518263ffffffff1660e01b81526004016122d991906143c3565b600060405180830381865afa1580156122f6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261231e9190810190614c50565b905060005b82811015610c845761234f338584848151811061234257612342614936565b602002602001015161300d565b80612359816149db565b915050612323565b60165460009033308114916001600160a01b031614818061237f5750805b61239b5760405162461bcd60e51b8152600401610ad590614b79565b604051633129e77360e01b8152600481018590526000903090633129e77390602401600060405180830381865afa1580156123da573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526124029190810190614a67565b60200151905060005b60125481101561253d576000818152600d6020526040902080546124d691906124339061489b565b80601f016020809104026020016040519081016040528092919081815260200182805461245f9061489b565b80156124ac5780601f10612481576101008083540402835291602001916124ac565b820191906000526020600020905b81548152906001019060200180831161248f57829003601f168201915b5050505050836040516020016124c29190614c23565b6040516020818303038152906040526135b3565b1561252b5760006125116040518060400160405280600481526020016372306e3160e01b815250886125078a612fb9565b61172e919061491e565b90506000612520600783614c0f565b1495505050506112bf565b80612535816149db565b91505061240b565b50600095945050505050565b836001600160a01b03811633146125635761256333612b67565b61256f8585858561360c565b5050505050565b61257e614299565b612586614299565b60005483106125955792915050565b61259e83613164565b90508060400151156125b05792915050565b61223083613650565b6125c1612792565b60088054911515600160a01b0260ff60a01b19909216919091179055565b60606125ea826127f1565b6126065760405162461bcd60e51b8152600401610ad5906149f4565b604051633129e77360e01b81526004810183905261090f903090633129e77390602401600060405180830381865afa158015612646573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261266e9190810190614a67565b60405162d47de760e71b8152600481018590523090636a3ef38090602401600060405180830381865afa1580156126a9573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526126d19190810190614b0d565b604051806020016040528060008152506000806126ed886119ea565b613669565b6126fa612792565b601680546001600160a01b0319166001600160a01b0392909216919091179055565b612724612792565b6001600160a01b0381166127895760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610ad5565b61112481613112565b3361279b611f2b565b6001600160a01b0316146118d85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ad5565b600080548210801561090f575050600090815260046020526040902054600160e01b161590565b600061283c8383600081811061283057612830614936565b90506020020135612fb9565b905060006128568484600181811061283057612830614936565b905060006128708585600281811061283057612830614936565b9050818314801561288057508083145b6128d65760405162461bcd60e51b815260206004820152602160248201527f416c6c206974656d732073686f756c64206265206f6620657175616c207479706044820152606560f81b6064820152608401610ad5565b60005b60028111610b4457336129038787848181106128f7576128f7614936565b9050602002013561162a565b6001600160a01b0316146129495760405162461bcd60e51b815260206004820152600d60248201526c2737ba103cb7bab91033b2b0b960991b6044820152606401610ad5565b61296a86868381811061295e5761295e614936565b90506020020135613809565b80612974816149db565b9150506128d9565b60006129fd3360405160609190911b6001600160601b031916602082015260348101879052605481018690526074016040516020818303038152906040528051906020012084848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061381492505050565b6001600160a01b0316866001600160a01b031614905095945050505050565b600854600160a81b900460ff16612a735760405162461bcd60e51b815260206004820152601b60248201527a546865206465616c6572206973206e6f7420617661696c61626c6560281b6044820152606401610ad5565b600a811115612ac45760405162461bcd60e51b815260206004820152601d60248201527f43616e6e6f74206d696e742074686174206d616e79206174206f6e63650000006044820152606401610ad5565b612ad1600661115c614b5a565b612aec612adf600684614b5a565b6001546000540390613838565b1115612b345760405162461bcd60e51b8152602060048201526017602482015276139bdd08195b9bdd59da081b19599d081d1bc81b5a5b9d604a1b6044820152606401610ad5565b4260146000612b4260005490565b815260208101919091526040016000205561112433612b62600684614b5a565b613844565b6daaeb6d7670e522a718067333cd4e3b1561112457604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015612bd4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bf89190614cf5565b6111245780604051633b79c77360e21b8152600401610ad591906143c3565b6000612c2282613028565b9050836001600160a01b0316816001600160a01b031614612c555760405162a1148160e81b815260040160405180910390fd5b60008281526006602052604090208054612c818187335b6001600160a01b039081169116811491141790565b612cac57612c8f8633610855565b612cac57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516612cd357604051633a954ecd60e21b815260040160405180910390fd5b8015612cde57600082555b6001600160a01b03868116600090815260056020526040808220805460001901905591871681522080546001019055612d1b85600160e11b61385e565b600085815260046020526040812091909155600160e11b84169003612d7057600184016000818152600460205260408120549003612d6e576000548114612d6e5760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b0316600080516020615b6283398151915260405160405180910390a4610b44565b606060008260800151612dc65760405180602001604052806000815250612e3d565b612e3d604051806040016040528060018152602001600360fc1b815250604051806040016040528060018152602001600360fc1b815250604051806040016040528060028152602001610d8d60f21b815250604051806040016040528060028152602001610d8d60f21b8152508760400151613873565b612eb4604051806040016040528060018152602001600360fc1b815250604051806040016040528060018152602001600360fc1b815250604051806040016040528060028152602001610d8d60f21b815250604051806040016040528060028152602001610d8d60f21b8152508860000151613873565b8460600151612ed25760405180602001604052806000815250612f49565b612f49604051806040016040528060018152602001600360fc1b815250604051806040016040528060018152602001600360fc1b815250604051806040016040528060028152602001610d8d60f21b815250604051806040016040528060028152602001610d8d60f21b8152508960200151613873565b604051602001612f5b93929190614d12565b60408051601f1981840301815290829052612f7891602001614d55565b6040516020818303038152906040529050612f92816138a8565b604051602001612fa29190614f0e565b604051602081830303815290604052915050919050565b600080612fc5836130a0565b90506000612ff5604051806040016040528060048152602001636974656d60e01b815250858461172e919061491e565b9050600f54816130059190614c0f565b949350505050565b610dff83838360405180602001604052806000815250612549565b6000816000548110156130765760008181526004602052604081205490600160e01b82169003613074575b80600003612230575060001901600081815260046020526040902054613053565b505b604051636f96cda160e11b815260040160405180910390fd5b6016546001600160a01b0316331490565b6000815b600081815260146020526040902054156130cc57505060009081526014602052604090205490565b806130d681614f50565b9150506130a4565b600082826040516020016130f3929190614f67565b60408051601f1981840301815291905280516020909101209392505050565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b61316c614299565b60008281526004602052604090205461090f906139fa565b606060008261014001516131c0846000015185604001516040516020016131ac929190614bbd565b604051602081830303815290604052613a3d565b6040516020016131d1929190614f89565b6040516020818303038152906040528361010001516131ff5760405180602001604052806000815250613277565b613277604051806040016040528060018152602001601b60f91b81525060405180604001604052806002815260200161062760f31b815250604051806040016040528060028152602001610d8d60f21b815250604051806040016040528060028152602001610d8d60f21b8152508860c00151613873565b6132f0604051806040016040528060018152602001600360fc1b815250604051806040016040528060018152602001600360fc1b815250604051806040016040528060028152602001611b9b60f11b815250604051806040016040528060038152602001620c4c4d60ea1b815250896101200151613873565b613368604051806040016040528060018152602001601b60f91b81525060405180604001604052806002815260200161062760f31b815250604051806040016040528060028152602001610d8d60f21b815250604051806040016040528060028152602001610d8d60f21b8152508a60600151613873565b6133e060405180604001604052806002815260200161033360f41b815250604051806040016040528060018152602001600360fc1b81525060405180604001604052806002815260200161189b60f11b81525060405180604001604052806002815260200161189960f11b8152508b60a00151613873565b8760e001516133fe5760405180602001604052806000815250613476565b613476604051806040016040528060018152602001601b60f91b81525060405180604001604052806002815260200161062760f31b815250604051806040016040528060028152602001610d8d60f21b815250604051806040016040528060028152602001610d8d60f21b8152508c60800151613873565b60405160200161348a9594939291906150e8565b6040516020818303038152906040528460e001516134eb57845160408087015190516134ba929190602001614bbd565b60408051601f19818403018152908290526134d791602001615153565b604051602081830303815290604052613535565b6020808601518651604080890151905192936135079301614bbd565b60408051601f198184030181529082905261352592916020016151dc565b6040516020818303038152906040525b604051602001612f78939291906152d0565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6000816040516020016135c69190615486565b60405160208183030381529060405280519060200120836040516020016135ed9190615486565b6040516020818303038152906040528051906020012014905092915050565b613617848484610e04565b6001600160a01b0383163b15610c845761363384848484613a8a565b610c84576040516368d2bf6b60e11b815260040160405180910390fd5b613658614299565b61090f61366483613028565b6139fa565b60208601518651606091906000866136a257828960405160200161368e9291906154a2565b6040516020818303038152906040526136c7565b87838a6040516020016136b793929190615503565b6040516020818303038152906040525b83886136e25760405180602001604052806000815250613703565b896040516020016136f39190615582565b6040516020818303038152906040525b8b858b801561370f57508a5b613728576040518060200160405280600081525061378d565b8a61374f57604051806040016040528060048152602001634e6f6e6560e01b81525061376d565b6040518060400160405280600481526020016352304e3160e01b8152505b60405160200161377d91906155e0565b6040516020818303038152906040525b6040516020016137a195949392919061563d565b60408051601f19818403018152908290526137c19291889060200161574b565b60405160208183030381529060405290506137db816138a8565b6040516020016137eb919061587e565b60405160208183030381529060405293505050509695505050505050565b611124816000613b75565b60008060006138238585613ca7565b9150915061383081613cec565b509392505050565b6000612230828461491e565b61130d828260405180602001604052806000815250613e31565b4260a01b176001600160a01b03919091161790565b6060858585858560405160200161388e9594939291906158c3565b604051602081830303815290604052905095945050505050565b606081516000036138c757505060408051602081019091526000815290565b6000604051806060016040528060408152602001615b0260409139905060006003845160026138f6919061491e565b6139009190615a01565b61390b906004614b5a565b6001600160401b0381111561392257613922614743565b6040519080825280601f01601f19166020018201604052801561394c576020820181803683370190505b509050600182016020820185865187015b808210156139b8576003820191508151603f8160121c168501518453600184019350603f81600c1c168501518453600184019350603f8160061c168501518453600184019350603f811685015184535060018301925061395d565b50506003865106600181146139d457600281146139e7576139ef565b603d6001830353603d60028303536139ef565b603d60018303535b509195945050505050565b613a02614299565b6001600160a01b03821681526001600160401b0360a083901c166020820152600160e01b82161515604082015260e89190911c606082015290565b8051606090602190600490819083811115613a5757600391505b613a6082613e97565b604051602001613a709190615a15565b604051602081830303815290604052945050505050919050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290613abf903390899088908890600401615a3b565b6020604051808303816000875af1925050508015613afa575060408051601f3d908101601f19168201909252613af791810190615a6e565b60015b613b58573d808015613b28576040519150601f19603f3d011682016040523d82523d6000602084013e613b2d565b606091505b508051600003613b50576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b6000613b8083613028565b905080600080613b9e86600090815260066020526040902080549091565b915091508415613bde57613bb3818433612c6c565b613bde57613bc18333610855565b613bde57604051632ce44b5f60e11b815260040160405180910390fd5b8015613be957600082555b6001600160a01b038316600090815260056020526040902080546001600160801b03019055613c1c83600360e01b61385e565b600087815260046020526040812091909155600160e11b85169003613c7157600186016000818152600460205260408120549003613c6f576000548114613c6f5760008181526004602052604090208590555b505b60405186906000906001600160a01b03861690600080516020615b62833981519152908390a45050600180548101905550505050565b6000808251604103613cdd5760208301516040840151606085015160001a613cd187828585613f29565b94509450505050613ce5565b506000905060025b9250929050565b6000816004811115613d0057613d00615a8b565b03613d085750565b6001816004811115613d1c57613d1c615a8b565b03613d645760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b6044820152606401610ad5565b6002816004811115613d7857613d78615a8b565b03613dc55760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610ad5565b6003816004811115613dd957613dd9615a8b565b036111245760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610ad5565b613e3b8383613fe3565b6001600160a01b0383163b15610dff576000548281035b613e656000868380600101945086613a8a565b613e82576040516368d2bf6b60e11b815260040160405180910390fd5b818110613e5257816000541461256f57600080fd5b60606000613ea4836140cb565b60010190506000816001600160401b03811115613ec357613ec3614743565b6040519080825280601f01601f191660200182016040528015613eed576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084613ef757509392505050565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b03831115613f565750600090506003613fda565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613faa573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116613fd357600060019250925050613fda565b9150600090505b94509492505050565b60008054908290036140085760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b038316600090815260056020526040902080546001600160401b01840201905561403f836001841460e11b61385e565b6000828152600460205260408120919091556001600160a01b038416908383019083908390600080516020615b628339815191528180a4600183015b8181146140a15780836000600080516020615b62833981519152600080a460010161407b565b50816000036140c257604051622e076360e81b815260040160405180910390fd5b60005550505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b831061410a5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6904ee2d6d415b85acef8160201b8310614134576904ee2d6d415b85acef8160201b830492506020015b662386f26fc10000831061415257662386f26fc10000830492506010015b6305f5e100831061416a576305f5e100830492506008015b612710831061417e57612710830492506004015b60648310614190576064830492506002015b600a831061090f5760010192915050565b8280546141ad9061489b565b90600052602060002090601f0160209004810192826141cf5760008555614215565b82601f106141e857805160ff1916838001178555614215565b82800160010185558215614215579182015b828111156142155782518255916020019190600101906141fa565b506142219291506142c0565b5090565b8280546142319061489b565b90600052602060002090601f0160209004810192826142535760008555614215565b82601f1061426c5782800160ff19823516178555614215565b82800160010185558215614215579182015b8281111561421557823582559160200191906001019061427e565b60408051608081018252600080825260208201819052918101829052606081019190915290565b5b8082111561422157600081556001016142c1565b6001600160e01b03198116811461112457600080fd5b6000602082840312156142fd57600080fd5b8135612230816142d5565b80356001600160a01b038116811461431f57600080fd5b919050565b60006020828403121561433657600080fd5b61223082614308565b60005b8381101561435a578181015183820152602001614342565b83811115610c845750506000910152565b6000815180845261438381602086016020860161433f565b601f01601f19169290920160200192915050565b602081526000612230602083018461436b565b6000602082840312156143bc57600080fd5b5035919050565b6001600160a01b0391909116815260200190565b600080604083850312156143ea57600080fd5b6143f383614308565b946020939093013593505050565b60008083601f84011261441357600080fd5b5081356001600160401b0381111561442a57600080fd5b6020830191508360208260051b8501011115613ce557600080fd5b6000806020838503121561445857600080fd5b82356001600160401b0381111561446e57600080fd5b61447a85828601614401565b90969095509350505050565b6000806000806060858703121561449c57600080fd5b843593506020850135925060408501356001600160401b03808211156144c157600080fd5b818701915087601f8301126144d557600080fd5b8135818111156144e457600080fd5b8860208285010111156144f657600080fd5b95989497505060200194505050565b60008060006060848603121561451a57600080fd5b61452384614308565b925061453160208501614308565b9150604084013590509250925092565b60208152600082516040602084015261455d606084018261436b565b90506020840151601f1984830301604085015261457a828261436b565b95945050505050565b60208152600082516080602084015261459f60a084018261436b565b90506020840151601f19808584030160408601526145bd838361436b565b925060408601519150808584030160608601526145da838361436b565b925060608601519150808584030160808601525061457a828261436b565b80516001600160a01b031682526020808201516001600160401b03169083015260408082015115159083015260609081015162ffffff16910152565b6020808252825182820181905260009190848201906040850190845b818110156119b4576146638385516145f8565b9284019260809290920191600101614650565b801515811461112457600080fd5b60006020828403121561469657600080fd5b813561223081614676565b6020808252825182820181905260009190848201906040850190845b818110156119b4578351835292840192918401916001016146bd565b6000806000606084860312156146ee57600080fd5b6146f784614308565b95602085013595506040909401359392505050565b6000806040838503121561471f57600080fd5b61472883614308565b9150602083013561473881614676565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561478157614781614743565b604052919050565b60006001600160401b038211156147a2576147a2614743565b50601f01601f191660200190565b600080600080608085870312156147c657600080fd5b6147cf85614308565b93506147dd60208601614308565b92506040850135915060608501356001600160401b038111156147ff57600080fd5b8501601f8101871361481057600080fd5b803561482361481e82614789565b614759565b81815288602083850101111561483857600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b6080810161090f82846145f8565b6000806040838503121561487b57600080fd5b61488483614308565b915061489260208401614308565b90509250929050565b600181811c908216806148af57607f821691505b6020821081036148cf57634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252601990820152784e656564207468726565206974656d7320746f20666f72676560381b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000821982111561493157614931614908565b500190565b634e487b7160e01b600052603260045260246000fd5b6000808335601e1984360301811261496357600080fd5b8301803591506001600160401b0382111561497d57600080fd5b6020019150600581901b3603821315613ce557600080fd5b6000808335601e198436030181126149ac57600080fd5b8301803591506001600160401b038211156149c657600080fd5b602001915036819003821315613ce557600080fd5b6000600182016149ed576149ed614908565b5060010190565b602080825260149082015273151bdad95b88191bd95cc81b9bdd08195e1a5cdd60621b604082015260600190565b600082601f830112614a3357600080fd5b8151614a4161481e82614789565b818152846020838601011115614a5657600080fd5b61300582602083016020870161433f565b600060208284031215614a7957600080fd5b81516001600160401b0380821115614a9057600080fd5b9083019060408286031215614aa457600080fd5b604051604081018181108382111715614abf57614abf614743565b604052825182811115614ad157600080fd5b614add87828601614a22565b825250602083015182811115614af257600080fd5b614afe87828601614a22565b60208301525095945050505050565b600060208284031215614b1f57600080fd5b81516001600160401b03811115614b3557600080fd5b61300584828501614a22565b600060208284031215614b5357600080fd5b5051919050565b6000816000190483118215151615614b7457614b74614908565b500290565b6020808252600e908201526d2ab735b737bbb71031b0b63632b960911b604082015260600190565b60008151614bb381856020860161433f565b9290920192915050565b60008351614bcf81846020880161433f565b600160fd1b9083019081528351614bed81600184016020880161433f565b01600101949350505050565b634e487b7160e01b600052601260045260246000fd5b600082614c1e57614c1e614bf9565b500690565b64029182718960dd1b815260008251614c4381600585016020870161433f565b9190910160050192915050565b60006020808385031215614c6357600080fd5b82516001600160401b0380821115614c7a57600080fd5b818501915085601f830112614c8e57600080fd5b815181811115614ca057614ca0614743565b8060051b9150614cb1848301614759565b8181529183018401918481019088841115614ccb57600080fd5b938501935b83851015614ce957845182529385019390850190614cd0565b98975050505050505050565b600060208284031215614d0757600080fd5b815161223081614676565b60008451614d2481846020890161433f565b845190830190614d3881836020890161433f565b8451910190614d4b81836020880161433f565b0195945050505050565b600080516020615ae28339815191528152600080516020615b428339815191526020820152600080516020615aa28339815191526040820152600080516020615ac283398151915260608201527f313939392f7868746d6c272077696474683d2736343027206865696768743d2760808201527f36343027207072657365727665417370656374526174696f3d27784d6964594d60a08201527f6964206d656574272076696577426f783d27302030203634203634272073747960c08201527f6c653d277374726f6b652d77696474683a303b206261636b67726f756e642d6360e08201527f6f6c6f723a68736c28302c30252c3025293b206d617267696e3a206175746f3b6101008201527f6865696768743a202d7765626b69742d66696c6c2d617661696c61626c65273e6101208201527f3c7374796c6520747970653d27746578742f637373273e2e706978656c6174656101408201527f64207b20696d6167652d72656e646572696e673a20706978656c617465643b20610160820152683e9e17b9ba3cb6329f60b91b6101808201526000612230614efc610189840185614ba1565b651e17b9bb339f60d11b815260060190565b7919185d184e9a5b5859d94bdcdd99cade1b5b0ed8985cd94d8d0b60321b815260008251614f4381601a85016020870161433f565b91909101601a0192915050565b600081614f5f57614f5f614908565b506000190190565b60008351614f7981846020880161433f565b9190910191825250602001919050565b761e39ba3cb632903a3cb8329e93ba32bc3a17b1b9b9939f60491b81527f40666f6e742d66616365207b20666f6e742d66616d696c793a2047656172466f60178201526d6e743b207372633a2075726c282760901b603782015260008351614ff881604585016020880161433f565b6427293b207d60d81b6045918401918201527f2e706978656c61746564207b20696d6167652d72656e646572696e673a207069604a8201526978656c617465643b207d60b01b606a8201527f2e6e616d65207b20666f6e742d66616d696c793a2047656172466f6e743b2066607482015269037b73a16b9b4bd329d160b51b6094820152835161508f81609e84016020880161433f565b7f3b20746578742d7472616e73666f726d3a207570706572636173653b2066696c9101609e8101919091526a6c3a20626c61636b3b207d60a81b60be820152671e17b9ba3cb6329f60c11b60c982015260d1810161457a565b600086516150fa818460208b0161433f565b86519083019061510e818360208b0161433f565b8651910190615121818360208a0161433f565b855191019061513481836020890161433f565b845191019061514781836020880161433f565b01979650505050505050565b7f3c7465787420783d273530252720793d273130342e35302720746578742d616e8152600080516020615b8283398151915260208201527513b6b4b2323632939031b630b9b99e93b730b6b2939f60511b6040820152600082516151be81605685016020870161433f565b661e17ba32bc3a1f60c91b6056939091019283015250605d01919050565b7f3c7465787420783d273530252720793d273130332e35302720746578742d616e81526000600080516020615b828339815191528060208401527513b137ba3a37b6939031b630b9b99e93b730b6b2939f60511b6040840152845161524881605686016020890161433f565b8084019050661e17ba32bc3a1f60c91b8060568301527f3c7465787420783d273530252720793d273130362e37352720746578742d616e605d83015282607d8301527213ba37b8139031b630b9b99e93b730b6b2939f60691b609d830152855192506152bb8360b084016020890161433f565b910160b081019190915260b701949350505050565b600080516020615ae28339815191528152600080516020615b428339815191526020820152600080516020615aa28339815191526040820152600080516020615ac283398151915260608201527f313939392f7868746d6c272077696474683d2737363027206865696768743d2760808201527f3131343027207072657365727665417370656374526174696f3d27784d69645960a08201527f4d6964206d656574272076696577426f783d273020302037362031313427207360c08201527f74796c653d277374726f6b652d77696474683a303b206261636b67726f756e6460e08201527f2d636f6c6f723a68736c28302c30252c3025293b206d617267696e3a206175746101008201527f6f3b6865696768743a202d7765626b69742d66696c6c2d617661696c61626c6561012082015261139f60f11b610140820152600061457a614efc61548061547a61542b61014287018a614ba1565b7f3c726563742077696474683d273130302527206865696768743d27313030252781527f20783d27302720793d2730272066696c6c3d272338383765383827202f3e00006020820152603e0190565b87614ba1565b85614ba1565b6000825161549881846020870161433f565b9190910192915050565b68113730b6b2911d101160b91b815282516000906154c781600985016020880161433f565b600160fd1b60099184019182015283516154e881600a84016020880161433f565b61088b60f21b600a9290910191820152600c01949350505050565b68113730b6b2911d101160b91b8152835160009061552881600985016020890161433f565b8083019050600160fd1b806009830152855161554b81600a850160208a0161433f565b600a920191820152835161556681600b84016020880161433f565b61088b60f21b600b9290910191820152600d0195945050505050565b7f7b2274726169745f74797065223a2022507265666978222c202276616c7565228152621d101160e91b6020820152600082516155c681602385016020870161433f565b62089f4b60ea1b6023939091019283015250602601919050565b7f2c7b2274726169745f74797065223a20224578747261222c202276616c7565228152621d101160e91b60208201526000825161562481602385016020870161433f565b61227d60f01b6023939091019283015250602501919050565b7f7b2274726169745f74797065223a20224e616d65222c202276616c7565223a208152601160f91b60208201526000865161567f816021850160208b0161433f565b62089f4b60ea1b602191840191820181905287516156a4816024850160208c0161433f565b7f7b2274726169745f74797065223a2022537566666978222c202276616c75652260249390910192830152621d101160e91b604483015286516156ee816047850160208b0161433f565b60479201918201527f7b2274726169745f74797065223a202243617465676f7279222c202276616c75604a8201526432911d101160d91b606a820152614ce961548061573d606f840188614ba1565b61227d60f01b815260020190565b607b60f81b81526000845161576781600185016020890161433f565b7f226465736372697074696f6e223a2022497420676f7420656d70747920696e206001918401918201527f7468652076656e74732061667465722030424552314e2068616420676f6e652060218201527f6d697373696e672e20546865206e65656420666f7220776561706f6e7320616e60418201527f642061726d6f72206973206e6f772067726561746572207468616e20697420656061820152691d995c881dd85ccb888b60b21b60818201526e2261747472696275746573223a205b60881b608b820152845161584181609a84016020890161433f565b61174b60f21b9101609a810191909152691134b6b0b3b2911d101160b11b609c82015261587461573d60a6830186614ba1565b9695505050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000008152600082516158b681601d85016020870161433f565b91909101601d0192915050565b713c666f726569676e4f626a65637420783d2760701b81526000865160206158f18260128601838c0161433f565b642720793d2760d81b60129285019283015287516159158160178501848c0161433f565b68272077696474683d2760b81b60179390910192830152865161593d81838501848b0161433f565b6927206865696768743d2760b01b920181810192909252855161596681602a850189850161433f565b61139f60f11b602a9390910192830152507f3c7868746d6c3a696d6720636c6173733d27706978656c617465642720776964602c8201527f74683d273130302527206865696768743d273130302527207372633d27000000604c820152614ce96159e56159d66069840187614ba1565b6213979f60e91b815260030190565b6f1e17b337b932b4b3b727b13532b1ba1f60811b815260100190565b600082615a1057615a10614bf9565b500490565b60008251615a2781846020870161433f565b610e0f60f31b920191825250600201919050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906158749083018461436b565b600060208284031215615a8057600080fd5b8151612230816142d5565b634e487b7160e01b600052602160045260246000fdfe6b3d27687474703a2f2f7777772e77332e6f72672f313939392f786c696e6b2720786d6c6e733a7868746d6c3d27687474703a2f2f7777772e77332e6f72672f3c7376672076657273696f6e3d27312e312720786d6c6e733d27687474703a2f4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f2f7777772e77332e6f72672f323030302f7376672720786d6c6e733a786c696eddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef63686f723d276d6964646c652720646f6d696e616e742d626173656c696e653da26469706673582212208312c2835886e4ee17ae141ac387dc03a2b0e0979bbb6ded3ae2c48fb1feb56664736f6c634300080d0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000008948ea37a3121f2419e2f83a7bd2c35daf611d730000000000000000000000003bf2922f4520a8ba0c2efc3d2a1539678dad5e9d0000000000000000000000000000000000000000000000000000000000000011546163746963616c20304e312047656172000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c544143544943414c474541520000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : name (string): Tactical 0N1 Gear
Arg [1] : symbol (string): TACTICALGEAR
Arg [2] : assetsAddress (address): 0x8948Ea37a3121F2419e2f83a7BD2C35DAf611D73
Arg [3] : oniAddress (address): 0x3bf2922f4520a8BA0c2eFC3D2a1539678DaD5e9D
-----Encoded View---------------
8 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [2] : 0000000000000000000000008948ea37a3121f2419e2f83a7bd2c35daf611d73
Arg [3] : 0000000000000000000000003bf2922f4520a8ba0c2efc3d2a1539678dad5e9d
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000011
Arg [5] : 546163746963616c20304e312047656172000000000000000000000000000000
Arg [6] : 000000000000000000000000000000000000000000000000000000000000000c
Arg [7] : 544143544943414c474541520000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.