Contract 0x3ba6efd5feaf614dc8601d94884d68b229f78b47

Contract Overview

Balance:
0 MATIC

Token:
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x056aa2c61e09c6e50b521feff4266c28440f61677389f9f0e83e63689a079bdaBuy Gen0260023792022-04-19 19:44:2135 days 21 hrs ago0xf2f85cbdc2d059437dfa96f6a97a7ffc773b5660 IN  0x3ba6efd5feaf614dc8601d94884d68b229f78b470.01 MATIC0.00015092353.5
0x466028f938c37a1db559bdb41dbb308643827d75fbd1984397c8b426a9c915d1Pause227488002021-12-16 20:53:21159 days 20 hrs ago0x3e848fa9556813c1c521f194515e01ba0cb5eeae IN  0x3ba6efd5feaf614dc8601d94884d68b229f78b470 MATIC0.0008322 30
0xd8afb0635b8c0cb3b3b1a81c30c30b5a579ac96bf61775579d924b259d90e35bWithdraw Matic227487442021-12-16 20:51:25159 days 20 hrs ago0x3e848fa9556813c1c521f194515e01ba0cb5eeae IN  0x3ba6efd5feaf614dc8601d94884d68b229f78b470 MATIC0.00091068 30
0x23f8613480a457226fb2717b144a4f1053cb284d48c1a2480d0549c9a9e28096Simple Replicate227481642021-12-16 20:31:29159 days 21 hrs ago0x7c6a9eb80dfc685f2b3c1612e4731383aa3d4535 IN  0x3ba6efd5feaf614dc8601d94884d68b229f78b470.01 MATIC0.03792387 30
0x70c833ade22e3d1a91715dfb753c59760a0f58315c38146f2c2b08e7f362fbfaReplicate227481162021-12-16 20:29:49159 days 21 hrs ago0x7c6a9eb80dfc685f2b3c1612e4731383aa3d4535 IN  0x3ba6efd5feaf614dc8601d94884d68b229f78b470.01 MATIC0.050832510001 30.000000001
0xd24b0129515e83e9e7bbb6da5ec4af74234e92b843e784dd71e10a8e25dc8cd8Replicate227480742021-12-16 20:28:21159 days 21 hrs ago0x7c6a9eb80dfc685f2b3c1612e4731383aa3d4535 IN  0x3ba6efd5feaf614dc8601d94884d68b229f78b470.01 MATIC0.05306097 30
0x9a92433b06d85333f0103ad8e08cb4eeb3c94f253cfe48ca85c1cfe322afb851Replicate227480432021-12-16 20:27:19159 days 21 hrs ago0x7c6a9eb80dfc685f2b3c1612e4731383aa3d4535 IN  0x3ba6efd5feaf614dc8601d94884d68b229f78b470.01 MATIC0.04789776 30
0x80d6acc27620a80ec8e5a471b5dc46b4d012d7bd0b45184bef76132deea8eefeReplicate227480292021-12-16 20:26:47159 days 21 hrs ago0x973c9d264d6c18df73a4d5d592a57770589c1cd9 IN  0x3ba6efd5feaf614dc8601d94884d68b229f78b470.01 MATIC0.04839933 30
0xa25c7dc954601e2efc76f5e6c9eabe461de3db13eafe20d8842f7a7d21e7771cReplicate227480022021-12-16 20:25:53159 days 21 hrs ago0x7c6a9eb80dfc685f2b3c1612e4731383aa3d4535 IN  0x3ba6efd5feaf614dc8601d94884d68b229f78b470.01 MATIC0.05070648 30
0x3069ec5356c79f953eb4e0fca02cc8366eae33cfc3d34ae184eb4a6d8da0d56eClaim All227479502021-12-16 20:24:05159 days 21 hrs ago0x7c6a9eb80dfc685f2b3c1612e4731383aa3d4535 IN  0x3ba6efd5feaf614dc8601d94884d68b229f78b470 MATIC0.01435803 30
0xa44d1f40579e02849676841271fd9e607b21ca0870bf0fa8ef547453666a5c52Replicate227478192021-12-16 20:19:35159 days 21 hrs ago0x4f7511dea2df8f1e2afcb5a798837201fe879a64 IN  0x3ba6efd5feaf614dc8601d94884d68b229f78b470.01 MATIC0.121789568996 32.999999999
0x84aded12eef19d9fcb44f2da3f02b7e04950d0ecebda71b81e8c35d93692562eReplicate227478012021-12-16 20:18:59159 days 21 hrs ago0x4f7511dea2df8f1e2afcb5a798837201fe879a64 IN  0x3ba6efd5feaf614dc8601d94884d68b229f78b470.01 MATIC0.066908984997 32.999999999
0x031f90c556728bbfe11644ed9f1f1aca36913c0441aac6a632fe930ef3c7ae73Claim All227477642021-12-16 20:17:41159 days 21 hrs ago0x4f7511dea2df8f1e2afcb5a798837201fe879a64 IN  0x3ba6efd5feaf614dc8601d94884d68b229f78b470 MATIC0.050493068998 32.999999999
0x8d486f3d53483a7fc351ad7d1f6dca92b9408ac295e8627af2fbfbd9aa7a0ec6Claim All227477592021-12-16 20:17:31159 days 21 hrs ago0x4f7511dea2df8f1e2afcb5a798837201fe879a64 IN  0x3ba6efd5feaf614dc8601d94884d68b229f78b470 MATIC0.333782294989 32.999999999
0x8ce62370ac69effd3ce761cb45f1b400a7f51c5dd6a16460ee38b6caa36a3795Claim All227477472021-12-16 20:17:07159 days 21 hrs ago0x4f7511dea2df8f1e2afcb5a798837201fe879a64 IN  0x3ba6efd5feaf614dc8601d94884d68b229f78b470 MATIC0.334634288989 32.999999999
0x35f8b2ee9cca23dece3839d56e501ef520223dfa369a3b323c4a31aefde039d4Replicate227476082021-12-16 20:12:21159 days 21 hrs ago0x973c9d264d6c18df73a4d5d592a57770589c1cd9 IN  0x3ba6efd5feaf614dc8601d94884d68b229f78b470.01 MATIC0.056920743 33
0x8064df082db75e805ba6ead6bd9f14cf6923fc918523a8fcca58d3138f3866c9Claim All227472872021-12-16 20:01:19159 days 21 hrs ago0x9336a7fa7e8e9019682c8d31bf98e497da4fb028 IN  0x3ba6efd5feaf614dc8601d94884d68b229f78b470 MATIC0.1046440830
0x5e40c074782492e8da38b49ae82347d1a429a960f3f97a774a0eaf4e73ae7825Replicate227466022021-12-16 19:37:45159 days 21 hrs ago0xc5f18020502f2c7fe0a528fc64f854688c5619c3 IN  0x3ba6efd5feaf614dc8601d94884d68b229f78b470.01 MATIC0.060693975 25
0x4a76b64f867856ebf1d693860f757e90f35935546b0be393a16d0827b4699ab9Claim All227465542021-12-16 19:36:05159 days 22 hrs ago0xc5f18020502f2c7fe0a528fc64f854688c5619c3 IN  0x3ba6efd5feaf614dc8601d94884d68b229f78b470 MATIC0.05379697 10
0x81cb54152f7e11c105d3e5ed2402b994b41894833b7dcbbdf657b56dafb9840bReplicate227463862021-12-16 19:30:21159 days 22 hrs ago0xc5f18020502f2c7fe0a528fc64f854688c5619c3 IN  0x3ba6efd5feaf614dc8601d94884d68b229f78b470.01 MATIC0.049898475 25
0x3b53a60305ebdc19a38dd0ddfee13593810d436eeb39f0dbe5b9d2b8e4055b04Replicate227463192021-12-16 19:28:03159 days 22 hrs ago0xc5f18020502f2c7fe0a528fc64f854688c5619c3 IN  0x3ba6efd5feaf614dc8601d94884d68b229f78b470.01 MATIC0.042444275 25
0xf5bffdbb1545ffb4ff39497d42b7521228aac27142e5b19e3fc4e0c73c762da9Replicate227462812021-12-16 19:26:43159 days 22 hrs ago0xc5f18020502f2c7fe0a528fc64f854688c5619c3 IN  0x3ba6efd5feaf614dc8601d94884d68b229f78b470.01 MATIC0.0417213 25
0xf6aad5d1e98392845c83f46537bd7462eb3b2479bfa4aab8e61643f2973668c7Replicate227461692021-12-16 19:22:51159 days 22 hrs ago0xc5f18020502f2c7fe0a528fc64f854688c5619c3 IN  0x3ba6efd5feaf614dc8601d94884d68b229f78b470.01 MATIC0.04391235 25
0xf2750ee10df0d85f073ba3257c7938127f2560b2c7bafe34b1177e377dec7d1dReplicate227461152021-12-16 19:21:03159 days 22 hrs ago0xc5f18020502f2c7fe0a528fc64f854688c5619c3 IN  0x3ba6efd5feaf614dc8601d94884d68b229f78b470.01 MATIC0.055956252 33
0x45f58f8b004aebfdfe5916bdeca4dfa8693e5a5d3b8b332c3da65069364be904Replicate227455112021-12-16 19:00:15159 days 22 hrs ago0xc5f18020502f2c7fe0a528fc64f854688c5619c3 IN  0x3ba6efd5feaf614dc8601d94884d68b229f78b470.01 MATIC0.0174377 10
[ Download CSV Export 
Latest 2 internal transactions
Parent Txn Hash Block From To Value
0xd8afb0635b8c0cb3b3b1a81c30c30b5a579ac96bf61775579d924b259d90e35b227487442021-12-16 20:51:25159 days 20 hrs ago 0x3ba6efd5feaf614dc8601d94884d68b229f78b470x3e848fa9556813c1c521f194515e01ba0cb5eeae41.89 MATIC
0x0b007a91d2b02884404fae7046f9850d76dba8cf088136fec6c5226e2e9578aa221791572021-12-02 20:04:50173 days 21 hrs ago 0x3ba6efd5feaf614dc8601d94884d68b229f78b470x3e848fa9556813c1c521f194515e01ba0cb5eeae36.36 MATIC
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
BuddyCore

Compiler Version
v0.8.10+commit.fc410830

Optimization Enabled:
Yes with 333 runs

Other Settings:
default evmVersion
File 1 of 25 : BuddyCore.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;

// |  \/  (_)              |  _ \          | |   | (_)
// | \  / |_  ___ _ __ ___ | |_) |_   _  __| | __| |_  ___  ___ ™
// | |\/| | |/ __| '__/ _ \|  _ <| | | |/ _` |/ _` | |/ _ \/ __|
// | |  | | | (__| | | (_) | |_) | |_| | (_| | (_| | |  __/\__ \
// |_|  |_|_|\___|_|  \___/|____/ \__,_|\__,_|\__,_|_|\___||___/ 2021

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";

import "./ERC721Full.sol";
import "./libraries/BuddyLib.sol";
import "./interfaces/IBuddyCore.sol";
import "./interfaces/IGoo.sol";
import "./interfaces/IBuddyLogic.sol";
import "./interfaces/IBuddyRandomness.sol";

contract BuddyCore is IBuddyCore, ERC721Full, ERC721Holder {
    IGoo public _goo;
    IBuddyLogic public _buddyLogic;
    IBuddyRandomness public _buddyRandomness;

    uint256 public gen0 = 0;
    uint256 private constant blackHole = 1;

    /*** EVENTS ***/
    event Birth(
        uint256 indexed tokenId,
        address indexed owner,
        uint256 indexed dna
    );
    event Death(
        uint256 indexed tokenId,
        address indexed owner,
        uint256 dna,
        uint256 indexed value
    );
    event Claim(
        uint256 indexed tokenId,
        address indexed owner,
        uint256 indexed value
    );

    constructor(
        address _gooAddr,
        address _buddyLogicAddr,
        address _buddyRandomnessAddr
    ) {
        _goo = IGoo(_gooAddr);
        _buddyLogic = IBuddyLogic(_buddyLogicAddr);
        _buddyRandomness = IBuddyRandomness(_buddyRandomnessAddr);
    }

    modifier onlyHolder(uint256 _tokenId) {
        require(msg.sender == ownerOf(_tokenId), "Unauthorized");
        _;
    }

    modifier whenNotLocked(uint256 _tokenId) {
        uint8 lock = isLocked(_tokenId);
        require(lock == 2, lock == 0 ? "Buddy locked" : "Unlocking");
        _;
    }

    modifier hasRandomness(uint256 _tokenId) {
        require(
            _buddyRandomness.getRandomResult(_tokenId) > 0,
            "No randomness"
        );
        _;
    }

    modifier hasPayment() {
        require(msg.value == _buddyLogic.getPayment(), "Need to send payment");
        _;
    }

    function setGooContract(address _gooContractAddr) external onlyOwner {
        _goo = IGoo(_gooContractAddr);
    }

    function setLogicContract(address _logicContractAddr) external onlyOwner {
        _buddyLogic = IBuddyLogic(_logicContractAddr);
        _buddyRandomness.setBuddyLogicAddr(_logicContractAddr);
    }

    function setRandomnessContract(address _randomnessContractAddr)
        external
        onlyOwner
    {
        _buddyRandomness = IBuddyRandomness(_randomnessContractAddr);
    }

    function getBlackHole() external pure override returns (uint256) {
        return blackHole;
    }

    function getApproval(uint256 tokenId)
        public
        view
        override
        returns (address)
    {
        return super.getApproved(tokenId);
    }

    function getOwnerOf(uint256 tokenId)
        public
        view
        override
        returns (address)
    {
        return super.ownerOf(tokenId);
    }

    function getBuddy(uint256 _tokenId)
        public
        view
        returns (
            uint8,
            uint8,
            uint8,
            uint8,
            uint24,
            uint256,
            uint256,
            uint256,
            uint256,
            uint256,
            uint256
        )
    {
        BuddyLib.Buddy storage base = _data[_tokenId];

        return (
            base.species,
            base.repMax,
            base.repCur,
            base.special,
            base.gen,
            base.dna,
            base.birth,
            base.totalProduced,
            base.lastRewardTime,
            base.parent,
            base.lock
        );
    }

    function generateBlackHole(address addr) external onlyOwner {
        BuddyLib.Buddy memory bh = BuddyLib.generate(0);
        bh.special = 1;
        uint256 tokenId = safeMint(addr);
        _data[tokenId] = bh;
        emit Birth(tokenId, addr, bh.dna);
    }

    // TODO: Remove this at launch time
    function mint(uint256 buddy, uint256 amount) external onlyOwner {
        _goo.mint(buddy, amount);
    }

    function createGen0(address receiver, uint256 amount) external onlyOwner {
        require(gen0 + amount <= 2500, "Max Gen0");

        for (uint256 i = 0; i < amount; i++) {
            uint256 tokenId = safeMint(receiver);
            _buddyRandomness.generateRandom(tokenId);
        }

        gen0 += amount;
    }

    function buyGen0(uint256 _tokenId)
        external
        payable
        hasPayment
        onlyHolder(_tokenId)
        hasRandomness(_tokenId)
        whenNotPaused
    {
        require(_data[_tokenId].birth == 0, "Buddy exists");
        uint256 dna = _buddyLogic.createGen0(_tokenId);

        BuddyLib.Buddy memory base = BuddyLib.generate(dna);

        if (_tokenId <= 11) {
            base.special = 2;
        }

        _data[_tokenId] = base;
        _goo.mint(_tokenId, _buddyLogic.getStartingGoo() * 1e18);
        emit Birth(_tokenId, msg.sender, base.dna);
    }

    function _isApprovedOrOwner(uint256 buddy) private view returns (bool) {
        return
            getApproval(buddy) == msg.sender || getOwnerOf(buddy) == msg.sender;
    }

    function replicate(
        uint256 _tokenId,
        int8[6] calldata dominantLock,
        int8[24] calldata recessiveSwap,
        uint256[] calldata buddies
    )
        external
        payable
        hasPayment
        onlyHolder(_tokenId)
        whenNotLocked(_tokenId)
        hasRandomness(_tokenId)
        whenNotPaused
    {
        uint256 cost = replicatePreview(_tokenId, dominantLock, recessiveSwap);
        uint256 gooBalance = _goo.balanceOf(_tokenId);

        for (uint256 i = 0; i < buddies.length; i++) {
            if (buddies[i] == _tokenId) {
                continue;
            }

            require(
                _isApprovedOrOwner(buddies[i]),
                "Not approved to spend GOO"
            );
            gooBalance += _goo.balanceOf(buddies[i]);

            if (gooBalance >= cost) {
                break;
            }
        }

        require(gooBalance >= cost, "Not enough GOO");
        uint256 gooAllowance = _goo.allowance(_tokenId, blackHole);
        require(gooAllowance >= cost, "Not enough allowance");

        uint256 newCost = cost;

        if (buddies.length > 0) {
            uint256 ogBalance = _goo.balanceOf(_tokenId);

            if (ogBalance < newCost) {
                newCost -= ogBalance;

                for (uint256 i = 0; i < buddies.length; i++) {
                    if (buddies[i] == _tokenId) {
                        continue;
                    }

                    uint256 id = buddies[i];
                    uint256 balance = _goo.balanceOf(id);

                    if (balance < newCost) {
                        _goo.transferFrom(blackHole, id, blackHole, balance);
                        newCost -= balance;
                    } else {
                        _goo.transferFrom(blackHole, id, blackHole, newCost);
                        newCost = 0;
                        break;
                    }
                }

                newCost += ogBalance;
            }
        }

        repBuddy(_tokenId, dominantLock, recessiveSwap, cost, newCost);
    }

    function repBuddy(
        uint256 _tokenId,
        int8[6] memory dominantLock,
        int8[24] memory recessiveSwap,
        uint256 cost,
        uint256 newCost
    ) private {
        _goo.transferFrom(blackHole, _tokenId, blackHole, newCost);
        _goo.burn(blackHole, (cost * _buddyLogic.getBurnPercent()) / 100);

        BuddyLib.Buddy storage base = _data[_tokenId];
        base.repCur += 1;

        uint256 dna;

        if (dominantLock.length > 0) {
            dna = _buddyLogic.repBuddy(
                _tokenId,
                base,
                dominantLock,
                recessiveSwap
            );
        } else {
            dna = _buddyLogic.simpleRepBuddy(_tokenId, base);
        }

        _buddyRandomness.generateRandom(_tokenId);

        BuddyLib.Buddy memory child = BuddyLib.generate(dna);
        child.parent = _tokenId;
        child.repMax = _buddyLogic.calcReps(_tokenId, child.gen);
        child.dna = dna;

        uint256 tokenId = safeMint(msg.sender);
        _buddyRandomness.generateRandom(tokenId);
        _data[tokenId] = child;

        emit Birth(tokenId, msg.sender, child.dna);
    }

    function replicatePreview(
        uint256 _tokenId,
        int8[6] calldata dominantLock,
        int8[24] calldata recessiveSwap
    ) public view returns (uint256) {
        BuddyLib.Buddy storage base = _data[_tokenId];
        return _buddyLogic.replicatePreview(dominantLock, recessiveSwap, base);
    }

    function simpleReplicate(uint256 _tokenId)
        external
        payable
        hasPayment
        onlyHolder(_tokenId)
        whenNotLocked(_tokenId)
        whenNotPaused
    {
        uint256 cost = simpleReplicatePreview(_tokenId);

        uint256 gooBalance = _goo.balanceOf(_tokenId);
        require(gooBalance >= cost, "Not enough GOO");
        uint256 gooAllowance = _goo.allowance(_tokenId, blackHole);
        require(gooAllowance >= cost, "Not enough allowance");

        int8[6] memory dominantLock;
        int8[24] memory recessiveSwap;

        repBuddy(_tokenId, dominantLock, recessiveSwap, cost, cost);
    }

    function simpleReplicatePreview(uint256 _tokenId)
        public
        view
        returns (uint256)
    {
        BuddyLib.Buddy storage base = _data[_tokenId];
        return _buddyLogic.simpleReplicatePreview(base);
    }

    function calcGGPD(
        uint256 _tokenId,
        bool fertility,
        bool recessiveBonus
    ) public view returns (uint256) {
        BuddyLib.Buddy storage base = _data[_tokenId];
        return _buddyLogic.calcGGPD(base, fertility, recessiveBonus);
    }

    function getMaxBalance(uint256 _tokenId)
        public
        view
        override
        returns (uint256)
    {
        BuddyLib.Buddy storage base = _data[_tokenId];
        uint256 ggpd = (_buddyLogic.calcGGPD(base, false, false)) *
            (base.special == 0 ? 90 : 1);
        return ggpd * 1e18;
    }

    function calcPeg() external view returns (uint256) {
        return _buddyLogic.calcPeg();
    }

    function claim(uint256 _tokenId)
        public
        onlyHolder(_tokenId)
        whenNotLocked(_tokenId)
        whenNotPaused
        returns (uint256 total)
    {
        BuddyLib.Buddy storage base = _data[_tokenId];
        require(base.special == 0, "Specials do not make GOO");
        require(
            block.timestamp - base.lastRewardTime > 5 minutes,
            "Claim cooldown"
        );

        total = calcClaim(_tokenId);

        base.lastRewardTime = block.timestamp;
        base.totalProduced += total;

        _goo.mint(_tokenId, total);
        emit Claim(_tokenId, msg.sender, total);
    }

    function calcClaim(uint256 _tokenId) public view returns (uint256) {
        BuddyLib.Buddy storage base = _data[_tokenId];
        return _buddyLogic.calcClaim(base);
    }

    function getTokensByOwner() public view returns (uint256[] memory tokens) {
        uint256 tokenCount = balanceOf(msg.sender);
        if (tokenCount == 0) {
            return new uint256[](0);
        } else {
            uint256[] memory result = new uint256[](tokenCount);
            for (uint256 i = 0; i < tokenCount; i++) {
                uint256 tokenId = tokenOfOwnerByIndex(msg.sender, i);
                result[i] = tokenId;
            }
            return result;
        }
    }

    function getBalanceByOwner() external view returns (uint256 balance) {
        uint256[] memory tokens = getTokensByOwner();

        for (uint256 i = 0; i < tokens.length; i++) {
            balance += _goo.balanceOf(tokens[i]);
        }
    }

    function claimAll(uint256[] calldata tokens)
        external
        whenNotPaused
        returns (uint256 total)
    {
        for (uint256 i = 0; i < tokens.length; i++) {
            total += claim(tokens[i]);
        }
    }

    function calcApop(uint256 _tokenId) public view returns (uint256) {
        BuddyLib.Buddy storage base = _data[_tokenId];
        return _buddyLogic.calcApop(base.totalProduced);
    }

    /// @dev Call to destroy a buddy in exchange for % of total produced Goo.
    function apoptosis(uint256 _tokenId, uint256[] calldata receivers)
        public
        onlyHolder(_tokenId)
        whenNotLocked(_tokenId)
        whenNotPaused
    {
        BuddyLib.Buddy storage base = _data[_tokenId];
        require(base.special == 0, "Specials cannot Apop");

        uint256 amount = calcApop(_tokenId);
        uint256 gooBalance = _goo.balanceOf(_tokenId);

        if (gooBalance > 0) {
            _goo.transferFrom(blackHole, _tokenId, blackHole, gooBalance);
            _goo.burn(blackHole, gooBalance);
        }

        transferFrom(
            msg.sender,
            address(0x000000000000000000000000000000000000dEaD),
            _tokenId
        );

        for (uint256 i = 0; i < receivers.length; i++) {
            if (receivers[i] == _tokenId) {
                continue;
            }

            uint256 receiver = receivers[i];
            uint256 rMax = getMaxBalance(receiver);

            if (amount > rMax) {
                _goo.mint(receiver, rMax);
                amount -= rMax;
            } else {
                _goo.mint(receiver, amount);
                break;
            }
        }

        emit Death(_tokenId, msg.sender, base.dna, amount);
    }

    function massApoptosis(
        uint256[] calldata buddies,
        uint256[] calldata receivers
    ) external whenNotPaused {
        for (uint256 i = 0; i < buddies.length; i++) {
            apoptosis(buddies[i], receivers);
        }
    }

    function toggleLock(uint256 _tokenId)
        external
        onlyHolder(_tokenId)
        whenNotPaused
    {
        BuddyLib.Buddy storage base = _data[_tokenId];

        if (base.lock == 0) {
            base.lock = block.timestamp;
        } else {
            base.lock = 0;
        }
    }

    function isLocked(uint256 _tokenId) public view override returns (uint8) {
        BuddyLib.Buddy storage base = _data[_tokenId];

        if (base.lock == 0) {
            return 0;
        } else if (block.timestamp - base.lock < 5 minutes) {
            return 1;
        }

        return 2;
    }

    function calcFounderClaim(uint256 _tokenId) public view returns (uint256) {
        BuddyLib.Buddy storage base = _data[_tokenId];
        return _buddyLogic.calcFounderClaim(base);
    }

    function founderClaim(uint256 _tokenId)
        public
        onlyHolder(_tokenId)
        whenNotLocked(_tokenId)
        whenNotPaused
    {
        BuddyLib.Buddy storage base = _data[_tokenId];

        uint256 claimAmount = _buddyLogic.founderClaim(base);
        base.lastRewardTime = block.timestamp;
        _goo.transfer(blackHole, _tokenId, claimAmount);
    }

    // Clears all pre-existing GOO approvals to avoid GOO rugs post-transfer
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal override {
        super._beforeTokenTransfer(from, to, tokenId);
        _goo.clearApprovals(tokenId);
    }

    function withdrawMatic() external onlyOwner {
        uint256 balance = address(this).balance;
        require(balance > 0, "No Matic available");
        payable(msg.sender).transfer(balance);
    }
}

File 2 of 25 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

File 3 of 25 : ERC721Holder.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC721Receiver.sol";

/**
 * @dev Implementation of the {IERC721Receiver} interface.
 *
 * Accepts all token transfers.
 * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}.
 */
contract ERC721Holder is IERC721Receiver {
    /**
     * @dev See {IERC721Receiver-onERC721Received}.
     *
     * Always returns `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address,
        address,
        uint256,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC721Received.selector;
    }
}

File 4 of 25 : ERC721Full.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;

// |  \/  (_)              |  _ \          | |   | (_)
// | \  / |_  ___ _ __ ___ | |_) |_   _  __| | __| |_  ___  ___ ™
// | |\/| | |/ __| '__/ _ \|  _ <| | | |/ _` |/ _` | |/ _ \/ __|
// | |  | | | (__| | | (_) | |_) | |_| | (_| | (_| | |  __/\__ \
// |_|  |_|_|\___|_|  \___/|____/ \__,_|\__,_|\__,_|_|\___||___/ 2021

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 "./libraries/BuddyLib.sol";

import "./interfaces/IMutations.sol";

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

    Counters.Counter private _tokenIdCounter;
    uint256 private _nonce;

    /// @dev A mapping to store all buddies.
    // Buddy[] _data;
    mapping(uint256 => BuddyLib.Buddy) internal _data;

    constructor() ERC721("MicroBuddies", "MBDY") {}

    function safeMint(address to) internal returns (uint256 tokenId) {
        uint256 current = getTokenId();
        _safeMint(to, current);
        _setTokenURI(
            current,
            string(abi.encodePacked(Strings.toString(current), ".json"))
        );
        _tokenIdCounter.increment();
        return current;
    }

    function getTokenId() internal view returns (uint256 tokenId) {
        return _tokenIdCounter.current();
    }

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

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

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

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

    function _burn(uint256 tokenId)
        internal
        override(ERC721, ERC721URIStorage)
    {
        super._burn(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);
    }

    /**
     * Override isApprovedForAll to auto-approve OS's proxy contract
     */
    function isApprovedForAll(address _owner, address _operator)
        public
        view
        override
        returns (bool isOperator)
    {
        // if OpenSea's ERC721 Proxy Address is detected, auto-return true
        if (_operator == address(0x58807baD0B376efc12F5AD86aAc70E78ed67deaE)) {
            return true;
        }

        // otherwise, use the default ERC721.isApprovedForAll()
        return ERC721.isApprovedForAll(_owner, _operator);
    }
}

File 5 of 25 : BuddyLib.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;

// |  \/  (_)              |  _ \          | |   | (_)
// | \  / |_  ___ _ __ ___ | |_) |_   _  __| | __| |_  ___  ___ ™
// | |\/| | |/ __| '__/ _ \|  _ <| | | |/ _` |/ _` | |/ _ \/ __|
// | |  | | | (__| | | (_) | |_) | |_| | (_| | (_| | |  __/\__ \
// |_|  |_|_|\___|_|  \___/|____/ \__,_|\__,_|\__,_|_|\___||___/ 2021

library BuddyLib {
    //Specials
    // 0 = None
    // 1 = Blackhole
    // 2 = Founder
    struct Buddy {
        uint8 species;
        uint8[30] traits;
        uint8 gen;
        uint8 repMax;
        uint8 repCur;
        uint8 special;
        uint256 dna;
        uint256 birth;
        uint256 totalProduced;
        uint256 lastRewardTime;
        uint256 parent;
        uint256 lock;
    }

    function generate(uint256 dna) external view returns (Buddy memory base) {
        uint8[] memory unpack = decode(dna);
        base.species = unpack[0];

        for (uint8 i = 1; i < 31; i++) {
            base.traits[i - 1] = unpack[i];
        }

        base.birth = block.timestamp;
        base.totalProduced = 0;
        base.lastRewardTime = block.timestamp;
        base.dna = dna;
        base.gen = unpack[31];
        base.repMax = 5;
        base.repCur = 0;
        base.lock = block.timestamp - 420;

        return base;
    }

    function decode(uint256 dna) public pure returns (uint8[] memory) {
        uint8[] memory traits = new uint8[](32);
        uint256 i;
        for (i = 0; i < 32; i++) {
            traits[i] = uint8(sliceNumber(dna, 8, i * 8));
        }
        return traits;
    }

    /// @dev given a number get a slice of any bits, at certain offset
    /// @param _n a number to be sliced
    /// @param _nbits how many bits long is the new number
    /// @param _offset how many bits to skip
    function sliceNumber(
        uint256 _n,
        uint256 _nbits,
        uint256 _offset
    ) public pure returns (uint256) {
        // mask is made by shifting left an offset number of times
        uint256 mask = (pow(2, _nbits) - 1) << _offset;
        // AND n with mask, and trim to max of _nbits bits
        return uint256((_n & mask) >> _offset);
    }

    function pow(uint256 A, uint256 B) public pure returns (uint256) {
        return A**B;
    }

    function encode(uint8[] memory traits) external pure returns (uint256 dna) {
        dna = 0;
        for (uint256 i = 0; i < 32; i++) {
            dna = dna << 8;
            // bitwise OR trait with _genes
            dna = dna | traits[31 - i];
        }
    }
}

File 6 of 25 : IBuddyCore.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;

interface IBuddyCore {
    function getApproval(uint256) external view returns (address);

    function getOwnerOf(uint256) external view returns (address);

    function getBlackHole() external pure returns (uint256);

    function getMaxBalance(uint256) external view returns (uint256);

    function isLocked(uint256) external view returns (uint8);
}

File 7 of 25 : IGoo.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;

interface IGoo {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    function balanceOf(uint256 buddy) external view returns (uint256);

    function mint(uint256 buddy, uint256 amount) external;

    function burn(uint256 buddy, uint256 amount) external;

    function allowance(uint256 buddy, uint256 spender)
        external
        view
        returns (uint256);

    function transfer(
        uint256 from,
        uint256 to,
        uint256 amount
    ) external returns (bool);

    function transferFrom(
        uint256 executor,
        uint256 from,
        uint256 to,
        uint256 amount
    ) external returns (bool);

    function clearApprovals(uint256 from) external;
}

File 8 of 25 : IBuddyLogic.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;

import "../libraries/BuddyLib.sol";

interface IBuddyLogic {
    function getMaxGen() external pure returns (uint8);

    function calcFounderClaim(BuddyLib.Buddy calldata)
        external
        view
        returns (uint256);

    function founderClaim(BuddyLib.Buddy calldata) external returns (uint256);

    function createGen0(uint256) external returns (uint256);

    function calcClaim(BuddyLib.Buddy calldata) external view returns (uint256);

    function calcGGPD(
        BuddyLib.Buddy calldata,
        bool,
        bool
    ) external view returns (uint256);

    function calcApop(uint256) external view returns (uint256);

    function replicatePreview(
        int8[6] calldata,
        int8[24] calldata,
        BuddyLib.Buddy calldata
    ) external view returns (uint256);

    function repBuddy(
        uint256,
        BuddyLib.Buddy calldata,
        int8[6] calldata,
        int8[24] calldata
    ) external returns (uint256);

    function simpleReplicatePreview(BuddyLib.Buddy calldata)
        external
        view
        returns (uint256);

    function simpleRepBuddy(uint256, BuddyLib.Buddy calldata)
        external
        returns (uint256);

    function calcReps(uint256, uint8) external returns (uint8);

    function calcPeg() external view returns (uint256);

    function getBurnPercent() external view returns (uint256);

    function getPayment() external view returns (uint256);

    function getStartingGoo() external view returns (uint256);
}

File 9 of 25 : IBuddyRandomness.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;

interface IBuddyRandomness {
    function setBuddySynthesizerAddr(address) external;

    function setBuddyLogicAddr(address) external;

    function generateRandom(uint256) external;

    function getRandomResult(uint256) external view returns (uint256);

    function rng(uint256, uint256) external returns (uint256);
}

File 10 of 25 : 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 11 of 25 : 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 12 of 25 : 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 13 of 25 : 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 14 of 25 : 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 15 of 25 : 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 16 of 25 : 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 17 of 25 : IMutations.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;

import "../libraries/BuddyLib.sol";

interface IMutations {
    function getMutation(
        uint8 species,
        uint8 trait,
        uint8 r1,
        uint8 r2,
        uint8 r3,
        uint8 r4,
        uint8 traitType
    ) external view returns (uint8);

    function getRarity(uint8 species, uint256 index)
        external
        view
        returns (uint256);
}

File 18 of 25 : 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 19 of 25 : 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 20 of 25 : 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 21 of 25 : 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 22 of 25 : 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 23 of 25 : 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 24 of 25 : 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 25 of 25 : 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": 333
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  },
  "libraries": {
    "contracts/libraries/BuddyLib.sol": {
      "BuddyLib": "0xfc7528e440ee7ea4919603c009901abe04b3c911"
    }
  }
}

Contract ABI

[{"inputs":[{"internalType":"address","name":"_gooAddr","type":"address"},{"internalType":"address","name":"_buddyLogicAddr","type":"address"},{"internalType":"address","name":"_buddyRandomnessAddr","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"dna","type":"uint256"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Claim","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":"dna","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Death","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"_buddyLogic","outputs":[{"internalType":"contract IBuddyLogic","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_buddyRandomness","outputs":[{"internalType":"contract IBuddyRandomness","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_goo","outputs":[{"internalType":"contract IGoo","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256[]","name":"receivers","type":"uint256[]"}],"name":"apoptosis","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"buyGen0","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"calcApop","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"calcClaim","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"calcFounderClaim","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bool","name":"fertility","type":"bool"},{"internalType":"bool","name":"recessiveBonus","type":"bool"}],"name":"calcGGPD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"calcPeg","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"claim","outputs":[{"internalType":"uint256","name":"total","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokens","type":"uint256[]"}],"name":"claimAll","outputs":[{"internalType":"uint256","name":"total","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"createGen0","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"founderClaim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"gen0","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"generateBlackHole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproval","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBalanceByOwner","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBlackHole","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getBuddy","outputs":[{"internalType":"uint8","name":"","type":"uint8"},{"internalType":"uint8","name":"","type":"uint8"},{"internalType":"uint8","name":"","type":"uint8"},{"internalType":"uint8","name":"","type":"uint8"},{"internalType":"uint24","name":"","type":"uint24"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getMaxBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getOwnerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokensByOwner","outputs":[{"internalType":"uint256[]","name":"tokens","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"isOperator","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"isLocked","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"buddies","type":"uint256[]"},{"internalType":"uint256[]","name":"receivers","type":"uint256[]"}],"name":"massApoptosis","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"buddy","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"int8[6]","name":"dominantLock","type":"int8[6]"},{"internalType":"int8[24]","name":"recessiveSwap","type":"int8[24]"},{"internalType":"uint256[]","name":"buddies","type":"uint256[]"}],"name":"replicate","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"int8[6]","name":"dominantLock","type":"int8[6]"},{"internalType":"int8[24]","name":"recessiveSwap","type":"int8[24]"}],"name":"replicatePreview","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gooContractAddr","type":"address"}],"name":"setGooContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_logicContractAddr","type":"address"}],"name":"setLogicContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_randomnessContractAddr","type":"address"}],"name":"setRandomnessContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"simpleReplicate","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"simpleReplicatePreview","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"toggleLock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawMatic","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405260006012553480156200001657600080fd5b506040516200626c3803806200626c833981016040819052620000399162000217565b604080518082018252600c81526b4d6963726f4275646469657360a01b6020808301918252835180850190945260048452634d42445960e01b908401528151919291620000899160009162000154565b5080516200009f90600190602084019062000154565b5050600b805460ff1916905550620000b733620000fa565b600f80546001600160a01b039485166001600160a01b0319918216179091556010805493851693821693909317909255601180549190931691161790556200029e565b600b80546001600160a01b03838116610100818102610100600160a81b031985161790945560405193909204169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b828054620001629062000261565b90600052602060002090601f016020900481019282620001865760008555620001d1565b82601f10620001a157805160ff1916838001178555620001d1565b82800160010185558215620001d1579182015b82811115620001d1578251825591602001919060010190620001b4565b50620001df929150620001e3565b5090565b5b80821115620001df5760008155600101620001e4565b80516001600160a01b03811681146200021257600080fd5b919050565b6000806000606084860312156200022d57600080fd5b6200023884620001fa565b92506200024860208501620001fa565b91506200025860408501620001fa565b90509250925092565b600181811c908216806200027657607f821691505b602082108114156200029857634e487b7160e01b600052602260045260246000fd5b50919050565b615fbe80620002ae6000396000f3fe6080604052600436106103815760003560e01c8063776e8eee116101d1578063b88d4fde11610102578063e985e9c5116100a0578063f658518a1161006f578063f658518a14610ac1578063f6aacfb114610ae1578063fe1b70c214610b13578063fe829e8714610b3357600080fd5b8063e985e9c514610a41578063ec9c4a4314610a61578063f2fde38b14610a81578063f6453c7f14610aa157600080fd5b8063c87b56dd116100dc578063c87b56dd146109d9578063cb3a2e02146109f9578063cdb5415d14610a19578063dfe31f1e14610a2e57600080fd5b8063b88d4fde14610986578063bcc1f280146109a6578063c84c180b146109b957600080fd5b80638ad6dfdf1161016f5780639d13ac13116101495780639d13ac131461091d5780639f6c2a8d1461093d578063a22cb46514610950578063a279d6211461097057600080fd5b80638ad6dfdf146108d15780638da5cb5b146108e557806395d89b411461090857600080fd5b806383638710116101ab578063836387101461085c578063844cb9f01461087c5780638456cb591461089c57806387e1aede146108b157600080fd5b8063776e8eee14610807578063810074c6146108275780638117b67a1461083c57600080fd5b8063379607f5116102b657806355de3343116102545780636352211e116102235780636352211e146106d35780636bf69699146106f357806370a08231146107d2578063715018a6146107f257600080fd5b806355de33431461065b5780635aa4470f1461067b5780635c975abb1461069b5780635ec43498146106b357600080fd5b80634610a32a116102905780634610a32a146105d95780634d90769b146105fb5780634f6ccce71461061b578063550090c51461063b57600080fd5b8063379607f5146105845780633f4ba83a146105a457806342842e0e146105b957600080fd5b806318b8cb99116103235780632738e806116102fd5780632738e8061461050457806328c77820146105245780632f745c5914610544578063353e674a1461056457600080fd5b806318b8cb99146104af5780631b2ef1ca146104c457806323b872dd146104e457600080fd5b8063095ea7b31161035f578063095ea7b314610415578063107f938f14610437578063150b7a021461045757806318160ddd1461049057600080fd5b806301ffc9a71461038657806306fdde03146103bb578063081812fc146103dd575b600080fd5b34801561039257600080fd5b506103a66103a136600461516b565b610b53565b60405190151581526020015b60405180910390f35b3480156103c757600080fd5b506103d0610b64565b6040516103b291906151e0565b3480156103e957600080fd5b506103fd6103f83660046151f3565b610bf6565b6040516001600160a01b0390911681526020016103b2565b34801561042157600080fd5b50610435610430366004615228565b610c90565b005b34801561044357600080fd5b50610435610452366004615228565b610da6565b34801561046357600080fd5b506104776104723660046152c3565b610ee3565b6040516001600160e01b031990911681526020016103b2565b34801561049c57600080fd5b506008545b6040519081526020016103b2565b3480156104bb57600080fd5b506104a1610ef4565b3480156104d057600080fd5b506104356104df366004615383565b610fc0565b3480156104f057600080fd5b506104356104ff3660046153a5565b611077565b34801561051057600080fd5b506104a161051f3660046153ef565b6110f2565b34801561053057600080fd5b506104a161053f36600461547d565b611180565b34801561055057600080fd5b506104a161055f366004615228565b6111fc565b34801561057057600080fd5b5061043561057f3660046151f3565b611292565b34801561059057600080fd5b506104a161059f3660046151f3565b61133c565b3480156105b057600080fd5b506104356115c7565b3480156105c557600080fd5b506104356105d43660046153a5565b61161f565b3480156105e557600080fd5b506105ee61163a565b6040516103b291906154bf565b34801561060757600080fd5b50610435610616366004615503565b6116f7565b34801561062757600080fd5b506104a16106363660046151f3565b611767565b34801561064757600080fd5b5061043561065636600461551e565b6117fa565b34801561066757600080fd5b506104356106763660046151f3565b611864565b34801561068757600080fd5b50610435610696366004615503565b611a77565b3480156106a757600080fd5b50600b5460ff166103a6565b3480156106bf57600080fd5b506104a16106ce3660046151f3565b611b37565b3480156106df57600080fd5b506103fd6106ee3660046151f3565b611bb6565b3480156106ff57600080fd5b5061076d61070e3660046151f3565b6000908152600e60205260409020805460028201546003830154600484015460058501546006860154600787015460089097015460ff968716986101008704881698620100008804891698630100000089048116981696959493929091565b6040805160ff9c8d1681529a8c1660208c0152988b16988a019890985298909516606088015262ffffff909316608087015260a086019190915260c085015260e0840152610100830152610120820192909252610140810191909152610160016103b2565b3480156107de57600080fd5b506104a16107ed366004615503565b611c2d565b3480156107fe57600080fd5b50610435611cb4565b34801561081357600080fd5b506010546103fd906001600160a01b031681565b34801561083357600080fd5b50610435611d0c565b34801561084857600080fd5b50610435610857366004615503565b611dce565b34801561086857600080fd5b506103fd6108773660046151f3565b611fc3565b34801561088857600080fd5b506104a16108973660046151f3565b611fce565b3480156108a857600080fd5b50610435612097565b3480156108bd57600080fd5b506104356108cc36600461558a565b6120ed565b3480156108dd57600080fd5b5060016104a1565b3480156108f157600080fd5b50600b5461010090046001600160a01b03166103fd565b34801561091457600080fd5b506103d0612589565b34801561092957600080fd5b506104a16109383660046155f9565b612598565b61043561094b3660046151f3565b6125da565b34801561095c57600080fd5b5061043561096b366004615638565b612941565b34801561097c57600080fd5b506104a160125481565b34801561099257600080fd5b506104356109a13660046152c3565b612a06565b6104356109b436600461566f565b612a88565b3480156109c557600080fd5b506104a16109d43660046151f3565b6132d4565b3480156109e557600080fd5b506103d06109f43660046151f3565b613312565b348015610a0557600080fd5b50610435610a14366004615503565b61331d565b348015610a2557600080fd5b506104a161338d565b610435610a3c3660046151f3565b613400565b348015610a4d57600080fd5b506103a6610a5c3660046156e2565b613927565b348015610a6d57600080fd5b50600f546103fd906001600160a01b031681565b348015610a8d57600080fd5b50610435610a9c366004615503565b613984565b348015610aad57600080fd5b506011546103fd906001600160a01b031681565b348015610acd57600080fd5b506103fd610adc3660046151f3565b613a43565b348015610aed57600080fd5b50610b01610afc3660046151f3565b613a4e565b60405160ff90911681526020016103b2565b348015610b1f57600080fd5b506104a1610b2e3660046151f3565b613a99565b348015610b3f57600080fd5b506104a1610b4e3660046151f3565b613ae0565b6000610b5e82613b1e565b92915050565b606060008054610b7390615715565b80601f0160208091040260200160405190810160405280929190818152602001828054610b9f90615715565b8015610bec5780601f10610bc157610100808354040283529160200191610bec565b820191906000526020600020905b815481529060010190602001808311610bcf57829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b0316610c745760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b6000610c9b82611bb6565b9050806001600160a01b0316836001600160a01b03161415610d095760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610c6b565b336001600160a01b0382161480610d255750610d258133613927565b610d975760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610c6b565b610da18383613b43565b505050565b600b546001600160a01b03610100909104163314610df45760405162461bcd60e51b81526020600482018190526024820152600080516020615f698339815191526044820152606401610c6b565b6109c481601254610e059190615766565b1115610e3e5760405162461bcd60e51b815260206004820152600860248201526704d61782047656e360c41b6044820152606401610c6b565b60005b81811015610ec7576000610e5484613bb1565b601154604051630a60208160e31b8152600481018390529192506001600160a01b031690635301040890602401600060405180830381600087803b158015610e9b57600080fd5b505af1158015610eaf573d6000803e3d6000fd5b50505050508080610ebf9061577e565b915050610e41565b508060126000828254610eda9190615766565b90915550505050565b630a85bd0160e11b5b949350505050565b600080610eff61163a565b905060005b8151811015610fbb57600f5482516001600160a01b0390911690639cc7f70890849084908110610f3657610f36615799565b60200260200101516040518263ffffffff1660e01b8152600401610f5c91815260200190565b602060405180830381865afa158015610f79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f9d91906157af565b610fa79084615766565b925080610fb38161577e565b915050610f04565b505090565b600b546001600160a01b0361010090910416331461100e5760405162461bcd60e51b81526020600482018190526024820152600080516020615f698339815191526044820152606401610c6b565b600f54604051630d9778e560e11b815260048101849052602481018390526001600160a01b0390911690631b2ef1ca90604401600060405180830381600087803b15801561105b57600080fd5b505af115801561106f573d6000803e3d6000fd5b505050505050565b6110813382613c07565b6110e75760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6044820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b6064820152608401610c6b565b610da1838383613cd6565b6000838152600e60205260408082206010549151631f868b5160e21b815290916001600160a01b031690637e1a2d449061113490849088908890600401615ab2565b602060405180830381865afa158015611151573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061117591906157af565b9150505b9392505050565b600061118e600b5460ff1690565b156111ab5760405162461bcd60e51b8152600401610c6b90615ad9565b60005b828110156111f5576111d78484838181106111cb576111cb615799565b9050602002013561133c565b6111e19083615766565b9150806111ed8161577e565b9150506111ae565b5092915050565b600061120783611c2d565b82106112695760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610c6b565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b8061129c81611bb6565b6001600160a01b0316336001600160a01b0316146112eb5760405162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b6044820152606401610c6b565b600b5460ff161561130e5760405162461bcd60e51b8152600401610c6b90615ad9565b6000828152600e60205260409020600881015461133057426008820155505050565b60006008820155505050565b60008161134881611bb6565b6001600160a01b0316336001600160a01b0316146113975760405162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b6044820152606401610c6b565b8260006113a382613a4e565b905060ff81166002811490156113da5760405180604001604052806009815260200168556e6c6f636b696e6760b81b815250611400565b6040518060400160405280600c81526020016b109d59191e481b1bd8dad95960a21b8152505b9061141e5760405162461bcd60e51b8152600401610c6b91906151e0565b50600b5460ff16156114425760405162461bcd60e51b8152600401610c6b90615ad9565b6000858152600e6020526040902060028101546301000000900460ff16156114ac5760405162461bcd60e51b815260206004820152601860248201527f5370656369616c7320646f206e6f74206d616b6520474f4f00000000000000006044820152606401610c6b565b61012c8160060154426114bf9190615b03565b116114fd5760405162461bcd60e51b815260206004820152600e60248201526d21b630b4b69031b7b7b63237bbb760911b6044820152606401610c6b565b61150686611b37565b9450428160060181905550848160050160008282546115259190615766565b9091555050600f54604051630d9778e560e11b815260048101889052602481018790526001600160a01b0390911690631b2ef1ca90604401600060405180830381600087803b15801561157757600080fd5b505af115801561158b573d6000803e3d6000fd5b505060405187925033915088907f3ed1528b0fdc7c5207c1bf935e34a667e13656b9ed165260c522be0bc544f30390600090a450505050919050565b600b546001600160a01b036101009091041633146116155760405162461bcd60e51b81526020600482018190526024820152600080516020615f698339815191526044820152606401610c6b565b61161d613e81565b565b610da183838360405180602001604052806000815250612a06565b6060600061164733611c2d565b90508061166257505060408051600081526020810190915290565b60008167ffffffffffffffff81111561167d5761167d615252565b6040519080825280602002602001820160405280156116a6578160200160208202803683370190505b50905060005b828110156111f55760006116c033836111fc565b9050808383815181106116d5576116d5615799565b602090810291909101015250806116eb8161577e565b9150506116ac565b5090565b600b546001600160a01b036101009091041633146117455760405162461bcd60e51b81526020600482018190526024820152600080516020615f698339815191526044820152606401610c6b565b600f80546001600160a01b0319166001600160a01b0392909216919091179055565b600061177260085490565b82106117d55760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610c6b565b600882815481106117e8576117e8615799565b90600052602060002001549050919050565b600b5460ff161561181d5760405162461bcd60e51b8152600401610c6b90615ad9565b60005b8381101561185d5761184b85858381811061183d5761183d615799565b9050602002013584846120ed565b806118558161577e565b915050611820565b5050505050565b8061186e81611bb6565b6001600160a01b0316336001600160a01b0316146118bd5760405162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b6044820152606401610c6b565b8160006118c982613a4e565b905060ff81166002811490156119005760405180604001604052806009815260200168556e6c6f636b696e6760b81b815250611926565b6040518060400160405280600c81526020016b109d59191e481b1bd8dad95960a21b8152505b906119445760405162461bcd60e51b8152600401610c6b91906151e0565b50600b5460ff16156119685760405162461bcd60e51b8152600401610c6b90615ad9565b6000848152600e60205260408082206010549151639cd5c44960e01b81529092916001600160a01b031690639cd5c449906119a7908590600401615b1a565b6020604051808303816000875af11580156119c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ea91906157af565b426006840155600f546040516390dd262760e01b81526001600482015260248101899052604481018390529192506001600160a01b0316906390dd2627906064016020604051808303816000875af1158015611a4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a6e9190615b29565b50505050505050565b600b546001600160a01b03610100909104163314611ac55760405162461bcd60e51b81526020600482018190526024820152600080516020615f698339815191526044820152606401610c6b565b601080546001600160a01b0319166001600160a01b03838116918217909255601154604051633c4feb5560e21b815260048101929092529091169063f13fad5490602401600060405180830381600087803b158015611b2357600080fd5b505af115801561185d573d6000803e3d6000fd5b6000818152600e6020526040808220601054915163a17d131760e01b815290916001600160a01b03169063a17d131790611b75908490600401615b1a565b602060405180830381865afa158015611b92573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061117991906157af565b6000818152600260205260408120546001600160a01b031680610b5e5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610c6b565b60006001600160a01b038216611c985760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610c6b565b506001600160a01b031660009081526003602052604090205490565b600b546001600160a01b03610100909104163314611d025760405162461bcd60e51b81526020600482018190526024820152600080516020615f698339815191526044820152606401610c6b565b61161d6000613f1d565b600b546001600160a01b03610100909104163314611d5a5760405162461bcd60e51b81526020600482018190526024820152600080516020615f698339815191526044820152606401610c6b565b4780611d9d5760405162461bcd60e51b81526020600482015260126024820152714e6f204d6174696320617661696c61626c6560701b6044820152606401610c6b565b604051339082156108fc029083906000818181858888f19350505050158015611dca573d6000803e3d6000fd5b5050565b600b546001600160a01b03610100909104163314611e1c5760405162461bcd60e51b81526020600482018190526024820152600080516020615f698339815191526044820152606401610c6b565b604051634a7dd52360e01b81526000600482018190529073fc7528e440ee7ea4919603c009901abe04b3c91190634a7dd5239060240161052060405180830381865af4158015611e70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e949190615bcc565b600160a082015290506000611ea883613bb1565b6000818152600e602090815260409091208451815460ff191660ff909116178155908401519192508391611ee2906001830190601e615000565b506040828101516002830180546060860151608087015160a088015160ff95861661ffff199094169390931761010092861683021763ffff00001916620100009186169190910263ff0000001916176301000000949092169390930217905560c080850151600385015560e0850151600485015590840151600584015561012084015160068401556101408401516007840155610160909301516008909201919091559083015190516001600160a01b0385169083907fdec4c55cfb28350d52de9c956e1e0418e3c15f99b92c58f3bda111a0e646c70590600090a4505050565b6000610b5e82611bb6565b6000818152600e60205260408120600281015482906301000000900460ff1615611ff9576001611ffc565b605a5b601054604051631f868b5160e21b815260ff92909216916001600160a01b0390911690637e1a2d44906120389086906000908190600401615ab2565b602060405180830381865afa158015612055573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061207991906157af565b6120839190615c99565b9050610eec81670de0b6b3a7640000615c99565b600b546001600160a01b036101009091041633146120e55760405162461bcd60e51b81526020600482018190526024820152600080516020615f698339815191526044820152606401610c6b565b61161d613f84565b826120f781611bb6565b6001600160a01b0316336001600160a01b0316146121465760405162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b6044820152606401610c6b565b83600061215282613a4e565b905060ff81166002811490156121895760405180604001604052806009815260200168556e6c6f636b696e6760b81b8152506121af565b6040518060400160405280600c81526020016b109d59191e481b1bd8dad95960a21b8152505b906121cd5760405162461bcd60e51b8152600401610c6b91906151e0565b50600b5460ff16156121f15760405162461bcd60e51b8152600401610c6b90615ad9565b6000868152600e6020526040902060028101546301000000900460ff161561225b5760405162461bcd60e51b815260206004820152601460248201527f5370656369616c732063616e6e6f742041706f700000000000000000000000006044820152606401610c6b565b600061226688613a99565b600f54604051631398fee160e31b8152600481018b90529192506000916001600160a01b0390911690639cc7f70890602401602060405180830381865afa1580156122b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122d991906157af565b905080156123cc57600f54604051638856f77960e01b8152600160048201819052602482018c90526044820152606481018390526001600160a01b0390911690638856f779906084016020604051808303816000875af1158015612341573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123659190615b29565b50600f5460405163b390c0ab60e01b815260016004820152602481018390526001600160a01b039091169063b390c0ab90604401600060405180830381600087803b1580156123b357600080fd5b505af11580156123c7573d6000803e3d6000fd5b505050505b6123d93361dead8b611077565b60005b8781101561253457898989838181106123f7576123f7615799565b90506020020135141561240957612522565b600089898381811061241d5761241d615799565b905060200201359050600061243182611fce565b9050808511156124b357600f54604051630d9778e560e11b815260048101849052602481018390526001600160a01b0390911690631b2ef1ca90604401600060405180830381600087803b15801561248857600080fd5b505af115801561249c573d6000803e3d6000fd5b5050505080856124ac9190615b03565b945061251f565b600f54604051630d9778e560e11b815260048101849052602481018790526001600160a01b0390911690631b2ef1ca90604401600060405180830381600087803b15801561250057600080fd5b505af1158015612514573d6000803e3d6000fd5b505050505050612534565b50505b8061252c8161577e565b9150506123dc565b5081336001600160a01b03168a7f475be312c16ac0b846154202e907015afb3111283f117575aace31f6ba31f5e0866003015460405161257691815260200190565b60405180910390a4505050505050505050565b606060018054610b7390615715565b6000838152600e602052604080822060105491516303c4ab2b60e31b815290916001600160a01b031690631e2559589061113490879087908690600401615cca565b601060009054906101000a90046001600160a01b03166001600160a01b031663bb328a7d6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561262d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061265191906157af565b34146126965760405162461bcd60e51b815260206004820152601460248201527313995959081d1bc81cd95b99081c185e5b595b9d60621b6044820152606401610c6b565b806126a081611bb6565b6001600160a01b0316336001600160a01b0316146126ef5760405162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b6044820152606401610c6b565b8160006126fb82613a4e565b905060ff81166002811490156127325760405180604001604052806009815260200168556e6c6f636b696e6760b81b815250612758565b6040518060400160405280600c81526020016b109d59191e481b1bd8dad95960a21b8152505b906127765760405162461bcd60e51b8152600401610c6b91906151e0565b50600b5460ff161561279a5760405162461bcd60e51b8152600401610c6b90615ad9565b60006127a5856132d4565b600f54604051631398fee160e31b8152600481018890529192506000916001600160a01b0390911690639cc7f70890602401602060405180830381865afa1580156127f4573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061281891906157af565b90508181101561285b5760405162461bcd60e51b815260206004820152600e60248201526d4e6f7420656e6f75676820474f4f60901b6044820152606401610c6b565b600f546040516319942df560e31b815260048101889052600160248201526000916001600160a01b03169063cca16fa890604401602060405180830381865afa1580156128ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128d091906157af565b9050828110156129195760405162461bcd60e51b81526020600482015260146024820152734e6f7420656e6f75676820616c6c6f77616e636560601b6044820152606401610c6b565b61292161508f565b6129296150ad565b6129368983838889613fdc565b505050505050505050565b6001600160a01b03821633141561299a5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610c6b565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b612a103383613c07565b612a765760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6044820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b6064820152608401610c6b565b612a8284848484614583565b50505050565b601060009054906101000a90046001600160a01b03166001600160a01b031663bb328a7d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612adb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612aff91906157af565b3414612b445760405162461bcd60e51b815260206004820152601460248201527313995959081d1bc81cd95b99081c185e5b595b9d60621b6044820152606401610c6b565b84612b4e81611bb6565b6001600160a01b0316336001600160a01b031614612b9d5760405162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b6044820152606401610c6b565b856000612ba982613a4e565b905060ff8116600281149015612be05760405180604001604052806009815260200168556e6c6f636b696e6760b81b815250612c06565b6040518060400160405280600c81526020016b109d59191e481b1bd8dad95960a21b8152505b90612c245760405162461bcd60e51b8152600401610c6b91906151e0565b5060115460405163aea2035f60e01b8152600481018a905289916000916001600160a01b039091169063aea2035f90602401602060405180830381865afa158015612c73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c9791906157af565b11612cd45760405162461bcd60e51b815260206004820152600d60248201526c4e6f2072616e646f6d6e65737360981b6044820152606401610c6b565b600b5460ff1615612cf75760405162461bcd60e51b8152600401610c6b90615ad9565b6000612d048a8a8a612598565b600f54604051631398fee160e31b8152600481018d90529192506000916001600160a01b0390911690639cc7f70890602401602060405180830381865afa158015612d53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d7791906157af565b905060005b87811015612ec9578b898983818110612d9757612d97615799565b905060200201351415612da957612eb7565b612dca898983818110612dbe57612dbe615799565b905060200201356145b6565b612e165760405162461bcd60e51b815260206004820152601960248201527f4e6f7420617070726f76656420746f207370656e6420474f4f000000000000006044820152606401610c6b565b600f546001600160a01b0316639cc7f7088a8a84818110612e3957612e39615799565b905060200201356040518263ffffffff1660e01b8152600401612e5e91815260200190565b602060405180830381865afa158015612e7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e9f91906157af565b612ea99083615766565b9150828210612eb757612ec9565b80612ec18161577e565b915050612d7c565b5081811015612f0b5760405162461bcd60e51b815260206004820152600e60248201526d4e6f7420656e6f75676820474f4f60901b6044820152606401610c6b565b600f546040516319942df560e31b8152600481018d9052600160248201526000916001600160a01b03169063cca16fa890604401602060405180830381865afa158015612f5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f8091906157af565b905082811015612fc95760405162461bcd60e51b81526020600482015260146024820152734e6f7420656e6f75676820616c6c6f77616e636560601b6044820152606401610c6b565b82881561326957600f54604051631398fee160e31b8152600481018f90526000916001600160a01b031690639cc7f70890602401602060405180830381865afa15801561301a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061303e91906157af565b905081811015613267576130528183615b03565b915060005b8a811015613259578e8c8c8381811061307257613072615799565b90506020020135141561308457613247565b60008c8c8381811061309857613098615799565b600f54604051631398fee160e31b815260209290920293909301356004820181905293506000926001600160a01b03169150639cc7f70890602401602060405180830381865afa1580156130f0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061311491906157af565b9050848110156131b457600f54604051638856f77960e01b8152600160048201819052602482018590526044820152606481018390526001600160a01b0390911690638856f779906084016020604051808303816000875af115801561317e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131a29190615b29565b506131ad8186615b03565b9450613244565b600f54604051638856f77960e01b8152600160048201819052602482018590526044820152606481018790526001600160a01b0390911690638856f779906084016020604051808303816000875af1158015613214573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132389190615b29565b50600094505050613259565b50505b806132518161577e565b915050613057565b506132648183615766565b91505b505b6132c58d8d6006806020026040519081016040528092919082600660200280828437600092019190915250506040805161030081810190925291508f906018908390839080828437600092019190915250899150869050613fdc565b50505050505050505050505050565b6000818152600e60205260408082206010549151636080abb760e01b815290916001600160a01b031690636080abb790611b75908490600401615b1a565b6060610b5e826145ec565b600b546001600160a01b0361010090910416331461336b5760405162461bcd60e51b81526020600482018190526024820152600080516020615f698339815191526044820152606401610c6b565b601180546001600160a01b0319166001600160a01b0392909216919091179055565b6010546040805163cdb5415d60e01b815290516000926001600160a01b03169163cdb5415d9160048083019260209291908290030181865afa1580156133d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133fb91906157af565b905090565b601060009054906101000a90046001600160a01b03166001600160a01b031663bb328a7d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613453573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061347791906157af565b34146134bc5760405162461bcd60e51b815260206004820152601460248201527313995959081d1bc81cd95b99081c185e5b595b9d60621b6044820152606401610c6b565b806134c681611bb6565b6001600160a01b0316336001600160a01b0316146135155760405162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b6044820152606401610c6b565b60115460405163aea2035f60e01b81526004810184905283916000916001600160a01b039091169063aea2035f90602401602060405180830381865afa158015613563573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061358791906157af565b116135c45760405162461bcd60e51b815260206004820152600d60248201526c4e6f2072616e646f6d6e65737360981b6044820152606401610c6b565b600b5460ff16156135e75760405162461bcd60e51b8152600401610c6b90615ad9565b6000838152600e6020526040902060040154156136355760405162461bcd60e51b815260206004820152600c60248201526b42756464792065786973747360a01b6044820152606401610c6b565b601054604051631a9caab960e01b8152600481018590526000916001600160a01b031690631a9caab9906024016020604051808303816000875af1158015613681573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136a591906157af565b604051634a7dd52360e01b81526004810182905290915060009073fc7528e440ee7ea4919603c009901abe04b3c91190634a7dd5239060240161052060405180830381865af41580156136fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137209190615bcc565b9050600b851161373257600260a08201525b6000858152600e602090815260409091208251815460ff191660ff9091161781559082015182919061376a906001830190601e615000565b506040828101516002830180546060860151608087015160a088015160ff95861661ffff199094169390931761010092861683021763ffff00001916620100009186169190910263ff0000001916176301000000949092169390930217905560c0840151600384015560e08401516004808501919091559084015160058401556101208401516006840155610140840151600784015561016090930151600890920191909155600f54601054825163f13060e960e01b815292516001600160a01b0392831694631b2ef1ca948b949093169263f13060e992818301926020928290030181865afa158015613862573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061388691906157af565b61389890670de0b6b3a7640000615c99565b6040516001600160e01b031960e085901b16815260048101929092526024820152604401600060405180830381600087803b1580156138d657600080fd5b505af11580156138ea573d6000803e3d6000fd5b5050505060c0810151604051339087907fdec4c55cfb28350d52de9c956e1e0418e3c15f99b92c58f3bda111a0e646c70590600090a45050505050565b60006001600160a01b0382167358807bad0b376efc12f5ad86aac70e78ed67deae141561395657506001610b5e565b6001600160a01b0380841660009081526005602090815260408083209386168352929052205460ff16611179565b600b546001600160a01b036101009091041633146139d25760405162461bcd60e51b81526020600482018190526024820152600080516020615f698339815191526044820152606401610c6b565b6001600160a01b038116613a375760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610c6b565b613a4081613f1d565b50565b6000610b5e82610bf6565b6000818152600e602052604081206008810154613a6e5750600092915050565b61012c816008015442613a819190615b03565b1015613a905750600192915050565b50600292915050565b6000818152600e602052604080822060105460058201549251637f0db86160e11b815291926001600160a01b039091169163fe1b70c291611b759160040190815260200190565b6000818152600e60205260408082206010549151630d9b3cef60e11b815290916001600160a01b031690631b3679de90611b75908490600401615b1a565b60006001600160e01b0319821663780e9d6360e01b1480610b5e5750610b5e82614790565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190613b7882611bb6565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600080613bbc6147e0565b9050613bc883826147eb565b613bf981613bd583614805565b604051602001613be59190615d44565b604051602081830303815290604052614903565b610b5e600c80546001019055565b6000818152600260205260408120546001600160a01b0316613c805760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610c6b565b6000613c8b83611bb6565b9050806001600160a01b0316846001600160a01b03161480613cc65750836001600160a01b0316613cbb84610bf6565b6001600160a01b0316145b80610eec5750610eec8185613927565b826001600160a01b0316613ce982611bb6565b6001600160a01b031614613d515760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610c6b565b6001600160a01b038216613db35760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610c6b565b613dbe83838361499d565b613dc9600082613b43565b6001600160a01b0383166000908152600360205260408120805460019290613df2908490615b03565b90915550506001600160a01b0382166000908152600360205260408120805460019290613e20908490615766565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600b5460ff16613ed35760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610c6b565b600b805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600b80546001600160a01b0383811661010081810274ffffffffffffffffffffffffffffffffffffffff001985161790945560405193909204169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600b5460ff1615613fa75760405162461bcd60e51b8152600401610c6b90615ad9565b600b805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258613f003390565b600f54604051638856f77960e01b8152600160048201819052602482018890526044820152606481018390526001600160a01b0390911690638856f779906084016020604051808303816000875af115801561403c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906140609190615b29565b50600f546010546040805163096cf85d60e01b815290516001600160a01b039384169363b390c0ab93600193606493919092169163096cf85d9160048083019260209291908290030181865afa1580156140be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906140e291906157af565b6140ec9087615c99565b6140f69190615d83565b6040516001600160e01b031960e085901b16815260048101929092526024820152604401600060405180830381600087803b15801561413457600080fd5b505af1158015614148573d6000803e3d6000fd5b5050506000868152600e602052604090206002808201805492935060019290919061417d90849062010000900460ff16615d97565b92506101000a81548160ff021916908360ff16021790555060008060061115614220576010546040516320f58c1560e01b81526001600160a01b03909116906320f58c15906141d6908a9086908b908b90600401615dbc565b6020604051808303816000875af11580156141f5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061421991906157af565b9050614298565b60105460405163b82cc4ff60e01b81526001600160a01b039091169063b82cc4ff90614252908a908690600401615e34565b6020604051808303816000875af1158015614271573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061429591906157af565b90505b601154604051630a60208160e31b8152600481018990526001600160a01b0390911690635301040890602401600060405180830381600087803b1580156142de57600080fd5b505af11580156142f2573d6000803e3d6000fd5b5050604051634a7dd52360e01b8152600481018490526000925073fc7528e440ee7ea4919603c009901abe04b3c9119150634a7dd5239060240161052060405180830381865af415801561434a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061436e9190615bcc565b6101408101899052601054604080830151905163f628c00360e01b8152600481018c905260ff90911660248201529192506001600160a01b03169063f628c003906044016020604051808303816000875af11580156143d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143f59190615e49565b60ff16606082015260c08101829052600061440f33613bb1565b601154604051630a60208160e31b8152600481018390529192506001600160a01b031690635301040890602401600060405180830381600087803b15801561445657600080fd5b505af115801561446a573d6000803e3d6000fd5b5050506000828152600e602090815260409091208451815460ff191660ff909116178155908401518492506144a5906001830190601e615000565b506040828101516002830180546060860151608087015160a088015160ff95861661ffff199094169390931761010092861683021763ffff00001916620100009186169190910263ff0000001916176301000000949092169390930217905560c080850151600385015560e085015160048501559084015160058401556101208401516006840155610140840151600784015561016090930151600890920191909155908301519051339083907fdec4c55cfb28350d52de9c956e1e0418e3c15f99b92c58f3bda111a0e646c70590600090a4505050505050505050565b61458e848484613cd6565b61459a84848484614a02565b612a825760405162461bcd60e51b8152600401610c6b90615e64565b6000336145c283613a43565b6001600160a01b03161480610b5e5750336145dc83611fc3565b6001600160a01b03161492915050565b6000818152600260205260409020546060906001600160a01b031661466d5760405162461bcd60e51b815260206004820152603160248201527f45524337323155524953746f726167653a2055524920717565727920666f72206044820152703737b732bc34b9ba32b73a103a37b5b2b760791b6064820152608401610c6b565b6000828152600a60205260408120805461468690615715565b80601f01602080910402602001604051908101604052809291908181526020018280546146b290615715565b80156146ff5780601f106146d4576101008083540402835291602001916146ff565b820191906000526020600020905b8154815290600101906020018083116146e257829003601f168201915b50505050509050600061474260408051808201909152601c81527f68747470733a2f2f6170692e6d6963726f627564646965732e696f2f00000000602082015290565b9050805160001415614755575092915050565b81511561478757808260405160200161476f929190615eb6565b60405160208183030381529060405292505050919050565b610eec84614afd565b60006001600160e01b031982166380ac58cd60e01b14806147c157506001600160e01b03198216635b5e139f60e01b145b80610b5e57506301ffc9a760e01b6001600160e01b0319831614610b5e565b60006133fb600c5490565b611dca828260405180602001604052806000815250614c09565b6060816148295750506040805180820190915260018152600360fc1b602082015290565b8160005b8115614853578061483d8161577e565b915061484c9050600a83615d83565b915061482d565b60008167ffffffffffffffff81111561486e5761486e615252565b6040519080825280601f01601f191660200182016040528015614898576020820181803683370190505b5090505b8415610eec576148ad600183615b03565b91506148ba600a86615ee5565b6148c5906030615766565b60f81b8183815181106148da576148da615799565b60200101906001600160f81b031916908160001a9053506148fc600a86615d83565b945061489c565b6000828152600260205260409020546001600160a01b031661497e5760405162461bcd60e51b815260206004820152602e60248201527f45524337323155524953746f726167653a2055524920736574206f66206e6f6e60448201526d32bc34b9ba32b73a103a37b5b2b760911b6064820152608401610c6b565b6000828152600a602090815260409091208251610da1928401906150cc565b6149a8838383614c3c565b600f54604051631cd6eaff60e21b8152600481018390526001600160a01b039091169063735babfc90602401600060405180830381600087803b1580156149ee57600080fd5b505af1158015611a6e573d6000803e3d6000fd5b60006001600160a01b0384163b15614af557604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290614a46903390899088908890600401615ef9565b6020604051808303816000875af1925050508015614a81575060408051601f3d908101601f19168201909252614a7e91810190615f35565b60015b614adb573d808015614aaf576040519150601f19603f3d011682016040523d82523d6000602084013e614ab4565b606091505b508051614ad35760405162461bcd60e51b8152600401610c6b90615e64565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610eec565b506001610eec565b6000818152600260205260409020546060906001600160a01b0316614b7c5760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610c6b565b6000614bb860408051808201909152601c81527f68747470733a2f2f6170692e6d6963726f627564646965732e696f2f00000000602082015290565b90506000815111614bd85760405180602001604052806000815250611179565b80614be284614805565b604051602001614bf3929190615eb6565b6040516020818303038152906040529392505050565b614c138383614c6a565b614c206000848484614a02565b610da15760405162461bcd60e51b8152600401610c6b90615e64565b600b5460ff1615614c5f5760405162461bcd60e51b8152600401610c6b90615ad9565b610da1838383614db8565b6001600160a01b038216614cc05760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610c6b565b6000818152600260205260409020546001600160a01b031615614d255760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610c6b565b614d316000838361499d565b6001600160a01b0382166000908152600360205260408120805460019290614d5a908490615766565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6001600160a01b038316614e1357614e0e81600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b614e36565b816001600160a01b0316836001600160a01b031614614e3657614e368382614e70565b6001600160a01b038216614e4d57610da181614f0d565b826001600160a01b0316826001600160a01b031614610da157610da18282614fbc565b60006001614e7d84611c2d565b614e879190615b03565b600083815260076020526040902054909150808214614eda576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b600854600090614f1f90600190615b03565b60008381526009602052604081205460088054939450909284908110614f4757614f47615799565b906000526020600020015490508060088381548110614f6857614f68615799565b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480614fa057614fa0615f52565b6001900381819060005260206000200160009055905550505050565b6000614fc783611c2d565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6001830191839082156150835791602002820160005b8382111561505457835183826101000a81548160ff021916908360ff1602179055509260200192600101602081600001049283019260010302615016565b80156150815782816101000a81549060ff0219169055600101602081600001049283019260010302615054565b505b506116f3929150615140565b6040518060c001604052806006906020820280368337509192915050565b6040518061030001604052806018906020820280368337509192915050565b8280546150d890615715565b90600052602060002090601f0160209004810192826150fa5760008555615083565b82601f1061511357805160ff1916838001178555615083565b82800160010185558215615083579182015b82811115615083578251825591602001919060010190615125565b5b808211156116f35760008155600101615141565b6001600160e01b031981168114613a4057600080fd5b60006020828403121561517d57600080fd5b813561117981615155565b60005b838110156151a357818101518382015260200161518b565b83811115612a825750506000910152565b600081518084526151cc816020860160208601615188565b601f01601f19169290920160200192915050565b60208152600061117960208301846151b4565b60006020828403121561520557600080fd5b5035919050565b80356001600160a01b038116811461522357600080fd5b919050565b6000806040838503121561523b57600080fd5b6152448361520c565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b604051610180810167ffffffffffffffff8111828210171561528c5761528c615252565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156152bb576152bb615252565b604052919050565b600080600080608085870312156152d957600080fd5b6152e28561520c565b935060206152f181870161520c565b935060408601359250606086013567ffffffffffffffff8082111561531557600080fd5b818801915088601f83011261532957600080fd5b81358181111561533b5761533b615252565b61534d601f8201601f19168501615292565b9150808252898482850101111561536357600080fd5b808484018584013760008482840101525080935050505092959194509250565b6000806040838503121561539657600080fd5b50508035926020909101359150565b6000806000606084860312156153ba57600080fd5b6153c38461520c565b92506153d16020850161520c565b9150604084013590509250925092565b8015158114613a4057600080fd5b60008060006060848603121561540457600080fd5b833592506020840135615416816153e1565b91506040840135615426816153e1565b809150509250925092565b60008083601f84011261544357600080fd5b50813567ffffffffffffffff81111561545b57600080fd5b6020830191508360208260051b850101111561547657600080fd5b9250929050565b6000806020838503121561549057600080fd5b823567ffffffffffffffff8111156154a757600080fd5b6154b385828601615431565b90969095509350505050565b6020808252825182820181905260009190848201906040850190845b818110156154f7578351835292840192918401916001016154db565b50909695505050505050565b60006020828403121561551557600080fd5b6111798261520c565b6000806000806040858703121561553457600080fd5b843567ffffffffffffffff8082111561554c57600080fd5b61555888838901615431565b9096509450602087013591508082111561557157600080fd5b5061557e87828801615431565b95989497509550505050565b60008060006040848603121561559f57600080fd5b83359250602084013567ffffffffffffffff8111156155bd57600080fd5b6155c986828701615431565b9497909650939450505050565b8060c08101831015610b5e57600080fd5b806103008101831015610b5e57600080fd5b60008060006103e0848603121561560f57600080fd5b8335925061562085602086016155d6565b915061562f8560e086016155e7565b90509250925092565b6000806040838503121561564b57600080fd5b6156548361520c565b91506020830135615664816153e1565b809150509250929050565b6000806000806000610400868803121561568857600080fd5b8535945061569987602088016155d6565b93506156a88760e088016155e7565b92506103e086013567ffffffffffffffff8111156156c557600080fd5b6156d188828901615431565b969995985093965092949392505050565b600080604083850312156156f557600080fd5b6156fe8361520c565b915061570c6020840161520c565b90509250929050565b600181811c9082168061572957607f821691505b6020821081141561574a57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b6000821982111561577957615779615750565b500190565b600060001982141561579257615792615750565b5060010190565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156157c157600080fd5b5051919050565b805460ff8082168452600882901c81166020850152601082901c81166040850152601882901c8116606085015261580960808501828460201c1660ff169052565b61581d60a08501828460281c1660ff169052565b61583160c08501828460301c1660ff169052565b61584560e08501828460381c1660ff169052565b61585a6101008501828460401c1660ff169052565b61586f6101208501828460481c1660ff169052565b6158846101408501828460501c1660ff169052565b6158996101608501828460581c1660ff169052565b6158ae6101808501828460601c1660ff169052565b6158c36101a08501828460681c1660ff169052565b6158d86101c08501828460701c1660ff169052565b6158ed6101e08501828460781c1660ff169052565b6159026102008501828460801c1660ff169052565b6159176102208501828460881c1660ff169052565b61592c6102408501828460901c1660ff169052565b6159416102608501828460981c1660ff169052565b6159566102808501828460a01c1660ff169052565b61596b6102a08501828460a81c1660ff169052565b6159806102c08501828460b01c1660ff169052565b6159956102e08501828460b81c1660ff169052565b6159aa6103008501828460c01c1660ff169052565b6159bf6103208501828460c81c1660ff169052565b6159d46103408501828460d01c1660ff169052565b6159e96103608501828460d81c1660ff169052565b6159fe6103808501828460e01c1660ff169052565b612a826103a08501828460e81c1660ff169052565b615a2982615a22835460ff1690565b60ff169052565b615a3960208301600183016157c8565b600281015460ff8082166103e0850152600882811c8216610400860152601083901c821661042086015260189290921c166104408401526003820154610460840152600482015461048084015260058201546104a084015260068201546104c084015260078201546104e0840152015461050090910152565b6105608101615ac18286615a13565b92151561052082015290151561054090910152919050565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b600082821015615b1557615b15615750565b500390565b6105208101610b5e8284615a13565b600060208284031215615b3b57600080fd5b8151611179816153e1565b805160ff8116811461522357600080fd5b600082601f830112615b6857600080fd5b6040516103c080820182811067ffffffffffffffff82111715615b8d57615b8d615252565b60405283018185821115615ba057600080fd5b845b82811015615bc157615bb381615b46565b825260209182019101615ba2565b509195945050505050565b60006105208284031215615bdf57600080fd5b615be7615268565b615bf083615b46565b8152615bff8460208501615b57565b6020820152615c116103e08401615b46565b6040820152615c236104008401615b46565b6060820152615c356104208401615b46565b6080820152615c476104408401615b46565b60a082015261046083015160c082015261048083015160e08201526104a08301516101008201526104c08301516101208201526104e08301516101408201526105009092015161016083015250919050565b6000816000190483118215151615615cb357615cb3615750565b500290565b8035600081900b811461522357600080fd5b6108e08101818560005b6006811015615cfe57615ce682615cb8565b60000b83526020928301929190910190600101615cd4565b50505060c082018460005b6018811015615d3357615d1b82615cb8565b60000b83526020928301929190910190600101615d09565b505050610eec6103c0830184615a13565b60008251615d56818460208701615188565b64173539b7b760d91b920191825250600501919050565b634e487b7160e01b600052601260045260246000fd5b600082615d9257615d92615d6d565b500490565b600060ff821660ff84168060ff03821115615db457615db4615750565b019392505050565b84815261090081016020615dd281840187615a13565b61054083018560005b6006811015615dfb57815160000b83529183019190830190600101615ddb565b50505061060083018460005b6018811015615e2757815160000b83529183019190830190600101615e07565b5050505095945050505050565b82815261054081016111796020830184615a13565b600060208284031215615e5b57600080fd5b61117982615b46565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60008351615ec8818460208801615188565b835190830190615edc818360208801615188565b01949350505050565b600082615ef457615ef4615d6d565b500690565b60006001600160a01b03808716835280861660208401525083604083015260806060830152615f2b60808301846151b4565b9695505050505050565b600060208284031215615f4757600080fd5b815161117981615155565b634e487b7160e01b600052603160045260246000fdfe4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a264697066735822122084872defb9ac5858b14d18d28b00046ac7699027af4d4be066f586408880b16664736f6c634300080a00330000000000000000000000005fd0ba505da857990a7055e3042d3dea7e189d2a000000000000000000000000acc170498ab0f05dd84c145619d8d9460d8a8aac000000000000000000000000a68419d04f71a06c10e18a6c911aa570dabf5186

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

0000000000000000000000005fd0ba505da857990a7055e3042d3dea7e189d2a000000000000000000000000acc170498ab0f05dd84c145619d8d9460d8a8aac000000000000000000000000a68419d04f71a06c10e18a6c911aa570dabf5186

-----Decoded View---------------
Arg [0] : _gooAddr (address): 0x5fd0ba505da857990a7055e3042d3dea7e189d2a
Arg [1] : _buddyLogicAddr (address): 0xacc170498ab0f05dd84c145619d8d9460d8a8aac
Arg [2] : _buddyRandomnessAddr (address): 0xa68419d04f71a06c10e18a6c911aa570dabf5186

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000005fd0ba505da857990a7055e3042d3dea7e189d2a
Arg [1] : 000000000000000000000000acc170498ab0f05dd84c145619d8d9460d8a8aac
Arg [2] : 000000000000000000000000a68419d04f71a06c10e18a6c911aa570dabf5186


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading