ETH Price: $2,504.97 (+0.55%)

Contract

0xb283c835410DC2c8429fBb38a410Ce021E263C78
 

Overview

ETH Balance

5.62793553037798084 ETH

Eth Value

$14,097.81 (@ $2,504.97/ETH)

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Deposit Wei159392402022-11-10 11:12:11718 days ago1668078731IN
0xb283c835...21E263C78
0.01 ETH0.0006671522
Withdraw Deposit149950232022-06-20 6:03:47861 days ago1655705027IN
0xb283c835...21E263C78
0 ETH0.0009142820.51815438
Withdraw Deposit149950122022-06-20 6:01:57861 days ago1655704917IN
0xb283c835...21E263C78
0 ETH0.0013614430.55298435
Deposit Wei149197162022-06-07 8:03:46874 days ago1654589026IN
0xb283c835...21E263C78
0.02 ETH0.0006742722.23501571
Change Day Name ...149197102022-06-07 8:02:55874 days ago1654588975IN
0xb283c835...21E263C78
0 ETH0.0024482926.66025668
Change Day Name ...147375512022-05-08 18:03:15904 days ago1652032995IN
0xb283c835...21E263C78
0 ETH0.0035913828.47657354
Change Day Name ...147348092022-05-08 7:43:26904 days ago1651995806IN
0xb283c835...21E263C78
0 ETH0.003239725.0927797
Withdraw Deposit146848212022-04-30 9:34:51912 days ago1651311291IN
0xb283c835...21E263C78
0 ETH0.0015348634.44490213
Change Day Name ...146848152022-04-30 9:33:03912 days ago1651311183IN
0xb283c835...21E263C78
0 ETH0.0033681635.55125017
Change Day Name ...146848102022-04-30 9:32:00912 days ago1651311120IN
0xb283c835...21E263C78
0 ETH0.0029781631.43247187
Buy Or Mint145291632022-04-06 0:36:20936 days ago1649205380IN
0xb283c835...21E263C78
1.001 ETH0.0450585482.87056324
Buy Or Mint144878872022-03-30 13:46:17943 days ago1648647977IN
0xb283c835...21E263C78
1.01 ETH0.0161626729.70921152
Change Day Name ...144598362022-03-26 4:53:43947 days ago1648270423IN
0xb283c835...21E263C78
0 ETH0.0024296718.82754277
Change Day Name ...144598292022-03-26 4:52:26947 days ago1648270346IN
0xb283c835...21E263C78
0 ETH0.0025398819.27834245
Change Day Name ...143256922022-03-05 8:05:28968 days ago1646467528IN
0xb283c835...21E263C78
0 ETH0.0024347418.88263326
Deposit Wei143089202022-03-02 17:20:56971 days ago1646241656IN
0xb283c835...21E263C78
0.03 ETH0.00353661116.62360205
Withdraw Deposit142685662022-02-24 11:37:21977 days ago1645702641IN
0xb283c835...21E263C78
0 ETH0.0017008738.170373
Change Day Name ...142685602022-02-24 11:36:12977 days ago1645702572IN
0xb283c835...21E263C78
0 ETH0.0037568540.47462953
Withdraw Deposit142634032022-02-23 16:22:54978 days ago1645633374IN
0xb283c835...21E263C78
0 ETH0.0027112460.82841672
Withdraw Deposit142633792022-02-23 16:18:25978 days ago1645633105IN
0xb283c835...21E263C78
0 ETH0.00487533109.4401026
Buy Or Mint142193762022-02-16 20:36:00984 days ago1645043760IN
0xb283c835...21E263C78
1.1 ETH0.0314555857.94195926
Deposit Wei142179022022-02-16 15:20:05985 days ago1645024805IN
0xb283c835...21E263C78
0.015 ETH0.0019730165.06238608
Buy Or Mint142087952022-02-15 5:15:03986 days ago1644902103IN
0xb283c835...21E263C78
1.0015 ETH0.0037825539.49372842
Buy Or Mint142087182022-02-15 4:57:17986 days ago1644901037IN
0xb283c835...21E263C78
0.005 ETH0.0040500342.26537097
Change Day Name ...142024112022-02-14 5:41:41987 days ago1644817301IN
0xb283c835...21E263C78
0 ETH0.0036863628.54634113
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
149950232022-06-20 6:03:47861 days ago1655705027
0xb283c835...21E263C78
0.1 ETH
149950122022-06-20 6:01:57861 days ago1655704917
0xb283c835...21E263C78
0.1 ETH
146848212022-04-30 9:34:51912 days ago1651311291
0xb283c835...21E263C78
0.2 ETH
145291632022-04-06 0:36:20936 days ago1649205380
0xb283c835...21E263C78
1 ETH
144878872022-03-30 13:46:17943 days ago1648647977
0xb283c835...21E263C78
1 ETH
142685662022-02-24 11:37:21977 days ago1645702641
0xb283c835...21E263C78
0.6 ETH
142634032022-02-23 16:22:54978 days ago1645633374
0xb283c835...21E263C78
0.139 ETH
142633792022-02-23 16:18:25978 days ago1645633105
0xb283c835...21E263C78
0.05 ETH
142193762022-02-16 20:36:00984 days ago1645043760
0xb283c835...21E263C78
1 ETH
140804822022-01-26 9:37:421006 days ago1643189862
0xb283c835...21E263C78
0.02 ETH
139903252022-01-12 11:02:181020 days ago1641985338
0xb283c835...21E263C78
1 ETH
139902982022-01-12 10:56:331020 days ago1641984993
0xb283c835...21E263C78
1 ETH
139780952022-01-10 13:43:261022 days ago1641822206
0xb283c835...21E263C78
0.18 ETH
139768172022-01-10 8:54:421022 days ago1641804882
0xb283c835...21E263C78
1 ETH
139767972022-01-10 8:50:271022 days ago1641804627
0xb283c835...21E263C78
0.1 ETH
139767892022-01-10 8:48:391022 days ago1641804519
0xb283c835...21E263C78
1 ETH
139767682022-01-10 8:44:481022 days ago1641804288
0xb283c835...21E263C78
1 ETH
139767182022-01-10 8:34:101022 days ago1641803650
0xb283c835...21E263C78
1 ETH
139766652022-01-10 8:23:101022 days ago1641802990
0xb283c835...21E263C78
1 ETH
139764472022-01-10 7:38:501022 days ago1641800330
0xb283c835...21E263C78
1 ETH
139763682022-01-10 7:21:031022 days ago1641799263
0xb283c835...21E263C78
1 ETH
139763282022-01-10 7:13:431022 days ago1641798823
0xb283c835...21E263C78
1 ETH
139758152022-01-10 5:15:401022 days ago1641791740
0xb283c835...21E263C78
1 ETH
139755542022-01-10 4:15:571022 days ago1641788157
0xb283c835...21E263C78
1 ETH
139748722022-01-10 1:33:101022 days ago1641778390
0xb283c835...21E263C78
1 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
CalendarSteward

Compiler Version
v0.8.0+commit.c7dfd78e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 19 : CalendarSteward.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./CommonCalendar.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";

contract CalendarSteward {

    using SafeMath for uint256;

    mapping(uint256 => uint256) public price; //  map tokenId to price
    CommonCalendar public assetToken; // ERC721 NFT.
    CommonCalendar public legacyToken = CommonCalendar(0xc9015e8Dd7a22C765e59a92Ee194AB8A55644988);
    address public benefactor = 0x613ea163982868DecEf2D9C1A1cbE23e43186549;
    address public hacker1 = 0x6E93D1880c87A254D142C46f712074F6cE378E14;
    address public hacker2 = 0xEF56F3D68ef19e48c367dB3E04B6AfFcE61d2981;
    mapping(uint256 => uint256) public totalCollected; // all patronage ever collected
    mapping(uint256 => uint256) public currentCollected; 
    mapping(uint256 => uint256) public timeLastCollected;
    mapping(address => uint256) public timeLastCollectedPatron; 
    mapping(address => uint256) public deposit; 
    mapping(address => uint256) public totalPatronOwnedTokenPrice;

    mapping(uint256 => address) public benefactors; 
    mapping(address => uint256) public benefactorFunds;

    mapping(uint256 => address) public currentPatron; 
    mapping(uint256 => mapping(address => bool)) public patrons;
    mapping(uint256 => mapping(address => uint256)) public timeHeld;

    mapping(uint256 => uint256) public timeAcquired;

    mapping(uint256 => uint256) public patronageNumerator;

    enum StewardState {Foreclosed, Owned}
    mapping(uint256 => StewardState) public state;

    address public admin;
    address public owner;

    event Buy(uint256 indexed tokenId, address indexed owner, uint256 price);
    event DayOwner(address owner);
    event PriceChange(uint256 indexed tokenId, uint256 newPrice);
    event Foreclosure(address indexed prevOwner, uint256 foreclosureTime);
    event RemainingDepositUpdate(
        address indexed tokenPatron,
        uint256 remainingDeposit
    );

    event AddToken(
        uint256 indexed tokenId,
        uint256 patronageNumerator
    );
    event CollectPatronage(
        uint256 indexed tokenId,
        address indexed patron,
        uint256 remainingDeposit,
        uint256 amountReceived
    );

    modifier onlyPatron(uint256 tokenId) {
        require(msg.sender == currentPatron[tokenId], "Not patron");
        _;
    }

    modifier onlyAdmin() {
        require(msg.sender == admin, "Not admin");
        _;
    }

    modifier onlyReceivingBenefactorOrAdmin(uint256 tokenId) {
        require(
            msg.sender == benefactors[tokenId] || msg.sender == admin,
            "Not benefactor or admin"
        );
        _;
    }

    modifier collectPatronage(uint256 tokenId) {
        _collectPatronage(tokenId);
        _;
    }

    modifier collectPatronageAddress(address tokenPatron) {
        _collectPatronagePatron(tokenPatron);
        _;
    }

    constructor(CommonCalendar _assetToken, address _admin) {
        assetToken = (_assetToken);
        admin = _admin;
        owner = msg.sender;
    }

    function setLegacyToken(CommonCalendar _legacy) onlyAdmin() public {
        legacyToken = _legacy;
    }
    function setBenefactor(address _benefactor) onlyAdmin() public {
        benefactor = _benefactor;
    }

    function buyOrMint(address to, uint8 month, uint8 dayOfMonth, uint256 _newPrice, uint256 _deposit, string memory dayName) public payable  {
        uint256 tokenId = uint256(month).mul(100).add(dayOfMonth);
        if (assetToken.exists(tokenId)) {
            _buy(to, tokenId, month, dayOfMonth, _newPrice, _deposit, dayName);   
        } else {
            uint256 salePrice = 1 ether;
            require(msg.value > salePrice, "Not enough");
            address payable oldOwner = payable(legacyToken.ownerOf(tokenId));
            if (oldOwner == hacker1 || oldOwner == hacker2) {
                oldOwner = payable(admin);
            }
            bool transferSuccess = oldOwner.send(salePrice);
            _listNewToken(to, month, dayOfMonth, _newPrice, _deposit, dayName);
        }
    }

    function _listNewToken(
        address to, uint8 month, uint8 dayOfMonth, uint256 _newPrice, uint256 _deposit, string memory dayName
        ) private {
        address payable _benefactor = payable(benefactor);
        uint256 _patronageNumerator = 10000000000; // 1%
        assert(_benefactor != address(0));
        uint256 tokenID = assetToken.mintItem(to, month, dayOfMonth);
        benefactors[tokenID] = _benefactor;
        state[tokenID] = StewardState.Foreclosed; 
        patronageNumerator[tokenID] = _patronageNumerator;
        emit AddToken(
            tokenID,
            _patronageNumerator
        );
        if(to != owner) {
            _buy(to, tokenID, month, dayOfMonth, _newPrice, _deposit, dayName);   
        }
    }
    
    function changeReceivingBenefactor(
        uint256 tokenId,
        address payable _newReceivingBenefactor
    ) public onlyReceivingBenefactorOrAdmin(tokenId) {
        address oldBenfactor = benefactors[tokenId];
        require(
            oldBenfactor != _newReceivingBenefactor,
            "Cannot change to same address"
        );
        benefactors[tokenId] = _newReceivingBenefactor;
        benefactorFunds[_newReceivingBenefactor] = benefactorFunds[_newReceivingBenefactor]
            .add(benefactorFunds[oldBenfactor]);
        benefactorFunds[oldBenfactor] = 0;
    }

    function changeAdmin(address _admin) public onlyAdmin {
        admin = _admin;
    }

    function patronageOwed(uint256 tokenId)
        public
        view
        returns (uint256 patronageDue)
    {
        if (timeLastCollected[tokenId] == 0) return 0;

        return
            price[tokenId]
                .mul(block.timestamp.sub(timeLastCollected[tokenId]))
                .mul(patronageNumerator[tokenId])
                .div(1000000000000)
                .div(365 days);
    }

    function patronageOwedWithTimestamp(uint256 tokenId)
        public
        view
        returns (uint256 patronageDue, uint256 timestamp)
    {
        return (patronageOwed(tokenId), block.timestamp);
    }

    // TODO: make a version of this function that is for patronage owed by token rather than by tokenPatron like it is now.
    function patronageOwedByPatron(address tokenPatron)
        public
        view
        returns (uint256 patronageDue)
    {
        if (timeLastCollectedPatron[tokenPatron] == 0) return 0;
        return
            totalPatronOwnedTokenPrice[tokenPatron]
                .mul(block.timestamp.sub(timeLastCollectedPatron[tokenPatron]))
                .div(1000000000000)
                .div(365 days);
    }

    function patronageOwedByPatronWithTimestamp(address tokenPatron)
        public
        view
        returns (uint256 patronageDue, uint256 timestamp)
    {
        return (patronageOwedByPatron(tokenPatron), block.timestamp);
    }

    function foreclosedPatron(address tokenPatron) public view returns (bool) {
        // returns whether it is in foreclosed state or not
        // depending on whether deposit covers patronage due
        // useful helper function when price should be zero, but contract doesn't reflect it yet.
        if (patronageOwedByPatron(tokenPatron) >= deposit[tokenPatron]) {
            return true;
        } else {
            return false;
        }
    }

    function foreclosed(uint256 tokenId) public view returns (bool) {
        // returns whether it is in foreclosed state or not
        // depending on whether deposit covers patronage due
        // useful helper function when price should be zero, but contract doesn't reflect it yet.
        address tokenPatron = currentPatron[tokenId];
        return foreclosedPatron(tokenPatron);
    }

    function depositAbleToWithdraw(address tokenPatron)
        public
        view
        returns (uint256)
    {
        uint256 collection = patronageOwedByPatron(tokenPatron);
        if (collection >= deposit[tokenPatron]) {
            return 0;
        } else {
            return deposit[tokenPatron].sub(collection);
        }
    }

    function foreclosureTimePatron(address tokenPatron)
        public
        view
        returns (uint256)
    {
        // patronage per second
        uint256 pps = totalPatronOwnedTokenPrice[tokenPatron]
            .div(1000000000000)
            .div(365 days);
        return block.timestamp.add(depositAbleToWithdraw(tokenPatron).div(pps)); // zero division if price is zero.
    }

    function foreclosureTime(uint256 tokenId) public view returns (uint256) {
        address tokenPatron = currentPatron[tokenId];
        return foreclosureTimePatron(tokenPatron);
    }

    // TODO:: think of more efficient ways for recipients to collect patronage for lots of tokens at the same time.0
    function _collectPatronage(uint256 tokenId) public {
        // determine patronage to pay
        if (state[tokenId] == StewardState.Owned) {
            address currentOwner = currentPatron[tokenId];
            uint256 previousTokenCollection = timeLastCollected[tokenId];
            uint256 patronageOwedByTokenPatron = patronageOwedByPatron(
                currentOwner
            );
            uint256 collection;

            // it should foreclose and take stewardship
            if (patronageOwedByTokenPatron >= deposit[currentOwner]) {

                    uint256 newTimeLastCollected
                 = timeLastCollectedPatron[currentOwner].add(
                    (
                        (block.timestamp.sub(timeLastCollectedPatron[currentOwner]))
                            .mul(deposit[currentOwner])
                            .div(patronageOwedByTokenPatron)
                    )
                );

                timeLastCollected[tokenId] = newTimeLastCollected;
                timeLastCollectedPatron[currentOwner] = newTimeLastCollected;
                collection = price[tokenId]
                    .mul(newTimeLastCollected.sub(previousTokenCollection))
                    .mul(patronageNumerator[tokenId])
                    .div(1000000000000)
                    .div(365 days);
                deposit[currentOwner] = 0;
                _foreclose(tokenId);
            } else {
                collection = price[tokenId]
                    .mul(block.timestamp.sub(previousTokenCollection))
                    .mul(patronageNumerator[tokenId])
                    .div(1000000000000)
                    .div(365 days);

                timeLastCollected[tokenId] = block.timestamp;
                timeLastCollectedPatron[currentOwner] = block.timestamp;
                currentCollected[tokenId] = currentCollected[tokenId].add(
                    collection
                );
                deposit[currentOwner] = deposit[currentOwner].sub(
                    patronageOwedByTokenPatron
                );
            }
            totalCollected[tokenId] = totalCollected[tokenId].add(collection);
            address benefactor = benefactors[tokenId];
            benefactorFunds[benefactor] = benefactorFunds[benefactor].add(
                collection
            );
            // if foreclosed, tokens are minted and sent to the steward since _foreclose is already called.
            emit CollectPatronage(
                tokenId,
                currentOwner,
                deposit[currentOwner],
                collection
            );
        }
    }

    // This does accounting without transfering any tokens
    function _collectPatronagePatron(address tokenPatron) public {
        uint256 patronageOwedByTokenPatron = patronageOwedByPatron(tokenPatron);
        if (
            patronageOwedByTokenPatron > 0 &&
            patronageOwedByTokenPatron >= deposit[tokenPatron]
        ) {

                uint256 previousCollectionTime
             = timeLastCollectedPatron[tokenPatron];
            // up to when was it actually paid for?
            uint256 newTimeLastCollected = previousCollectionTime.add(
                (
                    (block.timestamp.sub(previousCollectionTime))
                        .mul(deposit[tokenPatron])
                        .div(patronageOwedByTokenPatron)
                )
            );
            timeLastCollectedPatron[tokenPatron] = newTimeLastCollected;
            deposit[tokenPatron] = 0;
        } else {
            timeLastCollectedPatron[tokenPatron] = block.timestamp;
            deposit[tokenPatron] = deposit[tokenPatron].sub(
                patronageOwedByTokenPatron
            );
        }

        emit RemainingDepositUpdate(tokenPatron, deposit[tokenPatron]);
    }

    function depositWei() public payable {
        depositWeiPatron(msg.sender);
    }

    function getDeposit(address tokenPatron) public view returns (uint256) {
        return deposit[tokenPatron];
    }

    function depositWeiPatron(address patron) public payable {
        require(totalPatronOwnedTokenPrice[patron] > 0, "No tokens owned");
        deposit[patron] = deposit[patron].add(msg.value);
        emit RemainingDepositUpdate(patron, deposit[patron]);
    }

    function _buy(
        address to,
        uint256 tokenId,
        uint8 month,
        uint8 dayOfMonth,
        uint256 _newPrice,
        uint256 _deposit,
        string memory _dayName
    )
        private
        collectPatronage(tokenId)
        collectPatronageAddress(to)
    {
        require(_newPrice > 0, "Price is zero");
        require(_deposit > 0, "Deposit eth amount is zero");
        require(msg.value > price[tokenId], "Not enough"); 

        uint256 remainingValueForDeposit = msg.value.sub(price[tokenId]);
        require(
            remainingValueForDeposit >= _deposit,
            "The deposit available is < what was stated in the transaction"
        );
        address currentOwner = assetToken.ownerOf(tokenId);
        emit DayOwner(currentOwner);
        address tokenPatron = currentPatron[tokenId];

        if (state[tokenId] == StewardState.Owned) {
            uint256 totalToPayBack = price[tokenId];
            // NOTE: pay back the deposit only if it is the only token the patron owns.
            if (
                totalPatronOwnedTokenPrice[tokenPatron] ==
                price[tokenId].mul(patronageNumerator[tokenId])
            ) {
                totalToPayBack = totalToPayBack.add(deposit[tokenPatron]);
                deposit[tokenPatron] = 0;
            }
            // pay previous owner their price + deposit back.
            address payable payableCurrentPatron = payable(
                tokenPatron
            );
            bool transferSuccess = payableCurrentPatron.send(totalToPayBack);
        } else if (state[tokenId] == StewardState.Foreclosed) {
            state[tokenId] = StewardState.Owned;
            timeLastCollected[tokenId] = block.timestamp;
            timeLastCollectedPatron[to] = block.timestamp;
        }

        deposit[to] = deposit[to].add(_deposit);
        transferAssetTokenTo(
            tokenId,
            currentOwner,
            tokenPatron,
            to,
            _newPrice
        );
        assetToken.setDayName(month, dayOfMonth, _dayName);
        emit Buy(tokenId, to, _newPrice);
    }

    function getDaySellPrice(uint256 tokenId) public view returns (uint256 sellPrice) {
        return price[tokenId];
    }

    function changeDayNamePrice(uint256 tokenId, uint8 _monthNumber, uint8 _dayOfMonth, string memory _dayName, uint256 _newPrice)
        public
        onlyPatron(tokenId)
        collectPatronage(tokenId)
    {
        require(state[tokenId] != StewardState.Foreclosed, "Foreclosed");
        require(_newPrice != 0, "Incorrect Price");

        totalPatronOwnedTokenPrice[msg.sender] = totalPatronOwnedTokenPrice[msg
            .sender]
            .sub(price[tokenId].mul(patronageNumerator[tokenId]))
            .add(_newPrice.mul(patronageNumerator[tokenId])); // Update total price of all owned tokens

        price[tokenId] = _newPrice;
        assetToken.setDayName(_monthNumber, _dayOfMonth, _dayName);
        emit PriceChange(tokenId, price[tokenId]);
    }

    function withdrawDeposit(uint256 _wei)
        public
        collectPatronageAddress(msg.sender)
        returns (uint256)
    {
        _withdrawDeposit(_wei);
    }

    function withdrawBenefactorFunds() public {
        withdrawBenefactorFundsTo(payable(msg.sender));
    }

    function withdrawBenefactorFundsTo(address payable benefactor) public {
        require(benefactorFunds[benefactor] > 0, "No funds available");
        uint256 amountToWithdraw = benefactorFunds[benefactor];
        benefactorFunds[benefactor] = 0;

        bool transferSuccess = benefactor.send(amountToWithdraw);
        if (!transferSuccess) {
            revert("Unable to withdraw benefactor funds");
        }
    }

    function exit() public collectPatronageAddress(msg.sender) {
        _withdrawDeposit(deposit[msg.sender]);
    }

    /* internal */
    function _withdrawDeposit(uint256 _wei) internal {
        // note: can withdraw whole deposit, which puts it in immediate to be foreclosed state.
        require(deposit[msg.sender] >= _wei, "Withdrawing too much");

        deposit[msg.sender] = deposit[msg.sender].sub(_wei);

        // msg.sender == patron
        bool transferSuccess = payable(msg.sender).send(_wei);
        if (!transferSuccess) {
            revert("Unable to withdraw deposit");
        }
    }

    function _foreclose(uint256 tokenId) internal {
        // become steward of assetToken (aka foreclose)
        address currentOwner = assetToken.ownerOf(tokenId);
        address tokenPatron = currentPatron[tokenId];
        transferAssetTokenTo(
            tokenId,
            currentOwner,
            tokenPatron,
            address(this),
            0
        );
        state[tokenId] = StewardState.Foreclosed;
        currentCollected[tokenId] = 0;

        emit Foreclosure(currentOwner, timeLastCollected[tokenId]);
    }

    function transferAssetTokenTo(
        uint256 tokenId,
        address _currentOwner,
        address _currentPatron,
        address _newOwner,
        uint256 _newPrice
    ) internal {
        totalPatronOwnedTokenPrice[_newOwner] = totalPatronOwnedTokenPrice[_newOwner]
            .add(_newPrice.mul(patronageNumerator[tokenId]));
        totalPatronOwnedTokenPrice[_currentPatron] = totalPatronOwnedTokenPrice[_currentPatron]
            .sub(price[tokenId].mul(patronageNumerator[tokenId]));

        timeHeld[tokenId][_currentPatron] = timeHeld[tokenId][_currentPatron]
            .add((timeLastCollected[tokenId].sub(timeAcquired[tokenId])));
        assetToken.transferFrom(_currentOwner, _newOwner, tokenId);
        currentPatron[tokenId] = _newOwner;

        price[tokenId] = _newPrice;
        timeAcquired[tokenId] = block.timestamp;
        patrons[tokenId][_newOwner] = true;
    }
}

File 2 of 19 : CommonCalendar.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "./DateTime.sol";

contract CommonCalendar is ERC721, ERC721Enumerable, ERC721URIStorage, Pausable, Ownable {
    using Counters for Counters.Counter;

    using SafeMath for uint256;
    
    address public steward;
    address dateLibrary;
    mapping (uint8 => mapping (uint8 => bool)) internal mintedDates; // month -> day -> was minted bool
    mapping (uint8 => mapping (uint8 => string)) internal dayNames;  // User set names

    event AuctionAdded(uint8 month, uint8 day);

  function setSteward(address _steward) public onlyOwner {
    steward = _steward;
  }
  
  // Day Name methods 
  function setDayName(uint8 _monthNumber, uint8 _dayOfMonth, string memory newName) public {
      require(bytes(newName).length <= 36, "Day name must be less than 36 chars"); // Move to DAO
      dayNames[_monthNumber][_dayOfMonth] = newName;
  }

  function getDayName(uint8 _monthNumber, uint8 _dayOfMonth) public view returns (string memory) {
      return dayNames[_monthNumber][_dayOfMonth];
  }
  function getTodayName() public view returns (string memory) {
    DateTime datetimelib = DateTime(dateLibrary);
    uint8 monthNumber = datetimelib.getMonth(block.timestamp);
    uint8 dayOfMonth = datetimelib.getDay(block.timestamp);
    return dayNames[monthNumber][dayOfMonth];
  }

  function getMintedDay(uint8 _monthNumber, uint8 _dayOfMonth) public view returns(bool) {
    return mintedDates[_monthNumber][_dayOfMonth];
  }

  modifier notAlreadyMinted(uint8 _monthNumber, uint8 _dayOfMonth) {
    require(mintedDates[_monthNumber][_dayOfMonth] == false, "This NFT was already minted");
    _;
  }

  modifier onlyValidInputs(uint8 _monthNumber, uint8 _dayOfMonth) {
    require(_monthNumber < 13 && _monthNumber > 0, "Month out of range");
    require(_dayOfMonth < 32 && _dayOfMonth > 0, "Day out of range");
    _;
  }


  function calculateTokenID(uint8 month, uint8 dayOfMonth) public returns (uint256 tokenID) {
    return uint256(month).mul(100).add(dayOfMonth);
  }

  //onlyMintOnDay(month, dayOfMonth)
  function mintItem(address to, uint8 month, uint8 dayOfMonth)
      public
      notAlreadyMinted(month, dayOfMonth)
      onlyValidInputs(month, dayOfMonth)
      returns (uint256)
  {
      require (msg.sender == steward);
      uint256 tokenID = calculateTokenID(month, dayOfMonth);
      _mint(to, tokenID);
      _setTokenURI(tokenID, string(abi.encodePacked(uint2str(month), "/", uint2str(dayOfMonth))));
      mintedDates[month][dayOfMonth] = true;
      return tokenID;
  }

    function pause() public onlyOwner {
        _pause();
    }

    function unpause() public onlyOwner {
        _unpause();
    }

    function _baseURI() internal pure override returns (string memory) {
        return "https://api.calendar.org/";
    }

    function _beforeTokenTransfer(address from, address to, uint256 tokenId)
        internal
        whenNotPaused
        override(ERC721, ERC721Enumerable)
    {
        super._beforeTokenTransfer(from, to, tokenId);
    }

    function _burn(uint256 tokenId) internal override(ERC721, ERC721URIStorage) {
        return;
    }

    function exists(uint256 tokenId) public view returns (bool) {
        return super._exists(tokenId);
    }

    function tokenURI(uint256 tokenId)
        public
        view
        override(ERC721, ERC721URIStorage)
        returns (string memory)
    {
        return super.tokenURI(tokenId);
    }

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

     function _isApprovedOrOwner(address spender, uint256 tokenId)
        internal
        view
        override(ERC721)
        returns (bool)
    {
        return (spender == steward);
        /*
          // NOTE: temporarily disabling sending of the tokens independently. A protective messure since it isn't clear to users how this function should work.
          //       Will re-add once a mechanism is agreed on by the community.
          || ERC721._isApprovedOrOwner(spender, tokenId)
          */
    }


    constructor(address _dateLibrary) ERC721("CommonCalendar", "CC")  {
        dateLibrary = _dateLibrary;
      }

    function uint2str(uint256 _i) internal pure returns (string memory str) {
      if (_i == 0)
      {
        return "0";
      }
      uint256 j = _i;
      uint256 length;
      while (j != 0)
        {
          length++;
          j /= 10;
        }
      bytes memory bstr = new bytes(length);
      uint256 k = length;
      j = _i;
      while (j != 0)
        {
          bstr[--k] = bytes1(uint8(48 + j % 10));
          j /= 10;
        }
    str = string(bstr);
    }

}

File 3 of 19 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

File 4 of 19 : ERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/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 private _name;

    // Token symbol
    string private _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 overriden 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 {
        require(operator != _msgSender(), "ERC721: approve to caller");

        _operatorApprovals[_msgSender()][operator] = approved;
        emit ApprovalForAll(_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 || getApproved(tokenId) == spender || isApprovedForAll(owner, 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);
    }

    /**
     * @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);
    }

    /**
     * @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 of token that is not own");
        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);
    }

    /**
     * @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 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 {}
}

File 5 of 19 : ERC721Enumerable.sol
// SPDX-License-Identifier: MIT

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();
    }
}

File 6 of 19 : ERC721URIStorage.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../ERC721.sol";

/**
 * @dev ERC721 token with storage based token URI management.
 */
abstract contract ERC721URIStorage is ERC721 {
    using Strings for uint256;

    // Optional mapping for token URIs
    mapping(uint256 => string) private _tokenURIs;

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

        string memory _tokenURI = _tokenURIs[tokenId];
        string memory base = _baseURI();

        // If there is no base URI, return the token URI.
        if (bytes(base).length == 0) {
            return _tokenURI;
        }
        // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).
        if (bytes(_tokenURI).length > 0) {
            return string(abi.encodePacked(base, _tokenURI));
        }

        return super.tokenURI(tokenId);
    }

    /**
     * @dev Sets `_tokenURI` as the tokenURI of `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
        require(_exists(tokenId), "ERC721URIStorage: URI set of nonexistent token");
        _tokenURIs[tokenId] = _tokenURI;
    }

    /**
     * @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 override {
        super._burn(tokenId);

        if (bytes(_tokenURIs[tokenId]).length != 0) {
            delete _tokenURIs[tokenId];
        }
    }
}

File 7 of 19 : Pausable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        require(!paused(), "Pausable: paused");
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        require(paused(), "Pausable: not paused");
        _;
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

File 8 of 19 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _setOwner(_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 {
        _setOwner(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");
        _setOwner(newOwner);
    }

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 9 of 19 : Counters.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library Counters {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

File 10 of 19 : DateTime.sol
//SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

contract DateTime {
        /*
         *  Date and Time utilities for ethereum contracts
         *
         */
        struct _DateTime {
                uint16 year;
                uint8 month;
                uint8 day;
                uint8 hour;
                uint8 minute;
                uint8 second;
                uint8 weekday;
        }

        uint constant DAY_IN_SECONDS = 86400;
        uint constant YEAR_IN_SECONDS = 31536000;
        uint constant LEAP_YEAR_IN_SECONDS = 31622400;

        uint constant HOUR_IN_SECONDS = 3600;
        uint constant MINUTE_IN_SECONDS = 60;

        uint16 constant ORIGIN_YEAR = 1970;

        function isLeapYear(uint16 year) public pure returns (bool) {
                if (year % 4 != 0) {
                        return false;
                }
                if (year % 100 != 0) {
                        return true;
                }
                if (year % 400 != 0) {
                        return false;
                }
                return true;
        }

        function leapYearsBefore(uint year) public pure returns (uint) {
                year -= 1;
                return year / 4 - year / 100 + year / 400;
        }

        function getDaysInMonth(uint8 month, uint16 year) public pure returns (uint8) {
                if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) {
                        return 31;
                }
                else if (month == 4 || month == 6 || month == 9 || month == 11) {
                        return 30;
                }
                else if (isLeapYear(year)) {
                        return 29;
                }
                else {
                        return 28;
                }
        }

        function parseTimestamp(uint timestamp) internal pure returns (_DateTime memory dt) {
                uint secondsAccountedFor = 0;
                uint buf;
                uint8 i;

                // Year
                dt.year = getYear(timestamp);
                buf = leapYearsBefore(dt.year) - leapYearsBefore(ORIGIN_YEAR);

                secondsAccountedFor += LEAP_YEAR_IN_SECONDS * buf;
                secondsAccountedFor += YEAR_IN_SECONDS * (dt.year - ORIGIN_YEAR - buf);

                // Month
                uint secondsInMonth;
                for (i = 1; i <= 12; i++) {
                        secondsInMonth = DAY_IN_SECONDS * getDaysInMonth(i, dt.year);
                        if (secondsInMonth + secondsAccountedFor > timestamp) {
                                dt.month = i;
                                break;
                        }
                        secondsAccountedFor += secondsInMonth;
                }

                // Day
                for (i = 1; i <= getDaysInMonth(dt.month, dt.year); i++) {
                        if (DAY_IN_SECONDS + secondsAccountedFor > timestamp) {
                                dt.day = i;
                                break;
                        }
                        secondsAccountedFor += DAY_IN_SECONDS;
                }

                // Hour
                dt.hour = getHour(timestamp);

                // Minute
                dt.minute = getMinute(timestamp);

                // Second
                dt.second = getSecond(timestamp);

                // Day of week.
                dt.weekday = getWeekday(timestamp);
        }

        function getYear(uint timestamp) public pure returns (uint16) {
                uint secondsAccountedFor = 0;
                uint16 year;
                uint numLeapYears;

                // Year
                year = uint16(ORIGIN_YEAR + timestamp / YEAR_IN_SECONDS);
                numLeapYears = leapYearsBefore(year) - leapYearsBefore(ORIGIN_YEAR);

                secondsAccountedFor += LEAP_YEAR_IN_SECONDS * numLeapYears;
                secondsAccountedFor += YEAR_IN_SECONDS * (year - ORIGIN_YEAR - numLeapYears);

                while (secondsAccountedFor > timestamp) {
                        if (isLeapYear(uint16(year - 1))) {
                                secondsAccountedFor -= LEAP_YEAR_IN_SECONDS;
                        }
                        else {
                                secondsAccountedFor -= YEAR_IN_SECONDS;
                        }
                        year -= 1;
                }
                return year;
        }

        function getMonth(uint timestamp) public pure returns (uint8) {
                return parseTimestamp(timestamp).month;
        }

        function getDay(uint timestamp) public pure returns (uint8) {
                return parseTimestamp(timestamp).day;
        }

        function getHour(uint timestamp) public pure returns (uint8) {
                return uint8((timestamp / 60 / 60) % 24);
        }

        function getMinute(uint timestamp) public pure returns (uint8) {
                return uint8((timestamp / 60) % 60);
        }

        function getSecond(uint timestamp) public pure returns (uint8) {
                return uint8(timestamp % 60);
        }

        function getWeekday(uint timestamp) public pure returns (uint8) {
                return uint8((timestamp / DAY_IN_SECONDS + 4) % 7);
        }

        function toTimestamp(uint16 year, uint8 month, uint8 day) public pure returns (uint timestamp) {
                return toTimestamp(year, month, day, 0, 0, 0);
        }

        function toTimestamp(uint16 year, uint8 month, uint8 day, uint8 hour) public pure returns (uint timestamp) {
                return toTimestamp(year, month, day, hour, 0, 0);
        }

        function toTimestamp(uint16 year, uint8 month, uint8 day, uint8 hour, uint8 minute) public pure returns (uint timestamp) {
                return toTimestamp(year, month, day, hour, minute, 0);
        }

        function toTimestamp(uint16 year, uint8 month, uint8 day, uint8 hour, uint8 minute, uint8 second) public pure returns (uint timestamp) {
                uint16 i;

                // Year
                for (i = ORIGIN_YEAR; i < year; i++) {
                        if (isLeapYear(i)) {
                                timestamp += LEAP_YEAR_IN_SECONDS;
                        }
                        else {
                                timestamp += YEAR_IN_SECONDS;
                        }
                }

                // Month
                uint8[12] memory monthDayCounts;
                monthDayCounts[0] = 31;
                if (isLeapYear(year)) {
                        monthDayCounts[1] = 29;
                }
                else {
                        monthDayCounts[1] = 28;
                }
                monthDayCounts[2] = 31;
                monthDayCounts[3] = 30;
                monthDayCounts[4] = 31;
                monthDayCounts[5] = 30;
                monthDayCounts[6] = 31;
                monthDayCounts[7] = 31;
                monthDayCounts[8] = 30;
                monthDayCounts[9] = 31;
                monthDayCounts[10] = 30;
                monthDayCounts[11] = 31;

                for (i = 1; i < month; i++) {
                        timestamp += DAY_IN_SECONDS * monthDayCounts[i - 1];
                }

                // Day
                timestamp += DAY_IN_SECONDS * (day - 1);

                // Hour
                timestamp += HOUR_IN_SECONDS * (hour);

                // Minute
                timestamp += MINUTE_IN_SECONDS * (minute);

                // Second
                timestamp += second;

                return timestamp;
        }
}

File 11 of 19 : IERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, 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 Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @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 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);

    /**
     * @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;
}

File 12 of 19 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT

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 `IERC721.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

File 13 of 19 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT

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);
}

File 14 of 19 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 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);
            }
        }
    }
}

File 15 of 19 : Context.sol
// SPDX-License-Identifier: MIT

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;
    }
}

File 16 of 19 : Strings.sol
// SPDX-License-Identifier: MIT

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);
    }
}

File 17 of 19 : ERC165.sol
// SPDX-License-Identifier: MIT

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;
    }
}

File 18 of 19 : IERC165.sol
// SPDX-License-Identifier: MIT

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 19 of 19 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT

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 tokenId);

    /**
     * @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);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract CommonCalendar","name":"_assetToken","type":"address"},{"internalType":"address","name":"_admin","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"patronageNumerator","type":"uint256"}],"name":"AddToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"}],"name":"Buy","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"patron","type":"address"},{"indexed":false,"internalType":"uint256","name":"remainingDeposit","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountReceived","type":"uint256"}],"name":"CollectPatronage","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"}],"name":"DayOwner","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"prevOwner","type":"address"},{"indexed":false,"internalType":"uint256","name":"foreclosureTime","type":"uint256"}],"name":"Foreclosure","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newPrice","type":"uint256"}],"name":"PriceChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"tokenPatron","type":"address"},{"indexed":false,"internalType":"uint256","name":"remainingDeposit","type":"uint256"}],"name":"RemainingDepositUpdate","type":"event"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"_collectPatronage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenPatron","type":"address"}],"name":"_collectPatronagePatron","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"assetToken","outputs":[{"internalType":"contract CommonCalendar","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"benefactor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"benefactorFunds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"benefactors","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint8","name":"month","type":"uint8"},{"internalType":"uint8","name":"dayOfMonth","type":"uint8"},{"internalType":"uint256","name":"_newPrice","type":"uint256"},{"internalType":"uint256","name":"_deposit","type":"uint256"},{"internalType":"string","name":"dayName","type":"string"}],"name":"buyOrMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_admin","type":"address"}],"name":"changeAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint8","name":"_monthNumber","type":"uint8"},{"internalType":"uint8","name":"_dayOfMonth","type":"uint8"},{"internalType":"string","name":"_dayName","type":"string"},{"internalType":"uint256","name":"_newPrice","type":"uint256"}],"name":"changeDayNamePrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address payable","name":"_newReceivingBenefactor","type":"address"}],"name":"changeReceivingBenefactor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"currentCollected","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"currentPatron","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenPatron","type":"address"}],"name":"depositAbleToWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"depositWei","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"patron","type":"address"}],"name":"depositWeiPatron","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"exit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"foreclosed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenPatron","type":"address"}],"name":"foreclosedPatron","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"foreclosureTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenPatron","type":"address"}],"name":"foreclosureTimePatron","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getDaySellPrice","outputs":[{"internalType":"uint256","name":"sellPrice","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenPatron","type":"address"}],"name":"getDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"hacker1","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"hacker2","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"legacyToken","outputs":[{"internalType":"contract CommonCalendar","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"patronageNumerator","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"patronageOwed","outputs":[{"internalType":"uint256","name":"patronageDue","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenPatron","type":"address"}],"name":"patronageOwedByPatron","outputs":[{"internalType":"uint256","name":"patronageDue","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenPatron","type":"address"}],"name":"patronageOwedByPatronWithTimestamp","outputs":[{"internalType":"uint256","name":"patronageDue","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"patronageOwedWithTimestamp","outputs":[{"internalType":"uint256","name":"patronageDue","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"patrons","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"price","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_benefactor","type":"address"}],"name":"setBenefactor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract CommonCalendar","name":"_legacy","type":"address"}],"name":"setLegacyToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"state","outputs":[{"internalType":"enum CalendarSteward.StewardState","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"timeAcquired","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"timeHeld","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"timeLastCollected","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"timeLastCollectedPatron","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"totalCollected","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"totalPatronOwnedTokenPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawBenefactorFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"benefactor","type":"address"}],"name":"withdrawBenefactorFundsTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_wei","type":"uint256"}],"name":"withdrawDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]

6080604052600280546001600160a01b031990811673c9015e8dd7a22c765e59a92ee194ab8a556449881790915560038054821673613ea163982868decef2d9c1a1cbe23e43186549179055600480548216736e93d1880c87a254d142c46f712074f6ce378e141790556005805490911673ef56f3d68ef19e48c367db3e04b6affce61d29811790553480156200009557600080fd5b50604051620029cc380380620029cc833981016040819052620000b891620000fa565b600180546001600160a01b039384166001600160a01b031991821617909155601480549290931691811691909117909155601580549091163317905562000151565b600080604083850312156200010d578182fd5b82516200011a8162000138565b60208401519092506200012d8162000138565b809150509250929050565b6001600160a01b03811681146200014e57600080fd5b50565b61286b80620001616000396000f3fe6080604052600436106102885760003560e01c80638a81694c1161015a578063c62bebe7116100c1578063e2e7ec211161007a578063e2e7ec211461077b578063e4fb7aa91461079b578063e9fad8ee146107bb578063f340fa01146107d0578063f851a440146107f0578063fb84e7ec1461080557610288565b8063c62bebe7146106c8578063cac38cc6146106e8578063cad6797114610708578063d9d85b071461071b578063e1254fba1461073b578063e1c214c61461075b57610288565b80639c15b1e3116101135780639c15b1e314610615578063b08d024b14610635578063b9c3c38d14610655578063c255dd0014610675578063c315411214610695578063c3310052146106a857610288565b80638a81694c1461055d5780638cb3c25f146105725780638cb68899146105a05780638da5cb5b146105c05780638f283970146105d55780638fc47bc9146105f557610288565b80632a9cdd7a116101fe5780633d2bcb03116101b75780633d2bcb03146104a65780633e4f49e6146104c6578063582bf649146104f35780635b2ace64146105085780636c04824f146105285780637cd855fc1461054857610288565b80632a9cdd7a146103f15780632b09e013146104115780632c3db6ea1461043157806333289a4614610451578063385320aa146104715780633adbd0fb1461048657610288565b80631b252781116102505780631b252781146103175780631e8b76ad14610344578063236fa0f414610371578063237b5e4f146103915780632488a69e146103b157806326a49e37146103d157610288565b80630e8f274f1461028d5780631083f761146102c3578063128ee161146102d857806313155455146102f857806315488b881461030d575b600080fd5b34801561029957600080fd5b506102ad6102a83660046122cd565b610825565b6040516102ba919061239a565b60405180910390f35b3480156102cf57600080fd5b506102ad610840565b3480156102e457600080fd5b506102ad6102f33660046122cd565b61084f565b34801561030457600080fd5b506102ad61086a565b610315610879565b005b34801561032357600080fd5b506103376103323660046122cd565b610884565b6040516102ba9190612707565b34801561035057600080fd5b5061036461035f3660046122cd565b610896565b6040516102ba91906123f6565b34801561037d57600080fd5b5061031561038c3660046121f4565b6108c0565b34801561039d57600080fd5b506103376103ac3660046122fd565b610915565b3480156103bd57600080fd5b506103156103cc3660046121f4565b610932565b3480156103dd57600080fd5b506103376103ec3660046122cd565b610a8b565b3480156103fd57600080fd5b5061033761040c3660046122cd565b610a9d565b34801561041d57600080fd5b5061036461042c3660046122fd565b610b15565b34801561043d57600080fd5b5061031561044c3660046121f4565b610b35565b34801561045d57600080fd5b5061033761046c3660046122cd565b610bc8565b34801561047d57600080fd5b50610315610be3565b34801561049257600080fd5b506103156104a13660046122fd565b610bec565b3480156104b257600080fd5b506103376104c13660046121f4565b610cf0565b3480156104d257600080fd5b506104e66104e13660046122cd565b610d02565b6040516102ba9190612401565b3480156104ff57600080fd5b506102ad610d17565b34801561051457600080fd5b506103376105233660046122cd565b610d26565b34801561053457600080fd5b506103376105433660046121f4565b610d38565b34801561055457600080fd5b506102ad610db7565b34801561056957600080fd5b506102ad610dc6565b34801561057e57600080fd5b5061059261058d3660046122cd565b610dd5565b6040516102ba929190612710565b3480156105ac57600080fd5b506103376105bb3660046122cd565b610dea565b3480156105cc57600080fd5b506102ad610dfc565b3480156105e157600080fd5b506103156105f03660046121f4565b610e0b565b34801561060157600080fd5b506103156106103660046121f4565b610e57565b34801561062157600080fd5b506103376106303660046122cd565b610ea3565b34801561064157600080fd5b506103376106503660046121f4565b610eb5565b34801561066157600080fd5b506103376106703660046121f4565b610ec7565b34801561068157600080fd5b506103376106903660046121f4565b610f14565b6103156106a336600461222c565b610f26565b3480156106b457600080fd5b506103376106c33660046122cd565b61110a565b3480156106d457600080fd5b506105926106e33660046121f4565b61111c565b3480156106f457600080fd5b5061031561070336600461232c565b611128565b6103156107163660046121f4565b61130c565b34801561072757600080fd5b506103376107363660046121f4565b6113bb565b34801561074757600080fd5b506103376107563660046121f4565b61141e565b34801561076757600080fd5b506103376107763660046122cd565b611439565b34801561078757600080fd5b506103376107963660046122cd565b61145a565b3480156107a757600080fd5b506103646107b63660046121f4565b61146c565b3480156107c757600080fd5b506103156114a3565b3480156107dc57600080fd5b506103376107eb3660046121f4565b6114c9565b3480156107fc57600080fd5b506102ad6114db565b34801561081157600080fd5b506103156108203660046122cd565b6114ea565b600e602052600090815260409020546001600160a01b031681565b6001546001600160a01b031681565b600c602052600090815260409020546001600160a01b031681565b6002546001600160a01b031681565b6108823361130c565b565b60076020526000908152604090205481565b6000818152600e60205260408120546001600160a01b03166108b78161146c565b9150505b919050565b6014546001600160a01b031633146108f35760405162461bcd60e51b81526004016108ea906126bb565b60405180910390fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b601060209081526000928352604080842090915290825290205481565b600061093d82610d38565b905060008111801561096757506001600160a01b0382166000908152600a60205260409020548110155b156109ed576001600160a01b038216600090815260096020908152604080832054600a9092528220549091906109be906109b79085906109b1906109ab4288611808565b9061181b565b90611827565b8390611833565b6001600160a01b038516600090815260096020908152604080832093909355600a90529081205550610a379050565b6001600160a01b0382166000908152600960209081526040808320429055600a909152902054610a1d9082611808565b6001600160a01b0383166000908152600a60205260409020555b6001600160a01b0382166000818152600a6020526040908190205490517fbece12534c1381f016e2ce4d456a6eb916094df84a7dd97faa7159f3a44a0d3c91610a7f91612707565b60405180910390a25050565b60006020819052908152604090205481565b600081815260086020526040812054610ab8575060006108bb565b600082815260126020908152604080832054600890925290912054610b0f916301e13380916109b19164e8d4a51000918391906109ab90610afa904290611808565b60008a8152602081905260409020549061181b565b92915050565b600f60209081526000928352604080842090915290825290205460ff1681565b6001600160a01b0381166000908152600d6020526040902054610b6a5760405162461bcd60e51b81526004016108ea90612429565b6001600160a01b0381166000818152600d6020526040808220805490839055905190929083156108fc0290849084818181858888f19350505050905080610bc35760405162461bcd60e51b81526004016108ea906124c3565b505050565b600033610bd481610932565b610bdd8361183f565b50919050565b61088233610b35565b6000828152600c602052604090205482906001600160a01b0316331480610c1d57506014546001600160a01b031633145b610c395760405162461bcd60e51b81526004016108ea9061256b565b6000838152600c60205260409020546001600160a01b03908116908316811415610c755760405162461bcd60e51b81526004016108ea90612534565b6000848152600c6020908152604080832080546001600160a01b0319166001600160a01b038881169182179092559085168452600d9092528083205491835290912054610cc191611833565b6001600160a01b039384166000908152600d602052604080822092909255919093168152918220919091555050565b600b6020526000908152604090205481565b60136020526000908152604090205460ff1681565b6004546001600160a01b031681565b60116020526000908152604090205481565b6001600160a01b038116600090815260096020526040812054610d5d575060006108bb565b6001600160a01b038216600090815260096020526040902054610b0f906301e13380906109b19064e8d4a51000908290610d98904290611808565b6001600160a01b0388166000908152600b60205260409020549061181b565b6005546001600160a01b031681565b6003546001600160a01b031681565b600080610de183610a9d565b93429350915050565b60086020526000908152604090205481565b6015546001600160a01b031681565b6014546001600160a01b03163314610e355760405162461bcd60e51b81526004016108ea906126bb565b601480546001600160a01b0319166001600160a01b0392909216919091179055565b6014546001600160a01b03163314610e815760405162461bcd60e51b81526004016108ea906126bb565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b60009081526020819052604090205490565b60096020526000908152604090205481565b6001600160a01b0381166000908152600b60205260408120548190610efb906301e13380906109b19064e8d4a51000611827565b90506108b7610f0d826109b1866113bb565b4290611833565b600d6020526000908152604090205481565b6000610f4460ff80871690610f3e908916606461181b565b90611833565b600154604051634f558e7960e01b81529192506001600160a01b031690634f558e7990610f75908490600401612707565b60206040518083038186803b158015610f8d57600080fd5b505afa158015610fa1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fc591906122ad565b15610fde57610fd9878288888888886118d7565b611101565b670de0b6b3a76400003481106110065760405162461bcd60e51b81526004016108ea906125c6565b6002546040516331a9108f60e11b81526000916001600160a01b031690636352211e90611037908690600401612707565b60206040518083038186803b15801561104f57600080fd5b505afa158015611063573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110879190612210565b6004549091506001600160a01b03808316911614806110b357506005546001600160a01b038281169116145b156110c657506014546001600160a01b03165b6040516000906001600160a01b0383169084156108fc0290859084818181858888f1935050505090506110fd8a8a8a8a8a8a611cf0565b5050505b50505050505050565b60066020526000908152604090205481565b600080610de183610d38565b6000858152600e602052604090205485906001600160a01b031633146111605760405162461bcd60e51b81526004016108ea906125ea565b8561116a816114ea565b60008781526013602052604081205460ff16600181111561119b57634e487b7160e01b600052602160045260246000fd5b14156111b95760405162461bcd60e51b81526004016108ea906125a2565b826111d65760405162461bcd60e51b81526004016108ea9061260e565b600087815260126020526040902054611232906111f490859061181b565b6000898152601260209081526040808320549183905290912054610f3e9161121c919061181b565b336000908152600b602052604090205490611808565b336000908152600b6020908152604080832093909355898252819052819020849055600154905163d8fcbca560e01b81526001600160a01b039091169063d8fcbca5906112879089908990899060040161271e565b600060405180830381600087803b1580156112a157600080fd5b505af11580156112b5573d6000803e3d6000fd5b50505050867ffe6b606ca0477592b5740a0eb00c8e91570a5d0eb736abfa1a6309bd081b4a4d6000808a8152602001908152602001600020546040516112fb9190612707565b60405180910390a250505050505050565b6001600160a01b0381166000908152600b60205260409020546113415760405162461bcd60e51b81526004016108ea906126de565b6001600160a01b0381166000908152600a60205260409020546113649034611833565b6001600160a01b0382166000818152600a6020526040908190208390555190917fbece12534c1381f016e2ce4d456a6eb916094df84a7dd97faa7159f3a44a0d3c916113b09190612707565b60405180910390a250565b6000806113c783610d38565b6001600160a01b0384166000908152600a602052604090205490915081106113f35760009150506108bb565b6001600160a01b0383166000908152600a60205260409020546114169082611808565b9150506108bb565b6001600160a01b03166000908152600a602052604090205490565b6000818152600e60205260408120546001600160a01b03166108b781610ec7565b60126020526000908152604090205481565b6001600160a01b0381166000908152600a602052604081205461148e83610d38565b1061149b575060016108bb565b5060006108bb565b336114ad81610932565b336000908152600a60205260409020546114c69061183f565b50565b600a6020526000908152604090205481565b6014546001600160a01b031681565b600160008281526013602052604090205460ff16600181111561151d57634e487b7160e01b600052602160045260246000fd5b14156114c6576000818152600e602090815260408083205460089092528220546001600160a01b039091169161155283610d38565b6001600160a01b0384166000908152600a602052604081205491925090821061166c576001600160a01b0384166000908152600a602090815260408083205460099092528220546115d1916115b29186916109b1916109ab904290611808565b6001600160a01b03871660009081526009602052604090205490611833565b60008781526008602090815260408083208490556001600160a01b0389168352600982528083208490558983526012909152902054909150611642906301e13380906109b19064e8d4a510009082906109ab61162d888c611808565b60008e8152602081905260409020549061181b565b6001600160a01b0386166000908152600a6020526040812055915061166686611e53565b50611741565b6000858152601260205260409020546116b4906301e13380906109b19064e8d4a510009082906109ab61169f428b611808565b60008d8152602081905260409020549061181b565b600086815260086020908152604080832042908190556001600160a01b0389168452600983528184205588835260079091529020549091506116f69082611833565b6000868152600760209081526040808320939093556001600160a01b0387168252600a905220546117279083611808565b6001600160a01b0385166000908152600a60205260409020555b60008581526006602052604090205461175a9082611833565b600086815260066020908152604080832093909355600c8152828220546001600160a01b0316808352600d909152919020546117969083611833565b6001600160a01b038083166000908152600d6020908152604080832094909455918816808252600a909252829020549151909188917f939ba75588ef4ead6e17d8cd3cffe6231558a84a74907c6746780c20ccef5158916117f8918790612710565b60405180910390a3505050505050565b600061181482846127dd565b9392505050565b600061181482846127be565b6000611814828461279e565b60006118148284612786565b336000908152600a602052604090205481111561186e5760405162461bcd60e51b81526004016108ea90612506565b336000908152600a60205260409020546118889082611808565b336000818152600a602052604080822093909355915183156108fc0290849084818181858888f193505050509050806118d35760405162461bcd60e51b81526004016108ea90612455565b5050565b856118e1816114ea565b876118eb81610932565b6000851161190b5760405162461bcd60e51b81526004016108ea90612694565b6000841161192b5760405162461bcd60e51b81526004016108ea9061248c565b60008881526020819052604090205434116119585760405162461bcd60e51b81526004016108ea906125c6565b600088815260208190526040812054611972903490611808565b9050848110156119945760405162461bcd60e51b81526004016108ea90612637565b6001546040516331a9108f60e11b81526000916001600160a01b031690636352211e906119c5908d90600401612707565b60206040518083038186803b1580156119dd57600080fd5b505afa1580156119f1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a159190612210565b90507fa0168d8da84cdfd783c9d2cf1edcb32ba8a35f1fba34653de2006a08ece073b781604051611a46919061239a565b60405180910390a160008a8152600e60205260409020546001600160a01b0316600160008c81526013602052604090205460ff166001811115611a9957634e487b7160e01b600052602160045260246000fd5b1415611b585760008b8152602081815260408083205460128352908320549290915290611ac790829061181b565b6001600160a01b0383166000908152600b60205260409020541415611b26576001600160a01b0382166000908152600a6020526040902054611b0a908290611833565b6001600160a01b0383166000908152600a602052604081205590505b60405182906000906001600160a01b0383169084156108fc0290859084818181858888f150611bf19650505050505050565b60008b81526013602052604081205460ff166001811115611b8957634e487b7160e01b600052602160045260246000fd5b1415611bf15760008b815260136020526040902080546001919060ff19168280021790555042600860008d81526020019081526020016000208190555042600960008e6001600160a01b03166001600160a01b03168152602001908152602001600020819055505b6001600160a01b038c166000908152600a6020526040902054611c149088611833565b6001600160a01b038d166000908152600a6020526040902055611c3a8b83838f8c611f76565b60015460405163d8fcbca560e01b81526001600160a01b039091169063d8fcbca590611c6e908d908d908b9060040161271e565b600060405180830381600087803b158015611c8857600080fd5b505af1158015611c9c573d6000803e3d6000fd5b505050508b6001600160a01b03168b7f3b599f6217e39be59216b60e543ce0d4c7d534fe64dd9d962334924e7819894e8a604051611cda9190612707565b60405180910390a3505050505050505050505050565b6003546001600160a01b03166402540be40081611d1d57634e487b7160e01b600052600160045260246000fd5b6001546040516344038dcb60e01b81526000916001600160a01b0316906344038dcb90611d52908c908c908c906004016123d2565b602060405180830381600087803b158015611d6c57600080fd5b505af1158015611d80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611da491906122e5565b6000818152600c6020908152604080832080546001600160a01b0319166001600160a01b03891617905560138252808320805460ff191690556012909152908190208490555190915081907f210ae353ce16aa90d4e1030c30c12482a2dc45bbfed71e98267e93fb7684fa0790611e1c908590612707565b60405180910390a26015546001600160a01b038a8116911614611e4857611e4889828a8a8a8a8a6118d7565b505050505050505050565b6001546040516331a9108f60e11b81526000916001600160a01b031690636352211e90611e84908590600401612707565b60206040518083038186803b158015611e9c57600080fd5b505afa158015611eb0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ed49190612210565b6000838152600e60205260408120549192506001600160a01b0390911690611f03908490849084903090611f76565b6000838152601360209081526040808320805460ff19169055600782528083208390556008909152908190205490516001600160a01b038416917f5c96da7ec020805f8c8976230ffa5316fff9373db995b9a5c11deb511e530c6d91611f699190612707565b60405180910390a2505050565b600085815260126020526040902054611fb390611f9490839061181b565b6001600160a01b0384166000908152600b602052604090205490611833565b6001600160a01b0383166000908152600b60209081526040808320939093558782526012815282822054908290529190205461201291611ff3919061181b565b6001600160a01b0385166000908152600b602052604090205490611808565b6001600160a01b0384166000908152600b6020908152604080832093909355878252601181528282205460089091529190205461207c916120539190611808565b60008781526010602090815260408083206001600160a01b038916845290915290205490611833565b60008681526010602090815260408083206001600160a01b0380891685529252918290209290925560015490516323b872dd60e01b81529116906323b872dd906120ce90879086908a906004016123ae565b600060405180830381600087803b1580156120e857600080fd5b505af11580156120fc573d6000803e3d6000fd5b505050600095865250600e6020908152604080872080546001600160a01b039095166001600160a01b0319909516851790558682528087209290925560118152818620429055600f815281862092865291909152909220805460ff191660011790555050565b600082601f830112612172578081fd5b813567ffffffffffffffff8082111561218d5761218d61280a565b604051601f8301601f1916810160200182811182821017156121b1576121b161280a565b6040528281528483016020018610156121c8578384fd5b82602086016020830137918201602001929092529392505050565b803560ff811681146108bb57600080fd5b600060208284031215612205578081fd5b813561181481612820565b600060208284031215612221578081fd5b815161181481612820565b60008060008060008060c08789031215612244578182fd5b863561224f81612820565b955061225d602088016121e3565b945061226b604088016121e3565b9350606087013592506080870135915060a087013567ffffffffffffffff811115612294578182fd5b6122a089828a01612162565b9150509295509295509295565b6000602082840312156122be578081fd5b81518015158114611814578182fd5b6000602082840312156122de578081fd5b5035919050565b6000602082840312156122f6578081fd5b5051919050565b6000806040838503121561230f578182fd5b82359150602083013561232181612820565b809150509250929050565b600080600080600060a08688031215612343578081fd5b85359450612353602087016121e3565b9350612361604087016121e3565b9250606086013567ffffffffffffffff81111561237c578182fd5b61238888828901612162565b95989497509295608001359392505050565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b0393909316835260ff918216602084015216604082015260600190565b901515815260200190565b602081016002831061242357634e487b7160e01b600052602160045260246000fd5b91905290565b6020808252601290820152714e6f2066756e647320617661696c61626c6560701b604082015260600190565b6020808252601a908201527f556e61626c6520746f207769746864726177206465706f736974000000000000604082015260600190565b6020808252601a908201527f4465706f7369742065746820616d6f756e74206973207a65726f000000000000604082015260600190565b60208082526023908201527f556e61626c6520746f2077697468647261772062656e65666163746f722066756040820152626e647360e81b606082015260800190565b6020808252601490820152730aed2e8d0c8e4c2eed2dcce40e8dede40daeac6d60631b604082015260600190565b6020808252601d908201527f43616e6e6f74206368616e676520746f2073616d652061646472657373000000604082015260600190565b60208082526017908201527f4e6f742062656e65666163746f72206f722061646d696e000000000000000000604082015260600190565b6020808252600a9082015269119bdc9958db1bdcd95960b21b604082015260600190565b6020808252600a908201526909cdee840cadcdeeaced60b31b604082015260600190565b6020808252600a90820152692737ba103830ba3937b760b11b604082015260600190565b6020808252600f908201526e496e636f727265637420507269636560881b604082015260600190565b6020808252603d908201527f546865206465706f73697420617661696c61626c65206973203c20776861742060408201527f7761732073746174656420696e20746865207472616e73616374696f6e000000606082015260800190565b6020808252600d908201526c5072696365206973207a65726f60981b604082015260600190565b6020808252600990820152682737ba1030b236b4b760b91b604082015260600190565b6020808252600f908201526e139bc81d1bdad95b9cc81bdddb9959608a1b604082015260600190565b90815260200190565b918252602082015260400190565b600060ff85168252602060ff851681840152606060408401528351806060850152825b8181101561275d57858101830151858201608001528201612741565b8181111561276e5783608083870101525b50601f01601f19169290920160800195945050505050565b60008219821115612799576127996127f4565b500190565b6000826127b957634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156127d8576127d86127f4565b500290565b6000828210156127ef576127ef6127f4565b500390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146114c657600080fdfea2646970667358221220b3e93224a58502c3e605d1f2dc6aadef956164c8eb68067123ecdd1033ba8bb564736f6c634300080000330000000000000000000000005228787dbc773cfdae72bb98b6f27fbb546e0292000000000000000000000000613ea163982868decef2d9c1a1cbe23e43186549

Deployed Bytecode

0x6080604052600436106102885760003560e01c80638a81694c1161015a578063c62bebe7116100c1578063e2e7ec211161007a578063e2e7ec211461077b578063e4fb7aa91461079b578063e9fad8ee146107bb578063f340fa01146107d0578063f851a440146107f0578063fb84e7ec1461080557610288565b8063c62bebe7146106c8578063cac38cc6146106e8578063cad6797114610708578063d9d85b071461071b578063e1254fba1461073b578063e1c214c61461075b57610288565b80639c15b1e3116101135780639c15b1e314610615578063b08d024b14610635578063b9c3c38d14610655578063c255dd0014610675578063c315411214610695578063c3310052146106a857610288565b80638a81694c1461055d5780638cb3c25f146105725780638cb68899146105a05780638da5cb5b146105c05780638f283970146105d55780638fc47bc9146105f557610288565b80632a9cdd7a116101fe5780633d2bcb03116101b75780633d2bcb03146104a65780633e4f49e6146104c6578063582bf649146104f35780635b2ace64146105085780636c04824f146105285780637cd855fc1461054857610288565b80632a9cdd7a146103f15780632b09e013146104115780632c3db6ea1461043157806333289a4614610451578063385320aa146104715780633adbd0fb1461048657610288565b80631b252781116102505780631b252781146103175780631e8b76ad14610344578063236fa0f414610371578063237b5e4f146103915780632488a69e146103b157806326a49e37146103d157610288565b80630e8f274f1461028d5780631083f761146102c3578063128ee161146102d857806313155455146102f857806315488b881461030d575b600080fd5b34801561029957600080fd5b506102ad6102a83660046122cd565b610825565b6040516102ba919061239a565b60405180910390f35b3480156102cf57600080fd5b506102ad610840565b3480156102e457600080fd5b506102ad6102f33660046122cd565b61084f565b34801561030457600080fd5b506102ad61086a565b610315610879565b005b34801561032357600080fd5b506103376103323660046122cd565b610884565b6040516102ba9190612707565b34801561035057600080fd5b5061036461035f3660046122cd565b610896565b6040516102ba91906123f6565b34801561037d57600080fd5b5061031561038c3660046121f4565b6108c0565b34801561039d57600080fd5b506103376103ac3660046122fd565b610915565b3480156103bd57600080fd5b506103156103cc3660046121f4565b610932565b3480156103dd57600080fd5b506103376103ec3660046122cd565b610a8b565b3480156103fd57600080fd5b5061033761040c3660046122cd565b610a9d565b34801561041d57600080fd5b5061036461042c3660046122fd565b610b15565b34801561043d57600080fd5b5061031561044c3660046121f4565b610b35565b34801561045d57600080fd5b5061033761046c3660046122cd565b610bc8565b34801561047d57600080fd5b50610315610be3565b34801561049257600080fd5b506103156104a13660046122fd565b610bec565b3480156104b257600080fd5b506103376104c13660046121f4565b610cf0565b3480156104d257600080fd5b506104e66104e13660046122cd565b610d02565b6040516102ba9190612401565b3480156104ff57600080fd5b506102ad610d17565b34801561051457600080fd5b506103376105233660046122cd565b610d26565b34801561053457600080fd5b506103376105433660046121f4565b610d38565b34801561055457600080fd5b506102ad610db7565b34801561056957600080fd5b506102ad610dc6565b34801561057e57600080fd5b5061059261058d3660046122cd565b610dd5565b6040516102ba929190612710565b3480156105ac57600080fd5b506103376105bb3660046122cd565b610dea565b3480156105cc57600080fd5b506102ad610dfc565b3480156105e157600080fd5b506103156105f03660046121f4565b610e0b565b34801561060157600080fd5b506103156106103660046121f4565b610e57565b34801561062157600080fd5b506103376106303660046122cd565b610ea3565b34801561064157600080fd5b506103376106503660046121f4565b610eb5565b34801561066157600080fd5b506103376106703660046121f4565b610ec7565b34801561068157600080fd5b506103376106903660046121f4565b610f14565b6103156106a336600461222c565b610f26565b3480156106b457600080fd5b506103376106c33660046122cd565b61110a565b3480156106d457600080fd5b506105926106e33660046121f4565b61111c565b3480156106f457600080fd5b5061031561070336600461232c565b611128565b6103156107163660046121f4565b61130c565b34801561072757600080fd5b506103376107363660046121f4565b6113bb565b34801561074757600080fd5b506103376107563660046121f4565b61141e565b34801561076757600080fd5b506103376107763660046122cd565b611439565b34801561078757600080fd5b506103376107963660046122cd565b61145a565b3480156107a757600080fd5b506103646107b63660046121f4565b61146c565b3480156107c757600080fd5b506103156114a3565b3480156107dc57600080fd5b506103376107eb3660046121f4565b6114c9565b3480156107fc57600080fd5b506102ad6114db565b34801561081157600080fd5b506103156108203660046122cd565b6114ea565b600e602052600090815260409020546001600160a01b031681565b6001546001600160a01b031681565b600c602052600090815260409020546001600160a01b031681565b6002546001600160a01b031681565b6108823361130c565b565b60076020526000908152604090205481565b6000818152600e60205260408120546001600160a01b03166108b78161146c565b9150505b919050565b6014546001600160a01b031633146108f35760405162461bcd60e51b81526004016108ea906126bb565b60405180910390fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b601060209081526000928352604080842090915290825290205481565b600061093d82610d38565b905060008111801561096757506001600160a01b0382166000908152600a60205260409020548110155b156109ed576001600160a01b038216600090815260096020908152604080832054600a9092528220549091906109be906109b79085906109b1906109ab4288611808565b9061181b565b90611827565b8390611833565b6001600160a01b038516600090815260096020908152604080832093909355600a90529081205550610a379050565b6001600160a01b0382166000908152600960209081526040808320429055600a909152902054610a1d9082611808565b6001600160a01b0383166000908152600a60205260409020555b6001600160a01b0382166000818152600a6020526040908190205490517fbece12534c1381f016e2ce4d456a6eb916094df84a7dd97faa7159f3a44a0d3c91610a7f91612707565b60405180910390a25050565b60006020819052908152604090205481565b600081815260086020526040812054610ab8575060006108bb565b600082815260126020908152604080832054600890925290912054610b0f916301e13380916109b19164e8d4a51000918391906109ab90610afa904290611808565b60008a8152602081905260409020549061181b565b92915050565b600f60209081526000928352604080842090915290825290205460ff1681565b6001600160a01b0381166000908152600d6020526040902054610b6a5760405162461bcd60e51b81526004016108ea90612429565b6001600160a01b0381166000818152600d6020526040808220805490839055905190929083156108fc0290849084818181858888f19350505050905080610bc35760405162461bcd60e51b81526004016108ea906124c3565b505050565b600033610bd481610932565b610bdd8361183f565b50919050565b61088233610b35565b6000828152600c602052604090205482906001600160a01b0316331480610c1d57506014546001600160a01b031633145b610c395760405162461bcd60e51b81526004016108ea9061256b565b6000838152600c60205260409020546001600160a01b03908116908316811415610c755760405162461bcd60e51b81526004016108ea90612534565b6000848152600c6020908152604080832080546001600160a01b0319166001600160a01b038881169182179092559085168452600d9092528083205491835290912054610cc191611833565b6001600160a01b039384166000908152600d602052604080822092909255919093168152918220919091555050565b600b6020526000908152604090205481565b60136020526000908152604090205460ff1681565b6004546001600160a01b031681565b60116020526000908152604090205481565b6001600160a01b038116600090815260096020526040812054610d5d575060006108bb565b6001600160a01b038216600090815260096020526040902054610b0f906301e13380906109b19064e8d4a51000908290610d98904290611808565b6001600160a01b0388166000908152600b60205260409020549061181b565b6005546001600160a01b031681565b6003546001600160a01b031681565b600080610de183610a9d565b93429350915050565b60086020526000908152604090205481565b6015546001600160a01b031681565b6014546001600160a01b03163314610e355760405162461bcd60e51b81526004016108ea906126bb565b601480546001600160a01b0319166001600160a01b0392909216919091179055565b6014546001600160a01b03163314610e815760405162461bcd60e51b81526004016108ea906126bb565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b60009081526020819052604090205490565b60096020526000908152604090205481565b6001600160a01b0381166000908152600b60205260408120548190610efb906301e13380906109b19064e8d4a51000611827565b90506108b7610f0d826109b1866113bb565b4290611833565b600d6020526000908152604090205481565b6000610f4460ff80871690610f3e908916606461181b565b90611833565b600154604051634f558e7960e01b81529192506001600160a01b031690634f558e7990610f75908490600401612707565b60206040518083038186803b158015610f8d57600080fd5b505afa158015610fa1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fc591906122ad565b15610fde57610fd9878288888888886118d7565b611101565b670de0b6b3a76400003481106110065760405162461bcd60e51b81526004016108ea906125c6565b6002546040516331a9108f60e11b81526000916001600160a01b031690636352211e90611037908690600401612707565b60206040518083038186803b15801561104f57600080fd5b505afa158015611063573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110879190612210565b6004549091506001600160a01b03808316911614806110b357506005546001600160a01b038281169116145b156110c657506014546001600160a01b03165b6040516000906001600160a01b0383169084156108fc0290859084818181858888f1935050505090506110fd8a8a8a8a8a8a611cf0565b5050505b50505050505050565b60066020526000908152604090205481565b600080610de183610d38565b6000858152600e602052604090205485906001600160a01b031633146111605760405162461bcd60e51b81526004016108ea906125ea565b8561116a816114ea565b60008781526013602052604081205460ff16600181111561119b57634e487b7160e01b600052602160045260246000fd5b14156111b95760405162461bcd60e51b81526004016108ea906125a2565b826111d65760405162461bcd60e51b81526004016108ea9061260e565b600087815260126020526040902054611232906111f490859061181b565b6000898152601260209081526040808320549183905290912054610f3e9161121c919061181b565b336000908152600b602052604090205490611808565b336000908152600b6020908152604080832093909355898252819052819020849055600154905163d8fcbca560e01b81526001600160a01b039091169063d8fcbca5906112879089908990899060040161271e565b600060405180830381600087803b1580156112a157600080fd5b505af11580156112b5573d6000803e3d6000fd5b50505050867ffe6b606ca0477592b5740a0eb00c8e91570a5d0eb736abfa1a6309bd081b4a4d6000808a8152602001908152602001600020546040516112fb9190612707565b60405180910390a250505050505050565b6001600160a01b0381166000908152600b60205260409020546113415760405162461bcd60e51b81526004016108ea906126de565b6001600160a01b0381166000908152600a60205260409020546113649034611833565b6001600160a01b0382166000818152600a6020526040908190208390555190917fbece12534c1381f016e2ce4d456a6eb916094df84a7dd97faa7159f3a44a0d3c916113b09190612707565b60405180910390a250565b6000806113c783610d38565b6001600160a01b0384166000908152600a602052604090205490915081106113f35760009150506108bb565b6001600160a01b0383166000908152600a60205260409020546114169082611808565b9150506108bb565b6001600160a01b03166000908152600a602052604090205490565b6000818152600e60205260408120546001600160a01b03166108b781610ec7565b60126020526000908152604090205481565b6001600160a01b0381166000908152600a602052604081205461148e83610d38565b1061149b575060016108bb565b5060006108bb565b336114ad81610932565b336000908152600a60205260409020546114c69061183f565b50565b600a6020526000908152604090205481565b6014546001600160a01b031681565b600160008281526013602052604090205460ff16600181111561151d57634e487b7160e01b600052602160045260246000fd5b14156114c6576000818152600e602090815260408083205460089092528220546001600160a01b039091169161155283610d38565b6001600160a01b0384166000908152600a602052604081205491925090821061166c576001600160a01b0384166000908152600a602090815260408083205460099092528220546115d1916115b29186916109b1916109ab904290611808565b6001600160a01b03871660009081526009602052604090205490611833565b60008781526008602090815260408083208490556001600160a01b0389168352600982528083208490558983526012909152902054909150611642906301e13380906109b19064e8d4a510009082906109ab61162d888c611808565b60008e8152602081905260409020549061181b565b6001600160a01b0386166000908152600a6020526040812055915061166686611e53565b50611741565b6000858152601260205260409020546116b4906301e13380906109b19064e8d4a510009082906109ab61169f428b611808565b60008d8152602081905260409020549061181b565b600086815260086020908152604080832042908190556001600160a01b0389168452600983528184205588835260079091529020549091506116f69082611833565b6000868152600760209081526040808320939093556001600160a01b0387168252600a905220546117279083611808565b6001600160a01b0385166000908152600a60205260409020555b60008581526006602052604090205461175a9082611833565b600086815260066020908152604080832093909355600c8152828220546001600160a01b0316808352600d909152919020546117969083611833565b6001600160a01b038083166000908152600d6020908152604080832094909455918816808252600a909252829020549151909188917f939ba75588ef4ead6e17d8cd3cffe6231558a84a74907c6746780c20ccef5158916117f8918790612710565b60405180910390a3505050505050565b600061181482846127dd565b9392505050565b600061181482846127be565b6000611814828461279e565b60006118148284612786565b336000908152600a602052604090205481111561186e5760405162461bcd60e51b81526004016108ea90612506565b336000908152600a60205260409020546118889082611808565b336000818152600a602052604080822093909355915183156108fc0290849084818181858888f193505050509050806118d35760405162461bcd60e51b81526004016108ea90612455565b5050565b856118e1816114ea565b876118eb81610932565b6000851161190b5760405162461bcd60e51b81526004016108ea90612694565b6000841161192b5760405162461bcd60e51b81526004016108ea9061248c565b60008881526020819052604090205434116119585760405162461bcd60e51b81526004016108ea906125c6565b600088815260208190526040812054611972903490611808565b9050848110156119945760405162461bcd60e51b81526004016108ea90612637565b6001546040516331a9108f60e11b81526000916001600160a01b031690636352211e906119c5908d90600401612707565b60206040518083038186803b1580156119dd57600080fd5b505afa1580156119f1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a159190612210565b90507fa0168d8da84cdfd783c9d2cf1edcb32ba8a35f1fba34653de2006a08ece073b781604051611a46919061239a565b60405180910390a160008a8152600e60205260409020546001600160a01b0316600160008c81526013602052604090205460ff166001811115611a9957634e487b7160e01b600052602160045260246000fd5b1415611b585760008b8152602081815260408083205460128352908320549290915290611ac790829061181b565b6001600160a01b0383166000908152600b60205260409020541415611b26576001600160a01b0382166000908152600a6020526040902054611b0a908290611833565b6001600160a01b0383166000908152600a602052604081205590505b60405182906000906001600160a01b0383169084156108fc0290859084818181858888f150611bf19650505050505050565b60008b81526013602052604081205460ff166001811115611b8957634e487b7160e01b600052602160045260246000fd5b1415611bf15760008b815260136020526040902080546001919060ff19168280021790555042600860008d81526020019081526020016000208190555042600960008e6001600160a01b03166001600160a01b03168152602001908152602001600020819055505b6001600160a01b038c166000908152600a6020526040902054611c149088611833565b6001600160a01b038d166000908152600a6020526040902055611c3a8b83838f8c611f76565b60015460405163d8fcbca560e01b81526001600160a01b039091169063d8fcbca590611c6e908d908d908b9060040161271e565b600060405180830381600087803b158015611c8857600080fd5b505af1158015611c9c573d6000803e3d6000fd5b505050508b6001600160a01b03168b7f3b599f6217e39be59216b60e543ce0d4c7d534fe64dd9d962334924e7819894e8a604051611cda9190612707565b60405180910390a3505050505050505050505050565b6003546001600160a01b03166402540be40081611d1d57634e487b7160e01b600052600160045260246000fd5b6001546040516344038dcb60e01b81526000916001600160a01b0316906344038dcb90611d52908c908c908c906004016123d2565b602060405180830381600087803b158015611d6c57600080fd5b505af1158015611d80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611da491906122e5565b6000818152600c6020908152604080832080546001600160a01b0319166001600160a01b03891617905560138252808320805460ff191690556012909152908190208490555190915081907f210ae353ce16aa90d4e1030c30c12482a2dc45bbfed71e98267e93fb7684fa0790611e1c908590612707565b60405180910390a26015546001600160a01b038a8116911614611e4857611e4889828a8a8a8a8a6118d7565b505050505050505050565b6001546040516331a9108f60e11b81526000916001600160a01b031690636352211e90611e84908590600401612707565b60206040518083038186803b158015611e9c57600080fd5b505afa158015611eb0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ed49190612210565b6000838152600e60205260408120549192506001600160a01b0390911690611f03908490849084903090611f76565b6000838152601360209081526040808320805460ff19169055600782528083208390556008909152908190205490516001600160a01b038416917f5c96da7ec020805f8c8976230ffa5316fff9373db995b9a5c11deb511e530c6d91611f699190612707565b60405180910390a2505050565b600085815260126020526040902054611fb390611f9490839061181b565b6001600160a01b0384166000908152600b602052604090205490611833565b6001600160a01b0383166000908152600b60209081526040808320939093558782526012815282822054908290529190205461201291611ff3919061181b565b6001600160a01b0385166000908152600b602052604090205490611808565b6001600160a01b0384166000908152600b6020908152604080832093909355878252601181528282205460089091529190205461207c916120539190611808565b60008781526010602090815260408083206001600160a01b038916845290915290205490611833565b60008681526010602090815260408083206001600160a01b0380891685529252918290209290925560015490516323b872dd60e01b81529116906323b872dd906120ce90879086908a906004016123ae565b600060405180830381600087803b1580156120e857600080fd5b505af11580156120fc573d6000803e3d6000fd5b505050600095865250600e6020908152604080872080546001600160a01b039095166001600160a01b0319909516851790558682528087209290925560118152818620429055600f815281862092865291909152909220805460ff191660011790555050565b600082601f830112612172578081fd5b813567ffffffffffffffff8082111561218d5761218d61280a565b604051601f8301601f1916810160200182811182821017156121b1576121b161280a565b6040528281528483016020018610156121c8578384fd5b82602086016020830137918201602001929092529392505050565b803560ff811681146108bb57600080fd5b600060208284031215612205578081fd5b813561181481612820565b600060208284031215612221578081fd5b815161181481612820565b60008060008060008060c08789031215612244578182fd5b863561224f81612820565b955061225d602088016121e3565b945061226b604088016121e3565b9350606087013592506080870135915060a087013567ffffffffffffffff811115612294578182fd5b6122a089828a01612162565b9150509295509295509295565b6000602082840312156122be578081fd5b81518015158114611814578182fd5b6000602082840312156122de578081fd5b5035919050565b6000602082840312156122f6578081fd5b5051919050565b6000806040838503121561230f578182fd5b82359150602083013561232181612820565b809150509250929050565b600080600080600060a08688031215612343578081fd5b85359450612353602087016121e3565b9350612361604087016121e3565b9250606086013567ffffffffffffffff81111561237c578182fd5b61238888828901612162565b95989497509295608001359392505050565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b0393909316835260ff918216602084015216604082015260600190565b901515815260200190565b602081016002831061242357634e487b7160e01b600052602160045260246000fd5b91905290565b6020808252601290820152714e6f2066756e647320617661696c61626c6560701b604082015260600190565b6020808252601a908201527f556e61626c6520746f207769746864726177206465706f736974000000000000604082015260600190565b6020808252601a908201527f4465706f7369742065746820616d6f756e74206973207a65726f000000000000604082015260600190565b60208082526023908201527f556e61626c6520746f2077697468647261772062656e65666163746f722066756040820152626e647360e81b606082015260800190565b6020808252601490820152730aed2e8d0c8e4c2eed2dcce40e8dede40daeac6d60631b604082015260600190565b6020808252601d908201527f43616e6e6f74206368616e676520746f2073616d652061646472657373000000604082015260600190565b60208082526017908201527f4e6f742062656e65666163746f72206f722061646d696e000000000000000000604082015260600190565b6020808252600a9082015269119bdc9958db1bdcd95960b21b604082015260600190565b6020808252600a908201526909cdee840cadcdeeaced60b31b604082015260600190565b6020808252600a90820152692737ba103830ba3937b760b11b604082015260600190565b6020808252600f908201526e496e636f727265637420507269636560881b604082015260600190565b6020808252603d908201527f546865206465706f73697420617661696c61626c65206973203c20776861742060408201527f7761732073746174656420696e20746865207472616e73616374696f6e000000606082015260800190565b6020808252600d908201526c5072696365206973207a65726f60981b604082015260600190565b6020808252600990820152682737ba1030b236b4b760b91b604082015260600190565b6020808252600f908201526e139bc81d1bdad95b9cc81bdddb9959608a1b604082015260600190565b90815260200190565b918252602082015260400190565b600060ff85168252602060ff851681840152606060408401528351806060850152825b8181101561275d57858101830151858201608001528201612741565b8181111561276e5783608083870101525b50601f01601f19169290920160800195945050505050565b60008219821115612799576127996127f4565b500190565b6000826127b957634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156127d8576127d86127f4565b500290565b6000828210156127ef576127ef6127f4565b500390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146114c657600080fdfea2646970667358221220b3e93224a58502c3e605d1f2dc6aadef956164c8eb68067123ecdd1033ba8bb564736f6c63430008000033

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

0000000000000000000000005228787dbc773cfdae72bb98b6f27fbb546e0292000000000000000000000000613ea163982868decef2d9c1a1cbe23e43186549

-----Decoded View---------------
Arg [0] : _assetToken (address): 0x5228787dBc773CfdaE72Bb98B6f27FbB546e0292
Arg [1] : _admin (address): 0x613ea163982868DecEf2D9C1A1cbE23e43186549

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000005228787dbc773cfdae72bb98b6f27fbb546e0292
Arg [1] : 000000000000000000000000613ea163982868decef2d9c1a1cbe23e43186549


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
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.