ETH Price: $2,676.26 (-2.23%)

Contract

0x5FBe4eB536DADBcee54d5b55eD6559E29C60B055
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

1 address found via
Transaction Hash
Method
Block
From
To
Transfer Ownersh...128755392021-07-22 10:10:241131 days ago1626948624IN
0x5FBe4eB5...29C60B055
0 ETH0.0005741820
0x60806040120863272021-03-22 3:59:551254 days ago1616385595IN
 Create: KUSDMinter
0 ETH0.4033785140

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
KUSDMinter

Compiler Version
v0.5.16+commit.9c3226ce

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 12 : KUSDMinter.sol
pragma solidity ^0.5.16;

import "./KineOracleInterface.sol";
import "./KineControllerInterface.sol";
import "./KUSDMinterDelegate.sol";
import "./Math.sol";
import "./IERC20.sol";
import "./ERC20.sol";
import "./SafeERC20.sol";

/// @notice IKineUSD, a simplified interface of KineUSD (see KineUSD)
interface IKineUSD {
    function mint(address account, uint amount) external;

    function burn(address account, uint amount) external;

    function balanceOf(address account) external view returns (uint256);
}

/// @notice IKMCD, a simplified interface of KMCD (see KMCD)
interface IKMCD {
    function borrowBehalf(address payable borrower, uint borrowAmount) external;

    function repayBorrowBehalf(address borrower, uint repayAmount) external;

    function liquidateBorrowBehalf(address liquidator, address borrower, uint repayAmount, address kTokenCollateral) external;

    function borrowBalance(address account) external view returns (uint);

    function totalBorrows() external view returns (uint);
}

/**
 * @title IRewardDistributionRecipient
 */
contract IRewardDistributionRecipient is KUSDMinterDelegate {
    /// @notice Emitted when reward distributor changed
    event NewRewardDistribution(address oldRewardDistribution, address newRewardDistribution);

    /// @notice The reward distributor who is responsible to transfer rewards to this recipient and notify the recipient that reward is added.
    address public rewardDistribution;

    /// @notice Notify this recipient that reward is added.
    function notifyRewardAmount(uint reward) external;

    /// @notice Only reward distributor can notify that reward is added.
    modifier onlyRewardDistribution() {
        require(_msgSender() == rewardDistribution, "Caller is not reward distribution");
        _;
    }

    /// @notice Set reward distributor to new one.
    function setRewardDistribution(address _rewardDistribution) external onlyOwner {
        address oldRewardDistribution = rewardDistribution;
        rewardDistribution = _rewardDistribution;
        emit NewRewardDistribution(oldRewardDistribution, _rewardDistribution);
    }
}

/**
 * @title KUSDMinter is responsible to stake/unstake users' Kine MCD (see KMCD) and mint/burn KUSD (see KineUSD) on behalf of users.
 * When user want to mint KUSD against their collaterals (see KToken), KUSDMinter will borrow Knie MCD on behalf of user (which will increase user's debt ratio)
 * and then call KineUSD to mint KUSD to user. When user want to  burn KUSD, KUSDMinter will call KineUSD to burn KUSD from user and  repay Kine MCD on behalf of user.
 * KUSDMinter also let treasury account to mint/burn its balance to keep KUSD amount (the part that user transferred into Kine off-chain trading system) synced with Kine off-chain trading system.
 * @author Kine
 */
contract KUSDMinter is IRewardDistributionRecipient {
    using KineSafeMath for uint;
    using SafeERC20 for IERC20;

    /// @notice Emitted when KMCD changed
    event NewKMCD(address oldKMCD, address newKMCD);
    /// @notice Emitted when KineUSD changed
    event NewKUSD(address oldKUSD, address newKUSD);
    /// @notice Emitted when Kine changed
    event NewKine(address oldKine, address newKine);
    /// @notice Emitted when reward duration changed
    event NewRewardDuration(uint oldRewardDuration, uint newRewardDuration);
    /// @notice Emitted when reward release period changed
    event NewRewardReleasePeriod(uint oldRewardReleasePeriod, uint newRewardReleasePeriod);
    /// @notice Emitted when burn cool down time changed
    event NewBurnCooldownTime(uint oldCooldown, uint newCooldownTime);
    /// @notice Emitted when user mint KUSD
    event Mint(address indexed user, uint mintKUSDAmount, uint stakedKMCDAmount, uint userStakesNew, uint totalStakesNew);
    /// @notice Emitted when user burnt KUSD
    event Burn(address indexed user, uint burntKUSDAmount, uint unstakedKMCDAmount, uint userStakesNew, uint totalStakesNew);
    /// @notice Emitted when user burnt maximum KUSD
    event BurnMax(address indexed user, uint burntKUSDAmount, uint unstakedKMCDAmount, uint userStakesNew, uint totalStakesNew);
    /// @notice Emitted when liquidator liquidate staker's Kine MCD
    event Liquidate(address indexed liquidator, address indexed staker, uint burntKUSDAmount, uint unstakedKMCDAmount, uint stakerStakesNew, uint totalStakesNew);
    /// @notice Emitted when distributor notify reward is added
    event RewardAdded(uint reward);
    /// @notice Emitted when user claimed reward
    event RewardPaid(address indexed user, uint reward);
    /// @notice Emitted when treasury account mint kusd
    event TreasuryMint(uint amount);
    /// @notice Emitted when treasury account burn kusd
    event TreasuryBurn(uint amount);
    /// @notice Emitted when treasury account changed
    event NewTreasury(address oldTreasury, address newTreasury);
    /// @notice Emitted when vault account changed
    event NewVault(address oldVault, address newVault);
    /// @notice Emitted when controller changed
    event NewController(address oldController, address newController);

    /**
     * @notice This is for avoiding reward calculation overflow (see https://sips.synthetix.io/sips/sip-77)
     * 1.15792e59 < uint(-1) / 1e18
    */
    uint public constant REWARD_OVERFLOW_CHECK = 1.15792e59;

    /**
     * @notice Implementation address slot for delegation mode;
     */
    address public implementation;

    /// @notice Flag to mark if this contract has been initialized before
    bool public initialized;

    /// @notice Contract which holds Kine MCD
    IKMCD public kMCD;

    /// @notice Contract which holds Kine USD
    IKineUSD public kUSD;

    /// @notice Contract of controller which holds Kine Oracle
    KineControllerInterface public controller;

    /// @notice Treasury is responsible to keep KUSD amount consisted with Kine off-chain trading system
    address public treasury;

    /// @notice Vault is the place to store Kine trading system's reserved KUSD
    address public vault;

    /****************
    * Reward related
    ****************/

    /// @notice Contract which hold Kine Token
    IERC20 public kine;
    /// @notice Reward distribution duration. Added reward will be distribute to Kine MCD stakers within this duration.
    uint public rewardDuration;
    /// @notice Staker's reward will mature gradually in this period.
    uint public rewardReleasePeriod;
    /// @notice Start time that users can start staking/burning KUSD and claim their rewards.
    uint public startTime;
    /// @notice End time of this round of reward distribution.
    uint public periodFinish = 0;
    /// @notice Per second reward to be distributed
    uint public rewardRate = 0;
    /// @notice Accrued reward per Kine MCD staked per second.
    uint public rewardPerTokenStored;
    /// @notice Last time that rewardPerTokenStored is updated. Happens whenever total stakes going to be changed.
    uint public lastUpdateTime;
    /**
     * @notice The minium cool down time before user can burn kUSD after they mint kUSD everytime.
     * This is to raise risk and cost to arbitrageurs who front run our prices updates in oracle to drain profit from stakers.
     * Should be larger then minium price post interval.
     */
    uint public burnCooldownTime;

    struct AccountRewardDetail {
        /// @dev Last time account claimed its reward
        uint lastClaimTime;
        /// @dev RewardPerTokenStored at last time accrue rewards to this account
        uint rewardPerTokenUpdated;
        /// @dev Accrued rewards haven't been claimed of this account
        uint accruedReward;
        /// @dev Last time account mint kUSD
        uint lastMintTime;
    }

    /// @notice Mapping of account addresses to account reward detail
    mapping(address => AccountRewardDetail) public accountRewardDetails;

    function initialize(address kine_, address kUSD_, address kMCD_, address controller_, address treasury_, address vault_, address rewardDistribution_, uint startTime_, uint rewardDuration_, uint rewardReleasePeriod_) external {
        require(initialized == false, "KUSDMinter can only be initialized once");
        kine = IERC20(kine_);
        kUSD = IKineUSD(kUSD_);
        kMCD = IKMCD(kMCD_);
        controller = KineControllerInterface(controller_);
        treasury = treasury_;
        vault = vault_;
        rewardDistribution = rewardDistribution_;
        startTime = startTime_;
        rewardDuration = rewardDuration_;
        rewardReleasePeriod = rewardReleasePeriod_;
        initialized = true;
    }

    /**
     * @dev Local vars in calculating equivalent amount between KUSD and Kine MCD
     */
    struct CalculateVars {
        uint equivalentKMCDAmount;
        uint equivalentKUSDAmount;
    }

    /// @notice Prevent stakers' actions before start time
    modifier checkStart() {
        require(block.timestamp >= startTime, "not started yet");
        _;
    }

    /// @notice Prevent accounts other than treasury to mint/burn KUSD
    modifier onlyTreasury() {
        require(msg.sender == treasury, "only treasury account is allowed");
        _;
    }

    modifier afterCooldown(address staker) {
        require(accountRewardDetails[staker].lastMintTime.add(burnCooldownTime) < block.timestamp, "burn still cooling down");
        _;
    }

    /***
     * @notice Accrue account's rewards and store this time accrued results
     * @param account Reward status of whom to be updated
     */
    modifier updateReward(address account) {
        rewardPerTokenStored = rewardPerToken();
        lastUpdateTime = lastTimeRewardApplicable();
        if (account != address(0)) {
            accountRewardDetails[account].accruedReward = earned(account);
            accountRewardDetails[account].rewardPerTokenUpdated = rewardPerTokenStored;
            if (accountRewardDetails[account].lastClaimTime == 0) {
                accountRewardDetails[account].lastClaimTime = block.timestamp;
            }
        }
        _;
    }

    /**
     * @notice Current time which hasn't past this round reward's duration.
     * @return Current timestamp that hasn't past this round rewards' duration.
     */
    function lastTimeRewardApplicable() public view returns (uint) {
        return Math.min(block.timestamp, periodFinish);
    }

    /**
     * @notice Calculate new accrued reward per staked Kine MCD.
     * @return Current accrued reward per staked Kine MCD.
     */
    function rewardPerToken() public view returns (uint) {
        uint totalStakes = totalStakes();
        if (totalStakes == 0) {
            return rewardPerTokenStored;
        }
        return
        rewardPerTokenStored.add(
            lastTimeRewardApplicable()
            .sub(lastUpdateTime)
            .mul(rewardRate)
            .mul(1e18)
            .div(totalStakes)
        );
    }

    /**
     * @notice Calculate account's earned rewards so far.
     * @param account Which account to be viewed.
     * @return Account's earned rewards so far.
     */
    function earned(address account) public view returns (uint) {
        return accountStakes(account)
        .mul(rewardPerToken().sub(accountRewardDetails[account].rewardPerTokenUpdated))
        .div(1e18)
        .add(accountRewardDetails[account].accruedReward);
    }

    /**
     * @notice Calculate account's claimable rewards so far.
     * @param account Which account to be viewed.
     * @return Account's claimable rewards so far.
     */
    function claimable(address account) external view returns (uint) {
        uint accountNewAccruedReward = earned(account);
        uint pastTime = block.timestamp.sub(accountRewardDetails[account].lastClaimTime);
        uint maturedReward = rewardReleasePeriod == 0 ? accountNewAccruedReward : accountNewAccruedReward.mul(pastTime).div(rewardReleasePeriod);
        if (maturedReward > accountNewAccruedReward) {
            maturedReward = accountNewAccruedReward;
        }
        return maturedReward;
    }

    /**
    * @notice Mint will borrow equivalent Kine MCD for user, stake borrowed MCD and mint specified amount of KUSD. Call will fail if hasn't reached start time.
    * Mint will fail if hasn't reach start time.
    * @param kUSDAmount The amount of KUSD user want to mint
    */
    function mint(uint kUSDAmount) external checkStart updateReward(msg.sender) {
        address payable msgSender = _msgSender();
        // update sender's mint time
        accountRewardDetails[msgSender].lastMintTime = block.timestamp;

        uint kMCDPriceMantissa = KineOracleInterface(controller.getOracle()).getUnderlyingPrice(address(kMCD));
        require(kMCDPriceMantissa != 0, "Mint: get Kine MCD price zero");

        CalculateVars memory vars;

        // KUSD has 18 decimals
        // KMCD has 18 decimals
        // kMCDPriceMantissa is KMCD's price (quoted by KUSD, has 6 decimals) scaled by 1e36 / KMCD's decimals = 1e36 / 1e18 = 1e18
        // so the calculation of equivalent Kine MCD amount is as below
        //                          kUSDAmount        1e12 * 1e6               kUSDAmount * 1e18
        // equivalentKMCDAmount =  ----------- *  ------------------ * 1e18 =  -----------------
        //                             1e18         kMCDPriceMantissa           kMCDPriceMantissa

        vars.equivalentKMCDAmount = kUSDAmount.mul(1e18).div(kMCDPriceMantissa);

        // call KMCD contract to borrow Kine MCD for user and stake them
        kMCD.borrowBehalf(msgSender, vars.equivalentKMCDAmount);

        // mint KUSD to user
        kUSD.mint(msgSender, kUSDAmount);

        emit Mint(msgSender, kUSDAmount, vars.equivalentKMCDAmount, accountStakes(msgSender), totalStakes());
    }

    /**
    * @notice Burn repay equivalent Kine MCD for user and burn specified amount of KUSD
    * Burn will fail if hasn't reach start time.
    * @param kUSDAmount The amount of KUSD user want to burn
    */
    function burn(uint kUSDAmount) external checkStart afterCooldown(msg.sender) updateReward(msg.sender) {
        address msgSender = _msgSender();

        // burn user's KUSD
        kUSD.burn(msgSender, kUSDAmount);

        // calculate equivalent Kine MCD amount to specified amount of KUSD
        uint kMCDPriceMantissa = KineOracleInterface(controller.getOracle()).getUnderlyingPrice(address(kMCD));
        require(kMCDPriceMantissa != 0, "Burn: get Kine MCD price zero");

        CalculateVars memory vars;

        // KUSD has 18 decimals
        // KMCD has 18 decimals
        // kMCDPriceMantissa is KMCD's price (quoted by KUSD, has 6 decimals) scaled by 1e36 / KMCD's decimals = 1e36 / 1e18 = 1e18
        // so the calculation of equivalent Kine MCD amount is as below
        //                          kUSDAmount        1e12 * 1e6               kUSDAmount * 1e18
        // equivalentKMCDAmount =  ----------- *  ------------------ * 1e18 =  -----------------
        //                             1e18         kMCDPriceMantissa           kMCDPriceMantissa

        vars.equivalentKMCDAmount = kUSDAmount.mul(1e18).div(kMCDPriceMantissa);

        // call KMCD contract to repay Kine MCD for user
        kMCD.repayBorrowBehalf(msgSender, vars.equivalentKMCDAmount);

        emit Burn(msgSender, kUSDAmount, vars.equivalentKMCDAmount, accountStakes(msgSender), totalStakes());
    }

    /**
    * @notice BurnMax unstake and repay all borrowed Kine MCD for user and burn equivalent KUSD
    */
    function burnMax() external checkStart afterCooldown(msg.sender) updateReward(msg.sender) {
        address msgSender = _msgSender();

        uint kMCDPriceMantissa = KineOracleInterface(controller.getOracle()).getUnderlyingPrice(address(kMCD));
        require(kMCDPriceMantissa != 0, "BurnMax: get Kine MCD price zero");

        CalculateVars memory vars;

        // KUSD has 18 decimals
        // KMCD has 18 decimals
        // kMCDPriceMantissa is KMCD's price (quoted by KUSD, has 6 decimals) scaled by 1e36 / KMCD's decimals = 1e36 / 1e18 = 1e18
        // so the calculation of equivalent KUSD amount is as below
        //                         accountStakes     kMCDPriceMantissa         accountStakes * kMCDPriceMantissa
        // equivalentKUSDAmount =  ------------- *  ------------------ * 1e18 = ---------------------------------
        //                             1e18            1e12 * 1e6                          1e18
        //

        // try to unstake all Kine MCD
        uint userStakes = accountStakes(msgSender);
        vars.equivalentKMCDAmount = userStakes;
        vars.equivalentKUSDAmount = userStakes.mul(kMCDPriceMantissa).div(1e18);

        // in case user's kUSD is not enough to unstake all mcd, then just burn all kUSD and unstake part of MCD
        uint kUSDbalance = kUSD.balanceOf(msgSender);
        if (vars.equivalentKUSDAmount > kUSDbalance) {
            vars.equivalentKUSDAmount = kUSDbalance;
            vars.equivalentKMCDAmount = kUSDbalance.mul(1e18).div(kMCDPriceMantissa);
        }

        // burn user's equivalent KUSD
        kUSD.burn(msgSender, vars.equivalentKUSDAmount);

        // call KMCD contract to repay Kine MCD for user
        kMCD.repayBorrowBehalf(msgSender, vars.equivalentKMCDAmount);

        emit BurnMax(msgSender, vars.equivalentKUSDAmount, vars.equivalentKMCDAmount, accountStakes(msgSender), totalStakes());
    }

    /**
     * @notice Caller liquidates the staker's Kine MCD and seize staker's collateral.
     * Liquidate will fail if hasn't reach start time.
     * @param staker The staker of Kine MCD to be liquidated.
     * @param unstakeKMCDAmount The amount of Kine MCD to unstake.
     * @param maxBurnKUSDAmount The max amount limit of KUSD of liquidator to be burned.
     * @param kTokenCollateral The market in which to seize collateral from the staker.
     */
    function liquidate(address staker, uint unstakeKMCDAmount, uint maxBurnKUSDAmount, address kTokenCollateral) external checkStart updateReward(staker) {
        address msgSender = _msgSender();

        uint kMCDPriceMantissa = KineOracleInterface(controller.getOracle()).getUnderlyingPrice(address(kMCD));
        require(kMCDPriceMantissa != 0, "Liquidate: get Kine MCD price zero");

        CalculateVars memory vars;

        // KUSD has 18 decimals
        // KMCD has 18 decimals
        // kMCDPriceMantissa is KMCD's price (quoted by KUSD, has 6 decimals) scaled by 1e36 / KMCD's decimals = 1e36 / 1e18 = 1e18
        // so the calculation of equivalent KUSD amount is as below
        //                         accountStakes     kMCDPriceMantissa         accountStakes * kMCDPriceMantissa
        // equivalentKUSDAmount =  ------------- *  ------------------ * 1e18 = ---------------------------------
        //                             1e18            1e12 * 1e6                          1e30
        //

        vars.equivalentKUSDAmount = unstakeKMCDAmount.mul(kMCDPriceMantissa).div(1e18);

        require(maxBurnKUSDAmount >= vars.equivalentKUSDAmount, "Liquidate: reach out max burn KUSD amount limit");

        // burn liquidator's KUSD
        kUSD.burn(msgSender, vars.equivalentKUSDAmount);

        // call KMCD contract to liquidate staker's Kine MCD and seize collateral
        kMCD.liquidateBorrowBehalf(msgSender, staker, unstakeKMCDAmount, kTokenCollateral);

        emit Liquidate(msgSender, staker, vars.equivalentKUSDAmount, unstakeKMCDAmount, accountStakes(staker), totalStakes());
    }

    /**
     * @notice Show account's staked Kine MCD amount
     * @param account The account to be get MCD amount from
     */
    function accountStakes(address account) public view returns (uint) {
        return kMCD.borrowBalance(account);
    }

    /// @notice Show total staked Kine MCD amount
    function totalStakes() public view returns (uint) {
        return kMCD.totalBorrows();
    }

    /**
     * @notice Claim the matured rewards of caller.
     * Claim will fail if hasn't reach start time.
     */
    function getReward() external checkStart updateReward(msg.sender) {
        uint reward = accountRewardDetails[msg.sender].accruedReward;
        if (reward > 0) {
            uint pastTime = block.timestamp.sub(accountRewardDetails[msg.sender].lastClaimTime);
            uint maturedReward = rewardReleasePeriod == 0 ? reward : reward.mul(pastTime).div(rewardReleasePeriod);
            if (maturedReward > reward) {
                maturedReward = reward;
            }

            accountRewardDetails[msg.sender].accruedReward = reward.sub(maturedReward);
            accountRewardDetails[msg.sender].lastClaimTime = block.timestamp;
            kine.safeTransfer(msg.sender, maturedReward);
            emit RewardPaid(msg.sender, maturedReward);
        }
    }

    /**
     * @notice Notify rewards has been added, trigger a new round of reward period, recalculate reward rate and duration end time.
     * If distributor notify rewards before this round duration end time, then the leftover rewards of this round will roll over to
     * next round and will be distributed together with new rewards in next round of reward period.
     * @param reward How many of rewards has been added for new round of reward period.
     */
    function notifyRewardAmount(uint reward) external onlyRewardDistribution updateReward(address(0)) {
        if (block.timestamp > startTime) {
            if (block.timestamp >= periodFinish) {
                // @dev to avoid of rewardPerToken calculation overflow (see https://sips.synthetix.io/sips/sip-77), we check the reward to be inside a properate range
                // which is 2^256 / 10^18
                require(reward < REWARD_OVERFLOW_CHECK, "reward rate will overflow");
                rewardRate = reward.div(rewardDuration);
            } else {
                uint remaining = periodFinish.sub(block.timestamp);
                uint leftover = remaining.mul(rewardRate);
                // @dev to avoid of rewardPerToken calculation overflow (see https://sips.synthetix.io/sips/sip-77), we check the reward to be inside a properate range
                // which is 2^256 / 10^18
                require(reward.add(leftover) < REWARD_OVERFLOW_CHECK, "reward rate will overflow");
                rewardRate = reward.add(leftover).div(rewardDuration);
            }
            lastUpdateTime = block.timestamp;
            periodFinish = block.timestamp.add(rewardDuration);
            emit RewardAdded(reward);
        } else {
            // @dev to avoid of rewardPerToken calculation overflow (see https://sips.synthetix.io/sips/sip-77), we check the reward to be inside a properate range
            // which is 2^256 / 10^18
            require(reward < REWARD_OVERFLOW_CHECK, "reward rate will overflow");
            rewardRate = reward.div(rewardDuration);
            lastUpdateTime = startTime;
            periodFinish = startTime.add(rewardDuration);
            emit RewardAdded(reward);
        }
    }

    /**
     * @notice Set new reward duration, will start a new round of reward period immediately and recalculate rewardRate.
     * @param newRewardDuration New duration of each reward period round.
     */
    function _setRewardDuration(uint newRewardDuration) external onlyOwner updateReward(address(0)) {
        uint oldRewardDuration = rewardDuration;
        rewardDuration = newRewardDuration;

        if (block.timestamp > startTime) {
            if (block.timestamp >= periodFinish) {
                rewardRate = 0;
            } else {
                uint remaining = periodFinish.sub(block.timestamp);
                uint leftover = remaining.mul(rewardRate);
                rewardRate = leftover.div(rewardDuration);
            }
            lastUpdateTime = block.timestamp;
            periodFinish = block.timestamp.add(rewardDuration);
        } else {
            rewardRate = rewardRate.mul(oldRewardDuration).div(rewardDuration);
            lastUpdateTime = startTime;
            periodFinish = startTime.add(rewardDuration);
        }

        emit NewRewardDuration(oldRewardDuration, newRewardDuration);
    }

    /**
     * @notice Set new reward release period. The unclaimed rewards will be affected immediately.
     * @param newRewardReleasePeriod New release period of how long all earned rewards will be matured each time
     * before user claim reward.
     */
    function _setRewardReleasePeriod(uint newRewardReleasePeriod) external onlyOwner updateReward(address(0)) {
        uint oldRewardReleasePeriod = rewardReleasePeriod;
        rewardReleasePeriod = newRewardReleasePeriod;
        emit NewRewardReleasePeriod(oldRewardReleasePeriod, newRewardReleasePeriod);
    }

    function _setCooldownTime(uint newCooldownTime) external onlyOwner {
        uint oldCooldown = burnCooldownTime;
        burnCooldownTime = newCooldownTime;
        emit NewBurnCooldownTime(oldCooldown, newCooldownTime);
    }

    /**
     * @notice Mint KUSD to treasury account to keep on-chain KUSD consist with off-chain trading system
     * @param amount The amount of KUSD to mint to treasury
     */
    function treasuryMint(uint amount) external onlyTreasury {
        kUSD.mint(vault, amount);
        emit TreasuryMint(amount);
    }

    /**
     * @notice Burn KUSD from treasury account to keep on-chain KUSD consist with off-chain trading system
     * @param amount The amount of KUSD to burn from treasury
     */
    function treasuryBurn(uint amount) external onlyTreasury {
        kUSD.burn(vault, amount);
        emit TreasuryBurn(amount);
    }

    /**
     * @notice Change treasury account to a new one
     * @param newTreasury New treasury account address
     */
    function _setTreasury(address newTreasury) external onlyOwner {
        address oldTreasury = treasury;
        treasury = newTreasury;
        emit NewTreasury(oldTreasury, newTreasury);
    }

    /**
     * @notice Change vault account to a new one
     * @param newVault New vault account address
     */
    function _setVault(address newVault) external onlyOwner {
        address oldVault = vault;
        vault = newVault;
        emit NewVault(oldVault, newVault);
    }

    /**
     * @notice Change KMCD contract address to a new one.
     * @param newKMCD New KMCD contract address.
     */
    function _setKMCD(address newKMCD) external onlyOwner {
        address oldKMCD = address(kMCD);
        kMCD = IKMCD(newKMCD);
        emit NewKMCD(oldKMCD, newKMCD);
    }

    /**
     * @notice Change KUSD contract address to a new one.
     * @param newKUSD New KineUSD contract address.
     */
    function _setKUSD(address newKUSD) external onlyOwner {
        address oldKUSD = address(kUSD);
        kUSD = IKineUSD(newKUSD);
        emit NewKUSD(oldKUSD, newKUSD);
    }

    /**
     * @notice Change Kine contract address to a new one.
     * @param newKine New Kine contract address.
     */
    function _setKine(address newKine) external onlyOwner {
        address oldKine = address(kine);
        kine = IERC20(newKine);
        emit NewKine(oldKine, newKine);
    }
    /**
     * @notice Change Kine Controller address to a new one.
     * @param newController New Controller contract address.
     */
    function _setController(address newController) external onlyOwner {
        address oldController = address(controller);
        controller = KineControllerInterface(newController);
        emit NewController(oldController, newController);
    }
}

File 2 of 12 : Address.sol
pragma solidity ^0.5.5;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following 
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // According to EIP-1052, 0x0 is the value returned for not-yet created accounts
        // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
        // for accounts without code, i.e. `keccak256('')`
        bytes32 codehash;
        bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
        // solhint-disable-next-line no-inline-assembly
        assembly { codehash := extcodehash(account) }
        return (codehash != accountHash && codehash != 0x0);
    }

    /**
     * @dev Converts an `address` into `address payable`. Note that this is
     * simply a type cast: the actual underlying value is not changed.
     *
     * _Available since v2.4.0._
     */
    function toPayable(address account) internal pure returns (address payable) {
        return address(uint160(account));
    }

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

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

File 3 of 12 : 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 4 of 12 : ERC20.sol
pragma solidity ^0.5.0;

import "./Context.sol";
import "./IERC20.sol";
import "./KineSafeMath.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 KineSafeMath 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 5 of 12 : 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);
}

File 6 of 12 : KUSDMinterDelegate.sol
pragma solidity ^0.5.16;

import "./Ownable.sol";

/**
 * @title KUSDMinterDelegate
 * @author Kine
 */
contract KUSDMinterDelegate is Ownable {
    /**
     * @notice Emitted when implementation is changed
     */
    event NewImplementation(address oldImplementation, address newImplementation);

    /**
     * @notice Implementation address
     */
    address public implementation;
}

File 7 of 12 : KineControllerInterface.sol
pragma solidity ^0.5.16;

/**
Copyright 2020 Compound Labs, Inc.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

/**
* Original work from Compound: https://github.com/compound-finance/compound-protocol/blob/master/contracts/ComptrollerInterface.sol
* Modified to work in the Kine system.
* Main modifications:
*   1. removed Comp token related logics.
*   2. removed interest rate model related logics.
*   3. removed error code propagation mechanism to fail fast and loudly
*/

contract KineControllerInterface {
    /// @notice Indicator that this is a Controller contract (for inspection)
    bool public constant isController = true;

    /// @notice oracle getter function
    function getOracle() external view returns (address);

    /*** Assets You Are In ***/

    function enterMarkets(address[] calldata kTokens) external;

    function exitMarket(address kToken) external;

    /*** Policy Hooks ***/

    function mintAllowed(address kToken, address minter, uint mintAmount) external returns (bool, string memory);

    function mintVerify(address kToken, address minter, uint mintAmount, uint mintTokens) external;

    function redeemAllowed(address kToken, address redeemer, uint redeemTokens) external returns (bool, string memory);

    function redeemVerify(address kToken, address redeemer, uint redeemTokens) external;

    function borrowAllowed(address kToken, address borrower, uint borrowAmount) external returns (bool, string memory);

    function borrowVerify(address kToken, address borrower, uint borrowAmount) external;

    function repayBorrowAllowed(
        address kToken,
        address payer,
        address borrower,
        uint repayAmount) external returns (bool, string memory);

    function repayBorrowVerify(
        address kToken,
        address payer,
        address borrower,
        uint repayAmount) external;

    function liquidateBorrowAllowed(
        address kTokenBorrowed,
        address kTokenCollateral,
        address liquidator,
        address borrower,
        uint repayAmount) external returns (bool, string memory);

    function liquidateBorrowVerify(
        address kTokenBorrowed,
        address kTokenCollateral,
        address liquidator,
        address borrower,
        uint repayAmount,
        uint seizeTokens) external;

    function seizeAllowed(
        address kTokenCollateral,
        address kTokenBorrowed,
        address liquidator,
        address borrower,
        uint seizeTokens) external returns (bool, string memory);

    function seizeVerify(
        address kTokenCollateral,
        address kTokenBorrowed,
        address liquidator,
        address borrower,
        uint seizeTokens) external;

    function transferAllowed(address kToken, address src, address dst, uint transferTokens) external returns (bool, string memory);

    function transferVerify(address kToken, address src, address dst, uint transferTokens) external;

    /*** Liquidity/Liquidation Calculations ***/

    function liquidateCalculateSeizeTokens(
        address kTokenBorrowed,
        address kTokenCollateral,
        uint repayAmount) external view returns (uint);
}

File 8 of 12 : KineOracleInterface.sol
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;

/**
 * @title KineOracleInterface brief abstraction of Price Oracle
 */
interface KineOracleInterface {

    /**
     * @notice Get the underlying collateral price of given kToken.
     * @dev Returned kToken underlying price is scaled by 1e(36 - underlying token decimals)
     */
    function getUnderlyingPrice(address kToken) external view returns (uint);

    /**
     * @notice Post prices of tokens owned by Kine.
     * @param messages Signed price data of tokens
     * @param signatures Signatures used to recover reporter public key
     * @param symbols Token symbols
     */
    function postPrices(bytes[] calldata messages, bytes[] calldata signatures, string[] calldata symbols) external;

    /**
     * @notice Post Kine MCD price.
     */
    function postMcdPrice(uint mcdPrice) external;

    /**
     * @notice Get the reporter address.
     */
    function reporter() external returns (address);
}

File 9 of 12 : KineSafeMath.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.
 */

/**
 * Original work from OpenZeppelin: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.5.0/contracts/math/SafeMath.sol
 * changes we made:
 * 1. add two methods that take errorMessage as input parameter
 */

library KineSafeMath {
    /**
     * @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 addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     * - Addition cannot overflow.
     * added by Kine
     */
    function add(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, errorMessage);

        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 multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     * - Multiplication cannot overflow.
     * added by Kine
     */
    function mul(uint256 a, uint256 b, string memory errorMessage) 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, errorMessage);

        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 10 of 12 : Math.sol
pragma solidity ^0.5.0;

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

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

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

File 11 of 12 : Ownable.sol
pragma solidity ^0.5.0;

import "./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 12 of 12 : SafeERC20.sol
pragma solidity ^0.5.0;

import "./IERC20.sol";
import "./KineSafeMath.sol";
import "./Address.sol";

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

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

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

    function safeApprove(IERC20 token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        // solhint-disable-next-line max-line-length
        require((value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

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

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

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves.

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

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

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

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

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"burntKUSDAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"unstakedKMCDAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"userStakesNew","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalStakesNew","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"burntKUSDAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"unstakedKMCDAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"userStakesNew","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalStakesNew","type":"uint256"}],"name":"BurnMax","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"liquidator","type":"address"},{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":false,"internalType":"uint256","name":"burntKUSDAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"unstakedKMCDAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"stakerStakesNew","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalStakesNew","type":"uint256"}],"name":"Liquidate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"mintKUSDAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"stakedKMCDAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"userStakesNew","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalStakesNew","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldCooldown","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newCooldownTime","type":"uint256"}],"name":"NewBurnCooldownTime","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldController","type":"address"},{"indexed":false,"internalType":"address","name":"newController","type":"address"}],"name":"NewController","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldImplementation","type":"address"},{"indexed":false,"internalType":"address","name":"newImplementation","type":"address"}],"name":"NewImplementation","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldKMCD","type":"address"},{"indexed":false,"internalType":"address","name":"newKMCD","type":"address"}],"name":"NewKMCD","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldKUSD","type":"address"},{"indexed":false,"internalType":"address","name":"newKUSD","type":"address"}],"name":"NewKUSD","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldKine","type":"address"},{"indexed":false,"internalType":"address","name":"newKine","type":"address"}],"name":"NewKine","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldRewardDistribution","type":"address"},{"indexed":false,"internalType":"address","name":"newRewardDistribution","type":"address"}],"name":"NewRewardDistribution","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldRewardDuration","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newRewardDuration","type":"uint256"}],"name":"NewRewardDuration","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldRewardReleasePeriod","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newRewardReleasePeriod","type":"uint256"}],"name":"NewRewardReleasePeriod","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldTreasury","type":"address"},{"indexed":false,"internalType":"address","name":"newTreasury","type":"address"}],"name":"NewTreasury","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldVault","type":"address"},{"indexed":false,"internalType":"address","name":"newVault","type":"address"}],"name":"NewVault","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":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardPaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TreasuryBurn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TreasuryMint","type":"event"},{"constant":true,"inputs":[],"name":"REWARD_OVERFLOW_CHECK","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newController","type":"address"}],"name":"_setController","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"newCooldownTime","type":"uint256"}],"name":"_setCooldownTime","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newKMCD","type":"address"}],"name":"_setKMCD","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newKUSD","type":"address"}],"name":"_setKUSD","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newKine","type":"address"}],"name":"_setKine","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"newRewardDuration","type":"uint256"}],"name":"_setRewardDuration","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"newRewardReleasePeriod","type":"uint256"}],"name":"_setRewardReleasePeriod","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newTreasury","type":"address"}],"name":"_setTreasury","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newVault","type":"address"}],"name":"_setVault","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"accountRewardDetails","outputs":[{"internalType":"uint256","name":"lastClaimTime","type":"uint256"},{"internalType":"uint256","name":"rewardPerTokenUpdated","type":"uint256"},{"internalType":"uint256","name":"accruedReward","type":"uint256"},{"internalType":"uint256","name":"lastMintTime","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"accountStakes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"kUSDAmount","type":"uint256"}],"name":"burn","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"burnCooldownTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"burnMax","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"claimable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"controller","outputs":[{"internalType":"contract KineControllerInterface","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"earned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"getReward","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"implementation","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"kine_","type":"address"},{"internalType":"address","name":"kUSD_","type":"address"},{"internalType":"address","name":"kMCD_","type":"address"},{"internalType":"address","name":"controller_","type":"address"},{"internalType":"address","name":"treasury_","type":"address"},{"internalType":"address","name":"vault_","type":"address"},{"internalType":"address","name":"rewardDistribution_","type":"address"},{"internalType":"uint256","name":"startTime_","type":"uint256"},{"internalType":"uint256","name":"rewardDuration_","type":"uint256"},{"internalType":"uint256","name":"rewardReleasePeriod_","type":"uint256"}],"name":"initialize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"initialized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"kMCD","outputs":[{"internalType":"contract IKMCD","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"kUSD","outputs":[{"internalType":"contract IKineUSD","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"kine","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"lastTimeRewardApplicable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"lastUpdateTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"staker","type":"address"},{"internalType":"uint256","name":"unstakeKMCDAmount","type":"uint256"},{"internalType":"uint256","name":"maxBurnKUSDAmount","type":"uint256"},{"internalType":"address","name":"kTokenCollateral","type":"address"}],"name":"liquidate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"kUSDAmount","type":"uint256"}],"name":"mint","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"reward","type":"uint256"}],"name":"notifyRewardAmount","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"periodFinish","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":true,"inputs":[],"name":"rewardDistribution","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rewardDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rewardPerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rewardPerTokenStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rewardRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rewardReleasePeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_rewardDistribution","type":"address"}],"name":"setRewardDistribution","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"startTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalStakes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"treasuryBurn","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"treasuryMint","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"vault","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"}]

60806040526000600d556000600e55600061001e61006d60201b60201c565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350610071565b3390565b6132af806100806000396000f3fe608060405234801561001057600080fd5b506004361061029f5760003560e01c80637b0a47ee11610167578063cd3daf9d116100ce578063f290679811610087578063f2906798146106a9578063f2fde38b146106cf578063f520e7e5146106f5578063f77c4791146106fd578063fbfa77cf14610705578063fd0c1edb1461070d5761029f565b8063cd3daf9d1461064f578063df136d6514610657578063dfcbc4881461065f578063e6f4c2221461067c578063ebe2b12b14610684578063efdc77881461068c5761029f565b8063a31e8cb511610120578063a31e8cb5146105ed578063a70c196614610627578063b09fb0f41461062f578063bf9befb114610637578063c21f2de31461063f578063c8f33c91146106475761029f565b80637b0a47ee1461058a57806380faa57d1461059257806383de424e1461059a5780638da5cb5b146105c05780638f32d59b146105c8578063a0712d68146105d05761029f565b80633d18b9121161020b5780635c60da1b116101c45780635c60da1b1461053c57806361d027b314610544578063709d483c1461054c578063715018a61461055457806378aa917f1461055c57806378e97925146105825761029f565b80633d18b912146104af578063402914f5146104b757806340d82a88146104dd57806342966c68146104fa57806358c36c37146105175780635c131d70146105345761029f565b80631210de7d1161025d5780631210de7d146103d657806315616ad5146103de578063158ef93e14610404578063183ddbfb146104205780632a08922c1461046c5780633c6b16ab146104925761029f565b80628cc262146102a457806305517146146102dc5780630974f94c146103025780630d68b7611461036f5780630eeb50e214610395578063101114cf146103b2575b600080fd5b6102ca600480360360208110156102ba57600080fd5b50356001600160a01b0316610733565b60408051918252519081900360200190f35b6102ca600480360360208110156102f257600080fd5b50356001600160a01b03166107b8565b61036d600480360361014081101561031957600080fd5b506001600160a01b038135811691602081013582169160408201358116916060810135821691608082013581169160a081013582169160c0820135169060e08101359061010081013590610120013561083d565b005b61036d6004803603602081101561038557600080fd5b50356001600160a01b0316610928565b61036d600480360360208110156103ab57600080fd5b50356109d2565b6103ba610a60565b604080516001600160a01b039092168252519081900360200190f35b6103ba610a6f565b61036d600480360360208110156103f457600080fd5b50356001600160a01b0316610a7e565b61040c610b28565b604080519115158252519081900360200190f35b6104466004803603602081101561043657600080fd5b50356001600160a01b0316610b38565b604080519485526020850193909352838301919091526060830152519081900360800190f35b61036d6004803603602081101561048257600080fd5b50356001600160a01b0316610b5f565b61036d600480360360208110156104a857600080fd5b5035610c09565b61036d610f57565b6102ca600480360360208110156104cd57600080fd5b50356001600160a01b031661110b565b61036d600480360360208110156104f357600080fd5b5035611186565b61036d6004803603602081101561051057600080fd5b5035611355565b61036d6004803603602081101561052d57600080fd5b5035611752565b61036d611858565b6103ba611d2a565b6103ba611d39565b6102ca611d48565b61036d611d61565b61036d6004803603602081101561057257600080fd5b50356001600160a01b0316611df2565b6102ca611e9c565b6102ca611ea2565b6102ca611ea8565b61036d600480360360208110156105b057600080fd5b50356001600160a01b0316611ebc565b6103ba611f66565b61040c611f75565b61036d600480360360208110156105e657600080fd5b5035611f99565b61036d6004803603608081101561060357600080fd5b506001600160a01b038135811691602081013591604082013591606001351661232d565b6102ca612706565b6103ba61270c565b6102ca61271b565b6102ca61279c565b6102ca6127a2565b6102ca6127a8565b6102ca612800565b61036d6004803603602081101561067557600080fd5b5035612806565b6103ba61290e565b6102ca61291d565b61036d600480360360208110156106a257600080fd5b5035612923565b61036d600480360360208110156106bf57600080fd5b50356001600160a01b0316612a29565b61036d600480360360208110156106e557600080fd5b50356001600160a01b0316612ad3565b6102ca612b26565b6103ba612b2c565b6103ba612b3b565b61036d6004803603602081101561072357600080fd5b50356001600160a01b0316612b4a565b6001600160a01b038116600090815260126020526040812060028101546001909101546107b291906107a690670de0b6b3a76400009061079a90610785906107796127a8565b9063ffffffff612bf416565b61078e886107b8565b9063ffffffff612c3d16565b9063ffffffff612c9616565b9063ffffffff612cd816565b92915050565b60048054604080516326b9f4dd60e11b81526001600160a01b0385811694820194909452905160009390921691634d73e9ba91602480820192602092909190829003018186803b15801561080b57600080fd5b505afa15801561081f573d6000803e3d6000fd5b505050506040513d602081101561083557600080fd5b505192915050565b600354600160a01b900460ff16156108865760405162461bcd60e51b81526004018080602001828103825260278152602001806131c86027913960400191505060405180910390fd5b600980546001600160a01b03199081166001600160a01b039c8d16179091556005805482169a8c169a909a17909955600480548a16988b1698909817909755600680548916968a1696909617909555600780548816948916949094179093556008805487169288169290921790915560028054909516951694909417909255600c92909255600a55600b5560038054600160a01b60ff60a01b19909116179055565b610930611f75565b61096f576040805162461bcd60e51b81526020600482018190526024820152600080516020613210833981519152604482015290519081900360640190fd5b600280546001600160a01b038381166001600160a01b0319831681179093556040805191909216808252602082019390935281517fb2b9e30d3c2fa2ea6903abe69b7f597dc3fb9ae4b64aa1d5302557405a2b05cc929181900390910190a15050565b6109da611f75565b610a19576040805162461bcd60e51b81526020600482018190526024820152600080516020613210833981519152604482015290519081900360640190fd5b6011805490829055604080518281526020810184905281517f2f04c20afa6f81291ec2c607ff8f67b5e093d1019a0b2271254faec998e4165e929181900390910190a15050565b6002546001600160a01b031681565b6005546001600160a01b031681565b610a86611f75565b610ac5576040805162461bcd60e51b81526020600482018190526024820152600080516020613210833981519152604482015290519081900360640190fd5b600980546001600160a01b038381166001600160a01b0319831681179093556040805191909216808252602082019390935281517fac190f443acf2398c2b592bb8691b56caed54dd835cc72e220ee57bd218ea5c5929181900390910190a15050565b600354600160a01b900460ff1681565b60126020526000908152604090208054600182015460028301546003909301549192909184565b610b67611f75565b610ba6576040805162461bcd60e51b81526020600482018190526024820152600080516020613210833981519152604482015290519081900360640190fd5b600780546001600160a01b038381166001600160a01b0319831681179093556040805191909216808252602082019390935281517f567657fa3f286518b318f4a29870674f433f622fdfc819691acb13105b228225929181900390910190a15050565b6002546001600160a01b0316610c1d612d32565b6001600160a01b031614610c625760405162461bcd60e51b81526004018080602001828103825260218152602001806132306021913960400191505060405180910390fd5b6000610c6c6127a8565b600f55610c77611ea8565b6010556001600160a01b03811615610cdb57610c9281610733565b6001600160a01b03821660009081526012602052604090206002810191909155600f54600182015554610cdb576001600160a01b03811660009081526012602052604090204290555b600c54421115610e8557600d544210610d6f5771049c9738d3e759bf07b28cf2bce5c4af5dad603a1b8210610d53576040805162461bcd60e51b815260206004820152601960248201527872657761726420726174652077696c6c206f766572666c6f7760381b604482015290519081900360640190fd5b600a54610d6790839063ffffffff612c9616565b600e55610e31565b600d54600090610d85904263ffffffff612bf416565b90506000610d9e600e5483612c3d90919063ffffffff16565b905071049c9738d3e759bf07b28cf2bce5c4af5dad603a1b610dc6858363ffffffff612cd816565b10610e14576040805162461bcd60e51b815260206004820152601960248201527872657761726420726174652077696c6c206f766572666c6f7760381b604482015290519081900360640190fd5b600a54610e2b9061079a868463ffffffff612cd816565b600e5550505b426010819055600a54610e4a919063ffffffff612cd816565b600d556040805183815290517fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9181900360200190a1610f53565b71049c9738d3e759bf07b28cf2bce5c4af5dad603a1b8210610eea576040805162461bcd60e51b815260206004820152601960248201527872657761726420726174652077696c6c206f766572666c6f7760381b604482015290519081900360640190fd5b600a54610efe90839063ffffffff612c9616565b600e55600c546010819055600a54610f1c919063ffffffff612cd816565b600d556040805183815290517fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9181900360200190a15b5050565b600c54421015610fa0576040805162461bcd60e51b815260206004820152600f60248201526e1b9bdd081cdd185c9d1959081e595d608a1b604482015290519081900360640190fd5b33610fa96127a8565b600f55610fb4611ea8565b6010556001600160a01b0381161561101857610fcf81610733565b6001600160a01b03821660009081526012602052604090206002810191909155600f54600182015554611018576001600160a01b03811660009081526012602052604090204290555b336000908152601260205260409020600201548015610f53573360009081526012602052604081205461105290429063ffffffff612bf416565b90506000600b5460001461107c57600b546110779061079a858563ffffffff612c3d16565b61107e565b825b90508281111561108b5750815b61109b838263ffffffff612bf416565b3360008181526012602052604090206002810192909255429091556009546110cf916001600160a01b039091169083612d36565b60408051828152905133917fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e0486919081900360200190a250505050565b60008061111783610733565b6001600160a01b0384166000908152601260205260408120549192509061114590429063ffffffff612bf416565b90506000600b5460001461116f57600b5461116a9061079a858563ffffffff612c3d16565b611171565b825b90508281111561117e5750815b949350505050565b61118e611f75565b6111cd576040805162461bcd60e51b81526020600482018190526024820152600080516020613210833981519152604482015290519081900360640190fd5b60006111d76127a8565b600f556111e2611ea8565b6010556001600160a01b03811615611246576111fd81610733565b6001600160a01b03821660009081526012602052604090206002810191909155600f54600182015554611246576001600160a01b03811660009081526012602052604090204290555b600a805490839055600c544211156112d857600d54421061126b576000600e556112b7565b600d54600090611281904263ffffffff612bf416565b9050600061129a600e5483612c3d90919063ffffffff16565b90506112b1600a5482612c9690919063ffffffff16565b600e5550505b426010819055600a546112d0919063ffffffff612cd816565b600d55611315565b6112f3600a5461079a83600e54612c3d90919063ffffffff16565b600e55600c546010819055600a54611311919063ffffffff612cd816565b600d555b604080518281526020810185905281517f37e5f8958a9afaec655f11114303c589fb1d7bf418a0f5d0231b5645c9c97bfe929181900390910190a1505050565b600c5442101561139e576040805162461bcd60e51b815260206004820152600f60248201526e1b9bdd081cdd185c9d1959081e595d608a1b604482015290519081900360640190fd5b60115433600081815260126020526040902060030154909142916113c79163ffffffff612cd816565b10611413576040805162461bcd60e51b8152602060048201526017602482015276313ab9371039ba34b6361031b7b7b634b733903237bbb760491b604482015290519081900360640190fd5b3361141c6127a8565b600f55611427611ea8565b6010556001600160a01b0381161561148b5761144281610733565b6001600160a01b03821660009081526012602052604090206002810191909155600f5460018201555461148b576001600160a01b03811660009081526012602052604090204290555b6000611495612d32565b60055460408051632770a7eb60e21b81526001600160a01b038085166004830152602482018990529151939450911691639dc29fac9160448082019260009290919082900301818387803b1580156114ec57600080fd5b505af1158015611500573d6000803e3d6000fd5b505050506000600660009054906101000a90046001600160a01b03166001600160a01b031663833b1fce6040518163ffffffff1660e01b815260040160206040518083038186803b15801561155457600080fd5b505afa158015611568573d6000803e3d6000fd5b505050506040513d602081101561157e57600080fd5b5051600480546040805163fc57d4df60e01b81526001600160a01b03928316938101939093525192169163fc57d4df91602480820192602092909190829003018186803b1580156115ce57600080fd5b505afa1580156115e2573d6000803e3d6000fd5b505050506040513d60208110156115f857600080fd5b505190508061164e576040805162461bcd60e51b815260206004820152601d60248201527f4275726e3a20676574204b696e65204d4344207072696365207a65726f000000604482015290519081900360640190fd5b611656613136565b6116728261079a88670de0b6b3a764000063ffffffff612c3d16565b80825260048054604080516304c11f0360e31b81526001600160a01b0388811694820194909452602481019490945251911691632608f81891604480830192600092919082900301818387803b1580156116cb57600080fd5b505af11580156116df573d6000803e3d6000fd5b50505050826001600160a01b03167f4d667732637549615f3cd28023b13380094dd975c0ac7c1b26916a8b1363b7ec87836000015161171d876107b8565b61172561271b565b604080519485526020850193909352838301919091526060830152519081900360800190a2505050505050565b6007546001600160a01b031633146117b1576040805162461bcd60e51b815260206004820181905260248201527f6f6e6c79207472656173757279206163636f756e7420697320616c6c6f776564604482015290519081900360640190fd5b60055460085460408051632770a7eb60e21b81526001600160a01b0392831660048201526024810185905290519190921691639dc29fac91604480830192600092919082900301818387803b15801561180957600080fd5b505af115801561181d573d6000803e3d6000fd5b50506040805184815290517f040c98b4f8772a4da14b92dd8a5a6926c4a30caad1d19e7e9cc1de5bf5110d829350908190036020019150a150565b600c544210156118a1576040805162461bcd60e51b815260206004820152600f60248201526e1b9bdd081cdd185c9d1959081e595d608a1b604482015290519081900360640190fd5b60115433600081815260126020526040902060030154909142916118ca9163ffffffff612cd816565b10611916576040805162461bcd60e51b8152602060048201526017602482015276313ab9371039ba34b6361031b7b7b634b733903237bbb760491b604482015290519081900360640190fd5b3361191f6127a8565b600f5561192a611ea8565b6010556001600160a01b0381161561198e5761194581610733565b6001600160a01b03821660009081526012602052604090206002810191909155600f5460018201555461198e576001600160a01b03811660009081526012602052604090204290555b6000611998612d32565b90506000600660009054906101000a90046001600160a01b03166001600160a01b031663833b1fce6040518163ffffffff1660e01b815260040160206040518083038186803b1580156119ea57600080fd5b505afa1580156119fe573d6000803e3d6000fd5b505050506040513d6020811015611a1457600080fd5b5051600480546040805163fc57d4df60e01b81526001600160a01b03928316938101939093525192169163fc57d4df91602480820192602092909190829003018186803b158015611a6457600080fd5b505afa158015611a78573d6000803e3d6000fd5b505050506040513d6020811015611a8e57600080fd5b5051905080611ae4576040805162461bcd60e51b815260206004820181905260248201527f4275726e4d61783a20676574204b696e65204d4344207072696365207a65726f604482015290519081900360640190fd5b611aec613136565b6000611af7846107b8565b8083529050611b18670de0b6b3a764000061079a838663ffffffff612c3d16565b602080840191909152600554604080516370a0823160e01b81526001600160a01b038881166004830152915160009492909316926370a0823192602480840193919291829003018186803b158015611b6f57600080fd5b505afa158015611b83573d6000803e3d6000fd5b505050506040513d6020811015611b9957600080fd5b50516020840151909150811015611bd05760208301819052611bcd8461079a83670de0b6b3a764000063ffffffff612c3d16565b83525b600554602084015160408051632770a7eb60e21b81526001600160a01b038981166004830152602482019390935290519190921691639dc29fac91604480830192600092919082900301818387803b158015611c2b57600080fd5b505af1158015611c3f573d6000803e3d6000fd5b5050600480548651604080516304c11f0360e31b81526001600160a01b038c811695820195909552602481019290925251929091169350632608f818925060448082019260009290919082900301818387803b158015611c9e57600080fd5b505af1158015611cb2573d6000803e3d6000fd5b50505050846001600160a01b03167fdecb1cd0e32d7b8f7c14b5781a00863906e504265121bdbc8889d7c307865e6284602001518560000151611cf4896107b8565b611cfc61271b565b604080519485526020850193909352838301919091526060830152519081900360800190a250505050505050565b6003546001600160a01b031681565b6007546001600160a01b031681565b71049c9738d3e759bf07b28cf2bce5c4af5dad603a1b81565b611d69611f75565b611da8576040805162461bcd60e51b81526020600482018190526024820152600080516020613210833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b611dfa611f75565b611e39576040805162461bcd60e51b81526020600482018190526024820152600080516020613210833981519152604482015290519081900360640190fd5b600480546001600160a01b038381166001600160a01b0319831681179093556040805191909216808252602082019390935281517fcd44ec64fbc3def19c642e6f6c2a99354c2ae1b21711d03249c4f2f300f16418929181900390910190a15050565b600c5481565b600e5481565b6000611eb642600d54612d8d565b90505b90565b611ec4611f75565b611f03576040805162461bcd60e51b81526020600482018190526024820152600080516020613210833981519152604482015290519081900360640190fd5b600680546001600160a01b038381166001600160a01b0319831681179093556040805191909216808252602082019390935281517ff9b6a28700579d5c8fab50f0ac2dcaa52109b85c369c4f511fcc873330ab6cbb929181900390910190a15050565b6000546001600160a01b031690565b600080546001600160a01b0316611f8a612d32565b6001600160a01b031614905090565b600c54421015611fe2576040805162461bcd60e51b815260206004820152600f60248201526e1b9bdd081cdd185c9d1959081e595d608a1b604482015290519081900360640190fd5b33611feb6127a8565b600f55611ff6611ea8565b6010556001600160a01b0381161561205a5761201181610733565b6001600160a01b03821660009081526012602052604090206002810191909155600f5460018201555461205a576001600160a01b03811660009081526012602052604090204290555b6000612064612d32565b6001600160a01b03808216600090815260126020908152604080832042600390910155600654815163419d8fe760e11b815291519596509294929093169263833b1fce9260048083019392829003018186803b1580156120c357600080fd5b505afa1580156120d7573d6000803e3d6000fd5b505050506040513d60208110156120ed57600080fd5b5051600480546040805163fc57d4df60e01b81526001600160a01b03928316938101939093525192169163fc57d4df91602480820192602092909190829003018186803b15801561213d57600080fd5b505afa158015612151573d6000803e3d6000fd5b505050506040513d602081101561216757600080fd5b50519050806121bd576040805162461bcd60e51b815260206004820152601d60248201527f4d696e743a20676574204b696e65204d4344207072696365207a65726f000000604482015290519081900360640190fd5b6121c5613136565b6121e18261079a87670de0b6b3a764000063ffffffff612c3d16565b808252600480546040805163856e5bb360e01b81526001600160a01b038881169482019490945260248101949094525191169163856e5bb391604480830192600092919082900301818387803b15801561223a57600080fd5b505af115801561224e573d6000803e3d6000fd5b5050600554604080516340c10f1960e01b81526001600160a01b038881166004830152602482018b905291519190921693506340c10f199250604480830192600092919082900301818387803b1580156122a757600080fd5b505af11580156122bb573d6000803e3d6000fd5b50505050826001600160a01b03167f94c792774c59479f7bd68442f3af3691c02123a5aabee8b6f9116d8af8aa66698683600001516122f9876107b8565b61230161271b565b604080519485526020850193909352838301919091526060830152519081900360800190a25050505050565b600c54421015612376576040805162461bcd60e51b815260206004820152600f60248201526e1b9bdd081cdd185c9d1959081e595d608a1b604482015290519081900360640190fd5b8361237f6127a8565b600f5561238a611ea8565b6010556001600160a01b038116156123ee576123a581610733565b6001600160a01b03821660009081526012602052604090206002810191909155600f546001820155546123ee576001600160a01b03811660009081526012602052604090204290555b60006123f8612d32565b90506000600660009054906101000a90046001600160a01b03166001600160a01b031663833b1fce6040518163ffffffff1660e01b815260040160206040518083038186803b15801561244a57600080fd5b505afa15801561245e573d6000803e3d6000fd5b505050506040513d602081101561247457600080fd5b5051600480546040805163fc57d4df60e01b81526001600160a01b03928316938101939093525192169163fc57d4df91602480820192602092909190829003018186803b1580156124c457600080fd5b505afa1580156124d8573d6000803e3d6000fd5b505050506040513d60208110156124ee57600080fd5b505190508061252e5760405162461bcd60e51b81526004018080602001828103825260228152602001806131a66022913960400191505060405180910390fd5b612536613136565b612552670de0b6b3a764000061079a898563ffffffff612c3d16565b602082018190528610156125975760405162461bcd60e51b815260040180806020018281038252602f815260200180613177602f913960400191505060405180910390fd5b600554602082015160408051632770a7eb60e21b81526001600160a01b038781166004830152602482019390935290519190921691639dc29fac91604480830192600092919082900301818387803b1580156125f257600080fd5b505af1158015612606573d6000803e3d6000fd5b50506004805460408051630d73caf160e41b81526001600160a01b03898116948201949094528d84166024820152604481018d90528a84166064820152905192909116935063d73caf10925060848082019260009290919082900301818387803b15801561267357600080fd5b505af1158015612687573d6000803e3d6000fd5b50505050876001600160a01b0316836001600160a01b03167fdcfb2ea46125b5c04f5311ff0585da9998aa5151b11409482cd84c8ec08e821583602001518a6126cf8d6107b8565b6126d761271b565b604080519485526020850193909352838301919091526060830152519081900360800190a35050505050505050565b600b5481565b6009546001600160a01b031681565b6000600460009054906101000a90046001600160a01b03166001600160a01b03166347bd37186040518163ffffffff1660e01b815260040160206040518083038186803b15801561276b57600080fd5b505afa15801561277f573d6000803e3d6000fd5b505050506040513d602081101561279557600080fd5b5051905090565b60115481565b60105481565b6000806127b361271b565b9050806127c4575050600f54611eb9565b6127fa6127eb8261079a670de0b6b3a764000061078e600e5461078e601054610779611ea8565b600f549063ffffffff612cd816565b91505090565b600f5481565b61280e611f75565b61284d576040805162461bcd60e51b81526020600482018190526024820152600080516020613210833981519152604482015290519081900360640190fd5b60006128576127a8565b600f55612862611ea8565b6010556001600160a01b038116156128c65761287d81610733565b6001600160a01b03821660009081526012602052604090206002810191909155600f546001820155546128c6576001600160a01b03811660009081526012602052604090204290555b600b805490839055604080518281526020810185905281517fbece2bcccce4d94546c9210138e109c2851d2c2153d0e7afba36e61c1b53d817929181900390910190a1505050565b6004546001600160a01b031681565b600d5481565b6007546001600160a01b03163314612982576040805162461bcd60e51b815260206004820181905260248201527f6f6e6c79207472656173757279206163636f756e7420697320616c6c6f776564604482015290519081900360640190fd5b600554600854604080516340c10f1960e01b81526001600160a01b03928316600482015260248101859052905191909216916340c10f1991604480830192600092919082900301818387803b1580156129da57600080fd5b505af11580156129ee573d6000803e3d6000fd5b50506040805184815290517fea359e80a6420b426d422e3866e70562d462b26dd9c9c9ab8cd737e820d9ad249350908190036020019150a150565b612a31611f75565b612a70576040805162461bcd60e51b81526020600482018190526024820152600080516020613210833981519152604482015290519081900360640190fd5b600580546001600160a01b038381166001600160a01b0319831681179093556040805191909216808252602082019390935281517fb3850c5019fd43a2b12888a929e21089f1e4284fda291366b2eb1f45a0b0c10e929181900390910190a15050565b612adb611f75565b612b1a576040805162461bcd60e51b81526020600482018190526024820152600080516020613210833981519152604482015290519081900360640190fd5b612b2381612da3565b50565b600a5481565b6006546001600160a01b031681565b6008546001600160a01b031681565b612b52611f75565b612b91576040805162461bcd60e51b81526020600482018190526024820152600080516020613210833981519152604482015290519081900360640190fd5b600880546001600160a01b038381166001600160a01b0319831681179093556040805191909216808252602082019390935281517f4241302c393c713e690702c4a45a57e93cef59aa8c6e2358495853b3420551d8929181900390910190a15050565b6000612c3683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612e43565b9392505050565b600082612c4c575060006107b2565b82820282848281612c5957fe5b0414612c365760405162461bcd60e51b81526004018080602001828103825260218152602001806131ef6021913960400191505060405180910390fd5b6000612c3683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612eda565b600082820183811015612c36576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b3390565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052612d88908490612f3f565b505050565b6000818310612d9c5781612c36565b5090919050565b6001600160a01b038116612de85760405162461bcd60e51b81526004018080602001828103825260268152602001806131516026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60008184841115612ed25760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612e97578181015183820152602001612e7f565b50505050905090810190601f168015612ec45780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183612f295760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315612e97578181015183820152602001612e7f565b506000838581612f3557fe5b0495945050505050565b612f51826001600160a01b03166130fd565b612fa2576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b60208310612fe05780518252601f199092019160209182019101612fc1565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114613042576040519150601f19603f3d011682016040523d82523d6000602084013e613047565b606091505b50915091508161309e576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b8051156130f7578080602001905160208110156130ba57600080fd5b50516130f75760405162461bcd60e51b815260040180806020018281038252602a815260200180613251602a913960400191505060405180910390fd5b50505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061117e575050151592915050565b60405180604001604052806000815260200160008152509056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734c69717569646174653a207265616368206f7574206d6178206275726e204b55534420616d6f756e74206c696d69744c69717569646174653a20676574204b696e65204d4344207072696365207a65726f4b5553444d696e7465722063616e206f6e6c7920626520696e697469616c697a6564206f6e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657243616c6c6572206973206e6f742072657761726420646973747269627574696f6e5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a265627a7a72315820dff31801880c44fe3d075728a6027993e0dbb502c7af5f5d9dab3b453724b47064736f6c63430005100032

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061029f5760003560e01c80637b0a47ee11610167578063cd3daf9d116100ce578063f290679811610087578063f2906798146106a9578063f2fde38b146106cf578063f520e7e5146106f5578063f77c4791146106fd578063fbfa77cf14610705578063fd0c1edb1461070d5761029f565b8063cd3daf9d1461064f578063df136d6514610657578063dfcbc4881461065f578063e6f4c2221461067c578063ebe2b12b14610684578063efdc77881461068c5761029f565b8063a31e8cb511610120578063a31e8cb5146105ed578063a70c196614610627578063b09fb0f41461062f578063bf9befb114610637578063c21f2de31461063f578063c8f33c91146106475761029f565b80637b0a47ee1461058a57806380faa57d1461059257806383de424e1461059a5780638da5cb5b146105c05780638f32d59b146105c8578063a0712d68146105d05761029f565b80633d18b9121161020b5780635c60da1b116101c45780635c60da1b1461053c57806361d027b314610544578063709d483c1461054c578063715018a61461055457806378aa917f1461055c57806378e97925146105825761029f565b80633d18b912146104af578063402914f5146104b757806340d82a88146104dd57806342966c68146104fa57806358c36c37146105175780635c131d70146105345761029f565b80631210de7d1161025d5780631210de7d146103d657806315616ad5146103de578063158ef93e14610404578063183ddbfb146104205780632a08922c1461046c5780633c6b16ab146104925761029f565b80628cc262146102a457806305517146146102dc5780630974f94c146103025780630d68b7611461036f5780630eeb50e214610395578063101114cf146103b2575b600080fd5b6102ca600480360360208110156102ba57600080fd5b50356001600160a01b0316610733565b60408051918252519081900360200190f35b6102ca600480360360208110156102f257600080fd5b50356001600160a01b03166107b8565b61036d600480360361014081101561031957600080fd5b506001600160a01b038135811691602081013582169160408201358116916060810135821691608082013581169160a081013582169160c0820135169060e08101359061010081013590610120013561083d565b005b61036d6004803603602081101561038557600080fd5b50356001600160a01b0316610928565b61036d600480360360208110156103ab57600080fd5b50356109d2565b6103ba610a60565b604080516001600160a01b039092168252519081900360200190f35b6103ba610a6f565b61036d600480360360208110156103f457600080fd5b50356001600160a01b0316610a7e565b61040c610b28565b604080519115158252519081900360200190f35b6104466004803603602081101561043657600080fd5b50356001600160a01b0316610b38565b604080519485526020850193909352838301919091526060830152519081900360800190f35b61036d6004803603602081101561048257600080fd5b50356001600160a01b0316610b5f565b61036d600480360360208110156104a857600080fd5b5035610c09565b61036d610f57565b6102ca600480360360208110156104cd57600080fd5b50356001600160a01b031661110b565b61036d600480360360208110156104f357600080fd5b5035611186565b61036d6004803603602081101561051057600080fd5b5035611355565b61036d6004803603602081101561052d57600080fd5b5035611752565b61036d611858565b6103ba611d2a565b6103ba611d39565b6102ca611d48565b61036d611d61565b61036d6004803603602081101561057257600080fd5b50356001600160a01b0316611df2565b6102ca611e9c565b6102ca611ea2565b6102ca611ea8565b61036d600480360360208110156105b057600080fd5b50356001600160a01b0316611ebc565b6103ba611f66565b61040c611f75565b61036d600480360360208110156105e657600080fd5b5035611f99565b61036d6004803603608081101561060357600080fd5b506001600160a01b038135811691602081013591604082013591606001351661232d565b6102ca612706565b6103ba61270c565b6102ca61271b565b6102ca61279c565b6102ca6127a2565b6102ca6127a8565b6102ca612800565b61036d6004803603602081101561067557600080fd5b5035612806565b6103ba61290e565b6102ca61291d565b61036d600480360360208110156106a257600080fd5b5035612923565b61036d600480360360208110156106bf57600080fd5b50356001600160a01b0316612a29565b61036d600480360360208110156106e557600080fd5b50356001600160a01b0316612ad3565b6102ca612b26565b6103ba612b2c565b6103ba612b3b565b61036d6004803603602081101561072357600080fd5b50356001600160a01b0316612b4a565b6001600160a01b038116600090815260126020526040812060028101546001909101546107b291906107a690670de0b6b3a76400009061079a90610785906107796127a8565b9063ffffffff612bf416565b61078e886107b8565b9063ffffffff612c3d16565b9063ffffffff612c9616565b9063ffffffff612cd816565b92915050565b60048054604080516326b9f4dd60e11b81526001600160a01b0385811694820194909452905160009390921691634d73e9ba91602480820192602092909190829003018186803b15801561080b57600080fd5b505afa15801561081f573d6000803e3d6000fd5b505050506040513d602081101561083557600080fd5b505192915050565b600354600160a01b900460ff16156108865760405162461bcd60e51b81526004018080602001828103825260278152602001806131c86027913960400191505060405180910390fd5b600980546001600160a01b03199081166001600160a01b039c8d16179091556005805482169a8c169a909a17909955600480548a16988b1698909817909755600680548916968a1696909617909555600780548816948916949094179093556008805487169288169290921790915560028054909516951694909417909255600c92909255600a55600b5560038054600160a01b60ff60a01b19909116179055565b610930611f75565b61096f576040805162461bcd60e51b81526020600482018190526024820152600080516020613210833981519152604482015290519081900360640190fd5b600280546001600160a01b038381166001600160a01b0319831681179093556040805191909216808252602082019390935281517fb2b9e30d3c2fa2ea6903abe69b7f597dc3fb9ae4b64aa1d5302557405a2b05cc929181900390910190a15050565b6109da611f75565b610a19576040805162461bcd60e51b81526020600482018190526024820152600080516020613210833981519152604482015290519081900360640190fd5b6011805490829055604080518281526020810184905281517f2f04c20afa6f81291ec2c607ff8f67b5e093d1019a0b2271254faec998e4165e929181900390910190a15050565b6002546001600160a01b031681565b6005546001600160a01b031681565b610a86611f75565b610ac5576040805162461bcd60e51b81526020600482018190526024820152600080516020613210833981519152604482015290519081900360640190fd5b600980546001600160a01b038381166001600160a01b0319831681179093556040805191909216808252602082019390935281517fac190f443acf2398c2b592bb8691b56caed54dd835cc72e220ee57bd218ea5c5929181900390910190a15050565b600354600160a01b900460ff1681565b60126020526000908152604090208054600182015460028301546003909301549192909184565b610b67611f75565b610ba6576040805162461bcd60e51b81526020600482018190526024820152600080516020613210833981519152604482015290519081900360640190fd5b600780546001600160a01b038381166001600160a01b0319831681179093556040805191909216808252602082019390935281517f567657fa3f286518b318f4a29870674f433f622fdfc819691acb13105b228225929181900390910190a15050565b6002546001600160a01b0316610c1d612d32565b6001600160a01b031614610c625760405162461bcd60e51b81526004018080602001828103825260218152602001806132306021913960400191505060405180910390fd5b6000610c6c6127a8565b600f55610c77611ea8565b6010556001600160a01b03811615610cdb57610c9281610733565b6001600160a01b03821660009081526012602052604090206002810191909155600f54600182015554610cdb576001600160a01b03811660009081526012602052604090204290555b600c54421115610e8557600d544210610d6f5771049c9738d3e759bf07b28cf2bce5c4af5dad603a1b8210610d53576040805162461bcd60e51b815260206004820152601960248201527872657761726420726174652077696c6c206f766572666c6f7760381b604482015290519081900360640190fd5b600a54610d6790839063ffffffff612c9616565b600e55610e31565b600d54600090610d85904263ffffffff612bf416565b90506000610d9e600e5483612c3d90919063ffffffff16565b905071049c9738d3e759bf07b28cf2bce5c4af5dad603a1b610dc6858363ffffffff612cd816565b10610e14576040805162461bcd60e51b815260206004820152601960248201527872657761726420726174652077696c6c206f766572666c6f7760381b604482015290519081900360640190fd5b600a54610e2b9061079a868463ffffffff612cd816565b600e5550505b426010819055600a54610e4a919063ffffffff612cd816565b600d556040805183815290517fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9181900360200190a1610f53565b71049c9738d3e759bf07b28cf2bce5c4af5dad603a1b8210610eea576040805162461bcd60e51b815260206004820152601960248201527872657761726420726174652077696c6c206f766572666c6f7760381b604482015290519081900360640190fd5b600a54610efe90839063ffffffff612c9616565b600e55600c546010819055600a54610f1c919063ffffffff612cd816565b600d556040805183815290517fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9181900360200190a15b5050565b600c54421015610fa0576040805162461bcd60e51b815260206004820152600f60248201526e1b9bdd081cdd185c9d1959081e595d608a1b604482015290519081900360640190fd5b33610fa96127a8565b600f55610fb4611ea8565b6010556001600160a01b0381161561101857610fcf81610733565b6001600160a01b03821660009081526012602052604090206002810191909155600f54600182015554611018576001600160a01b03811660009081526012602052604090204290555b336000908152601260205260409020600201548015610f53573360009081526012602052604081205461105290429063ffffffff612bf416565b90506000600b5460001461107c57600b546110779061079a858563ffffffff612c3d16565b61107e565b825b90508281111561108b5750815b61109b838263ffffffff612bf416565b3360008181526012602052604090206002810192909255429091556009546110cf916001600160a01b039091169083612d36565b60408051828152905133917fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e0486919081900360200190a250505050565b60008061111783610733565b6001600160a01b0384166000908152601260205260408120549192509061114590429063ffffffff612bf416565b90506000600b5460001461116f57600b5461116a9061079a858563ffffffff612c3d16565b611171565b825b90508281111561117e5750815b949350505050565b61118e611f75565b6111cd576040805162461bcd60e51b81526020600482018190526024820152600080516020613210833981519152604482015290519081900360640190fd5b60006111d76127a8565b600f556111e2611ea8565b6010556001600160a01b03811615611246576111fd81610733565b6001600160a01b03821660009081526012602052604090206002810191909155600f54600182015554611246576001600160a01b03811660009081526012602052604090204290555b600a805490839055600c544211156112d857600d54421061126b576000600e556112b7565b600d54600090611281904263ffffffff612bf416565b9050600061129a600e5483612c3d90919063ffffffff16565b90506112b1600a5482612c9690919063ffffffff16565b600e5550505b426010819055600a546112d0919063ffffffff612cd816565b600d55611315565b6112f3600a5461079a83600e54612c3d90919063ffffffff16565b600e55600c546010819055600a54611311919063ffffffff612cd816565b600d555b604080518281526020810185905281517f37e5f8958a9afaec655f11114303c589fb1d7bf418a0f5d0231b5645c9c97bfe929181900390910190a1505050565b600c5442101561139e576040805162461bcd60e51b815260206004820152600f60248201526e1b9bdd081cdd185c9d1959081e595d608a1b604482015290519081900360640190fd5b60115433600081815260126020526040902060030154909142916113c79163ffffffff612cd816565b10611413576040805162461bcd60e51b8152602060048201526017602482015276313ab9371039ba34b6361031b7b7b634b733903237bbb760491b604482015290519081900360640190fd5b3361141c6127a8565b600f55611427611ea8565b6010556001600160a01b0381161561148b5761144281610733565b6001600160a01b03821660009081526012602052604090206002810191909155600f5460018201555461148b576001600160a01b03811660009081526012602052604090204290555b6000611495612d32565b60055460408051632770a7eb60e21b81526001600160a01b038085166004830152602482018990529151939450911691639dc29fac9160448082019260009290919082900301818387803b1580156114ec57600080fd5b505af1158015611500573d6000803e3d6000fd5b505050506000600660009054906101000a90046001600160a01b03166001600160a01b031663833b1fce6040518163ffffffff1660e01b815260040160206040518083038186803b15801561155457600080fd5b505afa158015611568573d6000803e3d6000fd5b505050506040513d602081101561157e57600080fd5b5051600480546040805163fc57d4df60e01b81526001600160a01b03928316938101939093525192169163fc57d4df91602480820192602092909190829003018186803b1580156115ce57600080fd5b505afa1580156115e2573d6000803e3d6000fd5b505050506040513d60208110156115f857600080fd5b505190508061164e576040805162461bcd60e51b815260206004820152601d60248201527f4275726e3a20676574204b696e65204d4344207072696365207a65726f000000604482015290519081900360640190fd5b611656613136565b6116728261079a88670de0b6b3a764000063ffffffff612c3d16565b80825260048054604080516304c11f0360e31b81526001600160a01b0388811694820194909452602481019490945251911691632608f81891604480830192600092919082900301818387803b1580156116cb57600080fd5b505af11580156116df573d6000803e3d6000fd5b50505050826001600160a01b03167f4d667732637549615f3cd28023b13380094dd975c0ac7c1b26916a8b1363b7ec87836000015161171d876107b8565b61172561271b565b604080519485526020850193909352838301919091526060830152519081900360800190a2505050505050565b6007546001600160a01b031633146117b1576040805162461bcd60e51b815260206004820181905260248201527f6f6e6c79207472656173757279206163636f756e7420697320616c6c6f776564604482015290519081900360640190fd5b60055460085460408051632770a7eb60e21b81526001600160a01b0392831660048201526024810185905290519190921691639dc29fac91604480830192600092919082900301818387803b15801561180957600080fd5b505af115801561181d573d6000803e3d6000fd5b50506040805184815290517f040c98b4f8772a4da14b92dd8a5a6926c4a30caad1d19e7e9cc1de5bf5110d829350908190036020019150a150565b600c544210156118a1576040805162461bcd60e51b815260206004820152600f60248201526e1b9bdd081cdd185c9d1959081e595d608a1b604482015290519081900360640190fd5b60115433600081815260126020526040902060030154909142916118ca9163ffffffff612cd816565b10611916576040805162461bcd60e51b8152602060048201526017602482015276313ab9371039ba34b6361031b7b7b634b733903237bbb760491b604482015290519081900360640190fd5b3361191f6127a8565b600f5561192a611ea8565b6010556001600160a01b0381161561198e5761194581610733565b6001600160a01b03821660009081526012602052604090206002810191909155600f5460018201555461198e576001600160a01b03811660009081526012602052604090204290555b6000611998612d32565b90506000600660009054906101000a90046001600160a01b03166001600160a01b031663833b1fce6040518163ffffffff1660e01b815260040160206040518083038186803b1580156119ea57600080fd5b505afa1580156119fe573d6000803e3d6000fd5b505050506040513d6020811015611a1457600080fd5b5051600480546040805163fc57d4df60e01b81526001600160a01b03928316938101939093525192169163fc57d4df91602480820192602092909190829003018186803b158015611a6457600080fd5b505afa158015611a78573d6000803e3d6000fd5b505050506040513d6020811015611a8e57600080fd5b5051905080611ae4576040805162461bcd60e51b815260206004820181905260248201527f4275726e4d61783a20676574204b696e65204d4344207072696365207a65726f604482015290519081900360640190fd5b611aec613136565b6000611af7846107b8565b8083529050611b18670de0b6b3a764000061079a838663ffffffff612c3d16565b602080840191909152600554604080516370a0823160e01b81526001600160a01b038881166004830152915160009492909316926370a0823192602480840193919291829003018186803b158015611b6f57600080fd5b505afa158015611b83573d6000803e3d6000fd5b505050506040513d6020811015611b9957600080fd5b50516020840151909150811015611bd05760208301819052611bcd8461079a83670de0b6b3a764000063ffffffff612c3d16565b83525b600554602084015160408051632770a7eb60e21b81526001600160a01b038981166004830152602482019390935290519190921691639dc29fac91604480830192600092919082900301818387803b158015611c2b57600080fd5b505af1158015611c3f573d6000803e3d6000fd5b5050600480548651604080516304c11f0360e31b81526001600160a01b038c811695820195909552602481019290925251929091169350632608f818925060448082019260009290919082900301818387803b158015611c9e57600080fd5b505af1158015611cb2573d6000803e3d6000fd5b50505050846001600160a01b03167fdecb1cd0e32d7b8f7c14b5781a00863906e504265121bdbc8889d7c307865e6284602001518560000151611cf4896107b8565b611cfc61271b565b604080519485526020850193909352838301919091526060830152519081900360800190a250505050505050565b6003546001600160a01b031681565b6007546001600160a01b031681565b71049c9738d3e759bf07b28cf2bce5c4af5dad603a1b81565b611d69611f75565b611da8576040805162461bcd60e51b81526020600482018190526024820152600080516020613210833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b611dfa611f75565b611e39576040805162461bcd60e51b81526020600482018190526024820152600080516020613210833981519152604482015290519081900360640190fd5b600480546001600160a01b038381166001600160a01b0319831681179093556040805191909216808252602082019390935281517fcd44ec64fbc3def19c642e6f6c2a99354c2ae1b21711d03249c4f2f300f16418929181900390910190a15050565b600c5481565b600e5481565b6000611eb642600d54612d8d565b90505b90565b611ec4611f75565b611f03576040805162461bcd60e51b81526020600482018190526024820152600080516020613210833981519152604482015290519081900360640190fd5b600680546001600160a01b038381166001600160a01b0319831681179093556040805191909216808252602082019390935281517ff9b6a28700579d5c8fab50f0ac2dcaa52109b85c369c4f511fcc873330ab6cbb929181900390910190a15050565b6000546001600160a01b031690565b600080546001600160a01b0316611f8a612d32565b6001600160a01b031614905090565b600c54421015611fe2576040805162461bcd60e51b815260206004820152600f60248201526e1b9bdd081cdd185c9d1959081e595d608a1b604482015290519081900360640190fd5b33611feb6127a8565b600f55611ff6611ea8565b6010556001600160a01b0381161561205a5761201181610733565b6001600160a01b03821660009081526012602052604090206002810191909155600f5460018201555461205a576001600160a01b03811660009081526012602052604090204290555b6000612064612d32565b6001600160a01b03808216600090815260126020908152604080832042600390910155600654815163419d8fe760e11b815291519596509294929093169263833b1fce9260048083019392829003018186803b1580156120c357600080fd5b505afa1580156120d7573d6000803e3d6000fd5b505050506040513d60208110156120ed57600080fd5b5051600480546040805163fc57d4df60e01b81526001600160a01b03928316938101939093525192169163fc57d4df91602480820192602092909190829003018186803b15801561213d57600080fd5b505afa158015612151573d6000803e3d6000fd5b505050506040513d602081101561216757600080fd5b50519050806121bd576040805162461bcd60e51b815260206004820152601d60248201527f4d696e743a20676574204b696e65204d4344207072696365207a65726f000000604482015290519081900360640190fd5b6121c5613136565b6121e18261079a87670de0b6b3a764000063ffffffff612c3d16565b808252600480546040805163856e5bb360e01b81526001600160a01b038881169482019490945260248101949094525191169163856e5bb391604480830192600092919082900301818387803b15801561223a57600080fd5b505af115801561224e573d6000803e3d6000fd5b5050600554604080516340c10f1960e01b81526001600160a01b038881166004830152602482018b905291519190921693506340c10f199250604480830192600092919082900301818387803b1580156122a757600080fd5b505af11580156122bb573d6000803e3d6000fd5b50505050826001600160a01b03167f94c792774c59479f7bd68442f3af3691c02123a5aabee8b6f9116d8af8aa66698683600001516122f9876107b8565b61230161271b565b604080519485526020850193909352838301919091526060830152519081900360800190a25050505050565b600c54421015612376576040805162461bcd60e51b815260206004820152600f60248201526e1b9bdd081cdd185c9d1959081e595d608a1b604482015290519081900360640190fd5b8361237f6127a8565b600f5561238a611ea8565b6010556001600160a01b038116156123ee576123a581610733565b6001600160a01b03821660009081526012602052604090206002810191909155600f546001820155546123ee576001600160a01b03811660009081526012602052604090204290555b60006123f8612d32565b90506000600660009054906101000a90046001600160a01b03166001600160a01b031663833b1fce6040518163ffffffff1660e01b815260040160206040518083038186803b15801561244a57600080fd5b505afa15801561245e573d6000803e3d6000fd5b505050506040513d602081101561247457600080fd5b5051600480546040805163fc57d4df60e01b81526001600160a01b03928316938101939093525192169163fc57d4df91602480820192602092909190829003018186803b1580156124c457600080fd5b505afa1580156124d8573d6000803e3d6000fd5b505050506040513d60208110156124ee57600080fd5b505190508061252e5760405162461bcd60e51b81526004018080602001828103825260228152602001806131a66022913960400191505060405180910390fd5b612536613136565b612552670de0b6b3a764000061079a898563ffffffff612c3d16565b602082018190528610156125975760405162461bcd60e51b815260040180806020018281038252602f815260200180613177602f913960400191505060405180910390fd5b600554602082015160408051632770a7eb60e21b81526001600160a01b038781166004830152602482019390935290519190921691639dc29fac91604480830192600092919082900301818387803b1580156125f257600080fd5b505af1158015612606573d6000803e3d6000fd5b50506004805460408051630d73caf160e41b81526001600160a01b03898116948201949094528d84166024820152604481018d90528a84166064820152905192909116935063d73caf10925060848082019260009290919082900301818387803b15801561267357600080fd5b505af1158015612687573d6000803e3d6000fd5b50505050876001600160a01b0316836001600160a01b03167fdcfb2ea46125b5c04f5311ff0585da9998aa5151b11409482cd84c8ec08e821583602001518a6126cf8d6107b8565b6126d761271b565b604080519485526020850193909352838301919091526060830152519081900360800190a35050505050505050565b600b5481565b6009546001600160a01b031681565b6000600460009054906101000a90046001600160a01b03166001600160a01b03166347bd37186040518163ffffffff1660e01b815260040160206040518083038186803b15801561276b57600080fd5b505afa15801561277f573d6000803e3d6000fd5b505050506040513d602081101561279557600080fd5b5051905090565b60115481565b60105481565b6000806127b361271b565b9050806127c4575050600f54611eb9565b6127fa6127eb8261079a670de0b6b3a764000061078e600e5461078e601054610779611ea8565b600f549063ffffffff612cd816565b91505090565b600f5481565b61280e611f75565b61284d576040805162461bcd60e51b81526020600482018190526024820152600080516020613210833981519152604482015290519081900360640190fd5b60006128576127a8565b600f55612862611ea8565b6010556001600160a01b038116156128c65761287d81610733565b6001600160a01b03821660009081526012602052604090206002810191909155600f546001820155546128c6576001600160a01b03811660009081526012602052604090204290555b600b805490839055604080518281526020810185905281517fbece2bcccce4d94546c9210138e109c2851d2c2153d0e7afba36e61c1b53d817929181900390910190a1505050565b6004546001600160a01b031681565b600d5481565b6007546001600160a01b03163314612982576040805162461bcd60e51b815260206004820181905260248201527f6f6e6c79207472656173757279206163636f756e7420697320616c6c6f776564604482015290519081900360640190fd5b600554600854604080516340c10f1960e01b81526001600160a01b03928316600482015260248101859052905191909216916340c10f1991604480830192600092919082900301818387803b1580156129da57600080fd5b505af11580156129ee573d6000803e3d6000fd5b50506040805184815290517fea359e80a6420b426d422e3866e70562d462b26dd9c9c9ab8cd737e820d9ad249350908190036020019150a150565b612a31611f75565b612a70576040805162461bcd60e51b81526020600482018190526024820152600080516020613210833981519152604482015290519081900360640190fd5b600580546001600160a01b038381166001600160a01b0319831681179093556040805191909216808252602082019390935281517fb3850c5019fd43a2b12888a929e21089f1e4284fda291366b2eb1f45a0b0c10e929181900390910190a15050565b612adb611f75565b612b1a576040805162461bcd60e51b81526020600482018190526024820152600080516020613210833981519152604482015290519081900360640190fd5b612b2381612da3565b50565b600a5481565b6006546001600160a01b031681565b6008546001600160a01b031681565b612b52611f75565b612b91576040805162461bcd60e51b81526020600482018190526024820152600080516020613210833981519152604482015290519081900360640190fd5b600880546001600160a01b038381166001600160a01b0319831681179093556040805191909216808252602082019390935281517f4241302c393c713e690702c4a45a57e93cef59aa8c6e2358495853b3420551d8929181900390910190a15050565b6000612c3683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612e43565b9392505050565b600082612c4c575060006107b2565b82820282848281612c5957fe5b0414612c365760405162461bcd60e51b81526004018080602001828103825260218152602001806131ef6021913960400191505060405180910390fd5b6000612c3683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612eda565b600082820183811015612c36576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b3390565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052612d88908490612f3f565b505050565b6000818310612d9c5781612c36565b5090919050565b6001600160a01b038116612de85760405162461bcd60e51b81526004018080602001828103825260268152602001806131516026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60008184841115612ed25760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612e97578181015183820152602001612e7f565b50505050905090810190601f168015612ec45780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183612f295760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315612e97578181015183820152602001612e7f565b506000838581612f3557fe5b0495945050505050565b612f51826001600160a01b03166130fd565b612fa2576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b60208310612fe05780518252601f199092019160209182019101612fc1565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114613042576040519150601f19603f3d011682016040523d82523d6000602084013e613047565b606091505b50915091508161309e576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b8051156130f7578080602001905160208110156130ba57600080fd5b50516130f75760405162461bcd60e51b815260040180806020018281038252602a815260200180613251602a913960400191505060405180910390fd5b50505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061117e575050151592915050565b60405180604001604052806000815260200160008152509056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734c69717569646174653a207265616368206f7574206d6178206275726e204b55534420616d6f756e74206c696d69744c69717569646174653a20676574204b696e65204d4344207072696365207a65726f4b5553444d696e7465722063616e206f6e6c7920626520696e697469616c697a6564206f6e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657243616c6c6572206973206e6f742072657761726420646973747269627574696f6e5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a265627a7a72315820dff31801880c44fe3d075728a6027993e0dbb502c7af5f5d9dab3b453724b47064736f6c63430005100032

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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