Contract 0xf2d858d63a8cfd674d78a558f52ead5f2fa6ab13

 
Txn Hash
Block
From
To
Value [Txn Fee]
0xa04b6c53b2362e34f3f9708974582103d50970d5247dac5d6d1f0722006e852772645462021-05-09 8:07:133 hrs 11 mins ago0xcb7d9cb4c1144db98f3390273bfbc1c0ff69d335 IN  0xf2d858d63a8cfd674d78a558f52ead5f2fa6ab130 BNB0.00059342
0x9361e6c7e8da4ada715b97061433528dca4f15827f6faa2d493be4e6ca0c0a6b72645252021-05-09 8:05:563 hrs 12 mins ago0xcb7d9cb4c1144db98f3390273bfbc1c0ff69d335 IN  0xf2d858d63a8cfd674d78a558f52ead5f2fa6ab130 BNB0.00059342
0x93793cfdf310b314c2219e60d720ddbe26251501d01122bbf2a0e0b819a735c172555762021-05-09 0:15:1711 hrs 3 mins ago0x7f80c7edfa3c04e47a34569ea89f84ca63269cbc IN  0xf2d858d63a8cfd674d78a558f52ead5f2fa6ab130 BNB0.00065939
0x548c01642de1ec562259490e0dc918f7ececaf1fb50654bf9e70a92b131f1eaa72378982021-05-08 8:50:431 day 2 hrs ago0xef38b935ad8e0641a36557aad91696ce1d551925 IN  0xf2d858d63a8cfd674d78a558f52ead5f2fa6ab130 BNB0.00045432
0x4b82ee0d3756dd982273ed9e1a1c99b96368cce47529d83d2e6bbcc23414d37872369872021-05-08 8:05:101 day 3 hrs ago0x4b6910654f598814606cd9b9e59c515b54168620 IN  0xf2d858d63a8cfd674d78a558f52ead5f2fa6ab130 BNB0.00052932
0x2033cac28b3e1448956ed247c1c40cbc2c4ffbb850d1200432d6c48c2a2db22072144582021-05-07 12:56:061 day 22 hrs ago0x6ba93928deb679c01dd2c550fd7378dca6a99f02 IN  0xf2d858d63a8cfd674d78a558f52ead5f2fa6ab130 BNB0.00049371
0x3b45986afdc1d3db42c21f919565594a17cdae4578dce6cd88aeca7438a507d172114542021-05-07 10:17:312 days 1 hr ago0x2f918dcd9a370c9bba73772371d83cf5d6af9e0d IN  0xf2d858d63a8cfd674d78a558f52ead5f2fa6ab130 BNB0.000504055
0x230703413b8635e69b109be259ca2eb2975e4f032c5a1446a45e687ac95ce48372114262021-05-07 10:16:072 days 1 hr ago0x2f918dcd9a370c9bba73772371d83cf5d6af9e0d IN  0xf2d858d63a8cfd674d78a558f52ead5f2fa6ab130 BNB0.00059336
0x29cd0ec195e0b428c78e4b1c7f9409cdfae04dc74e668ee1b465c259d621ddbe72112712021-05-07 10:08:212 days 1 hr ago0x2f918dcd9a370c9bba73772371d83cf5d6af9e0d IN  0xf2d858d63a8cfd674d78a558f52ead5f2fa6ab130 BNB0.00051842
0xd8568ac390ffaba4ecba91e8fe65e3c79c6420405971411008a967467f22e71472112642021-05-07 10:08:002 days 1 hr ago0x2f918dcd9a370c9bba73772371d83cf5d6af9e0d IN  0xf2d858d63a8cfd674d78a558f52ead5f2fa6ab130 BNB0.00059342
0x4628484c27c9e1b9d3cd8d93e657f911b9b56fc572a89699c38f51b3afec7a5572084152021-05-07 7:45:112 days 3 hrs ago0x381ed019a5ee2edd5596e2579cc9ef9ea99940f8 IN  0xf2d858d63a8cfd674d78a558f52ead5f2fa6ab130 BNB0.00037932
0x4cff13e3a7f1040b1c1c4002eb31bbebeefd16cbce34bc8f8dc9a868cf9ccf3e72084052021-05-07 7:44:412 days 3 hrs ago0x381ed019a5ee2edd5596e2579cc9ef9ea99940f8 IN  0xf2d858d63a8cfd674d78a558f52ead5f2fa6ab130 BNB0.00045432
0xc930cce7f198f9e2783c296bd9c02f2f43756365c1946a4e047ed26ac8f6c66b72083952021-05-07 7:44:112 days 3 hrs ago0x381ed019a5ee2edd5596e2579cc9ef9ea99940f8 IN  0xf2d858d63a8cfd674d78a558f52ead5f2fa6ab130 BNB0.00052932
0xeacb5d0f76396ea2d866fb01ed4922b26b8e82d69a119ea0569058b86138961c72013712021-05-07 1:49:442 days 9 hrs ago0xc87bf1972dd048404cbd3fba300b69277552c472 IN  0xf2d858d63a8cfd674d78a558f52ead5f2fa6ab130 BNB0.000579115
0xba06c9ee030e938d4010841445d8a20675c9c1d94b22f8e06ff14ea9b42dfc2972013572021-05-07 1:49:022 days 9 hrs ago0xc87bf1972dd048404cbd3fba300b69277552c472 IN  0xf2d858d63a8cfd674d78a558f52ead5f2fa6ab130 BNB0.00049371
0xeabbae5ad1079273a4f0c7e3fc53704e0a9f0f6d3f40ebc40e239312f6439e3372013472021-05-07 1:48:322 days 9 hrs ago0xc87bf1972dd048404cbd3fba300b69277552c472 IN  0xf2d858d63a8cfd674d78a558f52ead5f2fa6ab130 BNB0.000879655
0xe7d6a720001bf9f5bd0387a125f37fd0cd31d1965ea373d94f2890cf4a63e73c71692622021-05-05 22:17:083 days 13 hrs ago0x6ba93928deb679c01dd2c550fd7378dca6a99f02 IN  0xf2d858d63a8cfd674d78a558f52ead5f2fa6ab130 BNB0.00068212
0x694eba74205f5c3e2d1566e192ab16a34d245c98549f8642eb7be52f74c44f4a71666302021-05-05 20:05:123 days 15 hrs ago0x694207eb22ded07d4464fe5b8bba669855923e1e IN  0xf2d858d63a8cfd674d78a558f52ead5f2fa6ab130 BNB0.000664015
0x722627a09937ecea152e669804a2924805e4be0432e98aef19b78520105b9f3971666192021-05-05 20:04:393 days 15 hrs ago0x694207eb22ded07d4464fe5b8bba669855923e1e IN  0xf2d858d63a8cfd674d78a558f52ead5f2fa6ab130 BNB0.00050743
0xee2772565b9d16c66916f2e4c26863ce5fc289889063c5bd14437576fdddb0c571666072021-05-05 20:04:033 days 15 hrs ago0x694207eb22ded07d4464fe5b8bba669855923e1e IN  0xf2d858d63a8cfd674d78a558f52ead5f2fa6ab130 BNB0.00073439
0x9cac81d5fd43b75a7fd7664d45b753d0e6c76815368f401fd0f44136a74b83e971634462021-05-05 17:09:513 days 18 hrs ago0x065c85dcbeada4da3f4a389fcfc9665dffa1d490 IN  0xf2d858d63a8cfd674d78a558f52ead5f2fa6ab130 BNB0.000504055
0x600e8ed8daf48cb5320e50f35c04411f47bda5fbb8b113d0133ad64663ec3e1a71531032021-05-05 8:24:474 days 2 hrs ago0xef38b935ad8e0641a36557aad91696ce1d551925 IN  0xf2d858d63a8cfd674d78a558f52ead5f2fa6ab130 BNB0.00045432
0xd5fc64ca63463bc1432e37210f6a59dbdbd4c8427e76fec9a16f320eeef0fec171516192021-05-05 7:10:264 days 4 hrs ago0xef38b935ad8e0641a36557aad91696ce1d551925 IN  0xf2d858d63a8cfd674d78a558f52ead5f2fa6ab130 BNB0.00045432
0xa4344be2131a41f547e1d7ee2715d3ffb98f06252e7772422e954f8bcfffa2cb71515972021-05-05 7:09:204 days 4 hrs ago0xef38b935ad8e0641a36557aad91696ce1d551925 IN  0xf2d858d63a8cfd674d78a558f52ead5f2fa6ab130 BNB0.00045432
0x657b0dd11294bd3722f507724405b62b4fde078819480e233e2d7d83ba78bf5c71442092021-05-05 0:58:364 days 10 hrs ago0x82e5945ef52ff6e3963325edaebc9b3c20f1ce38 IN  0xf2d858d63a8cfd674d78a558f52ead5f2fa6ab130 BNB0.00057351
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
IthChef

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 27 : IthChef.sol
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../lib/token/BEP20/IBEP20.sol";
import "../lib/token/BEP20/SafeBEP20.sol";

import "../runes/Ith.sol";
import "../ArcaneItemFactoryV1.sol";
import "../ArcaneProfile.sol";

// MasterChef is the master of Rune. He can make Rune and he is a fair guy.
//
// Note that it's ownable and the owner wields tremendous power. The ownership
// will be transferred to a governance smart contract once RUNE is sufficiently
// distributed and the community can show to govern itself.
//
// Have fun reading it. Hopefully it's bug-free. God bless.
contract IthChef is Ownable, ERC721Holder {
    using SafeMath for uint256;
    using SafeBEP20 for IBEP20;

    // Info of each user.
    struct UserInfo {
        ArcaneItemFactoryV1.ArcaneItem[] items; // Equiped items
        uint256 amount;         // How many LP tokens the user has provided.
        uint256 rewardDebt;     // Reward debt. See explanation below.
        //
        // We do some fancy math here. Basically, any point in time, the amount of RUNEs
        // entitled to a user but is pending to be distributed is:
        //
        //   pending reward = (user.amount * pool.accRunePerShare) - user.rewardDebt
        //
        // Whenever a user deposits or withdraws LP tokens to a pool. Here's what happens:
        //   1. The pool's `accRunePerShare` (and `lastRewardBlock`) gets updated.
        //   2. User receives the pending reward sent to his/her address.
        //   3. User's `amount` gets updated.
        //   4. User's `rewardDebt` gets updated.
    }

    // Info of each pool.
    struct PoolInfo {
        IBEP20 lpToken;           // Address of LP token contract.
        uint256 allocPoint;       // How many allocation points assigned to this pool. RUNEs to distribute per block.
        uint256 lastRewardBlock;  // Last block number that RUNEs distribution occurs.
        uint256 accRunePerShare;   // Accumulated RUNEs per share, times 1e12. See below.
        uint16 depositFeeBP;      // Deposit fee in basis points
    }

    // The RUNE!
    IthRune public rune;
    // Dev address
    address public devAddress;
    // Charity address
    address public charityAddress;
    // RUNE tokens created per block.
    uint256 public runePerBlock;
    // Bonus muliplier for early rune makers.
    uint256 public constant BONUS_MULTIPLIER = 1;
    // Vault address
    address public vaultAddress;
    // Void address
    address public voidAddress;

    address public profileAddress;
    address public itemMintingStationAddress;


    // Mint percent breakdown
    uint256 public devMintPercent = 0;
    uint256 public vaultMintPercent = 0;
    uint256 public charityMintPercent = 0;

    // Deposit fee breakdown
    uint256 public devDepositPercent = 0;
    uint256 public vaultDepositPercent = 0;
    uint256 public charityDepositPercent = 0;

    address public itemsAddress;

    address public runeToken;
    address public elToken;
    address public tirToken;
    address public ithToken;

    // Info of each pool.
    PoolInfo[] public poolInfo;
    // Info of each user that stakes LP tokens.
    mapping (uint256 => mapping (address => UserInfo)) public userInfo;
    // Total allocation points. Must be the sum of all allocation points in all pools.
    uint256 public totalAllocPoint = 0;
    // The block number when RUNE mining starts.
    uint256 public startBlock;

    uint public randNonce;
    uint256 public hiddenPoolPid = 28;

    mapping (address => uint256) public userEquippedItemMap;

    event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
    event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
    event HarvestFee(address indexed user, uint256 amount);
    event HarvestBonus(address indexed user, uint256 amount);
    event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);

    constructor(
        IthRune _rune,
        address _profileAddress,
        address _itemMintingStationAddress,
        address _itemsAddress,
        address _devAddress,
        address _vaultAddress,
        address _charityAddress,
        address _voidAddress,
        uint256 _runePerBlock,
        uint256 _startBlock
    ) public {
        rune = _rune;
        profileAddress = _profileAddress;
        itemMintingStationAddress = _itemMintingStationAddress;
        itemsAddress = _itemsAddress;
        devAddress = _devAddress;
        vaultAddress = _vaultAddress;
        charityAddress = _charityAddress;
        voidAddress = _voidAddress;
        runePerBlock = _runePerBlock;
        startBlock = _startBlock;
        runeToken = 0xA9776B590bfc2f956711b3419910A5Ec1F63153E;
        elToken = 0x210C14fbeCC2BD9B6231199470DA12AD45F64D45;
        tirToken = 0x125a3E00a9A11317d4d95349E68Ba0bC744ADDc4;
        ithToken = address(_rune);
    }

    function poolLength() external view returns (uint256) {
        return poolInfo.length;
    }

    // Add a new lp to the pool. Can only be called by the owner.
    // XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do.
    function add(uint256 _allocPoint, IBEP20 _lpToken, uint16 _depositFeeBP, bool _withUpdate) public onlyOwner {
        require(_depositFeeBP <= 10000, "add: invalid deposit fee basis points");
        if (_withUpdate) {
            massUpdatePools();
        }
        uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock;
        totalAllocPoint = totalAllocPoint.add(_allocPoint);
        poolInfo.push(PoolInfo({
            lpToken: _lpToken,
            allocPoint: _allocPoint,
            lastRewardBlock: lastRewardBlock,
            accRunePerShare: 0,
            depositFeeBP: _depositFeeBP
        }));
    }

    // Update the given pool's RUNE allocation point and deposit fee. Can only be called by the owner.
    function set(uint256 _pid, uint256 _allocPoint, uint16 _depositFeeBP, bool _withUpdate) public onlyOwner {
        require(_depositFeeBP <= 10000, "set: invalid deposit fee basis points");
        if (_withUpdate) {
            massUpdatePools();
        }
        totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint);
        poolInfo[_pid].allocPoint = _allocPoint;
        poolInfo[_pid].depositFeeBP = _depositFeeBP;
    }

    // Return reward multiplier over the given _from to _to block.
    function getMultiplier(uint256 _from, uint256 _to) public view returns (uint256) {
        return _to.sub(_from).mul(BONUS_MULTIPLIER);
    }

    // View function to see pending RUNEs on frontend.
    function pendingRune(uint256 _pid, address _user) external view returns (uint256) {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][_user];
        uint256 accRunePerShare = pool.accRunePerShare;
        uint256 lpSupply = pool.lpToken.balanceOf(address(this));
        if (block.number > pool.lastRewardBlock && lpSupply != 0) {
            uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
            uint256 runeReward = multiplier.mul(runePerBlock).mul(pool.allocPoint).div(totalAllocPoint);
            accRunePerShare = accRunePerShare.add(runeReward.mul(1e12).div(lpSupply));
        }
        return user.amount.mul(accRunePerShare).div(1e12).sub(user.rewardDebt);
    }

    // Update reward variables for all pools. Be careful of gas spending!
    function massUpdatePools() public {
        uint256 length = poolInfo.length;
        for (uint256 pid = 0; pid < length; ++pid) {
            updatePool(pid);
        }
    }

    // Update reward variables of the given pool to be up-to-date.
    function updatePool(uint256 _pid) public {
        PoolInfo storage pool = poolInfo[_pid];
        if (block.number <= pool.lastRewardBlock) {
            return;
        }
        uint256 lpSupply = pool.lpToken.balanceOf(address(this));
        if (lpSupply == 0 || pool.allocPoint == 0 || runePerBlock == 0) {
            pool.lastRewardBlock = block.number;
            return;
        }
        uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
        uint256 runeReward = multiplier.mul(runePerBlock).mul(pool.allocPoint).div(totalAllocPoint);
        rune.mint(devAddress, runeReward.mul(devMintPercent).div(10000));
        rune.mint(vaultAddress, runeReward.mul(vaultMintPercent).div(10000));
        rune.mint(charityAddress, runeReward.mul(charityMintPercent).div(10000));
        rune.mint(address(this), runeReward);

        pool.accRunePerShare = pool.accRunePerShare.add(runeReward.mul(1e12).div(lpSupply));
        pool.lastRewardBlock = block.number;
    }

    function stringToUint(bytes memory b) internal view returns (uint256) {
        uint256 result = 0;
        for (uint i = 0; i < b.length; i++) { // c = b[i] was not needed
            if (uint8(b[i]) >= 48 && uint8(b[i]) <= 57) {
                result = result * 10 + (uint8(b[i]) - 48); // bytes and int are not compatible with the operator -.
            }
        }
        return result; // this was missing
    }

    // function uintToString(uint256 v) internal view returns (string memory) {
    //     if (v == 0) return "0";

    //     uint256 maxlength = 100;
    //     bytes memory reversed = new bytes(maxlength);
    //     uint i = 0;
    //     while (v != 0) {
    //         uint remainder = v % 10;
    //         v = v / 10;
    //         reversed[i++] = byte(48 + uint8(remainder));
    //     }
    //     bytes memory s = new bytes(i); // i + 1 is inefficient
    //     for (uint j = 0; j < i; j++) {
    //         s[j] = reversed[i - j - 1]; // to avoid the off-by-one error
    //     }
    //     string memory str = string(s);  // memory isn't implicitly convertible to storage
    //     return str;
    // }


    function getSlice(uint256 begin, uint256 end, string memory text) public pure returns (string memory) {
        bytes memory a = new bytes(end-begin);
        for(uint i=0;i<end-begin;i++){
            a[i] = bytes(text)[i+begin];
        }
        return string(a);    
    }

    function parseInt(string memory _a) internal pure returns (uint _parsedInt) {
        return parseInt(_a, 0);
    }

    function parseInt(string memory _a, uint _b) internal pure returns (uint _parsedInt) {
        bytes memory bresult = bytes(_a);
        uint mint = 0;
        bool decimals = false;
        for (uint i = 0; i < bresult.length; i++) {
            if ((uint(uint8(bresult[i])) >= 48) && (uint(uint8(bresult[i])) <= 57)) {
                if (decimals) {
                   if (_b == 0) {
                       break;
                   } else {
                       _b--;
                   }
                }
                mint *= 10;
                mint += uint(uint8(bresult[i])) - 48;
            } else if (uint(uint8(bresult[i])) == 46) {
                decimals = true;
            }
        }
        if (_b > 0) {
            mint *= 10 ** _b;
        }
        return mint;
    }

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

    function getItem(uint256 _tokenId) public view returns (ArcaneItemFactoryV1.ArcaneItem memory) {
        // Not exactly efficient but easy to read
        string memory tokenIdStr = uintToString(_tokenId);
        uint8 version = uint8(parseInt(getSlice(1, 4, tokenIdStr)));

        ArcaneItemFactoryV1.ArcaneItemModifier[] memory mods = new ArcaneItemFactoryV1.ArcaneItemModifier[](3);

        mods[0] = ArcaneItemFactoryV1.ArcaneItemModifier({
            variant: uint8(parseInt(getSlice(9, 10, tokenIdStr))),
            value: uint16(parseInt(getSlice(10, 13, tokenIdStr)))
        });

        mods[1] = ArcaneItemFactoryV1.ArcaneItemModifier({
            variant: uint8(parseInt(getSlice(13, 14, tokenIdStr))),
            value: uint16(parseInt(getSlice(14, 17, tokenIdStr)))
        });

        mods[2] = ArcaneItemFactoryV1.ArcaneItemModifier({
            variant: uint8(parseInt(getSlice(17, 18, tokenIdStr))),
            value: uint16(parseInt(getSlice(18, 21, tokenIdStr)))
        });

        ArcaneItemFactoryV1.ArcaneItem memory item = ArcaneItemFactoryV1.ArcaneItem({
            version: version,
            itemId: uint16(parseInt(getSlice(4, 9, tokenIdStr))),
            mods: mods
        });

        return item;
    }

    function getUserProfile(address _address) internal view returns (ArcaneProfile.User memory) {
        uint256 userId;
        uint256 numberPoints;
        uint256 teamId;
        address nftAddress;
        uint256 tokenId;
        bool isActive;
        
        (
            userId,
            numberPoints,
            teamId,
            nftAddress,
            tokenId,
            isActive
        ) = ArcaneProfile(profileAddress).getUserProfile(_address);
        
        
        ArcaneProfile.User memory user = ArcaneProfile.User({
            userId: userId,
            numberPoints: numberPoints,
            teamId: teamId,
            nftAddress: nftAddress,
            tokenId: tokenId,
            isActive: isActive
        });

        return user;
    }

    function equipItem(uint256 _tokenId) public {
        // User must be active to equip item
        ArcaneProfile.User memory arcaneUser = getUserProfile(_msgSender());
        require(arcaneUser.isActive == true, "User must be active");

        // massUpdatePools();

        // Loads the interface to deposit the NFT contract
        IERC721 nftToken = IERC721(itemsAddress);

        require(_msgSender() == nftToken.ownerOf(_tokenId), "Only NFT owner can register");

        require(userEquippedItemMap[_msgSender()] == 0, "Item already equiped");

        userEquippedItemMap[_msgSender()] = _tokenId;

        // Transfer NFT to this contract
        nftToken.safeTransferFrom(_msgSender(), address(this), _tokenId);
    }

    function _unequipItem(uint256 _tokenId) public {
        // User must be active to unequip item
        ArcaneProfile.User memory arcaneUser = getUserProfile(_msgSender());
        require(arcaneUser.isActive == true, "User must be active");

        // massUpdatePools();

        IERC721 nftToken = IERC721(itemsAddress);

        require(userEquippedItemMap[_msgSender()] == _tokenId, "Item not equipped");

        userEquippedItemMap[_msgSender()] = 0;

        // Transfer NFT back to user
        nftToken.safeTransferFrom(address(this), _msgSender(), _tokenId);
    }

    // function emergencyUnequipItem(uint256 _tokenId) public {
    //     require(runePerBlock == 0, "Emission must be zero");
    //     _unequipItem(_tokenId);
    // }

    function random(uint _modulus) internal returns(uint) {
        randNonce += 1;
        return uint(keccak256(abi.encodePacked(now, block.difficulty, msg.sender, randNonce))) % (_modulus + 1);
    }
    
    function uintToString(uint256 v) internal view returns (string memory) {
        if (v == 0) return "0";

        uint256 maxlength = 100;
        bytes memory reversed = new bytes(maxlength);
        uint i = 0;
        while (v != 0) {
            uint remainder = v % 10;
            v = v / 10;
            reversed[i++] = byte(48 + uint8(remainder));
        }
        bytes memory s = new bytes(i); // i + 1 is inefficient
        for (uint j = 0; j < i; j++) {
            s[j] = reversed[i - j - 1]; // to avoid the off-by-one error
        }
        string memory str = string(s);  // memory isn't implicitly convertible to storage
        return str;
    }

    function setHiddenPoolPid(uint256 _pid) public onlyOwner {
        hiddenPoolPid = _pid;
    }

    // Deposit LP tokens to MasterChef for RUNE allocation.
    function deposit(uint256 _pid, uint256 _amount) public {
        // User must have an active profile to deposit if they're using runewords
        if (userEquippedItemMap[_msgSender()] != 0) {
            ArcaneProfile.User memory arcaneUser = getUserProfile(_msgSender());
            require(arcaneUser.isActive == true, "User must be active");
        }

        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];
        updatePool(_pid);
        if (user.amount > 0) {
            uint256 pending = user.amount.mul(pool.accRunePerShare).div(1e12).sub(user.rewardDebt);
            if(pending > 0) {
                uint256 tokenId = userEquippedItemMap[_msgSender()];

                if (tokenId > 0) {
                    ArcaneItemFactoryV1.ArcaneItem memory item = getItem(tokenId);

                    if (item.itemId == 1 && item.version == 1) {
                        if (item.mods[1].value > 0) {
                            address feeToken;
                            if (item.mods[2].value == 1) {
                                feeToken = elToken;
                            } else if (item.mods[2].value == 2) {
                                feeToken = tirToken;
                            } else {
                                feeToken = runeToken;
                            }

                            uint256 feeAmount = pending.mul(item.mods[1].value).div(100);
                            safeBepTransfer(feeToken, address(msg.sender), vaultAddress, feeAmount);
                        }

                        // Transfer bonus
                        uint256 bonusAmount = pending.mul(item.mods[0].value).div(100);
                        safeBepTransfer(ithToken, vaultAddress, address(msg.sender), bonusAmount);

                        // Transfer pending
                        safeRuneTransfer(msg.sender, pending);
                    }
                    else if (item.itemId == 2 && item.version == 1) {
                        uint rand = random(100);

                        if (rand <= item.mods[0].value) {
                            PoolInfo storage pool2 = poolInfo[hiddenPoolPid];
                            UserInfo storage user2 = userInfo[hiddenPoolPid][msg.sender];
                            updatePool(hiddenPoolPid);

                            user2.amount = user2.amount.add(pending);

                            // Transfer pending
                            safeRuneTransfer(msg.sender, pending);
                        }
                        else if (rand >= (100 - item.mods[1].value)) {
                            address deadAddress = 0x000000000000000000000000000000000000dEaD;
                            safeRuneTransfer(deadAddress, pending);
                        }
                        
                        // Transfer bonus
                        uint256 bonusAmount = pending.mul(item.mods[0].value).div(100);
                        safeBepTransfer(ithToken, vaultAddress, address(msg.sender), bonusAmount);
                    }
                    else if (item.itemId == 3 && item.version == 1) {
                        if (item.mods[1].value > 0) {
                            uint256 feeAmount = pending.mul(item.mods[1].value).div(100);

                            pending -= feeAmount;

                            address deadAddress = 0x000000000000000000000000000000000000dEaD;
                            safeRuneTransfer(deadAddress, feeAmount);
                        }

                        // Transfer bonus
                        uint256 bonusAmount = pending.mul(item.mods[0].value).div(100);
                        safeBepTransfer(ithToken, vaultAddress, address(msg.sender), bonusAmount);

                        // Transfer pending
                        safeRuneTransfer(msg.sender, pending);
                    }
                } else {
                    safeRuneTransfer(msg.sender, pending);
                }
            }
        }
        if(_amount > 0) {
            pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount);
            if(pool.depositFeeBP > 0){
                uint256 depositFee = _amount.mul(pool.depositFeeBP).div(10000);
                pool.lpToken.safeTransfer(vaultAddress, depositFee.mul(vaultDepositPercent).div(10000));
                pool.lpToken.safeTransfer(devAddress, depositFee.mul(devDepositPercent).div(10000));
                pool.lpToken.safeTransfer(charityAddress, depositFee.mul(charityDepositPercent).div(10000));
                user.amount = user.amount.add(_amount).sub(depositFee);
            }else{
                user.amount = user.amount.add(_amount);
            }
        }
        user.rewardDebt = user.amount.mul(pool.accRunePerShare).div(1e12);
        emit Deposit(msg.sender, _pid, _amount);
    }

    // Withdraw LP tokens from MasterChef.
    function withdraw(uint256 _pid, uint256 _amount) public {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];
        require(user.amount >= _amount, "withdraw: not good");
        updatePool(_pid);
        uint256 pending = user.amount.mul(pool.accRunePerShare).div(1e12).sub(user.rewardDebt);
        if(pending > 0) {
            uint256 tokenId = userEquippedItemMap[_msgSender()];

            if (tokenId > 0) {
                ArcaneItemFactoryV1.ArcaneItem memory item = getItem(tokenId);

                if (item.itemId == 1 && item.version == 1) {
                    if (item.mods[1].value > 0) {
                        address feeToken;
                        if (item.mods[2].value == 1) {
                            feeToken = elToken;
                        } else if (item.mods[2].value == 2) {
                            feeToken = tirToken;
                        } else {
                            feeToken = runeToken;
                        }

                        uint256 feeAmount = pending.mul(item.mods[1].value).div(100);
                        safeBepTransfer(feeToken, address(msg.sender), vaultAddress, feeAmount);
                        
                        // emit HarvestFee(vaultAddress, feeAmount);
                    }

                    uint256 bonusAmount = pending.mul(item.mods[0].value).div(100);
                    safeBepTransfer(ithToken, vaultAddress, address(msg.sender), bonusAmount);

                    // emit HarvestBonus(msg.sender, bonusAmount);
                }
            }
            safeRuneTransfer(msg.sender, pending);
        }
        if(_amount > 0) {
            user.amount = user.amount.sub(_amount);
            pool.lpToken.safeTransfer(address(msg.sender), _amount);
        }
        user.rewardDebt = user.amount.mul(pool.accRunePerShare).div(1e12);
        emit Withdraw(msg.sender, _pid, _amount);
    }

    // Withdraw without caring about rewards. EMERGENCY ONLY.
    function emergencyWithdraw(uint256 _pid) public {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];
        uint256 amount = user.amount;
        user.amount = 0;
        user.rewardDebt = 0;
        pool.lpToken.safeTransfer(address(msg.sender), amount);
        emit EmergencyWithdraw(msg.sender, _pid, amount);
    }

    // Safe rune transfer function, just in case if rounding error causes pool to not have enough RUNEs.
    function safeRuneTransfer(address _to, uint256 _amount) internal {
        uint256 runeBal = rune.balanceOf(address(this));
        if (_amount > runeBal) {
            rune.transfer(_to, runeBal);
        } else {
            rune.transfer(_to, _amount);
        }
    }

    function safeBepTransfer(address _tokenAddress, address _from, address _to, uint256 _amount) internal {
        IBEP20 _token = BEP20(_tokenAddress);
        uint256 _bal = _token.balanceOf(_from);
        if (_amount > _bal) {
            _token.safeTransferFrom(_from, _to, _bal);
        } else {
            _token.safeTransferFrom(_from, _to, _amount);
        }
    }

    //Arcane has to add hidden dummy pools inorder to alter the emission, here we make it simple and transparent to all.
    function updateEmissionRate(uint256 _runePerBlock) public onlyOwner {
        massUpdatePools();
        runePerBlock = _runePerBlock;
    }

    function setInfo(address _vaultAddress, address _charityAddress, address _devAddress, uint256 _vaultMintPercent, uint256 _charityMintPercent, uint256 _devMintPercent, uint256 _vaultDepositPercent, uint256 _charityDepositPercent, uint256 _devDepositPercent) external
    {
        require(msg.sender == devAddress, "dev: wut?");
        require (_vaultAddress != address(0) && _charityAddress != address(0) && _devAddress != address(0), "Cannot use zero address");
        require (_vaultMintPercent <= 9500 && _charityMintPercent <= 250 && _devMintPercent <= 250, "Mint percent constraints");
        require (_vaultDepositPercent <= 9500 && _charityDepositPercent <= 250 && _devDepositPercent <= 250, "Mint percent constraints");

        vaultAddress = _vaultAddress;
        charityAddress = _charityAddress;
        devAddress = _devAddress;

        vaultMintPercent = _vaultMintPercent;
        charityMintPercent = _charityMintPercent;
        devMintPercent = _devMintPercent;

        vaultDepositPercent = _vaultDepositPercent;
        charityDepositPercent = _charityDepositPercent;
        devDepositPercent = _devDepositPercent;
    }

    function throwRuneInTheVoid() external {
        require(msg.sender == devAddress, "dev: wut?");
        massUpdatePools();
        runePerBlock = 0;
        rune.transferOwnership(voidAddress);
    }

    /// @notice Set the addresses of runes used
    /** @dev The Chef constructor is too large to take these as parameters, so they're hardcoded.
        That doesn't work with the testing framework as the addresses will be different.
        Update the addresses for use when testing.
        Optional: remove before deployment.
    */
    /// @param _runeToken Address of the protocol token
    /// @param _elToken Address of El token
    /// @param _tirToken Address of Tir token
    function setRuneAddresses(address _runeToken, address _elToken, address _tirToken) external {
        require(msg.sender == devAddress, "dev: wut?");

        runeToken = _runeToken;
        elToken = _elToken;
        tirToken = _tirToken;
    }
}

File 2 of 27 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <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 () internal {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), 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 {
        emit OwnershipTransferred(_owner, address(0));
        _owner = 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");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

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

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        uint256 c = a + b;
        if (c < a) return (false, 0);
        return (true, c);
    }

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

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

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

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

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

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

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

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

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

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

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

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

File 4 of 27 : IBEP20.sol
pragma solidity >=0.4.0;

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

    /**
     * @dev Returns the token decimals.
     */
    function decimals() external view returns (uint8);

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

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

    /**
     * @dev Returns the bep token owner.
     */
    function getOwner() external view returns (address);

    /**
     * @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 5 of 27 : SafeBEP20.sol
pragma solidity ^0.6.0;

import './IBEP20.sol';
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";

/**
 * @title SafeBEP20
 * @dev Wrappers around BEP20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeBEP20 for IBEP20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeBEP20 {
    using SafeMath for uint256;
    using Address for address;

    function safeTransfer(
        IBEP20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IBEP20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IBEP20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IBEP20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        // solhint-disable-next-line max-line-length
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            'SafeBEP20: approve from non-zero to non-zero allowance'
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IBEP20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender).add(value);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IBEP20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender).sub(
            value,
            'SafeBEP20: decreased allowance below zero'
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IBEP20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, 'SafeBEP20: low-level call failed');
        if (returndata.length > 0) {
            // Return data is optional
            // solhint-disable-next-line max-line-length
            require(abi.decode(returndata, (bool)), 'SafeBEP20: BEP20 operation did not succeed');
        }
    }
}

File 6 of 27 : Ith.sol
pragma solidity 0.6.12;

import "../lib/token/BEP20/BEP20.sol";

// Nef Rune
contract IthRune is BEP20('Ith', 'ITH') {
    uint256 public vaultFee = 0;
    uint256 public charityFee = 0;
    uint256 public devFee = 0;
    uint256 public botFee = 0;

    address public vaultAddress;
    address public charityAddress;
    address public devAddress;
    address public botAddress;

    mapping (address => bool) public isExcluded;
    address[] public excluded;

    mapping (address => bool) public isBot;
    address[] public bot;

    bool public mintable = true;

    function _mint(address account, uint256 amount) internal override {
        require(mintable == true, 'Minting has been forever disabled');
        require(account != address(0), 'BEP20: mint to the zero address');

        _totalSupply = _totalSupply.add(amount);
        _balances[account] = _balances[account].add(amount);
        emit Transfer(address(0), account, amount);
    }

    function mint(address _to, uint256 _amount) public onlyOwner {
        _mint(_to, _amount);
    }

    function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
        require(n < 2**32, errorMessage);
        return uint32(n);
    }

    function getChainId() internal pure returns (uint) {
        uint256 chainId;
        assembly { chainId := chainid() }
        return chainId;
    }

    function disableMintingForever() external {
        require(msg.sender == devAddress, "dev: wut?");
        mintable = false;
    }

    function setDevAddress(address _devAddress) external onlyOwner() {
        devAddress = _devAddress;
    }

    function setFeeInfo(address _vaultAddress, address _charityAddress, address _devAddress, address _botAddress, uint256 _vaultFee, uint256 _charityFee, uint256 _devFee, uint256 _botFee) external
    {
        require(msg.sender == devAddress, "dev: wut?");
        require (_vaultAddress != address(0) && _charityAddress != address(0) && _devAddress != address(0) && _botAddress != address(0), "RUNE::setFeeInfo: Cannot use zero address");
        require (_vaultFee <= 1000 && _charityFee <= 50 && _devFee <= 50 && _botFee <= 4000, "RUNE::_transfer: Fee constraints");

        vaultAddress = _vaultAddress;
        charityAddress = _charityAddress;
        devAddress = _devAddress;
        botAddress = _botAddress;

        vaultFee = _vaultFee;
        charityFee = _charityFee;
        devFee = _devFee;
        botFee = _botFee;
    }

    function addExcluded(address account) external {
        require(msg.sender == devAddress, "dev: wut?");
        require(!isExcluded[account], "RUNE::addExcluded: Account is already excluded");

        isExcluded[account] = true;
        excluded.push(account);
    }

    function removeExcluded(address account) external {
        require(msg.sender == devAddress, "dev: wut?");
        require(isExcluded[account], "RUNE::removeExcluded: Account isn't excluded");
        for (uint256 i = 0; i < excluded.length; i++) {
            if (excluded[i] == account) {
                excluded[i] = excluded[excluded.length - 1];
                isExcluded[account] = false;
                excluded.pop();
                break;
            }
        }
    }

    function addBot(address account) external {
        require(msg.sender == devAddress, "dev: wut?");
        require(!isBot[account], "RUNE::addBot: Account is already bot");

        isBot[account] = true;
        bot.push(account);
    }

    function removeBot(address account) external {
        require(msg.sender == devAddress, "dev: wut?");
        require(isBot[account], "RUNE::removeBot: Account isn't bot");
        for (uint256 i = 0; i < bot.length; i++) {
            if (bot[i] == account) {
                bot[i] = bot[bot.length - 1];
                isBot[account] = false;
                bot.pop();
                break;
            }
        }
    }

    function _transfer(address sender, address recipient, uint256 amount) internal override {
        require(sender != address(0), "RUNE::_transfer: Transfer from the zero address");
        require(recipient != address(0), "RUNE::_transfer: Transfer to the zero address");
    
        if (isBot[sender] || isBot[recipient]) {
            _transferBot(sender, recipient, amount);
        } else if (isExcluded[sender] && !isExcluded[recipient]) {
            _transferFromExcluded(sender, recipient, amount);
        } else if (!isExcluded[sender] && isExcluded[recipient]) {
            _transferToExcluded(sender, recipient, amount);
        } else if (!isExcluded[sender] && !isExcluded[recipient]) {
            _transferStandard(sender, recipient, amount);
        } else if (isExcluded[sender] && isExcluded[recipient]) {
            _transferBothExcluded(sender, recipient, amount);
        } else {
            _transferStandard(sender, recipient, amount);
        }
    }

    function _transferBot(address sender, address recipient, uint256 amount) private {
        uint256 _botFee = amount.mul(botFee).div(10000);
        uint256 transferAmount = amount.sub(_botFee);

        if (_botFee > 0) {
            emit Transfer(sender, botAddress, _botFee);
            _balances[botAddress] = _balances[botAddress].add(_botFee);
        }

        _balances[sender] = _balances[sender].sub(amount);
        _balances[recipient] = _balances[recipient].add(transferAmount);

        emit Transfer(sender, recipient, transferAmount);
    }

    function _transferStandard(address sender, address recipient, uint256 amount) private {
        uint256 _vaultFee = amount.mul(vaultFee).div(10000);
        uint256 _charityFee = amount.mul(charityFee).div(10000);
        uint256 _devFee = amount.mul(devFee).div(10000);
        uint256 transferAmount = amount.sub(_vaultFee).sub(_charityFee).sub(_devFee);

        if (_vaultFee > 0) {
            emit Transfer(sender, vaultAddress, _vaultFee);
            _balances[vaultAddress] = _balances[vaultAddress].add(_vaultFee);
        }

        if (_charityFee > 0) {
            emit Transfer(sender, charityAddress, _charityFee);
            _balances[charityAddress] = _balances[charityAddress].add(_charityFee);
        }

        if (_devFee > 0) {
            emit Transfer(sender, devAddress, _devFee);
            _balances[devAddress] = _balances[devAddress].add(_devFee);
        }

        _balances[sender] = _balances[sender].sub(amount);
        _balances[recipient] = _balances[recipient].add(transferAmount);

        emit Transfer(sender, recipient, transferAmount);
    }

    function _transferToExcluded(address sender, address recipient, uint256 amount) private {
        _balances[sender] = _balances[sender].sub(amount);
        _balances[recipient] = _balances[recipient].add(amount);

        emit Transfer(sender, recipient, amount);
    }

    function _transferFromExcluded(address sender, address recipient, uint256 amount) private {
        _balances[sender] = _balances[sender].sub(amount);
        _balances[recipient] = _balances[recipient].add(amount);

        emit Transfer(sender, recipient, amount);
    }

    function _transferBothExcluded(address sender, address recipient, uint256 amount) private {
        _balances[sender] = _balances[sender].sub(amount);
        _balances[recipient] = _balances[recipient].add(amount);

        emit Transfer(sender, recipient, amount);
    }

}

File 7 of 27 : ArcaneItemFactoryV1.sol
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;

import "@openzeppelin/contracts/math/SafeMath.sol";
import "./lib/token/BEP20/IBEP20.sol";
import "./lib/token/BEP20/SafeBEP20.sol";
import "./lib/token/BEP20/BEP20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

import "./ArcaneItemMintingStation.sol";
import "./ArcaneItems.sol";

contract ArcaneItemFactoryV1 is Ownable {
    using SafeMath for uint256;
    using SafeBEP20 for IBEP20;

    ArcaneItemMintingStation public itemMintingStation;

    IBEP20 public runeToken;

    // starting block
    uint256 public startBlockNumber;

    // Number of RUNEs a user needs to pay to acquire a token
    uint256 public tokenPrice;

    // IPFS hash for new json
    string private ipfsHash;

    // Map the token number to URI
    mapping(uint16 => string) private itemIdURIs;

    // ArcaneRecipe[] public recipes;
    mapping(address => mapping(address => ArcaneRecipe)) public recipes;

    // Is minting enabled
    bool private mintingEnabled = true;

    uint8 public constant version = 1;

    IBEP20 public elToken;
    IBEP20 public tirToken;

    // Vault address
    address public vaultAddress;

    // Event to notify when NFT is successfully minted
    event ItemMint(
        address indexed to,
        uint256 indexed tokenId,
        uint16 indexed itemId
    );

    struct ArcaneRecipe {
        uint16 version;
        uint16 itemId;
        mapping(uint8 => ArcaneRecipeModifier) mods;
    }

    struct ArcaneRecipeModifier {
        uint8 variant;
        uint16 minRange;
        uint16 maxRange;
        uint16 difficulty;
    }

    struct ArcaneItem {
        uint16 version;
        uint16 itemId;
        ArcaneItemModifier[] mods;
    }

    struct ArcaneItemModifier {
        uint8 variant;
        uint16 value;
    }

    constructor(
        ArcaneItemMintingStation _itemMintingStation,
        IBEP20 _runeToken,
        uint256 _tokenPrice,
        string memory _ipfsHash,
        uint256 _startBlockNumber
    ) public {
        itemMintingStation = _itemMintingStation;
        runeToken = _runeToken;
        tokenPrice = _tokenPrice;
        ipfsHash = _ipfsHash;
        startBlockNumber = _startBlockNumber;
        elToken = BEP20(0x210C14fbeCC2BD9B6231199470DA12AD45F64D45);
        tirToken = BEP20(0x125a3E00a9A11317d4d95349E68Ba0bC744ADDc4);
        vaultAddress = address(0x602a27bBf954b6945534a84C8c88FB8cA9E92B7F);
    }

    function setRecipe(address _item1, address _item2, uint16 _version, uint16 _itemId) external onlyOwner {
        recipes[_item1][_item2].version = _version;
        recipes[_item1][_item2].itemId = _itemId;
    }

    function setRecipeMod(address _item1, address _item2, uint8 _index, uint8 _variant, uint16 _minRange, uint16 _maxRange, uint16 _difficulty) external onlyOwner {
        // ArcaneRecipe memory recipe = recipes[_item1][_item2];

        recipes[_item1][_item2].mods[_index].variant = _variant;
        recipes[_item1][_item2].mods[_index].minRange = _minRange;
        recipes[_item1][_item2].mods[_index].maxRange = _maxRange;
        recipes[_item1][_item2].mods[_index].difficulty = _difficulty;
    }

    uint public randNonce;

    /**
     * @dev Allow to change the IPFS hash
     * Only the owner can set it.
     */
    function updateIpfsHash(string memory _ipfsHash) external onlyOwner {
        ipfsHash = _ipfsHash;
    }

    function random(uint _modulus) internal returns(uint) {
        randNonce += 1;
        return uint(keccak256(abi.encodePacked(now, block.difficulty, msg.sender, randNonce))) % (_modulus + 1);
    }
    
    function stringToUint(string memory s) internal view returns (uint256) {
        bytes memory b = bytes(s);
        uint256 result = 0;
        for (uint i = 0; i < b.length; i++) { // c = b[i] was not needed
            if (uint8(b[i]) >= 48 && uint8(b[i]) <= 57) {
                result = result * 10 + (uint8(b[i]) - 48); // bytes and int are not compatible with the operator -.
            }
        }
        return result; // this was missing
    }

    function uintToString(uint256 v) internal view returns (string memory) {
        if (v == 0) return "0";

        uint256 maxlength = 100;
        bytes memory reversed = new bytes(maxlength);
        uint i = 0;
        while (v != 0) {
            uint remainder = v % 10;
            v = v / 10;
            reversed[i++] = byte(48 + uint8(remainder));
        }
        bytes memory s = new bytes(i); // i + 1 is inefficient
        for (uint j = 0; j < i; j++) {
            s[j] = reversed[i - j - 1]; // to avoid the off-by-one error
        }
        string memory str = string(s);  // memory isn't implicitly convertible to storage
        return str;
    }

    function getSlice(uint256 begin, uint256 end, string memory text) public pure returns (string memory) {
        bytes memory a = new bytes(end-begin+1);
        for(uint i=0;i<=end-begin;i++){
            a[i] = bytes(text)[i+begin-1];
        }
        return string(a);    
    }

    function concat(string memory a, string memory b, string memory c, string memory d, string memory e) internal pure returns (string memory) {
        return string(abi.encodePacked(a, b, c, d, e));
    }

    function pad(string memory str, uint8 length) internal pure returns (string memory) {
        string memory padding = "000000000";

        return getSlice(0, length - bytes(str).length, padding);
    }

    // function pad(string memory str, uint8 length) internal pure returns (string memory) {
    //     string memory padding = "000000000";

    //     if (length > bytes(str).length) {
    //         return string(abi.encodePacked(getSlice(0, length - bytes(str).length, padding), str));
    //     } else {
    //         return str;
    //     }
    // }

    function getTokenIdFromRecipe(ArcaneRecipe storage recipe) internal returns (uint256) {
        string memory _version = uintToString(recipe.version);
        string memory itemId = uintToString(recipe.itemId);
        string memory mod1 = uintToString(recipe.mods[0].variant);
        string memory mod2 = recipe.mods[0].minRange == recipe.mods[0].maxRange ? uintToString(recipe.mods[0].minRange) : uintToString(recipe.mods[0].minRange + random(recipe.mods[0].maxRange - recipe.mods[0].minRange));
        string memory mod3 = uintToString(recipe.mods[1].variant);
        string memory mod4 = recipe.mods[1].minRange == recipe.mods[1].maxRange ? uintToString(recipe.mods[1].minRange) : uintToString(recipe.mods[1].minRange + random(recipe.mods[1].maxRange - recipe.mods[1].minRange));
        string memory mod5 = uintToString(recipe.mods[2].variant);
        string memory mod6 = recipe.mods[2].minRange == recipe.mods[2].maxRange ? uintToString(recipe.mods[2].minRange) : uintToString(recipe.mods[2].minRange + random(recipe.mods[2].maxRange - recipe.mods[2].minRange));

        ///return stringToUint(string("1", abi.encodePacked(pad(_version, 3), pad(itemId, 5), pad(mod1, 3), pad(mod2, 3), pad(mod3, 3), pad(mod4, 3), pad(mod5, 3), pad(mod6, 3))));

        string memory moreMods = string(abi.encodePacked("1", random(100), "1", random(100), "1", random(100), "1", random(100), "1", random(100)));

        return stringToUint(string(abi.encodePacked("1001000011", bytes(mod2).length > 1 ? "0" : "00", mod2, "100", mod4, "100", mod6, moreMods)));
    }

    /**
     * @dev Mint NFTs from the ItemMintingStation contract.
     * Users can specify what itemId they want to mint. Users can claim once.
     */
    function transmute(address _item1, address _item2) external {
        require(mintingEnabled == true, "Minting disabled");
        
        address senderAddress = _msgSender();

        ArcaneRecipe storage recipe = recipes[_item1][_item2];

        // Check block time is not too late
        require(block.number > startBlockNumber, "too early");

        // Send RUNE tokens to this contract
        if (tokenPrice > 0) {
            runeToken.safeTransferFrom(senderAddress, vaultAddress, tokenPrice);
        }

        elToken.safeTransferFrom(senderAddress, vaultAddress, 1 ether);
        tirToken.safeTransferFrom(senderAddress, vaultAddress, 1 ether);

        string memory tokenURI = itemIdURIs[recipe.itemId];

        uint16 _itemId = recipe.itemId;
        uint256 _tokenId = getTokenIdFromRecipe(recipe);

        uint256 tokenId =
            itemMintingStation.mint(
                senderAddress,
                tokenURI,
                _itemId,
                _tokenId
            );

        emit ItemMint(senderAddress, tokenId, _itemId);
    }

    /**
     * @dev It transfers the RUNE tokens back to the chef address.
     * Only callable by the owner.
     */
    function claimFee(uint256 _amount) external onlyOwner {
        runeToken.safeTransfer(_msgSender(), _amount);
    }

    /**
     * @dev Set up json extensions for items
     * Assign tokenURI to look for each itemId in the mint function
     * Only the owner can set it.
     */
    function setItemJson(
        uint16 _itemId,
        string calldata _itemIdJson
    ) external onlyOwner {
        itemIdURIs[_itemId] = string(abi.encodePacked(ipfsHash, _itemIdJson));
    }

    /**
     * @dev Allow to set up the start number
     * Only the owner can set it.
     */
    function setStartBlockNumber(uint256 _newStartBlockNumber)
        external
        onlyOwner
    {
        require(_newStartBlockNumber > block.number, "too short");
        startBlockNumber = _newStartBlockNumber;
    }

    /**
     * @dev Allow to change the token price
     * Only the owner can set it.
     */
    function updateTokenPrice(uint256 _newTokenPrice) external onlyOwner {
        tokenPrice = _newTokenPrice;
    }

    function setMintingEnabled(bool _mintingEnabled) external onlyOwner {
        mintingEnabled = _mintingEnabled;
    }
}

File 8 of 27 : ArcaneProfile.sol
pragma solidity ^0.6.0;

import "@openzeppelin/contracts/math/SafeMath.sol";
import "./lib/token/BEP20/IBEP20.sol";
import "./lib/token/BEP20/SafeBEP20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721Holder.sol";
import "@openzeppelin/contracts/utils/Counters.sol";


/** @title ArcaneProfile.
@dev It is a contract for users to bind their address 
to a customizable profile by depositing a NFT.
*/
contract ArcaneProfile is AccessControl, ERC721Holder {
    using Counters for Counters.Counter;
    using SafeBEP20 for IBEP20;
    using SafeMath for uint256;

    IBEP20 public runeToken;

    bytes32 public constant NFT_ROLE = keccak256("NFT_ROLE");
    bytes32 public constant POINT_ROLE = keccak256("POINT_ROLE");
    bytes32 public constant SPECIAL_ROLE = keccak256("SPECIAL_ROLE");

    uint256 public numberActiveProfiles;
    uint256 public numberRuneToReactivate;
    uint256 public numberRuneToRegister;
    uint256 public numberRuneToUpdate;
    uint256 public numberTeams;

    mapping(address => bool) public hasRegistered;

    mapping(uint256 => Team) private teams;
    mapping(address => User) private users;

    // Used for generating the teamId
    Counters.Counter private _countTeams;

    // Used for generating the userId
    Counters.Counter private _countUsers;

    // Event to notify a new team is created
    event TeamAdd(uint256 teamId, string teamName);

    // Event to notify that team points are increased
    event TeamPointIncrease(
        uint256 indexed teamId,
        uint256 numberPoints,
        uint256 indexed campaignId
    );

    event UserChangeTeam(
        address indexed userAddress,
        uint256 oldTeamId,
        uint256 newTeamId
    );

    // Event to notify that a user is registered
    event UserNew(
        address indexed userAddress,
        uint256 teamId,
        address nftAddress,
        uint256 tokenId
    );

    // Event to notify a user pausing her profile
    event UserPause(address indexed userAddress, uint256 teamId);

    // Event to notify that user points are increased
    event UserPointIncrease(
        address indexed userAddress,
        uint256 numberPoints,
        uint256 indexed campaignId
    );

    // Event to notify that a list of users have an increase in points
    event UserPointIncreaseMultiple(
        address[] userAddresses,
        uint256 numberPoints,
        uint256 indexed campaignId
    );

    // Event to notify that a user is reactivating her profile
    event UserReactivate(
        address indexed userAddress,
        uint256 teamId,
        address nftAddress,
        uint256 tokenId
    );

    // Event to notify that a user is pausing her profile
    event UserUpdate(
        address indexed userAddress,
        address nftAddress,
        uint256 tokenId
    );

    // Modifier for admin roles
    modifier onlyOwner() {
        require(
            hasRole(DEFAULT_ADMIN_ROLE, _msgSender()),
            "Not the main admin"
        );
        _;
    }

    // Modifier for point roles
    modifier onlyPoint() {
        require(hasRole(POINT_ROLE, _msgSender()), "Not a point admin");
        _;
    }

    // Modifier for special roles
    modifier onlySpecial() {
        require(hasRole(SPECIAL_ROLE, _msgSender()), "Not a special admin");
        _;
    }

    struct Team {
        string teamName;
        string teamDescription;
        uint256 numberUsers;
        uint256 numberPoints;
        bool isJoinable;
    }

    struct User {
        uint256 userId;
        uint256 numberPoints;
        uint256 teamId;
        address nftAddress;
        uint256 tokenId;
        bool isActive;
    }

    constructor(
        IBEP20 _runeToken,
        uint256 _numberRuneToReactivate,
        uint256 _numberRuneToRegister,
        uint256 _numberRuneToUpdate
    ) public {
        runeToken = _runeToken;
        numberRuneToReactivate = _numberRuneToReactivate;
        numberRuneToRegister = _numberRuneToRegister;
        numberRuneToUpdate = _numberRuneToUpdate;
        _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
    }

    /**
     * @dev To create a user profile. It sends the NFT to the contract
     * and sends RUNE to burn address. Requires 2 token approvals.
     */
    function createProfile(
        uint256 _teamId,
        address _nftAddress,
        uint256 _tokenId
    ) external {
        require(!hasRegistered[_msgSender()], "Already registered");
        require((_teamId <= numberTeams) && (_teamId > 0), "Invalid teamId");
        require(teams[_teamId].isJoinable, "Team not joinable");
        require(hasRole(NFT_ROLE, _nftAddress), "NFT address invalid");

        // Loads the interface to deposit the NFT contract
        IERC721 nftToken = IERC721(_nftAddress);

        require(
            _msgSender() == nftToken.ownerOf(_tokenId),
            "Only NFT owner can register"
        );

        // Transfer NFT to this contract
        nftToken.safeTransferFrom(_msgSender(), address(this), _tokenId);

        // Transfer RUNE tokens to this contract
        runeToken.safeTransferFrom(
            _msgSender(),
            address(this),
            numberRuneToRegister
        );

        // Increment the _countUsers counter and get userId
        _countUsers.increment();
        uint256 newUserId = _countUsers.current();

        // Add data to the struct for newUserId
        users[_msgSender()] = User({
            userId: newUserId,
            numberPoints: 0,
            teamId: _teamId,
            nftAddress: _nftAddress,
            tokenId: _tokenId,
            isActive: true
        });

        // Update registration status
        hasRegistered[_msgSender()] = true;

        // Update number of active profiles
        numberActiveProfiles = numberActiveProfiles.add(1);

        // Increase the number of users for the team
        teams[_teamId].numberUsers = teams[_teamId].numberUsers.add(1);

        // Emit an event
        emit UserNew(_msgSender(), _teamId, _nftAddress, _tokenId);
    }

    /**
     * @dev To pause user profile. It releases the NFT.
     * Callable only by registered users.
     */
    function pauseProfile() external {
        require(hasRegistered[_msgSender()], "Has not registered");

        // Checks whether user has already paused
        require(users[_msgSender()].isActive, "User not active");

        // Change status of user to make it inactive
        users[_msgSender()].isActive = false;

        // Retrieve the teamId of the user calling
        uint256 userTeamId = users[_msgSender()].teamId;

        // Reduce number of active users and team users
        teams[userTeamId].numberUsers = teams[userTeamId].numberUsers.sub(1);
        numberActiveProfiles = numberActiveProfiles.sub(1);

        // Interface to deposit the NFT contract
        IERC721 nftToken = IERC721(users[_msgSender()].nftAddress);

        // tokenId of NFT redeemed
        uint256 redeemedTokenId = users[_msgSender()].tokenId;

        // Change internal statuses as extra safety
        users[_msgSender()].nftAddress = address(
            0x0000000000000000000000000000000000000000
        );

        users[_msgSender()].tokenId = 0;

        // Transfer the NFT back to the user
        nftToken.safeTransferFrom(address(this), _msgSender(), redeemedTokenId);

        // Emit event
        emit UserPause(_msgSender(), userTeamId);
    }

    /**
     * @dev To update user profile.
     * Callable only by registered users.
     */
    function updateProfile(address _nftAddress, uint256 _tokenId) external {
        require(hasRegistered[_msgSender()], "Has not registered");
        require(hasRole(NFT_ROLE, _nftAddress), "NFT address invalid");
        require(users[_msgSender()].isActive, "User not active");

        address currentAddress = users[_msgSender()].nftAddress;
        uint256 currentTokenId = users[_msgSender()].tokenId;

        // Interface to deposit the NFT contract
        IERC721 nftNewToken = IERC721(_nftAddress);

        require(
            _msgSender() == nftNewToken.ownerOf(_tokenId),
            "Only NFT owner can update"
        );

        // Transfer token to new address
        nftNewToken.safeTransferFrom(_msgSender(), address(this), _tokenId);

        // Transfer RUNE token to this address
        runeToken.safeTransferFrom(
            _msgSender(),
            address(this),
            numberRuneToUpdate
        );

        // Interface to deposit the NFT contract
        IERC721 nftCurrentToken = IERC721(currentAddress);

        // Transfer old token back to the owner
        nftCurrentToken.safeTransferFrom(
            address(this),
            _msgSender(),
            currentTokenId
        );

        // Update mapping in storage
        users[_msgSender()].nftAddress = _nftAddress;
        users[_msgSender()].tokenId = _tokenId;

        emit UserUpdate(_msgSender(), _nftAddress, _tokenId);
    }

    /**
     * @dev To reactivate user profile.
     * Callable only by registered users.
     */
    function reactivateProfile(address _nftAddress, uint256 _tokenId) external {
        require(hasRegistered[_msgSender()], "Has not registered");
        require(hasRole(NFT_ROLE, _nftAddress), "NFT address invalid");
        require(!users[_msgSender()].isActive, "User is active");

        // Interface to deposit the NFT contract
        IERC721 nftToken = IERC721(_nftAddress);
        require(
            _msgSender() == nftToken.ownerOf(_tokenId),
            "Only NFT owner can update"
        );

        // Transfer to this address
        runeToken.safeTransferFrom(
            _msgSender(),
            address(this),
            numberRuneToReactivate
        );

        // Transfer NFT to contract
        nftToken.safeTransferFrom(_msgSender(), address(this), _tokenId);

        // Retrieve teamId of the user
        uint256 userTeamId = users[_msgSender()].teamId;

        // Update number of users for the team and number of active profiles
        teams[userTeamId].numberUsers = teams[userTeamId].numberUsers.add(1);
        numberActiveProfiles = numberActiveProfiles.add(1);

        // Update user statuses
        users[_msgSender()].isActive = true;
        users[_msgSender()].nftAddress = _nftAddress;
        users[_msgSender()].tokenId = _tokenId;

        // Emit event
        emit UserReactivate(_msgSender(), userTeamId, _nftAddress, _tokenId);
    }

    /**
     * @dev To increase the number of points for a user.
     * Callable only by point admins
     */
    function increaseUserPoints(
        address _userAddress,
        uint256 _numberPoints,
        uint256 _campaignId
    ) external onlyPoint {
        // Increase the number of points for the user
        users[_userAddress].numberPoints = users[_userAddress].numberPoints.add(
            _numberPoints
        );

        emit UserPointIncrease(_userAddress, _numberPoints, _campaignId);
    }

    /**
     * @dev To increase the number of points for a set of users.
     * Callable only by point admins
     */
    function increaseUserPointsMultiple(
        address[] calldata _userAddresses,
        uint256 _numberPoints,
        uint256 _campaignId
    ) external onlyPoint {
        require(_userAddresses.length < 1001, "Length must be < 1001");
        for (uint256 i = 0; i < _userAddresses.length; i++) {
            users[_userAddresses[i]].numberPoints = users[_userAddresses[i]]
                .numberPoints
                .add(_numberPoints);
        }
        emit UserPointIncreaseMultiple(
            _userAddresses,
            _numberPoints,
            _campaignId
        );
    }

    /**
     * @dev To increase the number of points for a team.
     * Callable only by point admins
     */

    function increaseTeamPoints(
        uint256 _teamId,
        uint256 _numberPoints,
        uint256 _campaignId
    ) external onlyPoint {
        // Increase the number of points for the team
        teams[_teamId].numberPoints = teams[_teamId].numberPoints.add(
            _numberPoints
        );

        emit TeamPointIncrease(_teamId, _numberPoints, _campaignId);
    }

    /**
     * @dev To remove the number of points for a user.
     * Callable only by point admins
     */
    function removeUserPoints(address _userAddress, uint256 _numberPoints)
        external
        onlyPoint
    {
        // Increase the number of points for the user
        users[_userAddress].numberPoints = users[_userAddress].numberPoints.sub(
            _numberPoints
        );
    }

    /**
     * @dev To remove a set number of points for a set of users.
     */
    function removeUserPointsMultiple(
        address[] calldata _userAddresses,
        uint256 _numberPoints
    ) external onlyPoint {
        require(_userAddresses.length < 1001, "Length must be < 1001");
        for (uint256 i = 0; i < _userAddresses.length; i++) {
            users[_userAddresses[i]].numberPoints = users[_userAddresses[i]]
                .numberPoints
                .sub(_numberPoints);
        }
    }

    /**
     * @dev To remove the number of points for a team.
     * Callable only by point admins
     */

    function removeTeamPoints(uint256 _teamId, uint256 _numberPoints)
        external
        onlyPoint
    {
        // Increase the number of points for the team
        teams[_teamId].numberPoints = teams[_teamId].numberPoints.sub(
            _numberPoints
        );
    }

    /**
     * @dev To add a NFT contract address for users to set their profile.
     * Callable only by owner admins.
     */
    function addNftAddress(address _nftAddress) external onlyOwner {
        require(
            IERC721(_nftAddress).supportsInterface(0x80ac58cd),
            "Not ERC721"
        );
        grantRole(NFT_ROLE, _nftAddress);
    }

    /**
     * @dev Add a new teamId
     * Callable only by owner admins.
     */
    function addTeam(
        string calldata _teamName,
        string calldata _teamDescription
    ) external onlyOwner {
        // Verify length is between 3 and 16
        bytes memory strBytes = bytes(_teamName);
        require(strBytes.length < 20, "Must be < 20");
        require(strBytes.length > 3, "Must be > 3");

        // Increment the _countTeams counter and get teamId
        _countTeams.increment();
        uint256 newTeamId = _countTeams.current();

        // Add new team data to the struct
        teams[newTeamId] = Team({
            teamName: _teamName,
            teamDescription: _teamDescription,
            numberUsers: 0,
            numberPoints: 0,
            isJoinable: true
        });

        numberTeams = newTeamId;
        emit TeamAdd(newTeamId, _teamName);
    }

    /**
     * @dev Function to change team.
     * Callable only by special admins.
     */
    function changeTeam(address _userAddress, uint256 _newTeamId)
        external
        onlySpecial
    {
        require(hasRegistered[_userAddress], "User doesn't exist");
        require(
            (_newTeamId <= numberTeams) && (_newTeamId > 0),
            "teamId doesn't exist"
        );
        require(teams[_newTeamId].isJoinable, "Team not joinable");
        require(
            users[_userAddress].teamId != _newTeamId,
            "Already in the team"
        );

        // Get old teamId
        uint256 oldTeamId = users[_userAddress].teamId;

        // Change number of users in old team
        teams[oldTeamId].numberUsers = teams[oldTeamId].numberUsers.sub(1);

        // Change teamId in user mapping
        users[_userAddress].teamId = _newTeamId;

        // Change number of users in new team
        teams[_newTeamId].numberUsers = teams[_newTeamId].numberUsers.add(1);

        emit UserChangeTeam(_userAddress, oldTeamId, _newTeamId);
    }

    /**
     * @dev Claim RUNE to burn later.
     * Callable only by owner admins.
     */
    function claimFee(uint256 _amount) external onlyOwner {
        runeToken.safeTransfer(_msgSender(), _amount);
    }

    /**
     * @dev Make a team joinable again.
     * Callable only by owner admins.
     */
    function makeTeamJoinable(uint256 _teamId) external onlyOwner {
        require((_teamId <= numberTeams) && (_teamId > 0), "teamId invalid");
        teams[_teamId].isJoinable = true;
    }

    /**
     * @dev Make a team not joinable.
     * Callable only by owner admins.
     */
    function makeTeamNotJoinable(uint256 _teamId) external onlyOwner {
        require((_teamId <= numberTeams) && (_teamId > 0), "teamId invalid");
        teams[_teamId].isJoinable = false;
    }

    /**
     * @dev Rename a team
     * Callable only by owner admins.
     */
    function renameTeam(
        uint256 _teamId,
        string calldata _teamName,
        string calldata _teamDescription
    ) external onlyOwner {
        require((_teamId <= numberTeams) && (_teamId > 0), "teamId invalid");

        // Verify length is between 3 and 16
        bytes memory strBytes = bytes(_teamName);
        require(strBytes.length < 20, "Must be < 20");
        require(strBytes.length > 3, "Must be > 3");

        teams[_teamId].teamName = _teamName;
        teams[_teamId].teamDescription = _teamDescription;
    }

    /**
     * @dev Update the number of RUNE to register
     * Callable only by owner admins.
     */
    function updateNumberRune(
        uint256 _newNumberRuneToReactivate,
        uint256 _newNumberRuneToRegister,
        uint256 _newNumberRuneToUpdate
    ) external onlyOwner {
        numberRuneToReactivate = _newNumberRuneToReactivate;
        numberRuneToRegister = _newNumberRuneToRegister;
        numberRuneToUpdate = _newNumberRuneToUpdate;
    }

    /**
     * @dev Check the user's profile for a given address
     */
    function getUserProfile(address _userAddress)
        external
        view
        returns (
            uint256,
            uint256,
            uint256,
            address,
            uint256,
            bool
        )
    {
        require(hasRegistered[_userAddress], "Not registered");
        return (
            users[_userAddress].userId,
            users[_userAddress].numberPoints,
            users[_userAddress].teamId,
            users[_userAddress].nftAddress,
            users[_userAddress].tokenId,
            users[_userAddress].isActive
        );
    }

    /**
     * @dev Check the user's status for a given address
     */
    function getUserStatus(address _userAddress) external view returns (bool) {
        return (users[_userAddress].isActive);
    }

    /**
     * @dev Check a team's profile
     */
    function getTeamProfile(uint256 _teamId)
        external
        view
        returns (
            string memory,
            string memory,
            uint256,
            uint256,
            bool
        )
    {
        require((_teamId <= numberTeams) && (_teamId > 0), "teamId invalid");
        return (
            teams[_teamId].teamName,
            teams[_teamId].teamDescription,
            teams[_teamId].numberUsers,
            teams[_teamId].numberPoints,
            teams[_teamId].isJoinable
        );
    }
}

File 9 of 27 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <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 GSN 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 payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

File 10 of 27 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <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;
        // solhint-disable-next-line no-inline-assembly
        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");

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private 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

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 11 of 27 : BEP20.sol
pragma solidity >=0.4.0;

import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/GSN/Context.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import './IBEP20.sol';

/**
 * @dev Implementation of the {IBEP20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {BEP20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-BEP20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin guidelines: functions revert instead
 * of returning `false` on failure. This behavior is nonetheless conventional
 * and does not conflict with the expectations of BEP20 applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IBEP20-approve}.
 */
contract BEP20 is Context, IBEP20, Ownable {
    using SafeMath for uint256;
    using Address for address;

    mapping(address => uint256) internal _balances;

    mapping(address => mapping(address => uint256)) internal _allowances;

    uint256 internal _totalSupply;

    string private _name;
    string private _symbol;
    uint8 private _decimals;

    /**
     * @dev Sets the values for {name} and {symbol}, initializes {decimals} with
     * a default value of 18.
     *
     * To select a different value for {decimals}, use {_setupDecimals}.
     *
     * All three of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name, string memory symbol) public {
        _name = name;
        _symbol = symbol;
        _decimals = 18;
    }

    /**
     * @dev Returns the bep token owner.
     */
    function getOwner() external override view returns (address) {
        return owner();
    }

    /**
     * @dev Returns the token name.
     */
    function name() public override view returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the token decimals.
     */
    function decimals() public override view returns (uint8) {
        return _decimals;
    }

    /**
     * @dev Returns the token symbol.
     */
    function symbol() public override view returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {BEP20-totalSupply}.
     */
    function totalSupply() public override view returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {BEP20-balanceOf}.
     */
    function balanceOf(address account) public override view returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {BEP20-transfer}.
     *
     * Requirements:
     *
     * - `recipient` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(_msgSender(), recipient, amount);
        return true;
    }

    /**
     * @dev See {BEP20-allowance}.
     */
    function allowance(address owner, address spender) public override view returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {BEP20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {BEP20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {BEP20};
     *
     * Requirements:
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for `sender`'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);
        _approve(
            sender,
            _msgSender(),
            _allowances[sender][_msgSender()].sub(amount, 'BEP20: transfer amount exceeds allowance')
        );
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {BEP20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {BEP20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
        _approve(
            _msgSender(),
            spender,
            _allowances[_msgSender()][spender].sub(subtractedValue, 'BEP20: decreased allowance below zero')
        );
        return true;
    }

    /**
     * @dev Creates `amount` tokens and assigns them to `msg.sender`, increasing
     * the total supply.
     *
     * Requirements
     *
     * - `msg.sender` must be the token owner
     */
    function mint(uint256 amount) public onlyOwner returns (bool) {
        _mint(_msgSender(), amount);
        return true;
    }

    /**
     * @dev Moves tokens `amount` from `sender` to `recipient`.
     *
     * This is internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `sender` cannot be the zero address.
     * - `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     */
    function _transfer(
        address sender,
        address recipient,
        uint256 amount
    ) internal virtual {
        require(sender != address(0), 'BEP20: transfer from the zero address');
        require(recipient != address(0), 'BEP20: transfer to the zero address');

        _balances[sender] = _balances[sender].sub(amount, 'BEP20: transfer amount exceeds balance');
        _balances[recipient] = _balances[recipient].add(amount);
        emit Transfer(sender, recipient, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements
     *
     * - `to` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), 'BEP20: mint to the zero address');

        _totalSupply = _totalSupply.add(amount);
        _balances[account] = _balances[account].add(amount);
        emit Transfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal {
        require(account != address(0), 'BEP20: burn from the zero address');

        _balances[account] = _balances[account].sub(amount, 'BEP20: burn amount exceeds balance');
        _totalSupply = _totalSupply.sub(amount);
        emit Transfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
     *
     * This is internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal {
        require(owner != address(0), 'BEP20: approve from the zero address');
        require(spender != address(0), 'BEP20: approve to the zero address');

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`.`amount` is then deducted
     * from the caller's allowance.
     *
     * See {_burn} and {_approve}.
     */
    function _burnFrom(address account, uint256 amount) internal {
        _burn(account, amount);
        _approve(
            account,
            _msgSender(),
            _allowances[account][_msgSender()].sub(amount, 'BEP20: burn amount exceeds allowance')
        );
    }
}

File 12 of 27 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

File 13 of 27 : ArcaneItemMintingStation.sol
pragma solidity ^0.6.0;

import "@openzeppelin/contracts/math/SafeMath.sol";
import "./lib/token/BEP20/IBEP20.sol";
import "./lib/token/BEP20/SafeBEP20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";

import "./ArcaneItems.sol";

/** @title ArcaneItemMintingStation.
@dev It is a contract that allow different factories to mint
Arcane Collectibles/Items.
*/

contract ArcaneItemMintingStation is AccessControl {
    ArcaneItems public arcaneItems;

    bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");

    // Modifier for minting roles
    modifier onlyMinter() {
        require(hasRole(MINTER_ROLE, _msgSender()), "Not a minting role");
        _;
    }

    // Modifier for admin roles
    modifier onlyOwner() {
        require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "Not an admin role");
        _;
    }

    constructor(ArcaneItems _arcaneItems) public {
        arcaneItems = _arcaneItems;
        _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
    }

    /**
     * @dev Mint NFTs from the ArcaneItems contract.
     * Users can specify what itemId they want to mint. Users can claim once.
     * There is a limit on how many are distributed. It requires RUNE balance to be > 0.
     */
    function mint(
        address _tokenReceiver,
        string calldata _tokenURI,
        uint16 _itemId,
        uint256 _tokenId
    ) external onlyMinter returns (uint256) {
        uint256 tokenId =
            arcaneItems.mint(_tokenReceiver, _tokenURI, _itemId, _tokenId);
        return tokenId;
    }

    /**
     * @dev Set up names for items.
     * Only the main admins can set it.
     */
    function setItemName(uint8 _itemId, string calldata _itemName)
        external
        onlyOwner
    {
        arcaneItems.setItemName(_itemId, _itemName);
    }

    /**
     * @dev It transfers the ownership of the NFT contract
     * to a new address.
     * Only the main admins can set it.
     */
    function changeOwnershipNFTContract(address _newOwner) external onlyOwner {
        arcaneItems.transferOwnership(_newOwner);
    }
}

File 14 of 27 : ArcaneItems.sol
pragma solidity 0.6.12;

import "@openzeppelin/contracts/math/SafeMath.sol";
import "./lib/token/BEP20/IBEP20.sol";
import "./lib/token/BEP20/SafeBEP20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";

contract ArcaneItems is ERC721, Ownable {
    using Counters for Counters.Counter;

    // Map the number of tokens per itemId
    mapping(uint16 => uint256) public itemCount;

    // Map the number of tokens burnt per itemId
    mapping(uint16 => uint256) public itemBurnCount;

    // Used for generating the tokenId of new NFT minted
    // Counters.Counter private _tokenIds;

    // Map the itemId for each tokenId
    mapping(uint256 => uint16) public itemIds;

    // Map the itemName for a tokenId
    mapping(uint16 => string) public itemNames;

    constructor(string memory _baseURI) public ERC721("Arcane Items", "AI") {
        _setBaseURI(_baseURI);
    }

    /**
     * @dev Get itemId for a specific tokenId.
     */
    function getItemId(uint256 _tokenId) external view returns (uint16) {
        return itemIds[_tokenId];
    }

    /**
     * @dev Get the associated itemName for a specific itemId.
     */
    function getItemName(uint16 _itemId)
        external
        view
        returns (string memory)
    {
        return itemNames[_itemId];
    }

    /**
     * @dev Get the associated itemName for a unique tokenId.
     */
    function getItemNameOfTokenId(uint256 _tokenId)
        external
        view
        returns (string memory)
    {
        uint16 itemId = itemIds[_tokenId];
        return itemNames[itemId];
    }

    /**
     * @dev Mint NFTs. Only the owner can call it.
     */
    function mint(
        address _to,
        string calldata _tokenURI,
        uint16 _itemId,
        uint256 _tokenId
    ) external onlyOwner returns (uint256) {
        // uint256 newId = _tokenIds.current();
        // _tokenIds.increment();
        itemIds[_tokenId] = _itemId;
        itemCount[_itemId] = itemCount[_itemId].add(1);
        _mint(_to, _tokenId);
        _setTokenURI(_tokenId, _tokenURI);
        return _tokenId;
    }

    /**
     * @dev Set a unique name for each itemId. It is supposed to be called once.
     */
    function setItemName(uint16 _itemId, string calldata _name)
        external
        onlyOwner
    {
        itemNames[_itemId] = _name;
    }

    /**
     * @dev Burn a NFT token. Callable by owner only.
     */
    function burn(uint256 _tokenId) external onlyOwner {
        uint16 itemIdBurnt = itemIds[_tokenId];
        itemCount[itemIdBurnt] = itemCount[itemIdBurnt].sub(1);
        itemBurnCount[itemIdBurnt] = itemBurnCount[itemIdBurnt].add(1);
        _burn(_tokenId);
    }
}

File 15 of 27 : AccessControl.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControl is Context {
    using EnumerableSet for EnumerableSet.AddressSet;
    using Address for address;

    struct RoleData {
        EnumerableSet.AddressSet members;
        bytes32 adminRole;
    }

    mapping (bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view returns (bool) {
        return _roles[role].members.contains(account);
    }

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) public view returns (uint256) {
        return _roles[role].members.length();
    }

    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) public view returns (address) {
        return _roles[role].members.at(index);
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) public virtual {
        require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to grant");

        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) public virtual {
        require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to revoke");

        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) public virtual {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        emit RoleAdminChanged(role, _roles[role].adminRole, adminRole);
        _roles[role].adminRole = adminRole;
    }

    function _grantRole(bytes32 role, address account) private {
        if (_roles[role].members.add(account)) {
            emit RoleGranted(role, account, _msgSender());
        }
    }

    function _revokeRole(bytes32 role, address account) private {
        if (_roles[role].members.remove(account)) {
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

File 16 of 27 : EnumerableSet.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;

        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping (bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) { // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
            // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.

            bytes32 lastvalue = set._values[lastIndex];

            // Move the last value to the index where the value to delete is
            set._values[toDeleteIndex] = lastvalue;
            // Update the index for the moved value
            set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        require(set._values.length > index, "EnumerableSet: index out of bounds");
        return set._values[index];
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }


    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }
}

File 17 of 27 : ERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "../../utils/Context.sol";
import "./IERC721.sol";
import "./IERC721Metadata.sol";
import "./IERC721Enumerable.sol";
import "./IERC721Receiver.sol";
import "../../introspection/ERC165.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.sol";
import "../../utils/EnumerableSet.sol";
import "../../utils/EnumerableMap.sol";
import "../../utils/Strings.sol";

/**
 * @title ERC721 Non-Fungible Token Standard basic implementation
 * @dev see https://eips.ethereum.org/EIPS/eip-721
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
    using SafeMath for uint256;
    using Address for address;
    using EnumerableSet for EnumerableSet.UintSet;
    using EnumerableMap for EnumerableMap.UintToAddressMap;
    using Strings for uint256;

    // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
    // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector`
    bytes4 private constant _ERC721_RECEIVED = 0x150b7a02;

    // Mapping from holder address to their (enumerable) set of owned tokens
    mapping (address => EnumerableSet.UintSet) private _holderTokens;

    // Enumerable mapping from token ids to their owners
    EnumerableMap.UintToAddressMap private _tokenOwners;

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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

    // Base URI
    string private _baseURI;

    /*
     *     bytes4(keccak256('balanceOf(address)')) == 0x70a08231
     *     bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e
     *     bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3
     *     bytes4(keccak256('getApproved(uint256)')) == 0x081812fc
     *     bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465
     *     bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5
     *     bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd
     *     bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e
     *     bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde
     *
     *     => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^
     *        0xa22cb465 ^ 0xe985e9c5 ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd
     */
    bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd;

    /*
     *     bytes4(keccak256('name()')) == 0x06fdde03
     *     bytes4(keccak256('symbol()')) == 0x95d89b41
     *     bytes4(keccak256('tokenURI(uint256)')) == 0xc87b56dd
     *
     *     => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f
     */
    bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f;

    /*
     *     bytes4(keccak256('totalSupply()')) == 0x18160ddd
     *     bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) == 0x2f745c59
     *     bytes4(keccak256('tokenByIndex(uint256)')) == 0x4f6ccce7
     *
     *     => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63
     */
    bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63;

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

        // register the supported interfaces to conform to ERC721 via ERC165
        _registerInterface(_INTERFACE_ID_ERC721);
        _registerInterface(_INTERFACE_ID_ERC721_METADATA);
        _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE);
    }

    /**
     * @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 _holderTokens[owner].length();
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        return _tokenOwners.get(tokenId, "ERC721: owner query for nonexistent token");
    }

    /**
     * @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 _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));
        }
        // If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI.
        return string(abi.encodePacked(base, tokenId.toString()));
    }

    /**
    * @dev Returns the base URI set via {_setBaseURI}. This will be
    * automatically added as a prefix in {tokenURI} to each token's URI, or
    * to the token ID if no specific URI is set for that token ID.
    */
    function baseURI() public view virtual returns (string memory) {
        return _baseURI;
    }

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
        return _holderTokens[owner].at(index);
    }

    /**
     * @dev See {IERC721Enumerable-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        // _tokenOwners are indexed by tokenIds, so .length() returns the number of tokenIds
        return _tokenOwners.length();
    }

    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
        (uint256 tokenId, ) = _tokenOwners.at(index);
        return tokenId;
    }

    /**
     * @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 || ERC721.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 _tokenOwners.contains(tokenId);
    }

    /**
     * @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 || ERC721.isApprovedForAll(owner, spender));
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     d*
     * - `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);

        _holderTokens[to].add(tokenId);

        _tokenOwners.set(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); // internal owner

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

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

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

        _holderTokens[owner].remove(tokenId);

        _tokenOwners.remove(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"); // internal owner
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

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

        _holderTokens[from].remove(tokenId);
        _holderTokens[to].add(tokenId);

        _tokenOwners.set(tokenId, to);

        emit Transfer(from, to, 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), "ERC721Metadata: URI set of nonexistent token");
        _tokenURIs[tokenId] = _tokenURI;
    }

    /**
     * @dev Internal function to set the base URI for all token IDs. It is
     * automatically added as a prefix to the value returned in {tokenURI},
     * or to the token ID if {tokenURI} is empty.
     */
    function _setBaseURI(string memory baseURI_) internal virtual {
        _baseURI = baseURI_;
    }

    /**
     * @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()) {
            return true;
        }
        bytes memory returndata = to.functionCall(abi.encodeWithSelector(
            IERC721Receiver(to).onERC721Received.selector,
            _msgSender(),
            from,
            tokenId,
            _data
        ), "ERC721: transfer to non ERC721Receiver implementer");
        bytes4 retval = abi.decode(returndata, (bytes4));
        return (retval == _ERC721_RECEIVED);
    }

    function _approve(address to, uint256 tokenId) private {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721.ownerOf(tokenId), to, tokenId); // internal owner
    }

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

File 18 of 27 : Counters.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "../math/SafeMath.sol";

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented or decremented by one. 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;`
 * Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the {SafeMath}
 * overflow check, thereby saving gas. This does assume however correct usage, in that the underlying `_value` is never
 * directly accessed.
 */
library Counters {
    using SafeMath for uint256;

    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 {
        // The {SafeMath} overflow check can be skipped here, see the comment at the top
        counter._value += 1;
    }

    function decrement(Counter storage counter) internal {
        counter._value = counter._value.sub(1);
    }
}

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

pragma solidity >=0.6.2 <0.8.0;

import "../../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 20 of 27 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <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 21 of 27 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <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);
}

File 22 of 27 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <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 23 of 27 : ERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts may inherit from this and call {_registerInterface} to declare
 * their support of an interface.
 */
abstract contract ERC165 is IERC165 {
    /*
     * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7
     */
    bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;

    /**
     * @dev Mapping of interface ids to whether or not it's supported.
     */
    mapping(bytes4 => bool) private _supportedInterfaces;

    constructor () internal {
        // Derived contracts need only register support for their own interfaces,
        // we register support for ERC165 itself here
        _registerInterface(_INTERFACE_ID_ERC165);
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     *
     * Time complexity O(1), guaranteed to always use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return _supportedInterfaces[interfaceId];
    }

    /**
     * @dev Registers the contract as an implementer of the interface defined by
     * `interfaceId`. Support of the actual ERC165 interface is automatic and
     * registering its interface id is not required.
     *
     * See {IERC165-supportsInterface}.
     *
     * Requirements:
     *
     * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).
     */
    function _registerInterface(bytes4 interfaceId) internal virtual {
        require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
        _supportedInterfaces[interfaceId] = true;
    }
}

File 24 of 27 : EnumerableMap.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Library for managing an enumerable variant of Solidity's
 * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]
 * type.
 *
 * Maps have the following properties:
 *
 * - Entries are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Entries are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableMap for EnumerableMap.UintToAddressMap;
 *
 *     // Declare a set state variable
 *     EnumerableMap.UintToAddressMap private myMap;
 * }
 * ```
 *
 * As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are
 * supported.
 */
library EnumerableMap {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Map type with
    // bytes32 keys and values.
    // The Map implementation uses private functions, and user-facing
    // implementations (such as Uint256ToAddressMap) are just wrappers around
    // the underlying Map.
    // This means that we can only create new EnumerableMaps for types that fit
    // in bytes32.

    struct MapEntry {
        bytes32 _key;
        bytes32 _value;
    }

    struct Map {
        // Storage of map keys and values
        MapEntry[] _entries;

        // Position of the entry defined by a key in the `entries` array, plus 1
        // because index 0 means a key is not in the map.
        mapping (bytes32 => uint256) _indexes;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function _set(Map storage map, bytes32 key, bytes32 value) private returns (bool) {
        // We read and store the key's index to prevent multiple reads from the same storage slot
        uint256 keyIndex = map._indexes[key];

        if (keyIndex == 0) { // Equivalent to !contains(map, key)
            map._entries.push(MapEntry({ _key: key, _value: value }));
            // The entry is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            map._indexes[key] = map._entries.length;
            return true;
        } else {
            map._entries[keyIndex - 1]._value = value;
            return false;
        }
    }

    /**
     * @dev Removes a key-value pair from a map. O(1).
     *
     * Returns true if the key was removed from the map, that is if it was present.
     */
    function _remove(Map storage map, bytes32 key) private returns (bool) {
        // We read and store the key's index to prevent multiple reads from the same storage slot
        uint256 keyIndex = map._indexes[key];

        if (keyIndex != 0) { // Equivalent to contains(map, key)
            // To delete a key-value pair from the _entries array in O(1), we swap the entry to delete with the last one
            // in the array, and then remove the last entry (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = keyIndex - 1;
            uint256 lastIndex = map._entries.length - 1;

            // When the entry to delete is the last one, the swap operation is unnecessary. However, since this occurs
            // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.

            MapEntry storage lastEntry = map._entries[lastIndex];

            // Move the last entry to the index where the entry to delete is
            map._entries[toDeleteIndex] = lastEntry;
            // Update the index for the moved entry
            map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based

            // Delete the slot where the moved entry was stored
            map._entries.pop();

            // Delete the index for the deleted slot
            delete map._indexes[key];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the key is in the map. O(1).
     */
    function _contains(Map storage map, bytes32 key) private view returns (bool) {
        return map._indexes[key] != 0;
    }

    /**
     * @dev Returns the number of key-value pairs in the map. O(1).
     */
    function _length(Map storage map) private view returns (uint256) {
        return map._entries.length;
    }

   /**
    * @dev Returns the key-value pair stored at position `index` in the map. O(1).
    *
    * Note that there are no guarantees on the ordering of entries inside the
    * array, and it may change when more entries are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function _at(Map storage map, uint256 index) private view returns (bytes32, bytes32) {
        require(map._entries.length > index, "EnumerableMap: index out of bounds");

        MapEntry storage entry = map._entries[index];
        return (entry._key, entry._value);
    }

    /**
     * @dev Tries to returns the value associated with `key`.  O(1).
     * Does not revert if `key` is not in the map.
     */
    function _tryGet(Map storage map, bytes32 key) private view returns (bool, bytes32) {
        uint256 keyIndex = map._indexes[key];
        if (keyIndex == 0) return (false, 0); // Equivalent to contains(map, key)
        return (true, map._entries[keyIndex - 1]._value); // All indexes are 1-based
    }

    /**
     * @dev Returns the value associated with `key`.  O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function _get(Map storage map, bytes32 key) private view returns (bytes32) {
        uint256 keyIndex = map._indexes[key];
        require(keyIndex != 0, "EnumerableMap: nonexistent key"); // Equivalent to contains(map, key)
        return map._entries[keyIndex - 1]._value; // All indexes are 1-based
    }

    /**
     * @dev Same as {_get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {_tryGet}.
     */
    function _get(Map storage map, bytes32 key, string memory errorMessage) private view returns (bytes32) {
        uint256 keyIndex = map._indexes[key];
        require(keyIndex != 0, errorMessage); // Equivalent to contains(map, key)
        return map._entries[keyIndex - 1]._value; // All indexes are 1-based
    }

    // UintToAddressMap

    struct UintToAddressMap {
        Map _inner;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) {
        return _set(map._inner, bytes32(key), bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the key was removed from the map, that is if it was present.
     */
    function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) {
        return _remove(map._inner, bytes32(key));
    }

    /**
     * @dev Returns true if the key is in the map. O(1).
     */
    function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) {
        return _contains(map._inner, bytes32(key));
    }

    /**
     * @dev Returns the number of elements in the map. O(1).
     */
    function length(UintToAddressMap storage map) internal view returns (uint256) {
        return _length(map._inner);
    }

   /**
    * @dev Returns the element stored at position `index` in the set. O(1).
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) {
        (bytes32 key, bytes32 value) = _at(map._inner, index);
        return (uint256(key), address(uint160(uint256(value))));
    }

    /**
     * @dev Tries to returns the value associated with `key`.  O(1).
     * Does not revert if `key` is not in the map.
     *
     * _Available since v3.4._
     */
    function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) {
        (bool success, bytes32 value) = _tryGet(map._inner, bytes32(key));
        return (success, address(uint160(uint256(value))));
    }

    /**
     * @dev Returns the value associated with `key`.  O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(UintToAddressMap storage map, uint256 key) internal view returns (address) {
        return address(uint160(uint256(_get(map._inner, bytes32(key)))));
    }

    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryGet}.
     */
    function get(UintToAddressMap storage map, uint256 key, string memory errorMessage) internal view returns (address) {
        return address(uint160(uint256(_get(map._inner, bytes32(key), errorMessage))));
    }
}

File 25 of 27 : Strings.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    /**
     * @dev Converts a `uint256` to its ASCII `string` 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);
        uint256 index = digits - 1;
        temp = value;
        while (temp != 0) {
            buffer[index--] = bytes1(uint8(48 + temp % 10));
            temp /= 10;
        }
        return string(buffer);
    }
}

File 26 of 27 : IERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <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 27 of 27 : ERC721Holder.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <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;
    }
}

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

Contract ABI

[{"inputs":[{"internalType":"contract IthRune","name":"_rune","type":"address"},{"internalType":"address","name":"_profileAddress","type":"address"},{"internalType":"address","name":"_itemMintingStationAddress","type":"address"},{"internalType":"address","name":"_itemsAddress","type":"address"},{"internalType":"address","name":"_devAddress","type":"address"},{"internalType":"address","name":"_vaultAddress","type":"address"},{"internalType":"address","name":"_charityAddress","type":"address"},{"internalType":"address","name":"_voidAddress","type":"address"},{"internalType":"uint256","name":"_runePerBlock","type":"uint256"},{"internalType":"uint256","name":"_startBlock","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"HarvestBonus","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"HarvestFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"BONUS_MULTIPLIER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"_unequipItem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_allocPoint","type":"uint256"},{"internalType":"contract IBEP20","name":"_lpToken","type":"address"},{"internalType":"uint16","name":"_depositFeeBP","type":"uint16"},{"internalType":"bool","name":"_withUpdate","type":"bool"}],"name":"add","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"charityAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"charityDepositPercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"charityMintPercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"devAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"devDepositPercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"devMintPercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"elToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"equipItem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getItem","outputs":[{"components":[{"internalType":"uint16","name":"version","type":"uint16"},{"internalType":"uint16","name":"itemId","type":"uint16"},{"components":[{"internalType":"uint8","name":"variant","type":"uint8"},{"internalType":"uint16","name":"value","type":"uint16"}],"internalType":"struct ArcaneItemFactoryV1.ArcaneItemModifier[]","name":"mods","type":"tuple[]"}],"internalType":"struct ArcaneItemFactoryV1.ArcaneItem","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_from","type":"uint256"},{"internalType":"uint256","name":"_to","type":"uint256"}],"name":"getMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"begin","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"},{"internalType":"string","name":"text","type":"string"}],"name":"getSlice","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"hiddenPoolPid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"itemMintingStationAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"itemsAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ithToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"massUpdatePools","outputs":[],"stateMutability":"nonpayable","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":"_pid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"pendingRune","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolInfo","outputs":[{"internalType":"contract IBEP20","name":"lpToken","type":"address"},{"internalType":"uint256","name":"allocPoint","type":"uint256"},{"internalType":"uint256","name":"lastRewardBlock","type":"uint256"},{"internalType":"uint256","name":"accRunePerShare","type":"uint256"},{"internalType":"uint16","name":"depositFeeBP","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"profileAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"randNonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rune","outputs":[{"internalType":"contract IthRune","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"runePerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"runeToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_allocPoint","type":"uint256"},{"internalType":"uint16","name":"_depositFeeBP","type":"uint16"},{"internalType":"bool","name":"_withUpdate","type":"bool"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"setHiddenPoolPid","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vaultAddress","type":"address"},{"internalType":"address","name":"_charityAddress","type":"address"},{"internalType":"address","name":"_devAddress","type":"address"},{"internalType":"uint256","name":"_vaultMintPercent","type":"uint256"},{"internalType":"uint256","name":"_charityMintPercent","type":"uint256"},{"internalType":"uint256","name":"_devMintPercent","type":"uint256"},{"internalType":"uint256","name":"_vaultDepositPercent","type":"uint256"},{"internalType":"uint256","name":"_charityDepositPercent","type":"uint256"},{"internalType":"uint256","name":"_devDepositPercent","type":"uint256"}],"name":"setInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_runeToken","type":"address"},{"internalType":"address","name":"_elToken","type":"address"},{"internalType":"address","name":"_tirToken","type":"address"}],"name":"setRuneAddresses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"throwRuneInTheVoid","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"tirToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAllocPoint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_runePerBlock","type":"uint256"}],"name":"updateEmissionRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"updatePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userEquippedItemMap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"rewardDebt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vaultAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vaultDepositPercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vaultMintPercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"voidAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405260006009556000600a556000600b556000600c556000600d556000600e556000601655601c6019553480156200003957600080fd5b50604051620062673803806200626783398181016040528101906200005f9190620004c2565b6000620000716200047560201b60201c565b9050806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35089600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555088600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555087600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555086600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555085600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555084600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555083600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550816004819055508060178190555073a9776b590bfc2f956711b3419910a5ec1f63153e601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555073210c14fbecc2bd9b6231199470da12ad45f64d45601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555073125a3e00a9a11317d4d95349e68ba0bc744addc4601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555089601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050505050505050505062000652565b600033905090565b6000815190506200048e8162000604565b92915050565b600081519050620004a5816200061e565b92915050565b600081519050620004bc8162000638565b92915050565b6000806000806000806000806000806101408b8d031215620004e357600080fd5b6000620004f38d828e0162000494565b9a50506020620005068d828e016200047d565b9950506040620005198d828e016200047d565b98505060606200052c8d828e016200047d565b97505060806200053f8d828e016200047d565b96505060a0620005528d828e016200047d565b95505060c0620005658d828e016200047d565b94505060e0620005788d828e016200047d565b9350506101006200058c8d828e01620004ab565b925050610120620005a08d828e01620004ab565b9150509295989b9194979a5092959850565b6000620005bf82620005da565b9050919050565b6000620005d382620005b2565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6200060f81620005b2565b81146200061b57600080fd5b50565b6200062981620005c6565b81146200063557600080fd5b50565b6200064381620005fa565b81146200064f57600080fd5b50565b615c0580620006626000396000f3fe608060405234801561001057600080fd5b50600436106102d65760003560e01c80636c167e0311610182578063afcf2fc4116100e9578063d9638422116100a2578063e2bbb1581161007c578063e2bbb15814610886578063eec99081146108a2578063f2fde38b146108be578063fefb2317146108da576102d6565b8063d96384221461082e578063dbe653671461084a578063de9171ab14610868576102d6565b8063afcf2fc41461077c578063b3a2af6e1461079a578063c091b5eb146107b8578063c1f57bdb146107d4578063d71cac82146107f2578063d8c06d8e14610810576102d6565b80638da5cb5b1161013b5780638da5cb5b146106a35780638dbb1e3a146106c1578063934849f3146106f157806393f1a40b1461070f5780639fd53f2b14610740578063adf12e031461075e576102d6565b80636c167e03146105e1578063715018a6146105ff57806372d0d564146106095780637f60b20a1461063957806384e82a33146106695780638aa2855014610685576102d6565b80633129e77311610241578063441a3e70116101fa5780635312ea8e116101d45780635312ea8e1461057f57806353867a661461059b57806361e01356146105b9578063630b5ba1146105d7576102d6565b8063441a3e701461052957806348cd4cb11461054557806351eb05a614610563576102d6565b80633129e77314610463578063325d33f414610493578063351588bc146104b157806339367bc6146104cf5780633ad10ef6146104ed578063430bf08a1461050b576102d6565b80631615a199116102935780631615a199146103b3578063179b1a71146103d157806317caf6f1146103db578063255d2390146103f95780632cba362a146104295780632f65131414610445576102d6565b8063081e3eda146102db5780630b169d39146102f95780630ba84cd2146103155780630bd0c42914610331578063150b7a021461034f5780631526fe271461037f575b600080fd5b6102e36108f6565b6040516102f09190615869565b60405180910390f35b610313600480360381019061030e91906149b6565b610903565b005b61032f600480360381019061032a91906149b6565b610ade565b005b610339610b6c565b6040516103469190615869565b60405180910390f35b61036960048036038101906103649190614912565b610b72565b604051610376919061553c565b60405180910390f35b610399600480360381019061039491906149b6565b610b86565b6040516103aa959493929190615557565b60405180910390f35b6103bb610bf7565b6040516103c89190615453565b60405180910390f35b6103d9610c1d565b005b6103e3610d6e565b6040516103f09190615869565b60405180910390f35b610413600480360381019061040e9190614a08565b610d74565b6040516104209190615869565b60405180910390f35b610443600480360381019061043e91906149b6565b610fa1565b005b61044d611279565b60405161045a9190615869565b60405180910390f35b61047d600480360381019061047891906149b6565b61127f565b60405161048a9190615847565b60405180910390f35b61049b611468565b6040516104a89190615453565b60405180910390f35b6104b961148e565b6040516104c69190615869565b60405180910390f35b6104d7611494565b6040516104e49190615869565b60405180910390f35b6104f561149a565b6040516105029190615453565b60405180910390f35b6105136114c0565b6040516105209190615453565b60405180910390f35b610543600480360381019061053e9190614aa7565b6114e6565b005b61054d6119af565b60405161055a9190615869565b60405180910390f35b61057d600480360381019061057891906149b6565b6119b5565b005b610599600480360381019061059491906149b6565b611e93565b005b6105a3611fc7565b6040516105b09190615869565b60405180910390f35b6105c1611fcd565b6040516105ce9190615869565b60405180910390f35b6105df611fd3565b005b6105e9612000565b6040516105f69190615453565b60405180910390f35b610607612026565b005b610623600480360381019061061e91906147ab565b612160565b6040516106309190615869565b60405180910390f35b610653600480360381019061064e9190614ae3565b612178565b60405161066091906155c5565b60405180910390f35b610683600480360381019061067e9190614a44565b612244565b005b61068d612448565b60405161069a9190615869565b60405180910390f35b6106ab61244d565b6040516106b89190615453565b60405180910390f35b6106db60048036038101906106d69190614aa7565b612476565b6040516106e89190615869565b60405180910390f35b6106f96124a6565b6040516107069190615453565b60405180910390f35b61072960048036038101906107249190614a08565b6124cc565b604051610737929190615884565b60405180910390f35b6107486124fd565b6040516107559190615453565b60405180910390f35b610766612523565b6040516107739190615869565b60405180910390f35b610784612529565b6040516107919190615453565b60405180910390f35b6107a261254f565b6040516107af9190615453565b60405180910390f35b6107d260048036038101906107cd919061484c565b612575565b005b6107dc61289d565b6040516107e99190615453565b60405180910390f35b6107fa6128c3565b60405161080791906155aa565b60405180910390f35b6108186128e9565b6040516108259190615869565b60405180910390f35b61084860048036038101906108439190614b4a565b6128ef565b005b610852612a70565b60405161085f9190615869565b60405180910390f35b610870612a76565b60405161087d9190615453565b60405180910390f35b6108a0600480360381019061089b9190614aa7565b612a9c565b005b6108bc60048036038101906108b791906149b6565b61359d565b005b6108d860048036038101906108d391906147ab565b613623565b005b6108f460048036038101906108ef91906147fd565b6137cc565b005b6000601480549050905090565b61090b6145c3565b61091b610916613924565b61392c565b9050600115158160a00151151514610968576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161095f906157e7565b60405180910390fd5b6000600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905082601a600061099c613924565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414610a17576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a0e906156e7565b60405180910390fd5b6000601a6000610a25613924565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508073ffffffffffffffffffffffffffffffffffffffff166342842e0e30610a88613924565b866040518463ffffffff1660e01b8152600401610aa7939291906154a5565b600060405180830381600087803b158015610ac157600080fd5b505af1158015610ad5573d6000803e3d6000fd5b50505050505050565b610ae6613924565b73ffffffffffffffffffffffffffffffffffffffff16610b0461244d565b73ffffffffffffffffffffffffffffffffffffffff1614610b5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b51906157c7565b60405180910390fd5b610b62611fd3565b8060048190555050565b600d5481565b600063150b7a0260e01b9050949350505050565b60148181548110610b9357fe5b90600052602060002090600502016000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010154908060020154908060030154908060040160009054906101000a900461ffff16905085565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610cad576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca490615747565b60405180910390fd5b610cb5611fd3565b6000600481905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f2fde38b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff1660e01b8152600401610d3a9190615453565b600060405180830381600087803b158015610d5457600080fd5b505af1158015610d68573d6000803e3d6000fd5b50505050565b60165481565b60008060148481548110610d8457fe5b9060005260206000209060050201905060006015600086815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060008260030154905060008360000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610e509190615453565b60206040518083038186803b158015610e6857600080fd5b505afa158015610e7c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea091906149df565b9050836002015443118015610eb6575060008114155b15610f51576000610ecb856002015443612476565b90506000610f0e601654610f008860010154610ef260045487613a5e90919063ffffffff16565b613a5e90919063ffffffff16565b613ace90919063ffffffff16565b9050610f4c610f3d84610f2f64e8d4a5100085613a5e90919063ffffffff16565b613ace90919063ffffffff16565b85613b2490919063ffffffff16565b935050505b610f958360020154610f8764e8d4a51000610f79868860010154613a5e90919063ffffffff16565b613ace90919063ffffffff16565b613b7990919063ffffffff16565b94505050505092915050565b610fa96145c3565b610fb9610fb4613924565b61392c565b9050600115158160a00151151514611006576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ffd906157e7565b60405180910390fd5b6000600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff16636352211e846040518263ffffffff1660e01b81526004016110669190615869565b60206040518083038186803b15801561107e57600080fd5b505afa158015611092573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b691906147d4565b73ffffffffffffffffffffffffffffffffffffffff166110d4613924565b73ffffffffffffffffffffffffffffffffffffffff161461112a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611121906156a7565b60405180910390fd5b6000601a6000611138613924565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146111b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111aa90615767565b60405180910390fd5b82601a60006111c0613924565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508073ffffffffffffffffffffffffffffffffffffffff166342842e0e611222613924565b30866040518463ffffffff1660e01b81526004016112429392919061546e565b600060405180830381600087803b15801561125c57600080fd5b505af1158015611270573d6000803e3d6000fd5b50505050505050565b600c5481565b611287614611565b606061129283613bc9565b905060006112ab6112a66001600485612178565b613dad565b90506060600367ffffffffffffffff811180156112c757600080fd5b5060405190808252806020026020018201604052801561130157816020015b6112ee61463a565b8152602001906001900390816112e65790505b509050604051806040016040528061132461131f6009600a88612178565b613dad565b60ff16815260200161134161133c600a600d88612178565b613dad565b61ffff168152508160008151811061135557fe5b6020026020010181905250604051806040016040528061138061137b600d600e88612178565b613dad565b60ff16815260200161139d611398600e601188612178565b613dad565b61ffff16815250816001815181106113b157fe5b602002602001018190525060405180604001604052806113dc6113d76011601288612178565b613dad565b60ff1681526020016113f96113f46012601588612178565b613dad565b61ffff168152508160028151811061140d57fe5b6020026020010181905250611420614611565b60405180606001604052808460ff1661ffff16815260200161144d6114486004600989612178565b613dad565b61ffff16815260200183815250905080945050505050919050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60095481565b600b5481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000601483815481106114f557fe5b9060005260206000209060050201905060006015600085815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905082816001015410156115a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159790615827565b60405180910390fd5b6115a9846119b5565b60006115f382600201546115e564e8d4a510006115d787600301548760010154613a5e90919063ffffffff16565b613ace90919063ffffffff16565b613b7990919063ffffffff16565b905060008111156118a7576000601a600061160c613924565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050600081111561189b5761165a614611565b6116638261127f565b90506001816020015161ffff1614801561168557506001816000015161ffff16145b15611899576000816040015160018151811061169d57fe5b60200260200101516020015161ffff1611156117fd576000600182604001516002815181106116c857fe5b60200260200101516020015161ffff16141561170857601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050611782565b6002826040015160028151811061171b57fe5b60200260200101516020015161ffff16141561175b57601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050611781565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690505b5b60006117ca60646117bc856040015160018151811061179d57fe5b60200260200101516020015161ffff1688613a5e90919063ffffffff16565b613ace90919063ffffffff16565b90506117fa8233600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684613dc1565b50505b60006118456064611837846040015160008151811061181857fe5b60200260200101516020015161ffff1687613a5e90919063ffffffff16565b613ace90919063ffffffff16565b9050611897601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff163384613dc1565b505b505b6118a53383613ec3565b505b600084111561191f576118c7848360010154613b7990919063ffffffff16565b826001018190555061191e33858560000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166140e59092919063ffffffff16565b5b61195164e8d4a5100061194385600301548560010154613a5e90919063ffffffff16565b613ace90919063ffffffff16565b8260020181905550843373ffffffffffffffffffffffffffffffffffffffff167ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b568866040516119a09190615869565b60405180910390a35050505050565b60175481565b6000601482815481106119c457fe5b90600052602060002090600502019050806002015443116119e55750611e90565b60008160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611a449190615453565b60206040518083038186803b158015611a5c57600080fd5b505afa158015611a70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a9491906149df565b90506000811480611aa9575060008260010154145b80611ab657506000600454145b15611acb574382600201819055505050611e90565b6000611adb836002015443612476565b90506000611b1e601654611b108660010154611b0260045487613a5e90919063ffffffff16565b613a5e90919063ffffffff16565b613ace90919063ffffffff16565b9050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f19600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611baa612710611b9c60095487613a5e90919063ffffffff16565b613ace90919063ffffffff16565b6040518363ffffffff1660e01b8152600401611bc7929190615513565b600060405180830381600087803b158015611be157600080fd5b505af1158015611bf5573d6000803e3d6000fd5b50505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f19600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611c83612710611c75600a5487613a5e90919063ffffffff16565b613ace90919063ffffffff16565b6040518363ffffffff1660e01b8152600401611ca0929190615513565b600060405180830381600087803b158015611cba57600080fd5b505af1158015611cce573d6000803e3d6000fd5b50505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f19600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611d5c612710611d4e600b5487613a5e90919063ffffffff16565b613ace90919063ffffffff16565b6040518363ffffffff1660e01b8152600401611d79929190615513565b600060405180830381600087803b158015611d9357600080fd5b505af1158015611da7573d6000803e3d6000fd5b50505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f1930836040518363ffffffff1660e01b8152600401611e08929190615513565b600060405180830381600087803b158015611e2257600080fd5b505af1158015611e36573d6000803e3d6000fd5b50505050611e7a611e6784611e5964e8d4a5100085613a5e90919063ffffffff16565b613ace90919063ffffffff16565b8560030154613b2490919063ffffffff16565b8460030181905550438460020181905550505050505b50565b600060148281548110611ea257fe5b9060005260206000209060050201905060006015600084815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090506000816001015490506000826001018190555060008260020181905550611f7233828560000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166140e59092919063ffffffff16565b833373ffffffffffffffffffffffffffffffffffffffff167fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae059583604051611fb99190615869565b60405180910390a350505050565b600e5481565b60185481565b6000601480549050905060005b81811015611ffc57611ff1816119b5565b806001019050611fe0565b5050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61202e613924565b73ffffffffffffffffffffffffffffffffffffffff1661204c61244d565b73ffffffffffffffffffffffffffffffffffffffff16146120a2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612099906157c7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b601a6020528060005260406000206000915090505481565b60608084840367ffffffffffffffff8111801561219457600080fd5b506040519080825280601f01601f1916602001820160405280156121c75781602001600182028036833780820191505090505b50905060005b8585038110156122385783868201815181106121e557fe5b602001015160f81c60f81b8282815181106121fc57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080806001019150506121cd565b50809150509392505050565b61224c613924565b73ffffffffffffffffffffffffffffffffffffffff1661226a61244d565b73ffffffffffffffffffffffffffffffffffffffff16146122c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122b7906157c7565b60405180910390fd5b6127108261ffff161115612309576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612300906155e7565b60405180910390fd5b801561231857612317611fd3565b5b6000601754431161232b5760175461232d565b435b905061234485601654613b2490919063ffffffff16565b60168190555060146040518060a001604052808673ffffffffffffffffffffffffffffffffffffffff168152602001878152602001838152602001600081526020018561ffff16815250908060018154018082558091505060019003906000526020600020906005020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010155604082015181600201556060820151816003015560808201518160040160006101000a81548161ffff021916908361ffff16021790555050505050505050565b600181565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600061249e60016124908585613b7990919063ffffffff16565b613a5e90919063ffffffff16565b905092915050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6015602052816000526040600020602052806000526040600020600091509150508060010154908060020154905082565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600a5481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612605576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125fc90615747565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff161415801561266f5750600073ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff1614155b80156126a85750600073ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff1614155b6126e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126de90615707565b60405180910390fd5b61251c86111580156126fa575060fa8511155b8015612707575060fa8411155b612746576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161273d90615727565b60405180910390fd5b61251c8311158015612759575060fa8211155b8015612766575060fa8111155b6127a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161279c90615727565b60405180910390fd5b88600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555087600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555086600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555085600a8190555084600b819055508360098190555082600d8190555081600e8190555080600c81905550505050505050505050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60045481565b6128f7613924565b73ffffffffffffffffffffffffffffffffffffffff1661291561244d565b73ffffffffffffffffffffffffffffffffffffffff161461296b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612962906157c7565b60405180910390fd5b6127108261ffff1611156129b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129ab906157a7565b60405180910390fd5b80156129c3576129c2611fd3565b5b612a08836129fa601487815481106129d757fe5b906000526020600020906005020160010154601654613b7990919063ffffffff16565b613b2490919063ffffffff16565b6016819055508260148581548110612a1c57fe5b9060005260206000209060050201600101819055508160148581548110612a3f57fe5b906000526020600020906005020160040160006101000a81548161ffff021916908361ffff16021790555050505050565b60195481565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000601a6000612aaa613924565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414612b5157612af26145c3565b612b02612afd613924565b61392c565b9050600115158160a00151151514612b4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b46906157e7565b60405180910390fd5b505b600060148381548110612b6057fe5b9060005260206000209060050201905060006015600085815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050612bcd846119b5565b600081600101541115613231576000612c248260020154612c1664e8d4a51000612c0887600301548760010154613a5e90919063ffffffff16565b613ace90919063ffffffff16565b613b7990919063ffffffff16565b9050600081111561322f576000601a6000612c3d613924565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050600081111561322257612c8b614611565b612c948261127f565b90506001816020015161ffff16148015612cb657506001816000015161ffff16145b15612ed85760008160400151600181518110612cce57fe5b60200260200101516020015161ffff161115612e2e57600060018260400151600281518110612cf957fe5b60200260200101516020015161ffff161415612d3957601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050612db3565b60028260400151600281518110612d4c57fe5b60200260200101516020015161ffff161415612d8c57601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050612db2565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690505b5b6000612dfb6064612ded8560400151600181518110612dce57fe5b60200260200101516020015161ffff1688613a5e90919063ffffffff16565b613ace90919063ffffffff16565b9050612e2b8233600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684613dc1565b50505b6000612e766064612e688460400151600081518110612e4957fe5b60200260200101516020015161ffff1687613a5e90919063ffffffff16565b613ace90919063ffffffff16565b9050612ec8601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff163384613dc1565b612ed23385613ec3565b5061321c565b6002816020015161ffff16148015612ef857506001816000015161ffff16145b156130c3576000612f09606461416b565b90508160400151600081518110612f1c57fe5b60200260200101516020015161ffff168111612fe4576000601460195481548110612f4357fe5b90600052602060002090600502019050600060156000601954815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050612fb46019546119b5565b612fcb868260010154613b2490919063ffffffff16565b8160010181905550612fdd3387613ec3565b5050613022565b8160400151600181518110612ff557fe5b60200260200101516020015160640361ffff16811061302157600061dead905061301f8186613ec3565b505b5b600061306a606461305c856040015160008151811061303d57fe5b60200260200101516020015161ffff1688613a5e90919063ffffffff16565b613ace90919063ffffffff16565b90506130bc601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff163384613dc1565b505061321b565b6003816020015161ffff161480156130e357506001816000015161ffff16145b1561321a57600081604001516001815181106130fb57fe5b60200260200101516020015161ffff161115613174576000613159606461314b846040015160018151811061312c57fe5b60200260200101516020015161ffff1687613a5e90919063ffffffff16565b613ace90919063ffffffff16565b90508084039350600061dead90506131718183613ec3565b50505b60006131bc60646131ae846040015160008151811061318f57fe5b60200260200101516020015161ffff1687613a5e90919063ffffffff16565b613ace90919063ffffffff16565b905061320e601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff163384613dc1565b6132183385613ec3565b505b5b5b5061322d565b61322c3383613ec3565b5b505b505b600083111561350e5761328b3330858560000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166141c3909392919063ffffffff16565b60008260040160009054906101000a900461ffff1661ffff1611156134ed5760006132e96127106132db8560040160009054906101000a900461ffff1661ffff1687613a5e90919063ffffffff16565b613ace90919063ffffffff16565b9050613384600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661333a61271061332c600d5486613a5e90919063ffffffff16565b613ace90919063ffffffff16565b8560000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166140e59092919063ffffffff16565b61341d600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166133d36127106133c5600c5486613a5e90919063ffffffff16565b613ace90919063ffffffff16565b8560000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166140e59092919063ffffffff16565b6134b6600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661346c61271061345e600e5486613a5e90919063ffffffff16565b613ace90919063ffffffff16565b8560000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166140e59092919063ffffffff16565b6134df816134d1868560010154613b2490919063ffffffff16565b613b7990919063ffffffff16565b82600101819055505061350d565b613504838260010154613b2490919063ffffffff16565b81600101819055505b5b61354064e8d4a5100061353284600301548460010154613a5e90919063ffffffff16565b613ace90919063ffffffff16565b8160020181905550833373ffffffffffffffffffffffffffffffffffffffff167f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a158560405161358f9190615869565b60405180910390a350505050565b6135a5613924565b73ffffffffffffffffffffffffffffffffffffffff166135c361244d565b73ffffffffffffffffffffffffffffffffffffffff1614613619576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613610906157c7565b60405180910390fd5b8060198190555050565b61362b613924565b73ffffffffffffffffffffffffffffffffffffffff1661364961244d565b73ffffffffffffffffffffffffffffffffffffffff161461369f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613696906157c7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561370f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161370690615627565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461385c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161385390615747565b60405180910390fd5b82601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050565b600033905090565b6139346145c3565b600080600080600080600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663987ee156896040518263ffffffff1660e01b81526004016139989190615453565b60c06040518083038186803b1580156139b057600080fd5b505afa1580156139c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139e89190614bad565b809650819750829850839950849a50859b50505050505050613a086145c3565b6040518060c001604052808881526020018781526020018681526020018573ffffffffffffffffffffffffffffffffffffffff168152602001848152602001831515815250905080975050505050505050919050565b600080831415613a715760009050613ac8565b6000828402905082848281613a8257fe5b0414613ac3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613aba90615787565b60405180910390fd5b809150505b92915050565b6000808211613b12576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613b09906156c7565b60405180910390fd5b818381613b1b57fe5b04905092915050565b600080828401905083811015613b6f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613b6690615647565b60405180910390fd5b8091505092915050565b600082821115613bbe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613bb590615667565b60405180910390fd5b818303905092915050565b60606000821415613c11576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050613da8565b60006064905060608167ffffffffffffffff81118015613c3057600080fd5b506040519080825280601f01601f191660200182016040528015613c635781602001600182028036833780820191505090505b50905060005b60008514613cdb576000600a8681613c7d57fe5b069050600a8681613c8a57fe5b0495508060300160f81b838380600101945081518110613ca657fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535050613c69565b60608167ffffffffffffffff81118015613cf457600080fd5b506040519080825280601f01601f191660200182016040528015613d275781602001600182028036833780820191505090505b50905060005b82811015613d99578360018285030381518110613d4657fe5b602001015160f81c60f81b828281518110613d5d57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080600101915050613d2d565b50606081905080955050505050505b919050565b6000613dba82600061424c565b9050919050565b600084905060008173ffffffffffffffffffffffffffffffffffffffff166370a08231866040518263ffffffff1660e01b8152600401613e019190615453565b60206040518083038186803b158015613e1957600080fd5b505afa158015613e2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e5191906149df565b905080831115613e8d57613e888585838573ffffffffffffffffffffffffffffffffffffffff166141c3909392919063ffffffff16565b613ebb565b613eba8585858573ffffffffffffffffffffffffffffffffffffffff166141c3909392919063ffffffff16565b5b505050505050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401613f209190615453565b60206040518083038186803b158015613f3857600080fd5b505afa158015613f4c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f7091906149df565b90508082111561402f57600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84836040518363ffffffff1660e01b8152600401613fd7929190615513565b602060405180830381600087803b158015613ff157600080fd5b505af1158015614005573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614029919061498d565b506140e0565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84846040518363ffffffff1660e01b815260040161408c929190615513565b602060405180830381600087803b1580156140a657600080fd5b505af11580156140ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906140de919061498d565b505b505050565b6141668363a9059cbb60e01b8484604051602401614104929190615513565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050614355565b505050565b600060016018600082825401925050819055506001820142443360185460405160200161419b9493929190615405565b6040516020818303038152906040528051906020012060001c816141bb57fe5b069050919050565b614246846323b872dd60e01b8585856040516024016141e4939291906154dc565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050614355565b50505050565b6000606083905060008060005b835181101561433657603084828151811061427057fe5b602001015160f81c60f81b60f81c60ff16101580156142ac5750603984828151811061429857fe5b602001015160f81c60f81b60f81c60ff1611155b156142fe5781156142cf5760008614156142c557614336565b8580600190039650505b600a8302925060308482815181106142e357fe5b602001015160f81c60f81b60f81c60ff160383019250614329565b602e84828151811061430c57fe5b602001015160f81c60f81b60f81c60ff16141561432857600191505b5b8080600101915050614259565b5060008511156143495784600a0a820291505b81935050505092915050565b60606143b7826040518060400160405280602081526020017f5361666542455032303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661441c9092919063ffffffff16565b905060008151111561441757808060200190518101906143d7919061498d565b614416576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161440d90615607565b60405180910390fd5b5b505050565b606061442b8484600085614434565b90509392505050565b606082471015614479576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161447090615687565b60405180910390fd5b61448285614549565b6144c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016144b890615807565b60405180910390fd5b600060608673ffffffffffffffffffffffffffffffffffffffff1685876040516144eb91906153ee565b60006040518083038185875af1925050503d8060008114614528576040519150601f19603f3d011682016040523d82523d6000602084013e61452d565b606091505b509150915061453d82828661455c565b92505050949350505050565b600080823b905060008111915050919050565b6060831561456c578290506145bc565b60008351111561457f5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016145b391906155c5565b60405180910390fd5b9392505050565b6040518060c00160405280600081526020016000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081526020016000151581525090565b6040518060600160405280600061ffff168152602001600061ffff168152602001606081525090565b6040518060400160405280600060ff168152602001600061ffff1681525090565b60008135905061466a81615b5c565b92915050565b60008151905061467f81615b5c565b92915050565b60008135905061469481615b73565b92915050565b6000815190506146a981615b73565b92915050565b600082601f8301126146c057600080fd5b81356146d36146ce826158da565b6158ad565b915080825260208301602083018583830111156146ef57600080fd5b6146fa838284615ace565b50505092915050565b60008135905061471281615b8a565b92915050565b600082601f83011261472957600080fd5b813561473c61473782615906565b6158ad565b9150808252602083016020830185838301111561475857600080fd5b614763838284615ace565b50505092915050565b60008135905061477b81615ba1565b92915050565b60008135905061479081615bb8565b92915050565b6000815190506147a581615bb8565b92915050565b6000602082840312156147bd57600080fd5b60006147cb8482850161465b565b91505092915050565b6000602082840312156147e657600080fd5b60006147f484828501614670565b91505092915050565b60008060006060848603121561481257600080fd5b60006148208682870161465b565b93505060206148318682870161465b565b92505060406148428682870161465b565b9150509250925092565b60008060008060008060008060006101208a8c03121561486b57600080fd5b60006148798c828d0161465b565b995050602061488a8c828d0161465b565b985050604061489b8c828d0161465b565b97505060606148ac8c828d01614781565b96505060806148bd8c828d01614781565b95505060a06148ce8c828d01614781565b94505060c06148df8c828d01614781565b93505060e06148f08c828d01614781565b9250506101006149028c828d01614781565b9150509295985092959850929598565b6000806000806080858703121561492857600080fd5b60006149368782880161465b565b94505060206149478782880161465b565b935050604061495887828801614781565b925050606085013567ffffffffffffffff81111561497557600080fd5b614981878288016146af565b91505092959194509250565b60006020828403121561499f57600080fd5b60006149ad8482850161469a565b91505092915050565b6000602082840312156149c857600080fd5b60006149d684828501614781565b91505092915050565b6000602082840312156149f157600080fd5b60006149ff84828501614796565b91505092915050565b60008060408385031215614a1b57600080fd5b6000614a2985828601614781565b9250506020614a3a8582860161465b565b9150509250929050565b60008060008060808587031215614a5a57600080fd5b6000614a6887828801614781565b9450506020614a7987828801614703565b9350506040614a8a8782880161476c565b9250506060614a9b87828801614685565b91505092959194509250565b60008060408385031215614aba57600080fd5b6000614ac885828601614781565b9250506020614ad985828601614781565b9150509250929050565b600080600060608486031215614af857600080fd5b6000614b0686828701614781565b9350506020614b1786828701614781565b925050604084013567ffffffffffffffff811115614b3457600080fd5b614b4086828701614718565b9150509250925092565b60008060008060808587031215614b6057600080fd5b6000614b6e87828801614781565b9450506020614b7f87828801614781565b9350506040614b908782880161476c565b9250506060614ba187828801614685565b91505092959194509250565b60008060008060008060c08789031215614bc657600080fd5b6000614bd489828a01614796565b9650506020614be589828a01614796565b9550506040614bf689828a01614796565b9450506060614c0789828a01614670565b9350506080614c1889828a01614796565b92505060a0614c2989828a0161469a565b9150509295509295509295565b6000614c42838361531c565b60408301905092915050565b614c5781615a50565b82525050565b614c6e614c69826159af565b615b10565b82525050565b614c7d8161599d565b82525050565b6000614c8e82615942565b614c988185615970565b9350614ca383615932565b8060005b83811015614cd4578151614cbb8882614c36565b9750614cc683615963565b925050600181019050614ca7565b5085935050505092915050565b614cea816159cd565b82525050565b6000614cfb8261594d565b614d058185615981565b9350614d15818560208601615add565b80840191505092915050565b614d2a81615a62565b82525050565b614d3981615a86565b82525050565b6000614d4a82615958565b614d54818561598c565b9350614d64818560208601615add565b614d6d81615b3e565b840191505092915050565b6000614d8560258361598c565b91507f6164643a20696e76616c6964206465706f73697420666565206261736973207060008301527f6f696e74730000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000614deb602a8361598c565b91507f5361666542455032303a204245503230206f7065726174696f6e20646964206e60008301527f6f742073756363656564000000000000000000000000000000000000000000006020830152604082019050919050565b6000614e5160268361598c565b91507f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008301527f64647265737300000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000614eb7601b8361598c565b91507f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006000830152602082019050919050565b6000614ef7601e8361598c565b91507f536166654d6174683a207375627472616374696f6e206f766572666c6f7700006000830152602082019050919050565b6000614f3760268361598c565b91507f416464726573733a20696e73756666696369656e742062616c616e636520666f60008301527f722063616c6c00000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000614f9d601b8361598c565b91507f4f6e6c79204e4654206f776e65722063616e20726567697374657200000000006000830152602082019050919050565b6000614fdd601a8361598c565b91507f536166654d6174683a206469766973696f6e206279207a65726f0000000000006000830152602082019050919050565b600061501d60118361598c565b91507f4974656d206e6f742065717569707065640000000000000000000000000000006000830152602082019050919050565b600061505d60178361598c565b91507f43616e6e6f7420757365207a65726f20616464726573730000000000000000006000830152602082019050919050565b600061509d60188361598c565b91507f4d696e742070657263656e7420636f6e73747261696e747300000000000000006000830152602082019050919050565b60006150dd60098361598c565b91507f6465763a207775743f00000000000000000000000000000000000000000000006000830152602082019050919050565b600061511d60148361598c565b91507f4974656d20616c726561647920657175697065640000000000000000000000006000830152602082019050919050565b600061515d60218361598c565b91507f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008301527f77000000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006151c360258361598c565b91507f7365743a20696e76616c6964206465706f73697420666565206261736973207060008301527f6f696e74730000000000000000000000000000000000000000000000000000006020830152604082019050919050565b600061522960208361598c565b91507f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726000830152602082019050919050565b600061526960138361598c565b91507f55736572206d75737420626520616374697665000000000000000000000000006000830152602082019050919050565b60006152a9601d8361598c565b91507f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006000830152602082019050919050565b60006152e960128361598c565b91507f77697468647261773a206e6f7420676f6f6400000000000000000000000000006000830152602082019050919050565b60408201600082015161533260008501826153df565b506020820151615345602085018261539b565b50505050565b6000606083016000830151615363600086018261539b565b506020830151615376602086018261539b565b506040830151848203604086015261538e8282614c83565b9150508091505092915050565b6153a481615a0b565b82525050565b6153b381615a0b565b82525050565b6153c281615a39565b82525050565b6153d96153d482615a39565b615b34565b82525050565b6153e881615a43565b82525050565b60006153fa8284614cf0565b915081905092915050565b600061541182876153c8565b60208201915061542182866153c8565b6020820191506154318285614c5d565b60148201915061544182846153c8565b60208201915081905095945050505050565b60006020820190506154686000830184614c74565b92915050565b60006060820190506154836000830186614c4e565b6154906020830185614c74565b61549d60408301846153b9565b949350505050565b60006060820190506154ba6000830186614c74565b6154c76020830185614c4e565b6154d460408301846153b9565b949350505050565b60006060820190506154f16000830186614c74565b6154fe6020830185614c74565b61550b60408301846153b9565b949350505050565b60006040820190506155286000830185614c74565b61553560208301846153b9565b9392505050565b60006020820190506155516000830184614ce1565b92915050565b600060a08201905061556c6000830188614d21565b61557960208301876153b9565b61558660408301866153b9565b61559360608301856153b9565b6155a060808301846153aa565b9695505050505050565b60006020820190506155bf6000830184614d30565b92915050565b600060208201905081810360008301526155df8184614d3f565b905092915050565b6000602082019050818103600083015261560081614d78565b9050919050565b6000602082019050818103600083015261562081614dde565b9050919050565b6000602082019050818103600083015261564081614e44565b9050919050565b6000602082019050818103600083015261566081614eaa565b9050919050565b6000602082019050818103600083015261568081614eea565b9050919050565b600060208201905081810360008301526156a081614f2a565b9050919050565b600060208201905081810360008301526156c081614f90565b9050919050565b600060208201905081810360008301526156e081614fd0565b9050919050565b6000602082019050818103600083015261570081615010565b9050919050565b6000602082019050818103600083015261572081615050565b9050919050565b6000602082019050818103600083015261574081615090565b9050919050565b60006020820190508181036000830152615760816150d0565b9050919050565b6000602082019050818103600083015261578081615110565b9050919050565b600060208201905081810360008301526157a081615150565b9050919050565b600060208201905081810360008301526157c0816151b6565b9050919050565b600060208201905081810360008301526157e08161521c565b9050919050565b600060208201905081810360008301526158008161525c565b9050919050565b600060208201905081810360008301526158208161529c565b9050919050565b60006020820190508181036000830152615840816152dc565b9050919050565b60006020820190508181036000830152615861818461534b565b905092915050565b600060208201905061587e60008301846153b9565b92915050565b600060408201905061589960008301856153b9565b6158a660208301846153b9565b9392505050565b6000604051905081810181811067ffffffffffffffff821117156158d057600080fd5b8060405250919050565b600067ffffffffffffffff8211156158f157600080fd5b601f19601f8301169050602081019050919050565b600067ffffffffffffffff82111561591d57600080fd5b601f19601f8301169050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b60006159a882615a19565b9050919050565b60006159ba82615a19565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6000615a048261599d565b9050919050565b600061ffff82169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000615a5b82615aaa565b9050919050565b6000615a6d82615a74565b9050919050565b6000615a7f82615a19565b9050919050565b6000615a9182615a98565b9050919050565b6000615aa382615a19565b9050919050565b6000615ab582615abc565b9050919050565b6000615ac782615a19565b9050919050565b82818337600083830152505050565b60005b83811015615afb578082015181840152602081019050615ae0565b83811115615b0a576000848401525b50505050565b6000615b1b82615b22565b9050919050565b6000615b2d82615b4f565b9050919050565b6000819050919050565b6000601f19601f8301169050919050565b60008160601b9050919050565b615b658161599d565b8114615b7057600080fd5b50565b615b7c816159c1565b8114615b8757600080fd5b50565b615b93816159f9565b8114615b9e57600080fd5b50565b615baa81615a0b565b8114615bb557600080fd5b50565b615bc181615a39565b8114615bcc57600080fd5b5056fea264697066735822122088bd1aea28202b2935868d3f680496c79dedb21e7cabce2c0f4af989e45bbd8f64736f6c634300060c0033000000000000000000000000098afb73f809d8fe145363f802113e3825d7490c0000000000000000000000002c51b570b11da6c0852aadd059402e390a936b3900000000000000000000000070af5d9aa411de66ec4c810cd7f8f85641be643b000000000000000000000000e97a1b9f5d4b849f0d78f58adb7dd91e90e0fb40000000000000000000000000ec9e6fbb58b3633b132da9afb94a43446845edc8000000000000000000000000602a27bbf954b6945534a84c8c88fb8ca9e92b7f000000000000000000000000a40b29b0dacb37331456c2ca3b65e56a6d79fc9e000000000000000000000000e6e83aa19696f74f7f5467010066e2d432d327aa00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000698fdf

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

000000000000000000000000098afb73f809d8fe145363f802113e3825d7490c0000000000000000000000002c51b570b11da6c0852aadd059402e390a936b3900000000000000000000000070af5d9aa411de66ec4c810cd7f8f85641be643b000000000000000000000000e97a1b9f5d4b849f0d78f58adb7dd91e90e0fb40000000000000000000000000ec9e6fbb58b3633b132da9afb94a43446845edc8000000000000000000000000602a27bbf954b6945534a84c8c88fb8ca9e92b7f000000000000000000000000a40b29b0dacb37331456c2ca3b65e56a6d79fc9e000000000000000000000000e6e83aa19696f74f7f5467010066e2d432d327aa00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000698fdf

-----Encoded View---------------
10 Constructor Arguments found :
Arg [0] : 000000000000000000000000098afb73f809d8fe145363f802113e3825d7490c
Arg [1] : 0000000000000000000000002c51b570b11da6c0852aadd059402e390a936b39
Arg [2] : 00000000000000000000000070af5d9aa411de66ec4c810cd7f8f85641be643b
Arg [3] : 000000000000000000000000e97a1b9f5d4b849f0d78f58adb7dd91e90e0fb40
Arg [4] : 000000000000000000000000ec9e6fbb58b3633b132da9afb94a43446845edc8
Arg [5] : 000000000000000000000000602a27bbf954b6945534a84c8c88fb8ca9e92b7f
Arg [6] : 000000000000000000000000a40b29b0dacb37331456c2ca3b65e56a6d79fc9e
Arg [7] : 000000000000000000000000e6e83aa19696f74f7f5467010066e2d432d327aa
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [9] : 0000000000000000000000000000000000000000000000000000000000698fdf


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.