POL Price: $0.211198 (-3.05%)
Gas: 30 GWei
 

Overview

POL Balance

Polygon PoS Chain LogoPolygon PoS Chain LogoPolygon PoS Chain Logo0 POL

POL Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Deposit369596252022-12-18 0:57:08824 days ago1671325028IN
0x17E765Cf...3B9eD0e8C
0 POL0.0021055230
Deposit369596252022-12-18 0:57:08824 days ago1671325028IN
0x17E765Cf...3B9eD0e8C
0 POL0.0021055230
Deposit369596252022-12-18 0:57:08824 days ago1671325028IN
0x17E765Cf...3B9eD0e8C
0 POL0.0021055230
Deposit369596252022-12-18 0:57:08824 days ago1671325028IN
0x17E765Cf...3B9eD0e8C
0 POL0.0021055230
Deposit367541152022-12-12 20:43:53829 days ago1670877833IN
0x17E765Cf...3B9eD0e8C
0 POL0.0023180533
Deposit367540452022-12-12 20:41:25829 days ago1670877685IN
0x17E765Cf...3B9eD0e8C
0 POL0.0023180533
Emergency Withdr...352741512022-11-06 13:29:55865 days ago1667741395IN
0x17E765Cf...3B9eD0e8C
0 POL0.01194266172.01261039
Deposit319913602022-08-17 9:46:21946 days ago1660729581IN
0x17E765Cf...3B9eD0e8C
0 POL0.0021069630
Deposit269550732022-04-10 4:21:111075 days ago1649564471IN
0x17E765Cf...3B9eD0e8C
0 POL0.0021076830
Deposit264637252022-03-28 14:32:361088 days ago1648477956IN
0x17E765Cf...3B9eD0e8C
0 POL0.0023180533
Deposit264636572022-03-28 14:30:161088 days ago1648477816IN
0x17E765Cf...3B9eD0e8C
0 POL0.0023180533
Deposit255153202022-03-03 1:58:501114 days ago1646272730IN
0x17E765Cf...3B9eD0e8C
0 POL0.0021073230
Deposit255153142022-03-03 1:58:371114 days ago1646272717IN
0x17E765Cf...3B9eD0e8C
0 POL0.0021044430
Deposit255152872022-03-03 1:57:431114 days ago1646272663IN
0x17E765Cf...3B9eD0e8C
0 POL0.0021073230
Deposit253517292022-02-26 10:33:401118 days ago1645871620IN
0x17E765Cf...3B9eD0e8C
0 POL0.0021073230
Deposit253517292022-02-26 10:33:401118 days ago1645871620IN
0x17E765Cf...3B9eD0e8C
0 POL0.0021073230
Deposit249389462022-02-14 17:13:421130 days ago1644858822IN
0x17E765Cf...3B9eD0e8C
0 POL0.003512250
Deposit249388902022-02-14 17:11:461130 days ago1644858706IN
0x17E765Cf...3B9eD0e8C
0 POL0.0028345740.35325105
Emergency Withdr...249005622022-02-13 17:27:041131 days ago1644773224IN
0x17E765Cf...3B9eD0e8C
0 POL0.002346629.93801586
Emergency Withdr...248951222022-02-13 14:04:131131 days ago1644761053IN
0x17E765Cf...3B9eD0e8C
0 POL0.000150512.1669352
Deposit246869172022-02-08 7:17:551136 days ago1644304675IN
0x17E765Cf...3B9eD0e8C
0 POL0.0021069630
Deposit246868552022-02-08 7:15:471136 days ago1644304547IN
0x17E765Cf...3B9eD0e8C
0 POL0.0024172234.41771914
Deposit246867822022-02-08 7:13:131136 days ago1644304393IN
0x17E765Cf...3B9eD0e8C
0 POL0.0021076830
Deposit246628652022-02-07 16:41:291137 days ago1644252089IN
0x17E765Cf...3B9eD0e8C
0 POL0.0021073230
Deposit246624632022-02-07 16:25:291137 days ago1644251129IN
0x17E765Cf...3B9eD0e8C
0 POL0.0023180533
View all transactions

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

Contract Source Code Verified (Exact Match)

Contract Name:
ProtofiMasterChef

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 999999 runs

Other Settings:
default evmVersion
File 1 of 12 : ProtofiMasterChef.sol
// SPDX-License-Identifier: MIT
pragma solidity >= 0.6.12;

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

import "./ProtonToken.sol";
import "./ElectronToken.sol";

/**
This is the masterchef of ProtoFi.

It has several features:

- Ownable
- ReentrancyGuard
- Farms with:
--- Lockup period (customizable)
--- Deposit fee (customizable)
--- Primary or secondary tokens as reward

Owner --> Timelock

Base is the Masterchef from Pancake, with several added features and ReentrancyGuard for security reasons
*/
contract ProtofiMasterChef is Ownable, ReentrancyGuard {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;
    using SafeERC20 for ProtofiERC20;

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

    // Info of each pool.
    struct PoolInfo {
        IERC20 lpToken;           // Address of LP token contract.
        uint256 lpSupply;         // Supply of the lp token related to the pool.
        uint256 allocPoint;       // How many allocation points assigned to this pool. PROTOs to distribute per block.
        uint256 lastRewardBlock;  // Last block number that PROTOs distribution occurs.
        uint256 accProtonPerShare; // Accumulated PROTOs per share, times 1e12. See below.
        uint16 depositFeeBP;      // Deposit fee in basis points.
        uint256 harvestInterval;  // Harvest interval in seconds.
        bool isElectronRewards;     // Establishes which token is given as reward for each pool.
    }

    // The PROTO token - Primary token for ProtoFi tokenomics
    ProtonToken public proton;
    // The ELCT token - Secondary (shares) token for ProtoFi tokenomics
    ElectronToken public electron;
    // Dev address.
    address public devAddress;
    // Deposit Fee address
    address public feeAddress;
    // PROTO tokens created per block, number including decimals.
    uint256 public protonPerBlock;
    // Bonus muliplier
    uint256 public constant BONUS_MULTIPLIER = 1;
    // Max harvest interval: 14 days.
    uint256 public constant MAXIMUM_HARVEST_INTERVAL = 14 days; // Cannot be changed, ever!
    // Max deposit fee is at 6% - Gives us a bit of flexibility, in general it will be <= 4.5%
    uint256 public constant MAXIMUM_DEPOSIT_FEES = 600; // Cannot be changed, ever!

    address public constant BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD;

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

    // Events, always useful to keep trak
    event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
    event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
    event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
    event UpdateEmissionRate(address indexed user, uint256 indexed protonPerBlock);
    event RewardLockedUp(address indexed user, uint256 indexed pid, uint256 amountLockedUp);

    event UpdatedDevAddress(address indexed previousDevAddress, address indexed newDevAddress);
    event UpdatedFeeAddress(address indexed previousFeeAddress, address indexed newFeeAddress);

    constructor(
        ProtonToken _proton,
        ElectronToken _electron,
        uint256 _startBlock,
        uint256 _protonPerBlock,
        address _devaddr,
        address _feeAddress
    ) public {
        proton = _proton;
        electron = _electron;
        startBlock = _startBlock;
        protonPerBlock = _protonPerBlock;

        devAddress = _devaddr;
        feeAddress = _feeAddress;

        // No pools are added by default!
    }

    // Checks that poolInfo array has length at least >= _pid
    modifier validatePool(uint256 _pid) {
        require(_pid < poolInfo.length, "validatePool: pool exists?");
        _;
    }

    // Returns the number of pools
    function poolLength() external view returns (uint256) {
        return poolInfo.length;
    }

    // Add a new lp to the pool. Can only be called by the owner.
    function add(uint256 _allocPoint, IERC20 _lpToken,
                uint16 _depositFeeBP, uint256 _harvestInterval,
                bool _isElectronRewards) public onlyOwner {

        // First deposit fee and harvest interval must not be higher than predefined values
        require(_depositFeeBP <= MAXIMUM_DEPOSIT_FEES, "add: invalid deposit fee basis points");
        require(_harvestInterval <= MAXIMUM_HARVEST_INTERVAL, "add: invalid harvest interval");

        // Always update pools
        massUpdatePools();

        uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock;
        // Update the totalAllocPoint for the whole masterchef!
        totalAllocPoint = totalAllocPoint.add(_allocPoint);

        poolInfo.push(PoolInfo({
            lpToken: _lpToken,
            lpSupply: 0,
            allocPoint: _allocPoint,
            lastRewardBlock: lastRewardBlock,
            accProtonPerShare: 0,
            depositFeeBP: _depositFeeBP,
            harvestInterval: _harvestInterval,
            isElectronRewards: _isElectronRewards
        }));
    }

    // Update the given pool's PROTO allocation point and deposit fee. Can only be called by the owner.
    function set(uint256 _pid, uint256 _allocPoint,
                 uint16 _depositFeeBP, uint256 _harvestInterval,
                 bool _isElectronRewards) public onlyOwner {
        // First deposit fee and harvest interval must not be higher than predefined values
        require(_depositFeeBP <= MAXIMUM_DEPOSIT_FEES, "set: invalid deposit fee basis points");
        require(_harvestInterval <= MAXIMUM_HARVEST_INTERVAL, "set: invalid harvest interval");

        // Always update pools
        massUpdatePools();

        poolInfo[_pid].allocPoint = _allocPoint;
        poolInfo[_pid].depositFeeBP = _depositFeeBP;
        poolInfo[_pid].harvestInterval = _harvestInterval;
        poolInfo[_pid].isElectronRewards = _isElectronRewards;
        uint256 prevAllocPoint = poolInfo[_pid].allocPoint;
        if (prevAllocPoint != _allocPoint) {
            // Update the totalAllocPoint for the whole masterchef!
            totalAllocPoint = totalAllocPoint.sub(prevAllocPoint).add(_allocPoint);
        }
    }

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

    // View function to see pending PROTOs on frontend.
    function pendingProton(uint256 _pid, address _user) external view returns (uint256) {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][_user];
        uint256 accProtonPerShare = pool.accProtonPerShare;
        uint256 lpSupply = pool.lpSupply; // Taken from the pool!
        if (block.number > pool.lastRewardBlock && lpSupply != 0) {
            uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
            uint256 protonReward = multiplier.mul(protonPerBlock).mul(pool.allocPoint).div(totalAllocPoint);
            accProtonPerShare = accProtonPerShare.add(protonReward.mul(1e12).div(lpSupply));
        }
        uint256 pending = user.amount.mul(accProtonPerShare).div(1e12).sub(user.rewardDebt);
        if(!pool.isElectronRewards){
            // Primary token has a 1.8% burning mechanism on the transfer function, hence
            // we take into account the 1.8% auto-burn
            pending = pending.mul(982).div(1000);
        }
        return pending.add(user.rewardLockedUp);
    }

    // View function to see if user can harvest PROTOs.
    function canHarvest(uint256 _pid, address _user) public view returns (bool) {
        UserInfo storage user = userInfo[_pid][_user];
        return block.timestamp >= user.nextHarvestUntil;
    }

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

    // Update reward variables of the given pool to be up-to-date.
    function updatePool(uint256 _pid) public {
        PoolInfo storage pool = poolInfo[_pid];
        if (block.number <= pool.lastRewardBlock) {
            return;
        }
        uint256 lpSupply = pool.lpSupply;
        if (lpSupply == 0 || pool.allocPoint == 0) {
            pool.lastRewardBlock = block.number;
            return;
        }
        uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
        uint256 protonReward = multiplier.mul(protonPerBlock).mul(pool.allocPoint).div(totalAllocPoint);

        // 5% fees to the dev address for salaries + Marketing + Moneypot
        proton.mint(devAddress, protonReward.div(20));

        // 5% To the burning address
        proton.mint(address(this), protonReward.div(20));
        safeProtonTransfer(BURN_ADDRESS, protonReward.div(20));

        if (pool.isElectronRewards){
            electron.mint(address(this), protonReward);
        }
        else{
            proton.mint(address(this), protonReward);
        }
        pool.accProtonPerShare = pool.accProtonPerShare.add(protonReward.mul(1e12).div(lpSupply));
        pool.lastRewardBlock = block.number;
    }

    /**
    Deposit LP tokens to ProtofiMasterChef for PROTO allocation.
    At the same time, updates the Pool and harvests if the user
    is allowed to harvest from this pool
    */
    function deposit(uint256 _pid, uint256 _amount) public nonReentrant {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];
        updatePool(_pid);
        payOrLockupPendingProton(_pid);
        if (_amount > 0) {
            uint256 balanceBefore = pool.lpToken.balanceOf(address(this));
            pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount);
            _amount = pool.lpToken.balanceOf(address(this)).sub(balanceBefore);
            if (pool.depositFeeBP > 0) {
                // Stake paying deposit fees.
                uint256 depositFee = _amount.mul(pool.depositFeeBP).div(10000);
                pool.lpToken.safeTransfer(feeAddress, depositFee);
                user.amount = user.amount.add(_amount).sub(depositFee);
                pool.lpSupply = pool.lpSupply.add(_amount).sub(depositFee);
            } else {
                user.amount = user.amount.add(_amount);
                pool.lpSupply = pool.lpSupply.add(_amount);
            }
        }
        user.rewardDebt = user.amount.mul(pool.accProtonPerShare).div(1e12);
        emit Deposit(msg.sender, _pid, _amount);
    }

    /**
    Withdraw LP tokens from ProtofiMasterChef.
    At the same time, updates the Pool and harvests if the user
    is allowed to harvest from this pool
    */
    function withdraw(uint256 _pid, uint256 _amount) public nonReentrant {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];
        require(user.amount >= _amount, "withdraw: user amount staked is lower than the requested amount");

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

    /**
    Withdraw without caring about rewards. EMERGENCY ONLY.
    Resets user infos.
    Resets pool infos for the user (lpSupply)
    Transfers staked tokens to the user
    */
    function emergencyWithdraw(uint256 _pid) public nonReentrant {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];
        uint256 amount = user.amount;
        user.amount = 0;
        user.rewardDebt = 0;
        user.rewardLockedUp = 0;
        user.nextHarvestUntil = 0;
        pool.lpSupply = pool.lpSupply.sub(user.amount);
        pool.lpToken.safeTransfer(address(msg.sender), amount);
        emit EmergencyWithdraw(msg.sender, _pid, amount);
    }

    // Pay or lockup pending PROTOs.
    function payOrLockupPendingProton(uint256 _pid) internal {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];

        if (user.nextHarvestUntil == 0) {
            // Update nextHarvestTime for the user if it's set to 0
            user.nextHarvestUntil = block.timestamp.add(pool.harvestInterval);
        }

        uint256 pending = user.amount.mul(pool.accProtonPerShare).div(1e12).sub(user.rewardDebt);
        if (canHarvest(_pid, msg.sender)) {
            if (pending > 0 || user.rewardLockedUp > 0) {
                uint256 totalRewards = pending.add(user.rewardLockedUp);

                // Reset lockup
                totalLockedUpRewards = totalLockedUpRewards.sub(user.rewardLockedUp);
                user.rewardLockedUp = 0;
                user.nextHarvestUntil = block.timestamp.add(pool.harvestInterval);

                // Send rewards
                if(pool.isElectronRewards){
                    safeElectronTransfer(msg.sender, totalRewards);
                }
                else{
                    safeProtonTransfer(msg.sender, totalRewards);
                }
            }
        } else if (pending > 0) {
            user.rewardLockedUp = user.rewardLockedUp.add(pending);
            totalLockedUpRewards = totalLockedUpRewards.add(pending);
            emit RewardLockedUp(msg.sender, _pid, pending);
        }
    }

    // Safe proton transfer function, just in case if rounding error causes pool to not have enough PROTOs.
    function safeProtonTransfer(address _to, uint256 _amount) internal {
        uint256 protonBal = proton.balanceOf(address(this));
        bool transferSuccess = false;
        if (_amount > protonBal) {
            transferSuccess = proton.transfer(_to, protonBal);
        } else {
            transferSuccess = proton.transfer(_to, _amount);
        }
        require(transferSuccess, "safeProtonTransfer: Transfer failed");
    }

    // Safe electron transfer function, just in case if rounding error causes pool to not have enough ELCTs.
    function safeElectronTransfer(address _to, uint256 _amount) internal {
        uint256 electronBal = electron.balanceOf(address(this));
        bool transferSuccess = false;
        if (_amount > electronBal) {
            transferSuccess = electron.transfer(_to, electronBal);
        } else {
            transferSuccess = electron.transfer(_to, _amount);
        }
        require(transferSuccess, "safeElectronTransfer: Transfer failed");
    }

    function getPoolInfo(uint256 _pid) external view
        returns(address lpToken, uint256 allocPoint,
                uint256 lastRewardBlock, uint256 accProtonPerShare,
                uint256 depositFeeBP, uint256 harvestInterval,
                bool isElectronRewards) {
        return (
            address(poolInfo[_pid].lpToken),
            poolInfo[_pid].allocPoint,
            poolInfo[_pid].lastRewardBlock,
            poolInfo[_pid].accProtonPerShare,
            poolInfo[_pid].depositFeeBP,
            poolInfo[_pid].harvestInterval,
            poolInfo[_pid].isElectronRewards
        );
    }

    // Sets the dev address, can be changed only by the dev.
    function setDevAddress(address _devAddress) public {
        require(msg.sender == devAddress, "setDevAddress: FORBIDDEN");
        require(_devAddress != address(0), "setDevAddress: ZERO");
        devAddress = _devAddress;
        emit UpdatedDevAddress(msg.sender, _devAddress);
    }

    // Sets the fee address, can be changed only by the feeAddress.
    function setFeeAddress(address _feeAddress) public {
        require(msg.sender == feeAddress, "setFeeAddress: FORBIDDEN");
        require(_feeAddress != address(0), "setFeeAddress: ZERO");
        feeAddress = _feeAddress;
        emit UpdatedFeeAddress(msg.sender, _feeAddress);
    }

    // Update Emission Rate to control the emission per block (TimeLocked).
    function updateEmissionRate(uint256 _protonPerBlock) public onlyOwner {
        massUpdatePools();
        protonPerBlock = _protonPerBlock;
        emit UpdateEmissionRate(msg.sender, _protonPerBlock);
    }
}

File 2 of 12 : ElectronToken.sol
// SPDX-License-Identifier: MIT
pragma solidity >= 0.6.12;

import "@openzeppelin/contracts/math/SafeMath.sol";
import "./libs/ProtofiERC20.sol";
import "./interfaces/IMoneyPot.sol";

/**
This is the contract of the secondary token.

Features:
- Ownable
- Keeps track of every holder
- Can be swapped for the primary tokens
- Keeps track of the penalty over time to swap this token for the primary token

Owner --> Masterchef for farming features
 */
contract ElectronToken is ProtofiERC20("Electron Token", "ELCT") {
    using SafeMath for uint256;

    struct HolderInfo {
        uint256 avgTransactionBlock;
    }

    ProtofiERC20 public proton;
    bool private _isProtonSetup = false;

    IMoneyPot public moneyPot;
    bool private _isMoneyPotSetup = false;

    /// Penalty period expressed in blocks.
    uint256 public immutable SWAP_PENALTY_MAX_PERIOD; // default 129600 blocks (3d*24h*60m*60sec/2sec): after 72h penalty of holding electron, swap penalty is at the minimum (zero penalty)
    /// Penalty expressed in percentage points --> e.g. 30 means 30% of penalty
    uint256 public immutable SWAP_PENALTY_MAX_PER_ELCT; // default: 30, 30% => 1 electron = 0.7 proton

    // Keeps track of all the historical holders of Electron
    address[] private holdersAddresses;
    // Keeps track of all the addresses added to holdersAddresses
    mapping (address => bool) public wallets;
    // Keeps track of useful infos for each holder
    mapping(address => HolderInfo) public holdersInfo;

    constructor (uint256 swapPenaltyMaxPeriod, uint256 swapPenaltyMaxPerElectron) public{
        SWAP_PENALTY_MAX_PERIOD = swapPenaltyMaxPeriod;
        SWAP_PENALTY_MAX_PER_ELCT = swapPenaltyMaxPerElectron.mul(1e10);
    }

    /// Sets the reference to the primary token, can be done only once, be careful!
    function setupProton(ProtofiERC20 _proton) external onlyOwner {
        require(!_isProtonSetup, "The Proton token has already been set up. No one can change it anymore.");
        proton = _proton;
        _isProtonSetup = true;
    }

    /// Sets the reference to the MoneyPot, can be done only once, be careful!
    function setupMoneyPot(IMoneyPot _moneyPot) external onlyOwner {
        require(!_isMoneyPotSetup, "The Moneypot has already been set up. No one can change it anymore.");
        moneyPot = _moneyPot;
        _isMoneyPotSetup = true;
    }

    /**
    Calculate the penality for swapping ELCT to PROTO for a user.
    The penality decrease over time (by holding duration).
    From SWAP_PENALTY_MAX_PER_ELCT % to 0% on SWAP_PENALTY_MAX_PERIOD
    */
    function getPenaltyPercent(address _holderAddress) public view returns (uint256){
        HolderInfo storage holderInfo = holdersInfo[_holderAddress];
        if(block.number >= holderInfo.avgTransactionBlock.add(SWAP_PENALTY_MAX_PERIOD)){
            return 0;
        }
        if(block.number == holderInfo.avgTransactionBlock){
            return SWAP_PENALTY_MAX_PER_ELCT;
        }
        uint256 avgHoldingDuration = block.number.sub(holderInfo.avgTransactionBlock);
        return SWAP_PENALTY_MAX_PER_ELCT.sub(
            SWAP_PENALTY_MAX_PER_ELCT.mul(avgHoldingDuration).div(SWAP_PENALTY_MAX_PERIOD)
        );
    }

    /// Allow use to exchange (swap) their electron to proton
    function swapToProton(uint256 _amount) external {
        require(_amount > 0, "amount 0");
        address _from = msg.sender;
        // Get the amount of the primary token to be received
        uint256 protonAmount = _swapProtonAmount( _from, _amount);
        holdersInfo[_from].avgTransactionBlock = _getAvgTransactionBlock(_from, holdersInfo[_from], _amount, true);
        
        // Burn ELCT and mint PROTO
        super._burn(_from, _amount);

        // Moving delegates with the call to _burn
        emit DelegateChanged(_from, _delegates[_from], _delegates[BURN_ADDRESS]);
        _moveDelegates(_delegates[_from], _delegates[BURN_ADDRESS], _amount);

        proton.mint(_from, protonAmount);

        if (address(moneyPot) != address(0)) {
            moneyPot.updateElectronHolder(_from);
        }
    }

    /**
    @notice Preview swap return in proton with _electronAmount by _holderAddress
    this function is used by front-end to show how much PROTO will be retrieved if _holderAddress swap _electronAmount
    */
    function previewSwapProtonExpectedAmount(address _holderAddress, uint256 _electronAmount) external view returns (uint256 expectedProton){
        return _swapProtonAmount( _holderAddress, _electronAmount);
    }

    /**
    @notice Preview swap return in proton from all the addresses holding ELCT
    This function is used by front-end to show how much PROTO will be generated if all the holders of ELCT swap all ELCTS for PROTOS
    */
    function previewTotalSwapElectronToProton() external view returns (uint256 expectedProton){

        uint256 totalProton = 0;
        // For each holder, update the total PROTOs that can be generated
        for(uint index = 0; index < holdersAddresses.length; index++){
            address tmpaddress = holdersAddresses[index];
            uint256 tmpbalance = balanceOf(tmpaddress);
            totalProton = totalProton.add(_swapProtonAmount(tmpaddress, tmpbalance));
        }
        return totalProton;
    }

    /// @notice Calculate the adjustment for a user if he want to swap _electronAmount to proton
    function _swapProtonAmount(address _holderAddress, uint256 _electronAmount) internal view returns (uint256 expectedProton){
        require(balanceOf(_holderAddress) >= _electronAmount, "Not enough electron");
        uint256 penalty = getPenaltyPercent(_holderAddress);
        if(penalty == 0){
            return _electronAmount;
        }

        return _electronAmount.sub(_electronAmount.mul(penalty).div(1e12));
    }

    /**
    @notice Calculate average deposit/withdraw block for _holderAddress

    @dev The average transaction block is:
    - set to 0 if the user swaps all his electron to proton
    - set to the previous avgTransactionBlock if the user does not swap all his electron
    - is updated if the holder gets new electron
    Basically, avgTransactionBlock is updated to a higher value only if _holderAddress receives new electron,
    otherwise avgTransactionBlock stays the same or go to 0 if everything is swapped or sent.
     */
    function _getAvgTransactionBlock(address _holderAddress, HolderInfo storage holderInfo, uint256 _electronAmount, bool _onWithdraw) internal view returns (uint256){
        if (balanceOf(_holderAddress) == 0) {
            return block.number;
        }
        uint256 minAvgTransactionBlockPossible = block.number.sub(SWAP_PENALTY_MAX_PERIOD);
        uint256 holderAvgTransactionBlock = holderInfo.avgTransactionBlock > minAvgTransactionBlockPossible ? holderInfo.avgTransactionBlock : minAvgTransactionBlockPossible;

        uint256 transactionBlockWeight;
        if (_onWithdraw) {
            if (balanceOf(_holderAddress) == _electronAmount) {
                return 0; // Average transaction block is the lowest possible block
            }
            else {
                return holderAvgTransactionBlock;
            }
        }
        else {
            transactionBlockWeight = (balanceOf(_holderAddress).mul(holderAvgTransactionBlock).add(block.number.mul(_electronAmount)));
        }

        uint256 avgTransactionBlock = transactionBlockWeight.div(balanceOf(_holderAddress).add(_electronAmount));
        return avgTransactionBlock > minAvgTransactionBlockPossible ? avgTransactionBlock : minAvgTransactionBlockPossible;
    }


    /// @notice Creates `_amount` token to `_to`.
    function mint(address _to, uint256 _amount) external virtual override onlyOwner {
        HolderInfo storage holder = holdersInfo[_to];
        // avgTransactionBlock is updated accordingly to the amount minted
        holder.avgTransactionBlock = _getAvgTransactionBlock(_to, holder, _amount, false);

        if(wallets[_to] == false){
            // Add holder to historical holders
            holdersAddresses.push(_to);
            wallets[_to] = true;
        }

        _mint(_to, _amount);
        _moveDelegates(address(0), _delegates[_to], _amount);

        if (address(moneyPot) != address(0)) {
            moneyPot.updateElectronHolder(_to);
        }
    }

    /// @dev overrides transfer function to meet tokenomics of ELCT
    function _transfer(address _sender, address _recipient, uint256 _amount) internal virtual override {
        holdersInfo[_sender].avgTransactionBlock = _getAvgTransactionBlock(_sender, holdersInfo[_sender], _amount, true);
        if (_recipient == BURN_ADDRESS) {
            super._burn(_sender, _amount);
            if (address(moneyPot) != address(0)) {
                moneyPot.updateElectronHolder(_sender);
            }
        } else {
            holdersInfo[_recipient].avgTransactionBlock = _getAvgTransactionBlock(_recipient, holdersInfo[_recipient], _amount, false);
            super._transfer(_sender, _recipient, _amount);

            if (address(moneyPot) != address(0)) {
                moneyPot.updateElectronHolder(_sender);
                if (_sender != _recipient){
                    moneyPot.updateElectronHolder(_recipient);
                }
            }
        }
        if(wallets[_recipient] == false){
            // Add holder to historical holders
            holdersAddresses.push(_recipient);
            wallets[_recipient] = true;
        }

        // Moving delegates while transferring tokens - Valid also for the _burn call
        emit DelegateChanged(_sender, _delegates[msg.sender], _delegates[_recipient]);
        _moveDelegates(_delegates[msg.sender], _delegates[_recipient], _amount);
    }

    // Copied and modified from YAM code:
    // https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernanceStorage.sol
    // https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernance.sol
    // Which is copied and modified from COMPOUND:
    // https://github.com/compound-finance/compound-protocol/blob/master/contracts/Governance/Comp.sol

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @notice 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,
        uint nonce,
        uint 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), "PROTO::delegateBySig: invalid signature");
        require(nonce == nonces[signatory]++, "PROTO::delegateBySig: invalid nonce");
        require(now <= expiry, "PROTO::delegateBySig: signature expired");
        return _delegate(signatory, delegatee);
    }

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

    /**
     * @notice 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, uint blockNumber)
    external
    view
    returns (uint256)
    {
        require(blockNumber < block.number, "PROTO::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 PROTOs (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, "PROTO::_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(uint n, string memory errorMessage) internal pure returns (uint32) {
        require(n < 2 ** 32, errorMessage);
        return uint32(n);
    }

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

File 3 of 12 : ProtonToken.sol
// SPDX-License-Identifier: MIT
pragma solidity >= 0.6.12;

import "./libs/ProtofiERC20.sol";

/**
This is the contract of the primary token.

Features:
- 2% burn mechanism for every transaction.
- Ownable
- Strictly related to the second token
- You can use the second token to claim the primary token.
- Antiwhale,  can be set up only by operator

Owner --> Masterchef for farming features
Operator --> Team address that handles the antiwhales settings when needed
*/
contract ProtonToken is ProtofiERC20 {

    // Address to the secondary token
    address public electron;
    bool private _isElectronSetup = false;

    // Addresses that excluded from antiWhale
    mapping(address => bool) private _excludedFromAntiWhale;
    // Addresses that excluded from transfer fee
    mapping(address => bool) private _excludedFromTransferFee;

    // Max transfer amount rate in basis points. Eg: 50 - 0.5% of total supply (default the anti whale feature is turned off - set to 10000.)
    uint16 public maxTransferAmountRate = 10000;
    // Minimum transfer amount rate in basis points. Deserved for user trust, we can't block users to send this token.
    // maxTransferAmountRate cannot be lower than BASE_MIN_TRANSFER_AMOUNT_RATE
    uint16 public constant BASE_MAX_TRANSFER_AMOUNT_RATE = 100; // Cannot be changed, ever!
    // The operator can only update the Anti Whale Settings
    address private _operator;

    // Events
    event OperatorTransferred(address indexed previousOperator, address indexed newOperator);
    event MaxTransferAmountRateUpdated(address indexed operator, uint256 previousRate, uint256 newRate);

    constructor() public ProtofiERC20("Protofi Token", "PROTO"){

        // After initializing the token with the original constructor of ProtofiERC20
        // setup antiwhale variables.
        _operator = msg.sender;
        emit OperatorTransferred(address(0), _operator);

        _excludedFromAntiWhale[msg.sender] = true; // Original deployer address
        _excludedFromAntiWhale[address(0)] = true;
        _excludedFromAntiWhale[address(this)] = true;
        _excludedFromAntiWhale[BURN_ADDRESS] = true;
    }

    /**
    @dev similar to onlyOwner but used to handle the antiwhale side of the smart contract.
    In that way the ownership can be transferred to the MasterChef without preventing devs to modify
    antiwhale settings.
     */
    modifier onlyOperator() {
        require(_operator == msg.sender, "operator: caller is not the operator");
        _;
    }

    /**
    Exludes sender to send more than a certain amount of tokens given settings, if the
    sender is not whitelisted!
     */
    modifier antiWhale(address sender, address recipient, uint256 amount) {
        if (maxTransferAmount() > 0) {
            if (
                _excludedFromAntiWhale[sender] == false
            ) {
                require(amount <= maxTransferAmount(), "PROTO::antiWhale: Transfer amount exceeds the maxTransferAmount");
            }
        }
        _;
    }

    /**
     * @dev Returns the max transfer amount.
     */
    function maxTransferAmount() public view returns (uint256) {
        return totalSupply().mul(maxTransferAmountRate).div(10000);
    }

    /**
     * @dev Update the max transfer amount rate.
     * Can only be called by the current operator.
     */
    function updateMaxTransferAmountRate(uint16 _maxTransferAmountRate) public onlyOperator {
        require(_maxTransferAmountRate <= 10000, "PROTO::updateMaxTransferAmountRate: Max transfer amount rate must not exceed the maximum rate.");
        require(_maxTransferAmountRate >= BASE_MAX_TRANSFER_AMOUNT_RATE, "PROTO::updateMaxTransferAmountRate: _maxTransferAmountRate should be at least _maxTransferAmountRate");
        emit MaxTransferAmountRateUpdated(msg.sender, maxTransferAmountRate, _maxTransferAmountRate);
        maxTransferAmountRate = _maxTransferAmountRate;
    }

    /**
     * @dev Returns the address is excluded from antiWhale or not.
     */
    function isExcludedFromAntiWhale(address _account) public view returns (bool) {
        return _excludedFromAntiWhale[_account];
    }

    /**
     * @dev Exclude or include an address from antiWhale.
     * Can only be called by the current operator.
     */
    function setExcludedFromAntiWhale(address _account, bool _excluded) public onlyOperator {
        _excludedFromAntiWhale[_account] = _excluded;
    }

    /**
     * @dev Returns the address is excluded from transfer fee or not.
     */
    function isExcludedFromTransferFee(address _account) public view returns (bool) {
        return _excludedFromTransferFee[_account];
    }

    /**
     * @dev Exclude or include an address from transfer fee.
     * Can only be called by the current operator.
     */
    function setExcludedFromTransferFee(address _account, bool _excluded) public onlyOperator {
        _excludedFromTransferFee[_account] = _excluded;
    }

    /// @dev Throws if called by any account other than the owner or the secondary token
    modifier onlyOwnerOrElectron() {
        require(isOwner() || isElectron(), "caller is not the owner or electron");
        _;
    }

    /// @dev Returns true if the caller is the current owner.
    function isOwner() public view returns (bool) {
        return msg.sender == owner();
    }

    /// @dev Returns true if the caller is electron contracts.
    function isElectron() internal view returns (bool) {
        return msg.sender == address(electron);
    }

    /// @dev Sets the secondary token address.
    function setupElectron(address _electron) external onlyOwner{
        require(!_isElectronSetup, "The Electron token address has already been set up. No one can change it anymore.");
        electron = _electron;
        _isElectronSetup = true;
    }

    /**
    @notice Creates `_amount` token to `_to`. Must only be called by the masterchef or
    by the secondary token(during swap)
    */
    function mint(address _to, uint256 _amount) external virtual override onlyOwnerOrElectron  {
        _mint(_to, _amount);
    }

    /// @dev overrides transfer function to meet tokenomics of PROTO
    function _transfer(address sender, address recipient, uint256 amount) internal virtual override antiWhale(sender, recipient, amount) {
        require(amount > 0, "amount 0");

        if (recipient == BURN_ADDRESS) {
            // Burn all the amount
            super._burn(sender, amount);
        } else if (_excludedFromTransferFee[sender] || _excludedFromTransferFee[recipient]){
            // Transfer all the amount
            super._transfer(sender, recipient, amount);
        } else {
            // 1.8% of every transfer burnt
            uint256 burnAmount = amount.mul(18).div(1000);
            // 98.2% of transfer sent to recipient
            uint256 sendAmount = amount.sub(burnAmount);
            require(amount == sendAmount + burnAmount, "PROTO::transfer: Burn value invalid");

            super._burn(sender, burnAmount);
            super._transfer(sender, recipient, sendAmount);
            amount = sendAmount;
        }
    }

    /**
     * @dev Transfers operator of the contract to a new account (`newOperator`).
     * Can only be called by the current operator.
     */
    function transferOperator(address newOperator) public onlyOperator {
        require(newOperator != address(0), "ProtonToken::transferOperator: new operator is the zero address");
        emit OperatorTransferred(_operator, newOperator);
        _operator = newOperator;
    }
}

File 4 of 12 : IMoneyPot.sol
// SPDX-License-Identifier: MIT
pragma solidity >= 0.6.12;

interface IMoneyPot {
    function isDividendsToken(address _tokenAddr) external view returns (bool);
    function getRegisteredTokenLength() external view returns (uint256);
    function depositRewards(address _token, uint256 _amount) external;
    function getRegisteredToken(uint256 index) external view returns (address);
    function updateElectronHolder(address _electronHolder) external;
}

File 5 of 12 : ProtofiERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity >= 0.6.12;

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

/*
 * @dev Implementation of the {IERC20} interface.
 * This implementation is a copy of @pancakeswap/pancake-swap-lib/contracts/token/ERC20/ERC20.sol
 * with a burn supply management.
 */
contract ProtofiERC20 is Context, IERC20, Ownable {
    using SafeMath for uint256;
    using Address for address;

    address public constant BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD;

    mapping(address => uint256) private _balances;

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

    uint256 private _totalSupply;
    uint256 private _burnSupply;

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

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

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

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

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

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

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

    /**
     * @dev See {ERC20-totalSupply}.
     */
    function burnSupply() public view returns (uint256) {
        return _burnSupply;
    }

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

    /**
     * @dev See {ERC20-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 override returns (bool) {
        _transfer(_msgSender(), recipient, amount);
        return true;
    }

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

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

    /**
     * @dev See {ERC20-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 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 {ERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
        return true;
    }

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

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

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

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

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

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

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
     *
     * This is internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal {
        require(owner != address(0), "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 Destroys `amount` tokens from `account`.`amount` is then deducted
     * from the caller"s allowance.
     *
     * See {_burn} and {_approve}.
     */
    function _burnFrom(address account, uint256 amount) internal {
        _burn(account, amount);
        _approve(
            account,
            _msgSender(),
            _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance")
        );
    }
}

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

pragma solidity >=0.6.0 <0.8.0;

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

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

File 7 of 12 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor () internal {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

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

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

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

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

File 8 of 12 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

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

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

        return c;
    }

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

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

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

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts 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) {
        require(b > 0, errorMessage);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts 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 mod(a, b, "SafeMath: modulo by zero");
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts with custom message 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, string memory errorMessage) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

File 9 of 12 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

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

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

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

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

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

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

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

File 10 of 12 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "./IERC20.sol";
import "../../math/SafeMath.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 SafeMath for uint256;
    using Address for address;

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

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

    /**
     * @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'
        // solhint-disable-next-line max-line-length
        require((value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

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

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

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. 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");
        if (returndata.length > 0) { // Return data is optional
            // solhint-disable-next-line max-line-length
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 11 of 12 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

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

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 0;
    }

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

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call{ value: amount }("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

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

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

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

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

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

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

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

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

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

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

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

pragma solidity >=0.6.0 <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 () internal {
        _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 make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"contract ProtonToken","name":"_proton","type":"address"},{"internalType":"contract ElectronToken","name":"_electron","type":"address"},{"internalType":"uint256","name":"_startBlock","type":"uint256"},{"internalType":"uint256","name":"_protonPerBlock","type":"uint256"},{"internalType":"address","name":"_devaddr","type":"address"},{"internalType":"address","name":"_feeAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"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":"amountLockedUp","type":"uint256"}],"name":"RewardLockedUp","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"protonPerBlock","type":"uint256"}],"name":"UpdateEmissionRate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousDevAddress","type":"address"},{"indexed":true,"internalType":"address","name":"newDevAddress","type":"address"}],"name":"UpdatedDevAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousFeeAddress","type":"address"},{"indexed":true,"internalType":"address","name":"newFeeAddress","type":"address"}],"name":"UpdatedFeeAddress","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":"BURN_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAXIMUM_DEPOSIT_FEES","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAXIMUM_HARVEST_INTERVAL","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":"uint16","name":"_depositFeeBP","type":"uint16"},{"internalType":"uint256","name":"_harvestInterval","type":"uint256"},{"internalType":"bool","name":"_isElectronRewards","type":"bool"}],"name":"add","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"canHarvest","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"devAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"electron","outputs":[{"internalType":"contract ElectronToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_from","type":"uint256"},{"internalType":"uint256","name":"_to","type":"uint256"}],"name":"getMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"getPoolInfo","outputs":[{"internalType":"address","name":"lpToken","type":"address"},{"internalType":"uint256","name":"allocPoint","type":"uint256"},{"internalType":"uint256","name":"lastRewardBlock","type":"uint256"},{"internalType":"uint256","name":"accProtonPerShare","type":"uint256"},{"internalType":"uint256","name":"depositFeeBP","type":"uint256"},{"internalType":"uint256","name":"harvestInterval","type":"uint256"},{"internalType":"bool","name":"isElectronRewards","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"massUpdatePools","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"pendingProton","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":"lpSupply","type":"uint256"},{"internalType":"uint256","name":"allocPoint","type":"uint256"},{"internalType":"uint256","name":"lastRewardBlock","type":"uint256"},{"internalType":"uint256","name":"accProtonPerShare","type":"uint256"},{"internalType":"uint16","name":"depositFeeBP","type":"uint16"},{"internalType":"uint256","name":"harvestInterval","type":"uint256"},{"internalType":"bool","name":"isElectronRewards","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proton","outputs":[{"internalType":"contract ProtonToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protonPerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_allocPoint","type":"uint256"},{"internalType":"uint16","name":"_depositFeeBP","type":"uint16"},{"internalType":"uint256","name":"_harvestInterval","type":"uint256"},{"internalType":"bool","name":"_isElectronRewards","type":"bool"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_devAddress","type":"address"}],"name":"setDevAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeAddress","type":"address"}],"name":"setFeeAddress","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":"totalLockedUpRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_protonPerBlock","type":"uint256"}],"name":"updateEmissionRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"updatePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"rewardDebt","type":"uint256"},{"internalType":"uint256","name":"rewardLockedUp","type":"uint256"},{"internalType":"uint256","name":"nextHarvestUntil","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"}]

608060405260006009553480156200001657600080fd5b50604051620030e2380380620030e2833981810160405260c08110156200003c57600080fd5b508051602082015160408301516060840151608085015160a090950151939492939192909160006200006d6200011a565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a35060018055600280546001600160a01b039788166001600160a01b0319918216179091556003805496881696821696909617909555600a9390935560069190915560048054918516918416919091179055600580549190931691161790556200011e565b3390565b612fb4806200012e6000396000f3fe608060405234801561001057600080fd5b50600436106101f05760003560e01c8063715018a61161010f5780639d4610c8116100a2578063e2bbb15811610071578063e2bbb158146105ce578063ef5dd0d9146105f1578063f2fde38b1461062a578063fccc28131461065d576101f0565b80639d4610c81461053a578063af018de814610542578063d0d41fe114610593578063de73149d146105c6576101f0565b80638aa28550116100de5780638aa28550146104a85780638da5cb5b146104b05780638dbb1e3a146104b857806393f1a40b146104db576101f0565b8063715018a61461045d5780637fc3693e1461046557806382d283981461046d5780638705fcd414610475576101f0565b8063412753581161018757806351eb05a61161015657806351eb05a6146104135780635312ea8e146104305780635d8496bf1461044d578063630b5ba114610455576101f0565b806341275358146103d8578063441a3e70146103e0578063474fa6301461040357806348cd4cb11461040b576101f0565b80632143e545116101c35780632143e545146102b15780632e6c998d146102ec5780632f380b35146103395780633ad10ef6146103a7576101f0565b8063081e3eda146101f55780630ba84cd21461020f5780631526fe271461022e57806317caf6f1146102a9575b600080fd5b6101fd610665565b60408051918252519081900360200190f35b61022c6004803603602081101561022557600080fd5b503561066b565b005b61024b6004803603602081101561024457600080fd5b5035610739565b6040805173ffffffffffffffffffffffffffffffffffffffff90991689526020890197909752878701959095526060870193909352608086019190915261ffff1660a085015260c0840152151560e083015251908190036101000190f35b6101fd6107ab565b61022c600480360360a08110156102c757600080fd5b5080359060208101359061ffff604082013516906060810135906080013515156107b1565b6103256004803603604081101561030257600080fd5b508035906020013573ffffffffffffffffffffffffffffffffffffffff16610a25565b604080519115158252519081900360200190f35b6103566004803603602081101561034f57600080fd5b5035610a62565b6040805173ffffffffffffffffffffffffffffffffffffffff90981688526020880196909652868601949094526060860192909252608085015260a0840152151560c0830152519081900360e00190f35b6103af610b8e565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6103af610baa565b61022c600480360360408110156103f657600080fd5b5080359060200135610bc6565b6101fd610d98565b6101fd610d9e565b61022c6004803603602081101561042957600080fd5b5035610da4565b61022c6004803603602081101561044657600080fd5b50356110f8565b6103af61123e565b61022c61125a565b61022c61127d565b6101fd61137d565b6101fd611383565b61022c6004803603602081101561048b57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611389565b6101fd611502565b6103af611507565b6101fd600480360360408110156104ce57600080fd5b5080359060200135611523565b610514600480360360408110156104f157600080fd5b508035906020013573ffffffffffffffffffffffffffffffffffffffff1661153b565b604080519485526020850193909352838301919091526060830152519081900360800190f35b6103af61156d565b61022c600480360360a081101561055857600080fd5b5080359073ffffffffffffffffffffffffffffffffffffffff6020820135169061ffff60408201351690606081013590608001351515611589565b61022c600480360360208110156105a957600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611940565b6101fd611ab9565b61022c600480360360408110156105e457600080fd5b5080359060200135611ac0565b6101fd6004803603604081101561060757600080fd5b508035906020013573ffffffffffffffffffffffffffffffffffffffff16611e10565b61022c6004803603602081101561064057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611f47565b6103af6120d1565b60075490565b6106736120d7565b60005473ffffffffffffffffffffffffffffffffffffffff9081169116146106fc57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b61070461125a565b6006819055604051819033907fe2492e003bbe8afa53088b406f0c1cb5d9e280370fc72a74cf116ffd343c405390600090a350565b6007818154811061074657fe5b60009182526020909120600890910201805460018201546002830154600384015460048501546005860154600687015460079097015473ffffffffffffffffffffffffffffffffffffffff9096169750939592949193909261ffff9091169160ff1688565b60095481565b6107b96120d7565b60005473ffffffffffffffffffffffffffffffffffffffff90811691161461084257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6102588361ffff1611156108a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612f0d6025913960400191505060405180910390fd5b6212750082111561091357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f7365743a20696e76616c6964206861727665737420696e74657276616c000000604482015290519081900360640190fd5b61091b61125a565b836007868154811061092957fe5b906000526020600020906008020160020181905550826007868154811061094c57fe5b906000526020600020906008020160050160006101000a81548161ffff021916908361ffff160217905550816007868154811061098557fe5b90600052602060002090600802016006018190555080600786815481106109a857fe5b906000526020600020906008020160070160006101000a81548160ff0219169083151502179055506000600786815481106109df57fe5b9060005260206000209060080201600201549050848114610a1d57610a1985610a13836009546120db90919063ffffffff16565b9061211d565b6009555b505050505050565b600082815260086020908152604080832073ffffffffffffffffffffffffffffffffffffffff851684529091529020600301544210155b92915050565b600080600080600080600060078881548110610a7a57fe5b60009182526020909120600890910201546007805473ffffffffffffffffffffffffffffffffffffffff909216918a908110610ab257fe5b90600052602060002090600802016002015460078a81548110610ad157fe5b90600052602060002090600802016003015460078b81548110610af057fe5b90600052602060002090600802016004015460078c81548110610b0f57fe5b906000526020600020906008020160050160009054906101000a900461ffff1660078d81548110610b3c57fe5b90600052602060002090600802016006015460078e81548110610b5b57fe5b6000918252602090912060089091020160070154959e949d50929b5090995061ffff169750955060ff9091169350915050565b60045473ffffffffffffffffffffffffffffffffffffffff1681565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60026001541415610c3857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600181905550600060078381548110610c4f57fe5b6000918252602080832086845260088083526040808620338752909352919093208054929091029092019250831115610cd3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603f815260200180612e62603f913960400191505060405180910390fd5b610cdc84610da4565b610ce584612191565b8215610d31578054610cf790846120db565b81558154610d1c9073ffffffffffffffffffffffffffffffffffffffff163385612328565b6001820154610d2b90846120db565b60018301555b60048201548154610d529164e8d4a5100091610d4c916123ba565b9061242d565b6001820155604080518481529051859133917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5689181900360200190a35050600180555050565b600b5481565b600a5481565b600060078281548110610db357fe5b9060005260206000209060080201905080600301544311610dd457506110f5565b6001810154801580610de857506002820154155b15610dfa5750436003909101556110f5565b6000610e0a836003015443611523565b90506000610e37600954610d4c8660020154610e31600654876123ba90919063ffffffff16565b906123ba565b60025460045491925073ffffffffffffffffffffffffffffffffffffffff908116916340c10f199116610e6b84601461242d565b6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610ebe57600080fd5b505af1158015610ed2573d6000803e3d6000fd5b505060025473ffffffffffffffffffffffffffffffffffffffff1691506340c10f19905030610f0284601461242d565b6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610f5557600080fd5b505af1158015610f69573d6000803e3d6000fd5b50505050610f8c61dead610f8760148461242d90919063ffffffff16565b61246f565b600784015460ff161561102f57600354604080517f40c10f1900000000000000000000000000000000000000000000000000000000815230600482015260248101849052905173ffffffffffffffffffffffffffffffffffffffff909216916340c10f199160448082019260009290919082900301818387803b15801561101257600080fd5b505af1158015611026573d6000803e3d6000fd5b505050506110c1565b600254604080517f40c10f1900000000000000000000000000000000000000000000000000000000815230600482015260248101849052905173ffffffffffffffffffffffffffffffffffffffff909216916340c10f199160448082019260009290919082900301818387803b1580156110a857600080fd5b505af11580156110bc573d6000803e3d6000fd5b505050505b6110e26110d784610d4c8464e8d4a510006123ba565b60048601549061211d565b6004850155505043600390920191909155505b50565b6002600154141561116a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260018190555060006007828154811061118157fe5b60009182526020808320858452600880835260408086203387529093529184208054858255600180830187905560028301879055600383018790559390940290910191820154919450926111d591906120db565b600184015582546111fd9073ffffffffffffffffffffffffffffffffffffffff163383612328565b604080518281529051859133917fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae05959181900360200190a35050600180555050565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b60075460005b818110156112795761127181610da4565b600101611260565b5050565b6112856120d7565b60005473ffffffffffffffffffffffffffffffffffffffff90811691161461130e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b60065481565b61025881565b60055473ffffffffffffffffffffffffffffffffffffffff16331461140f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f736574466565416464726573733a20464f5242494444454e0000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811661149157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f736574466565416464726573733a205a45524f00000000000000000000000000604482015290519081900360640190fd5b600580547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff831690811790915560405133907fca68aa7805c8a17c09111b6be74d77af7df8318186a2c8d6f2743d137c6d282890600090a350565b600181565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b60006115346001610e3184866120db565b9392505050565b600860209081526000928352604080842090915290825290208054600182015460028301546003909301549192909184565b60025473ffffffffffffffffffffffffffffffffffffffff1681565b6115916120d7565b60005473ffffffffffffffffffffffffffffffffffffffff90811691161461161a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6102588361ffff161115611679576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612e176025913960400191505060405180910390fd5b621275008211156116eb57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f6164643a20696e76616c6964206861727665737420696e74657276616c000000604482015290519081900360640190fd5b6116f361125a565b6000600a54431161170657600a54611708565b435b600954909150611718908761211d565b600955604080516101008101825273ffffffffffffffffffffffffffffffffffffffff9687168152600060208201818152928201988952606082019384526080820181815261ffff97881660a0840190815260c0840197885295151560e0840190815260078054600181018255935292517fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c688600890930292830180547fffffffffffffffffffffffff00000000000000000000000000000000000000001691909a161790985591517fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68983015596517fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68a82015590517fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68b82015593517fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68c850155517fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68d840180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000169190931617909155517fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68e82015590517fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68f90910180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b60045473ffffffffffffffffffffffffffffffffffffffff1633146119c657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f736574446576416464726573733a20464f5242494444454e0000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116611a4857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f736574446576416464726573733a205a45524f00000000000000000000000000604482015290519081900360640190fd5b600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff831690811790915560405133907fb59f991d5ecf27b7e9bb0aa68edefcf18a87c293e59e02b96ff6e7335c603e9690600090a350565b6212750081565b60026001541415611b3257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600181905550600060078381548110611b4957fe5b60009182526020808320868452600880835260408086203387529093529190932091029091019150611b7a84610da4565b611b8384612191565b8215611daf578154604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905160009273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611bf957600080fd5b505afa158015611c0d573d6000803e3d6000fd5b505050506040513d6020811015611c2357600080fd5b50518354909150611c4c9073ffffffffffffffffffffffffffffffffffffffff163330876126c8565b8254604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611cf492849273ffffffffffffffffffffffffffffffffffffffff909116916370a0823191602480820192602092909190829003018186803b158015611cc257600080fd5b505afa158015611cd6573d6000803e3d6000fd5b505050506040513d6020811015611cec57600080fd5b5051906120db565b600584015490945061ffff1615611d8a576005830154600090611d249061271090610d4c90889061ffff166123ba565b6005548554919250611d509173ffffffffffffffffffffffffffffffffffffffff908116911683612328565b8254611d68908290611d62908861211d565b906120db565b83556001840154611d7f908290611d62908861211d565b600185015550611dad565b8154611d96908561211d565b82556001830154611da7908561211d565b60018401555b505b60048201548154611dca9164e8d4a5100091610d4c916123ba565b6001820155604080518481529051859133917f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159181900360200190a35050600180555050565b60008060078481548110611e2057fe5b600091825260208083208784526008808352604080862073ffffffffffffffffffffffffffffffffffffffff8a168752909352919093209102909101600481015460018201546003830154929450909143118015611e7d57508015155b15611edd576000611e92856003015443611523565b90506000611eb9600954610d4c8860020154610e31600654876123ba90919063ffffffff16565b9050611ed8611ed184610d4c8464e8d4a510006123ba565b859061211d565b935050505b6000611f078460010154611d6264e8d4a51000610d4c8789600001546123ba90919063ffffffff16565b600786015490915060ff16611f2b57611f286103e8610d4c836103d66123ba565b90505b6002840154611f3b90829061211d565b98975050505050505050565b611f4f6120d7565b60005473ffffffffffffffffffffffffffffffffffffffff908116911614611fd857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116612044576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612e3c6026913960400191505060405180910390fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b61dead81565b3390565b600061153483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061275d565b60008282018381101561153457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000600782815481106121a057fe5b60009182526020808320858452600880835260408086203387529093529190932060038101549290910290920192506121e95760068201546121e390429061211d565b60038201555b60006122178260010154611d6264e8d4a51000610d4c876004015487600001546123ba90919063ffffffff16565b90506122238433610a25565b156122c057600081118061223b575060008260020154115b156122bb57600061225983600201548361211d90919063ffffffff16565b90506122748360020154600b546120db90919063ffffffff16565b600b5560006002840155600684015461228e90429061211d565b6003840155600784015460ff16156122af576122aa338261280e565b6122b9565b6122b9338261246f565b505b612322565b80156123225760028201546122d5908261211d565b6002830155600b546122e7908261211d565b600b55604080518281529051859133917fee470483107f579a55c754fa00613c45a9a3b617a418b39cb0be97e5381ba7c19181900360200190a35b50505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790526123b5908490612a67565b505050565b6000826123c957506000610a5c565b828202828482816123d657fe5b0414611534576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612eec6021913960400191505060405180910390fd5b600061153483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612b3f565b600254604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905160009273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b1580156124e057600080fd5b505afa1580156124f4573d6000803e3d6000fd5b505050506040513d602081101561250a57600080fd5b505190506000818311156125c757600254604080517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152602482018690529151919092169163a9059cbb9160448083019260209291908290030181600087803b15801561259457600080fd5b505af11580156125a8573d6000803e3d6000fd5b505050506040513d60208110156125be57600080fd5b50519050612672565b600254604080517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152602482018790529151919092169163a9059cbb9160448083019260209291908290030181600087803b15801561264357600080fd5b505af1158015612657573d6000803e3d6000fd5b505050506040513d602081101561266d57600080fd5b505190505b80612322576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612f326023913960400191505060405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff80861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052612322908590612a67565b60008184841115612806576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156127cb5781810151838201526020016127b3565b50505050905090810190601f1680156127f85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600354604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905160009273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b15801561287f57600080fd5b505afa158015612893573d6000803e3d6000fd5b505050506040513d60208110156128a957600080fd5b5051905060008183111561296657600354604080517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152602482018690529151919092169163a9059cbb9160448083019260209291908290030181600087803b15801561293357600080fd5b505af1158015612947573d6000803e3d6000fd5b505050506040513d602081101561295d57600080fd5b50519050612a11565b600354604080517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152602482018790529151919092169163a9059cbb9160448083019260209291908290030181600087803b1580156129e257600080fd5b505af11580156129f6573d6000803e3d6000fd5b505050506040513d6020811015612a0c57600080fd5b505190505b80612322576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ec76025913960400191505060405180910390fd5b6060612ac9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612bbe9092919063ffffffff16565b8051909150156123b557808060200190516020811015612ae857600080fd5b50516123b5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180612f55602a913960400191505060405180910390fd5b60008183612ba8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526020600482018181528351602484015283519092839260449091019190850190808383600083156127cb5781810151838201526020016127b3565b506000838581612bb457fe5b0495945050505050565b6060612bcd8484600085612bd5565b949350505050565b606082471015612c30576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612ea16026913960400191505060405180910390fd5b612c3985612d90565b612ca457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600060608673ffffffffffffffffffffffffffffffffffffffff1685876040518082805190602001908083835b60208310612d0e57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101612cd1565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612d70576040519150601f19603f3d011682016040523d82523d6000602084013e612d75565b606091505b5091509150612d85828286612d96565b979650505050505050565b3b151590565b60608315612da5575081611534565b825115612db55782518084602001fd5b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526020600482018181528451602484015284518593919283926044019190850190808383600083156127cb5781810151838201526020016127b356fe6164643a20696e76616c6964206465706f7369742066656520626173697320706f696e74734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737377697468647261773a207573657220616d6f756e74207374616b6564206973206c6f776572207468616e207468652072657175657374656420616d6f756e74416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c73616665456c656374726f6e5472616e736665723a205472616e73666572206661696c6564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f777365743a20696e76616c6964206465706f7369742066656520626173697320706f696e74737361666550726f746f6e5472616e736665723a205472616e73666572206661696c65645361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a264697066735822122092ecac07a6556d8b42478a3217611d411f1edef08d94c58978c8516a27e74d1764736f6c634300060c0033000000000000000000000000673e064ecb5889ef163ec3c3ea693b8f74bbc95d00000000000000000000000022d5df224348321b65dcb14ff2bed72d4b6e56340000000000000000000000000000000000000000000000000000000001290cec0000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000a89ce2ef5c04ae6196e5db6210c1db802918201e000000000000000000000000649d3eaea71be129b33308f866298a0d00876245

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101f05760003560e01c8063715018a61161010f5780639d4610c8116100a2578063e2bbb15811610071578063e2bbb158146105ce578063ef5dd0d9146105f1578063f2fde38b1461062a578063fccc28131461065d576101f0565b80639d4610c81461053a578063af018de814610542578063d0d41fe114610593578063de73149d146105c6576101f0565b80638aa28550116100de5780638aa28550146104a85780638da5cb5b146104b05780638dbb1e3a146104b857806393f1a40b146104db576101f0565b8063715018a61461045d5780637fc3693e1461046557806382d283981461046d5780638705fcd414610475576101f0565b8063412753581161018757806351eb05a61161015657806351eb05a6146104135780635312ea8e146104305780635d8496bf1461044d578063630b5ba114610455576101f0565b806341275358146103d8578063441a3e70146103e0578063474fa6301461040357806348cd4cb11461040b576101f0565b80632143e545116101c35780632143e545146102b15780632e6c998d146102ec5780632f380b35146103395780633ad10ef6146103a7576101f0565b8063081e3eda146101f55780630ba84cd21461020f5780631526fe271461022e57806317caf6f1146102a9575b600080fd5b6101fd610665565b60408051918252519081900360200190f35b61022c6004803603602081101561022557600080fd5b503561066b565b005b61024b6004803603602081101561024457600080fd5b5035610739565b6040805173ffffffffffffffffffffffffffffffffffffffff90991689526020890197909752878701959095526060870193909352608086019190915261ffff1660a085015260c0840152151560e083015251908190036101000190f35b6101fd6107ab565b61022c600480360360a08110156102c757600080fd5b5080359060208101359061ffff604082013516906060810135906080013515156107b1565b6103256004803603604081101561030257600080fd5b508035906020013573ffffffffffffffffffffffffffffffffffffffff16610a25565b604080519115158252519081900360200190f35b6103566004803603602081101561034f57600080fd5b5035610a62565b6040805173ffffffffffffffffffffffffffffffffffffffff90981688526020880196909652868601949094526060860192909252608085015260a0840152151560c0830152519081900360e00190f35b6103af610b8e565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6103af610baa565b61022c600480360360408110156103f657600080fd5b5080359060200135610bc6565b6101fd610d98565b6101fd610d9e565b61022c6004803603602081101561042957600080fd5b5035610da4565b61022c6004803603602081101561044657600080fd5b50356110f8565b6103af61123e565b61022c61125a565b61022c61127d565b6101fd61137d565b6101fd611383565b61022c6004803603602081101561048b57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611389565b6101fd611502565b6103af611507565b6101fd600480360360408110156104ce57600080fd5b5080359060200135611523565b610514600480360360408110156104f157600080fd5b508035906020013573ffffffffffffffffffffffffffffffffffffffff1661153b565b604080519485526020850193909352838301919091526060830152519081900360800190f35b6103af61156d565b61022c600480360360a081101561055857600080fd5b5080359073ffffffffffffffffffffffffffffffffffffffff6020820135169061ffff60408201351690606081013590608001351515611589565b61022c600480360360208110156105a957600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611940565b6101fd611ab9565b61022c600480360360408110156105e457600080fd5b5080359060200135611ac0565b6101fd6004803603604081101561060757600080fd5b508035906020013573ffffffffffffffffffffffffffffffffffffffff16611e10565b61022c6004803603602081101561064057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611f47565b6103af6120d1565b60075490565b6106736120d7565b60005473ffffffffffffffffffffffffffffffffffffffff9081169116146106fc57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b61070461125a565b6006819055604051819033907fe2492e003bbe8afa53088b406f0c1cb5d9e280370fc72a74cf116ffd343c405390600090a350565b6007818154811061074657fe5b60009182526020909120600890910201805460018201546002830154600384015460048501546005860154600687015460079097015473ffffffffffffffffffffffffffffffffffffffff9096169750939592949193909261ffff9091169160ff1688565b60095481565b6107b96120d7565b60005473ffffffffffffffffffffffffffffffffffffffff90811691161461084257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6102588361ffff1611156108a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612f0d6025913960400191505060405180910390fd5b6212750082111561091357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f7365743a20696e76616c6964206861727665737420696e74657276616c000000604482015290519081900360640190fd5b61091b61125a565b836007868154811061092957fe5b906000526020600020906008020160020181905550826007868154811061094c57fe5b906000526020600020906008020160050160006101000a81548161ffff021916908361ffff160217905550816007868154811061098557fe5b90600052602060002090600802016006018190555080600786815481106109a857fe5b906000526020600020906008020160070160006101000a81548160ff0219169083151502179055506000600786815481106109df57fe5b9060005260206000209060080201600201549050848114610a1d57610a1985610a13836009546120db90919063ffffffff16565b9061211d565b6009555b505050505050565b600082815260086020908152604080832073ffffffffffffffffffffffffffffffffffffffff851684529091529020600301544210155b92915050565b600080600080600080600060078881548110610a7a57fe5b60009182526020909120600890910201546007805473ffffffffffffffffffffffffffffffffffffffff909216918a908110610ab257fe5b90600052602060002090600802016002015460078a81548110610ad157fe5b90600052602060002090600802016003015460078b81548110610af057fe5b90600052602060002090600802016004015460078c81548110610b0f57fe5b906000526020600020906008020160050160009054906101000a900461ffff1660078d81548110610b3c57fe5b90600052602060002090600802016006015460078e81548110610b5b57fe5b6000918252602090912060089091020160070154959e949d50929b5090995061ffff169750955060ff9091169350915050565b60045473ffffffffffffffffffffffffffffffffffffffff1681565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60026001541415610c3857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600181905550600060078381548110610c4f57fe5b6000918252602080832086845260088083526040808620338752909352919093208054929091029092019250831115610cd3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603f815260200180612e62603f913960400191505060405180910390fd5b610cdc84610da4565b610ce584612191565b8215610d31578054610cf790846120db565b81558154610d1c9073ffffffffffffffffffffffffffffffffffffffff163385612328565b6001820154610d2b90846120db565b60018301555b60048201548154610d529164e8d4a5100091610d4c916123ba565b9061242d565b6001820155604080518481529051859133917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5689181900360200190a35050600180555050565b600b5481565b600a5481565b600060078281548110610db357fe5b9060005260206000209060080201905080600301544311610dd457506110f5565b6001810154801580610de857506002820154155b15610dfa5750436003909101556110f5565b6000610e0a836003015443611523565b90506000610e37600954610d4c8660020154610e31600654876123ba90919063ffffffff16565b906123ba565b60025460045491925073ffffffffffffffffffffffffffffffffffffffff908116916340c10f199116610e6b84601461242d565b6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610ebe57600080fd5b505af1158015610ed2573d6000803e3d6000fd5b505060025473ffffffffffffffffffffffffffffffffffffffff1691506340c10f19905030610f0284601461242d565b6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610f5557600080fd5b505af1158015610f69573d6000803e3d6000fd5b50505050610f8c61dead610f8760148461242d90919063ffffffff16565b61246f565b600784015460ff161561102f57600354604080517f40c10f1900000000000000000000000000000000000000000000000000000000815230600482015260248101849052905173ffffffffffffffffffffffffffffffffffffffff909216916340c10f199160448082019260009290919082900301818387803b15801561101257600080fd5b505af1158015611026573d6000803e3d6000fd5b505050506110c1565b600254604080517f40c10f1900000000000000000000000000000000000000000000000000000000815230600482015260248101849052905173ffffffffffffffffffffffffffffffffffffffff909216916340c10f199160448082019260009290919082900301818387803b1580156110a857600080fd5b505af11580156110bc573d6000803e3d6000fd5b505050505b6110e26110d784610d4c8464e8d4a510006123ba565b60048601549061211d565b6004850155505043600390920191909155505b50565b6002600154141561116a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260018190555060006007828154811061118157fe5b60009182526020808320858452600880835260408086203387529093529184208054858255600180830187905560028301879055600383018790559390940290910191820154919450926111d591906120db565b600184015582546111fd9073ffffffffffffffffffffffffffffffffffffffff163383612328565b604080518281529051859133917fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae05959181900360200190a35050600180555050565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b60075460005b818110156112795761127181610da4565b600101611260565b5050565b6112856120d7565b60005473ffffffffffffffffffffffffffffffffffffffff90811691161461130e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b60065481565b61025881565b60055473ffffffffffffffffffffffffffffffffffffffff16331461140f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f736574466565416464726573733a20464f5242494444454e0000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811661149157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f736574466565416464726573733a205a45524f00000000000000000000000000604482015290519081900360640190fd5b600580547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff831690811790915560405133907fca68aa7805c8a17c09111b6be74d77af7df8318186a2c8d6f2743d137c6d282890600090a350565b600181565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b60006115346001610e3184866120db565b9392505050565b600860209081526000928352604080842090915290825290208054600182015460028301546003909301549192909184565b60025473ffffffffffffffffffffffffffffffffffffffff1681565b6115916120d7565b60005473ffffffffffffffffffffffffffffffffffffffff90811691161461161a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6102588361ffff161115611679576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612e176025913960400191505060405180910390fd5b621275008211156116eb57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f6164643a20696e76616c6964206861727665737420696e74657276616c000000604482015290519081900360640190fd5b6116f361125a565b6000600a54431161170657600a54611708565b435b600954909150611718908761211d565b600955604080516101008101825273ffffffffffffffffffffffffffffffffffffffff9687168152600060208201818152928201988952606082019384526080820181815261ffff97881660a0840190815260c0840197885295151560e0840190815260078054600181018255935292517fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c688600890930292830180547fffffffffffffffffffffffff00000000000000000000000000000000000000001691909a161790985591517fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68983015596517fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68a82015590517fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68b82015593517fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68c850155517fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68d840180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000169190931617909155517fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68e82015590517fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68f90910180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b60045473ffffffffffffffffffffffffffffffffffffffff1633146119c657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f736574446576416464726573733a20464f5242494444454e0000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116611a4857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f736574446576416464726573733a205a45524f00000000000000000000000000604482015290519081900360640190fd5b600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff831690811790915560405133907fb59f991d5ecf27b7e9bb0aa68edefcf18a87c293e59e02b96ff6e7335c603e9690600090a350565b6212750081565b60026001541415611b3257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600181905550600060078381548110611b4957fe5b60009182526020808320868452600880835260408086203387529093529190932091029091019150611b7a84610da4565b611b8384612191565b8215611daf578154604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905160009273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611bf957600080fd5b505afa158015611c0d573d6000803e3d6000fd5b505050506040513d6020811015611c2357600080fd5b50518354909150611c4c9073ffffffffffffffffffffffffffffffffffffffff163330876126c8565b8254604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611cf492849273ffffffffffffffffffffffffffffffffffffffff909116916370a0823191602480820192602092909190829003018186803b158015611cc257600080fd5b505afa158015611cd6573d6000803e3d6000fd5b505050506040513d6020811015611cec57600080fd5b5051906120db565b600584015490945061ffff1615611d8a576005830154600090611d249061271090610d4c90889061ffff166123ba565b6005548554919250611d509173ffffffffffffffffffffffffffffffffffffffff908116911683612328565b8254611d68908290611d62908861211d565b906120db565b83556001840154611d7f908290611d62908861211d565b600185015550611dad565b8154611d96908561211d565b82556001830154611da7908561211d565b60018401555b505b60048201548154611dca9164e8d4a5100091610d4c916123ba565b6001820155604080518481529051859133917f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159181900360200190a35050600180555050565b60008060078481548110611e2057fe5b600091825260208083208784526008808352604080862073ffffffffffffffffffffffffffffffffffffffff8a168752909352919093209102909101600481015460018201546003830154929450909143118015611e7d57508015155b15611edd576000611e92856003015443611523565b90506000611eb9600954610d4c8860020154610e31600654876123ba90919063ffffffff16565b9050611ed8611ed184610d4c8464e8d4a510006123ba565b859061211d565b935050505b6000611f078460010154611d6264e8d4a51000610d4c8789600001546123ba90919063ffffffff16565b600786015490915060ff16611f2b57611f286103e8610d4c836103d66123ba565b90505b6002840154611f3b90829061211d565b98975050505050505050565b611f4f6120d7565b60005473ffffffffffffffffffffffffffffffffffffffff908116911614611fd857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116612044576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612e3c6026913960400191505060405180910390fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b61dead81565b3390565b600061153483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061275d565b60008282018381101561153457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000600782815481106121a057fe5b60009182526020808320858452600880835260408086203387529093529190932060038101549290910290920192506121e95760068201546121e390429061211d565b60038201555b60006122178260010154611d6264e8d4a51000610d4c876004015487600001546123ba90919063ffffffff16565b90506122238433610a25565b156122c057600081118061223b575060008260020154115b156122bb57600061225983600201548361211d90919063ffffffff16565b90506122748360020154600b546120db90919063ffffffff16565b600b5560006002840155600684015461228e90429061211d565b6003840155600784015460ff16156122af576122aa338261280e565b6122b9565b6122b9338261246f565b505b612322565b80156123225760028201546122d5908261211d565b6002830155600b546122e7908261211d565b600b55604080518281529051859133917fee470483107f579a55c754fa00613c45a9a3b617a418b39cb0be97e5381ba7c19181900360200190a35b50505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790526123b5908490612a67565b505050565b6000826123c957506000610a5c565b828202828482816123d657fe5b0414611534576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612eec6021913960400191505060405180910390fd5b600061153483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612b3f565b600254604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905160009273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b1580156124e057600080fd5b505afa1580156124f4573d6000803e3d6000fd5b505050506040513d602081101561250a57600080fd5b505190506000818311156125c757600254604080517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152602482018690529151919092169163a9059cbb9160448083019260209291908290030181600087803b15801561259457600080fd5b505af11580156125a8573d6000803e3d6000fd5b505050506040513d60208110156125be57600080fd5b50519050612672565b600254604080517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152602482018790529151919092169163a9059cbb9160448083019260209291908290030181600087803b15801561264357600080fd5b505af1158015612657573d6000803e3d6000fd5b505050506040513d602081101561266d57600080fd5b505190505b80612322576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612f326023913960400191505060405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff80861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052612322908590612a67565b60008184841115612806576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156127cb5781810151838201526020016127b3565b50505050905090810190601f1680156127f85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600354604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905160009273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b15801561287f57600080fd5b505afa158015612893573d6000803e3d6000fd5b505050506040513d60208110156128a957600080fd5b5051905060008183111561296657600354604080517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152602482018690529151919092169163a9059cbb9160448083019260209291908290030181600087803b15801561293357600080fd5b505af1158015612947573d6000803e3d6000fd5b505050506040513d602081101561295d57600080fd5b50519050612a11565b600354604080517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152602482018790529151919092169163a9059cbb9160448083019260209291908290030181600087803b1580156129e257600080fd5b505af11580156129f6573d6000803e3d6000fd5b505050506040513d6020811015612a0c57600080fd5b505190505b80612322576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ec76025913960400191505060405180910390fd5b6060612ac9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612bbe9092919063ffffffff16565b8051909150156123b557808060200190516020811015612ae857600080fd5b50516123b5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180612f55602a913960400191505060405180910390fd5b60008183612ba8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526020600482018181528351602484015283519092839260449091019190850190808383600083156127cb5781810151838201526020016127b3565b506000838581612bb457fe5b0495945050505050565b6060612bcd8484600085612bd5565b949350505050565b606082471015612c30576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612ea16026913960400191505060405180910390fd5b612c3985612d90565b612ca457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600060608673ffffffffffffffffffffffffffffffffffffffff1685876040518082805190602001908083835b60208310612d0e57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101612cd1565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612d70576040519150601f19603f3d011682016040523d82523d6000602084013e612d75565b606091505b5091509150612d85828286612d96565b979650505050505050565b3b151590565b60608315612da5575081611534565b825115612db55782518084602001fd5b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526020600482018181528451602484015284518593919283926044019190850190808383600083156127cb5781810151838201526020016127b356fe6164643a20696e76616c6964206465706f7369742066656520626173697320706f696e74734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737377697468647261773a207573657220616d6f756e74207374616b6564206973206c6f776572207468616e207468652072657175657374656420616d6f756e74416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c73616665456c656374726f6e5472616e736665723a205472616e73666572206661696c6564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f777365743a20696e76616c6964206465706f7369742066656520626173697320706f696e74737361666550726f746f6e5472616e736665723a205472616e73666572206661696c65645361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a264697066735822122092ecac07a6556d8b42478a3217611d411f1edef08d94c58978c8516a27e74d1764736f6c634300060c0033

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

000000000000000000000000673e064ecb5889ef163ec3c3ea693b8f74bbc95d00000000000000000000000022d5df224348321b65dcb14ff2bed72d4b6e56340000000000000000000000000000000000000000000000000000000001290cec0000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000a89ce2ef5c04ae6196e5db6210c1db802918201e000000000000000000000000649d3eaea71be129b33308f866298a0d00876245

-----Decoded View---------------
Arg [0] : _proton (address): 0x673e064eCb5889Ef163ec3C3eA693b8f74BBC95D
Arg [1] : _electron (address): 0x22D5dF224348321B65DCb14ff2bED72d4B6e5634
Arg [2] : _startBlock (uint256): 19467500
Arg [3] : _protonPerBlock (uint256): 1000000000000000000
Arg [4] : _devaddr (address): 0xa89Ce2ef5c04ae6196e5dB6210C1Db802918201e
Arg [5] : _feeAddress (address): 0x649D3eAea71be129B33308f866298A0D00876245

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 000000000000000000000000673e064ecb5889ef163ec3c3ea693b8f74bbc95d
Arg [1] : 00000000000000000000000022d5df224348321b65dcb14ff2bed72d4b6e5634
Arg [2] : 0000000000000000000000000000000000000000000000000000000001290cec
Arg [3] : 0000000000000000000000000000000000000000000000000de0b6b3a7640000
Arg [4] : 000000000000000000000000a89ce2ef5c04ae6196e5db6210c1db802918201e
Arg [5] : 000000000000000000000000649d3eaea71be129b33308f866298a0d00876245


Block Transaction Gas Used Reward
view all blocks produced

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

Validator Index Block Amount
View All Withdrawals

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