Token Mensa

 

Overview ERC-20

Price
$0.00 @ 0.000000 FTM
Fully Diluted Market Cap
Total Supply:
3,179,073.301093 MSA

Holders:
704 addresses

Transfers:
-

Contract:
0x540d9ef5cd2d5F03694F85Aece84132C8F2220A40x540d9ef5cd2d5F03694F85Aece84132C8F2220A4

Decimals:
18

Social Profiles:
Not Available, Update ?

Loading
[ Download CSV Export  ] 
Loading
[ Download CSV Export  ] 
Loading

Click here to update the token ICO / general information
# Exchange Pair Price  24H Volume % Volume
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
MensaMinter

Compiler Version
v0.5.17+commit.d19bba13

Optimization Enabled:
Yes with 1 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 10 : IMensaAddressesProvider.sol
pragma solidity ^0.5.0;

/**
@title IMensaAddressesProvider interface
@notice provides the interface to fetch the MensaCore address
 */

contract IMensaAddressesProvider {

    function getMensa() public view returns (address);
    function setMensaImpl(address _pool) public;

    function getMensaCore() public view returns (address payable);
    function setMensaCoreImpl(address _mensaCore) public;

    function getMensaConfigurator() public view returns (address);
    function setMensaConfiguratorImpl(address _configurator) public;

    function getMensaDataProvider() public view returns (address);
    function setMensaDataProviderImpl(address _provider) public;

    function getMensaParametersProvider() public view returns (address);
    function setMensaParametersProviderImpl(address _parametersProvider) public;

    function getTokenDistributor() public view returns (address);
    function setTokenDistributor(address _tokenDistributor) public;


    function getFeeProvider() public view returns (address);
    function setFeeProviderImpl(address _feeProvider) public;

    function getMensaLiquidationManager() public view returns (address);
    function setMensaLiquidationManager(address _manager) public;

    function getMensaManager() public view returns (address);
    function setMensaManager(address _mensaManager) public;

    function getPriceOracle() public view returns (address);
    function setPriceOracle(address _priceOracle) public;

    function getInterestRateOracle() public view returns (address);
    function setInterestRateOracle(address _interestRateOracle) public;

}

File 2 of 10 : IMensaMinter.sol
pragma solidity ^0.5.0;
interface IMensaMinter {
    function mintMensaToken(address reserve, address _user,  uint256 _gid, uint256 _amount, uint256 reserveDEC, uint256 _price) external; 
    function withdrawMensaToken(address _reserve, address _user, uint256 _gid, uint256 amount, uint256 dec, bool unlockedOnly) external; 
}

File 3 of 10 : MensaMinter.sol
pragma solidity ^0.5.0;

import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";

import "../interfaces/IMensaAddressesProvider.sol";
import "../interfaces/IMensaMinter.sol";
import "./MensaToken.sol";

contract MensaMinter is MensaToken, IMensaMinter, Ownable {
    using SafeMath for uint256;
    bool private locked;

    modifier noReentrancy() {
        require(
            !locked,
            "Reentrant call."
        );
        locked = true;
        _;
        locked = false;
    }

    event CreatePool(address indexed user, uint256 indexed pid, uint256 poolCap, uint256 startBlock, uint256 endBlock);
    event SetGroup(address indexed user, uint256 indexed pid, uint256 gid, uint256 allocPoint);
    event PoolActive(address indexed user, uint256 indexed pid);
    event MintDeposit(address indexed user, uint256 indexed pid, uint256 gid, uint256 amount, uint256 total);
    event MintWithdraw(address indexed user, uint256 indexed pid, uint256 gid, uint256 amount, uint256 total, uint256 received, uint256 fine);

    uint256 private _alloced = 0;
    
    uint liquidityPool = 3;
    uint constPoolCount = 4;

    uint256 depositWithdraw = 1;
    uint256 borrowRepay = 2;
    uint256 timeLock;

    uint256 protectDurationBlocks = 2356360; 
    //12000000 * 1% to mutisig account
    uint256 public distributorCAP = 11550000e18; 

    PoolInfo[] private poolInfo;    
    mapping(uint256 => uint256[]) private idxGroups;
    IMensaAddressesProvider ap;
    address private lp;
    address private distributor;

    mapping(uint256 => bool) private constPoolIsInit;
    struct stakeInfo {
        uint256 amount; 
        uint256 AVP; 
    }
    struct mintLocalVar {
        uint256 poolStartBlock;
        uint256 poolEndBlock;
        uint256 groupTotalAmount;
        uint256 groupAccPerShare;
        uint256 groupPricePerStake;
        uint256 userAmount;
        uint256 userProtectAmount;
        uint256 userPDA;
        uint256 userReceivedPerStake;
        uint256 userMintPending;
        uint256 userProtectMintPending;
    }
    constructor(address addressAp) public MensaToken("Mensa", "MSA") {
        ap = IMensaAddressesProvider(addressAp);
        mint(msg.sender, 2000000e18);
        timeLock = block.number.add(protectDurationBlocks);
    }
    function setLp(address addressLP) public noReentrancy onlyOwner {
        lp = addressLP;
    }

    function setDistributor(address addressDistributor) public noReentrancy onlyOwner {
        require(block.number<timeLock, "Age out, setDistributor failed.");
        distributor = addressDistributor;
    }

    function distribute(uint256 amount) public noReentrancy onlyOwner {
        require(amount<distributorCAP, "exceed distributor CAP.");
        require(distributor != address(0),"distributor not init");
        mint(distributor, amount);
        distributorCAP = distributorCAP.sub(amount);
    }

    function mint(address _to, uint256 _amount) internal {
        MensaTokenMint(_to, _amount);
    }

    modifier onlyMensa {
        require(ap.getMensa() == msg.sender, "MensaToken: the caller must be mensa contract");
	_;
    }

    struct UserInfo {
        uint256 amount;
        uint256 lastWithdrawBlock;
        uint256 rewardDebt;
        uint256 protectAmount;
        uint256 mintPending;
        uint256 protectMintPending;
        uint256 receivedPerStake;
        uint256 PDA;
    }

    struct Group {
        uint256 allocPoint;
        uint256 totalAmount;  
        uint256 accPerShare;
        uint256 pricePerStake;
        mapping (address => UserInfo) users;
        mapping(address => mapping(address=>stakeInfo)) userStakeInfo;
    }

    struct PoolInfo {
        uint256 poolCap;
        uint256 totalAllocPoint;
        uint256 startBlock;
        uint256 endBlock;
        uint256 bonusPerBlock;
        uint256 lockedTotal;
        bool ageout;
        mapping (uint256 =>Group) groups;
    }

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

    function createPool(uint256 _pid, uint256 _poolCap, uint256 _startBlock, uint256 _endBlock) public noReentrancy onlyOwner {
        require(_pid == poolLength(), "createPool: _pid fault");
        require(block.number < _endBlock && _endBlock > _startBlock , "createPool: Invailed block parameters");
        _poolCap = _poolCap.mul(1e18);
        require(_poolCap > 0, "createPool: cap fault");

        _alloced = _alloced.add(_poolCap);
        uint256 startBlock = block.number > _startBlock ? block.number : _startBlock;

        require(_endBlock > startBlock , "createPool: Invailed block parameters 2");
        uint256 _bonusPerBlock = _poolCap.div(_endBlock.sub(startBlock));

        poolInfo.push(PoolInfo({
        poolCap: _poolCap,
        totalAllocPoint: 0,
        startBlock: startBlock,
        endBlock: _endBlock,
        bonusPerBlock: _bonusPerBlock,
        lockedTotal: 0,
        ageout: false
        }));
        emit CreatePool(msg.sender, _pid, _poolCap, _startBlock, _endBlock);
    }

    function setGroup(uint256 _pid, uint256 _gid, uint256 _allocPoint) public noReentrancy onlyOwner {
        require(_pid < poolLength(), "setGroup: _pid fault");
        require(constPoolIsInit[_pid] == false, "init failed");
        if (poolInfo[_pid].groups[_gid].allocPoint == 0){
            idxGroups[_pid].push(_gid);
        }
        poolInfo[_pid].totalAllocPoint = poolInfo[_pid].totalAllocPoint.sub(poolInfo[_pid].groups[_gid].allocPoint).add(_allocPoint);
        poolInfo[_pid].groups[_gid] = Group({
            allocPoint: _allocPoint,
            totalAmount: 0,
            accPerShare: 0,
            pricePerStake: 0
        });
	    massUpdateGroups(_pid);
        emit SetGroup(msg.sender, _pid, _gid, _allocPoint);
    }
    
    function getMultiplier(uint256 _from, uint256 _to, uint256 _start, uint256 _end) internal pure returns (uint256) {
        require(_from <= _to, "Block counting: ");
        require(_start <= _end, "Block counting: ");
        if (_to > _end) {
            _to = _end;
        } 
        if (_from < _start) {
            _from = _start;
        }

        if (_from >= _to) {
            return 0;
        }

        return _to.sub(_from);
    }
 
    function massUpdateGroups(uint256 _pid) internal {
        uint256 length = idxGroups[_pid].length;
        for (uint256 i = 0; i < length; ++i) {
            updateGroup(_pid, idxGroups[_pid][i]);
        }
    }
    
    function calculateMGR(uint256 point, uint256 base) internal pure returns (uint256 mgr) {
        mgr = 1e18;
        mgr = mgr.mul(point).div(base);
        
        uint256 z = mgr.add(1).div(2);
        uint256 y = mgr;
        while(z < y){
          y = z;
          z = mgr.div(z).add(z).div(2);
        }
        mgr = y.mul(75e7);
    }

    function updateUserProtectDuration(address userAddr, UserInfo storage u, uint256 amount, uint256 pending, uint256 poolPrice, bool unlockedOnly) internal returns(uint256 unlocked, uint256 flushCount) {
        if (block.number > u.PDA) {
            u.protectAmount = 0;
            u.protectMintPending = 0;
        }
        {
            uint256 pa = u.protectAmount.add(amount);
            if (pa > 0) {
                u.PDA = u.protectAmount.mul(u.PDA).add(amount.mul(block.number.add(protectDurationBlocks))).div(pa);
            }
        }
        u.lastWithdrawBlock = block.number;
        u.mintPending = u.mintPending.add(pending);
        if (u.protectAmount != 0) {
            u.protectMintPending = u.protectMintPending.add(pending.mul(u.protectAmount).div(u.amount));
        }
        u.amount = u.amount.add(amount);
        u.protectAmount = u.protectAmount.add(amount); 		
        if (amount == 0){ //withdraw 
            if (unlockedOnly) { 
                flushCount = u.mintPending.sub(u.protectMintPending).add(poolPrice);
                u.mintPending = u.protectMintPending;
            }else{
                unlocked = u.protectMintPending.mul(30).div(100); 
                flushCount = u.mintPending.sub(unlocked).add(poolPrice); 
                u.mintPending = 0;
                u.protectMintPending = 0;
            }
            if (flushCount > 0) {
                mint(address(this), flushCount);
                this.transfer(userAddr, flushCount);
            }
        }else{
                u.mintPending.add(poolPrice);
        }
    }

    function updateGroup(uint256 _pid, uint256 _gid) internal {
        Group storage group = poolInfo[_pid].groups[_gid];
        uint256 mgr = calculateMGR(group.totalAmount, poolInfo[_pid].poolCap);
        group.accPerShare = poolInfo[_pid].bonusPerBlock.mul(group.allocPoint).div(poolInfo[_pid].totalAllocPoint).mul(mgr).div(1e18);
    }

    function getPoolInfo (uint256 _pid) public view returns (uint256 poolCap,
        uint256 totalAllocPoint,
        uint256 startBlock,
        uint256 endBlock,
        uint256 bonusPerBlock,
        uint256 lockedTotal) {
        PoolInfo memory pool = poolInfo[_pid];
        poolCap = pool.poolCap;
        totalAllocPoint = pool.totalAllocPoint;
        startBlock = pool.startBlock;
        endBlock = pool.endBlock;
        bonusPerBlock = pool.bonusPerBlock;
        lockedTotal = pool.lockedTotal;
    }
    function getGroupInfo(uint256 _pid, uint256 _gid) public view returns (uint256 gp, uint256 groupTotal, uint256 accPerShare){
        gp = poolInfo[_pid].groups[_gid].allocPoint;
        groupTotal = poolInfo[_pid].groups[_gid].totalAmount;
        accPerShare = poolInfo[_pid].groups[_gid].accPerShare;
    }

    function _deposit(uint256 _pid, uint256 _gid, address u, uint256 _amount) internal {
        if (_amount == 0) {
            return;
        }
        PoolInfo storage pool = poolInfo[_pid];
        if (pool.ageout) {
            return;
        }
        if (pool.endBlock < block.number) {
            pool.ageout = true;
            return;
        }
        Group storage group = pool.groups[_gid];
        UserInfo storage user = group.users[u];

        uint256 multiplier = getMultiplier(user.lastWithdrawBlock, block.number, pool.startBlock, pool.endBlock);
        uint256 pending;
        uint256 blackHole;
        uint256 protectPrice; 
        if (group.totalAmount > 0) {
            pending = multiplier.mul(group.accPerShare).mul(user.amount).div(group.totalAmount);
        }
        group.totalAmount = group.totalAmount.add(_amount);
        updateGroup(_pid, _gid);

        (protectPrice, blackHole) = userGainPrice(_pid, _gid, u, _amount, true); 
        updateUserProtectDuration(u, user, _amount, pending, protectPrice, true);
        pool.lockedTotal = pool.lockedTotal.sub(protectPrice).sub(blackHole); 

        emit MintDeposit(u, _pid, _gid, user.amount, group.totalAmount);
    }

    struct WithdrawVar {
        uint256 fine;
        uint256 unlockAmount;
        uint256 flush;
        uint256 multiplier;
        uint256 pending;
        uint256 protectPrice; 
        uint256 blackHole; 
    }

    function _withdraw(uint256 _pid, uint256 _gid, address u, uint256 _amount, bool unlockedOnly) internal {
        WithdrawVar memory vars; 
        PoolInfo storage pool = poolInfo[_pid];
        if (pool.ageout == false && pool.endBlock < block.number) {
            pool.ageout = true;
        }
        Group storage group = pool.groups[_gid];
        UserInfo storage user = group.users[u];
        if (!(group.totalAmount > 0) || user.amount == 0) {
            return;
        }
        require(user.amount >= _amount, "withdraw: not good");
        if (pool.endBlock < block.number){
            user.protectAmount = 0; 
            user.protectMintPending = 0;
        }
        vars.unlockAmount = user.amount.sub(user.protectAmount); 
        require(!(unlockedOnly && vars.unlockAmount<_amount) , "withdraw: unlocked balance not enough");

        vars.multiplier = getMultiplier(user.lastWithdrawBlock, block.number, pool.startBlock, pool.endBlock);
        vars.pending = vars.multiplier.mul(group.accPerShare).mul(user.amount).div(group.totalAmount);
        vars.protectPrice; 
        {
            (vars.protectPrice, vars.blackHole) = userGainPrice(_pid, _gid, u, _amount, false); 
            if (_amount>0 && vars.unlockAmount >= _amount) {
                unlockedOnly = true;
            }
        }
        (vars.fine, vars.flush) = updateUserProtectDuration(u, user, 0, vars.pending, vars.protectPrice, unlockedOnly);
        pool.lockedTotal = pool.lockedTotal.add(vars.fine.div(3).mul(2)).sub(vars.protectPrice).sub(vars.blackHole); 
        user.amount = user.amount.sub(_amount);
        group.totalAmount = group.totalAmount.sub(_amount);
        if (vars.fine > 0) {
            updatePricePerStake(_pid, vars.fine.div(3).mul(2));
            mint(address(0xdead), vars.fine.div(3));
        }

        if (user.protectAmount > user.amount){
            user.protectAmount = user.amount;
        }
        user.rewardDebt = user.rewardDebt.add(vars.pending);
        if (!pool.ageout) {
            updateGroup(_pid, _gid);
        }

        emit MintWithdraw(msg.sender, _pid, _gid, _amount, group.totalAmount, vars.flush, vars.fine);
    }

    function pendingMensa(uint256 _pid, uint256 _gid, address _user) public view returns (uint256 amount, uint256 protectAmount, uint256 protectBlock, uint256 pending, uint256 protectMintPending, uint256 protectPrice, uint256 lockedTotal) {
        mintLocalVar memory vars;
        vars.poolStartBlock = poolInfo[_pid].startBlock;
        vars.poolEndBlock = poolInfo[_pid].endBlock;
        vars.groupTotalAmount = poolInfo[_pid].groups[_gid].totalAmount;
        vars.groupAccPerShare = poolInfo[_pid].groups[_gid].accPerShare;
        vars.groupPricePerStake = poolInfo[_pid].groups[_gid].pricePerStake;
        vars.userReceivedPerStake = poolInfo[_pid].groups[_gid].users[_user].receivedPerStake;
        vars.userAmount = poolInfo[_pid].groups[_gid].users[_user].amount;
        vars.userProtectAmount = poolInfo[_pid].groups[_gid].users[_user].protectAmount;
        vars.userPDA = poolInfo[_pid].groups[_gid].users[_user].PDA;
        vars.userMintPending = poolInfo[_pid].groups[_gid].users[_user].mintPending;
        vars.userProtectMintPending = poolInfo[_pid].groups[_gid].users[_user].protectMintPending;
        if (vars.groupTotalAmount == 0) {
            return (0, 0, 0, 0, 0, 0, 0);
        }
        uint256 multiplier = getMultiplier(poolInfo[_pid].groups[_gid].users[_user].lastWithdrawBlock, block.number, vars.poolStartBlock, vars.poolEndBlock);
        pending = multiplier.mul(vars.groupAccPerShare).mul(vars.userAmount).div(vars.groupTotalAmount).add(vars.userMintPending);

        amount = vars.userAmount;
        protectPrice = vars.userAmount.mul(vars.groupPricePerStake.sub(vars.userReceivedPerStake)).div(1e18); 
        if (block.number < vars.userPDA) {
            protectAmount = poolInfo[_pid].groups[_gid].users[_user].protectAmount;
            protectMintPending = multiplier.mul(vars.groupAccPerShare).mul(vars.userProtectAmount).div(vars.groupTotalAmount).add(vars.userProtectMintPending);
        }
        protectBlock = vars.userPDA;
        lockedTotal = poolInfo[_pid].lockedTotal; 
    }

    function selectPool() internal view returns (uint256){
        for (uint i = constPoolCount; i<poolLength(); i++) {
            if (poolInfo[i].endBlock > block.number) {
                return i;
            }
        }
        return 0;
    }

    function getUserAmount(uint256 _gid, address _user) public view returns (uint256 amount, uint256 pending, uint256 protectPending, uint256 protectPriceTotal, uint256 lockedPriceTotal){
        if (poolLength() <= constPoolCount) {
            return (0, 0, 0, 0, 0);
        }
        if (_gid != depositWithdraw && _gid != borrowRepay) {
            return (0, 0, 0, 0, 0);
        }
        uint256 p;
        uint256 pm;
        uint256 pp;
        uint256 lt;
        for (uint i = liquidityPool; i<poolLength(); i++) {
            amount = amount.add(poolInfo[i].groups[_gid].users[_user].amount);
            (, , , p, pm,pp,lt) = pendingMensa(i, _gid, _user);
            pending = pending.add(p);
            protectPending = protectPending.add(pm);
            protectPriceTotal = protectPriceTotal.add(pp); 
            lockedPriceTotal = lockedPriceTotal.add(lt);
        }
    }

    function _priceRate(PoolInfo memory p, Group memory g, UserInfo memory u) internal view returns (uint256 rate) {
        if (g.totalAmount == 0) {
            return 0;
        }
        uint256 protectAmount = u.protectAmount;
        if (block.number > u.PDA) {
            protectAmount = 0;
        }
        rate = 1e18;
        rate = rate.mul(u.amount.sub(protectAmount)).mul(g.allocPoint).div(p.totalAllocPoint).div(g.totalAmount); 
    }

    function userGainPrice(uint256 _pid, uint256 _gid, address _u, uint256 _amount, bool isDeposit) internal returns (uint256 price, uint256 blackHole) {
        uint256 pricePerStake = poolInfo[_pid].groups[_gid].pricePerStake; 
        UserInfo storage u = poolInfo[_pid].groups[_gid].users[_u]; 
        if (u.receivedPerStake >= pricePerStake) {
            return (0, 0);
        }
        uint256 newAmount;
        uint256 delta;

        if (block.number >= u.PDA) {
            price = u.amount.mul(pricePerStake.sub(u.receivedPerStake)).div(1e18); 
            u.receivedPerStake = pricePerStake; 
        }else{
            if (isDeposit){
                newAmount = u.amount.add(_amount);
                delta = u.amount.mul(pricePerStake.sub(u.receivedPerStake)).div(newAmount); 
                u.receivedPerStake = pricePerStake.sub(delta); 
            }else{
                require(u.amount >= _amount, "Not enough balance to withdraw.");
                blackHole = _amount.mul(pricePerStake.sub(u.receivedPerStake)).div(1e18); 
            }
        }
        return (price, blackHole);  
    }

    function updatePricePerStake(uint256 _pid, uint256 amount) internal {
        uint256 input = amount.mul(1e18);
        uint256 length = idxGroups[_pid].length;
        for (uint256 i = 0; i < length; ++i) {
            updateGroupStake(_pid, idxGroups[_pid][i], input);
        }
    }

    function updateGroupStake(uint256 _pid, uint256 _gid, uint256 amount) internal {
        Group storage group = poolInfo[_pid].groups[_gid];
        if (group.totalAmount > 0) {
            group.pricePerStake = group.pricePerStake.add(amount.mul(group.allocPoint).div(poolInfo[_pid].totalAllocPoint).div(group.totalAmount));
        }
    }

    function mintMensaToken(address _reserve, address _user, uint256 _gid, uint256 _amount, uint256 _reserveDEC, uint256 _price) external noReentrancy onlyMensa {
        if (_amount == 0 || _price == 0) {
            return;
        }

        require(poolLength() >= constPoolCount, "minMensaToken: Invailed pools");
        require(_gid == depositWithdraw || _gid == borrowRepay, "minMensaToken: Invailed action");
        uint256 pid;
        if (_reserve == lp) {
            pid = liquidityPool;
        }else{
            pid = selectPool();
            require(pid >= constPoolCount, "pool init fault");
        }
        stakeInfo storage s = poolInfo[pid].groups[_gid].userStakeInfo[_user][_reserve];
        s.AVP = s.AVP.mul(s.amount).add(_price.mul(_amount)).div(s.amount.add(_amount));
        s.amount = s.amount.add(_amount);
        uint256 workload = _amount.mul(_price).div(_reserveDEC);
        _mintMensaToken(_user, pid, _gid, workload); 
    }

    function getUserReserveAVP(uint256 _pid, uint256 _gid, address _reserve, address _user ) public view returns (uint256 amount, uint256 AVP) {
        amount = poolInfo[_pid].groups[_gid].userStakeInfo[_user][_reserve].amount;
        AVP = poolInfo[_pid].groups[_gid].userStakeInfo[_user][_reserve].AVP;
    }

    function _mintMensaToken(address _user, uint256 _pid, uint256 _gid, uint256 _amount) internal {
        if (_amount == 0) {
            return;
        }
        _deposit(_pid, _gid, _user, _amount); 
    }

    function withdrawMensaToken(address _reserve, address _user, uint256 _gid, uint256 _amount, uint256 _dec,  bool unlockedOnly) external noReentrancy onlyMensa {
        if (_amount == 0) {
            return;
        }
        require(poolLength() > constPoolCount, "minMensaToken: Invailed pools");
        require(_gid == depositWithdraw || _gid == borrowRepay, "minMensaToken: Invailed action");
        uint256 pid;
        if (_reserve == lp) {
            pid = liquidityPool;
        }else{
            pid = selectPool();
            require(pid >= constPoolCount, "pool init fault");
        }
        stakeInfo storage s = poolInfo[pid].groups[_gid].userStakeInfo[_user][_reserve];
        if (s.amount<_amount) {
            _amount = s.amount;
        }
        s.amount = s.amount.sub(_amount);
        uint256 workload = _amount.mul(s.AVP).div(_dec);
        _withdrawMensaToken(_user, pid, _gid, workload, unlockedOnly); 
    }

    function _withdrawMensaToken(address _user, uint256 _pid, uint256 _gid, uint256 _amount, bool unlockedOnly) internal {
        if (_amount == 0) {
            return;
        }
        
        _withdraw(_pid, _gid, _user, _amount, unlockedOnly);
    }

    function _withdrawPendingMensaToken(uint256 _gid, bool unlockedOnly) public {
        require(poolLength() > constPoolCount, "minMensaToken: Invailed pools");
        require(_gid == depositWithdraw || _gid == borrowRepay, "minMensaToken: Invailed action");
        for (uint i = poolLength()-1; i >=  liquidityPool; i--) {
            if (poolInfo[i].groups[_gid].users[msg.sender].lastWithdrawBlock < block.number) {
                _withdraw(i, _gid, msg.sender, 0, unlockedOnly);
            }
        }
    }

    function withdrawPendingMensaToken(bool unlockedOnly) public {
        _withdrawPendingMensaToken(1, unlockedOnly); 
        _withdrawPendingMensaToken(2, unlockedOnly); 
    }

    function setPoolInited(uint256 _pid) public noReentrancy onlyOwner {
        constPoolIsInit[_pid] = true;
        emit PoolActive(msg.sender, _pid);
    }

    function deposit(uint256 _pid, uint256 _gid, address u, uint256 _amount) external noReentrancy onlyOwner {
        require(_pid < liquidityPool, "only for const pool");
        require(constPoolIsInit[_pid] == false, "init failed");
        _deposit(_pid, _gid, u, _amount);
    }

    function withdraw(uint256 _pid, uint256 _gid, address u, uint256 _amount) external noReentrancy onlyOwner {
        require(_pid < liquidityPool, "only for const pool" );
        _withdraw(_pid, _gid, u, _amount, true);
    }

    function userWithdraw(uint256 _pid, uint256 _gid, uint256 _amount) external noReentrancy {
        require(_pid < liquidityPool, "only for const pool" );
        _withdraw(_pid, _gid, msg.sender, _amount, true);
    }
}

File 4 of 10 : MensaToken.sol
pragma solidity ^0.5.0;

import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol";

/**
 * @title Mensa ERC20 MensaToken
 *
 * @dev Implementation of the interest bearing token for the DLP protocol.
 */
contract MensaToken is ERC20, ERC20Detailed {
    uint256 private _cap = 200000000e18;
    uint256 private _supply = 0;
    constructor(
        string memory _name,
        string memory _symbol
    ) public ERC20Detailed(_name, _symbol, 18) {

    }
    function MensaTokenMint(address _to, uint256 _amount) internal {
        require(_supply.add(_amount) <= _cap, "Mensa cap exceeded");
        _supply = _supply.add(_amount);
        _mint(_to, _amount);
    }

    function totalSupply() public view returns (uint256) {
        return _supply;
    }
    function cap() public view returns (uint256) {
        return _cap;
    }
}

File 5 of 10 : Context.sol
pragma solidity ^0.5.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.
 */
contract Context {
    // Empty internal constructor, to prevent people from mistakenly deploying
    // an instance of this contract, which should be used via inheritance.
    constructor () internal { }
    // solhint-disable-previous-line no-empty-blocks

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

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

File 6 of 10 : SafeMath.sol
pragma solidity ^0.5.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.
     *
     * _Available since v2.4.0._
     */
    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.
     *
     * _Available since v2.4.0._
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        // Solidity only automatically asserts when dividing by 0
        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.
     *
     * _Available since v2.4.0._
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

File 7 of 10 : Ownable.sol
pragma solidity ^0.5.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.
 *
 * 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.
 */
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(isOwner(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Returns true if the caller is the current owner.
     */
    function isOwner() public view returns (bool) {
        return _msgSender() == _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 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 onlyOwner {
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     */
    function _transferOwnership(address newOwner) internal {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

File 8 of 10 : ERC20.sol
pragma solidity ^0.5.0;

import "../../GSN/Context.sol";
import "./IERC20.sol";
import "../../math/SafeMath.sol";

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

    mapping (address => uint256) private _balances;

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

    uint256 private _totalSupply;

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

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

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

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

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

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

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

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

    /** @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 != address(0), "ERC20: burn from the zero address");

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

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
     *
     * This 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 9 of 10 : ERC20Detailed.sol
pragma solidity ^0.5.0;

import "./IERC20.sol";

/**
 * @dev Optional functions from the ERC20 standard.
 */
contract ERC20Detailed is IERC20 {
    string private _name;
    string private _symbol;
    uint8 private _decimals;

    /**
     * @dev Sets the values for `name`, `symbol`, and `decimals`. All three of
     * these values are immutable: they can only be set once during
     * construction.
     */
    constructor (string memory name, string memory symbol, uint8 decimals) public {
        _name = name;
        _symbol = symbol;
        _decimals = decimals;
    }

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

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

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

File 10 of 10 : IERC20.sol
pragma solidity ^0.5.0;

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

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

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

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

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"addressAp","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","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":"poolCap","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"startBlock","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"endBlock","type":"uint256"}],"name":"CreatePool","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":"gid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"total","type":"uint256"}],"name":"MintDeposit","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":"gid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"total","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"received","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fine","type":"uint256"}],"name":"MintWithdraw","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"}],"name":"PoolActive","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":"gid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"allocPoint","type":"uint256"}],"name":"SetGroup","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"constant":false,"inputs":[{"internalType":"uint256","name":"_gid","type":"uint256"},{"internalType":"bool","name":"unlockedOnly","type":"bool"}],"name":"_withdrawPendingMensaToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"cap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_poolCap","type":"uint256"},{"internalType":"uint256","name":"_startBlock","type":"uint256"},{"internalType":"uint256","name":"_endBlock","type":"uint256"}],"name":"createPool","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_gid","type":"uint256"},{"internalType":"address","name":"u","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"distribute","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"distributorCAP","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_gid","type":"uint256"}],"name":"getGroupInfo","outputs":[{"internalType":"uint256","name":"gp","type":"uint256"},{"internalType":"uint256","name":"groupTotal","type":"uint256"},{"internalType":"uint256","name":"accPerShare","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"getPoolInfo","outputs":[{"internalType":"uint256","name":"poolCap","type":"uint256"},{"internalType":"uint256","name":"totalAllocPoint","type":"uint256"},{"internalType":"uint256","name":"startBlock","type":"uint256"},{"internalType":"uint256","name":"endBlock","type":"uint256"},{"internalType":"uint256","name":"bonusPerBlock","type":"uint256"},{"internalType":"uint256","name":"lockedTotal","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"_gid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"getUserAmount","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"pending","type":"uint256"},{"internalType":"uint256","name":"protectPending","type":"uint256"},{"internalType":"uint256","name":"protectPriceTotal","type":"uint256"},{"internalType":"uint256","name":"lockedPriceTotal","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_gid","type":"uint256"},{"internalType":"address","name":"_reserve","type":"address"},{"internalType":"address","name":"_user","type":"address"}],"name":"getUserReserveAVP","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"AVP","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_reserve","type":"address"},{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_gid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_reserveDEC","type":"uint256"},{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"mintMensaToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_gid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"pendingMensa","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"protectAmount","type":"uint256"},{"internalType":"uint256","name":"protectBlock","type":"uint256"},{"internalType":"uint256","name":"pending","type":"uint256"},{"internalType":"uint256","name":"protectMintPending","type":"uint256"},{"internalType":"uint256","name":"protectPrice","type":"uint256"},{"internalType":"uint256","name":"lockedTotal","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"poolLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"addressDistributor","type":"address"}],"name":"setDistributor","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_gid","type":"uint256"},{"internalType":"uint256","name":"_allocPoint","type":"uint256"}],"name":"setGroup","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"addressLP","type":"address"}],"name":"setLp","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"setPoolInited","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_gid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"userWithdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_gid","type":"uint256"},{"internalType":"address","name":"u","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_reserve","type":"address"},{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_gid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_dec","type":"uint256"},{"internalType":"bool","name":"unlockedOnly","type":"bool"}],"name":"withdrawMensaToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bool","name":"unlockedOnly","type":"bool"}],"name":"withdrawPendingMensaToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]

60806040526aa56fa5b99019a5c8000000600655600060075560006009556003600a556004600b556001600c556002600d556223f488600f556a098dcec12e255236c000006010553480156200005457600080fd5b50604051620045be380380620045be833981810160405260208110156200007a57600080fd5b505160408051808201825260058152644d656e736160d81b602082810191825283518085019094526003808552624d534160e81b91850191909152825192939284928492601292620000cd9290620003cd565b508151620000e3906004906020850190620003cd565b506005805460ff191660ff9290921691909117905550600092506200010a915050620001b0565b600880546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350601380546001600160a01b0319166001600160a01b0383161790556200018a336a01a784379d99db42000000620001b5565b620001a6600f5443620001ce60201b62002b221790919060201c565b600e55506200046f565b335b90565b620001ca82826001600160e01b036200023016565b5050565b60008282018381101562000229576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b6006546200024f82600754620001ce60201b62002b221790919060201c565b111562000298576040805162461bcd60e51b815260206004820152601260248201527113595b9cd84818d85c08195e18d95959195960721b604482015290519081900360640190fd5b620002b481600754620001ce60201b62002b221790919060201c565b600755620001ca82826001600160e01b03620002cc16565b6001600160a01b03821662000328576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b6200034481600254620001ce60201b62002b221790919060201c565b6002556001600160a01b038216600090815260208181526040909120546200037791839062002b22620001ce821b17901c565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200041057805160ff191683800117855562000440565b8280016001018555821562000440579182015b828111156200044057825182559160200191906001019062000423565b506200044e92915062000452565b5090565b620001b291905b808211156200044e576000815560010162000459565b61413f806200047f6000396000f3fe608060405234801561001057600080fd5b50600436106101ac5760003560e01c806306fdde03146101b1578063081e3eda1461022e578063095ea7b3146102485780631377984f1461028857806318160ddd146102b957806323b872dd146102c15780632f380b35146102f7578063313ce567146103475780633437586b14610365578063355274ea146103bc57806339509351146103c45780633abe7b31146103f05780636cc49eee1461040d57806370a082311461045757806370d976bf1461047d578063715018a61461048557806375619ab51461048d5780637584a02c146104b35780638da5cb5b146105065780638f32d59b1461052a57806391c05b0b1461053257806395d89b411461054f5780639a5c960b14610557578063a00caf271461059f578063a0717ff3146105c4578063a336421814610605578063a3ac81ff1461062e578063a457c2d71461064d578063a9059cbb14610679578063b5dfd153146106a5578063bdd5164e146106dd578063dd62ed3e14610706578063e78f094914610734578063efef97f01461076c578063f2fde38b146107d6578063f4c2baa9146107fc575b600080fd5b6101b9610822565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101f35781810151838201526020016101db565b50505050905090810190601f1680156102205780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102366108b9565b60408051918252519081900360200190f35b6102746004803603604081101561025e57600080fd5b506001600160a01b0381351690602001356108bf565b604080519115158252519081900360200190f35b6102b76004803603608081101561029e57600080fd5b50803590602081013590604081013590606001356108dd565b005b610236610cce565b610274600480360360608110156102d757600080fd5b506001600160a01b03813581169160208101359091169060400135610cd4565b6103146004803603602081101561030d57600080fd5b5035610d61565b604080519687526020870195909552858501939093526060850191909152608084015260a0830152519081900360c00190f35b61034f610e05565b6040805160ff9092168252519081900360200190f35b6103916004803603604081101561037b57600080fd5b50803590602001356001600160a01b0316610e0e565b6040805195865260208601949094528484019290925260608401526080830152519081900360a00190f35b610236610f6c565b610274600480360360408110156103da57600080fd5b506001600160a01b038135169060200135610f72565b6102b76004803603602081101561040657600080fd5b5035610fc6565b6102b7600480360360c081101561042357600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060808101359060a0013515156110c0565b6102366004803603602081101561046d57600080fd5b50356001600160a01b03166113b7565b6102366113d2565b6102b76113d8565b6102b7600480360360208110156104a357600080fd5b50356001600160a01b0316611457565b6104ed600480360360808110156104c957600080fd5b508035906020810135906001600160a01b0360408201358116916060013516611583565b6040805192835260208301919091528051918290030190f35b61050e611634565b604080516001600160a01b039092168252519081900360200190f35b610274611643565b6102b76004803603602081101561054857600080fd5b5035611669565b6101b96117f0565b6102b7600480360360c081101561056d57600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060808101359060a00135611851565b6102b7600480360360408110156105b557600080fd5b50803590602001351515611b67565b6105e7600480360360408110156105da57600080fd5b5080359060200135611c7a565b60408051938452602084019290925282820152519081900360600190f35b6102b76004803603606081101561061b57600080fd5b5080359060208101359060400135611d25565b6102b76004803603602081101561064457600080fd5b50351515611df1565b6102746004803603604081101561066357600080fd5b506001600160a01b038135169060200135611e0a565b6102746004803603604081101561068f57600080fd5b506001600160a01b038135169060200135611e78565b6102b7600480360360808110156106bb57600080fd5b508035906020810135906001600160a01b036040820135169060600135611e8c565b6102b7600480360360608110156106f357600080fd5b5080359060208101359060400135611fa0565b6102366004803603604081101561071c57600080fd5b506001600160a01b0381358116916020013516612295565b6102b76004803603608081101561074a57600080fd5b508035906020810135906001600160a01b0360408201351690606001356122c0565b61079e6004803603606081101561078257600080fd5b50803590602081013590604001356001600160a01b0316612411565b604080519788526020880196909652868601949094526060860192909252608085015260a084015260c0830152519081900360e00190f35b6102b7600480360360208110156107ec57600080fd5b50356001600160a01b03166128ac565b6102b76004803603602081101561081257600080fd5b50356001600160a01b03166128fc565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156108ae5780601f10610883576101008083540402835291602001916108ae565b820191906000526020600020905b81548152906001019060200180831161089157829003601f168201915b505050505090505b90565b60115490565b60006108d36108cc6129d2565b84846129d6565b5060015b92915050565b600854600160a01b900460ff161561092a576040805162461bcd60e51b815260206004820152600f6024820152600080516020614038833981519152604482015290519081900360640190fd5b6008805460ff60a01b1916600160a01b179055610945611643565b610984576040805162461bcd60e51b81526020600482018190526024820152600080516020613ff8833981519152604482015290519081900360640190fd5b61098c6108b9565b84146109d8576040805162461bcd60e51b815260206004820152601660248201527518dc99585d19541bdbdb0e8817dc1a590819985d5b1d60521b604482015290519081900360640190fd5b80431080156109e657508181115b610a215760405162461bcd60e51b8152600401808060200182810382526025815260200180613ef66025913960400191505060405180910390fd5b610a3983670de0b6b3a764000063ffffffff612ac216565b925060008311610a88576040805162461bcd60e51b815260206004820152601560248201527418dc99585d19541bdbdb0e8818d85c0819985d5b1d605a1b604482015290519081900360640190fd5b600954610a9b908463ffffffff612b2216565b6009556000438310610aad5782610aaf565b435b9050808211610aef5760405162461bcd60e51b8152600401808060200182810382526027815260200180613f686027913960400191505060405180910390fd5b6000610b11610b04848463ffffffff612b7a16565b869063ffffffff612bbc16565b6040805160e0810182528781526000602080830182815283850188815260608086018b81526080870189815260a0880187815260c0890188815260118054600181018255995298517f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c6860089099029889015594517f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c6988015592517f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c6a870155517f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c6b86015590517f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c6c85015590517f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c6d84015592517f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c6e909201805460ff19169215159290921790915582518981529081018890528083018790529151929350889233927ffb2ed3c92b01e8c6cc2491dbea8c2c41891db2f7420f2dd81b790e29da6dd15c92908290030190a350506008805460ff60a01b1916905550505050565b60075490565b6000610ce1848484612bfb565b610d5784610ced6129d2565b610d5285604051806060016040528060288152602001613fd0602891396001600160a01b038a16600090815260016020526040812090610d2b6129d2565b6001600160a01b03168152602081019190915260400160002054919063ffffffff612d4516565b6129d6565b5060019392505050565b600080600080600080610d72613d8e565b60118881548110610d7f57fe5b60009182526020918290206040805160e0810182526008909302909101805480845260018201549484018590526002820154928401839052600382015460608501819052600483015460808601819052600584015460a0870181905260069094015460ff16151560c090960195909552909d949c50919a50909850909650945092505050565b60055460ff1690565b6000806000806000600b54610e216108b9565b11610e3a57506000935083925082915081905080610f62565b600c548714158015610e4e5750600d548714155b15610e6757506000935083925082915081905080610f62565b6000806000806000600a5490505b610e7d6108b9565b811015610f5c57610eef60118281548110610e9457fe5b906000526020600020906008020160070160008e815260200190815260200160002060040160008d6001600160a01b03166001600160a01b03168152602001908152602001600020600001548b612b2290919063ffffffff16565b9950610efc818d8d612411565b929a5090985096509450610f1c92508b915087905063ffffffff612b2216565b9850610f2e888563ffffffff612b2216565b9750610f40878463ffffffff612b2216565b9650610f52868363ffffffff612b2216565b9550600101610e75565b50505050505b9295509295909350565b60065490565b60006108d3610f7f6129d2565b84610d528560016000610f906129d2565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549063ffffffff612b2216565b600854600160a01b900460ff1615611013576040805162461bcd60e51b815260206004820152600f6024820152600080516020614038833981519152604482015290519081900360640190fd5b6008805460ff60a01b1916600160a01b17905561102e611643565b61106d576040805162461bcd60e51b81526020600482018190526024820152600080516020613ff8833981519152604482015290519081900360640190fd5b600081815260166020526040808220805460ff1916600117905551829133917f5861bc35284955b8d9fba954841cca45cd9d0c61ee46243c8ac53bbad3c95cc39190a3506008805460ff60a01b19169055565b600854600160a01b900460ff161561110d576040805162461bcd60e51b815260206004820152600f6024820152600080516020614038833981519152604482015290519081900360640190fd5b6008805460ff60a01b1916600160a01b17905560135460408051630ef57ac560e41b8152905133926001600160a01b03169163ef57ac50916004808301926020929190829003018186803b15801561116457600080fd5b505afa158015611178573d6000803e3d6000fd5b505050506040513d602081101561118e57600080fd5b50516001600160a01b0316146111d55760405162461bcd60e51b815260040180806020018281038252602d815260200180613f1b602d913960400191505060405180910390fd5b826111df576113a2565b600b546111ea6108b9565b1161122a576040805162461bcd60e51b815260206004820152601d6024820152600080516020613f8f833981519152604482015290519081900360640190fd5b600c5484148061123b5750600d5484145b61127a576040805162461bcd60e51b815260206004820152601e6024820152600080516020613f48833981519152604482015290519081900360640190fd5b6014546000906001600160a01b038881169116141561129c5750600a546112ef565b6112a4612ddc565b9050600b548110156112ef576040805162461bcd60e51b815260206004820152600f60248201526e1c1bdbdb081a5b9a5d0819985d5b1d608a1b604482015290519081900360640190fd5b6000601182815481106112fe57fe5b60009182526020808320898452600760089093020191909101815260408083206001600160a01b03808c16855260059091018352818420908c1684529091529020805490915085111561135057805494505b8054611362908663ffffffff612b7a16565b8155600181015460009061138f90869061138390899063ffffffff612ac216565b9063ffffffff612bbc16565b905061139e8884898488612e2f565b5050505b50506008805460ff60a01b1916905550505050565b6001600160a01b031660009081526020819052604090205490565b60105481565b6113e0611643565b61141f576040805162461bcd60e51b81526020600482018190526024820152600080516020613ff8833981519152604482015290519081900360640190fd5b6008546040516000916001600160a01b031690600080516020614018833981519152908390a3600880546001600160a01b0319169055565b600854600160a01b900460ff16156114a4576040805162461bcd60e51b815260206004820152600f6024820152600080516020614038833981519152604482015290519081900360640190fd5b6008805460ff60a01b1916600160a01b1790556114bf611643565b6114fe576040805162461bcd60e51b81526020600482018190526024820152600080516020613ff8833981519152604482015290519081900360640190fd5b600e544310611554576040805162461bcd60e51b815260206004820152601f60248201527f416765206f75742c207365744469737472696275746f72206661696c65642e00604482015290519081900360640190fd5b601580546001600160a01b0319166001600160a01b03929092169190911790556008805460ff60a01b19169055565b6000806011868154811061159357fe5b60009182526020808320888452600760089093020191909101815260408083206001600160a01b0380881685526005909101835281842090881684529091529020546011805491935090879081106115e757fe5b600091825260208083209783526007600890920290970101865260408082206001600160a01b03958616835260050187528082209590941681529390945291206001015490939092509050565b6008546001600160a01b031690565b6008546000906001600160a01b031661165a6129d2565b6001600160a01b031614905090565b600854600160a01b900460ff16156116b6576040805162461bcd60e51b815260206004820152600f6024820152600080516020614038833981519152604482015290519081900360640190fd5b6008805460ff60a01b1916600160a01b1790556116d1611643565b611710576040805162461bcd60e51b81526020600482018190526024820152600080516020613ff8833981519152604482015290519081900360640190fd5b6010548110611760576040805162461bcd60e51b815260206004820152601760248201527632bc31b2b2b2103234b9ba3934b13aba37b91021a0a81760491b604482015290519081900360640190fd5b6015546001600160a01b03166117b4576040805162461bcd60e51b8152602060048201526014602482015273191a5cdd1c9a589d5d1bdc881b9bdd081a5b9a5d60621b604482015290519081900360640190fd5b6015546117ca906001600160a01b031682612e4d565b6010546117dd908263ffffffff612b7a16565b601055506008805460ff60a01b19169055565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156108ae5780601f10610883576101008083540402835291602001916108ae565b600854600160a01b900460ff161561189e576040805162461bcd60e51b815260206004820152600f6024820152600080516020614038833981519152604482015290519081900360640190fd5b6008805460ff60a01b1916600160a01b17905560135460408051630ef57ac560e41b8152905133926001600160a01b03169163ef57ac50916004808301926020929190829003018186803b1580156118f557600080fd5b505afa158015611909573d6000803e3d6000fd5b505050506040513d602081101561191f57600080fd5b50516001600160a01b0316146119665760405162461bcd60e51b815260040180806020018281038252602d815260200180613f1b602d913960400191505060405180910390fd5b821580611971575080155b1561197b576113a2565b600b546119866108b9565b10156119c7576040805162461bcd60e51b815260206004820152601d6024820152600080516020613f8f833981519152604482015290519081900360640190fd5b600c548414806119d85750600d5484145b611a17576040805162461bcd60e51b815260206004820152601e6024820152600080516020613f48833981519152604482015290519081900360640190fd5b6014546000906001600160a01b0388811691161415611a395750600a54611a8c565b611a41612ddc565b9050600b54811015611a8c576040805162461bcd60e51b815260206004820152600f60248201526e1c1bdbdb081a5b9a5d0819985d5b1d608a1b604482015290519081900360640190fd5b600060118281548110611a9b57fe5b60009182526020808320898452600760089093020191909101815260408083206001600160a01b03808c16855260059091018352818420908c16845290915290208054909150611b2a90611af5908763ffffffff612b2216565b611383611b08868963ffffffff612ac216565b84546001860154611b1e9163ffffffff612ac216565b9063ffffffff612b2216565b60018201558054611b41908663ffffffff612b2216565b81556000611b5985611383888763ffffffff612ac216565b905061139e88848984612e5b565b600b54611b726108b9565b11611bb2576040805162461bcd60e51b815260206004820152601d6024820152600080516020613f8f833981519152604482015290519081900360640190fd5b600c54821480611bc35750600d5482145b611c02576040805162461bcd60e51b815260206004820152601e6024820152600080516020613f48833981519152604482015290519081900360640190fd5b60006001611c0e6108b9565b0390505b600a548110611c75574360118281548110611c2957fe5b60009182526020808320878452600760089093020191909101815260408083203384526004019091529020600101541015611c6c57611c6c818433600086612e77565b60001901611c12565b505050565b600080600060118581548110611c8c57fe5b9060005260206000209060080201600701600085815260200190815260200160002060000154925060118581548110611cc157fe5b9060005260206000209060080201600701600085815260200190815260200160002060010154915060118581548110611cf657fe5b906000526020600020906008020160070160008581526020019081526020016000206002015490509250925092565b600854600160a01b900460ff1615611d72576040805162461bcd60e51b815260206004820152600f6024820152600080516020614038833981519152604482015290519081900360640190fd5b6008805460ff60a01b1916600160a01b179055600a548310611dd1576040805162461bcd60e51b81526020600482015260136024820152721bdb9b1e48199bdc8818dbdb9cdd081c1bdbdb606a1b604482015290519081900360640190fd5b611ddf838333846001612e77565b50506008805460ff60a01b1916905550565b611dfc600182611b67565b611e07600282611b67565b50565b60006108d3611e176129d2565b84610d52856040518060600160405280602581526020016140e66025913960016000611e416129d2565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919063ffffffff612d4516565b60006108d3611e856129d2565b8484612bfb565b600854600160a01b900460ff1615611ed9576040805162461bcd60e51b815260206004820152600f6024820152600080516020614038833981519152604482015290519081900360640190fd5b6008805460ff60a01b1916600160a01b179055611ef4611643565b611f33576040805162461bcd60e51b81526020600482018190526024820152600080516020613ff8833981519152604482015290519081900360640190fd5b600a548410611f7f576040805162461bcd60e51b81526020600482015260136024820152721bdb9b1e48199bdc8818dbdb9cdd081c1bdbdb606a1b604482015290519081900360640190fd5b611f8d848484846001612e77565b50506008805460ff60a01b191690555050565b600854600160a01b900460ff1615611fed576040805162461bcd60e51b815260206004820152600f6024820152600080516020614038833981519152604482015290519081900360640190fd5b6008805460ff60a01b1916600160a01b179055612008611643565b612047576040805162461bcd60e51b81526020600482018190526024820152600080516020613ff8833981519152604482015290519081900360640190fd5b61204f6108b9565b8310612099576040805162461bcd60e51b81526020600482015260146024820152731cd95d11dc9bdd5c0e8817dc1a590819985d5b1d60621b604482015290519081900360640190fd5b60008381526016602052604090205460ff16156120eb576040805162461bcd60e51b815260206004820152600b60248201526a1a5b9a5d0819985a5b195960aa1b604482015290519081900360640190fd5b601183815481106120f857fe5b600091825260208083208584526007600890930201919091019052604090205461213e576000838152601260209081526040822080546001810182559083529120018290555b6121a581611b1e6011868154811061215257fe5b90600052602060002090600802016007016000868152602001908152602001600020600001546011878154811061218557fe5b906000526020600020906008020160010154612b7a90919063ffffffff16565b601184815481106121b257fe5b906000526020600020906008020160010181905550604051806080016040528082815260200160008152602001600081526020016000815250601184815481106121f857fe5b60009182526020808320868452600760089093020191909101815260409182902083518155908301516001820155908201516002820155606090910151600390910155612244836131f9565b60408051838152602081018390528151859233927fae0008acd3412e94eca08902ec9c039cb78c6f8537a2b1b59a0f69d5a7d751e5929081900390910190a350506008805460ff60a01b1916905550565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b600854600160a01b900460ff161561230d576040805162461bcd60e51b815260206004820152600f6024820152600080516020614038833981519152604482015290519081900360640190fd5b6008805460ff60a01b1916600160a01b179055612328611643565b612367576040805162461bcd60e51b81526020600482018190526024820152600080516020613ff8833981519152604482015290519081900360640190fd5b600a5484106123b3576040805162461bcd60e51b81526020600482015260136024820152721bdb9b1e48199bdc8818dbdb9cdd081c1bdbdb606a1b604482015290519081900360640190fd5b60008481526016602052604090205460ff1615612405576040805162461bcd60e51b815260206004820152600b60248201526a1a5b9a5d0819985a5b195960aa1b604482015290519081900360640190fd5b611f8d8484848461324a565b6000806000806000806000612424613dcd565b60118b8154811061243157fe5b60009182526020909120600260089092020101548152601180548c90811061245557fe5b90600052602060002090600802016003015481602001818152505060118b8154811061247d57fe5b906000526020600020906008020160070160008b81526020019081526020016000206001015481604001818152505060118b815481106124b957fe5b600091825260208083208d8452600760089093020191909101905260409020600201546060820152601180548c9081106124ef57fe5b600091825260208083208d8452600760089093020191909101905260409020600301546080820152601180548c90811061252557fe5b600091825260208083208d8452600760089093020191909101815260408083206001600160a01b038d168452600401909152902060060154610100820152601180548c90811061257157fe5b600091825260208083208d8452600760089093020191909101815260408083206001600160a01b038d16845260040190915290205460a0820152601180548c9081106125b957fe5b600091825260208083208d8452600760089093020191909101815260408083206001600160a01b038d16845260040190915290206003015460c0820152601180548c90811061260457fe5b600091825260208083208d845260076008909302018201815260408084206001600160a01b038e168552600401909152909120015460e0820152601180548c90811061264c57fe5b600091825260208083208d8452600760089093020191909101815260408083206001600160a01b038d16845260049081019092529091200154610120820152601180548c90811061269957fe5b600091825260208083208d8452600760089093020191909101815260408083206001600160a01b038d16845260040190915290819020600501546101408301528101516126fc57506000965086955085945084935083925082915081905061289f565b600061275560118d8154811061270e57fe5b600091825260208083208f8452600760089093020191909101815260408083206001600160a01b038f168452600401825290912060010154845191850151909143916133f5565b9050612793826101200151611b1e84604001516113838660a00151612787886060015188612ac290919063ffffffff16565b9063ffffffff612ac216565b95508160a0015198506127d8670de0b6b3a76400006113836127c78561010001518660800151612b7a90919063ffffffff16565b60a08601519063ffffffff612ac216565b93508160e001514310156128745760118c815481106127f357fe5b906000526020600020906008020160070160008c815260200190815260200160002060040160008b6001600160a01b03166001600160a01b03168152602001908152602001600020600301549750612871826101400151611b1e84604001516113838660c00151612787886060015188612ac290919063ffffffff16565b94505b8160e00151965060118c8154811061288857fe5b906000526020600020906008020160050154925050505b9397509397509397909450565b6128b4611643565b6128f3576040805162461bcd60e51b81526020600482018190526024820152600080516020613ff8833981519152604482015290519081900360640190fd5b611e07816134c9565b600854600160a01b900460ff1615612949576040805162461bcd60e51b815260206004820152600f6024820152600080516020614038833981519152604482015290519081900360640190fd5b6008805460ff60a01b1916600160a01b179055612964611643565b6129a3576040805162461bcd60e51b81526020600482018190526024820152600080516020613ff8833981519152604482015290519081900360640190fd5b601480546001600160a01b0319166001600160a01b03929092169190911790556008805460ff60a01b19169055565b3390565b6001600160a01b038316612a1b5760405162461bcd60e51b815260040180806020018281038252602481526020018061409d6024913960400191505060405180910390fd5b6001600160a01b038216612a605760405162461bcd60e51b8152600401808060200182810382526022815260200180613eae6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600082612ad1575060006108d7565b82820282848281612ade57fe5b0414612b1b5760405162461bcd60e51b8152600401808060200182810382526021815260200180613faf6021913960400191505060405180910390fd5b9392505050565b600082820183811015612b1b576040805162461bcd60e51b815260206004820152601b60248201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604482015290519081900360640190fd5b6000612b1b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612d45565b6000612b1b83836040518060400160405280601a815260200179536166654d6174683a206469766973696f6e206279207a65726f60301b815250613558565b6001600160a01b038316612c405760405162461bcd60e51b81526004018080602001828103825260258152602001806140786025913960400191505060405180910390fd5b6001600160a01b038216612c855760405162461bcd60e51b8152600401808060200182810382526023815260200180613e656023913960400191505060405180910390fd5b612cc881604051806060016040528060268152602001613ed0602691396001600160a01b038616600090815260208190526040902054919063ffffffff612d4516565b6001600160a01b038085166000908152602081905260408082209390935590841681522054612cfd908263ffffffff612b2216565b6001600160a01b0380841660008181526020818152604091829020949094558051858152905191939287169260008051602061405883398151915292918290030190a3505050565b60008184841115612dd45760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612d99578181015183820152602001612d81565b50505050905090810190601f168015612dc65780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600b546000905b612deb6108b9565b811015612e27574360118281548110612e0057fe5b9060005260206000209060080201600301541115612e1f5790506108b6565b600101612de3565b506000905090565b81612e3957612e46565b612e468484878585612e77565b5050505050565b612e5782826135bd565b5050565b80612e6557612e71565b612e718383868461324a565b50505050565b612e7f613e27565b600060118781548110612e8e57fe5b60009182526020909120600890910201600681015490915060ff16158015612eb95750438160030154105b15612ece5760068101805460ff191660011790555b600086815260078201602090815260408083206001600160a01b03891684526004810190925290912060018201541580612f0757508054155b15612f155750505050612e46565b8054861115612f60576040805162461bcd60e51b81526020600482015260126024820152711dda5d1a191c985dce881b9bdd0819dbdbd960721b604482015290519081900360640190fd5b4383600301541015612f7b5760006003820181905560058201555b60038101548154612f919163ffffffff612b7a16565b6020850152848015612fa65750858460200151105b15612fe25760405162461bcd60e51b81526004018080602001828103825260258152602001806140c16025913960400191505060405180910390fd5b612ffa816001015443856002015486600301546133f5565b60608501819052600183015482546002850154613026936113839291612787919063ffffffff612ac216565b608085015261303989898989600061363b565b60c086015260a08501528515801590613056575085846020015110155b1561306057600194505b6130778782600087608001518860a001518a613814565b604086015280855260c085015160a08601516130c9926130bd919082906130ac9060029061278790600363ffffffff612bbc16565b60058901549063ffffffff612b2216565b9063ffffffff612b7a16565b600584015580546130e0908763ffffffff612b7a16565b815560018201546130f7908763ffffffff612b7a16565b60018301558351156131495761312989613124600261278760038960000151612bbc90919063ffffffff16565b613a48565b83516131499061dead9061314490600363ffffffff612bbc16565b612e4d565b80546003820154111561315e57805460038201555b608084015160028201546131779163ffffffff612b2216565b6002820155600683015460ff16613192576131928989613ab6565b6001820154604080860151865182518c8152602081018b90528084019490945260608401919091526080830152518a9133917f58a3b1c2d8f29a2b38d9a4d882ac09e15549500914f40fdf3817d32fe489a0389181900360a00190a3505050505050505050565b600081815260126020526040812054905b81811015611c7557600083815260126020526040902080546132429185918490811061323257fe5b9060005260206000200154613ab6565b60010161320a565b8061325457612e71565b60006011858154811061326357fe5b60009182526020909120600890910201600681015490915060ff16156132895750612e71565b43816003015410156132a857600601805460ff19166001179055612e71565b600084815260078201602090815260408083206001600160a01b0387168452600481019092528220600181015460028501546003860154939492936132ef929143916133f5565b90506000806000808660010154111561332c57613329866001015461138387600001546127878a6002015489612ac290919063ffffffff16565b92505b6001860154613341908963ffffffff612b2216565b60018701556133508b8b613ab6565b61335e8b8b8b8b600161363b565b9250905061337189868a86856001613814565b505061338e826130bd838a60050154612b7a90919063ffffffff16565b600588015584546001870154604080518d8152602081019390935282810191909152518c916001600160a01b038c16917f36ab550a399d9b968ddca0bc1d128ddfeb688341adb9be73efc280825b66d8109181900360600190a35050505050505050505050565b60008385111561343f576040805162461bcd60e51b815260206004820152601060248201526f0213637b1b59031b7bab73a34b7339d160851b604482015290519081900360640190fd5b81831115613487576040805162461bcd60e51b815260206004820152601060248201526f0213637b1b59031b7bab73a34b7339d160851b604482015290519081900360640190fd5b81841115613493578193505b8285101561349f578294505b8385106134ae575060006134c1565b6134be848663ffffffff612b7a16565b90505b949350505050565b6001600160a01b03811661350e5760405162461bcd60e51b8152600401808060200182810382526026815260200180613e886026913960400191505060405180910390fd5b6008546040516001600160a01b0380841692169060008051602061401883398151915290600090a3600880546001600160a01b0319166001600160a01b0392909216919091179055565b600081836135a75760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315612d99578181015183820152602001612d81565b5060008385816135b357fe5b0495945050505050565b6006546007546135d3908363ffffffff612b2216565b111561361b576040805162461bcd60e51b815260206004820152601260248201527113595b9cd84818d85c08195e18d95959195960721b604482015290519081900360640190fd5b60075461362e908263ffffffff612b2216565b600755612e578282613b8e565b60008060006011888154811061364d57fe5b9060005260206000209060080201600701600088815260200190815260200160002060030154905060006011898154811061368457fe5b600091825260208083208b8452600760089093020191909101815260408083206001600160a01b038b1684526004019091529020600681015490915082116136d557506000925082915061380a9050565b6000808260070154431061372557613717670de0b6b3a7640000611383613709866006015488612b7a90919063ffffffff16565b86549063ffffffff612ac216565b600684018590559550613805565b861561377957825461373d908963ffffffff612b2216565b915061375d82611383613709866006015488612b7a90919063ffffffff16565b905061376f848263ffffffff612b7a16565b6006840155613805565b82548811156137cf576040805162461bcd60e51b815260206004820152601f60248201527f4e6f7420656e6f7567682062616c616e636520746f2077697468647261772e00604482015290519081900360640190fd5b613802670de0b6b3a76400006113836137f5866006015488612b7a90919063ffffffff16565b8b9063ffffffff612ac216565b94505b505050505b9550959350505050565b60008086600701544311156138325760006003880181905560058801555b600387015460009061384a908863ffffffff612b2216565b905080156138905761388a816113836138716137f5600f5443612b2290919063ffffffff16565b60078c015460038d0154611b1e9163ffffffff612ac216565b60078901555b5043600188015560048701546138ac908663ffffffff612b2216565b60048801556003870154156138e157865460038801546138db916130ac9161138390899063ffffffff612ac216565b60058801555b86546138f3908763ffffffff612b2216565b8755600387015461390a908763ffffffff612b2216565b600388015585613a2657821561394a5761393984611b1e89600501548a60040154612b7a90919063ffffffff16565b600588015460048901559050613995565b6139676064611383601e8a60050154612ac290919063ffffffff16565b915061398484611b1e848a60040154612b7a90919063ffffffff16565b600060048901819055600589015590505b8015613a21576139a53082612e4d565b6040805163a9059cbb60e01b81526001600160a01b038a166004820152602481018390529051309163a9059cbb9160448083019260209291908290030181600087803b1580156139f457600080fd5b505af1158015613a08573d6000803e3d6000fd5b505050506040513d6020811015613a1e57600080fd5b50505b613a3d565b6004870154613a3b908563ffffffff612b2216565b505b965096945050505050565b6000613a6282670de0b6b3a764000063ffffffff612ac216565b6000848152601260205260408120549192505b81811015612e465760008581526012602052604090208054613aae91879184908110613a9d57fe5b906000526020600020015485613c6c565b600101613a75565b600060118381548110613ac557fe5b9060005260206000209060080201600701600083815260200190815260200160002090506000613b17826001015460118681548110613b0057fe5b906000526020600020906008020160000154613d0c565b9050613b80670de0b6b3a76400006113838361278760118981548110613b3957fe5b906000526020600020906008020160010154611383886000015460118c81548110613b6057fe5b906000526020600020906008020160040154612ac290919063ffffffff16565b826002018190555050505050565b6001600160a01b038216613be9576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b600254613bfc908263ffffffff612b2216565b6002556001600160a01b038216600090815260208190526040902054613c28908263ffffffff612b2216565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391926000805160206140588339815191529281900390910190a35050565b600060118481548110613c7b57fe5b906000526020600020906008020160070160008481526020019081526020016000209050600081600101541115612e7157613d01613cf0826001015461138360118881548110613cc757fe5b906000526020600020906008020160010154611383866000015488612ac290919063ffffffff16565b60038301549063ffffffff612b2216565b600382015550505050565b670de0b6b3a7640000613d2982611383838663ffffffff612ac216565b90506000613d43600261138384600163ffffffff612b2216565b9050815b80821015613d71575080613d6a600261138383611b1e878263ffffffff612bbc16565b9150613d47565b613d8581632cb4178063ffffffff612ac216565b95945050505050565b6040518060e001604052806000815260200160008152602001600081526020016000815260200160008152602001600081526020016000151581525090565b60405180610160016040528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6040518060e0016040528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152509056fe45524332303a207472616e7366657220746f20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365637265617465506f6f6c3a20496e7661696c656420626c6f636b20706172616d65746572734d656e7361546f6b656e3a207468652063616c6c6572206d757374206265206d656e736120636f6e74726163746d696e4d656e7361546f6b656e3a20496e7661696c656420616374696f6e0000637265617465506f6f6c3a20496e7661696c656420626c6f636b20706172616d657465727320326d696e4d656e7361546f6b656e3a20496e7661696c656420706f6f6c73000000536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65728be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05265656e7472616e742063616c6c2e0000000000000000000000000000000000ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737377697468647261773a20756e6c6f636b65642062616c616e6365206e6f7420656e6f75676845524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa265627a7a7231582091982517d86753dbcd62510657f560336eb96e2d732dc66a472c02e2e1f821c464736f6c63430005110032000000000000000000000000b2bb82da15d918f445a6d549f82ccaca7cec1801

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

000000000000000000000000b2bb82da15d918f445a6d549f82ccaca7cec1801

-----Decoded View---------------
Arg [0] : addressAp (address): 0xb2bb82da15d918f445a6d549f82ccaca7cec1801

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000b2bb82da15d918f445a6d549f82ccaca7cec1801


Loading