ETH Price: $3,124.90 (+1.95%)

Token

XEN Crypto (XEN)
 

Overview

Max Total Supply

150,212,439,646,060.539253544320506155 XEN

Holders

177,006 ( 0.015%)

Market

Price

$0.00 @ 0.000000 ETH (+4.23%)

Onchain Market Cap

$21,747,005.95

Circulating Supply Market Cap

$21,564,868.00

Other Info

Token Contract (WITH 18 Decimals)

Balance
0 XEN

Value
$0.00
0x591d4056d2169f900e2025907b7d8d17371f50f4
Loading...
Loading
Loading...
Loading
Loading...
Loading

OVERVIEW

XEN aims to become a community-building crypto asset that connects like minded people together and provide the lowest barrier to entry through its unique tokenomics.

Market

Volume (24H):$4,509,624.00
Market Capitalization:$21,564,868.00
Circulating Supply:150,205,143,719,752.00 XEN
Market Data Source: Coinmarketcap

# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
XENCrypto

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 20 runs

Other Settings:
default evmVersion
File 1 of 13 : XENCrypto.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;

import "./Math.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/interfaces/IERC165.sol";
import "abdk-libraries-solidity/ABDKMath64x64.sol";
import "./interfaces/IStakingToken.sol";
import "./interfaces/IRankedMintingToken.sol";
import "./interfaces/IBurnableToken.sol";
import "./interfaces/IBurnRedeemable.sol";

contract XENCrypto is Context, IRankedMintingToken, IStakingToken, IBurnableToken, ERC20("XEN Crypto", "XEN") {
    using Math for uint256;
    using ABDKMath64x64 for int128;
    using ABDKMath64x64 for uint256;

    // INTERNAL TYPE TO DESCRIBE A XEN MINT INFO
    struct MintInfo {
        address user;
        uint256 term;
        uint256 maturityTs;
        uint256 rank;
        uint256 amplifier;
        uint256 eaaRate;
    }

    // INTERNAL TYPE TO DESCRIBE A XEN STAKE
    struct StakeInfo {
        uint256 term;
        uint256 maturityTs;
        uint256 amount;
        uint256 apy;
    }

    // PUBLIC CONSTANTS

    uint256 public constant SECONDS_IN_DAY = 3_600 * 24;
    uint256 public constant DAYS_IN_YEAR = 365;

    uint256 public constant GENESIS_RANK = 1;

    uint256 public constant MIN_TERM = 1 * SECONDS_IN_DAY - 1;
    uint256 public constant MAX_TERM_START = 100 * SECONDS_IN_DAY;
    uint256 public constant MAX_TERM_END = 1_000 * SECONDS_IN_DAY;
    uint256 public constant TERM_AMPLIFIER = 15;
    uint256 public constant TERM_AMPLIFIER_THRESHOLD = 5_000;
    uint256 public constant REWARD_AMPLIFIER_START = 3_000;
    uint256 public constant REWARD_AMPLIFIER_END = 1;
    uint256 public constant EAA_PM_START = 100;
    uint256 public constant EAA_PM_STEP = 1;
    uint256 public constant EAA_RANK_STEP = 100_000;
    uint256 public constant WITHDRAWAL_WINDOW_DAYS = 7;
    uint256 public constant MAX_PENALTY_PCT = 99;

    uint256 public constant XEN_MIN_STAKE = 0;

    uint256 public constant XEN_MIN_BURN = 0;

    uint256 public constant XEN_APY_START = 20;
    uint256 public constant XEN_APY_DAYS_STEP = 90;
    uint256 public constant XEN_APY_END = 2;

    string public constant AUTHORS = "@MrJackLevin @lbelyaev faircrypto.org";

    // PUBLIC STATE, READABLE VIA NAMESAKE GETTERS

    uint256 public immutable genesisTs;
    uint256 public globalRank = GENESIS_RANK;
    uint256 public activeMinters;
    uint256 public activeStakes;
    uint256 public totalXenStaked;
    // user address => XEN mint info
    mapping(address => MintInfo) public userMints;
    // user address => XEN stake info
    mapping(address => StakeInfo) public userStakes;
    // user address => XEN burn amount
    mapping(address => uint256) public userBurns;

    // CONSTRUCTOR
    constructor() {
        genesisTs = block.timestamp;
    }

    // PRIVATE METHODS

    /**
     * @dev calculates current MaxTerm based on Global Rank
     *      (if Global Rank crosses over TERM_AMPLIFIER_THRESHOLD)
     */
    function _calculateMaxTerm() private view returns (uint256) {
        if (globalRank > TERM_AMPLIFIER_THRESHOLD) {
            uint256 delta = globalRank.fromUInt().log_2().mul(TERM_AMPLIFIER.fromUInt()).toUInt();
            uint256 newMax = MAX_TERM_START + delta * SECONDS_IN_DAY;
            return Math.min(newMax, MAX_TERM_END);
        }
        return MAX_TERM_START;
    }

    /**
     * @dev calculates Withdrawal Penalty depending on lateness
     */
    function _penalty(uint256 secsLate) private pure returns (uint256) {
        // =MIN(2^(daysLate+3)/window-1,99)
        uint256 daysLate = secsLate / SECONDS_IN_DAY;
        if (daysLate > WITHDRAWAL_WINDOW_DAYS - 1) return MAX_PENALTY_PCT;
        uint256 penalty = (uint256(1) << (daysLate + 3)) / WITHDRAWAL_WINDOW_DAYS - 1;
        return Math.min(penalty, MAX_PENALTY_PCT);
    }

    /**
     * @dev calculates net Mint Reward (adjusted for Penalty)
     */
    function _calculateMintReward(
        uint256 cRank,
        uint256 term,
        uint256 maturityTs,
        uint256 amplifier,
        uint256 eeaRate
    ) private view returns (uint256) {
        uint256 secsLate = block.timestamp - maturityTs;
        uint256 penalty = _penalty(secsLate);
        uint256 rankDelta = Math.max(globalRank - cRank, 2);
        uint256 EAA = (1_000 + eeaRate);
        uint256 reward = getGrossReward(rankDelta, amplifier, term, EAA);
        return (reward * (100 - penalty)) / 100;
    }

    /**
     * @dev cleans up User Mint storage (gets some Gas credit;))
     */
    function _cleanUpUserMint() private {
        delete userMints[_msgSender()];
        activeMinters--;
    }

    /**
     * @dev calculates XEN Stake Reward
     */
    function _calculateStakeReward(
        uint256 amount,
        uint256 term,
        uint256 maturityTs,
        uint256 apy
    ) private view returns (uint256) {
        if (block.timestamp > maturityTs) {
            uint256 rate = (apy * term * 1_000_000) / DAYS_IN_YEAR;
            return (amount * rate) / 100_000_000;
        }
        return 0;
    }

    /**
     * @dev calculates Reward Amplifier
     */
    function _calculateRewardAmplifier() private view returns (uint256) {
        uint256 amplifierDecrease = (block.timestamp - genesisTs) / SECONDS_IN_DAY;
        if (amplifierDecrease < REWARD_AMPLIFIER_START) {
            return Math.max(REWARD_AMPLIFIER_START - amplifierDecrease, REWARD_AMPLIFIER_END);
        } else {
            return REWARD_AMPLIFIER_END;
        }
    }

    /**
     * @dev calculates Early Adopter Amplifier Rate (in 1/000ths)
     *      actual EAA is (1_000 + EAAR) / 1_000
     */
    function _calculateEAARate() private view returns (uint256) {
        uint256 decrease = (EAA_PM_STEP * globalRank) / EAA_RANK_STEP;
        if (decrease > EAA_PM_START) return 0;
        return EAA_PM_START - decrease;
    }

    /**
     * @dev calculates APY (in %)
     */
    function _calculateAPY() private view returns (uint256) {
        uint256 decrease = (block.timestamp - genesisTs) / (SECONDS_IN_DAY * XEN_APY_DAYS_STEP);
        if (XEN_APY_START - XEN_APY_END < decrease) return XEN_APY_END;
        return XEN_APY_START - decrease;
    }

    /**
     * @dev creates User Stake
     */
    function _createStake(uint256 amount, uint256 term) private {
        userStakes[_msgSender()] = StakeInfo({
            term: term,
            maturityTs: block.timestamp + term * SECONDS_IN_DAY,
            amount: amount,
            apy: _calculateAPY()
        });
        activeStakes++;
        totalXenStaked += amount;
    }

    // PUBLIC CONVENIENCE GETTERS

    /**
     * @dev calculates gross Mint Reward
     */
    function getGrossReward(
        uint256 rankDelta,
        uint256 amplifier,
        uint256 term,
        uint256 eaa
    ) public pure returns (uint256) {
        int128 log128 = rankDelta.fromUInt().log_2();
        int128 reward128 = log128.mul(amplifier.fromUInt()).mul(term.fromUInt()).mul(eaa.fromUInt());
        return reward128.div(uint256(1_000).fromUInt()).toUInt();
    }

    /**
     * @dev returns User Mint object associated with User account address
     */
    function getUserMint() external view returns (MintInfo memory) {
        return userMints[_msgSender()];
    }

    /**
     * @dev returns XEN Stake object associated with User account address
     */
    function getUserStake() external view returns (StakeInfo memory) {
        return userStakes[_msgSender()];
    }

    /**
     * @dev returns current AMP
     */
    function getCurrentAMP() external view returns (uint256) {
        return _calculateRewardAmplifier();
    }

    /**
     * @dev returns current EAA Rate
     */
    function getCurrentEAAR() external view returns (uint256) {
        return _calculateEAARate();
    }

    /**
     * @dev returns current APY
     */
    function getCurrentAPY() external view returns (uint256) {
        return _calculateAPY();
    }

    /**
     * @dev returns current MaxTerm
     */
    function getCurrentMaxTerm() external view returns (uint256) {
        return _calculateMaxTerm();
    }

    // PUBLIC STATE-CHANGING METHODS

    /**
     * @dev accepts User cRank claim provided all checks pass (incl. no current claim exists)
     */
    function claimRank(uint256 term) external {
        uint256 termSec = term * SECONDS_IN_DAY;
        require(termSec > MIN_TERM, "CRank: Term less than min");
        require(termSec < _calculateMaxTerm() + 1, "CRank: Term more than current max term");
        require(userMints[_msgSender()].rank == 0, "CRank: Mint already in progress");

        // create and store new MintInfo
        MintInfo memory mintInfo = MintInfo({
            user: _msgSender(),
            term: term,
            maturityTs: block.timestamp + termSec,
            rank: globalRank,
            amplifier: _calculateRewardAmplifier(),
            eaaRate: _calculateEAARate()
        });
        userMints[_msgSender()] = mintInfo;
        activeMinters++;
        emit RankClaimed(_msgSender(), term, globalRank++);
    }

    /**
     * @dev ends minting upon maturity (and within permitted Withdrawal Time Window), gets minted XEN
     */
    function claimMintReward() external {
        MintInfo memory mintInfo = userMints[_msgSender()];
        require(mintInfo.rank > 0, "CRank: No mint exists");
        require(block.timestamp > mintInfo.maturityTs, "CRank: Mint maturity not reached");

        // calculate reward and mint tokens
        uint256 rewardAmount = _calculateMintReward(
            mintInfo.rank,
            mintInfo.term,
            mintInfo.maturityTs,
            mintInfo.amplifier,
            mintInfo.eaaRate
        ) * 1 ether;
        _mint(_msgSender(), rewardAmount);

        _cleanUpUserMint();
        emit MintClaimed(_msgSender(), rewardAmount);
    }

    /**
     * @dev  ends minting upon maturity (and within permitted Withdrawal time Window)
     *       mints XEN coins and splits them between User and designated other address
     */
    function claimMintRewardAndShare(address other, uint256 pct) external {
        MintInfo memory mintInfo = userMints[_msgSender()];
        require(other != address(0), "CRank: Cannot share with zero address");
        require(pct > 0, "CRank: Cannot share zero percent");
        require(pct < 101, "CRank: Cannot share 100+ percent");
        require(mintInfo.rank > 0, "CRank: No mint exists");
        require(block.timestamp > mintInfo.maturityTs, "CRank: Mint maturity not reached");

        // calculate reward
        uint256 rewardAmount = _calculateMintReward(
            mintInfo.rank,
            mintInfo.term,
            mintInfo.maturityTs,
            mintInfo.amplifier,
            mintInfo.eaaRate
        ) * 1 ether;
        uint256 sharedReward = (rewardAmount * pct) / 100;
        uint256 ownReward = rewardAmount - sharedReward;

        // mint reward tokens
        _mint(_msgSender(), ownReward);
        _mint(other, sharedReward);

        _cleanUpUserMint();
        emit MintClaimed(_msgSender(), rewardAmount);
    }

    /**
     * @dev  ends minting upon maturity (and within permitted Withdrawal time Window)
     *       mints XEN coins and stakes 'pct' of it for 'term'
     */
    function claimMintRewardAndStake(uint256 pct, uint256 term) external {
        MintInfo memory mintInfo = userMints[_msgSender()];
        // require(pct > 0, "CRank: Cannot share zero percent");
        require(pct < 101, "CRank: Cannot share >100 percent");
        require(mintInfo.rank > 0, "CRank: No mint exists");
        require(block.timestamp > mintInfo.maturityTs, "CRank: Mint maturity not reached");

        // calculate reward
        uint256 rewardAmount = _calculateMintReward(
            mintInfo.rank,
            mintInfo.term,
            mintInfo.maturityTs,
            mintInfo.amplifier,
            mintInfo.eaaRate
        ) * 1 ether;
        uint256 stakedReward = (rewardAmount * pct) / 100;
        uint256 ownReward = rewardAmount - stakedReward;

        // mint reward tokens part
        _mint(_msgSender(), ownReward);
        _cleanUpUserMint();
        emit MintClaimed(_msgSender(), rewardAmount);

        // nothing to burn since we haven't minted this part yet
        // stake extra tokens part
        require(stakedReward > XEN_MIN_STAKE, "XEN: Below min stake");
        require(term * SECONDS_IN_DAY > MIN_TERM, "XEN: Below min stake term");
        require(term * SECONDS_IN_DAY < MAX_TERM_END + 1, "XEN: Above max stake term");
        require(userStakes[_msgSender()].amount == 0, "XEN: stake exists");

        _createStake(stakedReward, term);
        emit Staked(_msgSender(), stakedReward, term);
    }

    /**
     * @dev initiates XEN Stake in amount for a term (days)
     */
    function stake(uint256 amount, uint256 term) external {
        require(balanceOf(_msgSender()) >= amount, "XEN: not enough balance");
        require(amount > XEN_MIN_STAKE, "XEN: Below min stake");
        require(term * SECONDS_IN_DAY > MIN_TERM, "XEN: Below min stake term");
        require(term * SECONDS_IN_DAY < MAX_TERM_END + 1, "XEN: Above max stake term");
        require(userStakes[_msgSender()].amount == 0, "XEN: stake exists");

        // burn staked XEN
        _burn(_msgSender(), amount);
        // create XEN Stake
        _createStake(amount, term);
        emit Staked(_msgSender(), amount, term);
    }

    /**
     * @dev ends XEN Stake and gets reward if the Stake is mature
     */
    function withdraw() external {
        StakeInfo memory userStake = userStakes[_msgSender()];
        require(userStake.amount > 0, "XEN: no stake exists");

        uint256 xenReward = _calculateStakeReward(
            userStake.amount,
            userStake.term,
            userStake.maturityTs,
            userStake.apy
        );
        activeStakes--;
        totalXenStaked -= userStake.amount;

        // mint staked XEN (+ reward)
        _mint(_msgSender(), userStake.amount + xenReward);
        emit Withdrawn(_msgSender(), userStake.amount, xenReward);
        delete userStakes[_msgSender()];
    }

    /**
     * @dev burns XEN tokens and creates Proof-Of-Burn record to be used by connected DeFi services
     */
    function burn(address user, uint256 amount) public {
        require(amount > XEN_MIN_BURN, "Burn: Below min limit");
        require(
            IERC165(_msgSender()).supportsInterface(type(IBurnRedeemable).interfaceId),
            "Burn: not a supported contract"
        );

        _spendAllowance(user, _msgSender(), amount);
        _burn(user, amount);
        userBurns[user] += amount;
        IBurnRedeemable(_msgSender()).onTokenBurned(user, amount);
    }
}

File 2 of 13 : IStakingToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;

interface IStakingToken {
    event Staked(address indexed user, uint256 amount, uint256 term);

    event Withdrawn(address indexed user, uint256 amount, uint256 reward);

    function stake(uint256 amount, uint256 term) external;

    function withdraw() external;
}

File 3 of 13 : IRankedMintingToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;

interface IRankedMintingToken {
    event RankClaimed(address indexed user, uint256 term, uint256 rank);

    event MintClaimed(address indexed user, uint256 rewardAmount);

    function claimRank(uint256 term) external;

    function claimMintReward() external;
}

File 4 of 13 : IBurnableToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;

interface IBurnableToken {
    function burn(address user, uint256 amount) external;
}

File 5 of 13 : IBurnRedeemable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;

interface IBurnRedeemable {
    event Redeemed(
        address indexed user,
        address indexed xenContract,
        address indexed tokenContract,
        uint256 xenAmount,
        uint256 tokenAmount
    );

    function onTokenBurned(address user, uint256 amount) external;
}

File 6 of 13 : Math.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;

import "abdk-libraries-solidity/ABDKMath64x64.sol";

library Math {
    function min(uint256 a, uint256 b) external pure returns (uint256) {
        if (a > b) return b;
        return a;
    }

    function max(uint256 a, uint256 b) external pure returns (uint256) {
        if (a > b) return a;
        return b;
    }

    function logX64(uint256 x) external pure returns (int128) {
        return ABDKMath64x64.log_2(ABDKMath64x64.fromUInt(x));
    }
}

File 7 of 13 : ABDKMath64x64.sol
// SPDX-License-Identifier: BSD-4-Clause
/*
 * ABDK Math 64.64 Smart Contract Library.  Copyright © 2019 by ABDK Consulting.
 * Author: Mikhail Vladimirov <[email protected]>
 */
pragma solidity ^0.8.0;

/**
 * Smart contract library of mathematical functions operating with signed
 * 64.64-bit fixed point numbers.  Signed 64.64-bit fixed point number is
 * basically a simple fraction whose numerator is signed 128-bit integer and
 * denominator is 2^64.  As long as denominator is always the same, there is no
 * need to store it, thus in Solidity signed 64.64-bit fixed point numbers are
 * represented by int128 type holding only the numerator.
 */
library ABDKMath64x64 {
  /*
   * Minimum value signed 64.64-bit fixed point number may have. 
   */
  int128 private constant MIN_64x64 = -0x80000000000000000000000000000000;

  /*
   * Maximum value signed 64.64-bit fixed point number may have. 
   */
  int128 private constant MAX_64x64 = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;

  /**
   * Convert signed 256-bit integer number into signed 64.64-bit fixed point
   * number.  Revert on overflow.
   *
   * @param x signed 256-bit integer number
   * @return signed 64.64-bit fixed point number
   */
  function fromInt (int256 x) internal pure returns (int128) {
    unchecked {
      require (x >= -0x8000000000000000 && x <= 0x7FFFFFFFFFFFFFFF);
      return int128 (x << 64);
    }
  }

  /**
   * Convert signed 64.64 fixed point number into signed 64-bit integer number
   * rounding down.
   *
   * @param x signed 64.64-bit fixed point number
   * @return signed 64-bit integer number
   */
  function toInt (int128 x) internal pure returns (int64) {
    unchecked {
      return int64 (x >> 64);
    }
  }

  /**
   * Convert unsigned 256-bit integer number into signed 64.64-bit fixed point
   * number.  Revert on overflow.
   *
   * @param x unsigned 256-bit integer number
   * @return signed 64.64-bit fixed point number
   */
  function fromUInt (uint256 x) internal pure returns (int128) {
    unchecked {
      require (x <= 0x7FFFFFFFFFFFFFFF);
      return int128 (int256 (x << 64));
    }
  }

  /**
   * Convert signed 64.64 fixed point number into unsigned 64-bit integer
   * number rounding down.  Revert on underflow.
   *
   * @param x signed 64.64-bit fixed point number
   * @return unsigned 64-bit integer number
   */
  function toUInt (int128 x) internal pure returns (uint64) {
    unchecked {
      require (x >= 0);
      return uint64 (uint128 (x >> 64));
    }
  }

  /**
   * Convert signed 128.128 fixed point number into signed 64.64-bit fixed point
   * number rounding down.  Revert on overflow.
   *
   * @param x signed 128.128-bin fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function from128x128 (int256 x) internal pure returns (int128) {
    unchecked {
      int256 result = x >> 64;
      require (result >= MIN_64x64 && result <= MAX_64x64);
      return int128 (result);
    }
  }

  /**
   * Convert signed 64.64 fixed point number into signed 128.128 fixed point
   * number.
   *
   * @param x signed 64.64-bit fixed point number
   * @return signed 128.128 fixed point number
   */
  function to128x128 (int128 x) internal pure returns (int256) {
    unchecked {
      return int256 (x) << 64;
    }
  }

  /**
   * Calculate x + y.  Revert on overflow.
   *
   * @param x signed 64.64-bit fixed point number
   * @param y signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function add (int128 x, int128 y) internal pure returns (int128) {
    unchecked {
      int256 result = int256(x) + y;
      require (result >= MIN_64x64 && result <= MAX_64x64);
      return int128 (result);
    }
  }

  /**
   * Calculate x - y.  Revert on overflow.
   *
   * @param x signed 64.64-bit fixed point number
   * @param y signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function sub (int128 x, int128 y) internal pure returns (int128) {
    unchecked {
      int256 result = int256(x) - y;
      require (result >= MIN_64x64 && result <= MAX_64x64);
      return int128 (result);
    }
  }

  /**
   * Calculate x * y rounding down.  Revert on overflow.
   *
   * @param x signed 64.64-bit fixed point number
   * @param y signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function mul (int128 x, int128 y) internal pure returns (int128) {
    unchecked {
      int256 result = int256(x) * y >> 64;
      require (result >= MIN_64x64 && result <= MAX_64x64);
      return int128 (result);
    }
  }

  /**
   * Calculate x * y rounding towards zero, where x is signed 64.64 fixed point
   * number and y is signed 256-bit integer number.  Revert on overflow.
   *
   * @param x signed 64.64 fixed point number
   * @param y signed 256-bit integer number
   * @return signed 256-bit integer number
   */
  function muli (int128 x, int256 y) internal pure returns (int256) {
    unchecked {
      if (x == MIN_64x64) {
        require (y >= -0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF &&
          y <= 0x1000000000000000000000000000000000000000000000000);
        return -y << 63;
      } else {
        bool negativeResult = false;
        if (x < 0) {
          x = -x;
          negativeResult = true;
        }
        if (y < 0) {
          y = -y; // We rely on overflow behavior here
          negativeResult = !negativeResult;
        }
        uint256 absoluteResult = mulu (x, uint256 (y));
        if (negativeResult) {
          require (absoluteResult <=
            0x8000000000000000000000000000000000000000000000000000000000000000);
          return -int256 (absoluteResult); // We rely on overflow behavior here
        } else {
          require (absoluteResult <=
            0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);
          return int256 (absoluteResult);
        }
      }
    }
  }

  /**
   * Calculate x * y rounding down, where x is signed 64.64 fixed point number
   * and y is unsigned 256-bit integer number.  Revert on overflow.
   *
   * @param x signed 64.64 fixed point number
   * @param y unsigned 256-bit integer number
   * @return unsigned 256-bit integer number
   */
  function mulu (int128 x, uint256 y) internal pure returns (uint256) {
    unchecked {
      if (y == 0) return 0;

      require (x >= 0);

      uint256 lo = (uint256 (int256 (x)) * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)) >> 64;
      uint256 hi = uint256 (int256 (x)) * (y >> 128);

      require (hi <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);
      hi <<= 64;

      require (hi <=
        0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - lo);
      return hi + lo;
    }
  }

  /**
   * Calculate x / y rounding towards zero.  Revert on overflow or when y is
   * zero.
   *
   * @param x signed 64.64-bit fixed point number
   * @param y signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function div (int128 x, int128 y) internal pure returns (int128) {
    unchecked {
      require (y != 0);
      int256 result = (int256 (x) << 64) / y;
      require (result >= MIN_64x64 && result <= MAX_64x64);
      return int128 (result);
    }
  }

  /**
   * Calculate x / y rounding towards zero, where x and y are signed 256-bit
   * integer numbers.  Revert on overflow or when y is zero.
   *
   * @param x signed 256-bit integer number
   * @param y signed 256-bit integer number
   * @return signed 64.64-bit fixed point number
   */
  function divi (int256 x, int256 y) internal pure returns (int128) {
    unchecked {
      require (y != 0);

      bool negativeResult = false;
      if (x < 0) {
        x = -x; // We rely on overflow behavior here
        negativeResult = true;
      }
      if (y < 0) {
        y = -y; // We rely on overflow behavior here
        negativeResult = !negativeResult;
      }
      uint128 absoluteResult = divuu (uint256 (x), uint256 (y));
      if (negativeResult) {
        require (absoluteResult <= 0x80000000000000000000000000000000);
        return -int128 (absoluteResult); // We rely on overflow behavior here
      } else {
        require (absoluteResult <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);
        return int128 (absoluteResult); // We rely on overflow behavior here
      }
    }
  }

  /**
   * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit
   * integer numbers.  Revert on overflow or when y is zero.
   *
   * @param x unsigned 256-bit integer number
   * @param y unsigned 256-bit integer number
   * @return signed 64.64-bit fixed point number
   */
  function divu (uint256 x, uint256 y) internal pure returns (int128) {
    unchecked {
      require (y != 0);
      uint128 result = divuu (x, y);
      require (result <= uint128 (MAX_64x64));
      return int128 (result);
    }
  }

  /**
   * Calculate -x.  Revert on overflow.
   *
   * @param x signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function neg (int128 x) internal pure returns (int128) {
    unchecked {
      require (x != MIN_64x64);
      return -x;
    }
  }

  /**
   * Calculate |x|.  Revert on overflow.
   *
   * @param x signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function abs (int128 x) internal pure returns (int128) {
    unchecked {
      require (x != MIN_64x64);
      return x < 0 ? -x : x;
    }
  }

  /**
   * Calculate 1 / x rounding towards zero.  Revert on overflow or when x is
   * zero.
   *
   * @param x signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function inv (int128 x) internal pure returns (int128) {
    unchecked {
      require (x != 0);
      int256 result = int256 (0x100000000000000000000000000000000) / x;
      require (result >= MIN_64x64 && result <= MAX_64x64);
      return int128 (result);
    }
  }

  /**
   * Calculate arithmetics average of x and y, i.e. (x + y) / 2 rounding down.
   *
   * @param x signed 64.64-bit fixed point number
   * @param y signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function avg (int128 x, int128 y) internal pure returns (int128) {
    unchecked {
      return int128 ((int256 (x) + int256 (y)) >> 1);
    }
  }

  /**
   * Calculate geometric average of x and y, i.e. sqrt (x * y) rounding down.
   * Revert on overflow or in case x * y is negative.
   *
   * @param x signed 64.64-bit fixed point number
   * @param y signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function gavg (int128 x, int128 y) internal pure returns (int128) {
    unchecked {
      int256 m = int256 (x) * int256 (y);
      require (m >= 0);
      require (m <
          0x4000000000000000000000000000000000000000000000000000000000000000);
      return int128 (sqrtu (uint256 (m)));
    }
  }

  /**
   * Calculate x^y assuming 0^0 is 1, where x is signed 64.64 fixed point number
   * and y is unsigned 256-bit integer number.  Revert on overflow.
   *
   * @param x signed 64.64-bit fixed point number
   * @param y uint256 value
   * @return signed 64.64-bit fixed point number
   */
  function pow (int128 x, uint256 y) internal pure returns (int128) {
    unchecked {
      bool negative = x < 0 && y & 1 == 1;

      uint256 absX = uint128 (x < 0 ? -x : x);
      uint256 absResult;
      absResult = 0x100000000000000000000000000000000;

      if (absX <= 0x10000000000000000) {
        absX <<= 63;
        while (y != 0) {
          if (y & 0x1 != 0) {
            absResult = absResult * absX >> 127;
          }
          absX = absX * absX >> 127;

          if (y & 0x2 != 0) {
            absResult = absResult * absX >> 127;
          }
          absX = absX * absX >> 127;

          if (y & 0x4 != 0) {
            absResult = absResult * absX >> 127;
          }
          absX = absX * absX >> 127;

          if (y & 0x8 != 0) {
            absResult = absResult * absX >> 127;
          }
          absX = absX * absX >> 127;

          y >>= 4;
        }

        absResult >>= 64;
      } else {
        uint256 absXShift = 63;
        if (absX < 0x1000000000000000000000000) { absX <<= 32; absXShift -= 32; }
        if (absX < 0x10000000000000000000000000000) { absX <<= 16; absXShift -= 16; }
        if (absX < 0x1000000000000000000000000000000) { absX <<= 8; absXShift -= 8; }
        if (absX < 0x10000000000000000000000000000000) { absX <<= 4; absXShift -= 4; }
        if (absX < 0x40000000000000000000000000000000) { absX <<= 2; absXShift -= 2; }
        if (absX < 0x80000000000000000000000000000000) { absX <<= 1; absXShift -= 1; }

        uint256 resultShift = 0;
        while (y != 0) {
          require (absXShift < 64);

          if (y & 0x1 != 0) {
            absResult = absResult * absX >> 127;
            resultShift += absXShift;
            if (absResult > 0x100000000000000000000000000000000) {
              absResult >>= 1;
              resultShift += 1;
            }
          }
          absX = absX * absX >> 127;
          absXShift <<= 1;
          if (absX >= 0x100000000000000000000000000000000) {
              absX >>= 1;
              absXShift += 1;
          }

          y >>= 1;
        }

        require (resultShift < 64);
        absResult >>= 64 - resultShift;
      }
      int256 result = negative ? -int256 (absResult) : int256 (absResult);
      require (result >= MIN_64x64 && result <= MAX_64x64);
      return int128 (result);
    }
  }

  /**
   * Calculate sqrt (x) rounding down.  Revert if x < 0.
   *
   * @param x signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function sqrt (int128 x) internal pure returns (int128) {
    unchecked {
      require (x >= 0);
      return int128 (sqrtu (uint256 (int256 (x)) << 64));
    }
  }

  /**
   * Calculate binary logarithm of x.  Revert if x <= 0.
   *
   * @param x signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function log_2 (int128 x) internal pure returns (int128) {
    unchecked {
      require (x > 0);

      int256 msb = 0;
      int256 xc = x;
      if (xc >= 0x10000000000000000) { xc >>= 64; msb += 64; }
      if (xc >= 0x100000000) { xc >>= 32; msb += 32; }
      if (xc >= 0x10000) { xc >>= 16; msb += 16; }
      if (xc >= 0x100) { xc >>= 8; msb += 8; }
      if (xc >= 0x10) { xc >>= 4; msb += 4; }
      if (xc >= 0x4) { xc >>= 2; msb += 2; }
      if (xc >= 0x2) msb += 1;  // No need to shift xc anymore

      int256 result = msb - 64 << 64;
      uint256 ux = uint256 (int256 (x)) << uint256 (127 - msb);
      for (int256 bit = 0x8000000000000000; bit > 0; bit >>= 1) {
        ux *= ux;
        uint256 b = ux >> 255;
        ux >>= 127 + b;
        result += bit * int256 (b);
      }

      return int128 (result);
    }
  }

  /**
   * Calculate natural logarithm of x.  Revert if x <= 0.
   *
   * @param x signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function ln (int128 x) internal pure returns (int128) {
    unchecked {
      require (x > 0);

      return int128 (int256 (
          uint256 (int256 (log_2 (x))) * 0xB17217F7D1CF79ABC9E3B39803F2F6AF >> 128));
    }
  }

  /**
   * Calculate binary exponent of x.  Revert on overflow.
   *
   * @param x signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function exp_2 (int128 x) internal pure returns (int128) {
    unchecked {
      require (x < 0x400000000000000000); // Overflow

      if (x < -0x400000000000000000) return 0; // Underflow

      uint256 result = 0x80000000000000000000000000000000;

      if (x & 0x8000000000000000 > 0)
        result = result * 0x16A09E667F3BCC908B2FB1366EA957D3E >> 128;
      if (x & 0x4000000000000000 > 0)
        result = result * 0x1306FE0A31B7152DE8D5A46305C85EDEC >> 128;
      if (x & 0x2000000000000000 > 0)
        result = result * 0x1172B83C7D517ADCDF7C8C50EB14A791F >> 128;
      if (x & 0x1000000000000000 > 0)
        result = result * 0x10B5586CF9890F6298B92B71842A98363 >> 128;
      if (x & 0x800000000000000 > 0)
        result = result * 0x1059B0D31585743AE7C548EB68CA417FD >> 128;
      if (x & 0x400000000000000 > 0)
        result = result * 0x102C9A3E778060EE6F7CACA4F7A29BDE8 >> 128;
      if (x & 0x200000000000000 > 0)
        result = result * 0x10163DA9FB33356D84A66AE336DCDFA3F >> 128;
      if (x & 0x100000000000000 > 0)
        result = result * 0x100B1AFA5ABCBED6129AB13EC11DC9543 >> 128;
      if (x & 0x80000000000000 > 0)
        result = result * 0x10058C86DA1C09EA1FF19D294CF2F679B >> 128;
      if (x & 0x40000000000000 > 0)
        result = result * 0x1002C605E2E8CEC506D21BFC89A23A00F >> 128;
      if (x & 0x20000000000000 > 0)
        result = result * 0x100162F3904051FA128BCA9C55C31E5DF >> 128;
      if (x & 0x10000000000000 > 0)
        result = result * 0x1000B175EFFDC76BA38E31671CA939725 >> 128;
      if (x & 0x8000000000000 > 0)
        result = result * 0x100058BA01FB9F96D6CACD4B180917C3D >> 128;
      if (x & 0x4000000000000 > 0)
        result = result * 0x10002C5CC37DA9491D0985C348C68E7B3 >> 128;
      if (x & 0x2000000000000 > 0)
        result = result * 0x1000162E525EE054754457D5995292026 >> 128;
      if (x & 0x1000000000000 > 0)
        result = result * 0x10000B17255775C040618BF4A4ADE83FC >> 128;
      if (x & 0x800000000000 > 0)
        result = result * 0x1000058B91B5BC9AE2EED81E9B7D4CFAB >> 128;
      if (x & 0x400000000000 > 0)
        result = result * 0x100002C5C89D5EC6CA4D7C8ACC017B7C9 >> 128;
      if (x & 0x200000000000 > 0)
        result = result * 0x10000162E43F4F831060E02D839A9D16D >> 128;
      if (x & 0x100000000000 > 0)
        result = result * 0x100000B1721BCFC99D9F890EA06911763 >> 128;
      if (x & 0x80000000000 > 0)
        result = result * 0x10000058B90CF1E6D97F9CA14DBCC1628 >> 128;
      if (x & 0x40000000000 > 0)
        result = result * 0x1000002C5C863B73F016468F6BAC5CA2B >> 128;
      if (x & 0x20000000000 > 0)
        result = result * 0x100000162E430E5A18F6119E3C02282A5 >> 128;
      if (x & 0x10000000000 > 0)
        result = result * 0x1000000B1721835514B86E6D96EFD1BFE >> 128;
      if (x & 0x8000000000 > 0)
        result = result * 0x100000058B90C0B48C6BE5DF846C5B2EF >> 128;
      if (x & 0x4000000000 > 0)
        result = result * 0x10000002C5C8601CC6B9E94213C72737A >> 128;
      if (x & 0x2000000000 > 0)
        result = result * 0x1000000162E42FFF037DF38AA2B219F06 >> 128;
      if (x & 0x1000000000 > 0)
        result = result * 0x10000000B17217FBA9C739AA5819F44F9 >> 128;
      if (x & 0x800000000 > 0)
        result = result * 0x1000000058B90BFCDEE5ACD3C1CEDC823 >> 128;
      if (x & 0x400000000 > 0)
        result = result * 0x100000002C5C85FE31F35A6A30DA1BE50 >> 128;
      if (x & 0x200000000 > 0)
        result = result * 0x10000000162E42FF0999CE3541B9FFFCF >> 128;
      if (x & 0x100000000 > 0)
        result = result * 0x100000000B17217F80F4EF5AADDA45554 >> 128;
      if (x & 0x80000000 > 0)
        result = result * 0x10000000058B90BFBF8479BD5A81B51AD >> 128;
      if (x & 0x40000000 > 0)
        result = result * 0x1000000002C5C85FDF84BD62AE30A74CC >> 128;
      if (x & 0x20000000 > 0)
        result = result * 0x100000000162E42FEFB2FED257559BDAA >> 128;
      if (x & 0x10000000 > 0)
        result = result * 0x1000000000B17217F7D5A7716BBA4A9AE >> 128;
      if (x & 0x8000000 > 0)
        result = result * 0x100000000058B90BFBE9DDBAC5E109CCE >> 128;
      if (x & 0x4000000 > 0)
        result = result * 0x10000000002C5C85FDF4B15DE6F17EB0D >> 128;
      if (x & 0x2000000 > 0)
        result = result * 0x1000000000162E42FEFA494F1478FDE05 >> 128;
      if (x & 0x1000000 > 0)
        result = result * 0x10000000000B17217F7D20CF927C8E94C >> 128;
      if (x & 0x800000 > 0)
        result = result * 0x1000000000058B90BFBE8F71CB4E4B33D >> 128;
      if (x & 0x400000 > 0)
        result = result * 0x100000000002C5C85FDF477B662B26945 >> 128;
      if (x & 0x200000 > 0)
        result = result * 0x10000000000162E42FEFA3AE53369388C >> 128;
      if (x & 0x100000 > 0)
        result = result * 0x100000000000B17217F7D1D351A389D40 >> 128;
      if (x & 0x80000 > 0)
        result = result * 0x10000000000058B90BFBE8E8B2D3D4EDE >> 128;
      if (x & 0x40000 > 0)
        result = result * 0x1000000000002C5C85FDF4741BEA6E77E >> 128;
      if (x & 0x20000 > 0)
        result = result * 0x100000000000162E42FEFA39FE95583C2 >> 128;
      if (x & 0x10000 > 0)
        result = result * 0x1000000000000B17217F7D1CFB72B45E1 >> 128;
      if (x & 0x8000 > 0)
        result = result * 0x100000000000058B90BFBE8E7CC35C3F0 >> 128;
      if (x & 0x4000 > 0)
        result = result * 0x10000000000002C5C85FDF473E242EA38 >> 128;
      if (x & 0x2000 > 0)
        result = result * 0x1000000000000162E42FEFA39F02B772C >> 128;
      if (x & 0x1000 > 0)
        result = result * 0x10000000000000B17217F7D1CF7D83C1A >> 128;
      if (x & 0x800 > 0)
        result = result * 0x1000000000000058B90BFBE8E7BDCBE2E >> 128;
      if (x & 0x400 > 0)
        result = result * 0x100000000000002C5C85FDF473DEA871F >> 128;
      if (x & 0x200 > 0)
        result = result * 0x10000000000000162E42FEFA39EF44D91 >> 128;
      if (x & 0x100 > 0)
        result = result * 0x100000000000000B17217F7D1CF79E949 >> 128;
      if (x & 0x80 > 0)
        result = result * 0x10000000000000058B90BFBE8E7BCE544 >> 128;
      if (x & 0x40 > 0)
        result = result * 0x1000000000000002C5C85FDF473DE6ECA >> 128;
      if (x & 0x20 > 0)
        result = result * 0x100000000000000162E42FEFA39EF366F >> 128;
      if (x & 0x10 > 0)
        result = result * 0x1000000000000000B17217F7D1CF79AFA >> 128;
      if (x & 0x8 > 0)
        result = result * 0x100000000000000058B90BFBE8E7BCD6D >> 128;
      if (x & 0x4 > 0)
        result = result * 0x10000000000000002C5C85FDF473DE6B2 >> 128;
      if (x & 0x2 > 0)
        result = result * 0x1000000000000000162E42FEFA39EF358 >> 128;
      if (x & 0x1 > 0)
        result = result * 0x10000000000000000B17217F7D1CF79AB >> 128;

      result >>= uint256 (int256 (63 - (x >> 64)));
      require (result <= uint256 (int256 (MAX_64x64)));

      return int128 (int256 (result));
    }
  }

  /**
   * Calculate natural exponent of x.  Revert on overflow.
   *
   * @param x signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function exp (int128 x) internal pure returns (int128) {
    unchecked {
      require (x < 0x400000000000000000); // Overflow

      if (x < -0x400000000000000000) return 0; // Underflow

      return exp_2 (
          int128 (int256 (x) * 0x171547652B82FE1777D0FFDA0D23A7D12 >> 128));
    }
  }

  /**
   * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit
   * integer numbers.  Revert on overflow or when y is zero.
   *
   * @param x unsigned 256-bit integer number
   * @param y unsigned 256-bit integer number
   * @return unsigned 64.64-bit fixed point number
   */
  function divuu (uint256 x, uint256 y) private pure returns (uint128) {
    unchecked {
      require (y != 0);

      uint256 result;

      if (x <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
        result = (x << 64) / y;
      else {
        uint256 msb = 192;
        uint256 xc = x >> 192;
        if (xc >= 0x100000000) { xc >>= 32; msb += 32; }
        if (xc >= 0x10000) { xc >>= 16; msb += 16; }
        if (xc >= 0x100) { xc >>= 8; msb += 8; }
        if (xc >= 0x10) { xc >>= 4; msb += 4; }
        if (xc >= 0x4) { xc >>= 2; msb += 2; }
        if (xc >= 0x2) msb += 1;  // No need to shift xc anymore

        result = (x << 255 - msb) / ((y - 1 >> msb - 191) + 1);
        require (result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);

        uint256 hi = result * (y >> 128);
        uint256 lo = result * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);

        uint256 xh = x >> 192;
        uint256 xl = x << 64;

        if (xl < lo) xh -= 1;
        xl -= lo; // We rely on overflow behavior here
        lo = hi << 128;
        if (xl < lo) xh -= 1;
        xl -= lo; // We rely on overflow behavior here

        assert (xh == hi >> 128);

        result += xl / y;
      }

      require (result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);
      return uint128 (result);
    }
  }

  /**
   * Calculate sqrt (x) rounding down, where x is unsigned 256-bit integer
   * number.
   *
   * @param x unsigned 256-bit integer number
   * @return unsigned 128-bit integer number
   */
  function sqrtu (uint256 x) private pure returns (uint128) {
    unchecked {
      if (x == 0) return 0;
      else {
        uint256 xx = x;
        uint256 r = 1;
        if (xx >= 0x100000000000000000000000000000000) { xx >>= 128; r <<= 64; }
        if (xx >= 0x10000000000000000) { xx >>= 64; r <<= 32; }
        if (xx >= 0x100000000) { xx >>= 32; r <<= 16; }
        if (xx >= 0x10000) { xx >>= 16; r <<= 8; }
        if (xx >= 0x100) { xx >>= 8; r <<= 4; }
        if (xx >= 0x10) { xx >>= 4; r <<= 2; }
        if (xx >= 0x8) { r <<= 1; }
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1; // Seven iterations should be enough
        uint256 r1 = x / r;
        return uint128 (r < r1 ? r : r1);
      }
    }
  }
}

File 8 of 13 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 9 of 13 : Context.sol
// 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;
    }
}

File 10 of 13 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

File 11 of 13 : IERC20.sol
// 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);
}

File 12 of 13 : ERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";

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

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

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

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

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

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

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

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

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

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, amount);
        return true;
    }

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

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

        return true;
    }

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

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
        }
        _balances[to] += amount;

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

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

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

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

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

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

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
        }
        _totalSupply -= amount;

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

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

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

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - amount);
            }
        }
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}
}

File 13 of 13 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)

pragma solidity ^0.8.0;

import "../utils/introspection/IERC165.sol";

Settings
{
  "remappings": [],
  "optimizer": {
    "enabled": true,
    "runs": 20
  },
  "evmVersion": "london",
  "libraries": {
    "/contracts/Math.sol": {
      "Math": "0x4bBA9B6B49f3dFA6615f079E9d66B0AA68B04A4d"
    }
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"rewardAmount","type":"uint256"}],"name":"MintClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"term","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rank","type":"uint256"}],"name":"RankClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"term","type":"uint256"}],"name":"Staked","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":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"AUTHORS","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DAYS_IN_YEAR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EAA_PM_START","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EAA_PM_STEP","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EAA_RANK_STEP","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GENESIS_RANK","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_PENALTY_PCT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_TERM_END","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_TERM_START","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_TERM","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REWARD_AMPLIFIER_END","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REWARD_AMPLIFIER_START","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SECONDS_IN_DAY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TERM_AMPLIFIER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TERM_AMPLIFIER_THRESHOLD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WITHDRAWAL_WINDOW_DAYS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"XEN_APY_DAYS_STEP","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"XEN_APY_END","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"XEN_APY_START","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"XEN_MIN_BURN","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"XEN_MIN_STAKE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"activeMinters","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"activeStakes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"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":"user","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimMintReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"other","type":"address"},{"internalType":"uint256","name":"pct","type":"uint256"}],"name":"claimMintRewardAndShare","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"pct","type":"uint256"},{"internalType":"uint256","name":"term","type":"uint256"}],"name":"claimMintRewardAndStake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"term","type":"uint256"}],"name":"claimRank","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"genesisTs","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentAMP","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentAPY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentEAAR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentMaxTerm","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"rankDelta","type":"uint256"},{"internalType":"uint256","name":"amplifier","type":"uint256"},{"internalType":"uint256","name":"term","type":"uint256"},{"internalType":"uint256","name":"eaa","type":"uint256"}],"name":"getGrossReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getUserMint","outputs":[{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"term","type":"uint256"},{"internalType":"uint256","name":"maturityTs","type":"uint256"},{"internalType":"uint256","name":"rank","type":"uint256"},{"internalType":"uint256","name":"amplifier","type":"uint256"},{"internalType":"uint256","name":"eaaRate","type":"uint256"}],"internalType":"struct XENCrypto.MintInfo","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getUserStake","outputs":[{"components":[{"internalType":"uint256","name":"term","type":"uint256"},{"internalType":"uint256","name":"maturityTs","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"apy","type":"uint256"}],"internalType":"struct XENCrypto.StakeInfo","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"globalRank","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"term","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalXenStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userBurns","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userMints","outputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"term","type":"uint256"},{"internalType":"uint256","name":"maturityTs","type":"uint256"},{"internalType":"uint256","name":"rank","type":"uint256"},{"internalType":"uint256","name":"amplifier","type":"uint256"},{"internalType":"uint256","name":"eaaRate","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userStakes","outputs":[{"internalType":"uint256","name":"term","type":"uint256"},{"internalType":"uint256","name":"maturityTs","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"apy","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60a060405260016005553480156200001657600080fd5b506040518060400160405280600a81526020016958454e2043727970746f60b01b815250604051806040016040528060038152602001622c22a760e91b815250816003908162000067919062000128565b50600462000076828262000128565b50504260805250620001f4565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680620000ae57607f821691505b602082108103620000cf57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200012357600081815260208120601f850160051c81016020861015620000fe5750805b601f850160051c820191505b818110156200011f578281556001016200010a565b5050505b505050565b81516001600160401b0381111562000144576200014462000083565b6200015c8162000155845462000099565b84620000d5565b602080601f8311600181146200019457600084156200017b5750858301515b600019600386901b1c1916600185901b1785556200011f565b600085815260208120601f198616915b82811015620001c557888601518255948401946001909101908401620001a4565b5085821015620001e45787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6080516128926200021e6000396000818161063d0152818161206801526120cb01526128926000f3fe608060405234801561001057600080fd5b50600436106102825760003560e01c80637e7aa62e116101585780637e7aa62e146104735780638979c87c1461047b5780638da7ad2314610483578063909a2ff6146104d857806395d89b41146104e0578063962ca496146104e857806399202454146104f05780639dc29fac146104f85780639ff054df1461050b578063a457c2d71461051e578063a9059cbb14610531578063b0fd1fc214610544578063b21d35f214610557578063b4800cdc14610560578063ba3ec74114610569578063bcfe394f1461035d578063c0c6525914610571578063c56f0bab14610579578063ce653d5f14610581578063dd62ed3e146105a1578063df282331146105b4578063e3af6d0a14610638578063e81917b41461065f578063ed2f236914610668578063f060482914610671578063f340faed14610679578063fed742691461068357600080fd5b80630237893214610287578063069612a5146102a357806306fdde03146102ac578063095ea7b3146102c15780630bfae56b146102e45780630f2e1228146102ec578063110d7fc2146102f457806316f9c8fd146102fc57806318160ddd146103375780631c2440821461033f5780631c560305146103485780631c6f212e1461035d57806323b872dd146103655780632a62d966146102f4578063313ce5671461037857806332870fda14610387578063395093511461038f5780633ccfd60b146103a257806345125715146103aa57806352c7f8dc146103b2578063543d36521461035d5780635bccb4c4146103ba57806361a52a36146103cd5780637010d7a1146103d757806370a082311461042f57806372475f94146104585780637b0472f014610460575b600080fd5b61029061016d81565b6040519081526020015b60405180910390f35b61029060085481565b6102b461068b565b60405161029a9190612419565b6102d46102cf366004612483565b61071d565b604051901515815260200161029a565b610290610737565b610290606381565b610290600081565b610304610748565b60405161029a91908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b600254610290565b61029060055481565b61035b610356366004612483565b6107b9565b005b610290600181565b6102d46103733660046124ad565b610a08565b6040516012815260200161029a565b610290605a81565b6102d461039d366004612483565b610a2c565b61035b610a4e565b610290610ba2565b61035b610bb1565b61035b6103c83660046124e9565b610cc2565b6102906201518081565b6103df610f64565b60405161029a919081516001600160a01b031681526020808301519082015260408083015190820152606080830151908201526080808301519082015260a0918201519181019190915260c00190565b61029061043d36600461250b565b6001600160a01b031660009081526020819052604090205490565b610290600f81565b61035b61046e3660046124e9565b611009565b610290600281565b61029061117e565b6104b861049136600461250b565b600a6020526000908152604090208054600182015460028301546003909301549192909184565b60408051948552602085019390935291830152606082015260800161029a565b610290606481565b6102b4611188565b610290611197565b6102906111a1565b61035b610506366004612483565b6111ab565b61035b610519366004612526565b61135d565b6102d461052c366004612483565b6115d2565b6102d461053f366004612483565b61164d565b61029061055236600461253f565b61165b565b61029061138881565b61029060065481565b6102b46116ea565b610290611706565b610290600781565b61029061058f36600461250b565b600b6020526000908152604090205481565b6102906105af366004612571565b611715565b6106016105c236600461250b565b6009602052600090815260409020805460018201546002830154600384015460048501546005909501546001600160a01b039094169492939192909186565b604080516001600160a01b0390971687526020870195909552938501929092526060840152608083015260a082015260c00161029a565b6102907f000000000000000000000000000000000000000000000000000000000000000081565b610290610bb881565b61029060075481565b610290611740565b610290620186a081565b610290601481565b60606003805461069a906125a4565b80601f01602080910402602001604051908101604052809291908181526020018280546106c6906125a4565b80156107135780601f106106e857610100808354040283529160200191610713565b820191906000526020600020905b8154815290600101906020018083116106f657829003601f168201915b5050505050905090565b60003361072b818585611759565b60019150505b92915050565b6107456201518060646125f4565b81565b6107736040518060800160405280600081526020016000815260200160008152602001600081525090565b50336000908152600a6020908152604091829020825160808101845281548152600182015492810192909252600281015492820192909252600390910154606082015290565b33600090815260096020908152604091829020825160c08101845281546001600160a01b03908116825260018301549382019390935260028201549381019390935260038101546060840152600481015460808401526005015460a083015283166108795760405162461bcd60e51b815260206004820152602560248201527f4352616e6b3a2043616e6e6f742073686172652077697468207a65726f206164604482015264647265737360d81b60648201526084015b60405180910390fd5b600082116108c95760405162461bcd60e51b815260206004820181905260248201527f4352616e6b3a2043616e6e6f74207368617265207a65726f2070657263656e746044820152606401610870565b606582106109195760405162461bcd60e51b815260206004820181905260248201527f4352616e6b3a2043616e6e6f74207368617265203130302b2070657263656e746044820152606401610870565b600081606001511161093d5760405162461bcd60e51b81526004016108709061260b565b806040015142116109605760405162461bcd60e51b81526004016108709061263a565b600061098382606001518360200151846040015185608001518660a0015161187e565b61099590670de0b6b3a76400006125f4565b9050600060646109a585846125f4565b6109af9190612685565b905060006109bd82846126a7565b90506109ca335b8261197c565b6109d4868361197c565b6109dc611a49565b60405183815233906000805160206127f8833981519152906020015b60405180910390a2505050505050565b600033610a16858285611a9d565b610a21858585611b17565b506001949350505050565b60003361072b818585610a3f8383611715565b610a4991906126ba565b611759565b336000908152600a6020908152604091829020825160808101845281548152600182015492810192909252600281015492820183905260030154606082015290610ad15760405162461bcd60e51b815260206004820152601460248201527358454e3a206e6f207374616b652065786973747360601b6044820152606401610870565b6000610aef8260400151836000015184602001518560600151611cd3565b600780549192506000610b01836126cd565b9190505550816040015160086000828254610b1c91906126a7565b90915550610b3b905033828460400151610b3691906126ba565b61197c565b60408083015181519081526020810183905233917f92ccf450a286a957af52509bc1c9939d1a6a481783e142e41e2499f0bb66ebc6910160405180910390a25050336000908152600a60205260408120818155600181018290556002810182905560030155565b6000610bac611d31565b905090565b33600090815260096020908152604091829020825160c08101845281546001600160a01b031681526001820154928101929092526002810154928201929092526003820154606082018190526004830154608083015260059092015460a082015290610c2f5760405162461bcd60e51b81526004016108709061260b565b80604001514211610c525760405162461bcd60e51b81526004016108709061263a565b6000610c7582606001518360200151846040015185608001518660a0015161187e565b610c8790670de0b6b3a76400006125f4565b9050610c92336109c4565b610c9a611a49565b60405181815233906000805160206127f8833981519152906020015b60405180910390a25050565b33600090815260096020908152604091829020825160c08101845281546001600160a01b03168152600182015492810192909252600281015492820192909252600382015460608201526004820154608082015260059091015460a082015260658310610d715760405162461bcd60e51b815260206004820181905260248201527f4352616e6b3a2043616e6e6f74207368617265203e3130302070657263656e746044820152606401610870565b6000816060015111610d955760405162461bcd60e51b81526004016108709061260b565b80604001514211610db85760405162461bcd60e51b81526004016108709061263a565b6000610ddb82606001518360200151846040015185608001518660a0015161187e565b610ded90670de0b6b3a76400006125f4565b905060006064610dfd86846125f4565b610e079190612685565b90506000610e1582846126a7565b9050610e20336109c4565b610e28611a49565b60405183815233906000805160206127f88339815191529060200160405180910390a260008211610e6b5760405162461bcd60e51b8152600401610870906126e4565b6001610e7a62015180826125f4565b610e8491906126a7565b610e9162015180876125f4565b11610eae5760405162461bcd60e51b815260040161087090612712565b610ebd620151806103e86125f4565b610ec89060016126ba565b610ed562015180876125f4565b10610ef25760405162461bcd60e51b815260040161087090612745565b336000908152600a602052604090206002015415610f225760405162461bcd60e51b815260040161087090612778565b610f2c8286611e37565b604080518381526020810187905233917f1449c6dd7851abc30abf37f57715f492010519147cc2652fbc38202c18a6ee9091016109f8565b610fa66040518060c0016040528060006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001600081525090565b5033600090815260096020908152604091829020825160c08101845281546001600160a01b03168152600182015492810192909252600281015492820192909252600382015460608201526004820154608082015260059091015460a082015290565b816110133361043d565b101561105b5760405162461bcd60e51b815260206004820152601760248201527658454e3a206e6f7420656e6f7567682062616c616e636560481b6044820152606401610870565b6000821161107b5760405162461bcd60e51b8152600401610870906126e4565b600161108a62015180826125f4565b61109491906126a7565b6110a162015180836125f4565b116110be5760405162461bcd60e51b815260040161087090612712565b6110cd620151806103e86125f4565b6110d89060016126ba565b6110e562015180836125f4565b106111025760405162461bcd60e51b815260040161087090612745565b336000908152600a6020526040902060020154156111325760405162461bcd60e51b815260040161087090612778565b61113c3383611eda565b6111468282611e37565b604080518381526020810183905233917f1449c6dd7851abc30abf37f57715f492010519147cc2652fbc38202c18a6ee909101610cb6565b6000610bac61200e565b60606004805461069a906125a4565b6000610bac612052565b6000610bac6120bf565b600081116111f35760405162461bcd60e51b8152602060048201526015602482015274109d5c9b8e8810995b1bddc81b5a5b881b1a5b5a5d605a1b6044820152606401610870565b336040516301ffc9a760e01b815263543746b160e01b60048201526001600160a01b0391909116906301ffc9a790602401602060405180830381865afa158015611241573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126591906127a3565b6112b15760405162461bcd60e51b815260206004820152601e60248201527f4275726e3a206e6f74206120737570706f7274656420636f6e747261637400006044820152606401610870565b6112bc823383611a9d565b6112c68282611eda565b6001600160a01b0382166000908152600b6020526040812080548392906112ee9084906126ba565b9091555033905060405163543746b160e01b81526001600160a01b03848116600483015260248201849052919091169063543746b190604401600060405180830381600087803b15801561134157600080fd5b505af1158015611355573d6000803e3d6000fd5b505050505050565b600061136c62015180836125f4565b9050600161137d62015180826125f4565b61138791906126a7565b81116113d15760405162461bcd60e51b815260206004820152601960248201527821a930b7359d102a32b936903632b9b9903a3430b71036b4b760391b6044820152606401610870565b6113d9611d31565b6113e49060016126ba565b81106114415760405162461bcd60e51b815260206004820152602660248201527f4352616e6b3a205465726d206d6f7265207468616e2063757272656e74206d6160448201526578207465726d60d01b6064820152608401610870565b33600090815260096020526040902060030154156114a15760405162461bcd60e51b815260206004820152601f60248201527f4352616e6b3a204d696e7420616c726561647920696e2070726f6772657373006044820152606401610870565b60006040518060c001604052806114b53390565b6001600160a01b03168152602081018590526040016114d484426126ba565b815260200160055481526020016114e96120bf565b81526020016114f661200e565b9052336000908152600960209081526040808320845181546001600160a01b0319166001600160a01b039091161781559184015160018301558301516002820155606083015160038201556080830151600482015560a08301516005909101556006805492935090611567836127c5565b91905055506115733390565b6001600160a01b03167fe9149e1b5059238baed02fa659dbf4bd932fbcf760a431330df4d934bc942f3784600560008154809291906115b1906127c5565b909155506040805192835260208301919091520160405180910390a2505050565b600033816115e08286611715565b9050838110156116405760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610870565b610a218286868403611759565b60003361072b818585611b17565b60008061167261166a8761219b565b600f0b6121b9565b905060006116ae6116828561219b565b6116a561168e8861219b565b6116a561169a8b61219b565b600f88900b90612293565b600f0b90612293565b90506116d46116cc6116c16103e861219b565b600f84900b906122d1565b600f0b612328565b6001600160401b0316925050505b949350505050565b6040518060600160405280602581526020016128386025913981565b610745620151806103e86125f4565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b600161174f62015180826125f4565b61074591906126a7565b6001600160a01b0383166117bb5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610870565b6001600160a01b03821661181c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610870565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b60008061188b85426126a7565b9050600061189882612344565b90506000734bba9b6b49f3dfa6615f079e9d66b0aa68b04a4d636d5433e68a6005546118c491906126a7565b6040516001600160e01b031960e084901b168152600481019190915260026024820152604401602060405180830381865af4158015611907573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061192b91906127de565b9050600061193b866103e86126ba565b9050600061194b83898c8561165b565b9050606461195985826126a7565b61196390836125f4565b61196d9190612685565b9b9a5050505050505050505050565b6001600160a01b0382166119d25760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610870565b80600260008282546119e491906126ba565b90915550506001600160a01b03821660009081526020819052604081208054839290611a119084906126ba565b90915550506040518181526001600160a01b038316906000906000805160206128188339815191529060200160405180910390a35050565b33600090815260096020526040812080546001600160a01b0319168155600181018290556002810182905560038101829055600481018290556005018190556006805491611a96836126cd565b9190505550565b6000611aa98484611715565b90506000198114611b115781811015611b045760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610870565b611b118484848403611759565b50505050565b6001600160a01b038316611b7b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610870565b6001600160a01b038216611bdd5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610870565b6001600160a01b03831660009081526020819052604090205481811015611c555760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610870565b6001600160a01b03808516600090815260208190526040808220858503905591851681529081208054849290611c8c9084906126ba565b92505081905550826001600160a01b0316846001600160a01b031660008051602061281883398151915284604051611cc691815260200190565b60405180910390a3611b11565b600082421115611d2657600061016d611cec86856125f4565b611cf990620f42406125f4565b611d039190612685565b90506305f5e100611d1482886125f4565b611d1e9190612685565b9150506116e2565b506000949350505050565b60006113886005541115611e29576000611d5f6116cc611d51600f61219b565b6116a561166a60055461219b565b6001600160401b031690506000611d7962015180836125f4565b611d876201518060646125f4565b611d9191906126ba565b9050734bba9b6b49f3dfa6615f079e9d66b0aa68b04a4d637ae2b5c782611dbd620151806103e86125f4565b6040516001600160e01b031960e085901b16815260048101929092526024820152604401602060405180830381865af4158015611dfe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e2291906127de565b9250505090565b610bac6201518060646125f4565b60405180608001604052808281526020016201518083611e5791906125f4565b611e6190426126ba565b8152602001838152602001611e74612052565b9052336000908152600a602090815260408083208451815591840151600183015583015160028201556060909201516003909201919091556007805491611eba836127c5565b91905055508160086000828254611ed191906126ba565b90915550505050565b6001600160a01b038216611f3a5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610870565b6001600160a01b03821660009081526020819052604090205481811015611fae5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610870565b6001600160a01b0383166000908152602081905260408120838303905560028054849290611fdd9084906126a7565b90915550506040518281526000906001600160a01b0385169060008051602061281883398151915290602001611871565b600080620186a0600554600161202491906125f4565b61202e9190612685565b9050606481111561204157600091505090565b61204c8160646126a7565b91505090565b600080612063605a620151806125f4565b61208d7f0000000000000000000000000000000000000000000000000000000000000000426126a7565b6120979190612685565b9050806120a6600260146126a7565b10156120b457600291505090565b61204c8160146126a7565b600080620151806120f07f0000000000000000000000000000000000000000000000000000000000000000426126a7565b6120fa9190612685565b9050610bb881101561219357734bba9b6b49f3dfa6615f079e9d66b0aa68b04a4d636d5433e661212c83610bb86126a7565b6040516001600160e01b031960e084901b168152600481019190915260016024820152604401602060405180830381865af415801561216f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061204c91906127de565b600191505090565b6000677fffffffffffffff8211156121b257600080fd5b5060401b90565b60008082600f0b136121ca57600080fd5b6000600f83900b600160401b81126121e4576040918201911d5b600160201b81126121f7576020918201911d5b620100008112612209576010918201911d5b610100811261221a576008918201911d5b6010811261222a576004918201911d5b6004811261223a576002918201911d5b60028112612249576001820191505b603f19820160401b600f85900b607f8490031b6001603f1b5b60008113156122885790800260ff81901c8281029390930192607f011c9060011d612262565b509095945050505050565b6000600f83810b9083900b0260401d60016001607f1b031981128015906122c1575060016001607f1b038113155b6122ca57600080fd5b9392505050565b600081600f0b6000036122e357600080fd5b600082600f0b604085600f0b901b816122fe576122fe61266f565b05905060016001607f1b031981128015906122c1575060016001607f1b038113156122ca57600080fd5b60008082600f0b121561233a57600080fd5b50600f0b60401d90565b6000806123546201518084612685565b9050612362600160076126a7565b8111156123725750606392915050565b6000600160076123838460036126ba565b6001901b6123919190612685565b61239b91906126a7565b604051637ae2b5c760e01b81526004810182905260636024820152909150734bba9b6b49f3dfa6615f079e9d66b0aa68b04a4d90637ae2b5c790604401602060405180830381865af41580156123f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116e291906127de565b600060208083528351808285015260005b818110156124465785810183015185820160400152820161242a565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b038116811461247e57600080fd5b919050565b6000806040838503121561249657600080fd5b61249f83612467565b946020939093013593505050565b6000806000606084860312156124c257600080fd5b6124cb84612467565b92506124d960208501612467565b9150604084013590509250925092565b600080604083850312156124fc57600080fd5b50508035926020909101359150565b60006020828403121561251d57600080fd5b6122ca82612467565b60006020828403121561253857600080fd5b5035919050565b6000806000806080858703121561255557600080fd5b5050823594602084013594506040840135936060013592509050565b6000806040838503121561258457600080fd5b61258d83612467565b915061259b60208401612467565b90509250929050565b600181811c908216806125b857607f821691505b6020821081036125d857634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610731576107316125de565b6020808252601590820152744352616e6b3a204e6f206d696e742065786973747360581b604082015260600190565b6020808252818101527f4352616e6b3a204d696e74206d61747572697479206e6f742072656163686564604082015260600190565b634e487b7160e01b600052601260045260246000fd5b6000826126a257634e487b7160e01b600052601260045260246000fd5b500490565b81810381811115610731576107316125de565b80820180821115610731576107316125de565b6000816126dc576126dc6125de565b506000190190565b60208082526014908201527358454e3a2042656c6f77206d696e207374616b6560601b604082015260600190565b60208082526019908201527858454e3a2042656c6f77206d696e207374616b65207465726d60381b604082015260600190565b60208082526019908201527858454e3a2041626f7665206d6178207374616b65207465726d60381b604082015260600190565b60208082526011908201527058454e3a207374616b652065786973747360781b604082015260600190565b6000602082840312156127b557600080fd5b815180151581146122ca57600080fd5b6000600182016127d7576127d76125de565b5060010190565b6000602082840312156127f057600080fd5b505191905056fed74752b13281df13701575f3a507e9b1242e0b5fb040143211c481c1fce573a6ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef404d724a61636b4c6576696e20406c62656c79616576206661697263727970746f2e6f7267a2646970667358221220c3156834d26b467f4edb2d28607a50e8cbfb9ca20cda44d2f1f27c7689a3c01464736f6c63430008110033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102825760003560e01c80637e7aa62e116101585780637e7aa62e146104735780638979c87c1461047b5780638da7ad2314610483578063909a2ff6146104d857806395d89b41146104e0578063962ca496146104e857806399202454146104f05780639dc29fac146104f85780639ff054df1461050b578063a457c2d71461051e578063a9059cbb14610531578063b0fd1fc214610544578063b21d35f214610557578063b4800cdc14610560578063ba3ec74114610569578063bcfe394f1461035d578063c0c6525914610571578063c56f0bab14610579578063ce653d5f14610581578063dd62ed3e146105a1578063df282331146105b4578063e3af6d0a14610638578063e81917b41461065f578063ed2f236914610668578063f060482914610671578063f340faed14610679578063fed742691461068357600080fd5b80630237893214610287578063069612a5146102a357806306fdde03146102ac578063095ea7b3146102c15780630bfae56b146102e45780630f2e1228146102ec578063110d7fc2146102f457806316f9c8fd146102fc57806318160ddd146103375780631c2440821461033f5780631c560305146103485780631c6f212e1461035d57806323b872dd146103655780632a62d966146102f4578063313ce5671461037857806332870fda14610387578063395093511461038f5780633ccfd60b146103a257806345125715146103aa57806352c7f8dc146103b2578063543d36521461035d5780635bccb4c4146103ba57806361a52a36146103cd5780637010d7a1146103d757806370a082311461042f57806372475f94146104585780637b0472f014610460575b600080fd5b61029061016d81565b6040519081526020015b60405180910390f35b61029060085481565b6102b461068b565b60405161029a9190612419565b6102d46102cf366004612483565b61071d565b604051901515815260200161029a565b610290610737565b610290606381565b610290600081565b610304610748565b60405161029a91908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b600254610290565b61029060055481565b61035b610356366004612483565b6107b9565b005b610290600181565b6102d46103733660046124ad565b610a08565b6040516012815260200161029a565b610290605a81565b6102d461039d366004612483565b610a2c565b61035b610a4e565b610290610ba2565b61035b610bb1565b61035b6103c83660046124e9565b610cc2565b6102906201518081565b6103df610f64565b60405161029a919081516001600160a01b031681526020808301519082015260408083015190820152606080830151908201526080808301519082015260a0918201519181019190915260c00190565b61029061043d36600461250b565b6001600160a01b031660009081526020819052604090205490565b610290600f81565b61035b61046e3660046124e9565b611009565b610290600281565b61029061117e565b6104b861049136600461250b565b600a6020526000908152604090208054600182015460028301546003909301549192909184565b60408051948552602085019390935291830152606082015260800161029a565b610290606481565b6102b4611188565b610290611197565b6102906111a1565b61035b610506366004612483565b6111ab565b61035b610519366004612526565b61135d565b6102d461052c366004612483565b6115d2565b6102d461053f366004612483565b61164d565b61029061055236600461253f565b61165b565b61029061138881565b61029060065481565b6102b46116ea565b610290611706565b610290600781565b61029061058f36600461250b565b600b6020526000908152604090205481565b6102906105af366004612571565b611715565b6106016105c236600461250b565b6009602052600090815260409020805460018201546002830154600384015460048501546005909501546001600160a01b039094169492939192909186565b604080516001600160a01b0390971687526020870195909552938501929092526060840152608083015260a082015260c00161029a565b6102907f000000000000000000000000000000000000000000000000000000006341b37381565b610290610bb881565b61029060075481565b610290611740565b610290620186a081565b610290601481565b60606003805461069a906125a4565b80601f01602080910402602001604051908101604052809291908181526020018280546106c6906125a4565b80156107135780601f106106e857610100808354040283529160200191610713565b820191906000526020600020905b8154815290600101906020018083116106f657829003601f168201915b5050505050905090565b60003361072b818585611759565b60019150505b92915050565b6107456201518060646125f4565b81565b6107736040518060800160405280600081526020016000815260200160008152602001600081525090565b50336000908152600a6020908152604091829020825160808101845281548152600182015492810192909252600281015492820192909252600390910154606082015290565b33600090815260096020908152604091829020825160c08101845281546001600160a01b03908116825260018301549382019390935260028201549381019390935260038101546060840152600481015460808401526005015460a083015283166108795760405162461bcd60e51b815260206004820152602560248201527f4352616e6b3a2043616e6e6f742073686172652077697468207a65726f206164604482015264647265737360d81b60648201526084015b60405180910390fd5b600082116108c95760405162461bcd60e51b815260206004820181905260248201527f4352616e6b3a2043616e6e6f74207368617265207a65726f2070657263656e746044820152606401610870565b606582106109195760405162461bcd60e51b815260206004820181905260248201527f4352616e6b3a2043616e6e6f74207368617265203130302b2070657263656e746044820152606401610870565b600081606001511161093d5760405162461bcd60e51b81526004016108709061260b565b806040015142116109605760405162461bcd60e51b81526004016108709061263a565b600061098382606001518360200151846040015185608001518660a0015161187e565b61099590670de0b6b3a76400006125f4565b9050600060646109a585846125f4565b6109af9190612685565b905060006109bd82846126a7565b90506109ca335b8261197c565b6109d4868361197c565b6109dc611a49565b60405183815233906000805160206127f8833981519152906020015b60405180910390a2505050505050565b600033610a16858285611a9d565b610a21858585611b17565b506001949350505050565b60003361072b818585610a3f8383611715565b610a4991906126ba565b611759565b336000908152600a6020908152604091829020825160808101845281548152600182015492810192909252600281015492820183905260030154606082015290610ad15760405162461bcd60e51b815260206004820152601460248201527358454e3a206e6f207374616b652065786973747360601b6044820152606401610870565b6000610aef8260400151836000015184602001518560600151611cd3565b600780549192506000610b01836126cd565b9190505550816040015160086000828254610b1c91906126a7565b90915550610b3b905033828460400151610b3691906126ba565b61197c565b60408083015181519081526020810183905233917f92ccf450a286a957af52509bc1c9939d1a6a481783e142e41e2499f0bb66ebc6910160405180910390a25050336000908152600a60205260408120818155600181018290556002810182905560030155565b6000610bac611d31565b905090565b33600090815260096020908152604091829020825160c08101845281546001600160a01b031681526001820154928101929092526002810154928201929092526003820154606082018190526004830154608083015260059092015460a082015290610c2f5760405162461bcd60e51b81526004016108709061260b565b80604001514211610c525760405162461bcd60e51b81526004016108709061263a565b6000610c7582606001518360200151846040015185608001518660a0015161187e565b610c8790670de0b6b3a76400006125f4565b9050610c92336109c4565b610c9a611a49565b60405181815233906000805160206127f8833981519152906020015b60405180910390a25050565b33600090815260096020908152604091829020825160c08101845281546001600160a01b03168152600182015492810192909252600281015492820192909252600382015460608201526004820154608082015260059091015460a082015260658310610d715760405162461bcd60e51b815260206004820181905260248201527f4352616e6b3a2043616e6e6f74207368617265203e3130302070657263656e746044820152606401610870565b6000816060015111610d955760405162461bcd60e51b81526004016108709061260b565b80604001514211610db85760405162461bcd60e51b81526004016108709061263a565b6000610ddb82606001518360200151846040015185608001518660a0015161187e565b610ded90670de0b6b3a76400006125f4565b905060006064610dfd86846125f4565b610e079190612685565b90506000610e1582846126a7565b9050610e20336109c4565b610e28611a49565b60405183815233906000805160206127f88339815191529060200160405180910390a260008211610e6b5760405162461bcd60e51b8152600401610870906126e4565b6001610e7a62015180826125f4565b610e8491906126a7565b610e9162015180876125f4565b11610eae5760405162461bcd60e51b815260040161087090612712565b610ebd620151806103e86125f4565b610ec89060016126ba565b610ed562015180876125f4565b10610ef25760405162461bcd60e51b815260040161087090612745565b336000908152600a602052604090206002015415610f225760405162461bcd60e51b815260040161087090612778565b610f2c8286611e37565b604080518381526020810187905233917f1449c6dd7851abc30abf37f57715f492010519147cc2652fbc38202c18a6ee9091016109f8565b610fa66040518060c0016040528060006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001600081525090565b5033600090815260096020908152604091829020825160c08101845281546001600160a01b03168152600182015492810192909252600281015492820192909252600382015460608201526004820154608082015260059091015460a082015290565b816110133361043d565b101561105b5760405162461bcd60e51b815260206004820152601760248201527658454e3a206e6f7420656e6f7567682062616c616e636560481b6044820152606401610870565b6000821161107b5760405162461bcd60e51b8152600401610870906126e4565b600161108a62015180826125f4565b61109491906126a7565b6110a162015180836125f4565b116110be5760405162461bcd60e51b815260040161087090612712565b6110cd620151806103e86125f4565b6110d89060016126ba565b6110e562015180836125f4565b106111025760405162461bcd60e51b815260040161087090612745565b336000908152600a6020526040902060020154156111325760405162461bcd60e51b815260040161087090612778565b61113c3383611eda565b6111468282611e37565b604080518381526020810183905233917f1449c6dd7851abc30abf37f57715f492010519147cc2652fbc38202c18a6ee909101610cb6565b6000610bac61200e565b60606004805461069a906125a4565b6000610bac612052565b6000610bac6120bf565b600081116111f35760405162461bcd60e51b8152602060048201526015602482015274109d5c9b8e8810995b1bddc81b5a5b881b1a5b5a5d605a1b6044820152606401610870565b336040516301ffc9a760e01b815263543746b160e01b60048201526001600160a01b0391909116906301ffc9a790602401602060405180830381865afa158015611241573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126591906127a3565b6112b15760405162461bcd60e51b815260206004820152601e60248201527f4275726e3a206e6f74206120737570706f7274656420636f6e747261637400006044820152606401610870565b6112bc823383611a9d565b6112c68282611eda565b6001600160a01b0382166000908152600b6020526040812080548392906112ee9084906126ba565b9091555033905060405163543746b160e01b81526001600160a01b03848116600483015260248201849052919091169063543746b190604401600060405180830381600087803b15801561134157600080fd5b505af1158015611355573d6000803e3d6000fd5b505050505050565b600061136c62015180836125f4565b9050600161137d62015180826125f4565b61138791906126a7565b81116113d15760405162461bcd60e51b815260206004820152601960248201527821a930b7359d102a32b936903632b9b9903a3430b71036b4b760391b6044820152606401610870565b6113d9611d31565b6113e49060016126ba565b81106114415760405162461bcd60e51b815260206004820152602660248201527f4352616e6b3a205465726d206d6f7265207468616e2063757272656e74206d6160448201526578207465726d60d01b6064820152608401610870565b33600090815260096020526040902060030154156114a15760405162461bcd60e51b815260206004820152601f60248201527f4352616e6b3a204d696e7420616c726561647920696e2070726f6772657373006044820152606401610870565b60006040518060c001604052806114b53390565b6001600160a01b03168152602081018590526040016114d484426126ba565b815260200160055481526020016114e96120bf565b81526020016114f661200e565b9052336000908152600960209081526040808320845181546001600160a01b0319166001600160a01b039091161781559184015160018301558301516002820155606083015160038201556080830151600482015560a08301516005909101556006805492935090611567836127c5565b91905055506115733390565b6001600160a01b03167fe9149e1b5059238baed02fa659dbf4bd932fbcf760a431330df4d934bc942f3784600560008154809291906115b1906127c5565b909155506040805192835260208301919091520160405180910390a2505050565b600033816115e08286611715565b9050838110156116405760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610870565b610a218286868403611759565b60003361072b818585611b17565b60008061167261166a8761219b565b600f0b6121b9565b905060006116ae6116828561219b565b6116a561168e8861219b565b6116a561169a8b61219b565b600f88900b90612293565b600f0b90612293565b90506116d46116cc6116c16103e861219b565b600f84900b906122d1565b600f0b612328565b6001600160401b0316925050505b949350505050565b6040518060600160405280602581526020016128386025913981565b610745620151806103e86125f4565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b600161174f62015180826125f4565b61074591906126a7565b6001600160a01b0383166117bb5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610870565b6001600160a01b03821661181c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610870565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b60008061188b85426126a7565b9050600061189882612344565b90506000734bba9b6b49f3dfa6615f079e9d66b0aa68b04a4d636d5433e68a6005546118c491906126a7565b6040516001600160e01b031960e084901b168152600481019190915260026024820152604401602060405180830381865af4158015611907573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061192b91906127de565b9050600061193b866103e86126ba565b9050600061194b83898c8561165b565b9050606461195985826126a7565b61196390836125f4565b61196d9190612685565b9b9a5050505050505050505050565b6001600160a01b0382166119d25760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610870565b80600260008282546119e491906126ba565b90915550506001600160a01b03821660009081526020819052604081208054839290611a119084906126ba565b90915550506040518181526001600160a01b038316906000906000805160206128188339815191529060200160405180910390a35050565b33600090815260096020526040812080546001600160a01b0319168155600181018290556002810182905560038101829055600481018290556005018190556006805491611a96836126cd565b9190505550565b6000611aa98484611715565b90506000198114611b115781811015611b045760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610870565b611b118484848403611759565b50505050565b6001600160a01b038316611b7b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610870565b6001600160a01b038216611bdd5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610870565b6001600160a01b03831660009081526020819052604090205481811015611c555760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610870565b6001600160a01b03808516600090815260208190526040808220858503905591851681529081208054849290611c8c9084906126ba565b92505081905550826001600160a01b0316846001600160a01b031660008051602061281883398151915284604051611cc691815260200190565b60405180910390a3611b11565b600082421115611d2657600061016d611cec86856125f4565b611cf990620f42406125f4565b611d039190612685565b90506305f5e100611d1482886125f4565b611d1e9190612685565b9150506116e2565b506000949350505050565b60006113886005541115611e29576000611d5f6116cc611d51600f61219b565b6116a561166a60055461219b565b6001600160401b031690506000611d7962015180836125f4565b611d876201518060646125f4565b611d9191906126ba565b9050734bba9b6b49f3dfa6615f079e9d66b0aa68b04a4d637ae2b5c782611dbd620151806103e86125f4565b6040516001600160e01b031960e085901b16815260048101929092526024820152604401602060405180830381865af4158015611dfe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e2291906127de565b9250505090565b610bac6201518060646125f4565b60405180608001604052808281526020016201518083611e5791906125f4565b611e6190426126ba565b8152602001838152602001611e74612052565b9052336000908152600a602090815260408083208451815591840151600183015583015160028201556060909201516003909201919091556007805491611eba836127c5565b91905055508160086000828254611ed191906126ba565b90915550505050565b6001600160a01b038216611f3a5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610870565b6001600160a01b03821660009081526020819052604090205481811015611fae5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610870565b6001600160a01b0383166000908152602081905260408120838303905560028054849290611fdd9084906126a7565b90915550506040518281526000906001600160a01b0385169060008051602061281883398151915290602001611871565b600080620186a0600554600161202491906125f4565b61202e9190612685565b9050606481111561204157600091505090565b61204c8160646126a7565b91505090565b600080612063605a620151806125f4565b61208d7f000000000000000000000000000000000000000000000000000000006341b373426126a7565b6120979190612685565b9050806120a6600260146126a7565b10156120b457600291505090565b61204c8160146126a7565b600080620151806120f07f000000000000000000000000000000000000000000000000000000006341b373426126a7565b6120fa9190612685565b9050610bb881101561219357734bba9b6b49f3dfa6615f079e9d66b0aa68b04a4d636d5433e661212c83610bb86126a7565b6040516001600160e01b031960e084901b168152600481019190915260016024820152604401602060405180830381865af415801561216f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061204c91906127de565b600191505090565b6000677fffffffffffffff8211156121b257600080fd5b5060401b90565b60008082600f0b136121ca57600080fd5b6000600f83900b600160401b81126121e4576040918201911d5b600160201b81126121f7576020918201911d5b620100008112612209576010918201911d5b610100811261221a576008918201911d5b6010811261222a576004918201911d5b6004811261223a576002918201911d5b60028112612249576001820191505b603f19820160401b600f85900b607f8490031b6001603f1b5b60008113156122885790800260ff81901c8281029390930192607f011c9060011d612262565b509095945050505050565b6000600f83810b9083900b0260401d60016001607f1b031981128015906122c1575060016001607f1b038113155b6122ca57600080fd5b9392505050565b600081600f0b6000036122e357600080fd5b600082600f0b604085600f0b901b816122fe576122fe61266f565b05905060016001607f1b031981128015906122c1575060016001607f1b038113156122ca57600080fd5b60008082600f0b121561233a57600080fd5b50600f0b60401d90565b6000806123546201518084612685565b9050612362600160076126a7565b8111156123725750606392915050565b6000600160076123838460036126ba565b6001901b6123919190612685565b61239b91906126a7565b604051637ae2b5c760e01b81526004810182905260636024820152909150734bba9b6b49f3dfa6615f079e9d66b0aa68b04a4d90637ae2b5c790604401602060405180830381865af41580156123f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116e291906127de565b600060208083528351808285015260005b818110156124465785810183015185820160400152820161242a565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b038116811461247e57600080fd5b919050565b6000806040838503121561249657600080fd5b61249f83612467565b946020939093013593505050565b6000806000606084860312156124c257600080fd5b6124cb84612467565b92506124d960208501612467565b9150604084013590509250925092565b600080604083850312156124fc57600080fd5b50508035926020909101359150565b60006020828403121561251d57600080fd5b6122ca82612467565b60006020828403121561253857600080fd5b5035919050565b6000806000806080858703121561255557600080fd5b5050823594602084013594506040840135936060013592509050565b6000806040838503121561258457600080fd5b61258d83612467565b915061259b60208401612467565b90509250929050565b600181811c908216806125b857607f821691505b6020821081036125d857634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610731576107316125de565b6020808252601590820152744352616e6b3a204e6f206d696e742065786973747360581b604082015260600190565b6020808252818101527f4352616e6b3a204d696e74206d61747572697479206e6f742072656163686564604082015260600190565b634e487b7160e01b600052601260045260246000fd5b6000826126a257634e487b7160e01b600052601260045260246000fd5b500490565b81810381811115610731576107316125de565b80820180821115610731576107316125de565b6000816126dc576126dc6125de565b506000190190565b60208082526014908201527358454e3a2042656c6f77206d696e207374616b6560601b604082015260600190565b60208082526019908201527858454e3a2042656c6f77206d696e207374616b65207465726d60381b604082015260600190565b60208082526019908201527858454e3a2041626f7665206d6178207374616b65207465726d60381b604082015260600190565b60208082526011908201527058454e3a207374616b652065786973747360781b604082015260600190565b6000602082840312156127b557600080fd5b815180151581146122ca57600080fd5b6000600182016127d7576127d76125de565b5060010190565b6000602082840312156127f057600080fd5b505191905056fed74752b13281df13701575f3a507e9b1242e0b5fb040143211c481c1fce573a6ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef404d724a61636b4c6576696e20406c62656c79616576206661697263727970746f2e6f7267a2646970667358221220c3156834d26b467f4edb2d28607a50e8cbfb9ca20cda44d2f1f27c7689a3c01464736f6c63430008110033

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.