ETH Price: $3,197.57 (-0.62%)

Contract

0x7C4633f6D4Ffa91520e07AF7ab8Cd447DC5Ab9c9
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

More Info

Private Name Tags

TokenTracker

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Safe Transfer Fr...227978562025-06-27 19:27:35142 days ago1751052455IN
0x7C4633f6...7DC5Ab9c9
0 ETH0.000136772.70480936
Set Approval For...227928672025-06-27 2:43:35143 days ago1750992215IN
0x7C4633f6...7DC5Ab9c9
0 ETH0.000126932.74756069
Set Approval For...218533642025-02-15 17:38:23274 days ago1739641103IN
0x7C4633f6...7DC5Ab9c9
0 ETH0.000033651.3862002
Set Approval For...216147552025-01-13 9:46:11307 days ago1736761571IN
0x7C4633f6...7DC5Ab9c9
0 ETH0.000377078.16402066
Set Approval For...215256362024-12-31 23:08:47320 days ago1735686527IN
0x7C4633f6...7DC5Ab9c9
0 ETH0.000275755.96881976
Set Approval For...215206782024-12-31 6:30:59321 days ago1735626659IN
0x7C4633f6...7DC5Ab9c9
0 ETH0.000420419.1
Safe Transfer Fr...197664692024-04-30 6:54:59566 days ago1714460099IN
0x7C4633f6...7DC5Ab9c9
0 ETH0.000477617.10505881
Safe Transfer Fr...191310042024-02-01 3:46:11655 days ago1706759171IN
0x7C4633f6...7DC5Ab9c9
0 ETH0.0011618623.28109442
Set Approval For...190006892024-01-13 21:35:35673 days ago1705181735IN
0x7C4633f6...7DC5Ab9c9
0 ETH0.0006780514.6805465
Set Approval For...189112182024-01-01 7:50:35685 days ago1704095435IN
0x7C4633f6...7DC5Ab9c9
0 ETH0.00046019.94360299
Safe Transfer Fr...189078612023-12-31 20:32:47686 days ago1704054767IN
0x7C4633f6...7DC5Ab9c9
0 ETH0.0009346917.08205398
Set Approval For...189075352023-12-31 19:26:35686 days ago1704050795IN
0x7C4633f6...7DC5Ab9c9
0 ETH0.000624313.5168302
Set Approval For...188954272023-12-30 2:38:11688 days ago1703903891IN
0x7C4633f6...7DC5Ab9c9
0 ETH0.0006456913.95464457
Distribute Share...188344872023-12-21 13:17:47696 days ago1703164667IN
0x7C4633f6...7DC5Ab9c9
0 ETH0.006551738.61556394
Set Team Share188344682023-12-21 13:13:59696 days ago1703164439IN
0x7C4633f6...7DC5Ab9c9
0 ETH0.0014737340.07001215
Set Team Share188344222023-12-21 13:04:47696 days ago1703163887IN
0x7C4633f6...7DC5Ab9c9
0 ETH0.0018885945.39566398
Remove Artist188344162023-12-21 13:03:35696 days ago1703163815IN
0x7C4633f6...7DC5Ab9c9
0 ETH0.0028613448.22838502
Set Approval For...187490142023-12-09 13:37:35708 days ago1702129055IN
0x7C4633f6...7DC5Ab9c9
0 ETH0.0015361233.20707345
Close Box187132942023-12-04 13:27:23713 days ago1701696443IN
0x7C4633f6...7DC5Ab9c9
0 ETH0.0011799538.15182238
Buy Many Boxes186130242023-11-20 12:33:11727 days ago1700483591IN
0x7C4633f6...7DC5Ab9c9
0.65 ETH0.0038188823.32686354
Set Approval For...186099002023-11-20 2:03:35728 days ago1700445815IN
0x7C4633f6...7DC5Ab9c9
0 ETH0.0010001821.65502331
Buy Many Boxes186062962023-11-19 13:56:59728 days ago1700402219IN
0x7C4633f6...7DC5Ab9c9
0.65 ETH0.0028117.16429666
Buy Many Boxes185880832023-11-17 0:40:35731 days ago1700181635IN
0x7C4633f6...7DC5Ab9c9
0.65 ETH0.0035714824.36010803
Safe Transfer Fr...185695522023-11-14 10:29:23733 days ago1699957763IN
0x7C4633f6...7DC5Ab9c9
0 ETH0.0024787936.86815097
Buy Many Boxes185695452023-11-14 10:27:59733 days ago1699957679IN
0x7C4633f6...7DC5Ab9c9
0.65 ETH0.0054033733.00535889
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Method Block
From
To
Transfer188344872023-12-21 13:17:47696 days ago1703164667
0x7C4633f6...7DC5Ab9c9
0.143 ETH
Transfer188344872023-12-21 13:17:47696 days ago1703164667
0x7C4633f6...7DC5Ab9c9
0.143 ETH
Transfer188344872023-12-21 13:17:47696 days ago1703164667
0x7C4633f6...7DC5Ab9c9
0.143 ETH
Transfer188344872023-12-21 13:17:47696 days ago1703164667
0x7C4633f6...7DC5Ab9c9
0.143 ETH
Transfer188344872023-12-21 13:17:47696 days ago1703164667
0x7C4633f6...7DC5Ab9c9
0.143 ETH
Transfer188344872023-12-21 13:17:47696 days ago1703164667
0x7C4633f6...7DC5Ab9c9
0.6435 ETH
Transfer188344872023-12-21 13:17:47696 days ago1703164667
0x7C4633f6...7DC5Ab9c9
0.0715 ETH
Transfer188344872023-12-21 13:17:47696 days ago1703164667
0x7C4633f6...7DC5Ab9c9
5.72 ETH
Transfer171447712023-04-28 12:57:59933 days ago1682686679
0x7C4633f6...7DC5Ab9c9
0.2574 ETH
Transfer171447712023-04-28 12:57:59933 days ago1682686679
0x7C4633f6...7DC5Ab9c9
0.234 ETH
Transfer171447712023-04-28 12:57:59933 days ago1682686679
0x7C4633f6...7DC5Ab9c9
0.234 ETH
Transfer171447712023-04-28 12:57:59933 days ago1682686679
0x7C4633f6...7DC5Ab9c9
0.234 ETH
Transfer171447712023-04-28 12:57:59933 days ago1682686679
0x7C4633f6...7DC5Ab9c9
0.234 ETH
Transfer171447712023-04-28 12:57:59933 days ago1682686679
0x7C4633f6...7DC5Ab9c9
0.234 ETH
Transfer171447712023-04-28 12:57:59933 days ago1682686679
0x7C4633f6...7DC5Ab9c9
1.755 ETH
Transfer171447712023-04-28 12:57:59933 days ago1682686679
0x7C4633f6...7DC5Ab9c9
1.053 ETH
Transfer171447712023-04-28 12:57:59933 days ago1682686679
0x7C4633f6...7DC5Ab9c9
0.351 ETH
Transfer171447712023-04-28 12:57:59933 days ago1682686679
0x7C4633f6...7DC5Ab9c9
0.117 ETH
Transfer171447712023-04-28 12:57:59933 days ago1682686679
0x7C4633f6...7DC5Ab9c9
6.9966 ETH
Transfer160595332022-11-27 6:28:591086 days ago1669530539
0x7C4633f6...7DC5Ab9c9
64.025 ETH
Transfer160595332022-11-27 6:28:591086 days ago1669530539
0x7C4633f6...7DC5Ab9c9
5.122 ETH
Transfer160595332022-11-27 6:28:591086 days ago1669530539
0x7C4633f6...7DC5Ab9c9
5.122 ETH
Transfer160595332022-11-27 6:28:591086 days ago1669530539
0x7C4633f6...7DC5Ab9c9
5.122 ETH
Transfer160595332022-11-27 6:28:591086 days ago1669530539
0x7C4633f6...7DC5Ab9c9
5.6342 ETH
Transfer160595332022-11-27 6:28:591086 days ago1669530539
0x7C4633f6...7DC5Ab9c9
5.122 ETH
View All Internal Transactions
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
NFTBoxesBox

Compiler Version
v0.8.2+commit.661d1103

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, Unlicense license
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.2;

import "ERC721.sol";
import "ERC2981.sol";
import "IVendingMachine.sol";
import "Ownable.sol";	
import "SubscriptionService.sol";
import "BoxJsonParser.sol";


contract NFTBoxesBox is ERC721("NFTBox", "[BOX]"), Ownable, ERC2981, BoxJsonParser {
    
	struct BoxMould{
		uint8				live; // bool
		uint8				shared; // bool
		uint128				maxEdition;
		uint128				maxBuyAmount;
		uint128				currentEditionCount;
		uint128				boughtCount;
		uint256				price;
		address payable[]	artists;
		uint256[]			shares;
		string				name;
		string				series;
		string				theme;
		string				ipfsHash;
		string				arweaveHash;
	}

	struct Box {
		uint256				mouldId;
		uint256				edition;
	}

	uint256 totalSupply;
	IVendingMachine public	vendingMachine;
	SubscriptionService public subService;
	uint256 public			boxMouldCount;

	uint256 constant public TOTAL_SHARES = 1000;

	mapping(uint256 => BoxMould) public	boxMoulds;
	mapping(uint256 =>  Box) public	boxes;
	mapping(uint256 => bool) public lockedBoxes;
	mapping(uint256 => mapping(address => uint256)) boxBoughtMapping;
	mapping(uint256 => uint256) subDistroTracker;

	mapping(address => uint256) public teamShare;
	address payable[] public team;


	mapping(address => bool) public authorisedCaller;

	event BoxMouldCreated(uint256 id);
	event BoxBought(uint256 indexed boxMould, uint256 boxEdition, uint256 tokenId);
	event BatchDeployed(uint256 indexed boxMould, uint256 batchSize);

	constructor(address _service) {
		boxMouldCount = 1;
		team.push(payable(0x3428B1746Dfd26C7C725913D829BE2706AA89B2e));
		team.push(payable(0x4C7BEdfA26C744e6bd61CBdF86F3fc4a76DCa073));
		team.push(payable(0x00000000002bF160523a704a019a0C0E63a41B66));
		team.push(payable(0x8C26a91205e531E8B35Cf3315f384727B9681D75));

		teamShare[address(0x3428B1746Dfd26C7C725913D829BE2706AA89B2e)] = 580;
        teamShare[address(0x4C7BEdfA26C744e6bd61CBdF86F3fc4a76DCa073)] = 10;
        teamShare[address(0x4125515f4e5A0db45316bf05a7C102c13e1e5Ba1)] = 90;
		teamShare[address(0x8C26a91205e531E8B35Cf3315f384727B9681D75)] = 30;
		vendingMachine = IVendingMachine(0x6d4530149e5B4483d2F7E60449C02570531A0751);
		subService = SubscriptionService(_service);
	}


	function supportsInterface(bytes4 interfaceId) public view override(ERC721, ERC2981) returns (bool) {
        return ERC2981.supportsInterface(interfaceId)
            || ERC721.supportsInterface(interfaceId);
    }

	function setDefaultRoyalty(address _receiver, uint96 _feeNumerator) external onlyOwner {
		_setDefaultRoyalty(_receiver, _feeNumerator);
	} 

	modifier authorised() {
		require(authorisedCaller[msg.sender] || msg.sender == owner(), "Not authorised to execute.");
		_;
	}

	function setSubService(address _newSub) external onlyOwner {
		subService = SubscriptionService(_newSub);
	}

	function setCaller(address _caller, bool _value) external onlyOwner {
		authorisedCaller[_caller] = _value;
	}

	function addTeamMember(address payable _member) external onlyOwner {
		for (uint256 i = 0; i < team.length; i++)
			require( _member != team[i], "members exists already");
		team.push(_member);
	}

	function removeTeamMember(address payable _member) external onlyOwner {
		for (uint256 i = 0; i < team.length; i++)
			if (team[i] == _member) {
				delete teamShare[_member];
				team[i] = team[team.length - 1];
				team.pop();
			}
	}

	function setTeamShare(address _member, uint _share) external onlyOwner {
		require(_share <= TOTAL_SHARES, "share must be below 1000");
		for (uint256 i = 0; i < team.length; i++)
			if (team[i] == _member)
				teamShare[_member] = _share;
	}

	function setLockOnBox(uint256 _id, bool _lock) external authorised {
		require(_id <= boxMouldCount && _id > 0, "ID !exist.");
		lockedBoxes[_id] = _lock;
	}

	function createBoxMould(
		uint128 _max,
		uint128 _maxBuyAmount,
		uint256 _price,
		address payable[] memory _artists,
		uint256[] memory _shares,
		string memory _name,
		string memory _series,
		string memory _theme,
		string memory _ipfsHash,
		string memory _arweaveHash)
		external
		onlyOwner {
		require(_artists.length == _shares.length, "arrays !same len");
		boxMoulds[boxMouldCount + 1] = BoxMould({
			live: uint8(0),
			shared: uint8(0),
			maxEdition: _max,
			maxBuyAmount: _maxBuyAmount,
			currentEditionCount: 0,
			boughtCount: 0,
			price: _price,
			artists: _artists,
			shares: _shares,
			name: _name,
			series: _series,
			theme: _theme,
			ipfsHash: _ipfsHash,
			arweaveHash: _arweaveHash
		});
		boxMouldCount++;
		lockedBoxes[boxMouldCount] = true;
		emit BoxMouldCreated(boxMouldCount);
	}

	function removeArtist(uint256 _id, address payable _artist) external onlyOwner {
		BoxMould storage boxMould = boxMoulds[_id];
		require(_id <= boxMouldCount && _id > 0, "ID !exist");
		for (uint256 i = 0; i < boxMould.artists.length; i++) {
			if (boxMould.artists[i] == _artist) {
				boxMould.artists[i] = boxMould.artists[boxMould.artists.length - 1];
				boxMould.artists.pop();
				boxMould.shares[i] = boxMould.shares[boxMould.shares.length - 1];
				boxMould.shares.pop();
			}
		}
	}
	
	function addArtists(uint256 _id, address payable _artist, uint256 _share) external onlyOwner {
		BoxMould storage boxMould = boxMoulds[_id];
		require(_id <= boxMouldCount && _id > 0, "ID !exist");
		boxMould.artists.push(_artist);
		boxMould.shares.push(_share);
	}

	function distributeBoxToSubHolders(uint256 _id) external onlyOwner {
		require(_id <= boxMouldCount && _id > 0, "ID !exist");
		uint256 trackerId = subDistroTracker[_id]++;
		require(trackerId < 10, "Distro done");

		BoxMould storage boxMould = boxMoulds[_id];
		uint128 currentEdition = boxMould.currentEditionCount;
		address[] memory subHolders = subService.fetchValidHolders(trackerId * 50, 50);
		uint256 mintTracker;
		uint256 _totalSupply = totalSupply;
		for (uint256 i = 0; i < 50; i++) {
			address holder = subHolders[i];
			if (holder != address(0)) {
				_buy(currentEdition, _id, mintTracker, holder, _totalSupply + mintTracker + 1);
				mintTracker++;
			}
		}
		totalSupply += mintTracker;
		boxMould.currentEditionCount += uint128(mintTracker);
		if (currentEdition + mintTracker == boxMould.maxEdition)
			boxMould.live = uint8(1);
		if (trackerId == 9)
			subService.pushNewBox();
	}

	function buyManyBoxes(uint256 _id, uint128 _quantity) external payable {
		BoxMould storage boxMould = boxMoulds[_id];
		uint128 currentEdition = boxMould.currentEditionCount;
		uint128 max = boxMould.maxEdition;
		require(_id <= boxMouldCount && _id > 0, "ID !exist");
		require(boxMould.live == 0, "!live");
		require(!lockedBoxes[_id], "locked");
		require(boxMould.price * _quantity == msg.value, "!price");
		require(currentEdition + _quantity <= max, "Too many boxes");
		require(boxBoughtMapping[_id][msg.sender] + _quantity <= boxMould.maxBuyAmount, "!buy");

		uint256 _totalSupply = totalSupply;
		for (uint128 i = 0; i < _quantity; i++)
			_buy(currentEdition, _id, i, msg.sender, _totalSupply + i + 1);
		totalSupply += _quantity;
		boxMould.currentEditionCount += _quantity;
		boxMould.boughtCount += _quantity;
		boxBoughtMapping[_id][msg.sender] = boxBoughtMapping[_id][msg.sender] + _quantity;
		if (currentEdition + _quantity == max)
			boxMould.live = uint8(1);
	}

	function _buy(uint128 _currentEdition, uint256 _id, uint256 _new, address _recipient, uint256 _tokenId) internal {
		boxes[_tokenId] = Box(_id, _currentEdition + _new + 1);
		//safe mint?
		emit BoxBought(_id, _currentEdition + _new + 1, _tokenId);
		_mint(_recipient, _tokenId);
	}

	// close a sale if not sold out
	function closeBox(uint256 _id) external authorised {
		BoxMould storage boxMould = boxMoulds[_id];
		require(_id <= boxMouldCount && _id > 0, "ID !exist.");
		boxMould.live = uint8(1);
	}

	function setVendingMachine(address _machine) external onlyOwner {
		vendingMachine = IVendingMachine(_machine);
	}

	function distributeOffchain(uint256 _id, address[][] calldata _recipients, uint256[] calldata _ids) external authorised {
		BoxMould memory boxMould= boxMoulds[_id];
		require(boxMould.live == 1, "live");
		require (_recipients[0].length == _ids.length, "bad array");

		// i is batch number
		for (uint256 i = 0; i < _recipients.length; i++) {
			// j is for the index of nft ID to send
			for (uint256 j = 0;j <  _recipients[0].length; j++)
				vendingMachine.NFTMachineFor(_ids[j], _recipients[i][j]);
		}
		emit BatchDeployed(_id, _recipients.length);
	}

	function distributeShares(uint256 _id) external {
		BoxMould storage boxMould= boxMoulds[_id];
		require(_id <= boxMouldCount && _id > 0, "ID !exist.");
		require(boxMould.live == 1 && boxMould.shared == 0,  "!distribute");
		require(is100(_id), "sum != 100%.");

		boxMould.shared = 1;
		uint256 rev = uint256(boxMould.boughtCount) * boxMould.price;
		uint256 share;
		for (uint256 i = 0; i < team.length; i++) {
			share = rev * teamShare[team[i]] / TOTAL_SHARES;
			team[i].transfer(share);
		}
		for (uint256 i = 0; i < boxMould.artists.length; i++) {
			share = rev * boxMould.shares[i] / TOTAL_SHARES;
			boxMould.artists[i].transfer(share);
		}
	}

	function is100(uint256 _id) internal returns(bool) {
		BoxMould storage boxMould= boxMoulds[_id];
		uint256 total;
		for (uint256 i = 0; i < team.length; i++) {
			total = total + teamShare[team[i]];
		}
		for (uint256 i = 0; i < boxMould.shares.length; i++) {
			total = total + boxMould.shares[i];
		}
		return total == TOTAL_SHARES;
	}

	function getArtist(uint256 _id) external view returns (address payable[] memory) {
		return boxMoulds[_id].artists;
	}

	function getArtistShares(uint256 _id) external view returns (uint256[] memory) {
		return boxMoulds[_id].shares;
	}

    function getBoxMetaData(uint256 _id) external view returns 
    (uint256 boxId, uint256 boxEdition, uint128 boxMax, string memory boxName, string memory boxSeries, string memory boxTheme, string memory boxHashIPFS, string memory boxHashArweave) {
        Box memory box = boxes[_id];
        BoxMould memory mould = boxMoulds[box.mouldId];
        return (box.mouldId, box.edition, mould.maxEdition, mould.name, mould.series, mould.theme, mould.ipfsHash, mould.arweaveHash);
    }

	function _transfer(address from, address to, uint256 tokenId) internal override {
		Box memory box = boxes[tokenId];
		require(!lockedBoxes[box.mouldId], "Box is locked");
		super._transfer(from, to, tokenId);
	}

	function tokenURI(uint256 _tokenId) public view override returns(string memory) {
		Box memory box = boxes[_tokenId];
		require(box.mouldId > 0);
		BoxMould memory mould = boxMoulds[box.mouldId];
		return string(
			abi.encodePacked(
				generateTokenUriPart1(box.edition, mould.series, mould.name, mould.theme),
				generateTokenUriPart2(box.mouldId, box.edition, mould.maxEdition, mould.series, mould.ipfsHash, mould.theme)
			)
		);
	}

	// function tokenURITest(uint256 _tokenId) public view returns(string memory) {

	// 	return string(
	// 		abi.encodePacked(
	// 			generateTokenUriPart1(66, "Main", "December 2021", "Finale"),
	// 			generateTokenUriPart2(12, 66, 132, "Main", "QmefbyT1uqjDaHsLzVMmwicjHVAXQjzfkeCXjfBwUA8om2", "Finale")
	// 		)
	// 	);
	// }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

import "IERC721.sol";
import "IERC721Receiver.sol";
import "IERC721Metadata.sol";
import "Address.sol";
import "Context.sol";
import "Strings.sol";
import "ERC165.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings for uint256;

    // Token name
    string internal _name;

    // Token symbol
    string internal _symbol;

    // Mapping from token ID to owner address
    mapping(uint256 => address) private _owners;

    // Mapping owner address to token count
    mapping(address => uint256) private _balances;

    // Mapping from token ID to approved address
    mapping(uint256 => address) private _tokenApprovals;

    // Mapping from owner to operator approvals
    mapping(address => mapping(address => bool)) private _operatorApprovals;

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
        return
            interfaceId == type(IERC721).interfaceId ||
            interfaceId == type(IERC721Metadata).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: balance query for the zero address");
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[tokenId];
        require(owner != address(0), "ERC721: owner query for nonexistent token");
        return owner;
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

        string memory baseURI = _baseURI();
        return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
    }

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, can be overridden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(
            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        require(_exists(tokenId), "ERC721: approved query for nonexistent token");

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        _setApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC721-isApprovedForAll}.
     */
    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[owner][operator];
    }

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");

        _transfer(from, to, tokenId);
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        safeTransferFrom(from, to, tokenId, "");
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
        _safeTransfer(from, to, tokenId, _data);
    }

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _owners[tokenId] != address(0);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        require(_exists(tokenId), "ERC721: operator query for nonexistent token");
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _mint(to, tokenId);
        require(
            _checkOnERC721Received(address(0), to, tokenId, _data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _beforeTokenTransfer(address(0), to, tokenId);

        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(address(0), to, tokenId);

        _afterTokenTransfer(address(0), to, tokenId);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

        _beforeTokenTransfer(owner, address(0), tokenId);

        // Clear approvals
        _approve(address(0), tokenId);

        _balances[owner] -= 1;
        delete _owners[tokenId];

        emit Transfer(owner, address(0), tokenId);

        _afterTokenTransfer(owner, address(0), tokenId);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId);

        _balances[from] -= 1;
        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits a {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits a {ApprovalForAll} event.
     */
    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal virtual {
        require(owner != operator, "ERC721: approve to caller");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param _data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) private returns (bool) {
        if (to.isContract()) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
                return retval == IERC721Receiver.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

import "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 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
    ) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts 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);
}

File 5 of 19 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/common/ERC2981.sol)

pragma solidity ^0.8.0;

import "IERC2981.sol";
import "ERC165.sol";

/**
 * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.
 *
 * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for
 * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.
 *
 * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the
 * fee is specified in basis points by default.
 *
 * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See
 * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to
 * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.
 *
 * _Available since v4.5._
 */
abstract contract ERC2981 is IERC2981, ERC165 {
    struct RoyaltyInfo {
        address receiver;
        uint96 royaltyFraction;
    }

    RoyaltyInfo private _defaultRoyaltyInfo;
    mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo;

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) {
        return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @inheritdoc IERC2981
     */
    function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) {
        RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId];

        if (royalty.receiver == address(0)) {
            royalty = _defaultRoyaltyInfo;
        }

        uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator();

        return (royalty.receiver, royaltyAmount);
    }

    /**
     * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a
     * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an
     * override.
     */
    function _feeDenominator() internal pure virtual returns (uint96) {
        return 10000;
    }

    /**
     * @dev Sets the royalty information that all ids in this contract will default to.
     *
     * Requirements:
     *
     * - `receiver` cannot be the zero address.
     * - `feeNumerator` cannot be greater than the fee denominator.
     */
    function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {
        require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
        require(receiver != address(0), "ERC2981: invalid receiver");

        _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
    }

    /**
     * @dev Removes default royalty information.
     */
    function _deleteDefaultRoyalty() internal virtual {
        delete _defaultRoyaltyInfo;
    }

    /**
     * @dev Sets the royalty information for a specific token id, overriding the global default.
     *
     * Requirements:
     *
     * - `tokenId` must be already minted.
     * - `receiver` cannot be the zero address.
     * - `feeNumerator` cannot be greater than the fee denominator.
     */
    function _setTokenRoyalty(
        uint256 tokenId,
        address receiver,
        uint96 feeNumerator
    ) internal virtual {
        require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
        require(receiver != address(0), "ERC2981: Invalid parameters");

        _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);
    }

    /**
     * @dev Resets royalty information for the token id back to the global default.
     */
    function _resetTokenRoyalty(uint256 tokenId) internal virtual {
        delete _tokenRoyaltyInfo[tokenId];
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol)

pragma solidity ^0.8.0;

import "IERC165.sol";

/**
 * @dev Interface for the NFT Royalty Standard.
 *
 * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
 * support for royalty payments across all NFT marketplaces and ecosystem participants.
 *
 * _Available since v4.5._
 */
interface IERC2981 is IERC165 {
    /**
     * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
     * exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
     */
    function royaltyInfo(uint256 tokenId, uint256 salePrice)
        external
        view
        returns (address receiver, uint256 royaltyAmount);
}

pragma solidity ^0.8.2;

interface IVendingMachine {

	function NFTMachineFor(uint256 NFTId, address _recipient) external;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "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 internal _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        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: UNLICENSED
pragma solidity ^0.8.2;

import "ERC721Enumerable.sol";
import "Ownable.sol";
import "SubJsonParser.sol";

contract SubscriptionService is ERC721Enumerable, Ownable, SubJsonParser {

	struct SubData {
		uint32 tier;
		uint32 start;
		uint32 length;
	}

	uint256 public constant MAX = 500;
	uint256 public maxSupply = 300;
	bool public paused;
	uint32 public counter;

	uint256[3] public subPrice;
	uint256 buyCounter;

	mapping(uint256 => uint256) expiredStack;
	uint256 expiredCounter;
	mapping(uint256 => SubData) public subData;
	mapping(address => bool) public authorisedCaller;

	bool public initiated;

	bool public buySwitch;

	event SubBought(address indexed buyer, uint256 indexed tokenId, uint32 tier, uint256 value);

	constructor(string memory _name, string memory _symbol)  ERC721(_name, _symbol) {}

	function init (string memory __name, string memory __symbol) external {
		require(!initiated);
		initiated = true;
		paused = true;
		subPrice[0] = 1_950_000_000_000_000_000;
		subPrice[1] = 3_705_000_000_000_000_000;
		subPrice[2] = 5_265_000_000_000_000_000;

		counter = 1;
		_name = __name;
		_symbol = __symbol;
		_owner = msg.sender;
	}

	modifier notPaused() {
		require(!paused, "Paused");
		_;
	}

	modifier authorised() {
		require(authorisedCaller[msg.sender], "Not authorised to execute.");
		_;
	}

	modifier nonBuyable() {
		require(buySwitch, "Not authorised to buy.");
		_;
	}

	function setCaller(address _caller, bool _value) external onlyOwner {
		authorisedCaller[_caller] = _value;
	}

	function fetchEth() external onlyOwner {
		payable(owner()).transfer(address(this).balance);
	}

	function pause() external onlyOwner {
		paused = true;
	}

	function unpause() external onlyOwner {
		paused = false;
	}

	function switchIt() external onlyOwner {
		buySwitch = !buySwitch;
	}

	function pushNewBox() external authorised {
		counter++;
	}

	function setPrice(uint256 _index, uint256 _price) external onlyOwner {
		subPrice[_index] = _price;
	}

	function setMaxSupply(uint256 _max) external onlyOwner {
		require(_max <= MAX);
		maxSupply = _max;
	}

	function refundSub(uint256 _tokenId) external onlyOwner {
		require(!isExpired(_tokenId), "Expired");
		SubData memory data = subData[_tokenId];
		expiredStack[expiredCounter++] = _tokenId;
		delete subData[_tokenId];
		_burn(_tokenId);
	}

	function expireSub(uint256 _tokenId) external {
		require(isExpired(_tokenId), "Not expired");
		expiredStack[expiredCounter++] = _tokenId;
		delete subData[_tokenId];
		_burn(_tokenId);
	}

	function buySub(uint8 _tier) external payable {
		buySub(_tier, msg.sender);
	}

	function buySubOwner(uint8 _tier, address _for) public payable onlyOwner {
		require(_tier == 0 || _tier == 1 || _tier == 2, "Sub: Wrong sub model");
		require(totalSupply() < maxSupply, "No more subs of that tier to buy");
		require(msg.value == subPrice[_tier], "!price");

		if (buyCounter < MAX) {
			subData[++buyCounter] = SubData(_tier, counter, _getLength(_tier));
			_mint(_for, buyCounter);
			emit SubBought(_for, buyCounter, _tier, msg.value);
		}
		else {
			require(expiredCounter > 0, "No subs available, try next month");
			uint256 id = expiredStack[--expiredCounter];
			subData[id] = SubData(_tier, counter, _getLength(_tier));
			_mint(_for, id);
			emit SubBought(_for, id, _tier, msg.value);
		}
	}

	function buySub(uint8 _tier, address _for) public payable nonBuyable {
		require(_tier == 0 || _tier == 1 || _tier == 2, "Sub: Wrong sub model");
		require(totalSupply() < maxSupply, "No more subs of that tier to buy");
		require(msg.value == subPrice[_tier], "!price");

		if (buyCounter < MAX) {
			subData[++buyCounter] = SubData(_tier, counter, _getLength(_tier));
			_mint(_for, buyCounter);
			emit SubBought(_for, buyCounter, _tier, msg.value);
		}
		else {
			require(expiredCounter > 0, "No subs available, try next month");
			uint256 id = expiredStack[--expiredCounter];
			subData[id] = SubData(_tier, counter, _getLength(_tier));
			_mint(_for, id);
			emit SubBought(_for, id, _tier, msg.value);
		}
	}

	function isExpired(uint256 _tokenId) public view returns(bool) {
		SubData memory data = subData[_tokenId];
		return data.start + data.length <= counter;
	}

	function _getType(uint32 _length) internal pure returns(uint256) {
		if (_length == 3)
			return 0;
		else if (_length == 6)
			return 1;
		if (_length == 9)
			return 2;
		return 0;
	}

	function _getLength(uint8 _type) internal pure returns(uint32) {
		if (_type == uint8(0))
			return uint32(3);
		else if (_type == uint8(1))
			return uint32(6);
		if (_type == uint8(2))
			return uint32(9);
		return 0;
	}

	function fetchValidHolders(uint256 _start, uint256 _len) external view returns(address[] memory holders) {
		holders = new address[](_len);
		for (uint256 i = _start; i < _start + _len; i++) {
			if (_exists(i)) {
				address owner = ownerOf(i);
				if (!isExpired(i))
					holders[i - _start] = ownerOf(i);
			}
		}
	}

	function returnSubDataOfHolder(address _holder) external view returns(SubData[] memory data) {
		uint256 amount = balanceOf(_holder);
		data = new SubData[](amount);
		for (uint256 i = 0; i < amount; i++) {
			data[i] = subData[tokenOfOwnerByIndex(_holder, i)];
		}
	}

	function hasUserSub(address _holder, uint256 _tierId) external view returns(bool) {
		uint256 amount = balanceOf(_holder);
		for (uint256 i = 0; i < amount; i++) {
			uint256 tokenId = tokenOfOwnerByIndex(_holder, i);
			SubData memory data = subData[tokenId];
			if (data.tier == _tierId && !isExpired(tokenId))
				return true;
		}
		return false;
	}

	function _transfer(address from, address to, uint256 tokenId) internal override notPaused {
		super._transfer(from, to, tokenId);
	}


	function tokenURI(uint256 _tokenId) public view override returns(string memory) {
		SubData memory data = subData[_tokenId];
		require(_exists(_tokenId));
		return string(
			abi.encodePacked(
				generateTokenUriPart1(_tokenId, uint256(data.tier)),
				generateTokenUriPart2(_getLength(uint8(data.tier)), counter, data.start, data.length)
			)
		);
	}
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "ERC721.sol";
import "IERC721Enumerable.sol";

/**
 * @dev This implements an optional extension of {ERC721} defined in the EIP that adds
 * enumerability of all the token ids in the contract as well as all token ids owned by each
 * account.
 */
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
    // Mapping from owner to list of owned token IDs
    mapping(address => mapping(uint256 => uint256)) private _ownedTokens;

    // Mapping from token ID to index of the owner tokens list
    mapping(uint256 => uint256) private _ownedTokensIndex;

    // Array with all token ids, used for enumeration
    uint256[] private _allTokens;

    // Mapping from token id to position in the allTokens array
    mapping(uint256 => uint256) private _allTokensIndex;

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
        return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
        return _ownedTokens[owner][index];
    }

    /**
     * @dev See {IERC721Enumerable-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _allTokens.length;
    }

    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
        return _allTokens[index];
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual override {
        super._beforeTokenTransfer(from, to, tokenId);

        if (from == address(0)) {
            _addTokenToAllTokensEnumeration(tokenId);
        } else if (from != to) {
            _removeTokenFromOwnerEnumeration(from, tokenId);
        }
        if (to == address(0)) {
            _removeTokenFromAllTokensEnumeration(tokenId);
        } else if (to != from) {
            _addTokenToOwnerEnumeration(to, tokenId);
        }
    }

    /**
     * @dev Private function to add a token to this extension's ownership-tracking data structures.
     * @param to address representing the new owner of the given token ID
     * @param tokenId uint256 ID of the token to be added to the tokens list of the given address
     */
    function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
        uint256 length = ERC721.balanceOf(to);
        _ownedTokens[to][length] = tokenId;
        _ownedTokensIndex[tokenId] = length;
    }

    /**
     * @dev Private function to add a token to this extension's token tracking data structures.
     * @param tokenId uint256 ID of the token to be added to the tokens list
     */
    function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
        _allTokensIndex[tokenId] = _allTokens.length;
        _allTokens.push(tokenId);
    }

    /**
     * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
     * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
     * gas optimizations e.g. when performing a transfer operation (avoiding double writes).
     * This has O(1) time complexity, but alters the order of the _ownedTokens array.
     * @param from address representing the previous owner of the given token ID
     * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
     */
    function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
        // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
        uint256 tokenIndex = _ownedTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary
        if (tokenIndex != lastTokenIndex) {
            uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];

            _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
            _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
        }

        // This also deletes the contents at the last position of the array
        delete _ownedTokensIndex[tokenId];
        delete _ownedTokens[from][lastTokenIndex];
    }

    /**
     * @dev Private function to remove a token from this extension's token tracking data structures.
     * This has O(1) time complexity, but alters the order of the _allTokens array.
     * @param tokenId uint256 ID of the token to be removed from the tokens list
     */
    function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
        // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = _allTokens.length - 1;
        uint256 tokenIndex = _allTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
        // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
        // an 'if' statement (like in _removeTokenFromOwnerEnumeration)
        uint256 lastTokenId = _allTokens[lastTokenIndex];

        _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
        _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index

        // This also deletes the contents at the last position of the array
        delete _allTokensIndex[tokenId];
        _allTokens.pop();
    }
}

// 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: UNLICENSED
pragma solidity ^0.8.2;

contract SubJsonParser {

	function generateTokenUriPart1(uint256 _tokenId, uint256 _tier) public pure returns(string memory) {
		return string(
			abi.encodePacked(
				bytes('data:application/json;utf8,{"name":"'),
				_getName(_tokenId, _tier),
				bytes('","description":"'),
				"NFTBox subscription that guarantees the reception of a monthly box until it expires.",
				bytes('","external_url":"'),
				_getExternalUrl()
			)
		);
	}

	function generateTokenUriPart2(uint256 _tier, uint256 _counter, uint256 _start, uint256 _length) public pure returns(string memory) {
		return string(
			abi.encodePacked(
				bytes('","attributes":['),
				_tierSub(_tier),
				_expiry(_counter - _start + _length),
				bytes(',"image":"'),
				_getImageCache(_tier),
				bytes('"}')
			)
		);
	}

	function _getImageCache(uint256 _tier) internal pure returns(string memory) {
		if (_tier == 3)
			return string(abi.encodePacked("https://ipfs.io/ipfs/QmV3GaTzqLvGSRTAuiLQGsBUDDx4Dr7G7gxqtR8eRhudLL"));
		if (_tier == 6)
			return string(abi.encodePacked("https://ipfs.io/ipfs/QmZBtFNpbrstaKwSDzsB3uFGMeN7b5VjT93Udab2EbB2tQ"));
		if (_tier == 9)
			return string(abi.encodePacked("https://ipfs.io/ipfs/QmPCv1DEWH6pTXXVVdR3nqcavT1bzNRY5QoyR6KEzVjUkb"));
		return string(abi.encodePacked(""));
	}

	function _getName(uint256 _tokenId, uint256 _tier) internal pure returns(string memory) {
		return string(abi.encodePacked("NFTBox ", _tierName(_tier), " Subscription"));
	}

	function _tierSub(uint256 _tier) internal pure returns(string memory) {
		return string(abi.encodePacked(bytes('{"trait_type": "Tier","value":"'), _tierName(_tier), bytes('"},')));
	}

	function _tierName(uint256 _tier) internal pure returns(string memory) {
		if (_tier == 0)
			return string(abi.encodePacked("Bronze"));
		if (_tier == 1)
			return string(abi.encodePacked("Silver"));
		if (_tier == 2)
			return string(abi.encodePacked("Gold"));
		if (_tier == 3)
			return string(abi.encodePacked("Bronze"));
		if (_tier == 6)
			return string(abi.encodePacked("Silver"));
		if (_tier == 9)
			return string(abi.encodePacked("Gold"));
	}

	function _expiry(uint256 _expirationCount) internal pure returns(string memory) {
		return string(abi.encodePacked(bytes('{"trait_type": "Boxes left","value":"'), _uint2str(_expirationCount), bytes('"}]')));
	}

	function _getImageCache(string memory _hash) internal pure returns(string memory) {
		return string(abi.encodePacked("https://ipfs.io/ipfs/", _hash));
	}

	function _getExternalUrl() internal pure returns(string memory) {
		return string(abi.encodePacked("https://www.nftboxes.io/"));
	}

	function _uint2str(uint _i) internal pure returns (string memory _uintAsString) {
		if (_i == 0) {
			return "0";
		}
		uint j = _i;
		uint len;
		while (j != 0) {
			len++;
			j /= 10;
		}
		bytes memory bstr = new bytes(len);
		uint k = len;
		while (_i != 0) {
			k = k-1;
			uint8 temp = (48 + uint8(_i - _i / 10 * 10));
			bytes1 b1 = bytes1(temp);
			bstr[k] = b1;
			_i /= 10;
		}
		return string(bstr);
	}
}

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.2;

contract BoxJsonParser {

	function generateTokenUriPart1(uint256 _tokenId, string memory _series, string memory _name, string memory _theme) public pure returns(string memory) {
		return string(
			abi.encodePacked(
				bytes('data:application/json;utf8,{"name":"'),
				_getName(_name, _tokenId),
				bytes('","description":"'),
				"NFTBoxes are a curated monthly box of NFTs on the newest gold standard of NFT technology."
			)
		);
	}

	function generateTokenUriPart2(uint256 _boxId, uint256 _tokenId, uint256 _max, string memory _series, string memory _hash, string memory _theme) public pure returns(string memory) {
		return string(
			abi.encodePacked(
				bytes('","attributes":['),
				_traitBoxId(_boxId),
				_traitBoxSeries(_series),
				_traitBoxTheme(_theme),
				_traitBoxEdition(_tokenId, _max),
				bytes(',"image":"'),
				_getImageCache(_hash),bytes('"}')
			)
		);
	}

	function _traitBoxId(uint256 _boxId) internal pure returns(string memory) {
		return string(abi.encodePacked(bytes('{"trait_type": "box id","value":"'), _uint2str(_boxId), bytes('"},')));
	}

	function _traitBoxSeries(string memory _series) internal pure returns(string memory) {
		return string(abi.encodePacked(bytes('{"trait_type": "box series","value":"'), _series, bytes('"},')));
	}

	function _traitBoxTheme(string memory _theme) internal pure returns(string memory) {
		return string(abi.encodePacked(bytes('{"trait_type": "box theme","value":"'), _theme, bytes('"},')));
	}

	function _traitBoxEdition(uint256 _tokenId, uint256 _maxEdition) internal pure returns(string memory) {
		return string(abi.encodePacked(bytes('{"trait_type": "box edition","value":"'), _uint2str(_tokenId), bytes(' of '), _uint2str(_maxEdition), bytes('"}]')));
	}

	function _getName(string memory _name, uint256 _tokenId) internal pure returns(string memory) {
		return string(abi.encodePacked(_name, " #", _uint2str(_tokenId)));
	}

	function _getImageCache(string memory _hash) internal pure returns(string memory) {
		return string(abi.encodePacked("https://ipfs.io/ipfs/", _hash));
	}

	function _uint2str(uint _i) internal pure returns (string memory _uintAsString) {
		if (_i == 0) {
			return "0";
		}
		uint j = _i;
		uint len;
		while (j != 0) {
			len++;
			j /= 10;
		}
		bytes memory bstr = new bytes(len);
		uint k = len;
		while (_i != 0) {
			k = k-1;
			uint8 temp = (48 + uint8(_i - _i / 10 * 10));
			bytes1 b1 = bytes1(temp);
			bstr[k] = b1;
			_i /= 10;
		}
		return string(bstr);
	}
}

Settings
{
  "evmVersion": "istanbul",
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_service","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"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":"boxMould","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"batchSize","type":"uint256"}],"name":"BatchDeployed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"boxMould","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"boxEdition","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"BoxBought","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"}],"name":"BoxMouldCreated","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":"TOTAL_SHARES","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"address payable","name":"_artist","type":"address"},{"internalType":"uint256","name":"_share","type":"uint256"}],"name":"addArtists","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_member","type":"address"}],"name":"addTeamMember","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"authorisedCaller","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"boxMouldCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"boxMoulds","outputs":[{"internalType":"uint8","name":"live","type":"uint8"},{"internalType":"uint8","name":"shared","type":"uint8"},{"internalType":"uint128","name":"maxEdition","type":"uint128"},{"internalType":"uint128","name":"maxBuyAmount","type":"uint128"},{"internalType":"uint128","name":"currentEditionCount","type":"uint128"},{"internalType":"uint128","name":"boughtCount","type":"uint128"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"series","type":"string"},{"internalType":"string","name":"theme","type":"string"},{"internalType":"string","name":"ipfsHash","type":"string"},{"internalType":"string","name":"arweaveHash","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"boxes","outputs":[{"internalType":"uint256","name":"mouldId","type":"uint256"},{"internalType":"uint256","name":"edition","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"uint128","name":"_quantity","type":"uint128"}],"name":"buyManyBoxes","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"closeBox","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint128","name":"_max","type":"uint128"},{"internalType":"uint128","name":"_maxBuyAmount","type":"uint128"},{"internalType":"uint256","name":"_price","type":"uint256"},{"internalType":"address payable[]","name":"_artists","type":"address[]"},{"internalType":"uint256[]","name":"_shares","type":"uint256[]"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_series","type":"string"},{"internalType":"string","name":"_theme","type":"string"},{"internalType":"string","name":"_ipfsHash","type":"string"},{"internalType":"string","name":"_arweaveHash","type":"string"}],"name":"createBoxMould","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"distributeBoxToSubHolders","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"address[][]","name":"_recipients","type":"address[][]"},{"internalType":"uint256[]","name":"_ids","type":"uint256[]"}],"name":"distributeOffchain","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"distributeShares","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"string","name":"_series","type":"string"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_theme","type":"string"}],"name":"generateTokenUriPart1","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_boxId","type":"uint256"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_max","type":"uint256"},{"internalType":"string","name":"_series","type":"string"},{"internalType":"string","name":"_hash","type":"string"},{"internalType":"string","name":"_theme","type":"string"}],"name":"generateTokenUriPart2","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","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":"_id","type":"uint256"}],"name":"getArtist","outputs":[{"internalType":"address payable[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"getArtistShares","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"getBoxMetaData","outputs":[{"internalType":"uint256","name":"boxId","type":"uint256"},{"internalType":"uint256","name":"boxEdition","type":"uint256"},{"internalType":"uint128","name":"boxMax","type":"uint128"},{"internalType":"string","name":"boxName","type":"string"},{"internalType":"string","name":"boxSeries","type":"string"},{"internalType":"string","name":"boxTheme","type":"string"},{"internalType":"string","name":"boxHashIPFS","type":"string"},{"internalType":"string","name":"boxHashArweave","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lockedBoxes","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":"_id","type":"uint256"},{"internalType":"address payable","name":"_artist","type":"address"}],"name":"removeArtist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_member","type":"address"}],"name":"removeTeamMember","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_caller","type":"address"},{"internalType":"bool","name":"_value","type":"bool"}],"name":"setCaller","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint96","name":"_feeNumerator","type":"uint96"}],"name":"setDefaultRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"bool","name":"_lock","type":"bool"}],"name":"setLockOnBox","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newSub","type":"address"}],"name":"setSubService","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_member","type":"address"},{"internalType":"uint256","name":"_share","type":"uint256"}],"name":"setTeamShare","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_machine","type":"address"}],"name":"setVendingMachine","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"subService","outputs":[{"internalType":"contract SubscriptionService","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"team","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"teamShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vendingMachine","outputs":[{"internalType":"contract IVendingMachine","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60806040523480156200001157600080fd5b5060405162005d3d38038062005d3d833981016040819052620000349162000353565b604080518082018252600681526509c8ca884def60d31b6020808301918252835180850190945260058452645b424f585d60d81b9084015281519192916200007f91600091620002ad565b50805162000095906001906020840190620002ad565b505050620000b2620000ac6200025760201b60201c565b6200025b565b6001600c8190556013805480830182557f66de8ffda797e3de9c05e8fc57b3bf0ec28a930d40b0d285d93c06501cf6a09090810180546001600160a01b0319908116733428b1746dfd26c7c725913d829be2706aa89b2e1790915582548085018455820180548216734c7bedfa26c744e6bd61cbdf86f3fc4a76dca073179055825480850184558201805482166e2bf160523a704a019a0c0e63a41b6617905582549384019092559190910180548216738c26a91205e531e8b35cf3315f384727b9681d7590811790915560126020526102447f2a5556231608a05ac97b64345c5a2e21baac02555c887d2dd75327b0c18cac0455600a7f4b42c0dc43e7e2cec57c7e4866bff09faaba5ef9b3bf565d2d418946c71fc3b2819055605a7f3e359e31168d0d1bc8008ff6c3a73b6cb6100240cd6b7378d3e220dae004dfff55600091909152601e7f7cd96984c14683fdc049dceb589e45aebd09884098157bc9661c1aa3c98720ec5580548216736d4530149e5b4483d2f7e60449c02570531a0751179055600b80546001600160a01b039390931692909116919091179055620003c0565b3390565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b828054620002bb9062000383565b90600052602060002090601f016020900481019282620002df57600085556200032a565b82601f10620002fa57805160ff19168380011785556200032a565b828001600101855582156200032a579182015b828111156200032a5782518255916020019190600101906200030d565b50620003389291506200033c565b5090565b5b808211156200033857600081556001016200033d565b60006020828403121562000365578081fd5b81516001600160a01b03811681146200037c578182fd5b9392505050565b6002810460018216806200039857607f821691505b60208210811415620003ba57634e487b7160e01b600052602260045260246000fd5b50919050565b61596d80620003d06000396000f3fe6080604052600436106102935760003560e01c8063715018a61161015a578063b3ed1da4116100c1578063eba2389d1161007a578063eba2389d146108b5578063f2fde38b146108d5578063f5f0cebd146108f5578063f769046f14610915578063f9e1eb5f14610942578063fb4a25581461096257610293565b8063b3ed1da4146107c2578063b5a3f84f146107f6578063b88d4fde1461080c578063c87b56dd1461082c578063cb67558e1461084c578063e985e9c51461086c57610293565b80639cae6eae116101135780639cae6eae146106ff5780639e4189261461071f578063a22cb4651461073f578063a2e28ea31461075f578063a74772c81461077f578063aef078bc146107af57610293565b8063715018a614610654578063783abc8e14610669578063811dd0e21461068957806385e3f997146106b65780638da5cb5b146106cc57806395d89b41146106ea57610293565b80632a55205a116101fe578063451dc3e6116101b7578063451dc3e61461054d57806346fd55221461056d5780634ccc6b5f1461058d5780634ed3faf2146105bd5780636352211e1461060657806370a082311461062657610293565b80632a55205a146104565780632b28bc991461049557806333c1da70146104b55780633eb2b5ad146104ed578063424f4fef1461050d57806342842e0e1461052d57610293565b80630fceb9ab116102505780630fceb9ab1461038957806314eba026146103a9578063197ebd53146103c9578063231710d7146103e957806323b872dd14610409578063263030561461042957610293565b806301ffc9a71461029857806304634d8d146102cd57806306fdde03146102ef578063081812fc14610311578063095ea7b3146103495780630a7c6fca14610369575b600080fd5b3480156102a457600080fd5b506102b86102b3366004614bf4565b610982565b60405190151581526020015b60405180910390f35b3480156102d957600080fd5b506102ed6102e8366004614b23565b6109a4565b005b3480156102fb57600080fd5b506103046109e5565b6040516102c4919061536d565b34801561031d57600080fd5b5061033161032c366004614d6c565b610a77565b6040516001600160a01b0390911681526020016102c4565b34801561035557600080fd5b506102ed610364366004614af8565b610b0c565b34801561037557600080fd5b50610304610384366004614e67565b610c22565b34801561039557600080fd5b506102ed6103a4366004614d6c565b610c9d565b3480156103b557600080fd5b506102ed6103c43660046149b3565b610d2b565b3480156103d557600080fd5b506103316103e4366004614d6c565b610eab565b3480156103f557600080fd5b506102ed6104043660046149b3565b610ed5565b34801561041557600080fd5b506102ed610424366004614a07565b610f21565b34801561043557600080fd5b50610449610444366004614d6c565b610f52565b6040516102c49190615335565b34801561046257600080fd5b50610476610471366004614f0b565b610fb7565b604080516001600160a01b0390931683526020830191909152016102c4565b3480156104a157600080fd5b506102ed6104b0366004614da8565b611065565b3480156104c157600080fd5b506104d56104d0366004614d6c565b61111a565b6040516102c49c9b9a99989796959493929190615564565b3480156104f957600080fd5b506102ed6105083660046149b3565b611438565b34801561051957600080fd5b50600a54610331906001600160a01b031681565b34801561053957600080fd5b506102ed610548366004614a07565b611555565b34801561055957600080fd5b50600b54610331906001600160a01b031681565b34801561057957600080fd5b506102ed610588366004614c2c565b611570565b34801561059957600080fd5b506102b86105a8366004614d6c565b600f6020526000908152604090205460ff1681565b3480156105c957600080fd5b506105f16105d8366004614d6c565b600e602052600090815260409020805460019091015482565b604080519283526020830191909152016102c4565b34801561061257600080fd5b50610331610621366004614d6c565b611889565b34801561063257600080fd5b506106466106413660046149b3565b611900565b6040519081526020016102c4565b34801561066057600080fd5b506102ed611987565b34801561067557600080fd5b506102ed610684366004614d84565b6119bd565b34801561069557600080fd5b506106a96106a4366004614d6c565b611c11565b6040516102c491906152e8565b3480156106c257600080fd5b506106466103e881565b3480156106d857600080fd5b506006546001600160a01b0316610331565b3480156106f657600080fd5b50610304611c7f565b34801561070b57600080fd5b506102ed61071a366004614ac4565b611c8e565b34801561072b57600080fd5b506102ed61073a366004614e45565b611ce3565b34801561074b57600080fd5b506102ed61075a366004614ac4565b611d75565b34801561076b57600080fd5b506102ed61077a366004614d6c565b611d80565b34801561078b57600080fd5b506102b861079a3660046149b3565b60146020526000908152604090205460ff1681565b6102ed6107bd366004614ee9565b612095565b3480156107ce57600080fd5b506107e26107dd366004614d6c565b612409565b6040516102c49897969594939291906154d6565b34801561080257600080fd5b50610646600c5481565b34801561081857600080fd5b506102ed610827366004614a47565b612892565b34801561083857600080fd5b50610304610847366004614d6c565b6128c4565b34801561085857600080fd5b506102ed6108673660046149b3565b612d82565b34801561087857600080fd5b506102b86108873660046149cf565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b3480156108c157600080fd5b506102ed6108d0366004614af8565b612dce565b3480156108e157600080fd5b506102ed6108f03660046149b3565b612ecb565b34801561090157600080fd5b506102ed610910366004614dce565b612f66565b34801561092157600080fd5b506106466109303660046149b3565b60126020526000908152604090205481565b34801561094e57600080fd5b5061030461095d366004614f2c565b61360a565b34801561096e57600080fd5b506102ed61097d366004614d6c565b6136d3565b600061098d82613990565b8061099c575061099c826139b1565b90505b919050565b6006546001600160a01b031633146109d75760405162461bcd60e51b81526004016109ce906153f6565b60405180910390fd5b6109e18282613a01565b5050565b6060600080546109f4906157af565b80601f0160208091040260200160405190810160405280929190818152602001828054610a20906157af565b8015610a6d5780601f10610a4257610100808354040283529160200191610a6d565b820191906000526020600020905b815481529060010190602001808311610a5057829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b0316610af05760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016109ce565b506000908152600460205260409020546001600160a01b031690565b6000610b1782611889565b9050806001600160a01b0316836001600160a01b03161415610b855760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016109ce565b336001600160a01b0382161480610ba15750610ba18133610887565b610c135760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c000000000000000060648201526084016109ce565b610c1d8383613b15565b505050565b60606040518060600160405280602481526020016158ce60249139610c478487613b83565b604051806040016040528060118152602001701116113232b9b1b934b83a34b7b7111d1160791b815250604051602001610c83939291906150a6565b60405160208183030381529060405290505b949350505050565b3360009081526014602052604090205460ff1680610cc557506006546001600160a01b031633145b610ce15760405162461bcd60e51b81526004016109ce9061547c565b6000818152600d60205260409020600c548211801590610d015750600082115b610d1d5760405162461bcd60e51b81526004016109ce906153d2565b805460ff1916600117905550565b6006546001600160a01b03163314610d555760405162461bcd60e51b81526004016109ce906153f6565b60005b6013548110156109e157816001600160a01b031660138281548110610d8d57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415610e99576001600160a01b03821660009081526012602052604081205560138054610dd19060019061576c565b81548110610def57634e487b7160e01b600052603260045260246000fd5b600091825260209091200154601380546001600160a01b039092169183908110610e2957634e487b7160e01b600052603260045260246000fd5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506013805480610e7657634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b03191690550190555b80610ea381615811565b915050610d58565b60138181548110610ebb57600080fd5b6000918252602090912001546001600160a01b0316905081565b6006546001600160a01b03163314610eff5760405162461bcd60e51b81526004016109ce906153f6565b600b80546001600160a01b0319166001600160a01b0392909216919091179055565b610f2b3382613bb7565b610f475760405162461bcd60e51b81526004016109ce9061542b565b610c1d838383613cad565b6000818152600d6020908152604091829020600501805483518184028101840190945280845260609392830182828015610fab57602002820191906000526020600020905b815481526020019060010190808311610f97575b50505050509050919050565b60008281526008602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b031692820192909252829161102c5750604080518082019091526007546001600160a01b0381168252600160a01b90046001600160601b031660208201525b60208101516000906127109061104b906001600160601b03168761574d565b611055919061572d565b91519350909150505b9250929050565b6006546001600160a01b0316331461108f5760405162461bcd60e51b81526004016109ce906153f6565b6000838152600d60205260409020600c5484118015906110af5750600084115b6110cb5760405162461bcd60e51b81526004016109ce906154b3565b600481018054600180820183556000928352602080842090920180546001600160a01b0319166001600160a01b0397909716969096179095556005909201805494850181558152209091015550565b600d602052600090815260409020805460018201546002830154600384015460068501805460ff808716976101008804909116966001600160801b036201000090910481169680821696600160801b909104821695911693909261117d906157af565b80601f01602080910402602001604051908101604052809291908181526020018280546111a9906157af565b80156111f65780601f106111cb576101008083540402835291602001916111f6565b820191906000526020600020905b8154815290600101906020018083116111d957829003601f168201915b50505050509080600701805461120b906157af565b80601f0160208091040260200160405190810160405280929190818152602001828054611237906157af565b80156112845780601f1061125957610100808354040283529160200191611284565b820191906000526020600020905b81548152906001019060200180831161126757829003601f168201915b505050505090806008018054611299906157af565b80601f01602080910402602001604051908101604052809291908181526020018280546112c5906157af565b80156113125780601f106112e757610100808354040283529160200191611312565b820191906000526020600020905b8154815290600101906020018083116112f557829003601f168201915b505050505090806009018054611327906157af565b80601f0160208091040260200160405190810160405280929190818152602001828054611353906157af565b80156113a05780601f10611375576101008083540402835291602001916113a0565b820191906000526020600020905b81548152906001019060200180831161138357829003601f168201915b50505050509080600a0180546113b5906157af565b80601f01602080910402602001604051908101604052809291908181526020018280546113e1906157af565b801561142e5780601f106114035761010080835404028352916020019161142e565b820191906000526020600020905b81548152906001019060200180831161141157829003601f168201915b505050505090508c565b6006546001600160a01b031633146114625760405162461bcd60e51b81526004016109ce906153f6565b60005b601354811015611502576013818154811061149057634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03838116911614156114f05760405162461bcd60e51b81526020600482015260166024820152756d656d626572732065786973747320616c726561647960501b60448201526064016109ce565b806114fa81615811565b915050611465565b50601380546001810182556000919091527f66de8ffda797e3de9c05e8fc57b3bf0ec28a930d40b0d285d93c06501cf6a0900180546001600160a01b0319166001600160a01b0392909216919091179055565b610c1d83838360405180602001604052806000815250612892565b6006546001600160a01b0316331461159a5760405162461bcd60e51b81526004016109ce906153f6565b85518751146115de5760405162461bcd60e51b815260206004820152601060248201526f30b93930bcb99010b9b0b6b2903632b760811b60448201526064016109ce565b604051806101c00160405280600060ff168152602001600060ff1681526020018b6001600160801b031681526020018a6001600160801b0316815260200160006001600160801b0316815260200160006001600160801b0316815260200189815260200188815260200187815260200186815260200185815260200184815260200183815260200182815250600d6000600c54600161167d91906156f0565b815260208082019290925260409081016000208351815485850151938601516001600160801b03908116620100000271ffffffffffffffffffffffffffffffff00001960ff9687166101000261ff00199790951660ff1990941693909317959095169290921716929092178155606084015160018201805460808701518516600160801b029285166fffffffffffffffffffffffffffffffff1991821617851692909217905560a08501516002830180549190941691161790915560c0830151600382015560e08301518051919261175d926004850192909101906146d5565b50610100820151805161177a91600584019160209091019061473a565b506101208201518051611797916006840191602090910190614775565b5061014082015180516117b4916007840191602090910190614775565b5061016082015180516117d1916008840191602090910190614775565b5061018082015180516117ee916009840191602090910190614775565b506101a0820151805161180b91600a840191602090910190614775565b5050600c80549150600061181e83615811565b9091555050600c80546000908152600f602052604090819020805460ff19166001179055905490517f77628c9166aca2fc4ccb8b7681fa345c93f54fb929f857d05cfebbfb665bad02916118759190815260200190565b60405180910390a150505050505050505050565b6000818152600260205260408120546001600160a01b03168061099c5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b60648201526084016109ce565b60006001600160a01b03821661196b5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b60648201526084016109ce565b506001600160a01b031660009081526003602052604090205490565b6006546001600160a01b031633146119b15760405162461bcd60e51b81526004016109ce906153f6565b6119bb6000613d2b565b565b6006546001600160a01b031633146119e75760405162461bcd60e51b81526004016109ce906153f6565b6000828152600d60205260409020600c548311801590611a075750600083115b611a235760405162461bcd60e51b81526004016109ce906154b3565b60005b6004820154811015611c0b57826001600160a01b0316826004018281548110611a5f57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415611bf957600482018054611a8c9060019061576c565b81548110611aaa57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546004830180546001600160a01b039092169183908110611ae657634e487b7160e01b600052603260045260246000fd5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555081600401805480611b3557634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b0319169055019055600582018054611b699060019061576c565b81548110611b8757634e487b7160e01b600052603260045260246000fd5b9060005260206000200154826005018281548110611bb557634e487b7160e01b600052603260045260246000fd5b60009182526020909120015560058201805480611be257634e487b7160e01b600052603160045260246000fd5b600190038181906000526020600020016000905590555b80611c0381615811565b915050611a26565b50505050565b6000818152600d6020908152604091829020600401805483518184028101840190945280845260609392830182828015610fab57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611c565750505050509050919050565b6060600180546109f4906157af565b6006546001600160a01b03163314611cb85760405162461bcd60e51b81526004016109ce906153f6565b6001600160a01b03919091166000908152601460205260409020805460ff1916911515919091179055565b3360009081526014602052604090205460ff1680611d0b57506006546001600160a01b031633145b611d275760405162461bcd60e51b81526004016109ce9061547c565b600c548211158015611d395750600082115b611d555760405162461bcd60e51b81526004016109ce906153d2565b6000918252600f6020526040909120805460ff1916911515919091179055565b6109e1338383613d7d565b6006546001600160a01b03163314611daa5760405162461bcd60e51b81526004016109ce906153f6565b600c548111158015611dbc5750600081115b611dd85760405162461bcd60e51b81526004016109ce906154b3565b600081815260116020526040812080549082611df383615811565b919050559050600a8110611e375760405162461bcd60e51b815260206004820152600b60248201526a44697374726f20646f6e6560a81b60448201526064016109ce565b6000828152600d602052604081206001810154600b549192600160801b9091046001600160801b0316916001600160a01b031663aaae61eb611e7a86603261574d565b6040516001600160e01b031960e084901b16815260048101919091526032602482015260440160006040518083038186803b158015611eb857600080fd5b505afa158015611ecc573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611ef49190810190614b5b565b600954909150600090815b6032811015611f90576000848281518110611f2a57634e487b7160e01b600052603260045260246000fd5b6020026020010151905060006001600160a01b0316816001600160a01b031614611f7d57611f6f868a8684611f5f82896156f0565b611f6a9060016156f0565b613e4c565b83611f7981615811565b9450505b5080611f8881615811565b915050611eff565b508160096000828254611fa391906156f0565b9091555050600185018054839190601090611fcf908490600160801b90046001600160801b03166156ce565b82546101009290920a6001600160801b0381810219909316918316021790915586546201000090048116915061200890849087166156f0565b141561201a57845460ff191660011785555b856009141561208c57600b60009054906101000a90046001600160a01b03166001600160a01b031663b8dea0956040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561207357600080fd5b505af1158015612087573d6000803e3d6000fd5b505050505b50505050505050565b6000828152600d6020526040902060018101548154600c54600160801b9092046001600160801b039081169262010000909204169085118015906120d95750600085115b6120f55760405162461bcd60e51b81526004016109ce906154b3565b825460ff161561212f5760405162461bcd60e51b8152602060048201526005602482015264216c69766560d81b60448201526064016109ce565b6000858152600f602052604090205460ff16156121775760405162461bcd60e51b81526020600482015260066024820152651b1bd8dad95960d21b60448201526064016109ce565b34846001600160801b03168460030154612191919061574d565b146121c75760405162461bcd60e51b815260206004820152600660248201526521707269636560d01b60448201526064016109ce565b6001600160801b0381166121db85846156ce565b6001600160801b031611156122235760405162461bcd60e51b815260206004820152600e60248201526d546f6f206d616e7920626f78657360901b60448201526064016109ce565b600183015460008681526010602090815260408083203384529091529020546001600160801b039182169161225b91908716906156f0565b11156122925760405162461bcd60e51b81526004016109ce906020808252600490820152632162757960e01b604082015260600190565b60095460005b856001600160801b0316816001600160801b031610156122de576122cc84886001600160801b03841633611f5f82886156f0565b806122d6816157ea565b915050612298565b50846001600160801b0316600960008282546122fa91906156f0565b9091555050600184018054869190601090612326908490600160801b90046001600160801b03166156ce565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550848460020160008282829054906101000a90046001600160801b031661237091906156ce565b82546101009290920a6001600160801b0381810219909316918316021790915560008881526010602090815260408083203384529091529020546123b89250908716906156f0565b60008781526010602090815260408083203384529091529020556001600160801b0382166123e686856156ce565b6001600160801b0316141561240157835460ff191660011784555b505050505050565b6000818152600e60209081526040808320815180830183528154808252600192830154828601528552600d845282852083516101c081018552815460ff8082168352610100820416828801526001600160801b036201000090910481168287015293820154808516606083810191909152600160801b90910485166080830152600283015490941660a0820152600382015460c082015260048201805486518189028101890190975280875288978897879687968796879692958c959194929360e08601939290919083018282801561250b57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116124ed575b505050505081526020016005820180548060200260200160405190810160405280929190818152602001828054801561256357602002820191906000526020600020905b81548152602001906001019080831161254f575b5050505050815260200160068201805461257c906157af565b80601f01602080910402602001604051908101604052809291908181526020018280546125a8906157af565b80156125f55780601f106125ca576101008083540402835291602001916125f5565b820191906000526020600020905b8154815290600101906020018083116125d857829003601f168201915b5050505050815260200160078201805461260e906157af565b80601f016020809104026020016040519081016040528092919081815260200182805461263a906157af565b80156126875780601f1061265c57610100808354040283529160200191612687565b820191906000526020600020905b81548152906001019060200180831161266a57829003601f168201915b505050505081526020016008820180546126a0906157af565b80601f01602080910402602001604051908101604052809291908181526020018280546126cc906157af565b80156127195780601f106126ee57610100808354040283529160200191612719565b820191906000526020600020905b8154815290600101906020018083116126fc57829003601f168201915b50505050508152602001600982018054612732906157af565b80601f016020809104026020016040519081016040528092919081815260200182805461275e906157af565b80156127ab5780601f10612780576101008083540402835291602001916127ab565b820191906000526020600020905b81548152906001019060200180831161278e57829003601f168201915b50505050508152602001600a820180546127c4906157af565b80601f01602080910402602001604051908101604052809291908181526020018280546127f0906157af565b801561283d5780601f106128125761010080835404028352916020019161283d565b820191906000526020600020905b81548152906001019060200180831161282057829003601f168201915b5050505050815250509050816000015182602001518260400151836101200151846101400151856101600151866101800151876101a00151995099509950995099509950995099505050919395975091939597565b61289c3383613bb7565b6128b85760405162461bcd60e51b81526004016109ce9061542b565b611c0b84848484613efe565b6000818152600e60209081526040918290208251808401909352805480845260019091015491830191909152606091906128fd57600080fd5b80516000908152600d6020908152604080832081516101c081018352815460ff8082168352610100820416828601526001600160801b036201000090910481168285015260018301548082166060840152600160801b90048116608083015260028301541660a0820152600382015460c08201526004820180548451818702810187019095528085529194929360e08601939092908301828280156129cb57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116129ad575b5050505050815260200160058201805480602002602001604051908101604052809291908181526020018280548015612a2357602002820191906000526020600020905b815481526020019060010190808311612a0f575b50505050508152602001600682018054612a3c906157af565b80601f0160208091040260200160405190810160405280929190818152602001828054612a68906157af565b8015612ab55780601f10612a8a57610100808354040283529160200191612ab5565b820191906000526020600020905b815481529060010190602001808311612a9857829003601f168201915b50505050508152602001600782018054612ace906157af565b80601f0160208091040260200160405190810160405280929190818152602001828054612afa906157af565b8015612b475780601f10612b1c57610100808354040283529160200191612b47565b820191906000526020600020905b815481529060010190602001808311612b2a57829003601f168201915b50505050508152602001600882018054612b60906157af565b80601f0160208091040260200160405190810160405280929190818152602001828054612b8c906157af565b8015612bd95780601f10612bae57610100808354040283529160200191612bd9565b820191906000526020600020905b815481529060010190602001808311612bbc57829003601f168201915b50505050508152602001600982018054612bf2906157af565b80601f0160208091040260200160405190810160405280929190818152602001828054612c1e906157af565b8015612c6b5780601f10612c4057610100808354040283529160200191612c6b565b820191906000526020600020905b815481529060010190602001808311612c4e57829003601f168201915b50505050508152602001600a82018054612c84906157af565b80601f0160208091040260200160405190810160405280929190818152602001828054612cb0906157af565b8015612cfd5780601f10612cd257610100808354040283529160200191612cfd565b820191906000526020600020905b815481529060010190602001808311612ce057829003601f168201915b5050505050815250509050612d278260200151826101400151836101200151846101600151610c22565b612d598360000151846020015184604001516001600160801b031685610140015186610180015187610160015161360a565b604051602001612d6a929190615202565b60405160208183030381529060405292505050919050565b6006546001600160a01b03163314612dac5760405162461bcd60e51b81526004016109ce906153f6565b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b6006546001600160a01b03163314612df85760405162461bcd60e51b81526004016109ce906153f6565b6103e8811115612e4a5760405162461bcd60e51b815260206004820152601860248201527f7368617265206d7573742062652062656c6f772031303030000000000000000060448201526064016109ce565b60005b601354811015610c1d57826001600160a01b031660138281548110612e8257634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415612eb9576001600160a01b03831660009081526012602052604090208290555b80612ec381615811565b915050612e4d565b6006546001600160a01b03163314612ef55760405162461bcd60e51b81526004016109ce906153f6565b6001600160a01b038116612f5a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016109ce565b612f6381613d2b565b50565b3360009081526014602052604090205460ff1680612f8e57506006546001600160a01b031633145b612faa5760405162461bcd60e51b81526004016109ce9061547c565b6000858152600d6020908152604080832081516101c081018352815460ff8082168352610100820416828601526001600160801b036201000090910481168285015260018301548082166060840152600160801b90048116608083015260028301541660a0820152600382015460c08201526004820180548451818702810187019095528085529194929360e086019390929083018282801561307657602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613058575b50505050508152602001600582018054806020026020016040519081016040528092919081815260200182805480156130ce57602002820191906000526020600020905b8154815260200190600101908083116130ba575b505050505081526020016006820180546130e7906157af565b80601f0160208091040260200160405190810160405280929190818152602001828054613113906157af565b80156131605780601f1061313557610100808354040283529160200191613160565b820191906000526020600020905b81548152906001019060200180831161314357829003601f168201915b50505050508152602001600782018054613179906157af565b80601f01602080910402602001604051908101604052809291908181526020018280546131a5906157af565b80156131f25780601f106131c7576101008083540402835291602001916131f2565b820191906000526020600020905b8154815290600101906020018083116131d557829003601f168201915b5050505050815260200160088201805461320b906157af565b80601f0160208091040260200160405190810160405280929190818152602001828054613237906157af565b80156132845780601f1061325957610100808354040283529160200191613284565b820191906000526020600020905b81548152906001019060200180831161326757829003601f168201915b5050505050815260200160098201805461329d906157af565b80601f01602080910402602001604051908101604052809291908181526020018280546132c9906157af565b80156133165780601f106132eb57610100808354040283529160200191613316565b820191906000526020600020905b8154815290600101906020018083116132f957829003601f168201915b50505050508152602001600a8201805461332f906157af565b80601f016020809104026020016040519081016040528092919081815260200182805461335b906157af565b80156133a85780601f1061337d576101008083540402835291602001916133a8565b820191906000526020600020905b81548152906001019060200180831161338b57829003601f168201915b5050505050815250509050806000015160ff166001146133f35760405162461bcd60e51b81526004016109ce906020808252600490820152636c69766560e01b604082015260600190565b81858560008161341357634e487b7160e01b600052603260045260246000fd5b90506020028101906134259190615632565b9050146134605760405162461bcd60e51b815260206004820152600960248201526862616420617272617960b81b60448201526064016109ce565b60005b848110156135cc5760005b8686600081811061348f57634e487b7160e01b600052603260045260246000fd5b90506020028101906134a19190615632565b90508110156135b957600a546001600160a01b031663e56e34798686848181106134db57634e487b7160e01b600052603260045260246000fd5b9050602002013589898681811061350257634e487b7160e01b600052603260045260246000fd5b90506020028101906135149190615632565b8581811061353257634e487b7160e01b600052603260045260246000fd5b905060200201602081019061354791906149b3565b6040516001600160e01b031960e085901b16815260048101929092526001600160a01b03166024820152604401600060405180830381600087803b15801561358e57600080fd5b505af11580156135a2573d6000803e3d6000fd5b5050505080806135b190615811565b91505061346e565b50806135c481615811565b915050613463565b5060405184815286907fb3e821bfa4e118cf1cac28128930a4e53e59dd51d9e30c95ee100e4d3b0d2ef29060200160405180910390a2505050505050565b60606040518060400160405280601081526020016f222c2261747472696275746573223a5b60801b81525061363e88613f31565b61364786613f99565b61365085613fe3565b61365a8a8a61402d565b6040518060400160405280600a815260200169161134b6b0b3b2911d1160b11b815250613686896140a7565b60405180604001604052806002815260200161227d60f01b8152506040516020016136b898979695949392919061515d565b60405160208183030381529060405290509695505050505050565b6000818152600d60205260409020600c5482118015906136f35750600082115b61370f5760405162461bcd60e51b81526004016109ce906153d2565b805460ff16600114801561372a57508054610100900460ff16155b6137645760405162461bcd60e51b815260206004820152600b60248201526a216469737472696275746560a81b60448201526064016109ce565b61376d826140ba565b6137a85760405162461bcd60e51b815260206004820152600c60248201526b39bab690109e90189818129760a11b60448201526064016109ce565b805461ff001916610100178155600381015460028201546000916137d4916001600160801b031661574d565b90506000805b6013548110156138bb576103e8601260006013848154811061380c57634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b0316835282019290925260400190205461383b908561574d565b613845919061572d565b91506013818154811061386857634e487b7160e01b600052603260045260246000fd5b60009182526020822001546040516001600160a01b039091169184156108fc02918591818181858888f193505050501580156138a8573d6000803e3d6000fd5b50806138b381615811565b9150506137da565b5060005b6004840154811015613989576103e88460050182815481106138f157634e487b7160e01b600052603260045260246000fd5b906000526020600020015484613907919061574d565b613911919061572d565b915083600401818154811061393657634e487b7160e01b600052603260045260246000fd5b60009182526020822001546040516001600160a01b039091169184156108fc02918591818181858888f19350505050158015613976573d6000803e3d6000fd5b508061398181615811565b9150506138bf565b5050505050565b60006001600160e01b0319821663152a902d60e11b148061099c575061099c825b60006001600160e01b031982166380ac58cd60e01b14806139e257506001600160e01b03198216635b5e139f60e01b145b8061099c57506301ffc9a760e01b6001600160e01b031983161461099c565b6127106001600160601b0382161115613a6f5760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b60648201526084016109ce565b6001600160a01b038216613ac55760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c69642072656365697665720000000000000060448201526064016109ce565b604080518082019091526001600160a01b039283168082526001600160601b03929092166020909101819052600780546001600160a01b031916909217909216600160a01b909202919091179055565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190613b4a82611889565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b606082613b8f836141a6565b604051602001613ba0929190615231565b604051602081830303815290604052905092915050565b6000818152600260205260408120546001600160a01b0316613c305760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016109ce565b6000613c3b83611889565b9050806001600160a01b0316846001600160a01b03161480613c8257506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b80610c955750836001600160a01b0316613c9b84610a77565b6001600160a01b031614949350505050565b6000818152600e6020908152604080832081518083018352815480825260019092015481850152908452600f9092529091205460ff1615613d205760405162461bcd60e51b815260206004820152600d60248201526c109bde081a5cc81b1bd8dad959609a1b60448201526064016109ce565b611c0b8484846142ec565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b03161415613ddf5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016109ce565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b604051806040016040528085815260200184876001600160801b0316613e7291906156f0565b613e7d9060016156f0565b90526000828152600e6020908152604090912082518155910151600190910155837f5420392aab8a9f3a70c0145321ff58bc86c3da3596336224396de59f430fc0f5613ed2856001600160801b0389166156f0565b613edd9060016156f0565b60408051918252602082018590520160405180910390a26139898282614488565b613f09848484613cad565b613f15848484846145cb565b611c0b5760405162461bcd60e51b81526004016109ce90615380565b60606040518060600160405280602181526020016158f260219139613f55836141a6565b60405180604001604052806003815260200162089f4b60ea1b815250604051602001613f8393929190614ff8565b6040516020818303038152906040529050919050565b6060604051806060016040528060258152602001615913602591398260405180604001604052806003815260200162089f4b60ea1b815250604051602001613f8393929190614ff8565b60606040518060600160405280602481526020016158aa602491398260405180604001604052806003815260200162089f4b60ea1b815250604051602001613f8393929190614ff8565b606060405180606001604052806026815260200161588460269139614051846141a6565b6040518060400160405280600481526020016301037b3160e51b815250614077856141a6565b60405180604001604052806003815260200162227d5d60e81b815250604051602001613ba095949392919061503b565b606081604051602001613f83919061526e565b6000818152600d6020526040812081805b60135481101561413d5760126000601383815481106140fa57634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b0316835282019290925260400190205461412990836156f0565b91508061413581615811565b9150506140cb565b5060005b600583015481101561419a5782600501818154811061417057634e487b7160e01b600052603260045260246000fd5b90600052602060002001548261418691906156f0565b91508061419281615811565b915050614141565b506103e8149392505050565b6060816141cb57506040805180820190915260018152600360fc1b602082015261099f565b8160005b81156141f557806141df81615811565b91506141ee9050600a8361572d565b91506141cf565b60008167ffffffffffffffff81111561421e57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015614248576020820181803683370190505b509050815b85156142e35761425e60018261576c565b9050600061426d600a8861572d565b61427890600a61574d565b614282908861576c565b61428d906030615708565b905060008160f81b9050808484815181106142b857634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053506142da600a8961572d565b9750505061424d565b50949350505050565b826001600160a01b03166142ff82611889565b6001600160a01b0316146143635760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b60648201526084016109ce565b6001600160a01b0382166143c55760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016109ce565b6143d0600082613b15565b6001600160a01b03831660009081526003602052604081208054600192906143f990849061576c565b90915550506001600160a01b03821660009081526003602052604081208054600192906144279084906156f0565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4610c1d565b6001600160a01b0382166144de5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016109ce565b6000818152600260205260409020546001600160a01b0316156145435760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016109ce565b6001600160a01b038216600090815260036020526040812080546001929061456c9084906156f0565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a46109e1565b60006001600160a01b0384163b156146cd57604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061460f9033908990889088906004016152ab565b602060405180830381600087803b15801561462957600080fd5b505af1925050508015614659575060408051601f3d908101601f1916820190925261465691810190614c10565b60015b6146b3573d808015614687576040519150601f19603f3d011682016040523d82523d6000602084013e61468c565b606091505b5080516146ab5760405162461bcd60e51b81526004016109ce90615380565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610c95565b506001610c95565b82805482825590600052602060002090810192821561472a579160200282015b8281111561472a57825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906146f5565b506147369291506147e8565b5090565b82805482825590600052602060002090810192821561472a579160200282015b8281111561472a57825182559160200191906001019061475a565b828054614781906157af565b90600052602060002090601f0160209004810192826147a3576000855561472a565b82601f106147bc57805160ff191683800117855561472a565b8280016001018555821561472a579182018281111561472a57825182559160200191906001019061475a565b5b8082111561473657600081556001016147e9565b600067ffffffffffffffff83111561481757614817615842565b61482a601f8401601f1916602001615679565b905082815283838301111561483e57600080fd5b828260208301376000602084830101529392505050565b600082601f830112614865578081fd5b8135602061487a614875836156aa565b615679565b8281528181019085830183850287018401881015614896578586fd5b855b858110156148bd5781356148ab81615858565b84529284019290840190600101614898565b5090979650505050505050565b60008083601f8401126148db578182fd5b50813567ffffffffffffffff8111156148f2578182fd5b602083019150836020808302850101111561105e57600080fd5b600082601f83011261491c578081fd5b8135602061492c614875836156aa565b8281528181019085830183850287018401881015614948578586fd5b855b858110156148bd5781358452928401929084019060010161494a565b8035801515811461099f57600080fd5b600082601f830112614986578081fd5b614995838335602085016147fd565b9392505050565b80356001600160801b038116811461099f57600080fd5b6000602082840312156149c4578081fd5b813561499581615858565b600080604083850312156149e1578081fd5b82356149ec81615858565b915060208301356149fc81615858565b809150509250929050565b600080600060608486031215614a1b578081fd5b8335614a2681615858565b92506020840135614a3681615858565b929592945050506040919091013590565b60008060008060808587031215614a5c578182fd5b8435614a6781615858565b93506020850135614a7781615858565b925060408501359150606085013567ffffffffffffffff811115614a99578182fd5b8501601f81018713614aa9578182fd5b614ab8878235602084016147fd565b91505092959194509250565b60008060408385031215614ad6578182fd5b8235614ae181615858565b9150614aef60208401614966565b90509250929050565b60008060408385031215614b0a578182fd5b8235614b1581615858565b946020939093013593505050565b60008060408385031215614b35578182fd5b8235614b4081615858565b915060208301356001600160601b03811681146149fc578182fd5b60006020808385031215614b6d578182fd5b825167ffffffffffffffff811115614b83578283fd5b8301601f81018513614b93578283fd5b8051614ba1614875826156aa565b8181528381019083850185840285018601891015614bbd578687fd5b8694505b83851015614be8578051614bd481615858565b835260019490940193918501918501614bc1565b50979650505050505050565b600060208284031215614c05578081fd5b81356149958161586d565b600060208284031215614c21578081fd5b81516149958161586d565b6000806000806000806000806000806101408b8d031215614c4b578788fd5b614c548b61499c565b9950614c6260208c0161499c565b985060408b0135975060608b013567ffffffffffffffff80821115614c85578788fd5b614c918e838f01614855565b985060808d0135915080821115614ca6578788fd5b614cb28e838f0161490c565b975060a08d0135915080821115614cc7578687fd5b614cd38e838f01614976565b965060c08d0135915080821115614ce8578586fd5b614cf48e838f01614976565b955060e08d0135915080821115614d09578485fd5b614d158e838f01614976565b94506101008d0135915080821115614d2b578384fd5b614d378e838f01614976565b93506101208d0135915080821115614d4d578283fd5b50614d5a8d828e01614976565b9150509295989b9194979a5092959850565b600060208284031215614d7d578081fd5b5035919050565b60008060408385031215614d96578182fd5b8235915060208301356149fc81615858565b600080600060608486031215614dbc578081fd5b833592506020840135614a3681615858565b600080600080600060608688031215614de5578283fd5b85359450602086013567ffffffffffffffff80821115614e03578485fd5b614e0f89838a016148ca565b90965094506040880135915080821115614e27578283fd5b50614e34888289016148ca565b969995985093965092949392505050565b60008060408385031215614e57578182fd5b82359150614aef60208401614966565b60008060008060808587031215614e7c578182fd5b84359350602085013567ffffffffffffffff80821115614e9a578384fd5b614ea688838901614976565b94506040870135915080821115614ebb578384fd5b614ec788838901614976565b93506060870135915080821115614edc578283fd5b50614ab887828801614976565b60008060408385031215614efb578182fd5b82359150614aef6020840161499c565b60008060408385031215614f1d578182fd5b50508035926020909101359150565b60008060008060008060c08789031215614f44578384fd5b863595506020870135945060408701359350606087013567ffffffffffffffff80821115614f70578384fd5b614f7c8a838b01614976565b94506080890135915080821115614f91578384fd5b614f9d8a838b01614976565b935060a0890135915080821115614fb2578283fd5b50614fbf89828a01614976565b9150509295509295509295565b60008151808452614fe4816020860160208601615783565b601f01601f19169290920160200192915050565b6000845161500a818460208901615783565b84519083019061501e818360208901615783565b8451910190615031818360208801615783565b0195945050505050565b6000865161504d818460208b01615783565b865190830190615061818360208b01615783565b8651910190615074818360208a01615783565b8551910190615087818360208901615783565b845191019061509a818360208801615783565b01979650505050505050565b600084516150b8818460208901615783565b8451908301906150cc818360208901615783565b84519101906150df818360208801615783565b7f4e4654426f7865732061726520612063757261746564206d6f6e74686c79206291019081527f6f78206f66204e465473206f6e20746865206e657765737420676f6c6420737460208201527f616e64617264206f66204e465420746563686e6f6c6f67792e00000000000000604082015260590195945050505050565b6000895160206151708285838f01615783565b8a51918401916151838184848f01615783565b8a519201916151958184848e01615783565b89519201916151a78184848d01615783565b88519201916151b98184848c01615783565b87519201916151cb8184848b01615783565b86519201916151dd8184848a01615783565b85519201916151ef8184848901615783565b919091019b9a5050505050505050505050565b60008351615214818460208801615783565b835190830190615228818360208801615783565b01949350505050565b60008351615243818460208801615783565b61202360f01b9083019081528351615262816002840160208801615783565b01600201949350505050565b60007468747470733a2f2f697066732e696f2f697066732f60581b8252825161529e816015850160208701615783565b9190910160150192915050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906152de90830184614fcc565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b818110156153295783516001600160a01b031683529284019291840191600101615304565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561532957835183529284019291840191600101615351565b6000602082526149956020830184614fcc565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252600a908201526924a21010b2bc34b9ba1760b11b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252601a908201527f4e6f7420617574686f726973656420746f20657865637574652e000000000000604082015260600190565b60208082526009908201526812510808595e1a5cdd60ba1b604082015260600190565b60006101008a83528960208401526001600160801b038916604084015280606084015261550581840189614fcc565b905082810360808401526155198188614fcc565b905082810360a084015261552d8187614fcc565b905082810360c08401526155418186614fcc565b905082810360e08401526155558185614fcc565b9b9a5050505050505050505050565b60ff8d811682528c16602082015260006101806001600160801b038d1660408401526001600160801b038c1660608401526001600160801b038b1660808401526001600160801b038a1660a08401528860c08401528060e08401526155cb81840189614fcc565b90508281036101008401526155e08188614fcc565b90508281036101208401526155f58187614fcc565b905082810361014084015261560a8186614fcc565b905082810361016084015261561f8185614fcc565b9f9e505050505050505050505050505050565b6000808335601e19843603018112615648578283fd5b83018035915067ffffffffffffffff821115615662578283fd5b602090810192508102360382131561105e57600080fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156156a2576156a2615842565b604052919050565b600067ffffffffffffffff8211156156c4576156c4615842565b5060209081020190565b60006001600160801b038083168185168083038211156152285761522861582c565b600082198211156157035761570361582c565b500190565b600060ff821660ff84168060ff038211156157255761572561582c565b019392505050565b60008261574857634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156157675761576761582c565b500290565b60008282101561577e5761577e61582c565b500390565b60005b8381101561579e578181015183820152602001615786565b83811115611c0b5750506000910152565b6002810460018216806157c357607f821691505b602082108114156157e457634e487b7160e01b600052602260045260246000fd5b50919050565b60006001600160801b03808316818114156158075761580761582c565b6001019392505050565b60006000198214156158255761582561582c565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114612f6357600080fd5b6001600160e01b031981168114612f6357600080fdfe7b2274726169745f74797065223a2022626f782065646974696f6e222c2276616c7565223a227b2274726169745f74797065223a2022626f78207468656d65222c2276616c7565223a22646174613a6170706c69636174696f6e2f6a736f6e3b757466382c7b226e616d65223a227b2274726169745f74797065223a2022626f78206964222c2276616c7565223a227b2274726169745f74797065223a2022626f7820736572696573222c2276616c7565223a22a26469706673582212205adde4c74a93a098f3e8303afa967d2278fb902421dc6d5155ece6a4b0838abc64736f6c63430008020033000000000000000000000000acadaf7fb6156d3c1832c27612611c735babb495

Deployed Bytecode

0x6080604052600436106102935760003560e01c8063715018a61161015a578063b3ed1da4116100c1578063eba2389d1161007a578063eba2389d146108b5578063f2fde38b146108d5578063f5f0cebd146108f5578063f769046f14610915578063f9e1eb5f14610942578063fb4a25581461096257610293565b8063b3ed1da4146107c2578063b5a3f84f146107f6578063b88d4fde1461080c578063c87b56dd1461082c578063cb67558e1461084c578063e985e9c51461086c57610293565b80639cae6eae116101135780639cae6eae146106ff5780639e4189261461071f578063a22cb4651461073f578063a2e28ea31461075f578063a74772c81461077f578063aef078bc146107af57610293565b8063715018a614610654578063783abc8e14610669578063811dd0e21461068957806385e3f997146106b65780638da5cb5b146106cc57806395d89b41146106ea57610293565b80632a55205a116101fe578063451dc3e6116101b7578063451dc3e61461054d57806346fd55221461056d5780634ccc6b5f1461058d5780634ed3faf2146105bd5780636352211e1461060657806370a082311461062657610293565b80632a55205a146104565780632b28bc991461049557806333c1da70146104b55780633eb2b5ad146104ed578063424f4fef1461050d57806342842e0e1461052d57610293565b80630fceb9ab116102505780630fceb9ab1461038957806314eba026146103a9578063197ebd53146103c9578063231710d7146103e957806323b872dd14610409578063263030561461042957610293565b806301ffc9a71461029857806304634d8d146102cd57806306fdde03146102ef578063081812fc14610311578063095ea7b3146103495780630a7c6fca14610369575b600080fd5b3480156102a457600080fd5b506102b86102b3366004614bf4565b610982565b60405190151581526020015b60405180910390f35b3480156102d957600080fd5b506102ed6102e8366004614b23565b6109a4565b005b3480156102fb57600080fd5b506103046109e5565b6040516102c4919061536d565b34801561031d57600080fd5b5061033161032c366004614d6c565b610a77565b6040516001600160a01b0390911681526020016102c4565b34801561035557600080fd5b506102ed610364366004614af8565b610b0c565b34801561037557600080fd5b50610304610384366004614e67565b610c22565b34801561039557600080fd5b506102ed6103a4366004614d6c565b610c9d565b3480156103b557600080fd5b506102ed6103c43660046149b3565b610d2b565b3480156103d557600080fd5b506103316103e4366004614d6c565b610eab565b3480156103f557600080fd5b506102ed6104043660046149b3565b610ed5565b34801561041557600080fd5b506102ed610424366004614a07565b610f21565b34801561043557600080fd5b50610449610444366004614d6c565b610f52565b6040516102c49190615335565b34801561046257600080fd5b50610476610471366004614f0b565b610fb7565b604080516001600160a01b0390931683526020830191909152016102c4565b3480156104a157600080fd5b506102ed6104b0366004614da8565b611065565b3480156104c157600080fd5b506104d56104d0366004614d6c565b61111a565b6040516102c49c9b9a99989796959493929190615564565b3480156104f957600080fd5b506102ed6105083660046149b3565b611438565b34801561051957600080fd5b50600a54610331906001600160a01b031681565b34801561053957600080fd5b506102ed610548366004614a07565b611555565b34801561055957600080fd5b50600b54610331906001600160a01b031681565b34801561057957600080fd5b506102ed610588366004614c2c565b611570565b34801561059957600080fd5b506102b86105a8366004614d6c565b600f6020526000908152604090205460ff1681565b3480156105c957600080fd5b506105f16105d8366004614d6c565b600e602052600090815260409020805460019091015482565b604080519283526020830191909152016102c4565b34801561061257600080fd5b50610331610621366004614d6c565b611889565b34801561063257600080fd5b506106466106413660046149b3565b611900565b6040519081526020016102c4565b34801561066057600080fd5b506102ed611987565b34801561067557600080fd5b506102ed610684366004614d84565b6119bd565b34801561069557600080fd5b506106a96106a4366004614d6c565b611c11565b6040516102c491906152e8565b3480156106c257600080fd5b506106466103e881565b3480156106d857600080fd5b506006546001600160a01b0316610331565b3480156106f657600080fd5b50610304611c7f565b34801561070b57600080fd5b506102ed61071a366004614ac4565b611c8e565b34801561072b57600080fd5b506102ed61073a366004614e45565b611ce3565b34801561074b57600080fd5b506102ed61075a366004614ac4565b611d75565b34801561076b57600080fd5b506102ed61077a366004614d6c565b611d80565b34801561078b57600080fd5b506102b861079a3660046149b3565b60146020526000908152604090205460ff1681565b6102ed6107bd366004614ee9565b612095565b3480156107ce57600080fd5b506107e26107dd366004614d6c565b612409565b6040516102c49897969594939291906154d6565b34801561080257600080fd5b50610646600c5481565b34801561081857600080fd5b506102ed610827366004614a47565b612892565b34801561083857600080fd5b50610304610847366004614d6c565b6128c4565b34801561085857600080fd5b506102ed6108673660046149b3565b612d82565b34801561087857600080fd5b506102b86108873660046149cf565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b3480156108c157600080fd5b506102ed6108d0366004614af8565b612dce565b3480156108e157600080fd5b506102ed6108f03660046149b3565b612ecb565b34801561090157600080fd5b506102ed610910366004614dce565b612f66565b34801561092157600080fd5b506106466109303660046149b3565b60126020526000908152604090205481565b34801561094e57600080fd5b5061030461095d366004614f2c565b61360a565b34801561096e57600080fd5b506102ed61097d366004614d6c565b6136d3565b600061098d82613990565b8061099c575061099c826139b1565b90505b919050565b6006546001600160a01b031633146109d75760405162461bcd60e51b81526004016109ce906153f6565b60405180910390fd5b6109e18282613a01565b5050565b6060600080546109f4906157af565b80601f0160208091040260200160405190810160405280929190818152602001828054610a20906157af565b8015610a6d5780601f10610a4257610100808354040283529160200191610a6d565b820191906000526020600020905b815481529060010190602001808311610a5057829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b0316610af05760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016109ce565b506000908152600460205260409020546001600160a01b031690565b6000610b1782611889565b9050806001600160a01b0316836001600160a01b03161415610b855760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016109ce565b336001600160a01b0382161480610ba15750610ba18133610887565b610c135760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c000000000000000060648201526084016109ce565b610c1d8383613b15565b505050565b60606040518060600160405280602481526020016158ce60249139610c478487613b83565b604051806040016040528060118152602001701116113232b9b1b934b83a34b7b7111d1160791b815250604051602001610c83939291906150a6565b60405160208183030381529060405290505b949350505050565b3360009081526014602052604090205460ff1680610cc557506006546001600160a01b031633145b610ce15760405162461bcd60e51b81526004016109ce9061547c565b6000818152600d60205260409020600c548211801590610d015750600082115b610d1d5760405162461bcd60e51b81526004016109ce906153d2565b805460ff1916600117905550565b6006546001600160a01b03163314610d555760405162461bcd60e51b81526004016109ce906153f6565b60005b6013548110156109e157816001600160a01b031660138281548110610d8d57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415610e99576001600160a01b03821660009081526012602052604081205560138054610dd19060019061576c565b81548110610def57634e487b7160e01b600052603260045260246000fd5b600091825260209091200154601380546001600160a01b039092169183908110610e2957634e487b7160e01b600052603260045260246000fd5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506013805480610e7657634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b03191690550190555b80610ea381615811565b915050610d58565b60138181548110610ebb57600080fd5b6000918252602090912001546001600160a01b0316905081565b6006546001600160a01b03163314610eff5760405162461bcd60e51b81526004016109ce906153f6565b600b80546001600160a01b0319166001600160a01b0392909216919091179055565b610f2b3382613bb7565b610f475760405162461bcd60e51b81526004016109ce9061542b565b610c1d838383613cad565b6000818152600d6020908152604091829020600501805483518184028101840190945280845260609392830182828015610fab57602002820191906000526020600020905b815481526020019060010190808311610f97575b50505050509050919050565b60008281526008602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b031692820192909252829161102c5750604080518082019091526007546001600160a01b0381168252600160a01b90046001600160601b031660208201525b60208101516000906127109061104b906001600160601b03168761574d565b611055919061572d565b91519350909150505b9250929050565b6006546001600160a01b0316331461108f5760405162461bcd60e51b81526004016109ce906153f6565b6000838152600d60205260409020600c5484118015906110af5750600084115b6110cb5760405162461bcd60e51b81526004016109ce906154b3565b600481018054600180820183556000928352602080842090920180546001600160a01b0319166001600160a01b0397909716969096179095556005909201805494850181558152209091015550565b600d602052600090815260409020805460018201546002830154600384015460068501805460ff808716976101008804909116966001600160801b036201000090910481169680821696600160801b909104821695911693909261117d906157af565b80601f01602080910402602001604051908101604052809291908181526020018280546111a9906157af565b80156111f65780601f106111cb576101008083540402835291602001916111f6565b820191906000526020600020905b8154815290600101906020018083116111d957829003601f168201915b50505050509080600701805461120b906157af565b80601f0160208091040260200160405190810160405280929190818152602001828054611237906157af565b80156112845780601f1061125957610100808354040283529160200191611284565b820191906000526020600020905b81548152906001019060200180831161126757829003601f168201915b505050505090806008018054611299906157af565b80601f01602080910402602001604051908101604052809291908181526020018280546112c5906157af565b80156113125780601f106112e757610100808354040283529160200191611312565b820191906000526020600020905b8154815290600101906020018083116112f557829003601f168201915b505050505090806009018054611327906157af565b80601f0160208091040260200160405190810160405280929190818152602001828054611353906157af565b80156113a05780601f10611375576101008083540402835291602001916113a0565b820191906000526020600020905b81548152906001019060200180831161138357829003601f168201915b50505050509080600a0180546113b5906157af565b80601f01602080910402602001604051908101604052809291908181526020018280546113e1906157af565b801561142e5780601f106114035761010080835404028352916020019161142e565b820191906000526020600020905b81548152906001019060200180831161141157829003601f168201915b505050505090508c565b6006546001600160a01b031633146114625760405162461bcd60e51b81526004016109ce906153f6565b60005b601354811015611502576013818154811061149057634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03838116911614156114f05760405162461bcd60e51b81526020600482015260166024820152756d656d626572732065786973747320616c726561647960501b60448201526064016109ce565b806114fa81615811565b915050611465565b50601380546001810182556000919091527f66de8ffda797e3de9c05e8fc57b3bf0ec28a930d40b0d285d93c06501cf6a0900180546001600160a01b0319166001600160a01b0392909216919091179055565b610c1d83838360405180602001604052806000815250612892565b6006546001600160a01b0316331461159a5760405162461bcd60e51b81526004016109ce906153f6565b85518751146115de5760405162461bcd60e51b815260206004820152601060248201526f30b93930bcb99010b9b0b6b2903632b760811b60448201526064016109ce565b604051806101c00160405280600060ff168152602001600060ff1681526020018b6001600160801b031681526020018a6001600160801b0316815260200160006001600160801b0316815260200160006001600160801b0316815260200189815260200188815260200187815260200186815260200185815260200184815260200183815260200182815250600d6000600c54600161167d91906156f0565b815260208082019290925260409081016000208351815485850151938601516001600160801b03908116620100000271ffffffffffffffffffffffffffffffff00001960ff9687166101000261ff00199790951660ff1990941693909317959095169290921716929092178155606084015160018201805460808701518516600160801b029285166fffffffffffffffffffffffffffffffff1991821617851692909217905560a08501516002830180549190941691161790915560c0830151600382015560e08301518051919261175d926004850192909101906146d5565b50610100820151805161177a91600584019160209091019061473a565b506101208201518051611797916006840191602090910190614775565b5061014082015180516117b4916007840191602090910190614775565b5061016082015180516117d1916008840191602090910190614775565b5061018082015180516117ee916009840191602090910190614775565b506101a0820151805161180b91600a840191602090910190614775565b5050600c80549150600061181e83615811565b9091555050600c80546000908152600f602052604090819020805460ff19166001179055905490517f77628c9166aca2fc4ccb8b7681fa345c93f54fb929f857d05cfebbfb665bad02916118759190815260200190565b60405180910390a150505050505050505050565b6000818152600260205260408120546001600160a01b03168061099c5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b60648201526084016109ce565b60006001600160a01b03821661196b5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b60648201526084016109ce565b506001600160a01b031660009081526003602052604090205490565b6006546001600160a01b031633146119b15760405162461bcd60e51b81526004016109ce906153f6565b6119bb6000613d2b565b565b6006546001600160a01b031633146119e75760405162461bcd60e51b81526004016109ce906153f6565b6000828152600d60205260409020600c548311801590611a075750600083115b611a235760405162461bcd60e51b81526004016109ce906154b3565b60005b6004820154811015611c0b57826001600160a01b0316826004018281548110611a5f57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415611bf957600482018054611a8c9060019061576c565b81548110611aaa57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546004830180546001600160a01b039092169183908110611ae657634e487b7160e01b600052603260045260246000fd5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555081600401805480611b3557634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b0319169055019055600582018054611b699060019061576c565b81548110611b8757634e487b7160e01b600052603260045260246000fd5b9060005260206000200154826005018281548110611bb557634e487b7160e01b600052603260045260246000fd5b60009182526020909120015560058201805480611be257634e487b7160e01b600052603160045260246000fd5b600190038181906000526020600020016000905590555b80611c0381615811565b915050611a26565b50505050565b6000818152600d6020908152604091829020600401805483518184028101840190945280845260609392830182828015610fab57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611c565750505050509050919050565b6060600180546109f4906157af565b6006546001600160a01b03163314611cb85760405162461bcd60e51b81526004016109ce906153f6565b6001600160a01b03919091166000908152601460205260409020805460ff1916911515919091179055565b3360009081526014602052604090205460ff1680611d0b57506006546001600160a01b031633145b611d275760405162461bcd60e51b81526004016109ce9061547c565b600c548211158015611d395750600082115b611d555760405162461bcd60e51b81526004016109ce906153d2565b6000918252600f6020526040909120805460ff1916911515919091179055565b6109e1338383613d7d565b6006546001600160a01b03163314611daa5760405162461bcd60e51b81526004016109ce906153f6565b600c548111158015611dbc5750600081115b611dd85760405162461bcd60e51b81526004016109ce906154b3565b600081815260116020526040812080549082611df383615811565b919050559050600a8110611e375760405162461bcd60e51b815260206004820152600b60248201526a44697374726f20646f6e6560a81b60448201526064016109ce565b6000828152600d602052604081206001810154600b549192600160801b9091046001600160801b0316916001600160a01b031663aaae61eb611e7a86603261574d565b6040516001600160e01b031960e084901b16815260048101919091526032602482015260440160006040518083038186803b158015611eb857600080fd5b505afa158015611ecc573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611ef49190810190614b5b565b600954909150600090815b6032811015611f90576000848281518110611f2a57634e487b7160e01b600052603260045260246000fd5b6020026020010151905060006001600160a01b0316816001600160a01b031614611f7d57611f6f868a8684611f5f82896156f0565b611f6a9060016156f0565b613e4c565b83611f7981615811565b9450505b5080611f8881615811565b915050611eff565b508160096000828254611fa391906156f0565b9091555050600185018054839190601090611fcf908490600160801b90046001600160801b03166156ce565b82546101009290920a6001600160801b0381810219909316918316021790915586546201000090048116915061200890849087166156f0565b141561201a57845460ff191660011785555b856009141561208c57600b60009054906101000a90046001600160a01b03166001600160a01b031663b8dea0956040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561207357600080fd5b505af1158015612087573d6000803e3d6000fd5b505050505b50505050505050565b6000828152600d6020526040902060018101548154600c54600160801b9092046001600160801b039081169262010000909204169085118015906120d95750600085115b6120f55760405162461bcd60e51b81526004016109ce906154b3565b825460ff161561212f5760405162461bcd60e51b8152602060048201526005602482015264216c69766560d81b60448201526064016109ce565b6000858152600f602052604090205460ff16156121775760405162461bcd60e51b81526020600482015260066024820152651b1bd8dad95960d21b60448201526064016109ce565b34846001600160801b03168460030154612191919061574d565b146121c75760405162461bcd60e51b815260206004820152600660248201526521707269636560d01b60448201526064016109ce565b6001600160801b0381166121db85846156ce565b6001600160801b031611156122235760405162461bcd60e51b815260206004820152600e60248201526d546f6f206d616e7920626f78657360901b60448201526064016109ce565b600183015460008681526010602090815260408083203384529091529020546001600160801b039182169161225b91908716906156f0565b11156122925760405162461bcd60e51b81526004016109ce906020808252600490820152632162757960e01b604082015260600190565b60095460005b856001600160801b0316816001600160801b031610156122de576122cc84886001600160801b03841633611f5f82886156f0565b806122d6816157ea565b915050612298565b50846001600160801b0316600960008282546122fa91906156f0565b9091555050600184018054869190601090612326908490600160801b90046001600160801b03166156ce565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550848460020160008282829054906101000a90046001600160801b031661237091906156ce565b82546101009290920a6001600160801b0381810219909316918316021790915560008881526010602090815260408083203384529091529020546123b89250908716906156f0565b60008781526010602090815260408083203384529091529020556001600160801b0382166123e686856156ce565b6001600160801b0316141561240157835460ff191660011784555b505050505050565b6000818152600e60209081526040808320815180830183528154808252600192830154828601528552600d845282852083516101c081018552815460ff8082168352610100820416828801526001600160801b036201000090910481168287015293820154808516606083810191909152600160801b90910485166080830152600283015490941660a0820152600382015460c082015260048201805486518189028101890190975280875288978897879687968796879692958c959194929360e08601939290919083018282801561250b57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116124ed575b505050505081526020016005820180548060200260200160405190810160405280929190818152602001828054801561256357602002820191906000526020600020905b81548152602001906001019080831161254f575b5050505050815260200160068201805461257c906157af565b80601f01602080910402602001604051908101604052809291908181526020018280546125a8906157af565b80156125f55780601f106125ca576101008083540402835291602001916125f5565b820191906000526020600020905b8154815290600101906020018083116125d857829003601f168201915b5050505050815260200160078201805461260e906157af565b80601f016020809104026020016040519081016040528092919081815260200182805461263a906157af565b80156126875780601f1061265c57610100808354040283529160200191612687565b820191906000526020600020905b81548152906001019060200180831161266a57829003601f168201915b505050505081526020016008820180546126a0906157af565b80601f01602080910402602001604051908101604052809291908181526020018280546126cc906157af565b80156127195780601f106126ee57610100808354040283529160200191612719565b820191906000526020600020905b8154815290600101906020018083116126fc57829003601f168201915b50505050508152602001600982018054612732906157af565b80601f016020809104026020016040519081016040528092919081815260200182805461275e906157af565b80156127ab5780601f10612780576101008083540402835291602001916127ab565b820191906000526020600020905b81548152906001019060200180831161278e57829003601f168201915b50505050508152602001600a820180546127c4906157af565b80601f01602080910402602001604051908101604052809291908181526020018280546127f0906157af565b801561283d5780601f106128125761010080835404028352916020019161283d565b820191906000526020600020905b81548152906001019060200180831161282057829003601f168201915b5050505050815250509050816000015182602001518260400151836101200151846101400151856101600151866101800151876101a00151995099509950995099509950995099505050919395975091939597565b61289c3383613bb7565b6128b85760405162461bcd60e51b81526004016109ce9061542b565b611c0b84848484613efe565b6000818152600e60209081526040918290208251808401909352805480845260019091015491830191909152606091906128fd57600080fd5b80516000908152600d6020908152604080832081516101c081018352815460ff8082168352610100820416828601526001600160801b036201000090910481168285015260018301548082166060840152600160801b90048116608083015260028301541660a0820152600382015460c08201526004820180548451818702810187019095528085529194929360e08601939092908301828280156129cb57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116129ad575b5050505050815260200160058201805480602002602001604051908101604052809291908181526020018280548015612a2357602002820191906000526020600020905b815481526020019060010190808311612a0f575b50505050508152602001600682018054612a3c906157af565b80601f0160208091040260200160405190810160405280929190818152602001828054612a68906157af565b8015612ab55780601f10612a8a57610100808354040283529160200191612ab5565b820191906000526020600020905b815481529060010190602001808311612a9857829003601f168201915b50505050508152602001600782018054612ace906157af565b80601f0160208091040260200160405190810160405280929190818152602001828054612afa906157af565b8015612b475780601f10612b1c57610100808354040283529160200191612b47565b820191906000526020600020905b815481529060010190602001808311612b2a57829003601f168201915b50505050508152602001600882018054612b60906157af565b80601f0160208091040260200160405190810160405280929190818152602001828054612b8c906157af565b8015612bd95780601f10612bae57610100808354040283529160200191612bd9565b820191906000526020600020905b815481529060010190602001808311612bbc57829003601f168201915b50505050508152602001600982018054612bf2906157af565b80601f0160208091040260200160405190810160405280929190818152602001828054612c1e906157af565b8015612c6b5780601f10612c4057610100808354040283529160200191612c6b565b820191906000526020600020905b815481529060010190602001808311612c4e57829003601f168201915b50505050508152602001600a82018054612c84906157af565b80601f0160208091040260200160405190810160405280929190818152602001828054612cb0906157af565b8015612cfd5780601f10612cd257610100808354040283529160200191612cfd565b820191906000526020600020905b815481529060010190602001808311612ce057829003601f168201915b5050505050815250509050612d278260200151826101400151836101200151846101600151610c22565b612d598360000151846020015184604001516001600160801b031685610140015186610180015187610160015161360a565b604051602001612d6a929190615202565b60405160208183030381529060405292505050919050565b6006546001600160a01b03163314612dac5760405162461bcd60e51b81526004016109ce906153f6565b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b6006546001600160a01b03163314612df85760405162461bcd60e51b81526004016109ce906153f6565b6103e8811115612e4a5760405162461bcd60e51b815260206004820152601860248201527f7368617265206d7573742062652062656c6f772031303030000000000000000060448201526064016109ce565b60005b601354811015610c1d57826001600160a01b031660138281548110612e8257634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415612eb9576001600160a01b03831660009081526012602052604090208290555b80612ec381615811565b915050612e4d565b6006546001600160a01b03163314612ef55760405162461bcd60e51b81526004016109ce906153f6565b6001600160a01b038116612f5a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016109ce565b612f6381613d2b565b50565b3360009081526014602052604090205460ff1680612f8e57506006546001600160a01b031633145b612faa5760405162461bcd60e51b81526004016109ce9061547c565b6000858152600d6020908152604080832081516101c081018352815460ff8082168352610100820416828601526001600160801b036201000090910481168285015260018301548082166060840152600160801b90048116608083015260028301541660a0820152600382015460c08201526004820180548451818702810187019095528085529194929360e086019390929083018282801561307657602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613058575b50505050508152602001600582018054806020026020016040519081016040528092919081815260200182805480156130ce57602002820191906000526020600020905b8154815260200190600101908083116130ba575b505050505081526020016006820180546130e7906157af565b80601f0160208091040260200160405190810160405280929190818152602001828054613113906157af565b80156131605780601f1061313557610100808354040283529160200191613160565b820191906000526020600020905b81548152906001019060200180831161314357829003601f168201915b50505050508152602001600782018054613179906157af565b80601f01602080910402602001604051908101604052809291908181526020018280546131a5906157af565b80156131f25780601f106131c7576101008083540402835291602001916131f2565b820191906000526020600020905b8154815290600101906020018083116131d557829003601f168201915b5050505050815260200160088201805461320b906157af565b80601f0160208091040260200160405190810160405280929190818152602001828054613237906157af565b80156132845780601f1061325957610100808354040283529160200191613284565b820191906000526020600020905b81548152906001019060200180831161326757829003601f168201915b5050505050815260200160098201805461329d906157af565b80601f01602080910402602001604051908101604052809291908181526020018280546132c9906157af565b80156133165780601f106132eb57610100808354040283529160200191613316565b820191906000526020600020905b8154815290600101906020018083116132f957829003601f168201915b50505050508152602001600a8201805461332f906157af565b80601f016020809104026020016040519081016040528092919081815260200182805461335b906157af565b80156133a85780601f1061337d576101008083540402835291602001916133a8565b820191906000526020600020905b81548152906001019060200180831161338b57829003601f168201915b5050505050815250509050806000015160ff166001146133f35760405162461bcd60e51b81526004016109ce906020808252600490820152636c69766560e01b604082015260600190565b81858560008161341357634e487b7160e01b600052603260045260246000fd5b90506020028101906134259190615632565b9050146134605760405162461bcd60e51b815260206004820152600960248201526862616420617272617960b81b60448201526064016109ce565b60005b848110156135cc5760005b8686600081811061348f57634e487b7160e01b600052603260045260246000fd5b90506020028101906134a19190615632565b90508110156135b957600a546001600160a01b031663e56e34798686848181106134db57634e487b7160e01b600052603260045260246000fd5b9050602002013589898681811061350257634e487b7160e01b600052603260045260246000fd5b90506020028101906135149190615632565b8581811061353257634e487b7160e01b600052603260045260246000fd5b905060200201602081019061354791906149b3565b6040516001600160e01b031960e085901b16815260048101929092526001600160a01b03166024820152604401600060405180830381600087803b15801561358e57600080fd5b505af11580156135a2573d6000803e3d6000fd5b5050505080806135b190615811565b91505061346e565b50806135c481615811565b915050613463565b5060405184815286907fb3e821bfa4e118cf1cac28128930a4e53e59dd51d9e30c95ee100e4d3b0d2ef29060200160405180910390a2505050505050565b60606040518060400160405280601081526020016f222c2261747472696275746573223a5b60801b81525061363e88613f31565b61364786613f99565b61365085613fe3565b61365a8a8a61402d565b6040518060400160405280600a815260200169161134b6b0b3b2911d1160b11b815250613686896140a7565b60405180604001604052806002815260200161227d60f01b8152506040516020016136b898979695949392919061515d565b60405160208183030381529060405290509695505050505050565b6000818152600d60205260409020600c5482118015906136f35750600082115b61370f5760405162461bcd60e51b81526004016109ce906153d2565b805460ff16600114801561372a57508054610100900460ff16155b6137645760405162461bcd60e51b815260206004820152600b60248201526a216469737472696275746560a81b60448201526064016109ce565b61376d826140ba565b6137a85760405162461bcd60e51b815260206004820152600c60248201526b39bab690109e90189818129760a11b60448201526064016109ce565b805461ff001916610100178155600381015460028201546000916137d4916001600160801b031661574d565b90506000805b6013548110156138bb576103e8601260006013848154811061380c57634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b0316835282019290925260400190205461383b908561574d565b613845919061572d565b91506013818154811061386857634e487b7160e01b600052603260045260246000fd5b60009182526020822001546040516001600160a01b039091169184156108fc02918591818181858888f193505050501580156138a8573d6000803e3d6000fd5b50806138b381615811565b9150506137da565b5060005b6004840154811015613989576103e88460050182815481106138f157634e487b7160e01b600052603260045260246000fd5b906000526020600020015484613907919061574d565b613911919061572d565b915083600401818154811061393657634e487b7160e01b600052603260045260246000fd5b60009182526020822001546040516001600160a01b039091169184156108fc02918591818181858888f19350505050158015613976573d6000803e3d6000fd5b508061398181615811565b9150506138bf565b5050505050565b60006001600160e01b0319821663152a902d60e11b148061099c575061099c825b60006001600160e01b031982166380ac58cd60e01b14806139e257506001600160e01b03198216635b5e139f60e01b145b8061099c57506301ffc9a760e01b6001600160e01b031983161461099c565b6127106001600160601b0382161115613a6f5760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b60648201526084016109ce565b6001600160a01b038216613ac55760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c69642072656365697665720000000000000060448201526064016109ce565b604080518082019091526001600160a01b039283168082526001600160601b03929092166020909101819052600780546001600160a01b031916909217909216600160a01b909202919091179055565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190613b4a82611889565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b606082613b8f836141a6565b604051602001613ba0929190615231565b604051602081830303815290604052905092915050565b6000818152600260205260408120546001600160a01b0316613c305760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016109ce565b6000613c3b83611889565b9050806001600160a01b0316846001600160a01b03161480613c8257506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b80610c955750836001600160a01b0316613c9b84610a77565b6001600160a01b031614949350505050565b6000818152600e6020908152604080832081518083018352815480825260019092015481850152908452600f9092529091205460ff1615613d205760405162461bcd60e51b815260206004820152600d60248201526c109bde081a5cc81b1bd8dad959609a1b60448201526064016109ce565b611c0b8484846142ec565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b03161415613ddf5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016109ce565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b604051806040016040528085815260200184876001600160801b0316613e7291906156f0565b613e7d9060016156f0565b90526000828152600e6020908152604090912082518155910151600190910155837f5420392aab8a9f3a70c0145321ff58bc86c3da3596336224396de59f430fc0f5613ed2856001600160801b0389166156f0565b613edd9060016156f0565b60408051918252602082018590520160405180910390a26139898282614488565b613f09848484613cad565b613f15848484846145cb565b611c0b5760405162461bcd60e51b81526004016109ce90615380565b60606040518060600160405280602181526020016158f260219139613f55836141a6565b60405180604001604052806003815260200162089f4b60ea1b815250604051602001613f8393929190614ff8565b6040516020818303038152906040529050919050565b6060604051806060016040528060258152602001615913602591398260405180604001604052806003815260200162089f4b60ea1b815250604051602001613f8393929190614ff8565b60606040518060600160405280602481526020016158aa602491398260405180604001604052806003815260200162089f4b60ea1b815250604051602001613f8393929190614ff8565b606060405180606001604052806026815260200161588460269139614051846141a6565b6040518060400160405280600481526020016301037b3160e51b815250614077856141a6565b60405180604001604052806003815260200162227d5d60e81b815250604051602001613ba095949392919061503b565b606081604051602001613f83919061526e565b6000818152600d6020526040812081805b60135481101561413d5760126000601383815481106140fa57634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b0316835282019290925260400190205461412990836156f0565b91508061413581615811565b9150506140cb565b5060005b600583015481101561419a5782600501818154811061417057634e487b7160e01b600052603260045260246000fd5b90600052602060002001548261418691906156f0565b91508061419281615811565b915050614141565b506103e8149392505050565b6060816141cb57506040805180820190915260018152600360fc1b602082015261099f565b8160005b81156141f557806141df81615811565b91506141ee9050600a8361572d565b91506141cf565b60008167ffffffffffffffff81111561421e57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015614248576020820181803683370190505b509050815b85156142e35761425e60018261576c565b9050600061426d600a8861572d565b61427890600a61574d565b614282908861576c565b61428d906030615708565b905060008160f81b9050808484815181106142b857634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053506142da600a8961572d565b9750505061424d565b50949350505050565b826001600160a01b03166142ff82611889565b6001600160a01b0316146143635760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b60648201526084016109ce565b6001600160a01b0382166143c55760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016109ce565b6143d0600082613b15565b6001600160a01b03831660009081526003602052604081208054600192906143f990849061576c565b90915550506001600160a01b03821660009081526003602052604081208054600192906144279084906156f0565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4610c1d565b6001600160a01b0382166144de5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016109ce565b6000818152600260205260409020546001600160a01b0316156145435760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016109ce565b6001600160a01b038216600090815260036020526040812080546001929061456c9084906156f0565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a46109e1565b60006001600160a01b0384163b156146cd57604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061460f9033908990889088906004016152ab565b602060405180830381600087803b15801561462957600080fd5b505af1925050508015614659575060408051601f3d908101601f1916820190925261465691810190614c10565b60015b6146b3573d808015614687576040519150601f19603f3d011682016040523d82523d6000602084013e61468c565b606091505b5080516146ab5760405162461bcd60e51b81526004016109ce90615380565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610c95565b506001610c95565b82805482825590600052602060002090810192821561472a579160200282015b8281111561472a57825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906146f5565b506147369291506147e8565b5090565b82805482825590600052602060002090810192821561472a579160200282015b8281111561472a57825182559160200191906001019061475a565b828054614781906157af565b90600052602060002090601f0160209004810192826147a3576000855561472a565b82601f106147bc57805160ff191683800117855561472a565b8280016001018555821561472a579182018281111561472a57825182559160200191906001019061475a565b5b8082111561473657600081556001016147e9565b600067ffffffffffffffff83111561481757614817615842565b61482a601f8401601f1916602001615679565b905082815283838301111561483e57600080fd5b828260208301376000602084830101529392505050565b600082601f830112614865578081fd5b8135602061487a614875836156aa565b615679565b8281528181019085830183850287018401881015614896578586fd5b855b858110156148bd5781356148ab81615858565b84529284019290840190600101614898565b5090979650505050505050565b60008083601f8401126148db578182fd5b50813567ffffffffffffffff8111156148f2578182fd5b602083019150836020808302850101111561105e57600080fd5b600082601f83011261491c578081fd5b8135602061492c614875836156aa565b8281528181019085830183850287018401881015614948578586fd5b855b858110156148bd5781358452928401929084019060010161494a565b8035801515811461099f57600080fd5b600082601f830112614986578081fd5b614995838335602085016147fd565b9392505050565b80356001600160801b038116811461099f57600080fd5b6000602082840312156149c4578081fd5b813561499581615858565b600080604083850312156149e1578081fd5b82356149ec81615858565b915060208301356149fc81615858565b809150509250929050565b600080600060608486031215614a1b578081fd5b8335614a2681615858565b92506020840135614a3681615858565b929592945050506040919091013590565b60008060008060808587031215614a5c578182fd5b8435614a6781615858565b93506020850135614a7781615858565b925060408501359150606085013567ffffffffffffffff811115614a99578182fd5b8501601f81018713614aa9578182fd5b614ab8878235602084016147fd565b91505092959194509250565b60008060408385031215614ad6578182fd5b8235614ae181615858565b9150614aef60208401614966565b90509250929050565b60008060408385031215614b0a578182fd5b8235614b1581615858565b946020939093013593505050565b60008060408385031215614b35578182fd5b8235614b4081615858565b915060208301356001600160601b03811681146149fc578182fd5b60006020808385031215614b6d578182fd5b825167ffffffffffffffff811115614b83578283fd5b8301601f81018513614b93578283fd5b8051614ba1614875826156aa565b8181528381019083850185840285018601891015614bbd578687fd5b8694505b83851015614be8578051614bd481615858565b835260019490940193918501918501614bc1565b50979650505050505050565b600060208284031215614c05578081fd5b81356149958161586d565b600060208284031215614c21578081fd5b81516149958161586d565b6000806000806000806000806000806101408b8d031215614c4b578788fd5b614c548b61499c565b9950614c6260208c0161499c565b985060408b0135975060608b013567ffffffffffffffff80821115614c85578788fd5b614c918e838f01614855565b985060808d0135915080821115614ca6578788fd5b614cb28e838f0161490c565b975060a08d0135915080821115614cc7578687fd5b614cd38e838f01614976565b965060c08d0135915080821115614ce8578586fd5b614cf48e838f01614976565b955060e08d0135915080821115614d09578485fd5b614d158e838f01614976565b94506101008d0135915080821115614d2b578384fd5b614d378e838f01614976565b93506101208d0135915080821115614d4d578283fd5b50614d5a8d828e01614976565b9150509295989b9194979a5092959850565b600060208284031215614d7d578081fd5b5035919050565b60008060408385031215614d96578182fd5b8235915060208301356149fc81615858565b600080600060608486031215614dbc578081fd5b833592506020840135614a3681615858565b600080600080600060608688031215614de5578283fd5b85359450602086013567ffffffffffffffff80821115614e03578485fd5b614e0f89838a016148ca565b90965094506040880135915080821115614e27578283fd5b50614e34888289016148ca565b969995985093965092949392505050565b60008060408385031215614e57578182fd5b82359150614aef60208401614966565b60008060008060808587031215614e7c578182fd5b84359350602085013567ffffffffffffffff80821115614e9a578384fd5b614ea688838901614976565b94506040870135915080821115614ebb578384fd5b614ec788838901614976565b93506060870135915080821115614edc578283fd5b50614ab887828801614976565b60008060408385031215614efb578182fd5b82359150614aef6020840161499c565b60008060408385031215614f1d578182fd5b50508035926020909101359150565b60008060008060008060c08789031215614f44578384fd5b863595506020870135945060408701359350606087013567ffffffffffffffff80821115614f70578384fd5b614f7c8a838b01614976565b94506080890135915080821115614f91578384fd5b614f9d8a838b01614976565b935060a0890135915080821115614fb2578283fd5b50614fbf89828a01614976565b9150509295509295509295565b60008151808452614fe4816020860160208601615783565b601f01601f19169290920160200192915050565b6000845161500a818460208901615783565b84519083019061501e818360208901615783565b8451910190615031818360208801615783565b0195945050505050565b6000865161504d818460208b01615783565b865190830190615061818360208b01615783565b8651910190615074818360208a01615783565b8551910190615087818360208901615783565b845191019061509a818360208801615783565b01979650505050505050565b600084516150b8818460208901615783565b8451908301906150cc818360208901615783565b84519101906150df818360208801615783565b7f4e4654426f7865732061726520612063757261746564206d6f6e74686c79206291019081527f6f78206f66204e465473206f6e20746865206e657765737420676f6c6420737460208201527f616e64617264206f66204e465420746563686e6f6c6f67792e00000000000000604082015260590195945050505050565b6000895160206151708285838f01615783565b8a51918401916151838184848f01615783565b8a519201916151958184848e01615783565b89519201916151a78184848d01615783565b88519201916151b98184848c01615783565b87519201916151cb8184848b01615783565b86519201916151dd8184848a01615783565b85519201916151ef8184848901615783565b919091019b9a5050505050505050505050565b60008351615214818460208801615783565b835190830190615228818360208801615783565b01949350505050565b60008351615243818460208801615783565b61202360f01b9083019081528351615262816002840160208801615783565b01600201949350505050565b60007468747470733a2f2f697066732e696f2f697066732f60581b8252825161529e816015850160208701615783565b9190910160150192915050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906152de90830184614fcc565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b818110156153295783516001600160a01b031683529284019291840191600101615304565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561532957835183529284019291840191600101615351565b6000602082526149956020830184614fcc565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252600a908201526924a21010b2bc34b9ba1760b11b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252601a908201527f4e6f7420617574686f726973656420746f20657865637574652e000000000000604082015260600190565b60208082526009908201526812510808595e1a5cdd60ba1b604082015260600190565b60006101008a83528960208401526001600160801b038916604084015280606084015261550581840189614fcc565b905082810360808401526155198188614fcc565b905082810360a084015261552d8187614fcc565b905082810360c08401526155418186614fcc565b905082810360e08401526155558185614fcc565b9b9a5050505050505050505050565b60ff8d811682528c16602082015260006101806001600160801b038d1660408401526001600160801b038c1660608401526001600160801b038b1660808401526001600160801b038a1660a08401528860c08401528060e08401526155cb81840189614fcc565b90508281036101008401526155e08188614fcc565b90508281036101208401526155f58187614fcc565b905082810361014084015261560a8186614fcc565b905082810361016084015261561f8185614fcc565b9f9e505050505050505050505050505050565b6000808335601e19843603018112615648578283fd5b83018035915067ffffffffffffffff821115615662578283fd5b602090810192508102360382131561105e57600080fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156156a2576156a2615842565b604052919050565b600067ffffffffffffffff8211156156c4576156c4615842565b5060209081020190565b60006001600160801b038083168185168083038211156152285761522861582c565b600082198211156157035761570361582c565b500190565b600060ff821660ff84168060ff038211156157255761572561582c565b019392505050565b60008261574857634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156157675761576761582c565b500290565b60008282101561577e5761577e61582c565b500390565b60005b8381101561579e578181015183820152602001615786565b83811115611c0b5750506000910152565b6002810460018216806157c357607f821691505b602082108114156157e457634e487b7160e01b600052602260045260246000fd5b50919050565b60006001600160801b03808316818114156158075761580761582c565b6001019392505050565b60006000198214156158255761582561582c565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114612f6357600080fd5b6001600160e01b031981168114612f6357600080fdfe7b2274726169745f74797065223a2022626f782065646974696f6e222c2276616c7565223a227b2274726169745f74797065223a2022626f78207468656d65222c2276616c7565223a22646174613a6170706c69636174696f6e2f6a736f6e3b757466382c7b226e616d65223a227b2274726169745f74797065223a2022626f78206964222c2276616c7565223a227b2274726169745f74797065223a2022626f7820736572696573222c2276616c7565223a22a26469706673582212205adde4c74a93a098f3e8303afa967d2278fb902421dc6d5155ece6a4b0838abc64736f6c63430008020033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000acadaf7fb6156d3c1832c27612611c735babb495

-----Decoded View---------------
Arg [0] : _service (address): 0xACaDaF7FB6156D3c1832c27612611C735baBB495

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000acadaf7fb6156d3c1832c27612611c735babb495


Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.