ETH Price: $3,942.74 (+1.79%)

Contract

0x915F0288B53573A73C8725607F8A82A564d9aE88
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

1 address found via
Transaction Hash
Method
Block
From
To
Claim Mint Rewar...165281302023-01-31 16:54:11684 days ago1675184051IN
0x915F0288...564d9aE88
0 ETH0.002937435.09240783
Claim Mint Rewar...165281122023-01-31 16:50:35684 days ago1675183835IN
0x915F0288...564d9aE88
0 ETH0.0026551431.7202764
Claim Mint Rewar...165207902023-01-30 16:19:11685 days ago1675095551IN
0x915F0288...564d9aE88
0 ETH0.0015548818.57884378
Claim Mint Rewar...165024042023-01-28 2:43:59688 days ago1674873839IN
0x915F0288...564d9aE88
0 ETH0.0012886715.39597203
Approve164856362023-01-25 18:30:47690 days ago1674671447IN
0x915F0288...564d9aE88
0 ETH0.0011282824.2026959
Claim Mint Rewar...164856332023-01-25 18:30:11690 days ago1674671411IN
0x915F0288...564d9aE88
0 ETH0.0018942522.63018546
Approve164856202023-01-25 18:27:35690 days ago1674671255IN
0x915F0288...564d9aE88
0 ETH0.0011682225.05961578
Claim Mint Rewar...164856102023-01-25 18:25:35690 days ago1674671135IN
0x915F0288...564d9aE88
0 ETH0.002093325.00806875
Approve164855022023-01-25 18:03:59690 days ago1674669839IN
0x915F0288...564d9aE88
0 ETH0.0015753933.79378158
Claim Mint Rewar...164854962023-01-25 18:02:47690 days ago1674669767IN
0x915F0288...564d9aE88
0 ETH0.0028028733.48511993
Approve164853962023-01-25 17:42:23690 days ago1674668543IN
0x915F0288...564d9aE88
0 ETH0.0018734540.18731097
Claim Mint Rewar...164853812023-01-25 17:39:23690 days ago1674668363IN
0x915F0288...564d9aE88
0 ETH0.0025243130.15726738
Approve164853682023-01-25 17:36:47690 days ago1674668207IN
0x915F0288...564d9aE88
0 ETH0.0012871427.6105552
Claim Mint Rewar...164853602023-01-25 17:35:11690 days ago1674668111IN
0x915F0288...564d9aE88
0 ETH0.0025712130.71762004
Claim Mint Rewar...164853432023-01-25 17:31:47690 days ago1674667907IN
0x915F0288...564d9aE88
0 ETH0.0025494830.45793668
Approve164853372023-01-25 17:30:35690 days ago1674667835IN
0x915F0288...564d9aE88
0 ETH0.0015271132.75795162
Approve164853112023-01-25 17:25:23690 days ago1674667523IN
0x915F0288...564d9aE88
0 ETH0.0014761531.66501997
Claim Mint Rewar...164853042023-01-25 17:23:59690 days ago1674667439IN
0x915F0288...564d9aE88
0 ETH0.002882734.43888468
Approve164852422023-01-25 17:11:35690 days ago1674666695IN
0x915F0288...564d9aE88
0 ETH0.0020247443.43264591
Claim Mint Rewar...164852392023-01-25 17:10:59690 days ago1674666659IN
0x915F0288...564d9aE88
0 ETH0.0037884145.25907565
Approve164851292023-01-25 16:48:47690 days ago1674665327IN
0x915F0288...564d9aE88
0 ETH0.0012470326.75003292
Claim Mint Rewar...164851262023-01-25 16:48:11690 days ago1674665291IN
0x915F0288...564d9aE88
0 ETH0.0022130826.4390584
Approve164851082023-01-25 16:44:35690 days ago1674665075IN
0x915F0288...564d9aE88
0 ETH0.0012022625.78981577
Claim Mint Rewar...164850822023-01-25 16:39:23690 days ago1674664763IN
0x915F0288...564d9aE88
0 ETH0.0020504624.49637642
Claim Mint Rewar...163438162023-01-05 23:18:23710 days ago1672960703IN
0x915F0288...564d9aE88
0 ETH0.0018153121.68788876
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block
From
To
163182772023-01-02 9:45:11713 days ago1672652711
0x915F0288...564d9aE88
0.005 ETH
160456052022-11-25 7:47:35751 days ago1669362455
0x915F0288...564d9aE88
0.005 ETH
160409772022-11-24 16:17:11752 days ago1669306631
0x915F0288...564d9aE88
0.005 ETH
160326212022-11-23 12:13:35753 days ago1669205615
0x915F0288...564d9aE88
0.005 ETH
160325192022-11-23 11:52:47753 days ago1669204367
0x915F0288...564d9aE88
0.005 ETH
160291342022-11-23 0:31:47754 days ago1669163507
0x915F0288...564d9aE88
0.005 ETH
159221412022-11-08 1:51:23769 days ago1667872283
0x915F0288...564d9aE88
0.005 ETH
158973352022-11-04 14:45:59772 days ago1667573159
0x915F0288...564d9aE88
0.005 ETH
158973332022-11-04 14:45:35772 days ago1667573135
0x915F0288...564d9aE88
0.005 ETH
158511692022-10-29 3:55:35778 days ago1667015735
0x915F0288...564d9aE88
0.005 ETH
158495612022-10-28 22:31:59779 days ago1666996319
0x915F0288...564d9aE88
0.005 ETH
158495472022-10-28 22:28:59779 days ago1666996139
0x915F0288...564d9aE88
0.005 ETH
158495302022-10-28 22:25:23779 days ago1666995923
0x915F0288...564d9aE88
0.005 ETH
158472702022-10-28 14:50:47779 days ago1666968647
0x915F0288...564d9aE88
0.005 ETH
158453802022-10-28 8:31:59779 days ago1666945919
0x915F0288...564d9aE88
0.005 ETH
158439782022-10-28 3:49:35779 days ago1666928975
0x915F0288...564d9aE88
0.005 ETH
158412382022-10-27 18:36:23780 days ago1666895783
0x915F0288...564d9aE88
0.005 ETH
158406272022-10-27 16:32:59780 days ago1666888379
0x915F0288...564d9aE88
0.005 ETH
158401012022-10-27 14:46:59780 days ago1666882019
0x915F0288...564d9aE88
0.005 ETH
158358912022-10-27 0:40:59781 days ago1666831259
0x915F0288...564d9aE88
0.005 ETH
158358442022-10-27 0:31:35781 days ago1666830695
0x915F0288...564d9aE88
0.005 ETH
158257472022-10-25 14:39:11782 days ago1666708751
0x915F0288...564d9aE88
0.005 ETH
158253062022-10-25 13:09:47782 days ago1666703387
0x915F0288...564d9aE88
0.005 ETH
158112412022-10-23 13:54:59784 days ago1666533299
0x915F0288...564d9aE88
0.005 ETH
158109272022-10-23 12:51:23784 days ago1666529483
0x915F0288...564d9aE88
0.005 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
YENCrypto

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 17 : YENCrypto.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";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

contract YENCrypto is Context, IRankedMintingToken, IStakingToken, IBurnableToken, Ownable, ERC20("YEN Crypto", "YEN") {
    using Math for uint256;
    using ABDKMath64x64 for int128;
    using ABDKMath64x64 for uint256;
    using SafeERC20 for IERC20;

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

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

    uint256 public startTime;
    address public FundAddress;
    // 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 = 100;
    uint256 public constant REWARD_AMPLIFIER_END = 1;
    uint256 public constant EAA_PM_START = 10;
    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 YEN_MIN_STAKE = 0;

    uint256 public constant YEN_MIN_BURN = 0;

    uint256 public constant YEN_APY_START = 20;
    uint256 public constant YEN_APY_DAYS_STEP = 90;
    uint256 public constant YEN_APY_END = 2;

    // PUBLIC STATE, READABLE VIA NAMESAKE GETTERS

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

    // CONSTRUCTOR
    constructor(uint256 _startTime, address _FundAddress) {
        genesisTs = block.timestamp;
        startTime = _startTime;
        FundAddress = _FundAddress;
    }

    modifier chargeFee(){
        require(msg.value >= 0.005 ether, "insufficient fee");
        payable(FundAddress).transfer(msg.value);
        _;
    }

    // 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 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 * YEN_APY_DAYS_STEP);
        if (YEN_APY_START - YEN_APY_END < decrease) return YEN_APY_END;
        return YEN_APY_START - decrease;
    }


    // 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 YEN 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) payable external chargeFee{
        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++;
        totalTransactions++;
        emit RankClaimed(_msgSender(), term, globalRank++);
    }

    /**
     * @dev ends minting upon maturity (and within permitted Withdrawal Time Window), gets minted YEN
     */
    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();
        totalTransactions++;
        emit MintClaimed(_msgSender(), rewardAmount);
    }

    /**
     * @dev  ends minting upon maturity (and within permitted Withdrawal time Window)
     *       mints YEN 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();
        totalTransactions++;
        emit MintClaimed(_msgSender(), rewardAmount);
    }


    /**
     * @dev burns YEN tokens and creates Proof-Of-Burn record to be used by connected DeFi services
     */
    function burn(address user, uint256 amount) public {
        require(amount > YEN_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);
        totalTransactions++;
    }

    function updateStartTime(uint256 _startTime) external onlyOwner {
        startTime = _startTime;
    }

    //in case of mis-transfer tokens
    function recovery(address erc20Token, uint256 amount) external onlyOwner {
        require(erc20Token != address(this), "can not transfer yen");

        if (erc20Token != address(0)) {
            IERC20(erc20Token).safeTransfer(msg.sender, amount);
        } else {
            Address.sendValue(payable(msg.sender), amount);
        }
    }
}

File 2 of 17 : 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) internal pure returns (uint256) {
        if (a > b) return b;
        return a;
    }

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

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

File 3 of 17 : 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 4 of 17 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)

pragma solidity ^0.8.0;

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

File 5 of 17 : 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 6 of 17 : 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 7 of 17 : 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) payable external;

    function claimMintReward() external;
}

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

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

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

interface IBurnRedeemable {
    event Redeemed(
        address indexed user,
        address indexed yenContract,
        address indexed tokenContract,
        uint256 yenAmount,
        uint256 tokenAmount
    );

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

File 11 of 17 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

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

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

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

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly
                /// @solidity memory-safe-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 12 of 17 : 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 13 of 17 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

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

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

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

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

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

File 14 of 17 : 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 15 of 17 : 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 16 of 17 : 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 17 of 17 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

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

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

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

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"uint256","name":"_startTime","type":"uint256"},{"internalType":"address","name":"_FundAddress","type":"address"}],"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":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":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":"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":"FundAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"YEN_APY_DAYS_STEP","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"YEN_APY_END","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"YEN_APY_START","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"YEN_MIN_BURN","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"YEN_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":[{"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":"term","type":"uint256"}],"name":"claimRank","outputs":[],"stateMutability":"payable","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 YENCrypto.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 YENCrypto.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":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"erc20Token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"recovery","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":"totalTransactions","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":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_startTime","type":"uint256"}],"name":"updateStartTime","outputs":[],"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"}]

60a060405260016008553480156200001657600080fd5b5060405162002ced38038062002ced833981016040819052620000399162000135565b6040518060400160405280600a81526020016959454e2043727970746f60b01b815250604051806040016040528060038152602001622ca2a760e91b815250620000926200008c620000e160201b60201c565b620000e5565b6004620000a0838262000219565b506005620000af828262000219565b50504260805250600691909155600780546001600160a01b0319166001600160a01b03909216919091179055620002e5565b3390565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080604083850312156200014957600080fd5b825160208401519092506001600160a01b03811681146200016957600080fd5b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200019f57607f821691505b602082108103620001c057634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200021457600081815260208120601f850160051c81016020861015620001ef5750805b601f850160051c820191505b818110156200021057828155600101620001fb565b5050505b505050565b81516001600160401b0381111562000235576200023562000174565b6200024d816200024684546200018a565b84620001c6565b602080601f8311600181146200028557600084156200026c5750858301515b600019600386901b1c1916600185901b17855562000210565b600085815260208120601f198616915b82811015620002b65788860151825594840194600190910190840162000295565b5085821015620002d55787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6080516129de6200030f600039600081816109c6015281816120d4015261213701526129de6000f3fe60806040526004361061036b5760003560e01c8063909a2ff6116101c6578063bcfe394f116100f7578063df28233111610095578063e81917b41161006f578063e81917b4146109fd578063f060482914610a12578063f2fde38b14610a27578063f340faed14610a4757600080fd5b8063df28233114610923578063e3af6d0a146109b4578063e541d864146109e857600080fd5b8063cd2bc11c116100d1578063cd2bc11c14610800578063ce653d5f146108c1578063db3f69fc146108ee578063dd62ed3e1461090357600080fd5b8063bcfe394f146104ca578063c0c6525914610897578063c56f0bab146108ac57600080fd5b8063a457c2d711610164578063b0fd1fc21161013e578063b0fd1fc214610835578063b21d35f214610855578063b4800cdc1461086b578063b9a600381461088157600080fd5b8063a457c2d7146107e0578063a662d0b414610800578063a9059cbb1461081557600080fd5b8063987afafe116101a0578063987afafe1461078357806399202454146107985780639dc29fac146107ad5780639ff054df146107cd57600080fd5b8063909a2ff61461074457806395d89b4114610759578063962ca4961461076e57600080fd5b80633fb0971b116102a0578063715018a61161023e57806378e979251161021857806378e97925146106995780638979c87c146106af5780638da5cb5b146106c45780638da7ad23146106e257600080fd5b8063715018a61461063757806372475f941461064c5780637359f5cf1461066157600080fd5b8063543d36521161027a578063543d3652146104ca57806361a52a36146105855780637010d7a11461059c57806370a082311461060157600080fd5b80633fb0971b1461053b578063451257151461055b57806352c7f8dc1461057057600080fd5b806318160ddd1161030d5780631c6f212e116102e75780631c6f212e146104ca57806323b872dd146104df578063313ce567146104ff578063395093511461051b57600080fd5b806318160ddd1461047f5780631c244082146104945780631c560305146104aa57600080fd5b8063095ea7b311610349578063095ea7b3146103dd5780630bfae56b1461040d5780630f2e12281461042257806316f9c8fd1461043757600080fd5b8063023789321461037057806306bcf02f1461039957806306fdde03146103bb575b600080fd5b34801561037c57600080fd5b5061038661016d81565b6040519081526020015b60405180910390f35b3480156103a557600080fd5b506103b96103b4366004612709565b610a5e565b005b3480156103c757600080fd5b506103d0610a6b565b6040516103909190612746565b3480156103e957600080fd5b506103fd6103f8366004612795565b610afd565b6040519015158152602001610390565b34801561041957600080fd5b50610386610b17565b34801561042e57600080fd5b50610386606381565b34801561044357600080fd5b5061044c610b28565b60405161039091908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b34801561048b57600080fd5b50600354610386565b3480156104a057600080fd5b5061038660085481565b3480156104b657600080fd5b506103b96104c5366004612795565b610b99565b3480156104d657600080fd5b50610386600181565b3480156104eb57600080fd5b506103fd6104fa3660046127bf565b610e7a565b34801561050b57600080fd5b5060405160128152602001610390565b34801561052757600080fd5b506103fd610536366004612795565b610ea0565b34801561054757600080fd5b506103b9610556366004612795565b610ec2565b34801561056757600080fd5b50610386610f4a565b34801561057c57600080fd5b506103b9610f59565b34801561059157600080fd5b506103866201518081565b3480156105a857600080fd5b506105b16110fc565b604051610390919081516001600160a01b031681526020808301519082015260408083015190820152606080830151908201526080808301519082015260a0918201519181019190915260c00190565b34801561060d57600080fd5b5061038661061c3660046127fb565b6001600160a01b031660009081526001602052604090205490565b34801561064357600080fd5b506103b96111a1565b34801561065857600080fd5b50610386600f81565b34801561066d57600080fd5b50600754610681906001600160a01b031681565b6040516001600160a01b039091168152602001610390565b3480156106a557600080fd5b5061038660065481565b3480156106bb57600080fd5b506103866111b5565b3480156106d057600080fd5b506000546001600160a01b0316610681565b3480156106ee57600080fd5b506107246106fd3660046127fb565b600c6020526000908152604090208054600182015460028301546003909301549192909184565b604080519485526020850193909352918301526060820152608001610390565b34801561075057600080fd5b50610386600a81565b34801561076557600080fd5b506103d06111bf565b34801561077a57600080fd5b506103866111ce565b34801561078f57600080fd5b50610386600281565b3480156107a457600080fd5b506103866111d8565b3480156107b957600080fd5b506103b96107c8366004612795565b6111e2565b6103b96107db366004612709565b6113aa565b3480156107ec57600080fd5b506103fd6107fb366004612795565b6116bc565b34801561080c57600080fd5b50610386600081565b34801561082157600080fd5b506103fd610830366004612795565b611742565b34801561084157600080fd5b50610386610850366004612816565b611750565b34801561086157600080fd5b5061038661138881565b34801561087757600080fd5b5061038660095481565b34801561088d57600080fd5b50610386600a5481565b3480156108a357600080fd5b506103866117de565b3480156108b857600080fd5b50610386600781565b3480156108cd57600080fd5b506103866108dc3660046127fb565b600d6020526000908152604090205481565b3480156108fa57600080fd5b50610386605a81565b34801561090f57600080fd5b5061038661091e366004612848565b6117ed565b34801561092f57600080fd5b5061097d61093e3660046127fb565b600b602052600090815260409020805460018201546002830154600384015460048501546005909501546001600160a01b039094169492939192909186565b604080516001600160a01b0390971687526020870195909552938501929092526060840152608083015260a082015260c001610390565b3480156109c057600080fd5b506103867f000000000000000000000000000000000000000000000000000000000000000081565b3480156109f457600080fd5b50610386601481565b348015610a0957600080fd5b50610386606481565b348015610a1e57600080fd5b50610386611818565b348015610a3357600080fd5b506103b9610a423660046127fb565b611831565b348015610a5357600080fd5b50610386620186a081565b610a666118aa565b600655565b606060048054610a7a9061287b565b80601f0160208091040260200160405190810160405280929190818152602001828054610aa69061287b565b8015610af35780601f10610ac857610100808354040283529160200191610af3565b820191906000526020600020905b815481529060010190602001808311610ad657829003601f168201915b5050505050905090565b600033610b0b818585611904565b60019150505b92915050565b610b256201518060646128c5565b81565b610b536040518060800160405280600081526020016000815260200160008152602001600081525090565b50336000908152600c6020908152604091829020825160808101845281548152600182015492810192909252600281015492820192909252600390910154606082015290565b336000908152600b6020908152604091829020825160c08101845281546001600160a01b03908116825260018301549382019390935260028201549381019390935260038101546060840152600481015460808401526005015460a08301528316610c595760405162461bcd60e51b815260206004820152602560248201527f4352616e6b3a2043616e6e6f742073686172652077697468207a65726f206164604482015264647265737360d81b60648201526084015b60405180910390fd5b60008211610ca95760405162461bcd60e51b815260206004820181905260248201527f4352616e6b3a2043616e6e6f74207368617265207a65726f2070657263656e746044820152606401610c50565b60658210610cf95760405162461bcd60e51b815260206004820181905260248201527f4352616e6b3a2043616e6e6f74207368617265203130302b2070657263656e746044820152606401610c50565b6000816060015111610d455760405162461bcd60e51b81526020600482015260156024820152744352616e6b3a204e6f206d696e742065786973747360581b6044820152606401610c50565b80604001514211610d985760405162461bcd60e51b815260206004820181905260248201527f4352616e6b3a204d696e74206d61747572697479206e6f7420726561636865646044820152606401610c50565b6000610dbb82606001518360200151846040015185608001518660a00151611a28565b610dcd90670de0b6b3a76400006128c5565b905060006064610ddd85846128c5565b610de791906128f2565b90506000610df58284612914565b9050610e02335b82611aaf565b610e0c8683611aaf565b610e14611b8e565b600a8054906000610e2483612927565b9190505550610e303390565b6001600160a01b03167fd74752b13281df13701575f3a507e9b1242e0b5fb040143211c481c1fce573a684604051610e6a91815260200190565b60405180910390a2505050505050565b600033610e88858285611be2565b610e93858585611c5c565b60019150505b9392505050565b600033610b0b818585610eb383836117ed565b610ebd9190612940565b611904565b610eca6118aa565b306001600160a01b03831603610f195760405162461bcd60e51b815260206004820152601460248201527331b0b7103737ba103a3930b739b332b9103cb2b760611b6044820152606401610c50565b6001600160a01b03821615610f4057610f3c6001600160a01b0383163383611e2a565b5050565b610f3c3382611e81565b6000610f54611f9a565b905090565b336000908152600b6020908152604091829020825160c08101845281546001600160a01b031681526001820154928101929092526002810154928201929092526003820154606082018190526004830154608083015260059092015460a082015290610fff5760405162461bcd60e51b81526020600482015260156024820152744352616e6b3a204e6f206d696e742065786973747360581b6044820152606401610c50565b806040015142116110525760405162461bcd60e51b815260206004820181905260248201527f4352616e6b3a204d696e74206d61747572697479206e6f7420726561636865646044820152606401610c50565b600061107582606001518360200151846040015185608001518660a00151611a28565b61108790670de0b6b3a76400006128c5565b905061109233610dfc565b61109a611b8e565b600a80549060006110aa83612927565b91905055506110b63390565b6001600160a01b03167fd74752b13281df13701575f3a507e9b1242e0b5fb040143211c481c1fce573a6826040516110f091815260200190565b60405180910390a25050565b61113e6040518060c0016040528060006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001600081525090565b50336000908152600b6020908152604091829020825160c08101845281546001600160a01b03168152600182015492810192909252600281015492820192909252600382015460608201526004820154608082015260059091015460a082015290565b6111a96118aa565b6111b3600061202a565b565b6000610f5461207a565b606060058054610a7a9061287b565b6000610f546120be565b6000610f5461212b565b6000811161122a5760405162461bcd60e51b8152602060048201526015602482015274109d5c9b8e8810995b1bddc81b5a5b881b1a5b5a5d605a1b6044820152606401610c50565b336040516301ffc9a760e01b815263543746b160e01b60048201526001600160a01b0391909116906301ffc9a790602401602060405180830381865afa158015611278573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129c9190612953565b6112e85760405162461bcd60e51b815260206004820152601e60248201527f4275726e3a206e6f74206120737570706f7274656420636f6e747261637400006044820152606401610c50565b6112f3823383611be2565b6112fd828261218e565b6001600160a01b0382166000908152600d602052604081208054839290611325908490612940565b9091555033905060405163543746b160e01b81526001600160a01b03848116600483015260248201849052919091169063543746b190604401600060405180830381600087803b15801561137857600080fd5b505af115801561138c573d6000803e3d6000fd5b5050600a80549250905060006113a183612927565b91905055505050565b6611c37937e080003410156113f45760405162461bcd60e51b815260206004820152601060248201526f696e73756666696369656e742066656560801b6044820152606401610c50565b6007546040516001600160a01b03909116903480156108fc02916000818181858888f1935050505015801561142d573d6000803e3d6000fd5b50600061143d62015180836128c5565b9050600161144e62015180826128c5565b6114589190612914565b81116114a65760405162461bcd60e51b815260206004820152601960248201527f4352616e6b3a205465726d206c657373207468616e206d696e000000000000006044820152606401610c50565b6114ae611f9a565b6114b9906001612940565b81106115165760405162461bcd60e51b815260206004820152602660248201527f4352616e6b3a205465726d206d6f7265207468616e2063757272656e74206d6160448201526578207465726d60d01b6064820152608401610c50565b336000908152600b6020526040902060030154156115765760405162461bcd60e51b815260206004820152601f60248201527f4352616e6b3a204d696e7420616c726561647920696e2070726f6772657373006044820152606401610c50565b60006040518060c0016040528061158a3390565b6001600160a01b03168152602081018590526040016115a98442612940565b815260200160085481526020016115be61212b565b81526020016115cb61207a565b9052336000908152600b60209081526040808320845181546001600160a01b0319166001600160a01b039091161781559184015160018301558301516002820155606083015160038201556080830151600482015560a0830151600590910155600980549293509061163c83612927565b9091555050600a805490600061165183612927565b919050555061165d3390565b6001600160a01b03167fe9149e1b5059238baed02fa659dbf4bd932fbcf760a431330df4d934bc942f37846008600081548092919061169b90612927565b909155506040805192835260208301919091520160405180910390a2505050565b600033816116ca82866117ed565b90508381101561172a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610c50565b6117378286868403611904565b506001949350505050565b600033610b0b818585611c5c565b60008061176761175f876122dc565b600f0b6122fa565b905060006117a3611777856122dc565b61179a611783886122dc565b61179a61178f8b6122dc565b600f88900b906123de565b600f0b906123de565b90506117c96117c16117b66103e86122dc565b600f84900b90612415565b600f0b61246c565b67ffffffffffffffff16979650505050505050565b610b25620151806103e86128c5565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b600161182762015180826128c5565b610b259190612914565b6118396118aa565b6001600160a01b03811661189e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610c50565b6118a78161202a565b50565b6000546001600160a01b031633146111b35760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c50565b6001600160a01b0383166119665760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610c50565b6001600160a01b0382166119c75760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610c50565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b600080611a358542612914565b90506000611a4282612488565b90506000611a5e89600854611a579190612914565b60026124f4565b90506000611a6e866103e8612940565b90506000611a7e83898c85611750565b90506064611a8c8582612914565b611a9690836128c5565b611aa091906128f2565b9b9a5050505050505050505050565b6001600160a01b038216611b055760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610c50565b8060036000828254611b179190612940565b90915550506001600160a01b03821660009081526001602052604081208054839290611b44908490612940565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b336000908152600b6020526040812080546001600160a01b0319168155600181018290556002810182905560038101829055600481018290556005018190556009805491611bdb83612975565b9190505550565b6000611bee84846117ed565b90506000198114611c565781811015611c495760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610c50565b611c568484848403611904565b50505050565b6001600160a01b038316611cc05760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610c50565b6001600160a01b038216611d225760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610c50565b6001600160a01b03831660009081526001602052604090205481811015611d9a5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610c50565b6001600160a01b03808516600090815260016020526040808220858503905591851681529081208054849290611dd1908490612940565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611e1d91815260200190565b60405180910390a3611c56565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611e7c90849061250b565b505050565b80471015611ed15760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610c50565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611f1e576040519150601f19603f3d011682016040523d82523d6000602084013e611f23565b606091505b5050905080611e7c5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610c50565b6000611388600854111561201c576000611fc86117c1611fba600f6122dc565b61179a61175f6008546122dc565b67ffffffffffffffff1690506000611fe362015180836128c5565b611ff16201518060646128c5565b611ffb9190612940565b905061201581612010620151806103e86128c5565b6125dd565b9250505090565b610f546201518060646128c5565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080620186a0600854600161209091906128c5565b61209a91906128f2565b9050600a8111156120ad57600091505090565b6120b881600a612914565b91505090565b6000806120cf605a620151806128c5565b6120f97f000000000000000000000000000000000000000000000000000000000000000042612914565b61210391906128f2565b90508061211260026014612914565b101561212057600291505090565b6120b8816014612914565b6000806201518061215c7f000000000000000000000000000000000000000000000000000000000000000042612914565b61216691906128f2565b90506064811015612186576120b861217f826064612914565b60016124f4565b600191505090565b6001600160a01b0382166121ee5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610c50565b6001600160a01b038216600090815260016020526040902054818110156122625760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610c50565b6001600160a01b0383166000908152600160205260408120838303905560038054849290612291908490612914565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b6000677fffffffffffffff8211156122f357600080fd5b5060401b90565b60008082600f0b1361230b57600080fd5b6000600f83900b68010000000000000000811261232a576040918201911d5b640100000000811261233e576020918201911d5b620100008112612350576010918201911d5b6101008112612361576008918201911d5b60108112612371576004918201911d5b60048112612381576002918201911d5b60028112612390576001820191505b603f19820160401b600f85900b607f8490031b6780000000000000005b60008113156123d35790800260ff81901c8281029390930192607f011c9060011d6123ad565b509095945050505050565b6000600f83810b9083900b0260401d60016001607f1b0319811280159061240c575060016001607f1b038113155b610e9957600080fd5b600081600f0b60000361242757600080fd5b600082600f0b604085600f0b901b81612442576124426128dc565b05905060016001607f1b0319811280159061240c575060016001607f1b03811315610e9957600080fd5b60008082600f0b121561247e57600080fd5b50600f0b60401d90565b60008061249862015180846128f2565b90506124a660016007612914565b8111156124b65750606392915050565b6000600160076124c7846003612940565b6001901b6124d591906128f2565b6124df9190612914565b90506124ec8160636125dd565b949350505050565b600081831115612505575081610b11565b50919050565b6000612560826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166125f59092919063ffffffff16565b805190915015611e7c578080602001905181019061257e9190612953565b611e7c5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610c50565b6000818311156125ee575080610b11565b5090919050565b60606124ec8484600085856001600160a01b0385163b6126575760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610c50565b600080866001600160a01b03168587604051612673919061298c565b60006040518083038185875af1925050503d80600081146126b0576040519150601f19603f3d011682016040523d82523d6000602084013e6126b5565b606091505b50915091506126c58282866126d0565b979650505050505050565b606083156126df575081610e99565b8251156126ef5782518084602001fd5b8160405162461bcd60e51b8152600401610c509190612746565b60006020828403121561271b57600080fd5b5035919050565b60005b8381101561273d578181015183820152602001612725565b50506000910152565b6020815260008251806020840152612765816040850160208701612722565b601f01601f19169190910160400192915050565b80356001600160a01b038116811461279057600080fd5b919050565b600080604083850312156127a857600080fd5b6127b183612779565b946020939093013593505050565b6000806000606084860312156127d457600080fd5b6127dd84612779565b92506127eb60208501612779565b9150604084013590509250925092565b60006020828403121561280d57600080fd5b610e9982612779565b6000806000806080858703121561282c57600080fd5b5050823594602084013594506040840135936060013592509050565b6000806040838503121561285b57600080fd5b61286483612779565b915061287260208401612779565b90509250929050565b600181811c9082168061288f57607f821691505b60208210810361250557634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610b1157610b116128af565b634e487b7160e01b600052601260045260246000fd5b60008261290f57634e487b7160e01b600052601260045260246000fd5b500490565b81810381811115610b1157610b116128af565b600060018201612939576129396128af565b5060010190565b80820180821115610b1157610b116128af565b60006020828403121561296557600080fd5b81518015158114610e9957600080fd5b600081612984576129846128af565b506000190190565b6000825161299e818460208701612722565b919091019291505056fea264697066735822122092cb5c9dbb5062f2fc42e6541a7b8b2637a5875c50b0dd8e657b86c566dcfece64736f6c6343000811003300000000000000000000000000000000000000000000000000000000634d5fe00000000000000000000000007818e1e260994dca5f35b183aa8ba0e684446bc5

Deployed Bytecode

0x60806040526004361061036b5760003560e01c8063909a2ff6116101c6578063bcfe394f116100f7578063df28233111610095578063e81917b41161006f578063e81917b4146109fd578063f060482914610a12578063f2fde38b14610a27578063f340faed14610a4757600080fd5b8063df28233114610923578063e3af6d0a146109b4578063e541d864146109e857600080fd5b8063cd2bc11c116100d1578063cd2bc11c14610800578063ce653d5f146108c1578063db3f69fc146108ee578063dd62ed3e1461090357600080fd5b8063bcfe394f146104ca578063c0c6525914610897578063c56f0bab146108ac57600080fd5b8063a457c2d711610164578063b0fd1fc21161013e578063b0fd1fc214610835578063b21d35f214610855578063b4800cdc1461086b578063b9a600381461088157600080fd5b8063a457c2d7146107e0578063a662d0b414610800578063a9059cbb1461081557600080fd5b8063987afafe116101a0578063987afafe1461078357806399202454146107985780639dc29fac146107ad5780639ff054df146107cd57600080fd5b8063909a2ff61461074457806395d89b4114610759578063962ca4961461076e57600080fd5b80633fb0971b116102a0578063715018a61161023e57806378e979251161021857806378e97925146106995780638979c87c146106af5780638da5cb5b146106c45780638da7ad23146106e257600080fd5b8063715018a61461063757806372475f941461064c5780637359f5cf1461066157600080fd5b8063543d36521161027a578063543d3652146104ca57806361a52a36146105855780637010d7a11461059c57806370a082311461060157600080fd5b80633fb0971b1461053b578063451257151461055b57806352c7f8dc1461057057600080fd5b806318160ddd1161030d5780631c6f212e116102e75780631c6f212e146104ca57806323b872dd146104df578063313ce567146104ff578063395093511461051b57600080fd5b806318160ddd1461047f5780631c244082146104945780631c560305146104aa57600080fd5b8063095ea7b311610349578063095ea7b3146103dd5780630bfae56b1461040d5780630f2e12281461042257806316f9c8fd1461043757600080fd5b8063023789321461037057806306bcf02f1461039957806306fdde03146103bb575b600080fd5b34801561037c57600080fd5b5061038661016d81565b6040519081526020015b60405180910390f35b3480156103a557600080fd5b506103b96103b4366004612709565b610a5e565b005b3480156103c757600080fd5b506103d0610a6b565b6040516103909190612746565b3480156103e957600080fd5b506103fd6103f8366004612795565b610afd565b6040519015158152602001610390565b34801561041957600080fd5b50610386610b17565b34801561042e57600080fd5b50610386606381565b34801561044357600080fd5b5061044c610b28565b60405161039091908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b34801561048b57600080fd5b50600354610386565b3480156104a057600080fd5b5061038660085481565b3480156104b657600080fd5b506103b96104c5366004612795565b610b99565b3480156104d657600080fd5b50610386600181565b3480156104eb57600080fd5b506103fd6104fa3660046127bf565b610e7a565b34801561050b57600080fd5b5060405160128152602001610390565b34801561052757600080fd5b506103fd610536366004612795565b610ea0565b34801561054757600080fd5b506103b9610556366004612795565b610ec2565b34801561056757600080fd5b50610386610f4a565b34801561057c57600080fd5b506103b9610f59565b34801561059157600080fd5b506103866201518081565b3480156105a857600080fd5b506105b16110fc565b604051610390919081516001600160a01b031681526020808301519082015260408083015190820152606080830151908201526080808301519082015260a0918201519181019190915260c00190565b34801561060d57600080fd5b5061038661061c3660046127fb565b6001600160a01b031660009081526001602052604090205490565b34801561064357600080fd5b506103b96111a1565b34801561065857600080fd5b50610386600f81565b34801561066d57600080fd5b50600754610681906001600160a01b031681565b6040516001600160a01b039091168152602001610390565b3480156106a557600080fd5b5061038660065481565b3480156106bb57600080fd5b506103866111b5565b3480156106d057600080fd5b506000546001600160a01b0316610681565b3480156106ee57600080fd5b506107246106fd3660046127fb565b600c6020526000908152604090208054600182015460028301546003909301549192909184565b604080519485526020850193909352918301526060820152608001610390565b34801561075057600080fd5b50610386600a81565b34801561076557600080fd5b506103d06111bf565b34801561077a57600080fd5b506103866111ce565b34801561078f57600080fd5b50610386600281565b3480156107a457600080fd5b506103866111d8565b3480156107b957600080fd5b506103b96107c8366004612795565b6111e2565b6103b96107db366004612709565b6113aa565b3480156107ec57600080fd5b506103fd6107fb366004612795565b6116bc565b34801561080c57600080fd5b50610386600081565b34801561082157600080fd5b506103fd610830366004612795565b611742565b34801561084157600080fd5b50610386610850366004612816565b611750565b34801561086157600080fd5b5061038661138881565b34801561087757600080fd5b5061038660095481565b34801561088d57600080fd5b50610386600a5481565b3480156108a357600080fd5b506103866117de565b3480156108b857600080fd5b50610386600781565b3480156108cd57600080fd5b506103866108dc3660046127fb565b600d6020526000908152604090205481565b3480156108fa57600080fd5b50610386605a81565b34801561090f57600080fd5b5061038661091e366004612848565b6117ed565b34801561092f57600080fd5b5061097d61093e3660046127fb565b600b602052600090815260409020805460018201546002830154600384015460048501546005909501546001600160a01b039094169492939192909186565b604080516001600160a01b0390971687526020870195909552938501929092526060840152608083015260a082015260c001610390565b3480156109c057600080fd5b506103867f00000000000000000000000000000000000000000000000000000000634d16d781565b3480156109f457600080fd5b50610386601481565b348015610a0957600080fd5b50610386606481565b348015610a1e57600080fd5b50610386611818565b348015610a3357600080fd5b506103b9610a423660046127fb565b611831565b348015610a5357600080fd5b50610386620186a081565b610a666118aa565b600655565b606060048054610a7a9061287b565b80601f0160208091040260200160405190810160405280929190818152602001828054610aa69061287b565b8015610af35780601f10610ac857610100808354040283529160200191610af3565b820191906000526020600020905b815481529060010190602001808311610ad657829003601f168201915b5050505050905090565b600033610b0b818585611904565b60019150505b92915050565b610b256201518060646128c5565b81565b610b536040518060800160405280600081526020016000815260200160008152602001600081525090565b50336000908152600c6020908152604091829020825160808101845281548152600182015492810192909252600281015492820192909252600390910154606082015290565b336000908152600b6020908152604091829020825160c08101845281546001600160a01b03908116825260018301549382019390935260028201549381019390935260038101546060840152600481015460808401526005015460a08301528316610c595760405162461bcd60e51b815260206004820152602560248201527f4352616e6b3a2043616e6e6f742073686172652077697468207a65726f206164604482015264647265737360d81b60648201526084015b60405180910390fd5b60008211610ca95760405162461bcd60e51b815260206004820181905260248201527f4352616e6b3a2043616e6e6f74207368617265207a65726f2070657263656e746044820152606401610c50565b60658210610cf95760405162461bcd60e51b815260206004820181905260248201527f4352616e6b3a2043616e6e6f74207368617265203130302b2070657263656e746044820152606401610c50565b6000816060015111610d455760405162461bcd60e51b81526020600482015260156024820152744352616e6b3a204e6f206d696e742065786973747360581b6044820152606401610c50565b80604001514211610d985760405162461bcd60e51b815260206004820181905260248201527f4352616e6b3a204d696e74206d61747572697479206e6f7420726561636865646044820152606401610c50565b6000610dbb82606001518360200151846040015185608001518660a00151611a28565b610dcd90670de0b6b3a76400006128c5565b905060006064610ddd85846128c5565b610de791906128f2565b90506000610df58284612914565b9050610e02335b82611aaf565b610e0c8683611aaf565b610e14611b8e565b600a8054906000610e2483612927565b9190505550610e303390565b6001600160a01b03167fd74752b13281df13701575f3a507e9b1242e0b5fb040143211c481c1fce573a684604051610e6a91815260200190565b60405180910390a2505050505050565b600033610e88858285611be2565b610e93858585611c5c565b60019150505b9392505050565b600033610b0b818585610eb383836117ed565b610ebd9190612940565b611904565b610eca6118aa565b306001600160a01b03831603610f195760405162461bcd60e51b815260206004820152601460248201527331b0b7103737ba103a3930b739b332b9103cb2b760611b6044820152606401610c50565b6001600160a01b03821615610f4057610f3c6001600160a01b0383163383611e2a565b5050565b610f3c3382611e81565b6000610f54611f9a565b905090565b336000908152600b6020908152604091829020825160c08101845281546001600160a01b031681526001820154928101929092526002810154928201929092526003820154606082018190526004830154608083015260059092015460a082015290610fff5760405162461bcd60e51b81526020600482015260156024820152744352616e6b3a204e6f206d696e742065786973747360581b6044820152606401610c50565b806040015142116110525760405162461bcd60e51b815260206004820181905260248201527f4352616e6b3a204d696e74206d61747572697479206e6f7420726561636865646044820152606401610c50565b600061107582606001518360200151846040015185608001518660a00151611a28565b61108790670de0b6b3a76400006128c5565b905061109233610dfc565b61109a611b8e565b600a80549060006110aa83612927565b91905055506110b63390565b6001600160a01b03167fd74752b13281df13701575f3a507e9b1242e0b5fb040143211c481c1fce573a6826040516110f091815260200190565b60405180910390a25050565b61113e6040518060c0016040528060006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001600081525090565b50336000908152600b6020908152604091829020825160c08101845281546001600160a01b03168152600182015492810192909252600281015492820192909252600382015460608201526004820154608082015260059091015460a082015290565b6111a96118aa565b6111b3600061202a565b565b6000610f5461207a565b606060058054610a7a9061287b565b6000610f546120be565b6000610f5461212b565b6000811161122a5760405162461bcd60e51b8152602060048201526015602482015274109d5c9b8e8810995b1bddc81b5a5b881b1a5b5a5d605a1b6044820152606401610c50565b336040516301ffc9a760e01b815263543746b160e01b60048201526001600160a01b0391909116906301ffc9a790602401602060405180830381865afa158015611278573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129c9190612953565b6112e85760405162461bcd60e51b815260206004820152601e60248201527f4275726e3a206e6f74206120737570706f7274656420636f6e747261637400006044820152606401610c50565b6112f3823383611be2565b6112fd828261218e565b6001600160a01b0382166000908152600d602052604081208054839290611325908490612940565b9091555033905060405163543746b160e01b81526001600160a01b03848116600483015260248201849052919091169063543746b190604401600060405180830381600087803b15801561137857600080fd5b505af115801561138c573d6000803e3d6000fd5b5050600a80549250905060006113a183612927565b91905055505050565b6611c37937e080003410156113f45760405162461bcd60e51b815260206004820152601060248201526f696e73756666696369656e742066656560801b6044820152606401610c50565b6007546040516001600160a01b03909116903480156108fc02916000818181858888f1935050505015801561142d573d6000803e3d6000fd5b50600061143d62015180836128c5565b9050600161144e62015180826128c5565b6114589190612914565b81116114a65760405162461bcd60e51b815260206004820152601960248201527f4352616e6b3a205465726d206c657373207468616e206d696e000000000000006044820152606401610c50565b6114ae611f9a565b6114b9906001612940565b81106115165760405162461bcd60e51b815260206004820152602660248201527f4352616e6b3a205465726d206d6f7265207468616e2063757272656e74206d6160448201526578207465726d60d01b6064820152608401610c50565b336000908152600b6020526040902060030154156115765760405162461bcd60e51b815260206004820152601f60248201527f4352616e6b3a204d696e7420616c726561647920696e2070726f6772657373006044820152606401610c50565b60006040518060c0016040528061158a3390565b6001600160a01b03168152602081018590526040016115a98442612940565b815260200160085481526020016115be61212b565b81526020016115cb61207a565b9052336000908152600b60209081526040808320845181546001600160a01b0319166001600160a01b039091161781559184015160018301558301516002820155606083015160038201556080830151600482015560a0830151600590910155600980549293509061163c83612927565b9091555050600a805490600061165183612927565b919050555061165d3390565b6001600160a01b03167fe9149e1b5059238baed02fa659dbf4bd932fbcf760a431330df4d934bc942f37846008600081548092919061169b90612927565b909155506040805192835260208301919091520160405180910390a2505050565b600033816116ca82866117ed565b90508381101561172a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610c50565b6117378286868403611904565b506001949350505050565b600033610b0b818585611c5c565b60008061176761175f876122dc565b600f0b6122fa565b905060006117a3611777856122dc565b61179a611783886122dc565b61179a61178f8b6122dc565b600f88900b906123de565b600f0b906123de565b90506117c96117c16117b66103e86122dc565b600f84900b90612415565b600f0b61246c565b67ffffffffffffffff16979650505050505050565b610b25620151806103e86128c5565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b600161182762015180826128c5565b610b259190612914565b6118396118aa565b6001600160a01b03811661189e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610c50565b6118a78161202a565b50565b6000546001600160a01b031633146111b35760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c50565b6001600160a01b0383166119665760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610c50565b6001600160a01b0382166119c75760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610c50565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b600080611a358542612914565b90506000611a4282612488565b90506000611a5e89600854611a579190612914565b60026124f4565b90506000611a6e866103e8612940565b90506000611a7e83898c85611750565b90506064611a8c8582612914565b611a9690836128c5565b611aa091906128f2565b9b9a5050505050505050505050565b6001600160a01b038216611b055760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610c50565b8060036000828254611b179190612940565b90915550506001600160a01b03821660009081526001602052604081208054839290611b44908490612940565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b336000908152600b6020526040812080546001600160a01b0319168155600181018290556002810182905560038101829055600481018290556005018190556009805491611bdb83612975565b9190505550565b6000611bee84846117ed565b90506000198114611c565781811015611c495760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610c50565b611c568484848403611904565b50505050565b6001600160a01b038316611cc05760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610c50565b6001600160a01b038216611d225760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610c50565b6001600160a01b03831660009081526001602052604090205481811015611d9a5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610c50565b6001600160a01b03808516600090815260016020526040808220858503905591851681529081208054849290611dd1908490612940565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611e1d91815260200190565b60405180910390a3611c56565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611e7c90849061250b565b505050565b80471015611ed15760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610c50565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611f1e576040519150601f19603f3d011682016040523d82523d6000602084013e611f23565b606091505b5050905080611e7c5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610c50565b6000611388600854111561201c576000611fc86117c1611fba600f6122dc565b61179a61175f6008546122dc565b67ffffffffffffffff1690506000611fe362015180836128c5565b611ff16201518060646128c5565b611ffb9190612940565b905061201581612010620151806103e86128c5565b6125dd565b9250505090565b610f546201518060646128c5565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080620186a0600854600161209091906128c5565b61209a91906128f2565b9050600a8111156120ad57600091505090565b6120b881600a612914565b91505090565b6000806120cf605a620151806128c5565b6120f97f00000000000000000000000000000000000000000000000000000000634d16d742612914565b61210391906128f2565b90508061211260026014612914565b101561212057600291505090565b6120b8816014612914565b6000806201518061215c7f00000000000000000000000000000000000000000000000000000000634d16d742612914565b61216691906128f2565b90506064811015612186576120b861217f826064612914565b60016124f4565b600191505090565b6001600160a01b0382166121ee5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610c50565b6001600160a01b038216600090815260016020526040902054818110156122625760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610c50565b6001600160a01b0383166000908152600160205260408120838303905560038054849290612291908490612914565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b6000677fffffffffffffff8211156122f357600080fd5b5060401b90565b60008082600f0b1361230b57600080fd5b6000600f83900b68010000000000000000811261232a576040918201911d5b640100000000811261233e576020918201911d5b620100008112612350576010918201911d5b6101008112612361576008918201911d5b60108112612371576004918201911d5b60048112612381576002918201911d5b60028112612390576001820191505b603f19820160401b600f85900b607f8490031b6780000000000000005b60008113156123d35790800260ff81901c8281029390930192607f011c9060011d6123ad565b509095945050505050565b6000600f83810b9083900b0260401d60016001607f1b0319811280159061240c575060016001607f1b038113155b610e9957600080fd5b600081600f0b60000361242757600080fd5b600082600f0b604085600f0b901b81612442576124426128dc565b05905060016001607f1b0319811280159061240c575060016001607f1b03811315610e9957600080fd5b60008082600f0b121561247e57600080fd5b50600f0b60401d90565b60008061249862015180846128f2565b90506124a660016007612914565b8111156124b65750606392915050565b6000600160076124c7846003612940565b6001901b6124d591906128f2565b6124df9190612914565b90506124ec8160636125dd565b949350505050565b600081831115612505575081610b11565b50919050565b6000612560826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166125f59092919063ffffffff16565b805190915015611e7c578080602001905181019061257e9190612953565b611e7c5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610c50565b6000818311156125ee575080610b11565b5090919050565b60606124ec8484600085856001600160a01b0385163b6126575760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610c50565b600080866001600160a01b03168587604051612673919061298c565b60006040518083038185875af1925050503d80600081146126b0576040519150601f19603f3d011682016040523d82523d6000602084013e6126b5565b606091505b50915091506126c58282866126d0565b979650505050505050565b606083156126df575081610e99565b8251156126ef5782518084602001fd5b8160405162461bcd60e51b8152600401610c509190612746565b60006020828403121561271b57600080fd5b5035919050565b60005b8381101561273d578181015183820152602001612725565b50506000910152565b6020815260008251806020840152612765816040850160208701612722565b601f01601f19169190910160400192915050565b80356001600160a01b038116811461279057600080fd5b919050565b600080604083850312156127a857600080fd5b6127b183612779565b946020939093013593505050565b6000806000606084860312156127d457600080fd5b6127dd84612779565b92506127eb60208501612779565b9150604084013590509250925092565b60006020828403121561280d57600080fd5b610e9982612779565b6000806000806080858703121561282c57600080fd5b5050823594602084013594506040840135936060013592509050565b6000806040838503121561285b57600080fd5b61286483612779565b915061287260208401612779565b90509250929050565b600181811c9082168061288f57607f821691505b60208210810361250557634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610b1157610b116128af565b634e487b7160e01b600052601260045260246000fd5b60008261290f57634e487b7160e01b600052601260045260246000fd5b500490565b81810381811115610b1157610b116128af565b600060018201612939576129396128af565b5060010190565b80820180821115610b1157610b116128af565b60006020828403121561296557600080fd5b81518015158114610e9957600080fd5b600081612984576129846128af565b506000190190565b6000825161299e818460208701612722565b919091019291505056fea264697066735822122092cb5c9dbb5062f2fc42e6541a7b8b2637a5875c50b0dd8e657b86c566dcfece64736f6c63430008110033

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

00000000000000000000000000000000000000000000000000000000634d5fe00000000000000000000000007818e1e260994dca5f35b183aa8ba0e684446bc5

-----Decoded View---------------
Arg [0] : _startTime (uint256): 1666015200
Arg [1] : _FundAddress (address): 0x7818e1E260994dCA5f35B183Aa8Ba0E684446Bc5

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000634d5fe0
Arg [1] : 0000000000000000000000007818e1e260994dca5f35b183aa8ba0e684446bc5


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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