XDC Price: $0.081837 (+4.67%)

Contract

0x8701Ce4b2b3a90684eb184857Fc2ea3F09Da1d07
Transaction Hash
Method
Block
From
To
Deposit LP910619362025-07-14 4:48:0841 mins ago1752468488IN
0x8701Ce4b...F09Da1d07
0 XDC0.0026804313.75
Deposit LP910618892025-07-14 4:46:0843 mins ago1752468368IN
0x8701Ce4b...F09Da1d07
0 XDC0.0030865113.75
Deposit LP910618462025-07-14 4:44:4244 mins ago1752468282IN
0x8701Ce4b...F09Da1d07
0 XDC0.0023881413.75
Deposit LP910618302025-07-14 4:43:5245 mins ago1752468232IN
0x8701Ce4b...F09Da1d07
0 XDC0.0030847513.75
Deposit LP910618102025-07-14 4:43:1246 mins ago1752468192IN
0x8701Ce4b...F09Da1d07
0 XDC0.0029276913.75
Deposit LP910617912025-07-14 4:42:3246 mins ago1752468152IN
0x8701Ce4b...F09Da1d07
0 XDC0.0038160213.75
Deposit LP910617762025-07-14 4:42:0247 mins ago1752468122IN
0x8701Ce4b...F09Da1d07
0 XDC0.0034645413.75
Deposit LP910617632025-07-14 4:41:2847 mins ago1752468088IN
0x8701Ce4b...F09Da1d07
0 XDC0.0031348213.75
Deposit LP910617022025-07-14 4:39:1550 mins ago1752467955IN
0x8701Ce4b...F09Da1d07
0 XDC0.0028720813.75
Deposit LP910456992025-07-13 19:02:1910 hrs ago1752433339IN
0x8701Ce4b...F09Da1d07
0 XDC0.0033410713.75
Deposit LP910456762025-07-13 19:01:2510 hrs ago1752433285IN
0x8701Ce4b...F09Da1d07
0 XDC0.0038151413.75
Deposit LP910168192025-07-13 1:42:5227 hrs ago1752370972IN
0x8701Ce4b...F09Da1d07
0 XDC0.0024367612.5
Deposit LP910167992025-07-13 1:42:1227 hrs ago1752370932IN
0x8701Ce4b...F09Da1d07
0 XDC0.0034691112.5
Deposit LP910167762025-07-13 1:41:1727 hrs ago1752370877IN
0x8701Ce4b...F09Da1d07
0 XDC0.0025343312.5
Deposit LP910167582025-07-13 1:40:3227 hrs ago1752370832IN
0x8701Ce4b...F09Da1d07
0 XDC0.0021710312.5
Deposit LP910167172025-07-13 1:39:0827 hrs ago1752370748IN
0x8701Ce4b...F09Da1d07
0 XDC0.0035128812.5
Deposit LP910167012025-07-13 1:38:2827 hrs ago1752370708IN
0x8701Ce4b...F09Da1d07
0 XDC0.0031495812.5
Deposit LP909921272025-07-12 11:06:0042 hrs ago1752318360IN
0x8701Ce4b...F09Da1d07
0 XDC0.0032927613.75
Deposit LP909920922025-07-12 11:04:5042 hrs ago1752318290IN
0x8701Ce4b...F09Da1d07
0 XDC0.0026804313.75
Deposit LP909920872025-07-12 11:04:4042 hrs ago1752318280IN
0x8701Ce4b...F09Da1d07
0 XDC0.0018163413.75
Deposit LP909920812025-07-12 11:04:2842 hrs ago1752318268IN
0x8701Ce4b...F09Da1d07
0 XDC0.0029285713.75
Deposit LP909920772025-07-12 11:04:2042 hrs ago1752318260IN
0x8701Ce4b...F09Da1d07
0 XDC0.0036707913.75
Deposit LP909920722025-07-12 11:04:1042 hrs ago1752318250IN
0x8701Ce4b...F09Da1d07
0 XDC0.0031339413.75
Deposit LP909920672025-07-12 11:04:0042 hrs ago1752318240IN
0x8701Ce4b...F09Da1d07
0 XDC0.0023881413.75
Deposit LP909873192025-07-12 8:15:5045 hrs ago1752308150IN
0x8701Ce4b...F09Da1d07
0 XDC0.0024359612.5
View all transactions

Advanced mode:
Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
NexusGenerator

Compiler Version
v0.8.12+commit.f00d7308

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./NexusToken.sol";
import "./Utils/MultiOwnable.sol";

contract NexusGenerator is MultiOwnable, ReentrancyGuard {
    using SafeMath for uint256;

    using SafeERC20 for IERC20;

    uint256 public constant BONUS_MULTIPLIER = 10;

    struct UserInfo {
        uint256 amount; // How many LP tokens the user has provided.
        uint256 rewardDebt; // Reward debt. See explanation below.
    }

    struct PoolInfo {
        IERC20 lpToken; // Address of LP token contract.
        uint256 allocPoint; // How many allocation points assigned to this pool. NXSs to distribute per block.
        uint256 lastRewardBlock; // Last block number that NXSs distribution occurs.
        uint256 accNexusPerShare; // Accumulated NXSs per share, times 1e12. See below.
        uint256 totalLockedLP;
    }

    struct PendingRewardInfo {
        address rewardToken;
        uint256 pendingReward;
    }

    struct ReductionInfo {
        uint256 reductionNumber;
        uint256 fromBlock;
        uint256 toBlock;
        uint256 nexusPerBlock;
    }

    // Info of each Reward Token.
    struct RewardTokenInfo {
        IERC20 rewardToken; //Address of Reward Token contract for stakers
        uint256 distRate; //Distributed Rate per block
        uint256 remainAmount; // Deposited Amount as reward token for any lp token contract
        uint256 rewardDuration;
        uint256 lastRewardTimestamp; // Last timestamp that Reward Token distribution occurs.
        uint256 accRewardPerShare;
    }
    // The NXS TOKEN!
    NexusToken public nexus;
    // Dev address.
    address public multiStakingDistributor;

    address public treasury;

    // Block number when bonus NXS period ends.
    uint256 public bonusEndBlock;
    // NXS tokens % distributed to multistaking.
    uint256 public multiStakingDistRate = 10;
    // NXS tokens created per block
    uint256 public nexusPerBlock;
    // Bonus muliplier for early nexus makers.

    uint256 public REDUCTION_RATE; // 91% for every

    uint256 public REDUCTION_PERIOD; // The reduction occurs for every 3000 blocks.

    uint256 public reductionNumber;

    uint256 public nextReductionBlock;

    // Info of each pool.
    PoolInfo[] public poolInfo;

    //Reward Token Infoes of each pool
    mapping(uint256 => RewardTokenInfo[]) public rewardTokenInfo;

    // Info of each user that stakes LP tokens.
    mapping(uint256 => mapping(address => UserInfo)) public userInfo;

    // Info of each user that claimed the reward token. pid -> user -> rewardToken -> amount.
    mapping(uint256 => mapping(address => mapping(address => uint256))) rewardTokenDebt;

    mapping(uint256 => ReductionInfo) reduction; // poolId -> ReducctionInfo;
    // Total allocation poitns. Must be the sum of all allocation points in all pools.
    uint256 public totalAllocPoint = 0;
    // The block number when NXS mining starts.
    uint256 public startBlock;

    event DepositLP(address indexed user, uint256 indexed pid, uint256 amount);

    event DepositRewardToken(
        address indexed user,
        uint256 indexed pid,
        address indexed rewardToken,
        uint256 amount
    );

    event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);

    event EmergencyWithdraw(
        address indexed user,
        uint256 indexed pid,
        uint256 amount
    );

    constructor(
        NexusToken _nexus,
        address _multiStakingDistributor,
        uint256 _nexusPerBlock,
        uint256 _startBlock,
        uint256 _bonusEndBlock
    ) {
        nexus = _nexus;
        multiStakingDistributor = _multiStakingDistributor;
        nexusPerBlock = _nexusPerBlock;
        bonusEndBlock = _bonusEndBlock;
        startBlock = _startBlock;
        nextReductionBlock = block.number.add(REDUCTION_PERIOD);
        setOwner(msg.sender, msg.sender);
    }

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

    // Add a new lp to the pool. Can only be called by the owner.
    // XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do.
    function add(
        uint256 _allocPoint,
        IERC20 _lpToken,
        bool _withUpdate
    ) public onlyOwner {
        if (poolLength() > getPoolId(_lpToken)) return;
        if (_withUpdate) {
            massUpdatePools();
        }
        uint256 lastRewardBlock = block.number > startBlock
            ? block.number
            : startBlock;
        totalAllocPoint = totalAllocPoint.add(_allocPoint);
        poolInfo.push(
            PoolInfo({
                lpToken: _lpToken,
                allocPoint: _allocPoint,
                lastRewardBlock: lastRewardBlock,
                accNexusPerShare: 0,
                totalLockedLP: 0
            })
        );
        _updateReductionStatusOfPool(poolLength() - 1);
    }

    // Add a new Reward Token to the pool, It will be distributed e.g XYZ token
    function setRewardToken(
        IERC20 _lpToken,
        IERC20 _rewardToken,
        uint256 _distRate
    ) external onlyOwner {
        uint256 _pid = getPoolId(_lpToken);
        if (_pid == poolLength()) {
            add(0, _lpToken, false);
        }
        uint256 _rid = getRewardTokenId(_pid, _rewardToken);
        if (_rid < rewardTokenInfo[_pid].length) {
            updateRewardTokenStatus(_pid, _rid);

            RewardTokenInfo storage rtInfo = rewardTokenInfo[_pid][_rid];
            rtInfo.rewardDuration = rtInfo.remainAmount.div(_distRate);
            rtInfo.distRate = _distRate;
        } else {
            rewardTokenInfo[_pid].push(
                RewardTokenInfo({
                    rewardToken: _rewardToken,
                    distRate: _distRate,
                    remainAmount: 0,
                    rewardDuration: 0,
                    lastRewardTimestamp: type(uint256).max,
                    accRewardPerShare: 0
                })
            );
        }
    }

    function removeRewardToken(
        uint256 _pid,
        IERC20 _rewardToken
    ) public onlyOwner {
        require(_pid < poolInfo.length, "No Such Pool");
        uint256 _rid = getRewardTokenId(_pid, _rewardToken);
        require(
            _rid < rewardTokenInfo[_pid].length,
            "No Such Reward Token in pool"
        );
        RewardTokenInfo[] storage rtInfo = rewardTokenInfo[_pid];
        rtInfo[_rid] = rtInfo[rtInfo.length - 1];
        rtInfo.pop();
    }

    // Update the given pool's NXS allocation point. Can only be called by the owner.
    function set(
        uint256 _pid,
        uint256 _allocPoint,
        bool _withUpdate
    ) public onlyOwner {
        if (_withUpdate) {
            massUpdatePools();
        }
        totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(
            _allocPoint
        );
        poolInfo[_pid].allocPoint = _allocPoint;
    }

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

    // Update the Multistaking getter contract address
    function setMultiStakingDistributorGetter(
        address _multiStakingDistributor
    ) external onlyOwner {
        multiStakingDistributor = _multiStakingDistributor;
    }

    function setNexusTreasury(address _treasury) external onlyOwner {
        treasury = _treasury;
    }

    function setMultiStakingDistRate(uint256 _rate) external onlyOwner {
        require(_rate <= 10, "Cannot be large than 10%");
        multiStakingDistRate = _rate;
    }

    function setNexuReward(
        uint256 _nexuPerBlock,
        uint256 _reductionRate,
        uint256 _reductionPeriod
    ) public onlyOwner {
        massUpdatePools();
        nexusPerBlock = _nexuPerBlock;
        REDUCTION_PERIOD = _reductionPeriod;
        REDUCTION_RATE = _reductionRate;
        nextReductionBlock = block.number.add(REDUCTION_PERIOD);
        massUpdatePools();
    }

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

    // View function to see pending NXSs on frontend.
    function pendingNexusByUser(
        uint256 _pid,
        address _user
    ) public view returns (uint256) {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][_user];
        uint256 accNexusPerShare = pool.accNexusPerShare;
        uint256 lpSupply = pool.totalLockedLP;
        if (lpSupply == 0) return 0;
        uint256 nexusReward = pendingNexusByPool(_pid).div(100);
        uint256 nexuTothis = nexusReward.mul(
            uint256(100).sub(multiStakingDistRate)
        );
        accNexusPerShare = accNexusPerShare.add(
            nexuTothis.mul(1e12).div(lpSupply)
        );
        return user.amount.mul(accNexusPerShare).div(1e12).sub(user.rewardDebt);
    }

    function pendingNexusByPool(uint256 _pid) public view returns (uint256) {
        PoolInfo memory pool = poolInfo[_pid];
        ReductionInfo memory redInfo = reduction[_pid];
        uint256 lastRewardBlock = pool.lastRewardBlock;
        uint256 nexusReward;
        uint256 multiplier;
        while (lastRewardBlock != block.number) {
            if (redInfo.toBlock < block.number) {
                multiplier = getMultiplier(lastRewardBlock, redInfo.toBlock);
                lastRewardBlock = redInfo.toBlock;
                redInfo.fromBlock += REDUCTION_PERIOD;
                redInfo.toBlock += REDUCTION_PERIOD;
                nexusReward = nexusReward.add(
                    multiplier
                        .mul(redInfo.nexusPerBlock)
                        .mul(pool.allocPoint)
                        .div(totalAllocPoint)
                );
                redInfo.nexusPerBlock = redInfo
                    .nexusPerBlock
                    .mul(REDUCTION_RATE)
                    .div(1000000);
            } else {
                multiplier = getMultiplier(lastRewardBlock, block.number);
                lastRewardBlock = block.number;
                nexusReward = nexusReward.add(
                    multiplier
                        .mul(redInfo.nexusPerBlock)
                        .mul(pool.allocPoint)
                        .div(totalAllocPoint)
                );
            }
        }
        return nexusReward;
    }

    function pendingRewardToken(
        uint256 _pid,
        uint256 _rid,
        address _user
    ) public view returns (uint256) {
        PoolInfo memory pool = poolInfo[_pid];
        RewardTokenInfo memory rtInfo = rewardTokenInfo[_pid][_rid];
        UserInfo memory user = userInfo[_pid][_user];
        uint256 accRewardPerShare = rtInfo.accRewardPerShare;
        uint256 lpSupply = pool.totalLockedLP;
        if (rtInfo.rewardDuration != 0 && lpSupply != 0) {
            uint256 rewardDuration;
            if (rtInfo.lastRewardTimestamp > block.timestamp)
                rewardDuration = 0;
            else if (
                block.timestamp >=
                rtInfo.lastRewardTimestamp.add(rtInfo.rewardDuration)
            ) {
                rewardDuration = rtInfo.rewardDuration;
            } else {
                rewardDuration = block.timestamp.sub(
                    rtInfo.lastRewardTimestamp
                );
            }
            uint256 reward = rewardDuration.mul(rtInfo.distRate);
            uint256 sendingAmount = rtInfo.remainAmount >= reward
                ? reward
                : rtInfo.remainAmount;
            accRewardPerShare = accRewardPerShare.add(
                sendingAmount.mul(1e12).div(lpSupply)
            );
        }
        uint256 rewardDebt = rewardTokenDebt[_pid][_user][
            address(rtInfo.rewardToken)
        ];
        return user.amount.mul(accRewardPerShare).div(1e12).sub(rewardDebt);
    }

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

    function massRTInfoesUpdate(uint256 _pid) public {
        RewardTokenInfo[] storage rtInfoes = rewardTokenInfo[_pid];
        uint len = rtInfoes.length;
        for (uint256 i = 0; i < len; i++) {
            updateRewardTokenStatus(_pid, i);
        }
    }

    // Update reward variables of the given pool to be up-to-date.
    function updatePool(uint256 _pid) public {
        if (_pid >= poolLength()) return;
        PoolInfo storage pool = poolInfo[_pid];
        uint256 lpSupply = pool.totalLockedLP;
        uint256 nexusReward = pendingNexusByPool(_pid).div(100);
        uint256 nexuToMultiStaking = nexusReward.mul(multiStakingDistRate);
        uint256 nexuTothis = nexusReward.mul(
            uint256(100).sub(multiStakingDistRate)
        );
        _updateReductionStatusOfPool(_pid);
        pool.lastRewardBlock = block.number;
        if (lpSupply == 0) return;
        nexus.mint(multiStakingDistributor, nexuToMultiStaking);
        nexus.mint(address(this), nexuTothis);
        pool.accNexusPerShare = pool.accNexusPerShare.add(
            nexuTothis.mul(1e12).div(lpSupply)
        );
    }

    function _reductionNexusPerBlock() internal {
        while (nextReductionBlock <= block.number) {
            nextReductionBlock = nextReductionBlock.add(REDUCTION_PERIOD);
            if (nexusPerBlock < 1 || REDUCTION_RATE < 1) continue;
            nexusPerBlock = nexusPerBlock.mul(REDUCTION_RATE).div(1000000);
            reductionNumber++;
        }
    }

    function _updateReductionStatusOfPool(uint256 _pid) internal {
        _reductionNexusPerBlock();
        ReductionInfo storage redInfo = reduction[_pid];
        redInfo.fromBlock = nextReductionBlock.sub(REDUCTION_PERIOD);
        redInfo.toBlock = nextReductionBlock;
        redInfo.nexusPerBlock = nexusPerBlock;
        redInfo.reductionNumber = reductionNumber;
    }

    function updateRewardTokenStatus(uint256 _pid, uint256 _rid) public {
        PoolInfo memory pool = poolInfo[_pid];
        RewardTokenInfo storage rtInfo = rewardTokenInfo[_pid][_rid];
        uint256 lpSupply = pool.totalLockedLP;
        if (lpSupply == 0) {
            rtInfo.lastRewardTimestamp = type(uint256).max;
            rtInfo.rewardDuration = 0;
            return;
        }
        uint256 rewardDuration;
        if (rtInfo.lastRewardTimestamp > block.timestamp) return;
        uint256 last = rtInfo.lastRewardTimestamp.add(rtInfo.rewardDuration);
        if (block.timestamp > last) {
            rewardDuration = rtInfo.rewardDuration;
            rtInfo.lastRewardTimestamp = type(uint256).max;
            rtInfo.rewardDuration = 0;
        } else {
            rewardDuration = block.timestamp.sub(rtInfo.lastRewardTimestamp);
            rtInfo.lastRewardTimestamp = block.timestamp;
            rtInfo.rewardDuration = rtInfo.rewardDuration.sub(rewardDuration);
        }
        uint256 expectedReward = rewardDuration.mul(rtInfo.distRate);
        uint256 reward = rtInfo.remainAmount >= expectedReward
            ? expectedReward
            : rtInfo.remainAmount;
        uint256 moreShare = reward.mul(1e12).div(lpSupply);
        rtInfo.accRewardPerShare = rtInfo.accRewardPerShare.add(moreShare);
        rtInfo.remainAmount = rtInfo.remainAmount.sub(reward);
    }

    // Deposit LP tokens to NexusGenerator for NXS allocation.
    function depositLP(uint256 _pid, uint256 _amount) public nonReentrant {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];
        uint256 rtLen = rewardTokenInfo[_pid].length;
        updatePool(_pid);
        massRTInfoesUpdate(_pid);
        for (uint256 i = 0; i < rtLen; i++) {
            RewardTokenInfo memory rtInfo = rewardTokenInfo[_pid][i];
            uint256 pendingReward = pendingRewardToken(_pid, i, msg.sender);
            rewardTokenDebt[_pid][msg.sender][address(rtInfo.rewardToken)] = (
                user.amount.add(_amount)
            ).mul(rtInfo.accRewardPerShare).div(1e12);
            if (pendingReward > 0)
                rtInfo.rewardToken.transfer(msg.sender, pendingReward);
        }
        if (user.amount > 0) {
            uint256 pending = user
                .amount
                .mul(pool.accNexusPerShare)
                .div(1e12)
                .sub(user.rewardDebt);
            if (pending > 0) _safeNexusTransfer(msg.sender, pending);
        }
        if (_amount > 0)
            pool.lpToken.transferFrom(msg.sender, address(this), _amount);
        user.amount = user.amount.add(_amount);
        user.rewardDebt = user.amount.mul(pool.accNexusPerShare).div(1e12);
        pool.totalLockedLP = pool.totalLockedLP.add(_amount);
        emit DepositLP(msg.sender, _pid, _amount);
    }

    //Deposit Reward Token to this smart contract.
    function depositRewardToken(
        uint256 _pid,
        IERC20 _rewardToken,
        uint256 _depositAmount
    ) public nonReentrant {
        require(_pid < poolLength(), "Non Exist Pool");
        uint256 _rid = getRewardTokenId(_pid, _rewardToken);
        require(_rid < rewardTokenInfo[_pid].length, "No reward token setting");
        updateRewardTokenStatus(_pid, _rid);
        RewardTokenInfo storage rtInfo = rewardTokenInfo[_pid][_rid];
        uint256 _amount = _depositAmount.mul(99).div(100);
        uint256 _fee = _depositAmount.mul(50).div(10000);
        rtInfo.remainAmount += _amount;
        rtInfo.lastRewardTimestamp = block.timestamp;
        rtInfo.rewardDuration += _amount.div(rtInfo.distRate);
        if (_depositAmount > 0)
            _rewardToken.transferFrom(
                address(msg.sender),
                address(this),
                _depositAmount
            );
        if (_fee > 0) {
            _rewardToken.transfer(multiStakingDistributor, _fee);
            _rewardToken.transfer(treasury, _fee);
        }
        emit DepositRewardToken(
            msg.sender,
            _pid,
            address(_rewardToken),
            _amount
        );
    }

    // Withdraw LP tokens from NexusGenerator.
    function withdraw(uint256 _pid, uint256 _amount) public nonReentrant {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];
        uint256 rtLen = rewardTokenInfo[_pid].length;
        require(user.amount >= _amount, "withdraw: not good");
        updatePool(_pid);
        massRTInfoesUpdate(_pid);
        for (uint256 i = 0; i < rtLen; i++) {
            RewardTokenInfo memory rtInfo = rewardTokenInfo[_pid][i];
            uint256 pendingReward = pendingRewardToken(_pid, i, msg.sender);
            rewardTokenDebt[_pid][msg.sender][address(rtInfo.rewardToken)] = (
                user.amount.sub(_amount)
            ).mul(rtInfo.accRewardPerShare).div(1e12);
            if (pendingReward > 0)
                rtInfo.rewardToken.transfer(msg.sender, pendingReward);
        }
        uint256 pending = user.amount.mul(pool.accNexusPerShare).div(1e12).sub(
            user.rewardDebt
        );
        if (pending > 0) _safeNexusTransfer(msg.sender, pending);

        user.amount = user.amount.sub(_amount);
        user.rewardDebt = user.amount.mul(pool.accNexusPerShare).div(1e12);
        if (_amount > 0)
            pool.lpToken.safeTransfer(address(msg.sender), _amount);
        pool.totalLockedLP = pool.totalLockedLP.sub(_amount);
        emit Withdraw(msg.sender, _pid, _amount);
    }

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

    function getPendingRewardInfoes(
        uint256 _pid,
        address _user
    ) external view returns (PendingRewardInfo[] memory) {
        uint256 rewardLen = rewardTokenInfo[_pid].length;
        PendingRewardInfo[] memory res = new PendingRewardInfo[](rewardLen + 1);
        res[0].rewardToken = address(nexus);
        res[0].pendingReward = pendingNexusByUser(_pid, _user);
        for (uint256 i = 0; i < rewardLen; i++) {
            res[i + 1].rewardToken = address(
                rewardTokenInfo[_pid][i].rewardToken
            );
            res[i + 1].pendingReward = pendingRewardToken(_pid, i, _user);
        }
        return res;
    }

    function getPoolInfo(uint256 _pid) external view returns (PoolInfo memory) {
        return poolInfo[_pid];
    }

    function getRewardTokenInfo(
        uint256 _pid
    ) external view returns (RewardTokenInfo[] memory) {
        return rewardTokenInfo[_pid];
    }

    function getRewardTokenId(
        uint256 _pid,
        IERC20 _rewardToken
    ) public view returns (uint256) {
        RewardTokenInfo[] memory rtInfoes = rewardTokenInfo[_pid];
        for (uint256 i = 0; i < rtInfoes.length; i++) {
            if (rtInfoes[i].rewardToken == _rewardToken) return i;
        }
        return rtInfoes.length;
    }

    function getPoolId(IERC20 _lpToken) public view returns (uint256) {
        uint256 pLen = poolLength();
        for (uint256 i = 0; i < pLen; ++i) {
            if (poolInfo[i].lpToken == _lpToken) return i;
        }
        return pLen;
    }

    function getNexusPerBlock() public view returns (uint256) {
        uint256 result = nexusPerBlock;
        uint256 reductionblock = nextReductionBlock;
        while (reductionblock <= block.number) {
            result = result.mul(REDUCTION_RATE).div(1000000);
            reductionblock = reductionblock.add(REDUCTION_PERIOD);
        }
        return result;
    }
}

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

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

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

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     *
     * CAUTION: See Security Considerations above.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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);

    /**
     * @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 `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

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

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

    /**
     * @dev Moves `amount` tokens from `from` to `to` 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 from, address to, uint256 amount) external returns (bool);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.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 IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    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'
        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));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @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. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
    }

    /**
     * @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).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
    }
}

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, "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");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, 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) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, 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) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // 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
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

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

pragma solidity ^0.8.0;

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

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

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)

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 generally not needed starting with Solidity 0.8, since 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 subtraction 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;
        }
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";

contract NexusToken is IERC20, Ownable {
    using SafeMath for uint256;

    mapping(address => uint256) private _balances;

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

    string private _name;
    string private _symbol;
    uint8 private _decimals;
    uint256 private _totalSupply;
    uint256 private _maxSupply;

    address public owner1;
    address public owner2;
    address public owner3;

    modifier onlyOwnerRole() {
        require(
            msg.sender == owner1 ||
            msg.sender == owner2 ||
            msg.sender == owner3,
            "User is not owner"
        );
        _;
    }

    constructor() {
        _name = "Nexus";
        _symbol = "NEXU";
        _decimals = 18;
        _maxSupply = 1111111111 * (10 ** uint256(_decimals));
    }

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

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the the max supply of the token.
     */
    function getMaxSupply() public view returns (uint256) {
        return _maxSupply;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5,05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
     * called.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual returns (uint8) {
        return _decimals;
    }

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

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

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

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

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

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

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

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

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

        _beforeTokenTransfer(sender, recipient, amount);
        uint256 fromBalance = _balances[sender];
        require(
            fromBalance >= amount,
            "ERC20: transfer amount exceeds balance"
        );

        _balances[sender] = _balances[sender].sub(
            amount,
            "ERC20: transfer amount exceeds balance"
        );
        _balances[recipient] = _balances[recipient].add(amount);

        _moveDelegates(_delegates[sender], _delegates[recipient], amount);
        emit Transfer(sender, recipient, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply. The total supply cannot be greater than the max supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * total supply cannot be greater than max supply.
     */

    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        uint256 newTotalSupply = _totalSupply.add(amount);
        require(newTotalSupply <= _maxSupply, "ERC20: max supply exceeded");

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

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

        _beforeTokenTransfer(account, address(0), amount);

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

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

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

    /**
     * @dev Sets {decimals} to a value other than the default one of 18.
     *
     * WARNING: This function should only be called from the constructor. Most
     * applications that interact with token contracts will not expect
     * {decimals} to ever change, and may work incorrectly if it does.
     */
    function _setupDecimals(uint8 decimals_) internal virtual {
        _decimals = decimals_;
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be to transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens 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 amount
    ) internal virtual {}

    function mint(address _to, uint256 _amount) public onlyOwnerRole {
        _mint(_to, _amount);
        _moveDelegates(address(0), _delegates[_to], _amount);
    }

    function setOwner(
        address owner1_,
        address owner2_,
        address owner3_
    ) public onlyOwner() {
        owner1 = owner1_;
        owner2 = owner2_;
        owner3 = owner3_;
    }

    /// @dev A record of each accounts delegate
    mapping(address => address) internal _delegates;

    /// @dev A checkpoint for marking number of votes from a given block
    struct Checkpoint {
        uint32 fromBlock;
        uint256 votes;
    }

    /// @dev A record of votes checkpoints for each account, by index
    mapping(address => mapping(uint32 => Checkpoint)) public checkpoints;

    /// @dev The number of checkpoints for each account
    mapping(address => uint32) public numCheckpoints;

    /// @dev The EIP-712 typehash for the contract's domain
    bytes32 public constant DOMAIN_TYPEHASH =
        keccak256(
            "EIP712Domain(string name,uint256 chainId,address verifyingContract)"
        );

    /// @dev The EIP-712 typehash for the delegation struct used by the contract
    bytes32 public constant DELEGATION_TYPEHASH =
        keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");

    /// @dev A record of states for signing / validating signatures
    mapping(address => uint256) public nonces;

    /// @dev An event thats emitted when an account changes its delegate
    event DelegateChanged(
        address indexed delegator,
        address indexed fromDelegate,
        address indexed toDelegate
    );

    /// @dev An event thats emitted when a delegate account's vote balance changes
    event DelegateVotesChanged(
        address indexed delegate,
        uint256 previousBalance,
        uint256 newBalance
    );

    /**
     * @dev Delegate votes from `msg.sender` to `delegatee`
     * @param delegator The address to get delegatee for
     */
    function delegates(address delegator) external view returns (address) {
        return _delegates[delegator];
    }

    /**
     * @dev Delegate votes from `msg.sender` to `delegatee`
     * @param delegatee The address to delegate votes to
     */
    function delegate(address delegatee) external {
        return _delegate(msg.sender, delegatee);
    }

    /**
     * @dev Delegates votes from signatory to `delegatee`
     * @param delegatee The address to delegate votes to
     * @param nonce The contract state required to match the signature
     * @param expiry The time at which to expire the signature
     * @param v The recovery byte of the signature
     * @param r Half of the ECDSA signature pair
     * @param s Half of the ECDSA signature pair
     */
    function delegateBySig(
        address delegatee,
        uint256 nonce,
        uint256 expiry,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external {
        bytes32 domainSeparator = keccak256(
            abi.encode(
                DOMAIN_TYPEHASH,
                keccak256(bytes(name())),
                getChainId(),
                address(this)
            )
        );

        bytes32 structHash = keccak256(
            abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry)
        );

        bytes32 digest = keccak256(
            abi.encodePacked("\x19\x01", domainSeparator, structHash)
        );

        address signatory = ecrecover(digest, v, r, s);
        require(
            signatory != address(0),
            "NEXU::delegateBySig: invalid signature"
        );
        require(
            nonce == nonces[signatory]++,
            "NEXU::delegateBySig: invalid nonce"
        );
        require(
            block.timestamp <= expiry,
            "NEXU::delegateBySig: signature expired"
        );
        return _delegate(signatory, delegatee);
    }

    /**
     * @dev Gets the current votes balance for `account`
     * @param account The address to get votes balance
     * @return The number of current votes for `account`
     */
    function getCurrentVotes(address account) external view returns (uint256) {
        uint32 nCheckpoints = numCheckpoints[account];
        return
            nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
    }

    /**
     * @dev Determine the prior number of votes for an account as of a block number
     * @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
     * @param account The address of the account to check
     * @param blockNumber The block number to get the vote balance at
     * @return The number of votes the account had as of the given block
     */
    function getPriorVotes(
        address account,
        uint256 blockNumber
    ) external view returns (uint256) {
        require(
            blockNumber < block.number,
            "NEXU::getPriorVotes: not yet determined"
        );

        uint32 nCheckpoints = numCheckpoints[account];
        if (nCheckpoints == 0) {
            return 0;
        }

        // First check most recent balance
        if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
            return checkpoints[account][nCheckpoints - 1].votes;
        }

        // Next check implicit zero balance
        if (checkpoints[account][0].fromBlock > blockNumber) {
            return 0;
        }

        uint32 lower = 0;
        uint32 upper = nCheckpoints - 1;
        while (upper > lower) {
            uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
            Checkpoint memory cp = checkpoints[account][center];
            if (cp.fromBlock == blockNumber) {
                return cp.votes;
            } else if (cp.fromBlock < blockNumber) {
                lower = center;
            } else {
                upper = center - 1;
            }
        }
        return checkpoints[account][lower].votes;
    }

    function _delegate(address delegator, address delegatee) internal {
        address currentDelegate = _delegates[delegator];
        uint256 delegatorBalance = balanceOf(delegator); // balance of underlying NEXUs (not scaled);
        _delegates[delegator] = delegatee;

        emit DelegateChanged(delegator, currentDelegate, delegatee);

        _moveDelegates(currentDelegate, delegatee, delegatorBalance);
    }

    function _moveDelegates(
        address srcRep,
        address dstRep,
        uint256 amount
    ) internal {
        if (srcRep != dstRep && amount > 0) {
            if (srcRep != address(0)) {
                // decrease old representative
                uint32 srcRepNum = numCheckpoints[srcRep];
                uint256 srcRepOld = srcRepNum > 0
                    ? checkpoints[srcRep][srcRepNum - 1].votes
                    : 0;
                uint256 srcRepNew = srcRepOld.sub(amount);
                _writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
            }

            if (dstRep != address(0)) {
                // increase new representative
                uint32 dstRepNum = numCheckpoints[dstRep];
                uint256 dstRepOld = dstRepNum > 0
                    ? checkpoints[dstRep][dstRepNum - 1].votes
                    : 0;
                uint256 dstRepNew = dstRepOld.add(amount);
                _writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
            }
        }
    }

    function _writeCheckpoint(
        address delegatee,
        uint32 nCheckpoints,
        uint256 oldVotes,
        uint256 newVotes
    ) internal {
        uint32 blockNumber = safe32(
            block.number,
            "NEXU::_writeCheckpoint: block number exceeds 32 bits"
        );

        if (
            nCheckpoints > 0 &&
            checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber
        ) {
            checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
        } else {
            checkpoints[delegatee][nCheckpoints] = Checkpoint(
                blockNumber,
                newVotes
            );
            numCheckpoints[delegatee] = nCheckpoints + 1;
        }

        emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
    }

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

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

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;

abstract contract MultiOwnable {
    address private _ownerSetter;

    address public owner;
    address public ownerGovernance;

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

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

    modifier onlyOwner() {
        require(
            owner == _msgSender() || ownerGovernance == _msgSender(),
            "User is not owner"
        );
        _;
    }

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

    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

    function setOwner(
        address owner_,
        address ownerGovernance_
    ) public onlyOwnerSetter {
        owner = owner_;
        ownerGovernance = ownerGovernance_;
    }

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

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwnerSetter` 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 renounceOwnerSetter() public virtual onlyOwnerSetter {
        _transferOwnership(address(0));
    }

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _ownerSetter;
        _ownerSetter = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"contract NexusToken","name":"_nexus","type":"address"},{"internalType":"address","name":"_multiStakingDistributor","type":"address"},{"internalType":"uint256","name":"_nexusPerBlock","type":"uint256"},{"internalType":"uint256","name":"_startBlock","type":"uint256"},{"internalType":"uint256","name":"_bonusEndBlock","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DepositLP","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":true,"internalType":"address","name":"rewardToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DepositRewardToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"BONUS_MULTIPLIER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REDUCTION_PERIOD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REDUCTION_RATE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_allocPoint","type":"uint256"},{"internalType":"contract IERC20","name":"_lpToken","type":"address"},{"internalType":"bool","name":"_withUpdate","type":"bool"}],"name":"add","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"bonusEndBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"depositLP","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"contract IERC20","name":"_rewardToken","type":"address"},{"internalType":"uint256","name":"_depositAmount","type":"uint256"}],"name":"depositRewardToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"emergencyWithdrawLP","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_from","type":"uint256"},{"internalType":"uint256","name":"_to","type":"uint256"}],"name":"getMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNexusPerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"getPendingRewardInfoes","outputs":[{"components":[{"internalType":"address","name":"rewardToken","type":"address"},{"internalType":"uint256","name":"pendingReward","type":"uint256"}],"internalType":"struct NexusGenerator.PendingRewardInfo[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_lpToken","type":"address"}],"name":"getPoolId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"getPoolInfo","outputs":[{"components":[{"internalType":"contract IERC20","name":"lpToken","type":"address"},{"internalType":"uint256","name":"allocPoint","type":"uint256"},{"internalType":"uint256","name":"lastRewardBlock","type":"uint256"},{"internalType":"uint256","name":"accNexusPerShare","type":"uint256"},{"internalType":"uint256","name":"totalLockedLP","type":"uint256"}],"internalType":"struct NexusGenerator.PoolInfo","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"contract IERC20","name":"_rewardToken","type":"address"}],"name":"getRewardTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"getRewardTokenInfo","outputs":[{"components":[{"internalType":"contract IERC20","name":"rewardToken","type":"address"},{"internalType":"uint256","name":"distRate","type":"uint256"},{"internalType":"uint256","name":"remainAmount","type":"uint256"},{"internalType":"uint256","name":"rewardDuration","type":"uint256"},{"internalType":"uint256","name":"lastRewardTimestamp","type":"uint256"},{"internalType":"uint256","name":"accRewardPerShare","type":"uint256"}],"internalType":"struct NexusGenerator.RewardTokenInfo[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"massRTInfoesUpdate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"massUpdatePools","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"multiStakingDistRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"multiStakingDistributor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextReductionBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nexus","outputs":[{"internalType":"contract NexusToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nexusPerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ownerGovernance","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ownerSetter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"pendingNexusByPool","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"pendingNexusByUser","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_rid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"pendingRewardToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolInfo","outputs":[{"internalType":"contract IERC20","name":"lpToken","type":"address"},{"internalType":"uint256","name":"allocPoint","type":"uint256"},{"internalType":"uint256","name":"lastRewardBlock","type":"uint256"},{"internalType":"uint256","name":"accNexusPerShare","type":"uint256"},{"internalType":"uint256","name":"totalLockedLP","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"reductionNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"contract IERC20","name":"_rewardToken","type":"address"}],"name":"removeRewardToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnerSetter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewardTokenInfo","outputs":[{"internalType":"contract IERC20","name":"rewardToken","type":"address"},{"internalType":"uint256","name":"distRate","type":"uint256"},{"internalType":"uint256","name":"remainAmount","type":"uint256"},{"internalType":"uint256","name":"rewardDuration","type":"uint256"},{"internalType":"uint256","name":"lastRewardTimestamp","type":"uint256"},{"internalType":"uint256","name":"accRewardPerShare","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_allocPoint","type":"uint256"},{"internalType":"bool","name":"_withUpdate","type":"bool"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rate","type":"uint256"}],"name":"setMultiStakingDistRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_multiStakingDistributor","type":"address"}],"name":"setMultiStakingDistributorGetter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_nexuPerBlock","type":"uint256"},{"internalType":"uint256","name":"_reductionRate","type":"uint256"},{"internalType":"uint256","name":"_reductionPeriod","type":"uint256"}],"name":"setNexuReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_treasury","type":"address"}],"name":"setNexusTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner_","type":"address"},{"internalType":"address","name":"ownerGovernance_","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"setOwnerSetter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_lpToken","type":"address"},{"internalType":"contract IERC20","name":"_rewardToken","type":"address"},{"internalType":"uint256","name":"_distRate","type":"uint256"}],"name":"setRewardToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAllocPoint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"updatePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_rid","type":"uint256"}],"name":"updateRewardTokenStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"rewardDebt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6080604052600a60085560006013553480156200001b57600080fd5b50604051620035c7380380620035c78339810160408190526200003e91620001df565b6200004933620000c5565b6001600355600480546001600160a01b03199081166001600160a01b038881169190911790925560058054909116918616919091179055600983905560078190556014829055600b54620000ab90439062000115602090811b620028cc17901c565b600d55620000ba33806200012a565b50505050506200025e565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600062000123828462000237565b9392505050565b6000546001600160a01b03163314620001985760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526529b2ba3a32b960d11b606482015260840160405180910390fd5b600180546001600160a01b039384166001600160a01b03199182161790915560028054929093169116179055565b6001600160a01b0381168114620001dc57600080fd5b50565b600080600080600060a08688031215620001f857600080fd5b85516200020581620001c6565b60208701519095506200021881620001c6565b6040870151606088015160809098015196999198509695945092505050565b600082198211156200025957634e487b7160e01b600052601160045260246000fd5b500190565b613359806200026e6000396000f3fe608060405234801561001057600080fd5b50600436106102bb5760003560e01c806364482f791161018257806393f1a40b116100e9578063a3f5c1d2116100a2578063bfe50f721161007c578063bfe50f72146106ac578063caa9a08d146106bf578063d0c1ed07146106d2578063e5dc22a8146106e557600080fd5b8063a3f5c1d214610646578063a4e2e7b014610659578063bb9b233e1461066257600080fd5b806393f1a40b146105b4578063942f8e5a146105fb5780639ae5f958146106045780639b83cd051461060d5780639ba638bf14610620578063a241c07e1461063357600080fd5b80637bd6b3a71161013b5780637bd6b3a71461054b5780638295cbb1146105535780638704589d146105665780638aa28550146105865780638da5cb5b1461058e5780638dbb1e3a146105a157600080fd5b806364482f79146104ed57806364e8d7c214610500578063656bc2f414610509578063708dffe61461051c5780637656cd961461052f578063793a1c041461053857600080fd5b806335cc9cb41161022657806346c98160116101df57806346c981601461047857806348cd4cb11461048b57806351eb05a61461049457806361d027b3146104a7578063630b5ba1146104d257806363c7f51b146104da57600080fd5b806335cc9cb4146104115780633655944a1461042457806339499d66146104375780633e2011f21461043f57806343da429314610452578063441a3e701461046557600080fd5b80631eaaa045116102785780631eaaa0451461035757806321c41b611461036c57806328a95ee41461037f578063299a7bcc146103925780632e35e36f146103a55780632f380b35146103b857600080fd5b8063081e3eda146102c05780630a61f302146102d7578063100adeb8146102e05780631526fe271461030057806317caf6f1146103455780631aed65531461034e575b600080fd5b600e545b6040519081526020015b60405180910390f35b6102c460085481565b6102f36102ee366004612e47565b6106f6565b6040516102ce9190612e60565b61031361030e366004612e47565b6107a7565b604080516001600160a01b0390961686526020860194909452928401919091526060830152608082015260a0016102ce565b6102c460135481565b6102c460075481565b61036a610365366004612f04565b6107f2565b005b61036a61037a366004612e47565b6109c1565b61036a61038d366004612e47565b610a56565b61036a6103a0366004612f46565b610b27565b61036a6103b3366004612f7f565b610b7f565b6103cb6103c6366004612e47565b610d15565b6040516102ce919081516001600160a01b031681526020808301519082015260408083015190820152606080830151908201526080918201519181019190915260a00190565b61036a61041f366004612fc0565b610dbd565b61036a610432366004612fe5565b610fb2565b61036a611013565b6102c461044d366004612e47565b611049565b61036a610460366004613002565b6111ff565b61036a61047336600461302e565b61126a565b6102c4610486366004613050565b61157d565b6102c460145481565b61036a6104a2366004612e47565b6117b4565b6006546104ba906001600160a01b031681565b6040516001600160a01b0390911681526020016102ce565b61036a611962565b61036a6104e8366004612fe5565b611989565b61036a6104fb36600461307e565b611a21565b6102c4600c5481565b6002546104ba906001600160a01b031681565b61036a61052a366004612e47565b611ae5565b6102c460095481565b6102c4610546366004612fc0565b611b1c565b6102c4611c0e565b61036a6105613660046130ac565b611c60565b610579610574366004612fc0565b611f91565b6040516102ce91906130d3565b6102c4600a81565b6001546104ba906001600160a01b031681565b6102c46105af36600461302e565b61213d565b6105e66105c2366004612fc0565b60106020908152600092835260408084209091529082529020805460019091015482565b604080519283526020830191909152016102ce565b6102c4600d5481565b6102c4600a5481565b61036a61061b36600461302e565b6121a3565b61036a61062e366004612fe5565b612363565b6102c4610641366004612fc0565b6123c4565b6004546104ba906001600160a01b031681565b6102c4600b5481565b61067561067036600461302e565b6124cb565b604080516001600160a01b0390971687526020870195909552938501929092526060840152608083015260a082015260c0016102ce565b61036a6106ba36600461302e565b612529565b6102c46106cd366004612fe5565b612858565b6005546104ba906001600160a01b031681565b6000546001600160a01b03166104ba565b6060600f6000838152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b8282101561079c5760008481526020908190206040805160c0810182526006860290920180546001600160a01b031683526001808201548486015260028201549284019290925260038101546060840152600481015460808401526005015460a0830152908352909201910161072b565b505050509050919050565b600e81815481106107b757600080fd5b6000918252602090912060059091020180546001820154600283015460038401546004909401546001600160a01b0390931694509092909185565b6001546001600160a01b031633148061081557506002546001600160a01b031633145b61083a5760405162461bcd60e51b81526004016108319061311e565b60405180910390fd5b61084382612858565b600e54111561085157505050565b801561085f5761085f611962565b6000601454431161087257601454610874565b435b60135490915061088490856128cc565b6013556040805160a0810182526001600160a01b0385811682526020820187815292820184815260006060840181815260808501828152600e8054600180820183559482905296517fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fd600590980297880180546001600160a01b031916919097161790955595517fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fe86015591517fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3ff85015590517fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c40084015592517fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c40190920191909155546109ba91906109b5919061315f565b6128df565b505b505050565b6001546001600160a01b03163314806109e457506002546001600160a01b031633145b610a005760405162461bcd60e51b81526004016108319061311e565b600a811115610a515760405162461bcd60e51b815260206004820152601860248201527f43616e6e6f74206265206c61726765207468616e2031302500000000000000006044820152606401610831565b600855565b610a5e612921565b6000600e8281548110610a7357610a73613176565b60009182526020808320858452601082526040808520338652909252922080546005909202909201925015610abd5780548254610abd916001600160a01b0390911690339061297b565b8054604051908152839033907fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae05959060200160405180910390a380546004830154610b06916129cd565b6004909201919091556000808255600190910155610b246001600355565b50565b6000546001600160a01b03163314610b515760405162461bcd60e51b81526004016108319061318c565b600180546001600160a01b039384166001600160a01b03199182161790915560028054929093169116179055565b6001546001600160a01b0316331480610ba257506002546001600160a01b031633145b610bbe5760405162461bcd60e51b81526004016108319061311e565b6000610bc984612858565b9050610bd4600e5490565b811415610be857610be860008560006107f2565b6000610bf482856123c4565b6000838152600f6020526040902054909150811015610c6e57610c1782826121a3565b6000828152600f60205260408120805483908110610c3757610c37613176565b90600052602060002090600602019050610c5e8482600201546129d990919063ffffffff16565b6003820155600101839055610d0e565b6000828152600f60209081526040808320815160c0810183526001600160a01b038981168252818501898152938201868152606083018781526000196080850190815260a08501898152865460018082018955978b52989099209451600690980290940180546001600160a01b03191697909316969096178255935192810192909255915160028201559151600383015551600482015590516005909101555b5050505050565b610d506040518060a0016040528060006001600160a01b03168152602001600081526020016000815260200160008152602001600081525090565b600e8281548110610d6357610d63613176565b60009182526020918290206040805160a081018252600590930290910180546001600160a01b0316835260018101549383019390935260028301549082015260038201546060820152600490910154608082015292915050565b6001546001600160a01b0316331480610de057506002546001600160a01b031633145b610dfc5760405162461bcd60e51b81526004016108319061311e565b600e548210610e3c5760405162461bcd60e51b815260206004820152600c60248201526b139bc814dd58da08141bdbdb60a21b6044820152606401610831565b6000610e4883836123c4565b6000848152600f60205260409020549091508110610ea85760405162461bcd60e51b815260206004820152601c60248201527f4e6f20537563682052657761726420546f6b656e20696e20706f6f6c000000006044820152606401610831565b6000838152600f6020526040902080548190610ec69060019061315f565b81548110610ed657610ed6613176565b9060005260206000209060060201818381548110610ef657610ef6613176565b60009182526020909120825460069092020180546001600160a01b0319166001600160a01b03909216919091178155600180830154908201556002808301549082015560038083015490820155600480830154908201556005918201549101558054819080610f6757610f676131d2565b60008281526020812060066000199093019283020180546001600160a01b03191681556001810182905560028101829055600381018290556004810182905560050155905550505050565b6001546001600160a01b0316331480610fd557506002546001600160a01b031633145b610ff15760405162461bcd60e51b81526004016108319061311e565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b0316331461103d5760405162461bcd60e51b81526004016108319061318c565b61104760006129e5565b565b600080600e838154811061105f5761105f613176565b600091825260208083206040805160a081018252600590940290910180546001600160a01b03168452600180820154858501526002808301548685019081526003808501546060808a01919091526004909501546080808a01919091528c8a5260128852868a208751918201885280548252948501549781019790975291830154948601949094520154908301525191935091805b4383146111f55743846040015110156111b75761111583856040015161213d565b905083604001519250600b548460200181815161113291906131e8565b905250600b546040850180516111499083906131e8565b9150818152505061118b61118460135461117e8860200151611178896060015187612a3590919063ffffffff16565b90612a35565b906129d9565b83906128cc565b91506111ad620f424061117e600a548760600151612a3590919063ffffffff16565b60608501526110f4565b6111c1834361213d565b90504392506111ee61118460135461117e8860200151611178896060015187612a3590919063ffffffff16565b91506110f4565b5095945050505050565b6001546001600160a01b031633148061122257506002546001600160a01b031633145b61123e5760405162461bcd60e51b81526004016108319061311e565b611246611962565b6009839055600b819055600a82905561125f43826128cc565b600d556109bc611962565b611272612921565b6000600e838154811061128757611287613176565b600091825260208083208684526010825260408085203386528352808520888652600f9093529093205481546005909302909301935091908411156113035760405162461bcd60e51b81526020600482015260126024820152711dda5d1a191c985dce881b9bdd0819dbdbd960721b6044820152606401610831565b61130c856117b4565b61131585611ae5565b60005b8181101561148f576000868152600f6020526040812080548390811061134057611340613176565b600091825260208083206040805160c081018252600690940290910180546001600160a01b0316845260018101549284019290925260028201549083015260038101546060830152600481015460808301526005015460a082015291506113a888843361157d565b90506113d264e8d4a5100061117e8460a001516111788b8a600001546129cd90919063ffffffff16565b6000898152601160209081526040808320338452825280832086516001600160a01b03168452909152902055801561147a57815160405163a9059cbb60e01b8152336004820152602481018390526001600160a01b039091169063a9059cbb906044016020604051808303816000875af1158015611454573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114789190613200565b505b505080806114879061321d565b915050611318565b5060006114c483600101546114be64e8d4a5100061117e88600301548860000154612a3590919063ffffffff16565b906129cd565b905080156114d6576114d63382612a41565b82546114e290866129cd565b80845560038501546114ff9164e8d4a510009161117e9190612a35565b60018401558415611520578354611520906001600160a01b0316338761297b565b600484015461152f90866129cd565b6004850155604051858152869033907ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5689060200160405180910390a3505050506115796001600355565b5050565b600080600e858154811061159357611593613176565b600091825260208083206040805160a081018252600590940290910180546001600160a01b0316845260018101548484015260028101548483015260038101546060850152600401546080840152888452600f90915282208054919350908690811061160157611601613176565b600091825260208083206040805160c081018252600690940290910180546001600160a01b03908116855260018083015486860152600283015486850152600383015460608701908152600484015460808089019190915260059094015460a088019081528e895260108752858920938d168952928652968490208451808601909552805485520154938301939093529151918601519351929450929091158015906116ac57508015155b1561175857600042856080015111156116c7575060006116fe565b606085015160808601516116da916128cc565b42106116eb575060608401516116fe565b60808501516116fb9042906129cd565b90505b6000611717866020015183612a3590919063ffffffff16565b905060008187604001511015611731578660400151611733565b815b905061175261174b8561117e8464e8d4a51000612a35565b86906128cc565b94505050505b60008981526011602090815260408083206001600160a01b03808c1685529083528184208851909116845290915290205483516117a69082906114be9064e8d4a510009061117e9088612a35565b9a9950505050505050505050565b600e5481106117c05750565b6000600e82815481106117d5576117d5613176565b9060005260206000209060050201905060008160040154905060006117fe606461117e86611049565b9050600061181760085483612a3590919063ffffffff16565b9050600061183b61183460085460646129cd90919063ffffffff16565b8490612a35565b9050611846866128df565b4360028601558361185957505050505050565b600480546005546040516340c10f1960e01b81526001600160a01b03918216938101939093526024830185905216906340c10f1990604401600060405180830381600087803b1580156118ab57600080fd5b505af11580156118bf573d6000803e3d6000fd5b5050600480546040516340c10f1960e01b81523092810192909252602482018590526001600160a01b031692506340c10f199150604401600060405180830381600087803b15801561191057600080fd5b505af1158015611924573d6000803e3d6000fd5b505050506119526119478561117e64e8d4a5100085612a3590919063ffffffff16565b6003870154906128cc565b8560030181905550505050505050565b600e5460005b8181101561157957611979816117b4565b6119828161321d565b9050611968565b6000546001600160a01b031633146119b35760405162461bcd60e51b81526004016108319061318c565b6001600160a01b038116611a185760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610831565b610b24816129e5565b6001546001600160a01b0316331480611a4457506002546001600160a01b031633145b611a605760405162461bcd60e51b81526004016108319061311e565b8015611a6e57611a6e611962565b611ab182611aab600e8681548110611a8857611a88613176565b9060005260206000209060050201600101546013546129cd90919063ffffffff16565b906128cc565b60138190555081600e8481548110611acb57611acb613176565b906000526020600020906005020160010181905550505050565b6000818152600f60205260408120805490915b818110156109ba57611b0a84826121a3565b80611b148161321d565b915050611af8565b600080600e8481548110611b3257611b32613176565b600091825260208083208784526010825260408085206001600160a01b03891686529092529220600360059092029092019081015460048201549193509080611b82576000945050505050611c08565b6000611b92606461117e8a611049565b90506000611bb6611baf60085460646129cd90919063ffffffff16565b8390612a35565b9050611bd5611bce8461117e8464e8d4a51000612a35565b85906128cc565b9350611bff85600101546114be64e8d4a5100061117e888a60000154612a3590919063ffffffff16565b96505050505050505b92915050565b600954600d54600091905b438111611c5a57611c3c620f424061117e600a5485612a3590919063ffffffff16565b9150611c53600b54826128cc90919063ffffffff16565b9050611c19565b50919050565b611c68612921565b600e548310611caa5760405162461bcd60e51b815260206004820152600e60248201526d139bdb88115e1a5cdd08141bdbdb60921b6044820152606401610831565b6000611cb684846123c4565b6000858152600f60205260409020549091508110611d165760405162461bcd60e51b815260206004820152601760248201527f4e6f2072657761726420746f6b656e2073657474696e670000000000000000006044820152606401610831565b611d2084826121a3565b6000848152600f60205260408120805483908110611d4057611d40613176565b6000918252602082206006909102019150611d61606461117e866063612a35565b90506000611d7661271061117e876032612a35565b905081836002016000828254611d8c91906131e8565b90915550504260048401556001830154611da79083906129d9565b836003016000828254611dba91906131e8565b90915550508415611e3e576040516323b872dd60e01b8152336004820152306024820152604481018690526001600160a01b038716906323b872dd906064016020604051808303816000875af1158015611e18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e3c9190613200565b505b8015611f355760055460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018390529087169063a9059cbb906044016020604051808303816000875af1158015611e97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ebb9190613200565b5060065460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018390529087169063a9059cbb906044016020604051808303816000875af1158015611f0f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f339190613200565b505b856001600160a01b031687336001600160a01b03167f345f418d18b9b90e548c6e253c551738e1d53ae79391ed314cb93d0e1cab975a85604051611f7b91815260200190565b60405180910390a4505050506109bc6001600355565b6000828152600f6020526040812054606091611fae8260016131e8565b67ffffffffffffffff811115611fc657611fc6613238565b60405190808252806020026020018201604052801561200b57816020015b6040805180820190915260008082526020820152815260200190600190039081611fe45790505b5060045481519192506001600160a01b031690829060009061202f5761202f613176565b60209081029190910101516001600160a01b0390911690526120518585611b1c565b8160008151811061206457612064613176565b6020026020010151602001818152505060005b82811015612134576000868152600f6020526040902080548290811061209f5761209f613176565b60009182526020909120600690910201546001600160a01b0316826120c58360016131e8565b815181106120d5576120d5613176565b60209081029190910101516001600160a01b0390911690526120f886828761157d565b826121048360016131e8565b8151811061211457612114613176565b60209081029190910181015101528061212c8161321d565b915050612077565b50949350505050565b6000600754821161215e57612157600a61117884866129cd565b9050611c08565b60075483106121715761215782846129cd565b612157612189600754846129cd90919063ffffffff16565b611aab600a611178876007546129cd90919063ffffffff16565b6000600e83815481106121b8576121b8613176565b600091825260208083206040805160a081018252600590940290910180546001600160a01b0316845260018101548484015260028101548483015260038101546060850152600401546080840152868452600f90915282208054919350908490811061222657612226613176565b600091825260209091206080840151600690920201915080612258575060001960048201556000600390910155505050565b6000428360040154111561226e57505050505050565b600061228b846003015485600401546128cc90919063ffffffff16565b9050804211156122af576003840180546000196004870155600090915591506122dd565b60048401546122bf9042906129cd565b42600486015560038501549092506122d790836129cd565b60038501555b60006122f6856001015484612a3590919063ffffffff16565b905060008186600201541015612310578560020154612312565b815b905060006123298661117e8464e8d4a51000612a35565b600588015490915061233b90826128cc565b6005880155600287015461234f90836129cd565b876002018190555050505050505050505050565b6001546001600160a01b031633148061238657506002546001600160a01b031633145b6123a25760405162461bcd60e51b81526004016108319061311e565b600680546001600160a01b0319166001600160a01b0392909216919091179055565b6000828152600f6020908152604080832080548251818502810185019093528083528493849084015b8282101561245e5760008481526020908190206040805160c0810182526006860290920180546001600160a01b031683526001808201548486015260028201549284019290925260038101546060840152600481015460808401526005015460a083015290835290920191016123ed565b50505050905060005b81518110156124c257836001600160a01b031682828151811061248c5761248c613176565b6020026020010151600001516001600160a01b031614156124b0579150611c089050565b806124ba8161321d565b915050612467565b50519392505050565b600f60205281600052604060002081815481106124e757600080fd5b60009182526020909120600690910201805460018201546002830154600384015460048501546005909501546001600160a01b03909416965091945092909186565b612531612921565b6000600e838154811061254657612546613176565b600091825260208083208684526010825260408085203386528352808520888652600f9093529093205460059092029092019250612583856117b4565b61258c85611ae5565b60005b81811015612706576000868152600f602052604081208054839081106125b7576125b7613176565b600091825260208083206040805160c081018252600690940290910180546001600160a01b0316845260018101549284019290925260028201549083015260038101546060830152600481015460808301526005015460a0820152915061261f88843361157d565b905061264964e8d4a5100061117e8460a001516111788b8a600001546128cc90919063ffffffff16565b6000898152601160209081526040808320338452825280832086516001600160a01b0316845290915290205580156126f157815160405163a9059cbb60e01b8152336004820152602481018390526001600160a01b039091169063a9059cbb906044016020604051808303816000875af11580156126cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126ef9190613200565b505b505080806126fe9061321d565b91505061258f565b5081541561275057600061273c83600101546114be64e8d4a5100061117e88600301548860000154612a3590919063ffffffff16565b9050801561274e5761274e3382612a41565b505b83156127d25782546040516323b872dd60e01b8152336004820152306024820152604481018690526001600160a01b03909116906323b872dd906064016020604051808303816000875af11580156127ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127d09190613200565b505b81546127de90856128cc565b80835560038401546127fb9164e8d4a510009161117e9190612a35565b6001830155600483015461280f90856128cc565b6004840155604051848152859033907fabdf5866cb45ed6cb840bd666f95053184f0ae811ba5896df6597dd6495de8be9060200160405180910390a35050506115796001600355565b600080612864600e5490565b905060005b818110156128c557836001600160a01b0316600e828154811061288e5761288e613176565b60009182526020909120600590910201546001600160a01b031614156128b5579392505050565b6128be8161321d565b9050612869565b5092915050565b60006128d882846131e8565b9392505050565b6128e7612b72565b6000818152601260205260409020600b54600d54612904916129cd565b6001820155600d5460028201556009546003820155600c54905550565b600260035414156129745760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610831565b6002600355565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526109bc908490612be5565b60006128d8828461315f565b60006128d8828461324e565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006128d88284613270565b600480546040516370a0823160e01b815230928101929092526000916001600160a01b03909116906370a0823190602401602060405180830381865afa158015612a8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ab3919061328f565b905080821115612b37576004805460405163a9059cbb60e01b81526001600160a01b03868116938201939093526024810184905291169063a9059cbb906044015b6020604051808303816000875af1158015612b13573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ba9190613200565b6004805460405163a9059cbb60e01b81526001600160a01b03868116938201939093526024810185905291169063a9059cbb90604401612af4565b43600d541161104757600b54600d54612b8a916128cc565b600d5560095460011180612ba057506001600a54105b15612baa57612b72565b612bc8620f424061117e600a54600954612a3590919063ffffffff16565b600955600c8054906000612bdb8361321d565b9190505550612b72565b6000612c3a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612cba9092919063ffffffff16565b9050805160001480612c5b575080806020019051810190612c5b9190613200565b6109bc5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610831565b6060612cc98484600085612cd1565b949350505050565b606082471015612d325760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610831565b600080866001600160a01b03168587604051612d4e91906132d4565b60006040518083038185875af1925050503d8060008114612d8b576040519150601f19603f3d011682016040523d82523d6000602084013e612d90565b606091505b5091509150612da187838387612dac565b979650505050505050565b60608315612e18578251612e11576001600160a01b0385163b612e115760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610831565b5081612cc9565b612cc98383815115612e2d5781518083602001fd5b8060405162461bcd60e51b815260040161083191906132f0565b600060208284031215612e5957600080fd5b5035919050565b602080825282518282018190526000919060409081850190868401855b82811015612ed457815180516001600160a01b0316855286810151878601528581015186860152606080820151908601526080808201519086015260a0908101519085015260c09093019290850190600101612e7d565b5091979650505050505050565b6001600160a01b0381168114610b2457600080fd5b8015158114610b2457600080fd5b600080600060608486031215612f1957600080fd5b833592506020840135612f2b81612ee1565b91506040840135612f3b81612ef6565b809150509250925092565b60008060408385031215612f5957600080fd5b8235612f6481612ee1565b91506020830135612f7481612ee1565b809150509250929050565b600080600060608486031215612f9457600080fd5b8335612f9f81612ee1565b92506020840135612faf81612ee1565b929592945050506040919091013590565b60008060408385031215612fd357600080fd5b823591506020830135612f7481612ee1565b600060208284031215612ff757600080fd5b81356128d881612ee1565b60008060006060848603121561301757600080fd5b505081359360208301359350604090920135919050565b6000806040838503121561304157600080fd5b50508035926020909101359150565b60008060006060848603121561306557600080fd5b83359250602084013591506040840135612f3b81612ee1565b60008060006060848603121561309357600080fd5b83359250602084013591506040840135612f3b81612ef6565b6000806000606084860312156130c157600080fd5b833592506020840135612faf81612ee1565b602080825282518282018190526000919060409081850190868401855b82811015612ed457815180516001600160a01b031685528601518685015292840192908501906001016130f0565b6020808252601190820152702ab9b2b91034b9903737ba1037bbb732b960791b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b60008282101561317157613171613149565b500390565b634e487b7160e01b600052603260045260246000fd5b60208082526026908201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260408201526529b2ba3a32b960d11b606082015260800190565b634e487b7160e01b600052603160045260246000fd5b600082198211156131fb576131fb613149565b500190565b60006020828403121561321257600080fd5b81516128d881612ef6565b600060001982141561323157613231613149565b5060010190565b634e487b7160e01b600052604160045260246000fd5b60008261326b57634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561328a5761328a613149565b500290565b6000602082840312156132a157600080fd5b5051919050565b60005b838110156132c35781810151838201526020016132ab565b838111156109ba5750506000910152565b600082516132e68184602087016132a8565b9190910192915050565b602081526000825180602084015261330f8160408501602087016132a8565b601f01601f1916919091016040019291505056fea2646970667358221220c2ac6b36eaac37fa8775b5d7748ea299325bdf0b2e9087b40421ded033b77b9a64736f6c634300080c00330000000000000000000000006daf228391e388b05bbc682fea3cb1cc3e38c44e000000000000000000000000a96d4dfb9eed8824cae29fa0b7e62c72b5e51018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102bb5760003560e01c806364482f791161018257806393f1a40b116100e9578063a3f5c1d2116100a2578063bfe50f721161007c578063bfe50f72146106ac578063caa9a08d146106bf578063d0c1ed07146106d2578063e5dc22a8146106e557600080fd5b8063a3f5c1d214610646578063a4e2e7b014610659578063bb9b233e1461066257600080fd5b806393f1a40b146105b4578063942f8e5a146105fb5780639ae5f958146106045780639b83cd051461060d5780639ba638bf14610620578063a241c07e1461063357600080fd5b80637bd6b3a71161013b5780637bd6b3a71461054b5780638295cbb1146105535780638704589d146105665780638aa28550146105865780638da5cb5b1461058e5780638dbb1e3a146105a157600080fd5b806364482f79146104ed57806364e8d7c214610500578063656bc2f414610509578063708dffe61461051c5780637656cd961461052f578063793a1c041461053857600080fd5b806335cc9cb41161022657806346c98160116101df57806346c981601461047857806348cd4cb11461048b57806351eb05a61461049457806361d027b3146104a7578063630b5ba1146104d257806363c7f51b146104da57600080fd5b806335cc9cb4146104115780633655944a1461042457806339499d66146104375780633e2011f21461043f57806343da429314610452578063441a3e701461046557600080fd5b80631eaaa045116102785780631eaaa0451461035757806321c41b611461036c57806328a95ee41461037f578063299a7bcc146103925780632e35e36f146103a55780632f380b35146103b857600080fd5b8063081e3eda146102c05780630a61f302146102d7578063100adeb8146102e05780631526fe271461030057806317caf6f1146103455780631aed65531461034e575b600080fd5b600e545b6040519081526020015b60405180910390f35b6102c460085481565b6102f36102ee366004612e47565b6106f6565b6040516102ce9190612e60565b61031361030e366004612e47565b6107a7565b604080516001600160a01b0390961686526020860194909452928401919091526060830152608082015260a0016102ce565b6102c460135481565b6102c460075481565b61036a610365366004612f04565b6107f2565b005b61036a61037a366004612e47565b6109c1565b61036a61038d366004612e47565b610a56565b61036a6103a0366004612f46565b610b27565b61036a6103b3366004612f7f565b610b7f565b6103cb6103c6366004612e47565b610d15565b6040516102ce919081516001600160a01b031681526020808301519082015260408083015190820152606080830151908201526080918201519181019190915260a00190565b61036a61041f366004612fc0565b610dbd565b61036a610432366004612fe5565b610fb2565b61036a611013565b6102c461044d366004612e47565b611049565b61036a610460366004613002565b6111ff565b61036a61047336600461302e565b61126a565b6102c4610486366004613050565b61157d565b6102c460145481565b61036a6104a2366004612e47565b6117b4565b6006546104ba906001600160a01b031681565b6040516001600160a01b0390911681526020016102ce565b61036a611962565b61036a6104e8366004612fe5565b611989565b61036a6104fb36600461307e565b611a21565b6102c4600c5481565b6002546104ba906001600160a01b031681565b61036a61052a366004612e47565b611ae5565b6102c460095481565b6102c4610546366004612fc0565b611b1c565b6102c4611c0e565b61036a6105613660046130ac565b611c60565b610579610574366004612fc0565b611f91565b6040516102ce91906130d3565b6102c4600a81565b6001546104ba906001600160a01b031681565b6102c46105af36600461302e565b61213d565b6105e66105c2366004612fc0565b60106020908152600092835260408084209091529082529020805460019091015482565b604080519283526020830191909152016102ce565b6102c4600d5481565b6102c4600a5481565b61036a61061b36600461302e565b6121a3565b61036a61062e366004612fe5565b612363565b6102c4610641366004612fc0565b6123c4565b6004546104ba906001600160a01b031681565b6102c4600b5481565b61067561067036600461302e565b6124cb565b604080516001600160a01b0390971687526020870195909552938501929092526060840152608083015260a082015260c0016102ce565b61036a6106ba36600461302e565b612529565b6102c46106cd366004612fe5565b612858565b6005546104ba906001600160a01b031681565b6000546001600160a01b03166104ba565b6060600f6000838152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b8282101561079c5760008481526020908190206040805160c0810182526006860290920180546001600160a01b031683526001808201548486015260028201549284019290925260038101546060840152600481015460808401526005015460a0830152908352909201910161072b565b505050509050919050565b600e81815481106107b757600080fd5b6000918252602090912060059091020180546001820154600283015460038401546004909401546001600160a01b0390931694509092909185565b6001546001600160a01b031633148061081557506002546001600160a01b031633145b61083a5760405162461bcd60e51b81526004016108319061311e565b60405180910390fd5b61084382612858565b600e54111561085157505050565b801561085f5761085f611962565b6000601454431161087257601454610874565b435b60135490915061088490856128cc565b6013556040805160a0810182526001600160a01b0385811682526020820187815292820184815260006060840181815260808501828152600e8054600180820183559482905296517fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fd600590980297880180546001600160a01b031916919097161790955595517fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fe86015591517fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3ff85015590517fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c40084015592517fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c40190920191909155546109ba91906109b5919061315f565b6128df565b505b505050565b6001546001600160a01b03163314806109e457506002546001600160a01b031633145b610a005760405162461bcd60e51b81526004016108319061311e565b600a811115610a515760405162461bcd60e51b815260206004820152601860248201527f43616e6e6f74206265206c61726765207468616e2031302500000000000000006044820152606401610831565b600855565b610a5e612921565b6000600e8281548110610a7357610a73613176565b60009182526020808320858452601082526040808520338652909252922080546005909202909201925015610abd5780548254610abd916001600160a01b0390911690339061297b565b8054604051908152839033907fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae05959060200160405180910390a380546004830154610b06916129cd565b6004909201919091556000808255600190910155610b246001600355565b50565b6000546001600160a01b03163314610b515760405162461bcd60e51b81526004016108319061318c565b600180546001600160a01b039384166001600160a01b03199182161790915560028054929093169116179055565b6001546001600160a01b0316331480610ba257506002546001600160a01b031633145b610bbe5760405162461bcd60e51b81526004016108319061311e565b6000610bc984612858565b9050610bd4600e5490565b811415610be857610be860008560006107f2565b6000610bf482856123c4565b6000838152600f6020526040902054909150811015610c6e57610c1782826121a3565b6000828152600f60205260408120805483908110610c3757610c37613176565b90600052602060002090600602019050610c5e8482600201546129d990919063ffffffff16565b6003820155600101839055610d0e565b6000828152600f60209081526040808320815160c0810183526001600160a01b038981168252818501898152938201868152606083018781526000196080850190815260a08501898152865460018082018955978b52989099209451600690980290940180546001600160a01b03191697909316969096178255935192810192909255915160028201559151600383015551600482015590516005909101555b5050505050565b610d506040518060a0016040528060006001600160a01b03168152602001600081526020016000815260200160008152602001600081525090565b600e8281548110610d6357610d63613176565b60009182526020918290206040805160a081018252600590930290910180546001600160a01b0316835260018101549383019390935260028301549082015260038201546060820152600490910154608082015292915050565b6001546001600160a01b0316331480610de057506002546001600160a01b031633145b610dfc5760405162461bcd60e51b81526004016108319061311e565b600e548210610e3c5760405162461bcd60e51b815260206004820152600c60248201526b139bc814dd58da08141bdbdb60a21b6044820152606401610831565b6000610e4883836123c4565b6000848152600f60205260409020549091508110610ea85760405162461bcd60e51b815260206004820152601c60248201527f4e6f20537563682052657761726420546f6b656e20696e20706f6f6c000000006044820152606401610831565b6000838152600f6020526040902080548190610ec69060019061315f565b81548110610ed657610ed6613176565b9060005260206000209060060201818381548110610ef657610ef6613176565b60009182526020909120825460069092020180546001600160a01b0319166001600160a01b03909216919091178155600180830154908201556002808301549082015560038083015490820155600480830154908201556005918201549101558054819080610f6757610f676131d2565b60008281526020812060066000199093019283020180546001600160a01b03191681556001810182905560028101829055600381018290556004810182905560050155905550505050565b6001546001600160a01b0316331480610fd557506002546001600160a01b031633145b610ff15760405162461bcd60e51b81526004016108319061311e565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b0316331461103d5760405162461bcd60e51b81526004016108319061318c565b61104760006129e5565b565b600080600e838154811061105f5761105f613176565b600091825260208083206040805160a081018252600590940290910180546001600160a01b03168452600180820154858501526002808301548685019081526003808501546060808a01919091526004909501546080808a01919091528c8a5260128852868a208751918201885280548252948501549781019790975291830154948601949094520154908301525191935091805b4383146111f55743846040015110156111b75761111583856040015161213d565b905083604001519250600b548460200181815161113291906131e8565b905250600b546040850180516111499083906131e8565b9150818152505061118b61118460135461117e8860200151611178896060015187612a3590919063ffffffff16565b90612a35565b906129d9565b83906128cc565b91506111ad620f424061117e600a548760600151612a3590919063ffffffff16565b60608501526110f4565b6111c1834361213d565b90504392506111ee61118460135461117e8860200151611178896060015187612a3590919063ffffffff16565b91506110f4565b5095945050505050565b6001546001600160a01b031633148061122257506002546001600160a01b031633145b61123e5760405162461bcd60e51b81526004016108319061311e565b611246611962565b6009839055600b819055600a82905561125f43826128cc565b600d556109bc611962565b611272612921565b6000600e838154811061128757611287613176565b600091825260208083208684526010825260408085203386528352808520888652600f9093529093205481546005909302909301935091908411156113035760405162461bcd60e51b81526020600482015260126024820152711dda5d1a191c985dce881b9bdd0819dbdbd960721b6044820152606401610831565b61130c856117b4565b61131585611ae5565b60005b8181101561148f576000868152600f6020526040812080548390811061134057611340613176565b600091825260208083206040805160c081018252600690940290910180546001600160a01b0316845260018101549284019290925260028201549083015260038101546060830152600481015460808301526005015460a082015291506113a888843361157d565b90506113d264e8d4a5100061117e8460a001516111788b8a600001546129cd90919063ffffffff16565b6000898152601160209081526040808320338452825280832086516001600160a01b03168452909152902055801561147a57815160405163a9059cbb60e01b8152336004820152602481018390526001600160a01b039091169063a9059cbb906044016020604051808303816000875af1158015611454573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114789190613200565b505b505080806114879061321d565b915050611318565b5060006114c483600101546114be64e8d4a5100061117e88600301548860000154612a3590919063ffffffff16565b906129cd565b905080156114d6576114d63382612a41565b82546114e290866129cd565b80845560038501546114ff9164e8d4a510009161117e9190612a35565b60018401558415611520578354611520906001600160a01b0316338761297b565b600484015461152f90866129cd565b6004850155604051858152869033907ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5689060200160405180910390a3505050506115796001600355565b5050565b600080600e858154811061159357611593613176565b600091825260208083206040805160a081018252600590940290910180546001600160a01b0316845260018101548484015260028101548483015260038101546060850152600401546080840152888452600f90915282208054919350908690811061160157611601613176565b600091825260208083206040805160c081018252600690940290910180546001600160a01b03908116855260018083015486860152600283015486850152600383015460608701908152600484015460808089019190915260059094015460a088019081528e895260108752858920938d168952928652968490208451808601909552805485520154938301939093529151918601519351929450929091158015906116ac57508015155b1561175857600042856080015111156116c7575060006116fe565b606085015160808601516116da916128cc565b42106116eb575060608401516116fe565b60808501516116fb9042906129cd565b90505b6000611717866020015183612a3590919063ffffffff16565b905060008187604001511015611731578660400151611733565b815b905061175261174b8561117e8464e8d4a51000612a35565b86906128cc565b94505050505b60008981526011602090815260408083206001600160a01b03808c1685529083528184208851909116845290915290205483516117a69082906114be9064e8d4a510009061117e9088612a35565b9a9950505050505050505050565b600e5481106117c05750565b6000600e82815481106117d5576117d5613176565b9060005260206000209060050201905060008160040154905060006117fe606461117e86611049565b9050600061181760085483612a3590919063ffffffff16565b9050600061183b61183460085460646129cd90919063ffffffff16565b8490612a35565b9050611846866128df565b4360028601558361185957505050505050565b600480546005546040516340c10f1960e01b81526001600160a01b03918216938101939093526024830185905216906340c10f1990604401600060405180830381600087803b1580156118ab57600080fd5b505af11580156118bf573d6000803e3d6000fd5b5050600480546040516340c10f1960e01b81523092810192909252602482018590526001600160a01b031692506340c10f199150604401600060405180830381600087803b15801561191057600080fd5b505af1158015611924573d6000803e3d6000fd5b505050506119526119478561117e64e8d4a5100085612a3590919063ffffffff16565b6003870154906128cc565b8560030181905550505050505050565b600e5460005b8181101561157957611979816117b4565b6119828161321d565b9050611968565b6000546001600160a01b031633146119b35760405162461bcd60e51b81526004016108319061318c565b6001600160a01b038116611a185760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610831565b610b24816129e5565b6001546001600160a01b0316331480611a4457506002546001600160a01b031633145b611a605760405162461bcd60e51b81526004016108319061311e565b8015611a6e57611a6e611962565b611ab182611aab600e8681548110611a8857611a88613176565b9060005260206000209060050201600101546013546129cd90919063ffffffff16565b906128cc565b60138190555081600e8481548110611acb57611acb613176565b906000526020600020906005020160010181905550505050565b6000818152600f60205260408120805490915b818110156109ba57611b0a84826121a3565b80611b148161321d565b915050611af8565b600080600e8481548110611b3257611b32613176565b600091825260208083208784526010825260408085206001600160a01b03891686529092529220600360059092029092019081015460048201549193509080611b82576000945050505050611c08565b6000611b92606461117e8a611049565b90506000611bb6611baf60085460646129cd90919063ffffffff16565b8390612a35565b9050611bd5611bce8461117e8464e8d4a51000612a35565b85906128cc565b9350611bff85600101546114be64e8d4a5100061117e888a60000154612a3590919063ffffffff16565b96505050505050505b92915050565b600954600d54600091905b438111611c5a57611c3c620f424061117e600a5485612a3590919063ffffffff16565b9150611c53600b54826128cc90919063ffffffff16565b9050611c19565b50919050565b611c68612921565b600e548310611caa5760405162461bcd60e51b815260206004820152600e60248201526d139bdb88115e1a5cdd08141bdbdb60921b6044820152606401610831565b6000611cb684846123c4565b6000858152600f60205260409020549091508110611d165760405162461bcd60e51b815260206004820152601760248201527f4e6f2072657761726420746f6b656e2073657474696e670000000000000000006044820152606401610831565b611d2084826121a3565b6000848152600f60205260408120805483908110611d4057611d40613176565b6000918252602082206006909102019150611d61606461117e866063612a35565b90506000611d7661271061117e876032612a35565b905081836002016000828254611d8c91906131e8565b90915550504260048401556001830154611da79083906129d9565b836003016000828254611dba91906131e8565b90915550508415611e3e576040516323b872dd60e01b8152336004820152306024820152604481018690526001600160a01b038716906323b872dd906064016020604051808303816000875af1158015611e18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e3c9190613200565b505b8015611f355760055460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018390529087169063a9059cbb906044016020604051808303816000875af1158015611e97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ebb9190613200565b5060065460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018390529087169063a9059cbb906044016020604051808303816000875af1158015611f0f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f339190613200565b505b856001600160a01b031687336001600160a01b03167f345f418d18b9b90e548c6e253c551738e1d53ae79391ed314cb93d0e1cab975a85604051611f7b91815260200190565b60405180910390a4505050506109bc6001600355565b6000828152600f6020526040812054606091611fae8260016131e8565b67ffffffffffffffff811115611fc657611fc6613238565b60405190808252806020026020018201604052801561200b57816020015b6040805180820190915260008082526020820152815260200190600190039081611fe45790505b5060045481519192506001600160a01b031690829060009061202f5761202f613176565b60209081029190910101516001600160a01b0390911690526120518585611b1c565b8160008151811061206457612064613176565b6020026020010151602001818152505060005b82811015612134576000868152600f6020526040902080548290811061209f5761209f613176565b60009182526020909120600690910201546001600160a01b0316826120c58360016131e8565b815181106120d5576120d5613176565b60209081029190910101516001600160a01b0390911690526120f886828761157d565b826121048360016131e8565b8151811061211457612114613176565b60209081029190910181015101528061212c8161321d565b915050612077565b50949350505050565b6000600754821161215e57612157600a61117884866129cd565b9050611c08565b60075483106121715761215782846129cd565b612157612189600754846129cd90919063ffffffff16565b611aab600a611178876007546129cd90919063ffffffff16565b6000600e83815481106121b8576121b8613176565b600091825260208083206040805160a081018252600590940290910180546001600160a01b0316845260018101548484015260028101548483015260038101546060850152600401546080840152868452600f90915282208054919350908490811061222657612226613176565b600091825260209091206080840151600690920201915080612258575060001960048201556000600390910155505050565b6000428360040154111561226e57505050505050565b600061228b846003015485600401546128cc90919063ffffffff16565b9050804211156122af576003840180546000196004870155600090915591506122dd565b60048401546122bf9042906129cd565b42600486015560038501549092506122d790836129cd565b60038501555b60006122f6856001015484612a3590919063ffffffff16565b905060008186600201541015612310578560020154612312565b815b905060006123298661117e8464e8d4a51000612a35565b600588015490915061233b90826128cc565b6005880155600287015461234f90836129cd565b876002018190555050505050505050505050565b6001546001600160a01b031633148061238657506002546001600160a01b031633145b6123a25760405162461bcd60e51b81526004016108319061311e565b600680546001600160a01b0319166001600160a01b0392909216919091179055565b6000828152600f6020908152604080832080548251818502810185019093528083528493849084015b8282101561245e5760008481526020908190206040805160c0810182526006860290920180546001600160a01b031683526001808201548486015260028201549284019290925260038101546060840152600481015460808401526005015460a083015290835290920191016123ed565b50505050905060005b81518110156124c257836001600160a01b031682828151811061248c5761248c613176565b6020026020010151600001516001600160a01b031614156124b0579150611c089050565b806124ba8161321d565b915050612467565b50519392505050565b600f60205281600052604060002081815481106124e757600080fd5b60009182526020909120600690910201805460018201546002830154600384015460048501546005909501546001600160a01b03909416965091945092909186565b612531612921565b6000600e838154811061254657612546613176565b600091825260208083208684526010825260408085203386528352808520888652600f9093529093205460059092029092019250612583856117b4565b61258c85611ae5565b60005b81811015612706576000868152600f602052604081208054839081106125b7576125b7613176565b600091825260208083206040805160c081018252600690940290910180546001600160a01b0316845260018101549284019290925260028201549083015260038101546060830152600481015460808301526005015460a0820152915061261f88843361157d565b905061264964e8d4a5100061117e8460a001516111788b8a600001546128cc90919063ffffffff16565b6000898152601160209081526040808320338452825280832086516001600160a01b0316845290915290205580156126f157815160405163a9059cbb60e01b8152336004820152602481018390526001600160a01b039091169063a9059cbb906044016020604051808303816000875af11580156126cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126ef9190613200565b505b505080806126fe9061321d565b91505061258f565b5081541561275057600061273c83600101546114be64e8d4a5100061117e88600301548860000154612a3590919063ffffffff16565b9050801561274e5761274e3382612a41565b505b83156127d25782546040516323b872dd60e01b8152336004820152306024820152604481018690526001600160a01b03909116906323b872dd906064016020604051808303816000875af11580156127ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127d09190613200565b505b81546127de90856128cc565b80835560038401546127fb9164e8d4a510009161117e9190612a35565b6001830155600483015461280f90856128cc565b6004840155604051848152859033907fabdf5866cb45ed6cb840bd666f95053184f0ae811ba5896df6597dd6495de8be9060200160405180910390a35050506115796001600355565b600080612864600e5490565b905060005b818110156128c557836001600160a01b0316600e828154811061288e5761288e613176565b60009182526020909120600590910201546001600160a01b031614156128b5579392505050565b6128be8161321d565b9050612869565b5092915050565b60006128d882846131e8565b9392505050565b6128e7612b72565b6000818152601260205260409020600b54600d54612904916129cd565b6001820155600d5460028201556009546003820155600c54905550565b600260035414156129745760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610831565b6002600355565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526109bc908490612be5565b60006128d8828461315f565b60006128d8828461324e565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006128d88284613270565b600480546040516370a0823160e01b815230928101929092526000916001600160a01b03909116906370a0823190602401602060405180830381865afa158015612a8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ab3919061328f565b905080821115612b37576004805460405163a9059cbb60e01b81526001600160a01b03868116938201939093526024810184905291169063a9059cbb906044015b6020604051808303816000875af1158015612b13573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ba9190613200565b6004805460405163a9059cbb60e01b81526001600160a01b03868116938201939093526024810185905291169063a9059cbb90604401612af4565b43600d541161104757600b54600d54612b8a916128cc565b600d5560095460011180612ba057506001600a54105b15612baa57612b72565b612bc8620f424061117e600a54600954612a3590919063ffffffff16565b600955600c8054906000612bdb8361321d565b9190505550612b72565b6000612c3a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612cba9092919063ffffffff16565b9050805160001480612c5b575080806020019051810190612c5b9190613200565b6109bc5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610831565b6060612cc98484600085612cd1565b949350505050565b606082471015612d325760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610831565b600080866001600160a01b03168587604051612d4e91906132d4565b60006040518083038185875af1925050503d8060008114612d8b576040519150601f19603f3d011682016040523d82523d6000602084013e612d90565b606091505b5091509150612da187838387612dac565b979650505050505050565b60608315612e18578251612e11576001600160a01b0385163b612e115760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610831565b5081612cc9565b612cc98383815115612e2d5781518083602001fd5b8060405162461bcd60e51b815260040161083191906132f0565b600060208284031215612e5957600080fd5b5035919050565b602080825282518282018190526000919060409081850190868401855b82811015612ed457815180516001600160a01b0316855286810151878601528581015186860152606080820151908601526080808201519086015260a0908101519085015260c09093019290850190600101612e7d565b5091979650505050505050565b6001600160a01b0381168114610b2457600080fd5b8015158114610b2457600080fd5b600080600060608486031215612f1957600080fd5b833592506020840135612f2b81612ee1565b91506040840135612f3b81612ef6565b809150509250925092565b60008060408385031215612f5957600080fd5b8235612f6481612ee1565b91506020830135612f7481612ee1565b809150509250929050565b600080600060608486031215612f9457600080fd5b8335612f9f81612ee1565b92506020840135612faf81612ee1565b929592945050506040919091013590565b60008060408385031215612fd357600080fd5b823591506020830135612f7481612ee1565b600060208284031215612ff757600080fd5b81356128d881612ee1565b60008060006060848603121561301757600080fd5b505081359360208301359350604090920135919050565b6000806040838503121561304157600080fd5b50508035926020909101359150565b60008060006060848603121561306557600080fd5b83359250602084013591506040840135612f3b81612ee1565b60008060006060848603121561309357600080fd5b83359250602084013591506040840135612f3b81612ef6565b6000806000606084860312156130c157600080fd5b833592506020840135612faf81612ee1565b602080825282518282018190526000919060409081850190868401855b82811015612ed457815180516001600160a01b031685528601518685015292840192908501906001016130f0565b6020808252601190820152702ab9b2b91034b9903737ba1037bbb732b960791b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b60008282101561317157613171613149565b500390565b634e487b7160e01b600052603260045260246000fd5b60208082526026908201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260408201526529b2ba3a32b960d11b606082015260800190565b634e487b7160e01b600052603160045260246000fd5b600082198211156131fb576131fb613149565b500190565b60006020828403121561321257600080fd5b81516128d881612ef6565b600060001982141561323157613231613149565b5060010190565b634e487b7160e01b600052604160045260246000fd5b60008261326b57634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561328a5761328a613149565b500290565b6000602082840312156132a157600080fd5b5051919050565b60005b838110156132c35781810151838201526020016132ab565b838111156109ba5750506000910152565b600082516132e68184602087016132a8565b9190910192915050565b602081526000825180602084015261330f8160408501602087016132a8565b601f01601f1916919091016040019291505056fea2646970667358221220c2ac6b36eaac37fa8775b5d7748ea299325bdf0b2e9087b40421ded033b77b9a64736f6c634300080c0033

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

0000000000000000000000006daf228391e388b05bbc682fea3cb1cc3e38c44e000000000000000000000000a96d4dfb9eed8824cae29fa0b7e62c72b5e51018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _nexus (address): 0x6DaF228391e388B05BBc682FEA3CB1Cc3E38c44E
Arg [1] : _multiStakingDistributor (address): 0xa96d4Dfb9EED8824cae29fA0b7e62c72b5e51018
Arg [2] : _nexusPerBlock (uint256): 0
Arg [3] : _startBlock (uint256): 0
Arg [4] : _bonusEndBlock (uint256): 0

-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 0000000000000000000000006daf228391e388b05bbc682fea3cb1cc3e38c44e
Arg [1] : 000000000000000000000000a96d4dfb9eed8824cae29fa0b7e62c72b5e51018
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000000


Block Transaction Gas Used Reward
view all blocks validated

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]

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