ETH Price: $2,864.31 (-3.22%)

Token

ELP-1 (ELP-1)

Overview

Max Total Supply

98,800.604465505325910093 ELP-1

Holders

157

Market

Price

$0.00 @ 0.000000 ETH

Onchain Market Cap

-

Circulating Supply Market Cap

-

Other Info

Token Contract (WITH 18 Decimals)

Balance
0 ELP-1

Value
$0.00
0x285114b6349e1a0bcef66cd94ce005bad135a73f
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information

Contract Source Code Verified (Exact Match)

Contract Name:
ELP

Compiler Version
v0.8.16+commit.07a7930e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 18 : ELP.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/security/Pausable.sol"; 
import "@openzeppelin/contracts/access/Ownable.sol";
import "./interfaces/IELP.sol";
import "./interfaces/IMintable.sol";
import "../core/interfaces/IVault.sol";
import "../staking/interfaces/IRewardTracker.sol";

contract ELP is IERC20, IMintable, ReentrancyGuard, IELP, Ownable {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    string public name;
    string public symbol;
    uint8 public constant decimals = 18;

    uint256 public override totalSupply;
    uint256 public nonStakingSupply;

    // address public EUSDDistributor;
    mapping (address => bool) public override isMinter;
   


    mapping (address => uint256) public balances;
    mapping (address => uint256) public stakedAmount;
    mapping (address => mapping (address => uint256)) public allowances;

    mapping (address => bool) public nonStakingAccounts;

    bool public inPrivateTransferMode;
    mapping (address => bool) public isHandler;


    //----- start of EDIST


    uint256 public constant PRICE_TO_EUSD = 10 ** 12; //ATTENTION: must be same as vault.
    uint256 public constant fundingInterval = 24 hours; //ATTENTION: must be same as vault.
    // uint256 public stasticTimestamp;

    // mapping (uint256 => uint256) public cumulateFunding;

    bool public isSwapEnabled = true;
    bool public isInitialized;


    address public override vault;
    address public eusd;
    address public edeStakingPool;
    address public elpStakingTracker;
    uint256 public feeToPoolRatio = 4000; // 40%;
    uint256 public feeToPoolPrec = 10000; // 100%;
    uint256 public EUSDTotalAmount;
    uint256 public EUSDEDEReward;
    uint256 public EUSDELPReward;
    uint256 public EUSDEDERewardClaimed;
    uint256 public EUSDELPRewardClaimed;   
    mapping (address => uint256) public lastAddedAt;
    mapping (address => bool) public isManager;


    address[] public allWhitelistedTokens;
    mapping (address => bool) public whitelistedTokens;
    mapping (address => uint256) public tokenDecimals;

    uint256 public lastDistributionTime;
    uint256 public cumulativeRewardPerToken;
    uint256 public constant REWARD_PRECISION = 10 ** 20;



    mapping (address => uint256) public claimableReward;
    mapping (address => uint256) public previousCumulatedRewardPerToken;
    mapping (address => uint256) public cumulativeRewards;


    event buyESUD(
        address account,
        address token,
        uint256 amount,
        uint256 fee
    );

    event sellESUD(
        address account,
        address token,
        uint256 amount,
        uint256 fee
    );
    //----- end of EDIST


    constructor(string memory _name, string memory _symbol) {
        name = _name;
        symbol = _symbol;
    }


    modifier onlyMinter() {
        require(isMinter[msg.sender], "forbidden");
        _;
    }

    function setMinter(address _minter, bool _isActive) external override onlyOwner {
        isMinter[_minter] = _isActive;
    }

    function setFeeToPoolRatio( uint256 _feeToPoolRatio) external onlyOwner {
        require(_feeToPoolRatio < feeToPoolPrec, "x");
        feeToPoolRatio = _feeToPoolRatio;
    }

    function mint(address _account, uint256 _amount) external override onlyMinter {
        _updateRewardsLight(_account);
        _mint(_account, _amount);
    }

    function burn(address , uint256 _amount) external override {
        // require(msg.sender == _account, "unmached burn account");
        _updateRewardsLight(msg.sender);
        _burn(msg.sender, _amount);
    }

    function setInfo(string memory _name, string memory _symbol) external onlyOwner {
        name = _name;
        symbol = _symbol;
    }

    // to help users who accidentally send their tokens to this contract
    function withdrawToken(address _token, address _account, uint256 _amount) external onlyOwner {
        _updateRewards(_account);
        IERC20(_token).safeTransfer(_account, _amount);
    }


    function setHandler(address _handler, bool _isActive) external onlyOwner {
        isHandler[_handler] = _isActive;
    }

    function balanceOf(address _account) external view override returns (uint256) {
        return balances[_account];
    }


    function transfer(address _recipient, uint256 _amount) external override returns (bool) {
        require(msg.sender!= _recipient, "Self transfer is not allowed");
        _updateRewards(msg.sender);
        _updateRewards(_recipient);
        _transfer(msg.sender, _recipient, _amount);
        return true;
    }
    

    function allowance(address _owner, address _spender) external view override returns (uint256) {
        return allowances[_owner][_spender];
    }

    function approve(address _spender, uint256 _amount) external override returns (bool) {
        _approve(msg.sender, _spender, _amount);
        return true;
    }

    function transferFrom(address _sender, address _recipient, uint256 _amount) external override returns (bool) {
        _updateRewards(_sender);
        _updateRewards(_recipient);
        if (isHandler[msg.sender]) {
            _transfer(_sender, _recipient, _amount);
            return true;
        }
        uint256 nextAllowance = allowances[_sender][msg.sender].sub(_amount, "ELP: transfer amount exceeds allowance");
        _approve(_sender, msg.sender, nextAllowance);
        _transfer(_sender, _recipient, _amount);
        return true;
    }

    function _mint(address _account, uint256 _amount) internal {
        require(_account != address(0), "ELP: mint to the zero address");


        totalSupply = totalSupply.add(_amount);
        balances[_account] = balances[_account].add(_amount);

        if (nonStakingAccounts[_account]) {
            nonStakingSupply = nonStakingSupply.add(_amount);
        }

        emit Transfer(address(0), _account, _amount);
    }

    function _burn(address _account, uint256 _amount) internal {
        require(_account != address(0), "ELP: burn from the zero address");

        balances[_account] = balances[_account].sub(_amount, "ELP: burn amount exceeds balance");
        totalSupply = totalSupply.sub(_amount);

        if (nonStakingAccounts[_account]) {
            nonStakingSupply = nonStakingSupply.sub(_amount);
        }

        emit Transfer(_account, address(0), _amount);
    }

    function _transfer(address _sender, address _recipient, uint256 _amount) internal {
        require(_sender != address(0), "ELP: transfer from the zero address");
        require(_recipient != address(0), "ELP: transfer to the zero address");

        if (inPrivateTransferMode) {
            require(isHandler[msg.sender], "ELP: msg.sender not whitelisted");
        }


        balances[_sender] = balances[_sender].sub(_amount, "ELP: transfer amount exceeds balance");
        balances[_recipient] = balances[_recipient].add(_amount);

        if (nonStakingAccounts[_sender]) {
            nonStakingSupply = nonStakingSupply.sub(_amount);
        }
        if (nonStakingAccounts[_recipient]) {
            nonStakingSupply = nonStakingSupply.add(_amount);
        }

        emit Transfer(_sender, _recipient,_amount);
    }

    function _approve(address _owner, address _spender, uint256 _amount) private {
        require(_owner != address(0), "ELP: approve from the zero address");
        require(_spender != address(0), "ELP: approve to the zero address");

        allowances[_owner][_spender] = _amount;

        emit Approval(_owner, _spender, _amount);
    }

    // function _updateRewards(address _account) private {
    //     if (EUSDDistributor != address(0)){
    //         IEUSDDistributor(EUSDDistributor).updateRewards(_account);
    //     }
    // }


    //-------- start of EDIST
    function initialize(
        address _vault,
        address _eusd,
        uint256 _eusdDecimals
    ) external onlyOwner {
        require(!isInitialized, "already initialized");
        isInitialized = true;
        eusd = _eusd;
        vault =_vault;
        tokenDecimals[eusd] = _eusdDecimals;
    }

    function updateStakingAmount(address _account, uint256 _amount) external override {
        require(msg.sender == elpStakingTracker, "invalid update handler");
        stakedAmount[_account] = _amount;
    }

    function setStakingPoolAddress(address _pool) external onlyOwner {
        // require(_pool != address(0), "invalid address")
        edeStakingPool = _pool;
    }
    function setELPStakingTracker(address _elppool) external onlyOwner {
        elpStakingTracker = _elppool;
    }
    function setManager(address _manager, bool _isManager) external onlyOwner {
        isManager[_manager] = _isManager;
    }

    // we have this validation as a function instead of a modifier to reduce contract size
    function _validateManager() private view {
        require(isManager[msg.sender], "not manager");
    }

    function _validateInWhitelist(address _token) private view {
        require(whitelistedTokens[_token], "Whiltelist required");
    }

    function setTokenConfig(
        address _token,
        uint256 _tokenDecimals
    ) external onlyOwner {
        // increment token count for the first time
        if (!whitelistedTokens[_token]) {
            allWhitelistedTokens.push(_token);
        }
        whitelistedTokens[_token] = true;
        tokenDecimals[_token] = _tokenDecimals;
    }

    // function getFeeAum() public view returns (uint256) {
    //     uint256 length = allWhitelistedTokens.length;
    //     uint256 aum = 0;

    //     for (uint256 i = 0; i < length; i++) {
    //         address token = allWhitelistedTokens[i];
    //         bool isWhitelisted = whitelistedTokens[token];
    //         if (!isWhitelisted) {
    //             continue;
    //         }
    //         uint256 price = IVault(vault).getMinPrice(token);

    //         uint256 poolAmount = IVault(vault).feeReserves(token);

    //         uint256 _decimalsTk = tokenDecimals[token];
    //         aum = aum.add(poolAmount.mul(price).div(10 ** _decimalsTk));
    //     }
    //     return aum;
    // }

    function USDbyFee( ) external override view returns (uint256) {
        return IVault(vault).feeReservesUSD();
    }

    function TokenFeeReserved(address _token) external override view returns (uint256) {
        return IVault(vault).feeReserves( _token).sub(IVault(vault).feeSold( _token));
    }


    function _updateRewardsLight(address _account) private {
        uint256 accountAmount = balances[_account].add(stakedAmount[_account]);
        uint256 accountReward = accountAmount.mul(cumulativeRewardPerToken.sub(previousCumulatedRewardPerToken[_account])).div(REWARD_PRECISION);
        uint256 _claimableReward = claimableReward[_account].add(accountReward);
        claimableReward[_account] = _claimableReward;
        previousCumulatedRewardPerToken[_account] = cumulativeRewardPerToken;
    }

    function _updateRewards(address _account) private {
        uint256 blockReward = _pendingRewards();
        lastDistributionTime = block.timestamp;

        uint256 supply = totalSupply;
        uint256 _cumulativeRewardPerToken = cumulativeRewardPerToken;
        if (supply > 0 && blockReward > 0) {
            _cumulativeRewardPerToken = _cumulativeRewardPerToken.add(blockReward.mul(REWARD_PRECISION).div(supply));
            cumulativeRewardPerToken = _cumulativeRewardPerToken;
        }
        if (blockReward > 0){
        // console.log("blockReward Reward: %s", blockReward);
        // console.log("=+++++>>>_updateRewards : _cumulativeRewardPerToken : %s", _cumulativeRewardPerToken);

        }

        if (_account != address(0)) {
            // console.log("UpdAccount : [%s]: %s",_account,  previousCumulatedRewardPerToken[_account] );
            uint256 accountAmount = balances[_account].add(stakedAmount[_account]);
            uint256 accountReward = accountAmount.mul(_cumulativeRewardPerToken.sub(previousCumulatedRewardPerToken[_account])).div(REWARD_PRECISION);
            uint256 _claimableReward = claimableReward[_account].add(accountReward);

            claimableReward[_account] = _claimableReward;
            previousCumulatedRewardPerToken[_account] = _cumulativeRewardPerToken;

            if (_claimableReward > 0 && accountAmount > 0) {
                uint256 nextCumulativeReward = cumulativeRewards[_account].add(accountReward);
                cumulativeRewards[_account] = nextCumulativeReward;
            }
            
        }
    }


    function claim(address _receiver) public nonReentrant returns (uint256) {
        // console.log("TOTAl EUSD: %s", EUSDELPReward);
        return _claim(msg.sender, _receiver);
    }

    function claimForAccount(address _account) public nonReentrant override returns (uint256){
        return _claim(_account, _account);

    }

    function claimable(address _account) external override view returns (uint256) {
        uint256 _mintEUSDAmount = IVault(vault).claimableFeeReserves().div(PRICE_TO_EUSD);
        uint256 amountToEDEPool = _mintEUSDAmount.mul(feeToPoolRatio).div(feeToPoolPrec);
        uint256 thisRewardAmount = _mintEUSDAmount.sub(amountToEDEPool);

        uint256 supply = totalSupply;
        uint256 _cumulativeRewardPerToken = cumulativeRewardPerToken;
        if (supply > 0 && thisRewardAmount > 0) {
            _cumulativeRewardPerToken = _cumulativeRewardPerToken.add(thisRewardAmount.mul(REWARD_PRECISION).div(supply));
        }
        uint256 accountAmount = balances[_account].add(stakedAmount[_account]);
        uint256 accountReward = accountAmount.mul(_cumulativeRewardPerToken.sub(previousCumulatedRewardPerToken[_account])).div(REWARD_PRECISION);
        uint256 _claimableReward = claimableReward[_account].add(accountReward);
        return _claimableReward;
    }

    function _claim(address _account, address _receiver) private returns (uint256) {
        _updateRewards(_account);
        uint256 tokenAmount = claimableReward[_account];
        if (tokenAmount > 0) {
            require(EUSDELPRewardClaimed.add(tokenAmount) <= EUSDELPReward, "EUSD Reward out of range");
            claimableReward[_account] = 0;
            EUSDELPRewardClaimed = EUSDELPRewardClaimed.add(tokenAmount);
            IMintable(eusd).mint(_receiver, tokenAmount);
            // IERC20(eusd).safeTransfer(_receiver, tokenAmount);
        }
        return tokenAmount;
    }



    function _pendingRewards() private  returns (uint256) {
        if (block.timestamp == lastDistributionTime) {
            return 0;
        }

        uint256 _mintEUSDAmount = IVault(vault).claimFeeReserves().div(PRICE_TO_EUSD);
        if (_mintEUSDAmount < 1){
            return 0;
        }

        EUSDTotalAmount = EUSDTotalAmount.add(_mintEUSDAmount);

        uint256 amountToEDEPool = _mintEUSDAmount.mul(feeToPoolRatio).div(feeToPoolPrec);
        if ( amountToEDEPool > 0){
            EUSDEDEReward = EUSDEDEReward.add(amountToEDEPool);
        }
        uint256 thisRewardAmount = _mintEUSDAmount.sub(amountToEDEPool);
        EUSDELPReward = EUSDELPReward.add(thisRewardAmount);
        // uint256 timeCountID = block.timestamp.div(fundingInterval);
        // cumulateFunding[timeCountID] = cumulateFunding[timeCountID].add(thisRewardAmount);

        return thisRewardAmount;
    }

    function getFeeAmount(uint64 _stasticDays, uint64 _shiftDays) external view returns (uint256) {
        require(_stasticDays > 0 && _stasticDays < 30, "invalid days");
        require(_shiftDays >= 0 && _shiftDays < 30, "invalid _shiftDays");
        uint256 currentIndex = block.timestamp.div(fundingInterval).sub(_shiftDays);
       
        uint256 _feeTotal = 0;
        for (uint64 i = 0; i <_stasticDays; i++ ){
            _feeTotal = _feeTotal.add(IVault(vault).feeReservesRecord(currentIndex.sub(i)));
        }

        return _feeTotal.div(PRICE_TO_EUSD);//.mul(365).div(_stasticDays);
    }


    function adjustForEUSDDecimals(uint256 _amount, address _tokenDiv) public view returns (uint256) {
        return _amount.mul(10 ** tokenDecimals[eusd]).div(10 ** tokenDecimals[_tokenDiv]);
    }


    function withdrawToEDEPool() external override returns (uint256){
        uint256 extAmount = 0;
        if (edeStakingPool!= (address(0)) && EUSDEDEReward > EUSDEDERewardClaimed){
            _updateRewards(address(0));
            extAmount = EUSDEDEReward.sub(EUSDEDERewardClaimed);
            IMintable(eusd).mint(edeStakingPool, extAmount);
            EUSDEDERewardClaimed = EUSDEDEReward;
        }
        return extAmount;
    }






}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

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

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";

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

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

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

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        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) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

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

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

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

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

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

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

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

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

pragma solidity ^0.8.0;

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

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface IELP {
    // function mint(address _account, uint256 _amount) external;
    // function burn(address _account, uint256 _amount) external;
    function updateStakingAmount(address _account, uint256 _amount) external;
    function claimForAccount(address _account) external returns (uint256);
    function claimable(address _account) external view returns (uint256);
    function USDbyFee( ) external  view returns (uint256);
    function TokenFeeReserved( address _token) external  view returns (uint256);
    function withdrawToEDEPool() external  returns (uint256);
    function vault() external  returns (address);
    
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface IMintable {
    function isMinter(address _account) external returns (bool);
    function setMinter(address _minter, bool _isActive) external;
    function mint(address _account, uint256 _amount) external;
    function burn(address _account, uint256 _amount) external;
}

File 10 of 18 : IVault.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../../DID/interfaces/IESBT.sol";
import "../VaultMSData.sol";

interface IVault {
    function isSwapEnabled() external view returns (bool);
    
    function priceFeed() external view returns (address);
    function usdx() external view returns (address);
    function totalTokenWeights() external view returns (uint256);
    function usdxSupply() external view returns (uint256);
    function usdxAmounts(address _token) external view returns (uint256);
    function guaranteedUsd(address _token) external view returns (uint256);
    function baseMode() external view returns (uint8);

    function approvedRouters(address _router) external view returns (bool);
    function isManager(address _account) external view returns (bool);

    function feeReserves(address _token) external view returns (uint256);
    function feeSold (address _token)  external view returns (uint256);
    function feeReservesUSD() external view returns (uint256);
    function feeReservesDiscountedUSD() external view returns (uint256);
    function feeReservesRecord(uint256 _day) external view returns (uint256);
    function feeClaimedUSD() external view returns (uint256);
    // function keyOwner(bytes32 _key) external view returns (address);
    // function shortSizes(address _token) external view returns (uint256);
    // function shortCollateral(address _token) external view returns (uint256);
    // function shortAveragePrices(address _token) external view returns (uint256);
    // function longSizes(address _token) external view returns (uint256);
    // function longCollateral(address _token) external view returns (uint256);
    // function longAveragePrices(address _token) external view returns (uint256);
    function globalShortSize( ) external view returns (uint256);
    function globalLongSize( ) external view returns (uint256);


    //---------------------------------------- owner FUNCTIONS --------------------------------------------------
    function setESBT(address _eSBT) external;
    function setVaultStorage(address _vaultStorage) external;
    function setVaultUtils(address _vaultUtils) external;
    function setManager(address _manager, bool _isManager) external;
    function setIsSwapEnabled(bool _isSwapEnabled) external;
    function setPriceFeed(address _priceFeed) external;
    function setRouter(address _router, bool _status) external;
    function setUsdxAmount(address _token, uint256 _amount, bool _increase) external;
    function setTokenConfig(address _token, uint256 _tokenDecimals, uint256 _tokenWeight, uint256 _maxUSDAmount,
        bool _isStable,  bool _isFundingToken, bool _isTradingToken ) external;
    function clearTokenConfig(address _token) external;
    function updateRate(address _token) external;

    //-------------------------------------------------- FUNCTIONS FOR MANAGER --------------------------------------------------
    function buyUSDX(address _token, address _receiver) external returns (uint256);
    function sellUSDX(address _token, address _receiver, uint256 _usdxAmount) external returns (uint256);
    function claimFeeToken(address _token) external returns (uint256);
    function claimFeeReserves( ) external returns (uint256) ;


    //---------------------------------------- TRADING FUNCTIONS --------------------------------------------------
    function swap(address _tokenIn, address _tokenOut, address _receiver) external returns (uint256);
    function increasePosition(address _account, address _collateralToken, address _indexToken, uint256 _sizeDelta, bool _isLong) external;
    function decreasePosition(address _account, address _collateralToken, address _indexToken, uint256 _collateralDelta, uint256 _sizeDelta, bool _isLong, address _receiver) external returns (uint256);
    function liquidatePosition(address _account, address _collateralToken, address _indexToken, bool _isLong, address _feeReceiver) external;


    //-------------------------------------------------- PUBLIC FUNCTIONS --------------------------------------------------
    function directPoolDeposit(address _token) external;
    function tradingTokenList() external view returns (address[] memory);
    function fundingTokenList() external view returns (address[] memory);
    function claimableFeeReserves( )  external view returns (uint256);
    // function whitelistedTokenCount() external view returns (uint256);
    //fee functions
    // function tokenBalances(address _token) external view returns (uint256);
    // function lastFundingTimes(address _token) external view returns (uint256);
    // function setInManagerMode(bool _inManagerMode) external;
    // function setBufferAmount(address _token, uint256 _amount) external;
    // function setMaxGlobalShortSize(address _token, uint256 _amount) external;
    function getMaxPrice(address _token) external view returns (uint256);
    function getMinPrice(address _token) external view returns (uint256);
    function getRedemptionAmount(address _token, uint256 _usdxAmount) external view returns (uint256);
    function tokenToUsdMin(address _token, uint256 _tokenAmount) external view returns (uint256);
    function usdToTokenMax(address _token, uint256 _usdAmount) external view returns (uint256);
    function usdToTokenMin(address _token, uint256 _usdAmount) external view returns (uint256);
    // function getPosition(address _account, address _collateralToken, address _indexToken, bool _isLong) external view returns (uint256, uint256, uint256, int256, uint256, uint256, bool, uint256);
    // function getPositionByKey(bytes32 _key) external view returns (uint256, uint256, uint256, int256, uint256, uint256, bool, uint256);
    // function getNextFundingRate(address _token) external view returns (uint256);
    function isFundingToken(address _token) external view returns(bool);
    function isTradingToken(address _token) external view returns(bool);
    function tokenDecimals(address _token) external view returns (uint256);
    function getPositionStructByKey(bytes32 _key) external view returns (VaultMSData.Position memory);
    function getPositionStruct(address _account, address _collateralToken, address _indexToken, bool _isLong) external view returns (VaultMSData.Position memory);
    function getTokenBase(address _token) external view returns (VaultMSData.TokenBase memory);
    function getTradingFee(address _token) external view returns (VaultMSData.TradingFee memory);
    function getTradingRec(address _token) external view returns (VaultMSData.TradingRec memory);
    function getUserKeys(address _account, uint256 _start, uint256 _end) external view returns (bytes32[] memory);
    function getKeys(uint256 _start, uint256 _end) external view returns (bytes32[] memory);

    // function fundingRateFactor() external view returns (uint256);
    // function stableFundingRateFactor() external view returns (uint256);
    // function cumulativeFundingRates(address _token) external view returns (uint256);
    // // function getFeeBasisPoints(address _token, uint256 _usdxDelta, uint256 _feeBasisPoints, uint256 _taxBasisPoints, bool _increment) external view returns (uint256);


    // function allWhitelistedTokensLength() external view returns (uint256);
    // function allWhitelistedTokens(uint256) external view returns (address);
    // function whitelistedTokens(address _token) external view returns (bool);
    // function stableTokens(address _token) external view returns (bool);
    // function shortableTokens(address _token) external view returns (bool);
    
    // function globalShortSizes(address _token) external view returns (uint256);
    // function globalShortAveragePrices(address _token) external view returns (uint256);
    // function maxGlobalShortSizes(address _token) external view returns (uint256);
    // function tokenDecimals(address _token) external view returns (uint256);
    // function tokenWeights(address _token) external view returns (uint256);
    // function guaranteedUsd(address _token) external view returns (uint256);
    // function poolAmounts(address _token) external view returns (uint256);
    // function bufferAmounts(address _token) external view returns (uint256);
    // function reservedAmounts(address _token) external view returns (uint256);
    // function maxUSDAmounts(address _token) external view returns (uint256);



}

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface IRewardTracker {
    // function depositBalances(address _account, address _depositToken) external view returns (uint256);
    function stakedAmounts(address _account) external view returns (uint256);
    function updateRewardsForUser(address _account) external;
    function poolStakedAmount() external view returns (uint256);
    
    function stake(address _depositToken, uint256 _amount) external;
    function stakeForAccount(address _fundingAccount, address _account, address _depositToken, uint256 _amount) external;
    function unstake(address _depositToken, uint256 _amount) external;
    function unstakeForAccount(address _account, address _depositToken, uint256 _amount, address _receiver) external;
    // function tokensPerInterval() external view returns (uint256);
    function claim(address _receiver) external returns (uint256);
    function claimForAccount(address _account, address _receiver) external returns (uint256);
    function claimable(address _account) external view returns (uint256);
    function averageStakedAmounts(address _account) external view returns (uint256);
    function cumulativeRewards(address _account) external view returns (uint256);
    function balanceOf(address _account) external view returns (uint256);

    function poolTokenRewardPerInterval() external view returns (uint256);

}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

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

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

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

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

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

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

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

pragma solidity ^0.8.0;

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

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

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

interface IESBT {
    // function updateIncreaseLogForAccount(address _account, address _collateralToken, 
            // uint256 _collateralSize,uint256 _positionSize, bool /*_isLong*/ ) external returns (bool);

    function scorePara(uint256 _paraId) external view returns (uint256);
    function createTime(address _account) external view returns (uint256);
    // function tradingKey(address _account, bytes32 key) external view returns (bytes32);
    function nickName(address _account) external view returns (string memory);


    function getReferralForAccount(address _account) external view returns (address[] memory , address[] memory);
    function userSizeSum(address _account) external view returns (uint256);
    // function updateFeeDiscount(address _account, uint256 _discount, uint256 _rebate) external;
    function updateFee(address _account, uint256 _origFee) external returns (uint256);
    // function calFeeDiscount(address _account, uint256 _amount) external view returns (uint256);

    function getESBTAddMpUintetRoles(address _mpaddress, bytes32 _key) external view returns (uint256[] memory);
    function updateClaimVal(address _account) external ;
    function userClaimable(address _account) external view returns (uint256, uint256);

    // function updateScoreForAccount(address _account, uint256 _USDamount, uint16 _opeType) external;
    function updateScoreForAccount(address _account, address /*_vault*/, uint256 _amount, uint256 _reasonCode) external;
    function updateTradingScoreForAccount(address _account, address _vault, uint256 _amount, uint256 _refCode) external;
    function updateSwapScoreForAccount(address _account, address _vault, uint256 _amount) external;
    function updateAddLiqScoreForAccount(address _account, address _vault, uint256 _amount, uint256 _refCode) external;
    // function updateStakeEDEScoreForAccount(address _account, uint256 _amount) external ;
    function getScore(address _account) external view returns (uint256);
    function getRefCode(address _account) external view returns (string memory);
    function accountToDisReb(address _account) external view returns (uint256, uint256);
    function rank(address _account) external view returns (uint256);
    function addressToTokenID(address _account) external view returns (uint256);
}

File 16 of 18 : VaultMSData.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "../utils/EnumerableValues.sol";

library VaultMSData {
    // bytes32 public constant opeProtectIdx = keccak256("opeProtectIdx");
    // using EnumerableSet for EnumerableSet.UintSet;
    // using EnumerableValues for EnumerableSet.UintSet;

    uint256 constant COM_RATE_PRECISION = 10**4; //for common rate(leverage, etc.) and hourly rate
    uint256 constant HOUR_RATE_PRECISION = 10**6; //for common rate(leverage, etc.) and hourly rate
    uint256 constant PRC_RATE_PRECISION = 10**10;   //for precise rate  secondly rate
    uint256 constant PRICE_PRECISION = 10**30;

    struct Position {
        address account;
        address collateralToken;
        address indexToken;
        uint256 size;
        uint256 collateral;
        uint256 averagePrice;
        uint256 reserveAmount;
        uint256 lastUpdateTime;
        uint256 aveIncreaseTime;


        uint256 entryFundingRateSec;
        int256 entryPremiumRateSec;

        int256 realisedPnl;

        uint256 stopLossRatio;
        uint256 takeProfitRatio;

        bool isLong;

        int256 accPremiumFee;
        uint256 accFundingFee;
        uint256 accPositionFee;
        uint256 accCollateral;
    }


    struct TokenBase {
        //Setable parts
        bool isFundable;
        bool isStable;
        uint256 decimal;
        uint256 weight;  //tokenWeights allows customisation of index composition
        uint256 maxUSDAmounts;  // maxUSDAmounts allows setting a max amount of USDX debt for a token

        //Record only
        uint256 balance;        // tokenBalances is used only to determine _transferIn values
        uint256 poolAmount;     // poolAmounts tracks the number of received tokens that can be used for leverage
                                // this is tracked separately from tokenBalances to exclude funds that are deposited as margin collateral
        uint256 reservedAmount; // reservedAmounts tracks the number of tokens reserved for open leverage positions
        uint256 bufferAmount;   // bufferAmounts allows specification of an amount to exclude from swaps
                                // this can be used to ensure a certain amount of liquidity is available for leverage positions
    }


    struct TradingFee {
        uint256 fundingRatePerSec; //borrow fee & token util

        uint256 accumulativefundingRateSec;

        int256 longRatePerSec;  //according to position
        int256 shortRatePerSec; //according to position
        int256 accumulativeLongRateSec;
        int256 accumulativeShortRateSec;

        uint256 latestUpdateTime;
        // uint256 lastFundingTimes;     // lastFundingTimes tracks the last time funding was updated for a token
        // uint256 cumulativeFundingRates;// cumulativeFundingRates tracks the funding rates based on utilization
        // uint256 cumulativeLongFundingRates;
        // uint256 cumulativeShortFundingRates;
    }

    struct TradingTax {
        uint256 taxMax;
        uint256 taxDuration;
        uint256 k;
    }

    struct TradingLimit {
        uint256 maxShortSize;
        uint256 maxLongSize;
        uint256 maxTradingSize;

        uint256 maxRatio;
        uint256 countMinSize;
        //Price Impact
    }


    struct TradingRec {
        uint256 shortSize;
        uint256 shortCollateral;
        uint256 shortAveragePrice;
        uint256 longSize;
        uint256 longCollateral;
        uint256 longAveragePrice;
    }

}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
 * unusable.
 * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
 * array of EnumerableSet.
 * ====
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastValue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastValue;
                // Update the index for the moved value
                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        bytes32[] memory store = _values(set._inner);
        bytes32[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}

// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";

library EnumerableValues {
    using EnumerableSet for EnumerableSet.Bytes32Set;
    using EnumerableSet for EnumerableSet.AddressSet;
    using EnumerableSet for EnumerableSet.UintSet;

    function valuesAt(EnumerableSet.Bytes32Set storage set, uint256 start, uint256 end) internal view returns (bytes32[] memory) {
        uint256 max = set.length();
        if (end > max) { end = max; }

        bytes32[] memory items = new bytes32[](end - start);
        for (uint256 i = start; i < end; i++) {
            items[i - start] = set.at(i);
        }

        return items;
    }


    function valuesAt(EnumerableSet.AddressSet storage set, uint256 start, uint256 end) internal view returns (address[] memory) {
        uint256 max = set.length();
        if (end > max) { end = max; }

        address[] memory items = new address[](end - start);
        for (uint256 i = start; i < end; i++) {
            items[i - start] = set.at(i);
        }

        return items;
    }


    function valuesAt(EnumerableSet.UintSet storage set, uint256 start, uint256 end) internal view returns (uint256[] memory) {
        uint256 max = set.length();
        if (end > max) { end = max; }

        uint256[] memory items = new uint256[](end - start);
        for (uint256 i = start; i < end; i++) {
            items[i - start] = set.at(i);
        }

        return items;
    }
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"buyESUD","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"sellESUD","type":"event"},{"inputs":[],"name":"EUSDEDEReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EUSDEDERewardClaimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EUSDELPReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EUSDELPRewardClaimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EUSDTotalAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRICE_TO_EUSD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REWARD_PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"TokenFeeReserved","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"USDbyFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_tokenDiv","type":"address"}],"name":"adjustForEUSDDecimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"allWhitelistedTokens","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowances","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balances","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"}],"name":"claim","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"claimForAccount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"claimable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"claimableReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cumulativeRewardPerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"cumulativeRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"edeStakingPool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"elpStakingTracker","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"eusd","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeToPoolPrec","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeToPoolRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fundingInterval","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"_stasticDays","type":"uint64"},{"internalType":"uint64","name":"_shiftDays","type":"uint64"}],"name":"getFeeAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"inPrivateTransferMode","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_vault","type":"address"},{"internalType":"address","name":"_eusd","type":"address"},{"internalType":"uint256","name":"_eusdDecimals","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isHandler","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isInitialized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isManager","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isMinter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isSwapEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lastAddedAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastDistributionTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nonStakingAccounts","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nonStakingSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"previousCumulatedRewardPerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_elppool","type":"address"}],"name":"setELPStakingTracker","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_feeToPoolRatio","type":"uint256"}],"name":"setFeeToPoolRatio","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_handler","type":"address"},{"internalType":"bool","name":"_isActive","type":"bool"}],"name":"setHandler","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"}],"name":"setInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_manager","type":"address"},{"internalType":"bool","name":"_isManager","type":"bool"}],"name":"setManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_minter","type":"address"},{"internalType":"bool","name":"_isActive","type":"bool"}],"name":"setMinter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_pool","type":"address"}],"name":"setStakingPoolAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_tokenDecimals","type":"uint256"}],"name":"setTokenConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"stakedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokenDecimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_sender","type":"address"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"updateStakingAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelistedTokens","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawToEDEPool","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_account","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawToken","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6080604052600d805460ff19166001179055610fa06011556127106012553480156200002a57600080fd5b5060405162002de438038062002de48339810160408190526200004d916200019a565b60016000556200005d3362000083565b60026200006b838262000293565b5060036200007a828262000293565b5050506200035f565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620000fd57600080fd5b81516001600160401b03808211156200011a576200011a620000d5565b604051601f8301601f19908116603f01168101908282118183101715620001455762000145620000d5565b816040528381526020925086838588010111156200016257600080fd5b600091505b8382101562000186578582018301518183018401529082019062000167565b600093810190920192909252949350505050565b60008060408385031215620001ae57600080fd5b82516001600160401b0380821115620001c657600080fd5b620001d486838701620000eb565b93506020850151915080821115620001eb57600080fd5b50620001fa85828601620000eb565b9150509250929050565b600181811c908216806200021957607f821691505b6020821081036200023a57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200028e57600081815260208120601f850160051c81016020861015620002695750805b601f850160051c820191505b818110156200028a5782815560010162000275565b5050505b505050565b81516001600160401b03811115620002af57620002af620000d5565b620002c781620002c0845462000204565b8462000240565b602080601f831160018114620002ff5760008415620002e65750858301515b600019600386901b1c1916600185901b1785556200028a565b600085815260208120601f198616915b8281101562000330578886015182559484019460019091019084016200030f565b50858210156200034f5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b612a75806200036f6000396000f3fe608060405234801561001057600080fd5b50600436106103f15760003560e01c80638da5cb5b11610215578063c04d63da11610125578063dd62ed3e116100b8578063f2fde38b11610087578063f2fde38b14610909578063f3ae24151461091c578063f5fc50761461093f578063f993185514610948578063fbfa77cf1461096857600080fd5b8063dd62ed3e14610890578063dfbaefb1146108c9578063e468baf0146108d6578063e9503425146108e957600080fd5b8063cf456ae7116100f4578063cf456ae71461083f578063d8d46b5014610852578063daf9c21014610865578063dccc84ac1461088857600080fd5b8063c04d63da14610811578063c93be63614610824578063c9e1431c1461082d578063cb0110461461083657600080fd5b80639cb7de4b116101a8578063a5e90eee11610177578063a5e90eee146107a2578063a9059cbb146107b5578063a923fc40146107c8578063aa271e1a146107db578063afd6a5cc146107fe57600080fd5b80639cb7de4b146107605780639dc29fac14610773578063a313e28514610786578063a41a29541461078f57600080fd5b806395d89b41116101e457806395d89b411461073257806397313e381461073a5780639849e4121461074d5780639bbaee101461075757600080fd5b80638da5cb5b146106d55780638ee573ac146106e65780639554381a1461070657806395800e461461072957600080fd5b8063392e53cd1161031057806355b6ed5c116102a3578063715018a611610272578063715018a61461067e57806375b17350146106865780637cc2ac8f1461068f578063838172e2146106a25780638b770e11146106b557600080fd5b806355b6ed5c146106045780635b7f169a1461062f5780636019f28a1461064257806370a082311461065557600080fd5b806344a08411116102df57806344a08411146105a657806346ea87af146105c55780634e8edcb0146105e857806352b98766146105fb57600080fd5b8063392e53cd1461055e5780633d6aa5e114610570578063402914f51461058057806340c10f191461059357600080fd5b8063210e674211610388578063313ce56711610357578063313ce5671461050e578063351a964d146105285780633792def314610535578063380726871461055557600080fd5b8063210e6742146104c757806323b872dd146104d357806327e235e3146104e657806330167eda1461050657600080fd5b806318160ddd116103c457806318160ddd1461045f5780631a42c00b146104765780631e83409a146104a1578063203d81c1146104b457600080fd5b806301e33667146103f657806306fdde031461040b578063095ea7b3146104295780631794bb3c1461044c575b600080fd5b6104096104043660046123f2565b610981565b005b6104136109ab565b6040516104209190612452565b60405180910390f35b61043c610437366004612485565b610a39565b6040519015158152602001610420565b61040961045a3660046123f2565b610a50565b61046860045481565b604051908152602001610420565b600f54610489906001600160a01b031681565b6040516001600160a01b039091168152602001610420565b6104686104af3660046124af565b610b02565b6104096104c23660046124af565b610b27565b61046864e8d4a5100081565b61043c6104e13660046123f2565b610b51565b6104686104f43660046124af565b60076020526000908152604090205481565b610468610bff565b610516601281565b60405160ff9091168152602001610420565b600d5461043c9060ff1681565b6104686105433660046124af565b60216020526000908152604090205481565b61046860115481565b600d5461043c90610100900460ff1681565b61046868056bc75e2d6310000081565b61046861058e3660046124af565b610cb4565b6104096105a1366004612485565b610e4f565b6104686105b43660046124af565b602080526000908152604090205481565b61043c6105d33660046124af565b600c6020526000908152604090205460ff1681565b6104686105f63660046124af565b610eb1565b61046860135481565b6104686106123660046124ca565b600960209081526000928352604080842090915290825290205481565b601054610489906001600160a01b031681565b600e54610489906001600160a01b031681565b6104686106633660046124af565b6001600160a01b031660009081526007602052604090205490565b610409610fa8565b610468601d5481565b61040961069d3660046124af565b610fbc565b6104686106b0366004612515565b610fe6565b6104686106c33660046124af565b60186020526000908152604090205481565b6001546001600160a01b0316610489565b6104686106f43660046124af565b601c6020526000908152604090205481565b61043c6107143660046124af565b600a6020526000908152604090205460ff1681565b61046860175481565b610413611196565b610409610748366004612485565b6111a3565b6104686201518081565b61046860145481565b61040961076e36600461254d565b611212565b610409610781366004612485565b611245565b61046860165481565b61040961079d366004612485565b611258565b6104096107b036600461254d565b6112fd565b61043c6107c3366004612485565b611330565b6104096107d6366004612627565b6113a7565b61043c6107e93660046124af565b60066020526000908152604090205460ff1681565b61046861080c3660046124af565b6113c8565b61040961081f36600461268b565b6113dc565b61046860055481565b61046860155481565b61046860125481565b61040961084d36600461254d565b61141e565b6104686108603660046126a4565b611451565b61043c6108733660046124af565b601b6020526000908152604090205460ff1681565b6104686114aa565b61046861089e3660046124ca565b6001600160a01b03918216600090815260096020908152604080832093909416825291909152205490565b600b5461043c9060ff1681565b6104896108e436600461268b565b611528565b6104686108f73660046124af565b601f6020526000908152604090205481565b6104096109173660046124af565b611552565b61043c61092a3660046124af565b60196020526000908152604090205460ff1681565b610468601e5481565b6104686109563660046124af565b60086020526000908152604090205481565b600d54610489906201000090046001600160a01b031681565b6109896115cb565b61099282611625565b6109a66001600160a01b0384168383611794565b505050565b600280546109b8906126c7565b80601f01602080910402602001604051908101604052809291908181526020018280546109e4906126c7565b8015610a315780601f10610a0657610100808354040283529160200191610a31565b820191906000526020600020905b815481529060010190602001808311610a1457829003601f168201915b505050505081565b6000610a463384846117e6565b5060015b92915050565b610a586115cb565b600d54610100900460ff1615610aab5760405162461bcd60e51b8152602060048201526013602482015272185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b60448201526064015b60405180910390fd5b600d8054600e80546001600160a01b039586166001600160a01b03199091168117909155949093166201000002610100600160b01b031990931692909217610100179091556000918252601c602052604090912055565b6000610b0c6118ff565b610b163383611958565b9050610b226001600055565b919050565b610b2f6115cb565b600f80546001600160a01b0319166001600160a01b0392909216919091179055565b6000610b5c84611625565b610b6583611625565b336000908152600c602052604090205460ff1615610b9057610b88848484611a76565b506001610bf8565b6000610bda836040518060600160405280602681526020016129f6602691396001600160a01b03881660009081526009602090815260408083203384529091529020549190611cca565b9050610be78533836117e6565b610bf2858585611a76565b60019150505b9392505050565b600f5460009081906001600160a01b031615801590610c215750601654601454115b15610b2257610c306000611625565b601654601454610c3f91611cf6565b600e54600f546040516340c10f1960e01b81526001600160a01b0391821660048201526024810184905292935016906340c10f1990604401600060405180830381600087803b158015610c9157600080fd5b505af1158015610ca5573d6000803e3d6000fd5b50506014546016555050919050565b600080610d3d64e8d4a51000600d60029054906101000a90046001600160a01b03166001600160a01b031663995e93df6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d379190612701565b90611d02565b90506000610d5c601254610d3760115485611d0e90919063ffffffff16565b90506000610d6a8383611cf6565b600454601e54919250908115801590610d835750600083115b15610dac57610da9610da283610d378668056bc75e2d63100000611d0e565b8290611d1a565b90505b6001600160a01b0387166000908152600860209081526040808320546007909252822054610dd991611d1a565b6001600160a01b038916600090815260208052604081205491925090610e1a9068056bc75e2d6310000090610d3790610e13908790611cf6565b8590611d0e565b6001600160a01b038a166000908152601f602052604081205491925090610e419083611d1a565b9a9950505050505050505050565b3360009081526006602052604090205460ff16610e9a5760405162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b6044820152606401610aa2565b610ea382611d26565b610ead8282611de9565b5050565b600d54604051630fd074c160e41b81526001600160a01b038381166004830152600092610a4a92620100009091049091169063fd074c1090602401602060405180830381865afa158015610f09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f2d9190612701565b600d54604051631ce9cb8f60e01b81526001600160a01b0386811660048301526201000090920490911690631ce9cb8f90602401602060405180830381865afa158015610f7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fa29190612701565b90611cf6565b610fb06115cb565b610fba6000611ef6565b565b610fc46115cb565b601080546001600160a01b0319166001600160a01b0392909216919091179055565b6000808367ffffffffffffffff1611801561100b5750601e8367ffffffffffffffff16105b6110465760405162461bcd60e51b815260206004820152600c60248201526b696e76616c6964206461797360a01b6044820152606401610aa2565b601e8267ffffffffffffffff16106110955760405162461bcd60e51b8152602060048201526012602482015271696e76616c6964205f73686966744461797360701b6044820152606401610aa2565b60006110b267ffffffffffffffff8416610fa24262015180611d02565b90506000805b8567ffffffffffffffff168167ffffffffffffffff16101561117d57600d54611169906201000090046001600160a01b031663390f03c66111038667ffffffffffffffff8616611cf6565b6040518263ffffffff1660e01b815260040161112191815260200190565b602060405180830381865afa15801561113e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111629190612701565b8390611d1a565b91508061117581612730565b9150506110b8565b5061118d8164e8d4a51000611d02565b95945050505050565b600380546109b8906126c7565b6010546001600160a01b031633146111f65760405162461bcd60e51b815260206004820152601660248201527534b73b30b634b2103ab83230ba32903430b7323632b960511b6044820152606401610aa2565b6001600160a01b03909116600090815260086020526040902055565b61121a6115cb565b6001600160a01b03919091166000908152600c60205260409020805460ff1916911515919091179055565b61124e33611d26565b610ead3382611f48565b6112606115cb565b6001600160a01b0382166000908152601b602052604090205460ff166112cc57601a80546001810182556000919091527f057c384a7d1c54f3a1b2e5e67b2617b8224fdfd1ea7234eea573a6ff665ff63e0180546001600160a01b0319166001600160a01b0384161790555b6001600160a01b039091166000908152601b60209081526040808320805460ff19166001179055601c909152902055565b6113056115cb565b6001600160a01b03919091166000908152601960205260409020805460ff1916911515919091179055565b60006001600160a01b038316330361138a5760405162461bcd60e51b815260206004820152601c60248201527f53656c66207472616e73666572206973206e6f7420616c6c6f776564000000006044820152606401610aa2565b61139333611625565b61139c83611625565b610a46338484611a76565b6113af6115cb565b60026113bb83826127a5565b5060036109a682826127a5565b60006113d26118ff565b610b168283611958565b6113e46115cb565b60125481106114195760405162461bcd60e51b81526020600482015260016024820152600f60fb1b6044820152606401610aa2565b601155565b6114266115cb565b6001600160a01b03919091166000908152600660205260409020805460ff1916911515919091179055565b6001600160a01b0381166000908152601c6020526040812054610bf89061147990600a612949565b600e546001600160a01b03166000908152601c6020526040902054610d37906114a390600a612949565b8690611d0e565b6000600d60029054906101000a90046001600160a01b03166001600160a01b031663a28c5a406040518163ffffffff1660e01b8152600401602060405180830381865afa1580156114ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115239190612701565b905090565b601a818154811061153857600080fd5b6000918252602090912001546001600160a01b0316905081565b61155a6115cb565b6001600160a01b0381166115bf5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610aa2565b6115c881611ef6565b50565b6001546001600160a01b03163314610fba5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610aa2565b600061162f61208e565b42601d55600454601e5491925090811580159061164c5750600083115b156116735761166b610da283610d378668056bc75e2d63100000611d0e565b601e81905590505b6001600160a01b0384161561178e576001600160a01b03841660009081526008602090815260408083205460079092528220546116af91611d1a565b6001600160a01b0386166000908152602080526040812054919250906116e99068056bc75e2d6310000090610d3790610e13908790611cf6565b6001600160a01b0387166000908152601f6020526040812054919250906117109083611d1a565b6001600160a01b0388166000908152601f602090815260408083208490559080529020859055905080158015906117475750600083115b1561178a576001600160a01b03871660009081526021602052604081205461176f9084611d1a565b6001600160a01b038916600090815260216020526040902055505b5050505b50505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526109a6908490612179565b6001600160a01b0383166118475760405162461bcd60e51b815260206004820152602260248201527f454c503a20617070726f76652066726f6d20746865207a65726f206164647265604482015261737360f01b6064820152608401610aa2565b6001600160a01b03821661189d5760405162461bcd60e51b815260206004820181905260248201527f454c503a20617070726f766520746f20746865207a65726f20616464726573736044820152606401610aa2565b6001600160a01b0383811660008181526009602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6002600054036119515760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610aa2565b6002600055565b600061196383611625565b6001600160a01b0383166000908152601f60205260409020548015610bf8576015546017546119929083611d1a565b11156119e05760405162461bcd60e51b815260206004820152601860248201527f4555534420526577617264206f7574206f662072616e676500000000000000006044820152606401610aa2565b6001600160a01b0384166000908152601f6020526040812055601754611a069082611d1a565b601755600e546040516340c10f1960e01b81526001600160a01b03858116600483015260248201849052909116906340c10f1990604401600060405180830381600087803b158015611a5757600080fd5b505af1158015611a6b573d6000803e3d6000fd5b505050509392505050565b6001600160a01b038316611ad85760405162461bcd60e51b815260206004820152602360248201527f454c503a207472616e736665722066726f6d20746865207a65726f206164647260448201526265737360e81b6064820152608401610aa2565b6001600160a01b038216611b385760405162461bcd60e51b815260206004820152602160248201527f454c503a207472616e7366657220746f20746865207a65726f206164647265736044820152607360f81b6064820152608401610aa2565b600b5460ff1615611ba257336000908152600c602052604090205460ff16611ba25760405162461bcd60e51b815260206004820152601f60248201527f454c503a206d73672e73656e646572206e6f742077686974656c6973746564006044820152606401610aa2565b611bdf81604051806060016040528060248152602001612a1c602491396001600160a01b0386166000908152600760205260409020549190611cca565b6001600160a01b038085166000908152600760205260408082209390935590841681522054611c0e9082611d1a565b6001600160a01b038084166000908152600760209081526040808320949094559186168152600a909152205460ff1615611c5357600554611c4f9082611cf6565b6005555b6001600160a01b0382166000908152600a602052604090205460ff1615611c8557600554611c819082611d1a565b6005555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516118f291815260200190565b60008184841115611cee5760405162461bcd60e51b8152600401610aa29190612452565b505050900390565b6000610bf88284612955565b6000610bf88284612968565b6000610bf8828461298a565b6000610bf882846129a9565b6001600160a01b0381166000908152600860209081526040808320546007909252822054611d5391611d1a565b6001600160a01b0383166000908152602080526040812054601e549293509091611d909168056bc75e2d6310000091610d3791610e139190611cf6565b6001600160a01b0384166000908152601f602052604081205491925090611db79083611d1a565b6001600160a01b039094166000908152601f6020908152604080832096909655601e5490805294902093909355505050565b6001600160a01b038216611e3f5760405162461bcd60e51b815260206004820152601d60248201527f454c503a206d696e7420746f20746865207a65726f20616464726573730000006044820152606401610aa2565b600454611e4c9082611d1a565b6004556001600160a01b038216600090815260076020526040902054611e729082611d1a565b6001600160a01b038316600090815260076020908152604080832093909355600a9052205460ff1615611eb057600554611eac9082611d1a565b6005555b6040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020015b60405180910390a35050565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b038216611f9e5760405162461bcd60e51b815260206004820152601f60248201527f454c503a206275726e2066726f6d20746865207a65726f2061646472657373006044820152606401610aa2565b60408051808201825260208082527f454c503a206275726e20616d6f756e7420657863656564732062616c616e6365818301526001600160a01b038516600090815260079091529190912054611ff5918390611cca565b6001600160a01b03831660009081526007602052604090205560045461201b9082611cf6565b6004556001600160a01b0382166000908152600a602052604090205460ff16156120505760055461204c9082611cf6565b6005555b6040518181526000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602001611eea565b6000601d54420361209f5750600090565b60006120ff64e8d4a51000600d60029054906101000a90046001600160a01b03166001600160a01b0316631a64a24e6040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610d13573d6000803e3d6000fd5b9050600181101561211257600091505090565b60135461211f9082611d1a565b60135560125460115460009161213a91610d37908590611d0e565b905080156121535760145461214f9082611d1a565b6014555b600061215f8383611cf6565b60155490915061216f9082611d1a565b6015559392505050565b60006121ce826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661224b9092919063ffffffff16565b8051909150156109a657808060200190518101906121ec91906129bc565b6109a65760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610aa2565b606061225a8484600085612262565b949350505050565b6060824710156122c35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610aa2565b600080866001600160a01b031685876040516122df91906129d9565b60006040518083038185875af1925050503d806000811461231c576040519150601f19603f3d011682016040523d82523d6000602084013e612321565b606091505b50915091506123328783838761233d565b979650505050505050565b606083156123ac5782516000036123a5576001600160a01b0385163b6123a55760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610aa2565b508161225a565b61225a83838151156123c15781518083602001fd5b8060405162461bcd60e51b8152600401610aa29190612452565b80356001600160a01b0381168114610b2257600080fd5b60008060006060848603121561240757600080fd5b612410846123db565b925061241e602085016123db565b9150604084013590509250925092565b60005b83811015612449578181015183820152602001612431565b50506000910152565b602081526000825180602084015261247181604085016020870161242e565b601f01601f19169190910160400192915050565b6000806040838503121561249857600080fd5b6124a1836123db565b946020939093013593505050565b6000602082840312156124c157600080fd5b610bf8826123db565b600080604083850312156124dd57600080fd5b6124e6836123db565b91506124f4602084016123db565b90509250929050565b803567ffffffffffffffff81168114610b2257600080fd5b6000806040838503121561252857600080fd5b612531836124fd565b91506124f4602084016124fd565b80151581146115c857600080fd5b6000806040838503121561256057600080fd5b612569836123db565b915060208301356125798161253f565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126125ab57600080fd5b813567ffffffffffffffff808211156125c6576125c6612584565b604051601f8301601f19908116603f011681019082821181831017156125ee576125ee612584565b8160405283815286602085880101111561260757600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806040838503121561263a57600080fd5b823567ffffffffffffffff8082111561265257600080fd5b61265e8683870161259a565b9350602085013591508082111561267457600080fd5b506126818582860161259a565b9150509250929050565b60006020828403121561269d57600080fd5b5035919050565b600080604083850312156126b757600080fd5b823591506124f4602084016123db565b600181811c908216806126db57607f821691505b6020821081036126fb57634e487b7160e01b600052602260045260246000fd5b50919050565b60006020828403121561271357600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600067ffffffffffffffff80831681810361274d5761274d61271a565b6001019392505050565b601f8211156109a657600081815260208120601f850160051c8101602086101561277e5750805b601f850160051c820191505b8181101561279d5782815560010161278a565b505050505050565b815167ffffffffffffffff8111156127bf576127bf612584565b6127d3816127cd84546126c7565b84612757565b602080601f83116001811461280857600084156127f05750858301515b600019600386901b1c1916600185901b17855561279d565b600085815260208120601f198616915b8281101561283757888601518255948401946001909101908401612818565b50858210156128555787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600181815b808511156128a05781600019048211156128865761288661271a565b8085161561289357918102915b93841c939080029061286a565b509250929050565b6000826128b757506001610a4a565b816128c457506000610a4a565b81600181146128da57600281146128e457612900565b6001915050610a4a565b60ff8411156128f5576128f561271a565b50506001821b610a4a565b5060208310610133831016604e8410600b8410161715612923575081810a610a4a565b61292d8383612865565b80600019048211156129415761294161271a565b029392505050565b6000610bf883836128a8565b81810381811115610a4a57610a4a61271a565b60008261298557634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156129a4576129a461271a565b500290565b80820180821115610a4a57610a4a61271a565b6000602082840312156129ce57600080fd5b8151610bf88161253f565b600082516129eb81846020870161242e565b919091019291505056fe454c503a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365454c503a207472616e7366657220616d6f756e7420657863656564732062616c616e6365a2646970667358221220dee71fe5135c2b898fad2c452b15d5b04351fee9366d280cccacaa138a6391d864736f6c63430008100033000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000005454c502d310000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005454c502d31000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106103f15760003560e01c80638da5cb5b11610215578063c04d63da11610125578063dd62ed3e116100b8578063f2fde38b11610087578063f2fde38b14610909578063f3ae24151461091c578063f5fc50761461093f578063f993185514610948578063fbfa77cf1461096857600080fd5b8063dd62ed3e14610890578063dfbaefb1146108c9578063e468baf0146108d6578063e9503425146108e957600080fd5b8063cf456ae7116100f4578063cf456ae71461083f578063d8d46b5014610852578063daf9c21014610865578063dccc84ac1461088857600080fd5b8063c04d63da14610811578063c93be63614610824578063c9e1431c1461082d578063cb0110461461083657600080fd5b80639cb7de4b116101a8578063a5e90eee11610177578063a5e90eee146107a2578063a9059cbb146107b5578063a923fc40146107c8578063aa271e1a146107db578063afd6a5cc146107fe57600080fd5b80639cb7de4b146107605780639dc29fac14610773578063a313e28514610786578063a41a29541461078f57600080fd5b806395d89b41116101e457806395d89b411461073257806397313e381461073a5780639849e4121461074d5780639bbaee101461075757600080fd5b80638da5cb5b146106d55780638ee573ac146106e65780639554381a1461070657806395800e461461072957600080fd5b8063392e53cd1161031057806355b6ed5c116102a3578063715018a611610272578063715018a61461067e57806375b17350146106865780637cc2ac8f1461068f578063838172e2146106a25780638b770e11146106b557600080fd5b806355b6ed5c146106045780635b7f169a1461062f5780636019f28a1461064257806370a082311461065557600080fd5b806344a08411116102df57806344a08411146105a657806346ea87af146105c55780634e8edcb0146105e857806352b98766146105fb57600080fd5b8063392e53cd1461055e5780633d6aa5e114610570578063402914f51461058057806340c10f191461059357600080fd5b8063210e674211610388578063313ce56711610357578063313ce5671461050e578063351a964d146105285780633792def314610535578063380726871461055557600080fd5b8063210e6742146104c757806323b872dd146104d357806327e235e3146104e657806330167eda1461050657600080fd5b806318160ddd116103c457806318160ddd1461045f5780631a42c00b146104765780631e83409a146104a1578063203d81c1146104b457600080fd5b806301e33667146103f657806306fdde031461040b578063095ea7b3146104295780631794bb3c1461044c575b600080fd5b6104096104043660046123f2565b610981565b005b6104136109ab565b6040516104209190612452565b60405180910390f35b61043c610437366004612485565b610a39565b6040519015158152602001610420565b61040961045a3660046123f2565b610a50565b61046860045481565b604051908152602001610420565b600f54610489906001600160a01b031681565b6040516001600160a01b039091168152602001610420565b6104686104af3660046124af565b610b02565b6104096104c23660046124af565b610b27565b61046864e8d4a5100081565b61043c6104e13660046123f2565b610b51565b6104686104f43660046124af565b60076020526000908152604090205481565b610468610bff565b610516601281565b60405160ff9091168152602001610420565b600d5461043c9060ff1681565b6104686105433660046124af565b60216020526000908152604090205481565b61046860115481565b600d5461043c90610100900460ff1681565b61046868056bc75e2d6310000081565b61046861058e3660046124af565b610cb4565b6104096105a1366004612485565b610e4f565b6104686105b43660046124af565b602080526000908152604090205481565b61043c6105d33660046124af565b600c6020526000908152604090205460ff1681565b6104686105f63660046124af565b610eb1565b61046860135481565b6104686106123660046124ca565b600960209081526000928352604080842090915290825290205481565b601054610489906001600160a01b031681565b600e54610489906001600160a01b031681565b6104686106633660046124af565b6001600160a01b031660009081526007602052604090205490565b610409610fa8565b610468601d5481565b61040961069d3660046124af565b610fbc565b6104686106b0366004612515565b610fe6565b6104686106c33660046124af565b60186020526000908152604090205481565b6001546001600160a01b0316610489565b6104686106f43660046124af565b601c6020526000908152604090205481565b61043c6107143660046124af565b600a6020526000908152604090205460ff1681565b61046860175481565b610413611196565b610409610748366004612485565b6111a3565b6104686201518081565b61046860145481565b61040961076e36600461254d565b611212565b610409610781366004612485565b611245565b61046860165481565b61040961079d366004612485565b611258565b6104096107b036600461254d565b6112fd565b61043c6107c3366004612485565b611330565b6104096107d6366004612627565b6113a7565b61043c6107e93660046124af565b60066020526000908152604090205460ff1681565b61046861080c3660046124af565b6113c8565b61040961081f36600461268b565b6113dc565b61046860055481565b61046860155481565b61046860125481565b61040961084d36600461254d565b61141e565b6104686108603660046126a4565b611451565b61043c6108733660046124af565b601b6020526000908152604090205460ff1681565b6104686114aa565b61046861089e3660046124ca565b6001600160a01b03918216600090815260096020908152604080832093909416825291909152205490565b600b5461043c9060ff1681565b6104896108e436600461268b565b611528565b6104686108f73660046124af565b601f6020526000908152604090205481565b6104096109173660046124af565b611552565b61043c61092a3660046124af565b60196020526000908152604090205460ff1681565b610468601e5481565b6104686109563660046124af565b60086020526000908152604090205481565b600d54610489906201000090046001600160a01b031681565b6109896115cb565b61099282611625565b6109a66001600160a01b0384168383611794565b505050565b600280546109b8906126c7565b80601f01602080910402602001604051908101604052809291908181526020018280546109e4906126c7565b8015610a315780601f10610a0657610100808354040283529160200191610a31565b820191906000526020600020905b815481529060010190602001808311610a1457829003601f168201915b505050505081565b6000610a463384846117e6565b5060015b92915050565b610a586115cb565b600d54610100900460ff1615610aab5760405162461bcd60e51b8152602060048201526013602482015272185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b60448201526064015b60405180910390fd5b600d8054600e80546001600160a01b039586166001600160a01b03199091168117909155949093166201000002610100600160b01b031990931692909217610100179091556000918252601c602052604090912055565b6000610b0c6118ff565b610b163383611958565b9050610b226001600055565b919050565b610b2f6115cb565b600f80546001600160a01b0319166001600160a01b0392909216919091179055565b6000610b5c84611625565b610b6583611625565b336000908152600c602052604090205460ff1615610b9057610b88848484611a76565b506001610bf8565b6000610bda836040518060600160405280602681526020016129f6602691396001600160a01b03881660009081526009602090815260408083203384529091529020549190611cca565b9050610be78533836117e6565b610bf2858585611a76565b60019150505b9392505050565b600f5460009081906001600160a01b031615801590610c215750601654601454115b15610b2257610c306000611625565b601654601454610c3f91611cf6565b600e54600f546040516340c10f1960e01b81526001600160a01b0391821660048201526024810184905292935016906340c10f1990604401600060405180830381600087803b158015610c9157600080fd5b505af1158015610ca5573d6000803e3d6000fd5b50506014546016555050919050565b600080610d3d64e8d4a51000600d60029054906101000a90046001600160a01b03166001600160a01b031663995e93df6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d379190612701565b90611d02565b90506000610d5c601254610d3760115485611d0e90919063ffffffff16565b90506000610d6a8383611cf6565b600454601e54919250908115801590610d835750600083115b15610dac57610da9610da283610d378668056bc75e2d63100000611d0e565b8290611d1a565b90505b6001600160a01b0387166000908152600860209081526040808320546007909252822054610dd991611d1a565b6001600160a01b038916600090815260208052604081205491925090610e1a9068056bc75e2d6310000090610d3790610e13908790611cf6565b8590611d0e565b6001600160a01b038a166000908152601f602052604081205491925090610e419083611d1a565b9a9950505050505050505050565b3360009081526006602052604090205460ff16610e9a5760405162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b6044820152606401610aa2565b610ea382611d26565b610ead8282611de9565b5050565b600d54604051630fd074c160e41b81526001600160a01b038381166004830152600092610a4a92620100009091049091169063fd074c1090602401602060405180830381865afa158015610f09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f2d9190612701565b600d54604051631ce9cb8f60e01b81526001600160a01b0386811660048301526201000090920490911690631ce9cb8f90602401602060405180830381865afa158015610f7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fa29190612701565b90611cf6565b610fb06115cb565b610fba6000611ef6565b565b610fc46115cb565b601080546001600160a01b0319166001600160a01b0392909216919091179055565b6000808367ffffffffffffffff1611801561100b5750601e8367ffffffffffffffff16105b6110465760405162461bcd60e51b815260206004820152600c60248201526b696e76616c6964206461797360a01b6044820152606401610aa2565b601e8267ffffffffffffffff16106110955760405162461bcd60e51b8152602060048201526012602482015271696e76616c6964205f73686966744461797360701b6044820152606401610aa2565b60006110b267ffffffffffffffff8416610fa24262015180611d02565b90506000805b8567ffffffffffffffff168167ffffffffffffffff16101561117d57600d54611169906201000090046001600160a01b031663390f03c66111038667ffffffffffffffff8616611cf6565b6040518263ffffffff1660e01b815260040161112191815260200190565b602060405180830381865afa15801561113e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111629190612701565b8390611d1a565b91508061117581612730565b9150506110b8565b5061118d8164e8d4a51000611d02565b95945050505050565b600380546109b8906126c7565b6010546001600160a01b031633146111f65760405162461bcd60e51b815260206004820152601660248201527534b73b30b634b2103ab83230ba32903430b7323632b960511b6044820152606401610aa2565b6001600160a01b03909116600090815260086020526040902055565b61121a6115cb565b6001600160a01b03919091166000908152600c60205260409020805460ff1916911515919091179055565b61124e33611d26565b610ead3382611f48565b6112606115cb565b6001600160a01b0382166000908152601b602052604090205460ff166112cc57601a80546001810182556000919091527f057c384a7d1c54f3a1b2e5e67b2617b8224fdfd1ea7234eea573a6ff665ff63e0180546001600160a01b0319166001600160a01b0384161790555b6001600160a01b039091166000908152601b60209081526040808320805460ff19166001179055601c909152902055565b6113056115cb565b6001600160a01b03919091166000908152601960205260409020805460ff1916911515919091179055565b60006001600160a01b038316330361138a5760405162461bcd60e51b815260206004820152601c60248201527f53656c66207472616e73666572206973206e6f7420616c6c6f776564000000006044820152606401610aa2565b61139333611625565b61139c83611625565b610a46338484611a76565b6113af6115cb565b60026113bb83826127a5565b5060036109a682826127a5565b60006113d26118ff565b610b168283611958565b6113e46115cb565b60125481106114195760405162461bcd60e51b81526020600482015260016024820152600f60fb1b6044820152606401610aa2565b601155565b6114266115cb565b6001600160a01b03919091166000908152600660205260409020805460ff1916911515919091179055565b6001600160a01b0381166000908152601c6020526040812054610bf89061147990600a612949565b600e546001600160a01b03166000908152601c6020526040902054610d37906114a390600a612949565b8690611d0e565b6000600d60029054906101000a90046001600160a01b03166001600160a01b031663a28c5a406040518163ffffffff1660e01b8152600401602060405180830381865afa1580156114ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115239190612701565b905090565b601a818154811061153857600080fd5b6000918252602090912001546001600160a01b0316905081565b61155a6115cb565b6001600160a01b0381166115bf5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610aa2565b6115c881611ef6565b50565b6001546001600160a01b03163314610fba5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610aa2565b600061162f61208e565b42601d55600454601e5491925090811580159061164c5750600083115b156116735761166b610da283610d378668056bc75e2d63100000611d0e565b601e81905590505b6001600160a01b0384161561178e576001600160a01b03841660009081526008602090815260408083205460079092528220546116af91611d1a565b6001600160a01b0386166000908152602080526040812054919250906116e99068056bc75e2d6310000090610d3790610e13908790611cf6565b6001600160a01b0387166000908152601f6020526040812054919250906117109083611d1a565b6001600160a01b0388166000908152601f602090815260408083208490559080529020859055905080158015906117475750600083115b1561178a576001600160a01b03871660009081526021602052604081205461176f9084611d1a565b6001600160a01b038916600090815260216020526040902055505b5050505b50505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526109a6908490612179565b6001600160a01b0383166118475760405162461bcd60e51b815260206004820152602260248201527f454c503a20617070726f76652066726f6d20746865207a65726f206164647265604482015261737360f01b6064820152608401610aa2565b6001600160a01b03821661189d5760405162461bcd60e51b815260206004820181905260248201527f454c503a20617070726f766520746f20746865207a65726f20616464726573736044820152606401610aa2565b6001600160a01b0383811660008181526009602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6002600054036119515760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610aa2565b6002600055565b600061196383611625565b6001600160a01b0383166000908152601f60205260409020548015610bf8576015546017546119929083611d1a565b11156119e05760405162461bcd60e51b815260206004820152601860248201527f4555534420526577617264206f7574206f662072616e676500000000000000006044820152606401610aa2565b6001600160a01b0384166000908152601f6020526040812055601754611a069082611d1a565b601755600e546040516340c10f1960e01b81526001600160a01b03858116600483015260248201849052909116906340c10f1990604401600060405180830381600087803b158015611a5757600080fd5b505af1158015611a6b573d6000803e3d6000fd5b505050509392505050565b6001600160a01b038316611ad85760405162461bcd60e51b815260206004820152602360248201527f454c503a207472616e736665722066726f6d20746865207a65726f206164647260448201526265737360e81b6064820152608401610aa2565b6001600160a01b038216611b385760405162461bcd60e51b815260206004820152602160248201527f454c503a207472616e7366657220746f20746865207a65726f206164647265736044820152607360f81b6064820152608401610aa2565b600b5460ff1615611ba257336000908152600c602052604090205460ff16611ba25760405162461bcd60e51b815260206004820152601f60248201527f454c503a206d73672e73656e646572206e6f742077686974656c6973746564006044820152606401610aa2565b611bdf81604051806060016040528060248152602001612a1c602491396001600160a01b0386166000908152600760205260409020549190611cca565b6001600160a01b038085166000908152600760205260408082209390935590841681522054611c0e9082611d1a565b6001600160a01b038084166000908152600760209081526040808320949094559186168152600a909152205460ff1615611c5357600554611c4f9082611cf6565b6005555b6001600160a01b0382166000908152600a602052604090205460ff1615611c8557600554611c819082611d1a565b6005555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516118f291815260200190565b60008184841115611cee5760405162461bcd60e51b8152600401610aa29190612452565b505050900390565b6000610bf88284612955565b6000610bf88284612968565b6000610bf8828461298a565b6000610bf882846129a9565b6001600160a01b0381166000908152600860209081526040808320546007909252822054611d5391611d1a565b6001600160a01b0383166000908152602080526040812054601e549293509091611d909168056bc75e2d6310000091610d3791610e139190611cf6565b6001600160a01b0384166000908152601f602052604081205491925090611db79083611d1a565b6001600160a01b039094166000908152601f6020908152604080832096909655601e5490805294902093909355505050565b6001600160a01b038216611e3f5760405162461bcd60e51b815260206004820152601d60248201527f454c503a206d696e7420746f20746865207a65726f20616464726573730000006044820152606401610aa2565b600454611e4c9082611d1a565b6004556001600160a01b038216600090815260076020526040902054611e729082611d1a565b6001600160a01b038316600090815260076020908152604080832093909355600a9052205460ff1615611eb057600554611eac9082611d1a565b6005555b6040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020015b60405180910390a35050565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b038216611f9e5760405162461bcd60e51b815260206004820152601f60248201527f454c503a206275726e2066726f6d20746865207a65726f2061646472657373006044820152606401610aa2565b60408051808201825260208082527f454c503a206275726e20616d6f756e7420657863656564732062616c616e6365818301526001600160a01b038516600090815260079091529190912054611ff5918390611cca565b6001600160a01b03831660009081526007602052604090205560045461201b9082611cf6565b6004556001600160a01b0382166000908152600a602052604090205460ff16156120505760055461204c9082611cf6565b6005555b6040518181526000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602001611eea565b6000601d54420361209f5750600090565b60006120ff64e8d4a51000600d60029054906101000a90046001600160a01b03166001600160a01b0316631a64a24e6040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610d13573d6000803e3d6000fd5b9050600181101561211257600091505090565b60135461211f9082611d1a565b60135560125460115460009161213a91610d37908590611d0e565b905080156121535760145461214f9082611d1a565b6014555b600061215f8383611cf6565b60155490915061216f9082611d1a565b6015559392505050565b60006121ce826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661224b9092919063ffffffff16565b8051909150156109a657808060200190518101906121ec91906129bc565b6109a65760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610aa2565b606061225a8484600085612262565b949350505050565b6060824710156122c35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610aa2565b600080866001600160a01b031685876040516122df91906129d9565b60006040518083038185875af1925050503d806000811461231c576040519150601f19603f3d011682016040523d82523d6000602084013e612321565b606091505b50915091506123328783838761233d565b979650505050505050565b606083156123ac5782516000036123a5576001600160a01b0385163b6123a55760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610aa2565b508161225a565b61225a83838151156123c15781518083602001fd5b8060405162461bcd60e51b8152600401610aa29190612452565b80356001600160a01b0381168114610b2257600080fd5b60008060006060848603121561240757600080fd5b612410846123db565b925061241e602085016123db565b9150604084013590509250925092565b60005b83811015612449578181015183820152602001612431565b50506000910152565b602081526000825180602084015261247181604085016020870161242e565b601f01601f19169190910160400192915050565b6000806040838503121561249857600080fd5b6124a1836123db565b946020939093013593505050565b6000602082840312156124c157600080fd5b610bf8826123db565b600080604083850312156124dd57600080fd5b6124e6836123db565b91506124f4602084016123db565b90509250929050565b803567ffffffffffffffff81168114610b2257600080fd5b6000806040838503121561252857600080fd5b612531836124fd565b91506124f4602084016124fd565b80151581146115c857600080fd5b6000806040838503121561256057600080fd5b612569836123db565b915060208301356125798161253f565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126125ab57600080fd5b813567ffffffffffffffff808211156125c6576125c6612584565b604051601f8301601f19908116603f011681019082821181831017156125ee576125ee612584565b8160405283815286602085880101111561260757600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806040838503121561263a57600080fd5b823567ffffffffffffffff8082111561265257600080fd5b61265e8683870161259a565b9350602085013591508082111561267457600080fd5b506126818582860161259a565b9150509250929050565b60006020828403121561269d57600080fd5b5035919050565b600080604083850312156126b757600080fd5b823591506124f4602084016123db565b600181811c908216806126db57607f821691505b6020821081036126fb57634e487b7160e01b600052602260045260246000fd5b50919050565b60006020828403121561271357600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600067ffffffffffffffff80831681810361274d5761274d61271a565b6001019392505050565b601f8211156109a657600081815260208120601f850160051c8101602086101561277e5750805b601f850160051c820191505b8181101561279d5782815560010161278a565b505050505050565b815167ffffffffffffffff8111156127bf576127bf612584565b6127d3816127cd84546126c7565b84612757565b602080601f83116001811461280857600084156127f05750858301515b600019600386901b1c1916600185901b17855561279d565b600085815260208120601f198616915b8281101561283757888601518255948401946001909101908401612818565b50858210156128555787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600181815b808511156128a05781600019048211156128865761288661271a565b8085161561289357918102915b93841c939080029061286a565b509250929050565b6000826128b757506001610a4a565b816128c457506000610a4a565b81600181146128da57600281146128e457612900565b6001915050610a4a565b60ff8411156128f5576128f561271a565b50506001821b610a4a565b5060208310610133831016604e8410600b8410161715612923575081810a610a4a565b61292d8383612865565b80600019048211156129415761294161271a565b029392505050565b6000610bf883836128a8565b81810381811115610a4a57610a4a61271a565b60008261298557634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156129a4576129a461271a565b500290565b80820180821115610a4a57610a4a61271a565b6000602082840312156129ce57600080fd5b8151610bf88161253f565b600082516129eb81846020870161242e565b919091019291505056fe454c503a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365454c503a207472616e7366657220616d6f756e7420657863656564732062616c616e6365a2646970667358221220dee71fe5135c2b898fad2c452b15d5b04351fee9366d280cccacaa138a6391d864736f6c63430008100033

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

000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000005454c502d310000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005454c502d31000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _name (string): ELP-1
Arg [1] : _symbol (string): ELP-1

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [3] : 454c502d31000000000000000000000000000000000000000000000000000000
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [5] : 454c502d31000000000000000000000000000000000000000000000000000000


Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.