Contract 0xbe9ff181bfa9dd78191b81b23fd4ff774a3fb4f1

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0xbef00541ff9d084563490bfdece83e8fac6ffc785ea8580600d17167bda3c6f3Unstake130622972021-11-29 23:43:3448 secs ago0x1256d19957eeaa73b79ca9adda8ef4a11243279b IN  0xbe9ff181bfa9dd78191b81b23fd4ff774a3fb4f10 BNB0.00075999
0x60133484ebbce5831c47256ef4e48024806f4acd114ee0386dc48430329f6043Stake130622962021-11-29 23:43:3052 secs ago0x34607edded1cda1872b1837d802123a5c67b4af4 IN  0xbe9ff181bfa9dd78191b81b23fd4ff774a3fb4f10 BNB0.00127868
0x9142c7042153d2e8acc68623958a99a56526ab400dda6c383e44bc3ccae4f726Unstake130622702021-11-29 23:41:522 mins ago0x02ae58e5fb33a1a38f5574e7ec086198f540af0b IN  0xbe9ff181bfa9dd78191b81b23fd4ff774a3fb4f10 BNB0.000774565
0xd25b32fd41ed399c839fb76ac314757a9bcfa4355d3b58df22fc1df55f2755b6Harvest130622592021-11-29 23:41:143 mins ago0xb3f381252a46ce59d7d487d67cfbea06f3754d44 IN  0xbe9ff181bfa9dd78191b81b23fd4ff774a3fb4f10 BNB0.0013887
0xba334487ed756990cc37d3d9f509c67a61c8a653c76f6a6f33e8de9471a18ae5Harvest130622572021-11-29 23:41:083 mins ago0xe96a9bfb96eebd151b337811454584cf41ae039c IN  0xbe9ff181bfa9dd78191b81b23fd4ff774a3fb4f10 BNB0.0013887
0x8a68e7b66a972e1b34d62775a1deb08e81c3fb4980004e1a77fd928dfb0daed4Stake130622562021-11-29 23:41:053 mins ago0x8c8ce4c42cbfd5d1cd393c43b2b2c8e46467e125 IN  0xbe9ff181bfa9dd78191b81b23fd4ff774a3fb4f10 BNB0.00135368
0x44bd44b3d0f4f8f25b361bc85d02842492d009ef01091edebcd6933f9766bdb0Harvest130622422021-11-29 23:40:184 mins ago0xfc398604939472577f4de9b6243d80c3fd2e692a IN  0xbe9ff181bfa9dd78191b81b23fd4ff774a3fb4f10 BNB0.00134401
0xe90df214f13c8a1576cb02368899b135a51287d23602d98386678a677942206cStake130622392021-11-29 23:40:084 mins ago0x02ae58e5fb33a1a38f5574e7ec086198f540af0b IN  0xbe9ff181bfa9dd78191b81b23fd4ff774a3fb4f10 BNB0.00135299
0x467eb18387fe217dc3dbc1688471058c19f763602840fc96707e7797559e0426Harvest130622262021-11-29 23:39:234 mins ago0x5e928b40f5d8af9e0df26caa0fdaaaab44baba5d IN  0xbe9ff181bfa9dd78191b81b23fd4ff774a3fb4f10 BNB0.0013347
0x25818f6eb55183784891b2090cc94ff8583f51246dae6fb54be14e1a8eb6213aStake130622252021-11-29 23:39:205 mins ago0x057e75c3ac46d4d18a1d6dec58d2a5188116b261 IN  0xbe9ff181bfa9dd78191b81b23fd4ff774a3fb4f10 BNB0.001753485
0x2aa1379b2f780bbe9df549f82c4809cb2a3a19eee9337bf119caac5e4765d1e4Stake130622242021-11-29 23:39:175 mins ago0xe543ffe30af3723e361facb62752148b788a2089 IN  0xbe9ff181bfa9dd78191b81b23fd4ff774a3fb4f10 BNB0.00127799
0x323708ce12f09d3c7824fc80230183a33b890fa1738e6be8e946cbf4d23a37dfHarvest130622222021-11-29 23:39:095 mins ago0x6efc6c7f323ff6dc8565e1d62ff6272a458e560c IN  0xbe9ff181bfa9dd78191b81b23fd4ff774a3fb4f10 BNB0.0013887
0xf44018ad67132f6032ee138a99587164dcc45a2de7e581f5f16049a5451a1fc7Stake130622032021-11-29 23:38:096 mins ago0xc9b327e2be9149f9b599f981fe2d5ea2780610cf IN  0xbe9ff181bfa9dd78191b81b23fd4ff774a3fb4f10 BNB0.001754435
0x697986b76af9e3283071919f433fed72a115576d67a11d3e562f8868506100feStake130622012021-11-29 23:38:036 mins ago0x868b4e715fe0ffc5a232852a63a12dad5aaf6682 IN  0xbe9ff181bfa9dd78191b81b23fd4ff774a3fb4f10 BNB0.00135299
0x6029b0da687b9e881e0886204150aa9b04f75b79a23a30903f47936b0c0089c4Stake130621632021-11-29 23:36:098 mins ago0xb3455f1c7ed7e7d40ad18de553ec52434f325dba IN  0xbe9ff181bfa9dd78191b81b23fd4ff774a3fb4f10 BNB0.00135381
0xaa392bd7292e304339923799e65558fce187deb41228666ac3fd84a9ef04c19eExit130621622021-11-29 23:36:068 mins ago0x1256d19957eeaa73b79ca9adda8ef4a11243279b IN  0xbe9ff181bfa9dd78191b81b23fd4ff774a3fb4f10 BNB0.004
0x34b86e26aa794add823ebcb1cfc4c6e498bfdeb73aa3a2cbd6392a618d834d95Harvest130621512021-11-29 23:35:308 mins ago0xa39f388c345678887c0b27c153252de641999d44 IN  0xbe9ff181bfa9dd78191b81b23fd4ff774a3fb4f10 BNB0.0013887
0x1d7926402623749361f953f51b90d13bf571fc45ed1baf64c5f446f1445caf75Stake130621492021-11-29 23:35:209 mins ago0x868b4e715fe0ffc5a232852a63a12dad5aaf6682 IN  0xbe9ff181bfa9dd78191b81b23fd4ff774a3fb4f10 BNB0.001754305
0xd66e04fc5991dbbe9bfe852319d77dcbb388746c753890f2054844eb86e25f8fHarvest130621462021-11-29 23:35:119 mins ago0x97c2d2308d02dea8e636cc0a725e5e2e75f478ce IN  0xbe9ff181bfa9dd78191b81b23fd4ff774a3fb4f10 BNB0.0013347
0x132985992e9280bd32b6abaa9e93e5fd204106f8956a3375858ae4d70878578fHarvest130621422021-11-29 23:34:599 mins ago0x1914b199cf3e909581004f0b8c52274bf62a4512 IN  0xbe9ff181bfa9dd78191b81b23fd4ff774a3fb4f10 BNB0.0013887
0x1368cb1945e54adaadd39a5225ad7b334df1270e6dd31d6e4fc15d2cc050edcdStake130621392021-11-29 23:34:499 mins ago0x18a117e0b764223dc8a2f487ec061d817ed9f543 IN  0xbe9ff181bfa9dd78191b81b23fd4ff774a3fb4f10 BNB0.001753485
0x9cfe567f3c55f13d3190c8981b37a8856a48c477bbef890bf2461cf3b2a48a48Harvest130621162021-11-29 23:33:3910 mins ago0x8c8ce4c42cbfd5d1cd393c43b2b2c8e46467e125 IN  0xbe9ff181bfa9dd78191b81b23fd4ff774a3fb4f10 BNB0.00130201
0x50b57f4b2eebdd751ec2c953c70972dc1f8ab6d43a0dcb4bea0fc76f5e2a1008Stake130621162021-11-29 23:33:3910 mins ago0xd89c6b1c7a07b919d33495f09adced2ed6c18a42 IN  0xbe9ff181bfa9dd78191b81b23fd4ff774a3fb4f10 BNB0.001754305
0xc3ade66e205617e79b581b54875435847f2b52d943bea8a8bd93ba4c361df7a0Stake130621112021-11-29 23:33:2310 mins ago0x8a9037d44281a19edc2201bdaa61b8aeb8e3fef4 IN  0xbe9ff181bfa9dd78191b81b23fd4ff774a3fb4f10 BNB0.00127881
0x6348d7c1c6fa9accb03b0dcf4faae65167cc7d19e9916e2d3edb1ece3d34d0b7Exit130621112021-11-29 23:33:2310 mins ago0x1256d19957eeaa73b79ca9adda8ef4a11243279b IN  0xbe9ff181bfa9dd78191b81b23fd4ff774a3fb4f10 BNB0.004
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
GeneralNFTReward

Compiler Version
v0.8.0+commit.c7dfd78e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 22 : GeneralNFTReward.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <=0.8.4;

import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
// gego
import "../library/SafeERC20.sol";
import "../library/Governance.sol";
import "../interface/IPool.sol";
import "../interface/IERC20.sol";
import "../interface/IPlayerBook.sol";
import "../interface/IPosiNFTFactory.sol";
import "../interface/IPosiNFT.sol";

    
contract GeneralNFTReward is IPool,Governance {
    using SafeERC20 for IERC20;
    using SafeMath for uint256;

    IERC20 public _rewardERC20 = IERC20(address(0x0));
    IPosiNFTFactory public _gegoFactory = IPosiNFTFactory(address(0x0));
    IPosiNFT public _gegoToken = IPosiNFT(address(0x0));
    address public _playerBook = address(0x0);

    address public _teamWallet = 0x7AB2CB9913213D249F0cFdd871aA696c9529ac6b;
    address public _rewardPool = 0x7AB2CB9913213D249F0cFdd871aA696c9529ac6b;

    uint256 public constant DURATION = 7 days;
    uint256 public _startTime =  1629028800; 
    uint256 public _periodFinish = 0;
    uint256 public _rewardRate = 0;
    uint256 public _lastUpdateTime;
    uint256 public _rewardPerTokenStored;
    uint256 public _harvestInterval = 12 hours;
    uint256 public totalLockedUpRewards;

    uint256 public _teamRewardRate = 500;
    uint256 public _poolRewardRate = 1000;
    uint256 public _baseRate = 10000;
    uint256 public _punishTime = 3 days;

    mapping(address => uint256) public _userRewardPerTokenPaid;
    mapping(address => uint256) public _rewards;
    mapping(address => uint256) public _lastStakedTime;
    mapping(address => uint256) public _nextHarvestUntil;
    mapping(address => uint256) public _rewardLockedUp;

    uint256 public _fixRateBase = 100000;
    
    uint256 public _totalWeight;
    mapping(address => uint256) public _weightBalances;
    mapping(uint256 => uint256) public _stakeWeightes;
    mapping(uint256 => uint256) public _stakeBalances;

    uint256 public _totalBalance;
    mapping(address => uint256) public _degoBalances;
    uint256 public _maxStakedDego = 200 * 1e18;

    mapping(address => uint256[]) public _playerGego;
    mapping(uint256 => uint256) public _gegoMapIndex;
    


    event RewardAdded(uint256 reward);
    event StakedGEGO(address indexed user, uint256 amount);
    event WithdrawnGego(address indexed user, uint256 amount);
    event RewardPaid(address indexed user, uint256 reward);
    event RewardLockedUp(address indexed user, uint256 reward);
    event NFTReceived(address operator, address from, uint256 tokenId, bytes data);

    constructor(address posiNftToken, address gegoFactory, address rewardAddress, uint256 startTime) {
        _rewardERC20 = IERC20(rewardAddress);
        _gegoToken = IPosiNFT(posiNftToken);
        _gegoFactory = IPosiNFTFactory(gegoFactory);

        _startTime = startTime;
        _lastUpdateTime = _startTime;
    }
    



    modifier updateReward(address account) {
        _rewardPerTokenStored = rewardPerToken();
        _lastUpdateTime = lastTimeRewardApplicable();
        if (account != address(0)) {
            _rewards[account] = earned(account);
            _userRewardPerTokenPaid[account] = _rewardPerTokenStored;
        }
        _;
    }

    function setMaxStakedDego(uint256 amount) external onlyGovernance{
        _maxStakedDego = amount;
    }

    /* Fee collection for any other token */
    function seize(IERC20 token, uint256 amount) external  {
        require(token != _rewardERC20, "reward");
        token.transfer(_governance, amount);
    }
    
    /* Fee collection for any other token */
    function seizeErc721(IERC721 token, uint256 tokenId) external 
    {
        require(token != _gegoToken, "gego stake");
        token.safeTransferFrom(address(this), _governance, tokenId);
    }

    function lastTimeRewardApplicable() public view returns (uint256) {
        return Math.min(block.timestamp, _periodFinish);
    }

    function rewardPerToken() public view returns (uint256) {
        if (totalSupply() == 0) {
            return _rewardPerTokenStored;
        }
        return
            _rewardPerTokenStored.add(
                lastTimeRewardApplicable()
                    .sub(_lastUpdateTime)
                    .mul(_rewardRate)
                    .mul(1e18)
                    .div(totalSupply())
            );
    }

    function earned(address account) public view returns (uint256) {
        return
            balanceOf(account)
                .mul(rewardPerToken().sub(_userRewardPerTokenPaid[account]))
                .div(1e18)
                .add(_rewards[account]);
    }

    function canHarvest(address account) public view returns (bool) {
        return block.timestamp >= _nextHarvestUntil[account];
    }
    
    //the grade is a number between 1-6
    //the quality is a number between 1-10000
    /*
    1   quality	1.1+ 0.1*quality/5000
    2	quality	1.2+ 0.1*(quality-5000)/3000
    3	quality	1.3+ 0.1*(quality-8000/1000
    4	quality	1.4+ 0.2*(quality-9000)/800
    5	quality	1.6+ 0.2*(quality-9800)/180
    6	quality	1.8+ 0.2*(quality-9980)/20
    */

    function getFixRate(uint256 grade,uint256 quality) public pure returns (uint256){

        require(grade > 0 && grade <7, "the gego not dego");

        uint256 unfold = 0;

        if( grade == 1 ){
            unfold = quality*10000/5000;
            return unfold.add(110000);
        }else if( grade == 2){
            unfold = quality.sub(5000)*10000/3000;
            return unfold.add(120000);
        }else if( grade == 3){
            unfold = quality.sub(8000)*10000/1000;
           return unfold.add(130000);
        }else if( grade == 4){
            unfold = quality.sub(9000)*20000/800;
           return unfold.add(140000);
        }else if( grade == 5){
            unfold = quality.sub(9800)*20000/180;
            return unfold.add(160000);
        }else{
            unfold = quality.sub(9980)*20000/20;
            return unfold.add(180000);
        }
    }

    function getStakeInfo( uint256 gegoId ) public view returns ( uint256 stakeRate, uint256 degoAmount){

        uint256 grade;
        uint256 quality;
        uint256 createdTime;
        uint256 blockNum;
        uint256 resId;
        address author;

        (grade, quality, degoAmount,resId, , , ,author, ,createdTime,blockNum,) = _gegoFactory.getGego(gegoId);

        require(degoAmount > 0,"the gego not dego");

        stakeRate = getFixRate(grade,quality);
    }

    // stake NFT
    function stake(uint256 gegoId)
        public
        updateReward(msg.sender)
        checkStart
    {

        uint256[] storage gegoIds = _playerGego[msg.sender];
        if (gegoIds.length == 0) {
            gegoIds.push(0);    
            _gegoMapIndex[0] = 0;
        }
        gegoIds.push(gegoId);
        _gegoMapIndex[gegoId] = gegoIds.length - 1;

        uint256 stakeRate;
        uint256 degoAmount;
        (stakeRate, degoAmount) = getStakeInfo(gegoId);

        uint256 stakedDegoAmount = _degoBalances[msg.sender];
        uint256 stakingDegoAmount = stakedDegoAmount.add(degoAmount) <= _maxStakedDego?degoAmount:_maxStakedDego.sub(stakedDegoAmount);


        if(stakingDegoAmount > 0){
            uint256 stakeWeight = stakeRate.mul(stakingDegoAmount).div(_fixRateBase);
            _degoBalances[msg.sender] = _degoBalances[msg.sender].add(stakingDegoAmount);

            _weightBalances[msg.sender] = _weightBalances[msg.sender].add(stakeWeight);

            _stakeBalances[gegoId] = stakingDegoAmount;
            _stakeWeightes[gegoId] = stakeWeight;
            
            _totalBalance = _totalBalance.add(stakingDegoAmount);
            _totalWeight = _totalWeight.add(stakeWeight);
        }

        _gegoToken.safeTransferFrom(msg.sender, address(this), gegoId);

        if(_nextHarvestUntil[msg.sender] == 0){
            _nextHarvestUntil[msg.sender] = block.timestamp.add(
                    _harvestInterval
                );
        }
        _lastStakedTime[msg.sender] = block.timestamp;
        emit StakedGEGO(msg.sender, gegoId);
        
    }
    
    function onERC721Received(address operator, address from, uint256 tokenId, bytes memory data) public returns (bytes4) {
        emit NFTReceived(operator, from, tokenId, data);
        return bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"));
    }

    function unstake(uint256 gegoId)
        public
        updateReward(msg.sender)
        checkStart
    {
        require(gegoId > 0, "the gegoId error");
        
        uint256[] memory gegoIds = _playerGego[msg.sender];
        uint256 gegoIndex = _gegoMapIndex[gegoId];
        
        require(gegoIds[gegoIndex] == gegoId, "not gegoId owner");

        uint256 gegoArrayLength = gegoIds.length-1;
        uint256 tailId = gegoIds[gegoArrayLength];

        _playerGego[msg.sender][gegoIndex] = tailId;
        _playerGego[msg.sender][gegoArrayLength] = 0;
        
        // _playerGego[msg.sender].length--;  // remove in new version

        _playerGego[msg.sender].pop();

        _gegoMapIndex[tailId] = gegoIndex;
        _gegoMapIndex[gegoId] = 0;

        uint256 stakeWeight = _stakeWeightes[gegoId];
        _weightBalances[msg.sender] = _weightBalances[msg.sender].sub(stakeWeight);
        _totalWeight = _totalWeight.sub(stakeWeight);

        uint256 stakeBalance = _stakeBalances[gegoId];
        _degoBalances[msg.sender] = _degoBalances[msg.sender].sub(stakeBalance);
        _totalBalance = _totalBalance.sub(stakeBalance);

        _gegoToken.safeTransferFrom(address(this), msg.sender, gegoId);

        _stakeBalances[gegoId] = 0;
        _stakeWeightes[gegoId] = 0;

        emit WithdrawnGego(msg.sender, gegoId);
    }

    function withdraw()
        public
        checkStart
    {

        uint256[] memory gegoId = _playerGego[msg.sender];
        for (uint8 index = 1; index < gegoId.length; index++) {
            if (gegoId[index] > 0) {
                unstake(gegoId[index]);
            }
        }
    }

    function getPlayerIds( address account ) public view returns( uint256[] memory gegoId )
    {
        gegoId = _playerGego[account];
    }

    function exit() external {
        withdraw();
        harvest();
    }

    function harvest() public updateReward(msg.sender) checkStart {
        uint256 reward = earned(msg.sender);
        if(canHarvest(msg.sender)){
            if (reward > 0 || _rewardLockedUp[msg.sender] > 0) {
                _rewards[msg.sender] = 0;
                reward = reward.add(_rewardLockedUp[msg.sender]);
                
                // reset lockup
                totalLockedUpRewards = totalLockedUpRewards.sub(_rewardLockedUp[msg.sender]);
                _rewardLockedUp[msg.sender] = 0;
                _nextHarvestUntil[msg.sender] = block.timestamp.add(
                    _harvestInterval
                );

                // reward for team
                uint256 teamReward = reward.mul(_teamRewardRate).div(_baseRate);
                if(teamReward>0){
                    _rewardERC20.safeTransfer(_teamWallet, teamReward);
                }
                uint256 leftReward = reward.sub(teamReward);
                uint256 poolReward = 0;

                //withdraw time check

                if(block.timestamp  < (_lastStakedTime[msg.sender] + _punishTime) ){
                    poolReward = leftReward.mul(_poolRewardRate).div(_baseRate);
                }
                if(poolReward>0){
                    _rewardERC20.safeTransfer(_rewardPool, poolReward);
                    leftReward = leftReward.sub(poolReward);
                }

                if(leftReward>0){
                    _rewardERC20.safeTransfer(msg.sender, leftReward );
                }
        
                emit RewardPaid(msg.sender, leftReward);
            }
        }else if(reward > 0){
            _rewards[msg.sender] = 0;
            _rewardLockedUp[msg.sender] = _rewardLockedUp[msg.sender].add(reward);
            totalLockedUpRewards = totalLockedUpRewards.add(reward);
            emit RewardLockedUp(msg.sender, reward);
        }
        
    }

    
    modifier checkStart() {
        require(block.timestamp > _startTime, "not start");
        _;
    }

    //for extra reward
    function notifyReward(uint256 reward)
        external
        onlyGovernance
        updateReward(address(0))
    {

        uint256 balanceBefore = _rewardERC20.balanceOf(address(this));
        IERC20(_rewardERC20).transferFrom(msg.sender, address(this), reward);
        uint256 balanceEnd = _rewardERC20.balanceOf(address(this));

        uint256 realReward = balanceEnd.sub(balanceBefore);
        
        if (block.timestamp >= _periodFinish) {
            _rewardRate = realReward.div(DURATION);
        } else {
            uint256 remaining = _periodFinish.sub(block.timestamp);
            uint256 leftover = remaining.mul(_rewardRate);
            _rewardRate = realReward.add(leftover).div(DURATION);
        }
        _lastUpdateTime = block.timestamp;
        _periodFinish = block.timestamp.add(DURATION);

        emit RewardAdded(realReward);
    }

    function setTeamRewardRate( uint256 teamRewardRate ) public onlyGovernance {
        _teamRewardRate = teamRewardRate;
    }

    function setPoolRewardRate( uint256  poolRewardRate ) public onlyGovernance{
        _poolRewardRate = poolRewardRate;
    }
    
    function setHarvestInterval( uint256  harvestInterval ) public onlyGovernance{
        _harvestInterval = harvestInterval;
    }

    function setRewardPool( address  rewardPool ) public onlyGovernance{
        _rewardPool = rewardPool;
    }

    function setTeamWallet( address teamwallet ) public onlyGovernance{
        _teamWallet = teamwallet;
    }

    function totalSupply()  public view override returns (uint256) {
        return _totalWeight;
    }

    function balanceOf(address account) public view override returns (uint256) {
        return _weightBalances[account];
    }

    function setWithDrawPunishTime( uint256  punishTime ) public onlyGovernance{
        _punishTime = punishTime;
    }

}

File 2 of 22 : Math.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a >= b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow, so we distribute.
        return (a / 2) + (b / 2) + (((a % 2) + (b % 2)) / 2);
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a / b + (a % b == 0 ? 0 : 1);
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 4 of 22 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _setOwner(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _setOwner(newOwner);
    }

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 6 of 22 : IERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

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

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

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

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

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

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;
}

File 7 of 22 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <=0.8.4;

import "../interface/IERC20.sol";

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


/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 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 SafeERC20 for ERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using SafeMath for uint256;
    using Address for address;

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

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

    function safeApprove(IERC20 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),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(IERC20 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(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: 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(IERC20 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.

        // A Solidity high level call has three parts:
        //  1. The target address is checked to verify it contains contract code
        //  2. The call itself is made, and success asserted
        //  3. The return value is decoded, which in turn checks the size of the returned data.
        // solhint-disable-next-line max-line-length
        require(address(token).isContract(), "SafeERC20: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = address(token).call(data);
        require(success, "SafeERC20: low-level call failed");

        if (returndata.length > 0) { // Return data is optional
            // solhint-disable-next-line max-line-length
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 8 of 22 : Governance.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <=0.8.4;

contract Governance {

    address public _governance;

    constructor() public {
        _governance = tx.origin;
    }

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

    modifier onlyGovernance {
        require(msg.sender == _governance, "not governance");
        _;
    }

    function setGovernance(address governance)  public  onlyGovernance
    {
        require(governance != address(0), "new governance the zero address");
        emit GovernanceTransferred(_governance, governance);
        _governance = governance;
    }


}

File 9 of 22 : IPool.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <=0.8.4;


interface IPool {
    function totalSupply( ) external view returns (uint256);
    function balanceOf( address player ) external view returns (uint256);
}

File 10 of 22 : IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <=0.8.4;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP. Does not include
 * the optional functions; to access them see {ERC20Detailed}.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);
    function mint(address account, uint amount) external;
    /**
     * @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 11 of 22 : IPlayerBook.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <=0.8.4;


interface IPlayerBook {
    function settleReward( address from,uint256 amount ) external returns (uint256);
    function bindRefer( address from,string calldata  affCode )  external returns (bool);
    function hasRefer(address from) external returns(bool);

}

File 12 of 22 : IPosiNFTFactory.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <=0.8.4;

pragma experimental ABIEncoderV2;


import "../interface/IPosiNFT.sol";

interface IPosiNFTFactory {


    function getGego(uint256 tokenId)
        external view
        returns (
            uint256 grade,
            uint256 quality,
            uint256 amount,
            uint256 resBaseId,
            uint256 tLevel,
            uint256 ruleId,
            uint256 nftType,
            address author,
            address erc20,
            uint256 createdTime,
            uint256 blockNum,
            uint256 lockedDays
        );


    function getGegoStruct(uint256 tokenId)
        external view
        returns (IPosiNFT.Gego memory gego);

    function burn(uint256 tokenId) external returns ( bool );
    
    function isRulerProxyContract(address proxy) external view returns ( bool );
}

File 13 of 22 : IPosiNFT.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <=0.8.4;

import "@openzeppelin/contracts/token/ERC721/IERC721.sol";


interface IPosiNFT is IERC721 {

    struct Gego {
        uint256 id;
        uint256 grade;
        uint256 quality;
        uint256 amount;
        uint256 resBaseId;
        uint256 tLevel;
        uint256 ruleId;
        uint256 nftType;
        address author;
        address erc20;
        uint256 createdTime;
        uint256 blockNum;
        uint256 lockedDays;
    }
    
    function mint(address to, uint256 tokenId) external returns (bool) ;
    function burn(uint256 tokenId) external;
}

File 14 of 22 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

File 15 of 22 : ERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";

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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        _approve(to, tokenId);
    }

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

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        require(operator != _msgSender(), "ERC721: approve to caller");

        _operatorApprovals[_msgSender()][operator] = approved;
        emit ApprovalForAll(_msgSender(), operator, approved);
    }

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

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

        _transfer(from, to, tokenId);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        _beforeTokenTransfer(from, to, tokenId);

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

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

        emit Transfer(from, to, tokenId);
    }

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

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

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

File 16 of 22 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}

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

pragma solidity ^0.8.0;

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

File 18 of 22 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

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

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

    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

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

File 20 of 22 : Strings.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

File 21 of 22 : ERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

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

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"posiNftToken","type":"address"},{"internalType":"address","name":"gegoFactory","type":"address"},{"internalType":"address","name":"rewardAddress","type":"address"},{"internalType":"uint256","name":"startTime","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"GovernanceTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"}],"name":"NFTReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardLockedUp","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardPaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"StakedGEGO","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawnGego","type":"event"},{"inputs":[],"name":"DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_baseRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"_degoBalances","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_fixRateBase","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_gegoFactory","outputs":[{"internalType":"contract IPosiNFTFactory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"_gegoMapIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_gegoToken","outputs":[{"internalType":"contract IPosiNFT","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_governance","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_harvestInterval","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"_lastStakedTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_lastUpdateTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_maxStakedDego","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"_nextHarvestUntil","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_periodFinish","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_playerBook","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"_playerGego","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_poolRewardRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_punishTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_rewardERC20","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"_rewardLockedUp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_rewardPerTokenStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_rewardPool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_rewardRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"_rewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"_stakeBalances","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"_stakeWeightes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_startTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_teamRewardRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_teamWallet","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_totalBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_totalWeight","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"_userRewardPerTokenPaid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"_weightBalances","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"canHarvest","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"earned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"exit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"grade","type":"uint256"},{"internalType":"uint256","name":"quality","type":"uint256"}],"name":"getFixRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getPlayerIds","outputs":[{"internalType":"uint256[]","name":"gegoId","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"gegoId","type":"uint256"}],"name":"getStakeInfo","outputs":[{"internalType":"uint256","name":"stakeRate","type":"uint256"},{"internalType":"uint256","name":"degoAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"harvest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lastTimeRewardApplicable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"reward","type":"uint256"}],"name":"notifyReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardPerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"seize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"token","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"seizeErc721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"governance","type":"address"}],"name":"setGovernance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"harvestInterval","type":"uint256"}],"name":"setHarvestInterval","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"setMaxStakedDego","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolRewardRate","type":"uint256"}],"name":"setPoolRewardRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"rewardPool","type":"address"}],"name":"setRewardPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"teamRewardRate","type":"uint256"}],"name":"setTeamRewardRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"teamwallet","type":"address"}],"name":"setTeamWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"punishTime","type":"uint256"}],"name":"setWithDrawPunishTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"gegoId","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalLockedUpRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"gegoId","type":"uint256"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6080604052600180546001600160a01b0319908116909155600280548216905560038054821690556004805482169055600580548216737ab2cb9913213d249f0cfdd871aa696c9529ac6b9081179091556006805490921617905563611901c06007556000600881905560095561a8c0600c556101f4600e556103e8600f556127106010556203f480601155620186a0601755680ad78ebc5ac6200000601e55348015620000ac57600080fd5b506040516200283638038062002836833981016040819052620000cf9162000145565b60008054326001600160a01b0319918216179091556001805482166001600160a01b03948516179055600380548216958416959095179094556002805490941692909116919091179091556007819055600a5562000196565b80516001600160a01b03811681146200014057600080fd5b919050565b600080600080608085870312156200015b578384fd5b620001668562000128565b9350620001766020860162000128565b9250620001866040860162000128565b6060959095015193969295505050565b61269080620001a66000396000f3fe608060405234801561001057600080fd5b50600436106103a35760003560e01c80636adafab5116101e9578063cd3daf9d1161010f578063e44841f8116100ad578063f3a281611161007c578063f3a28161146106f4578063f9cff35114610707578063fa1acb5c1461070f578063fb70261a14610717576103a3565b8063e44841f8146106c9578063e9fad8ee146106d1578063eb9253c0146106d9578063ed6525c4146106ec576103a3565b8063d83e1042116100e9578063d83e104214610693578063dc099301146106a6578063dc7ced3d146106b9578063e08bf1da146106c1576103a3565b8063cd3daf9d14610658578063d484db7514610660578063d4e6b7a114610680576103a3565b806382e0bfae11610187578063a694fc3a11610156578063a694fc3a1461060c578063a8210e6b1461061f578063ab033ea914610632578063b0718b1714610645576103a3565b806382e0bfae146105d6578063927b26b9146105e95780639a6b25a3146105f15780639f3fbd2b14610604576103a3565b806378238c37116101c357806378238c37146105955780637b4d0812146105a85780637d6dfb7e146105bb57806380faa57d146105ce576103a3565b80636adafab51461057257806370a082311461057a578063770d58f81461058d576103a3565b806337e294d5116102ce57806353364da01161026c57806365d82b8a1161023b57806365d82b8a1461053c57806368fd25cd1461054f578063696e231c146105575780636a343e3c1461056a576103a3565b806353364da0146104fb57806356728e9d146105035780635efee7971461051657806360993b5b14610529576103a3565b80633ccfd60b116102a85780633ccfd60b146104d0578063410e66f1146104d85780634641257d146104eb578063474fa630146104f3576103a3565b806337e294d5146104ad57806338d7aae1146104b55780633a485c23146104c8576103a3565b80631525ff7d1161034657806324c5f05e1161031557806324c5f05e14610477578063252f7b491461048a5780632e17de78146104925780633572744e146104a5576103a3565b80631525ff7d1461043f57806318160ddd146104525780631be052891461045a5780631c2f3e3d14610462576103a3565b8063118103c611610382578063118103c614610407578063121544b91461040f5780631407c66414610417578063150b7a021461041f576103a3565b80628cc262146103a857806309813482146103d15780630ba86f05146103f2575b600080fd5b6103bb6103b6366004612001565b610737565b6040516103c89190612545565b60405180910390f35b6103e46103df366004612138565b6107a5565b6040516103c892919061254e565b610405610400366004612138565b6108ad565b005b6103bb6108dc565b6103bb6108e2565b6103bb6108e8565b61043261042d36600461201d565b6108ee565b6040516103c89190612335565b61040561044d366004612001565b610957565b6103bb6109a3565b6103bb6109aa565b61046a6109b1565b6040516103c89190612241565b6104056104853660046120ed565b6109c0565b6103bb610a58565b6104056104a0366004612138565b610a5e565b6103bb610e2b565b61046a610e31565b6104056104c3366004612138565b610e40565b6103bb610e6f565b610405610e75565b6103bb6104e6366004612138565b610f81565b610405610f93565b6103bb611277565b6103bb61127d565b6103bb610511366004612001565b611283565b6103bb6105243660046120ed565b611295565b610405610537366004612138565b6112c6565b6103bb61054a366004612001565b61159b565b6103bb6115ad565b6103bb610565366004612001565b6115b3565b61046a6115c5565b6103bb6115d4565b6103bb610588366004612001565b6115da565b61046a6115f5565b6104056105a3366004612001565b611604565b6104056105b6366004612138565b611650565b6103bb6105c9366004612001565b61167f565b6103bb611691565b6104056105e4366004612138565b6116a4565b6103bb6116d3565b6104056105ff366004612138565b6116d9565b6103bb611708565b61040561061a366004612138565b61170e565b6103bb61062d366004612001565b6119fa565b610405610640366004612001565b611a0c565b6103bb610653366004612168565b611ab7565b6103bb611c45565b61067361066e366004612001565b611c93565b6040516103c891906122e6565b6103bb61068e366004612138565b611cff565b6103bb6106a1366004612001565b611d10565b6103bb6106b4366004612138565b611d22565b61046a611d34565b6103bb611d43565b61046a611d49565b610405611d58565b6104056106e73660046120ed565b611d6a565b6103bb611e23565b6103bb610702366004612001565b611e29565b61046a611e3b565b6103bb611e4a565b61072a610725366004612001565b611e50565b6040516103c8919061232a565b6001600160a01b038116600090815260136020908152604080832054601290925282205461079f919061079990670de0b6b3a764000090610793906107849061077e611c45565b90611e6e565b61078d886115da565b90611e81565b90611e8d565b90611e99565b92915050565b6002546040516337baa4cb60e11b815260009182918291829182918291829182916001600160a01b0390911690636f754996906107e6908c90600401612545565b6101806040518083038186803b1580156107ff57600080fd5b505afa158015610813573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108379190612189565b9091929394959650909192939495509091929394509091925050809950819a50829750839850849d50859b50869c5050505050505050600087116108965760405162461bcd60e51b815260040161088d906124bb565b60405180910390fd5b6108a08686611ab7565b9750505050505050915091565b6000546001600160a01b031633146108d75760405162461bcd60e51b815260040161088d906124e6565b600e55565b601e5481565b600b5481565b60085481565b60007f1d823cdc8f0514a95b53538df2d2f3deaf98d1c534c6e750daa593173c27f8f0858585856040516109259493929190612279565b60405180910390a1507f150b7a023d4804d13e8c85fb27262cb750cf6ba9f9dd3bb30d90f482ceeb4b1f949350505050565b6000546001600160a01b031633146109815760405162461bcd60e51b815260040161088d906124e6565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6018545b90565b62093a8081565b6000546001600160a01b031681565b6003546001600160a01b03838116911614156109ee5760405162461bcd60e51b815260040161088d90612397565b600054604051632142170760e11b81526001600160a01b03808516926342842e0e92610a2292309216908690600401612255565b600060405180830381600087803b158015610a3c57600080fd5b505af1158015610a50573d6000803e3d6000fd5b505050505050565b601c5481565b33610a67611c45565b600b55610a72611691565b600a556001600160a01b03811615610ab957610a8d81610737565b6001600160a01b038216600090815260136020908152604080832093909355600b546012909152919020555b6007544211610ada5760405162461bcd60e51b815260040161088d9061234a565b60008211610afa5760405162461bcd60e51b815260040161088d9061236d565b336000908152601f6020908152604080832080548251818502810185019093528083529192909190830182828015610b5157602002820191906000526020600020905b815481526020019060010190808311610b3d575b505050600086815260208052604090205483519394509286925084915083908110610b8c57634e487b7160e01b600052603260045260246000fd5b602002602001015114610bb15760405162461bcd60e51b815260040161088d906123f0565b600060018351610bc191906125b3565b90506000838281518110610be557634e487b7160e01b600052603260045260246000fd5b6020026020010151905080601f6000336001600160a01b03166001600160a01b031681526020019081526020016000208481548110610c3457634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255338152601f90915260408120805484908110610c7157634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255338152601f90915260409020805480610cab57634e487b7160e01b600052603160045260246000fd5b6000828152602080822083016000199081018390559092019092558282528080526040808320869055888352808320839055601a825280832054338452601990925290912054610cfb9082611e6e565b33600090815260196020526040902055601854610d189082611e6e565b6018556000878152601b6020908152604080832054338452601d90925290912054610d439082611e6e565b336000908152601d6020526040902055601c54610d609082611e6e565b601c55600354604051632142170760e11b81526001600160a01b03909116906342842e0e90610d9790309033908d90600401612255565b600060405180830381600087803b158015610db157600080fd5b505af1158015610dc5573d6000803e3d6000fd5b5050506000898152601b60209081526040808320839055601a90915280822091909155513391507fa2e0b2a3eb8072b5bdc0b2dacae0f04bccefd4604cf97c93f9e3f8a5dbcb1b1990610e19908b90612545565b60405180910390a25050505050505050565b60185481565b6005546001600160a01b031681565b6000546001600160a01b03163314610e6a5760405162461bcd60e51b815260040161088d906124e6565b600c55565b60175481565b6007544211610e965760405162461bcd60e51b815260040161088d9061234a565b336000908152601f6020908152604080832080548251818502810185019093528083529192909190830182828015610eed57602002820191906000526020600020905b815481526020019060010190808311610ed9575b50939450600193505050505b81518160ff161015610f7d576000828260ff1681518110610f2a57634e487b7160e01b600052603260045260246000fd5b60200260200101511115610f6b57610f6b828260ff1681518110610f5e57634e487b7160e01b600052603260045260246000fd5b6020026020010151610a5e565b80610f75816125f6565b915050610ef9565b5050565b601a6020526000908152604090205481565b33610f9c611c45565b600b55610fa7611691565b600a556001600160a01b03811615610fee57610fc281610737565b6001600160a01b038216600090815260136020908152604080832093909355600b546012909152919020555b600754421161100f5760405162461bcd60e51b815260040161088d9061234a565b600061101a33610737565b905061102533611e50565b156111ec57600081118061104757503360009081526016602052604090205415155b156111e7573360009081526013602090815260408083208390556016909152902054611074908290611e99565b33600090815260166020526040902054600d549192506110949190611e6e565b600d5533600090815260166020526040812055600c546110b5904290611e99565b33600090815260156020526040812091909155601054600e546110de9190610793908590611e81565b9050801561110357600554600154611103916001600160a01b03918216911683611ea5565b600061110f8383611e6e565b6011543360009081526014602052604081205492935091611130919061255c565b42101561115557611152601054610793600f5485611e8190919063ffffffff16565b90505b801561118557600654600154611178916001600160a01b03918216911683611ea5565b6111828282611e6e565b91505b81156111a2576001546111a2906001600160a01b03163384611ea5565b336001600160a01b03167fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e0486836040516111db9190612545565b60405180910390a25050505b610f7d565b8015610f7d5733600090815260136020908152604080832083905560169091529020546112199082611e99565b33600090815260166020526040902055600d546112369082611e99565b600d5560405133907f3523c290f1fe55821da5494c12b82edf5399c04c36cb7abed4b87e2a05fd5b5a9061126b908490612545565b60405180910390a25050565b600d5481565b600f5481565b60146020526000908152604090205481565b601f60205281600052604060002081815481106112b157600080fd5b90600052602060002001600091509150505481565b6000546001600160a01b031633146112f05760405162461bcd60e51b815260040161088d906124e6565b60006112fa611c45565b600b55611305611691565b600a556001600160a01b0381161561134c5761132081610737565b6001600160a01b038216600090815260136020908152604080832093909355600b546012909152919020555b6001546040516370a0823160e01b81526000916001600160a01b0316906370a082319061137d903090600401612241565b60206040518083038186803b15801561139557600080fd5b505afa1580156113a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113cd9190612150565b6001546040516323b872dd60e01b81529192506001600160a01b0316906323b872dd9061140290339030908890600401612255565b602060405180830381600087803b15801561141c57600080fd5b505af1158015611430573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114549190612118565b506001546040516370a0823160e01b81526000916001600160a01b0316906370a0823190611486903090600401612241565b60206040518083038186803b15801561149e57600080fd5b505afa1580156114b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114d69190612150565b905060006114e48284611e6e565b90506008544210611504576114fc8162093a80611e8d565b600955611546565b6008546000906115149042611e6e565b9050600061152d60095483611e8190919063ffffffff16565b905061154062093a806107938584611e99565b60095550505b42600a8190556115599062093a80611e99565b6008556040517fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9061158c908390612545565b60405180910390a15050505050565b60126020526000908152604090205481565b60095481565b60166020526000908152604090205481565b6002546001600160a01b031681565b600a5481565b6001600160a01b031660009081526019602052604090205490565b6003546001600160a01b031681565b6000546001600160a01b0316331461162e5760405162461bcd60e51b815260040161088d906124e6565b600680546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b0316331461167a5760405162461bcd60e51b815260040161088d906124e6565b600f55565b60136020526000908152604090205481565b600061169f42600854611efb565b905090565b6000546001600160a01b031633146116ce5760405162461bcd60e51b815260040161088d906124e6565b601e55565b60105481565b6000546001600160a01b031633146117035760405162461bcd60e51b815260040161088d906124e6565b601155565b60115481565b33611717611c45565b600b55611722611691565b600a556001600160a01b038116156117695761173d81610737565b6001600160a01b038216600090815260136020908152604080832093909355600b546012909152919020555b600754421161178a5760405162461bcd60e51b815260040161088d9061234a565b336000908152601f6020526040902080546117e0578054600181018255600082815260208082209092018190558080529080527f29ab76e7ca72530a8284597fb76b039d796325740b21528d71ade454c6f2dbe9555b805460018181018355600083815260209020909101849055815461180491906125b3565b60008481526020805260408120919091558061181f856107a5565b336000908152601d6020526040812054601e5493955091935090916118448385611e99565b111561185c57601e546118579083611e6e565b61185e565b825b9050801561190a5760175460009061187a906107938785611e81565b336000908152601d60205260409020549091506118979083611e99565b336000908152601d60209081526040808320939093556019905220546118bd9082611e99565b336000908152601960209081526040808320939093558a8252601b8152828220859055601a905220819055601c546118f59083611e99565b601c556018546119059082611e99565b601855505b600354604051632142170760e11b81526001600160a01b03909116906342842e0e9061193e90339030908c90600401612255565b600060405180830381600087803b15801561195857600080fd5b505af115801561196c573d6000803e3d6000fd5b505033600090815260156020526040902054151591506119a7905057600c54611996904290611e99565b336000908152601560205260409020555b3360008181526014602052604090819020429055517f887aea178b533dd5d470ccde3cd6c6c09f8fd2cedc5116fda3f88c83f55479ef906119e9908a90612545565b60405180910390a250505050505050565b60156020526000908152604090205481565b6000546001600160a01b03163314611a365760405162461bcd60e51b815260040161088d906124e6565b6001600160a01b038116611a5c5760405162461bcd60e51b815260040161088d9061243a565b600080546040516001600160a01b03808516939216917f5f56bee8cffbe9a78652a74a60705edede02af10b0bbb888ca44b79a0d42ce8091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60008083118015611ac85750600783105b611ae45760405162461bcd60e51b815260040161088d906124bb565b60008360011415611b1f57611388611afe84612710612594565b611b089190612574565b9050611b17816201adb0611e99565b91505061079f565b8360021415611b5c57610bb8611b3784611388611e6e565b611b4390612710612594565b611b4d9190612574565b9050611b17816201d4c0611e99565b8360031415611b99576103e8611b7484611f40611e6e565b611b8090612710612594565b611b8a9190612574565b9050611b17816201fbd0611e99565b8360041415611bd657610320611bb184612328611e6e565b611bbd90614e20612594565b611bc79190612574565b9050611b1781620222e0611e99565b8360051415611c125760b4611bed84612648611e6e565b611bf990614e20612594565b611c039190612574565b9050611b178162027100611e99565b6014611c20846126fc611e6e565b611c2c90614e20612594565b611c369190612574565b9050611b17816202bf20611e99565b6000611c4f6109a3565b611c5c5750600b546109a7565b61169f611c8a611c6a6109a3565b610793670de0b6b3a764000061078d60095461078d600a5461077e611691565b600b5490611e99565b6001600160a01b0381166000908152601f6020908152604091829020805483518184028101840190945280845260609392830182828015611cf357602002820191906000526020600020905b815481526020019060010190808311611cdf575b50505050509050919050565b602080526000908152604090205481565b60196020526000908152604090205481565b601b6020526000908152604090205481565b6006546001600160a01b031681565b600c5481565b6001546001600160a01b031681565b611d60610e75565b611d68610f93565b565b6001546001600160a01b0383811691161415611d985760405162461bcd60e51b815260040161088d9061241a565b60005460405163a9059cbb60e01b81526001600160a01b038481169263a9059cbb92611dcc929091169085906004016122cd565b602060405180830381600087803b158015611de657600080fd5b505af1158015611dfa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e1e9190612118565b505050565b600e5481565b601d6020526000908152604090205481565b6004546001600160a01b031681565b60075481565b6001600160a01b031660009081526015602052604090205442101590565b6000611e7a82846125b3565b9392505050565b6000611e7a8284612594565b6000611e7a8284612574565b6000611e7a828461255c565b611e1e8363a9059cbb60e01b8484604051602401611ec49291906122cd565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611f11565b6000818310611f0a5781611e7a565b5090919050565b611f23826001600160a01b0316611ffb565b611f3f5760405162461bcd60e51b815260040161088d9061250e565b600080836001600160a01b031683604051611f5a9190612225565b6000604051808303816000865af19150503d8060008114611f97576040519150601f19603f3d011682016040523d82523d6000602084013e611f9c565b606091505b509150915081611fbe5760405162461bcd60e51b815260040161088d906123bb565b805115611ff55780806020019051810190611fd99190612118565b611ff55760405162461bcd60e51b815260040161088d90612471565b50505050565b3b151590565b600060208284031215612012578081fd5b8135611e7a81612642565b60008060008060808587031215612032578283fd5b843561203d81612642565b935060208581013561204e81612642565b935060408601359250606086013567ffffffffffffffff80821115612071578384fd5b818801915088601f830112612084578384fd5b8135818111156120965761209661262c565b604051601f8201601f19168101850183811182821017156120b9576120b961262c565b60405281815283820185018b10156120cf578586fd5b81858501868301379081019093019390935250939692955090935050565b600080604083850312156120ff578182fd5b823561210a81612642565b946020939093013593505050565b600060208284031215612129578081fd5b81518015158114611e7a578182fd5b600060208284031215612149578081fd5b5035919050565b600060208284031215612161578081fd5b5051919050565b6000806040838503121561217a578182fd5b50508035926020909101359150565b6000806000806000806000806000806000806101808d8f0312156121ab578788fd5b8c519b5060208d01519a5060408d0151995060608d0151985060808d0151975060a08d0151965060c08d0151955060e08d01516121e781612642565b6101008e01519095506121f981612642565b809450506101208d015192506101408d015191506101608d015190509295989b509295989b509295989b565b600082516122378184602087016125ca565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b600060018060a01b0380871683528086166020840152508360408301526080606083015282518060808401526122b68160a08501602087016125ca565b601f01601f19169190910160a00195945050505050565b6001600160a01b03929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b8181101561231e57835183529284019291840191600101612302565b50909695505050505050565b901515815260200190565b6001600160e01b031991909116815260200190565b6020808252600990820152681b9bdd081cdd185c9d60ba1b604082015260600190565b60208082526010908201526f3a34329033b2b3b7a4b21032b93937b960811b604082015260600190565b6020808252600a90820152696765676f207374616b6560b01b604082015260600190565b6020808252818101527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604082015260600190565b60208082526010908201526f3737ba1033b2b3b7a4b21037bbb732b960811b604082015260600190565b6020808252600690820152651c995dd85c9960d21b604082015260600190565b6020808252601f908201527f6e657720676f7665726e616e636520746865207a65726f206164647265737300604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b602080825260119082015270746865206765676f206e6f74206465676f60781b604082015260600190565b6020808252600e908201526d6e6f7420676f7665726e616e636560901b604082015260600190565b6020808252601f908201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604082015260600190565b90815260200190565b918252602082015260400190565b6000821982111561256f5761256f612616565b500190565b60008261258f57634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156125ae576125ae612616565b500290565b6000828210156125c5576125c5612616565b500390565b60005b838110156125e55781810151838201526020016125cd565b83811115611ff55750506000910152565b600060ff821660ff81141561260d5761260d612616565b60010192915050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461265757600080fd5b5056fea26469706673582212200508d7e82286168864d6c804dd3404890039b83bcf005e228e000efa20147d1864736f6c63430008000033000000000000000000000000eca16df8d11d3a160ff7a835a8dd91e0ae2964890000000000000000000000009d95b5ea6c8f678b7486be7a6331ec10a54156bd0000000000000000000000005ca42204cdaa70d5c773946e69de942b85ca670600000000000000000000000000000000000000000000000000000000611901c0

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

000000000000000000000000eca16df8d11d3a160ff7a835a8dd91e0ae2964890000000000000000000000009d95b5ea6c8f678b7486be7a6331ec10a54156bd0000000000000000000000005ca42204cdaa70d5c773946e69de942b85ca670600000000000000000000000000000000000000000000000000000000611901c0

-----Decoded View---------------
Arg [0] : posiNftToken (address): 0xeca16df8d11d3a160ff7a835a8dd91e0ae296489
Arg [1] : gegoFactory (address): 0x9d95b5ea6c8f678b7486be7a6331ec10a54156bd
Arg [2] : rewardAddress (address): 0x5ca42204cdaa70d5c773946e69de942b85ca6706
Arg [3] : startTime (uint256): 1629028800

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000eca16df8d11d3a160ff7a835a8dd91e0ae296489
Arg [1] : 0000000000000000000000009d95b5ea6c8f678b7486be7a6331ec10a54156bd
Arg [2] : 0000000000000000000000005ca42204cdaa70d5c773946e69de942b85ca6706
Arg [3] : 00000000000000000000000000000000000000000000000000000000611901c0


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.