ETH Price: $3,143.83 (+0.52%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Increase Amount242109442026-01-11 10:43:232 days ago1768128203IN
0x168c2F7D...ca1c7d113
0 ETH0.00000690.03121338
Increase Unlock ...242078882026-01-11 0:29:112 days ago1768091351IN
0x168c2F7D...ca1c7d113
0 ETH0.000008620.04
Increase Unlock ...241611702026-01-04 12:02:359 days ago1767528155IN
0x168c2F7D...ca1c7d113
0 ETH0.000008060.0374161
Increase Amount241611572026-01-04 11:59:599 days ago1767527999IN
0x168c2F7D...ca1c7d113
0 ETH0.00000860.03890256
Increase Unlock ...241223472025-12-30 2:02:2314 days ago1767060143IN
0x168c2F7D...ca1c7d113
0 ETH0.000011020.05
Increase Amount241171942025-12-29 8:45:4715 days ago1766997947IN
0x168c2F7D...ca1c7d113
0 ETH0.000012830.0580568
Increase Amount241074662025-12-28 0:11:5916 days ago1766880719IN
0x168c2F7D...ca1c7d113
0 ETH0.000005990.02711131
Increase Amount241035742025-12-27 11:09:3517 days ago1766833775IN
0x168c2F7D...ca1c7d113
0 ETH0.000451922.04420315
Increase Unlock ...240867452025-12-25 2:46:4719 days ago1766630807IN
0x168c2F7D...ca1c7d113
0 ETH0.000544592.02788471
Increase Unlock ...240582862025-12-21 3:27:4723 days ago1766287667IN
0x168c2F7D...ca1c7d113
0 ETH0.000006610.03
Increase Amount240371982025-12-18 4:47:1126 days ago1766033231IN
0x168c2F7D...ca1c7d113
0 ETH0.000005760.02608803
Increase Unlock ...240107192025-12-14 12:03:1130 days ago1765713791IN
0x168c2F7D...ca1c7d113
0 ETH0.00000760.03742873
Increase Amount240106072025-12-14 11:40:4730 days ago1765712447IN
0x168c2F7D...ca1c7d113
0 ETH0.000010160.04597109
Increase Unlock ...240073862025-12-14 0:53:4730 days ago1765673627IN
0x168c2F7D...ca1c7d113
0 ETH0.000008810.04
Increase Unlock ...239519822025-12-06 6:12:4738 days ago1765001567IN
0x168c2F7D...ca1c7d113
0 ETH0.000401272.02132527
Increase Amount239519792025-12-06 6:12:1138 days ago1765001531IN
0x168c2F7D...ca1c7d113
0 ETH0.000447212.02290176
Increase Unlock ...239082392025-11-30 1:36:2344 days ago1764466583IN
0x168c2F7D...ca1c7d113
0 ETH0.000009920.05
Increase Unlock ...239077712025-11-30 0:01:5944 days ago1764460919IN
0x168c2F7D...ca1c7d113
0 ETH0.000007770.03529255
Increase Amount239077362025-11-29 23:54:5944 days ago1764460499IN
0x168c2F7D...ca1c7d113
0 ETH0.000007560.03421784
Increase Amount238864982025-11-27 0:31:3547 days ago1764203495IN
0x168c2F7D...ca1c7d113
0 ETH0.000013260.06
Increase Amount238755852025-11-25 11:42:3549 days ago1764070955IN
0x168c2F7D...ca1c7d113
0 ETH0.000018060.0817336
Increase Unlock ...238581482025-11-23 0:51:2351 days ago1763859083IN
0x168c2F7D...ca1c7d113
0 ETH0.000015430.07
Increase Amount238439572025-11-21 0:56:5953 days ago1763686619IN
0x168c2F7D...ca1c7d113
0 ETH0.000022370.10120023
Increase Amount238439132025-11-21 0:47:5953 days ago1763686079IN
0x168c2F7D...ca1c7d113
0 ETH0.000024840.11
Increase Unlock ...238369172025-11-20 1:15:1154 days ago1763601311IN
0x168c2F7D...ca1c7d113
0 ETH0.000036120.13217634
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
VotingEscrow

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 10000 runs

Other Settings:
default evmVersion
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

// Voting escrow to have time-weighted votes
// Votes have a weight depending on time, so that users are committed
// to the future of (whatever they are voting for).
// The weight in this implementation is linear, and lock cannot be more than maxtime:
// w ^
// 1 +        /
//   |      /
//   |    /
//   |  /
//   |/
// 0 +--------+------> time
//       maxtime (4 years?)

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/math/SafeCast.sol";

contract VotingEscrow is ReentrancyGuard {
    using SafeCast for uint256;
    using SafeCast for int256;

    struct Point {
        int128 bias;
        int128 slope; // - dweight / dt
        uint256 ts; //timestamp
        uint256 blk; // block
    }

    // We cannot really do block numbers per se b/c slope is per time, not per block
    // and per block could be fairly bad b/c Ethereum changes blocktimes.
    // What we can do is to extrapolate ***At functions
    struct LockedBalance {
        int128 amount;
        uint256 end;
    }

    uint128 private constant DEPOSIT_FOR_TYPE = 0;
    uint128 private constant CREATE_LOCK_TYPE = 1;
    uint128 private constant INCREASE_LOCK_AMOUNT = 2;
    uint128 private constant INCREASE_UNLOCK_TIME = 3;

    event Deposit(
        address indexed provider,
        uint256 value,
        uint256 indexed locktime,
        uint128 _type,
        uint256 ts
    );
    event Withdraw(address indexed provider, uint256 value, uint256 ts);
    event Supply(uint256 prevSupply, uint256 supply);

    uint256 public constant WEEK = 7 * 86400; // all future times are rounded by week
    uint256 public constant MAXTIME = 4 * 365 * 86400; // 4 years
    uint256 public constant MULTIPLIER = 1e18;

    address public token;
    uint256 public supply;

    mapping(address => LockedBalance) public locked;

    //everytime user deposit/withdraw/change_locktime, these values will be updated;
    uint256 public epoch;

    mapping(uint256 => Point) public pointHistory; // epoch -> unsigned point.
    mapping(address => mapping(uint256 => Point)) public userPointHistory; // user -> Point[user_epoch]
    mapping(address => uint256) public userPointEpoch;
    mapping(uint256 => int128) public slopeChanges; // time -> signed slope change

    // depositor -> user -> allowed
    mapping(address => mapping(address => bool)) public depositForAllowed;
    // user -> all allowed
    mapping(address => bool) public depositForAllAllowed;

    string public name;
    string public symbol;
    uint8 public decimals;

    /***
     * @notice Contract constructor
     * @param tokenAddr_ `YMWK` token address
     * @param name_ Token name
     * @param symbol_ Token symbol
     */
    constructor(
        address tokenAddr_,
        string memory name_,
        string memory symbol_
    ) {
        token = tokenAddr_;
        pointHistory[0].blk = block.number;
        pointHistory[0].ts = block.timestamp;

        decimals = ERC20(tokenAddr_).decimals();

        name = name_;
        symbol = symbol_;
    }

    /***
     * @notice Get the most recently recorded rate of voting power decrease for `addr`
     * @param addr_ Address of the user wallet
     * @return Value of the slope
     */
    function getLastUserSlope(address addr_) external view returns (int128) {
        uint256 _uEpoch = userPointEpoch[addr_];
        return userPointHistory[addr_][_uEpoch].slope;
    }

    /***
     * @notice Get the timestamp for checkpoint `idx_` for `addr_`
     * @param addr_ User wallet address
     * @param idx_ User epoch number
     * @return Epoch time of the checkpoint
     */
    function userPointHistoryTs(
        address addr_,
        uint256 idx_
    ) external view returns (uint256) {
        return userPointHistory[addr_][idx_].ts;
    }

    /***
     * @notice Get timestamp when `addr_`'s lock finishes
     * @param addr_ User wallet
     * @return Epoch time of the lock end
     */
    function lockedEnd(address addr_) external view returns (uint256) {
        return locked[addr_].end;
    }

    /***
     * @notice Record global and per-user data to checkpoint
     * @param addr_ User's wallet address. No user checkpoint if 0x0
     * @param oldLocked_ Pevious locked amount / end lock time for the user
     * @param newLocked_ New locked amount / end lock time for the user
     */
    function _checkpoint(
        address addr_,
        LockedBalance memory oldLocked_,
        LockedBalance memory newLocked_
    ) internal {
        Point memory _uOld;
        Point memory _uNew;
        int128 _oldDSlope;
        int128 _newDSlope;
        uint256 _epoch = epoch;

        if (addr_ != address(0)) {
            // Calculate slopes and biases
            // Kept at zero when they have to
            if (oldLocked_.end > block.timestamp && oldLocked_.amount > 0) {
                unchecked {
                    _uOld.slope = int128(oldLocked_.amount / int256(MAXTIME));
                }
                _uOld.bias =
                    _uOld.slope *
                    int128(uint128(oldLocked_.end - block.timestamp));
            }

            if (newLocked_.end > block.timestamp && newLocked_.amount > 0) {
                unchecked {
                    _uNew.slope = int128(
                        uint128(newLocked_.amount) / uint128(MAXTIME)
                    );
                }
                _uNew.bias =
                    _uNew.slope *
                    int128(uint128(newLocked_.end - block.timestamp));
            }

            // Read values of scheduled changes in the slope
            // old_locked.end can be in the past and in the future
            // new_locked.end can ONLY by in the FUTURE unless everything expired: than zeros
            _oldDSlope = slopeChanges[oldLocked_.end];
            if (newLocked_.end != 0) {
                if (newLocked_.end == oldLocked_.end) {
                    _newDSlope = _oldDSlope;
                } else {
                    _newDSlope = slopeChanges[newLocked_.end];
                }
            }
        }

        Point memory _lastPoint = Point({
            bias: 0,
            slope: 0,
            ts: block.timestamp,
            blk: block.number
        });
        if (_epoch > 0) {
            _lastPoint = Point({
                bias: pointHistory[_epoch].bias,
                slope: pointHistory[_epoch].slope,
                ts: pointHistory[_epoch].ts,
                blk: pointHistory[_epoch].blk
            });
        }
        uint256 _lastCheckpoint = _lastPoint.ts;

        // initial_last_point is used for extrapolation to calculate block number
        // (approximately, for *At methods) and save them
        // as we cannot figure that out exactly from inside the contract
        Point memory _initialLastPoint = Point({
            bias: _lastPoint.bias,
            slope: _lastPoint.slope,
            ts: _lastPoint.ts,
            blk: _lastPoint.blk
        });
        uint256 _blockSlope;
        if (block.timestamp > _lastPoint.ts) {
            _blockSlope =
                (MULTIPLIER * (block.number - _lastPoint.blk)) /
                (block.timestamp - _lastPoint.ts);
        }
        // If last point is already recorded in this block, slope=0
        // But that's ok b/c we know the block in such case

        // Go over weeks to fill history and calculate what the current point is
        uint256 _ti;
        unchecked {
            _ti = (_lastCheckpoint / WEEK) * WEEK;
        }
        for (uint256 i; i < 255; ) {
            // Hopefully it won't happen that this won't get used in 5 years!
            // If it does, users will be able to withdraw but vote weight will be broken
            _ti += WEEK;
            int128 _dSlope;
            if (_ti > block.timestamp) {
                _ti = block.timestamp;
            } else {
                _dSlope = slopeChanges[_ti];
            }

            _lastPoint.bias -=
                _lastPoint.slope *
                int128(uint128(_ti) - uint128(_lastCheckpoint));
            _lastPoint.slope += _dSlope;

            if (_lastPoint.bias < 0) {
                // This can happen
                _lastPoint.bias = 0;
            }
            if (_lastPoint.slope < 0) {
                // This cannot happen - just in case
                _lastPoint.slope = 0;
            }

            _lastCheckpoint = _ti;
            _lastPoint.ts = _ti;
            _lastPoint.blk =
                _initialLastPoint.blk +
                (_blockSlope * (_ti - _initialLastPoint.ts)) /
                MULTIPLIER;

            ++_epoch;

            if (_ti == block.timestamp) {
                _lastPoint.blk = block.number;
                break;
            } else {
                pointHistory[_epoch] = Point({
                    bias: _lastPoint.bias,
                    slope: _lastPoint.slope,
                    ts: _lastPoint.ts,
                    blk: _lastPoint.blk
                });
            }
            unchecked {
                ++i;
            }
        }

        epoch = _epoch;
        // Now point_history is filled until t=now

        if (addr_ != address(0)) {
            // If last point was in this block, the slope change has been applied already
            // But in such case we have 0 slope(s)
            _lastPoint.slope += (_uNew.slope - _uOld.slope);
            _lastPoint.bias += (_uNew.bias - _uOld.bias);
            if (_lastPoint.slope < 0) {
                _lastPoint.slope = 0;
            }
            if (_lastPoint.bias < 0) {
                _lastPoint.bias = 0;
            }
        }

        // Record the changed point into history
        pointHistory[_epoch] = _lastPoint;

        address _addr = addr_; // To avoid being "Stack Too Deep"

        if (_addr != address(0)) {
            // Schedule the slope changes (slope is going down)
            // We subtract new_user_slope from [new_locked.end]
            // and add old_user_slope to [old_locked.end]
            if (oldLocked_.end > block.timestamp) {
                // old_dslope was <something> - u_old.slope, so we cancel that
                _oldDSlope += _uOld.slope;
                if (newLocked_.end == oldLocked_.end) {
                    _oldDSlope -= _uNew.slope; // It was a new deposit, not extension
                }
                slopeChanges[oldLocked_.end] = _oldDSlope;
            }

            if (newLocked_.end > block.timestamp) {
                if (newLocked_.end > oldLocked_.end) {
                    _newDSlope -= _uNew.slope; // old slope disappeared at this point
                    slopeChanges[newLocked_.end] = _newDSlope;
                }
                // else: we recorded it already in old_dslope
            }

            // Now handle user history
            uint256 _userEpoch;
            unchecked {
                _userEpoch = userPointEpoch[_addr] + 1;
            }
            userPointEpoch[_addr] = _userEpoch;

            _uNew.ts = block.timestamp;
            _uNew.blk = block.number;
            userPointHistory[_addr][_userEpoch] = _uNew;
        }
    }

    /***
     * @notice Deposit and lock tokens for a user
     * @param addr_ User's wallet address
     * @param value_ Amount to deposit
     * @param unlockTime_ New time when to unlock the tokens, or 0 if unchanged
     * @param lockedBalance_ Previous locked amount / timestamp
     */
    function _depositFor(
        address addr_,
        uint256 value_,
        uint256 unlockTime_,
        LockedBalance memory lockedBalance_,
        uint128 type_
    ) internal {
        LockedBalance memory _locked = LockedBalance(
            lockedBalance_.amount,
            lockedBalance_.end
        );
        LockedBalance memory _oldLocked = LockedBalance(
            lockedBalance_.amount,
            lockedBalance_.end
        );

        uint256 _supplyBefore = supply;
        supply = _supplyBefore + value_;

        // Adding to existing lock, or if a lock is expired - creating a new one
        _locked.amount += value_.toInt256().toInt128();
        if (unlockTime_ != 0) {
            _locked.end = unlockTime_;
        }
        locked[addr_] = _locked;

        // Possibilities:
        // Both old_locked.end could be current or expired (>/< block.timestamp)
        // value == 0 (extend lock) or value > 0 (add to lock or extend lock)
        // _locked.end > block.timestamp (always)
        _checkpoint(addr_, _oldLocked, _locked);

        if (value_ != 0) {
            require(
                ERC20(token).transferFrom(addr_, address(this), value_),
                "Transfer failed"
            );
        }

        emit Deposit(addr_, value_, _locked.end, type_, block.timestamp);
        emit Supply(_supplyBefore, _supplyBefore + value_);
    }

    /***
     * @notice Record global data to checkpoint
     */
    function checkpoint() external {
        LockedBalance memory _old;
        LockedBalance memory _new;
        _checkpoint(address(0), _old, _new);
    }

    /***
     * @notice Deposit `_value` tokens for `_addr` and add to the lock
     * @dev Anyone (even a smart contract) can deposit for someone else, but
         cannot extend their locktime and deposit for a brand new user
     * @param addr_ User's wallet address
     * @param value_ Amount to add to user's lock
     */
    function depositFor(address addr_, uint256 value_) external nonReentrant {
        require(
            depositForAllAllowed[addr_] || depositForAllowed[msg.sender][addr_],
            "Not allowed to deposit for this address"
        );
        LockedBalance memory _locked = locked[addr_];

        require(value_ > 0, "Need non-zero value");
        require(_locked.amount > 0, "No existing lock found");
        require(
            _locked.end > block.timestamp,
            "Cannot add to expired lock. Withdraw"
        );

        _depositFor(addr_, value_, 0, locked[addr_], DEPOSIT_FOR_TYPE);
    }

    /**
     * @notice Toggles the permission for a specific depositor to call depositFor on behalf of the message sender.
     * @param depositor_ The address of the depositor whose permission is being toggled.
     */
    function toggleDepositForApproval(address depositor_) external {
        depositForAllowed[depositor_][msg.sender] = !depositForAllowed[
            depositor_
        ][msg.sender];
    }

    /**
     * @notice Toggles the permission for all addresses to call depositFor on behalf of the message sender.
     */
    function toggleDepositForAllApproval() external {
        depositForAllAllowed[msg.sender] = !depositForAllAllowed[msg.sender];
    }

    /***
     * @notice Deposit `_value` tokens for `msg.sender` and lock until `_unlock_time`
     * @param value_ Amount to deposit
     * @param unlockTime_ Epoch time when tokens unlock, rounded down to whole weeks
     */
    function createLock(
        uint256 value_,
        uint256 unlockTime_
    ) external nonReentrant {
        uint256 _unlockTimeRounded = (unlockTime_ / WEEK) * WEEK;
        LockedBalance memory _locked = locked[msg.sender];

        require(value_ > 0, "Need non-zero value");
        require(_locked.amount == 0, "Withdraw old tokens first");
        require(
            _unlockTimeRounded > block.timestamp,
            "Can only lock until time in the future"
        );
        require(
            _unlockTimeRounded <= block.timestamp + MAXTIME,
            "Voting lock can be 4 years max"
        );

        _depositFor(
            msg.sender,
            value_,
            _unlockTimeRounded,
            _locked,
            CREATE_LOCK_TYPE
        );
    }

    /***
     * @notice Deposit `_value` additional tokens for `msg.sender`
            without modifying the unlock time
     * @param value_ Amount of tokens to deposit and add to the lock
     */
    function increaseAmount(uint256 value_) external nonReentrant {
        LockedBalance memory _locked = locked[msg.sender];

        require(value_ > 0, "Need non-zero value");
        require(_locked.amount > 0, "No existing lock found");
        require(
            _locked.end > block.timestamp,
            "Cannot add to expired lock. Withdraw"
        );

        _depositFor(msg.sender, value_, 0, _locked, INCREASE_LOCK_AMOUNT);
    }

    /***
     * @notice Extend the unlock time for `msg.sender` to `_unlock_time`
     * @param unlockTime_ New epoch time for unlocking
     */
    function increaseUnlockTime(uint256 unlockTime_) external nonReentrant {
        LockedBalance memory _locked = locked[msg.sender];
        uint256 _unlockTimeRounded;
        unchecked {
            _unlockTimeRounded = (unlockTime_ / WEEK) * WEEK;
        }

        require(_locked.end > block.timestamp, "Lock expired");
        require(_locked.amount > 0, "Nothing is locked");
        require(
            _unlockTimeRounded > _locked.end,
            "Can only increase lock duration"
        );
        require(
            _unlockTimeRounded <= block.timestamp + MAXTIME,
            "Voting lock can be 4 years max"
        );

        _depositFor(
            msg.sender,
            0,
            _unlockTimeRounded,
            _locked,
            INCREASE_UNLOCK_TIME
        );
    }

    /***
     * @notice Withdraw all tokens for `msg.sender`
     * @dev Only possible if the lock has expired
     */
    function withdraw() external nonReentrant {
        LockedBalance memory _locked = LockedBalance(
            locked[msg.sender].amount,
            locked[msg.sender].end
        );
        require(block.timestamp >= _locked.end, "The lock didn't expire");
        uint256 _value = uint256(int256(_locked.amount));

        LockedBalance memory _oldLocked = LockedBalance(
            locked[msg.sender].amount,
            locked[msg.sender].end
        );

        _locked.end = 0;
        _locked.amount = 0;
        locked[msg.sender] = LockedBalance(_locked.amount, _locked.end);
        uint256 _supplyBefore = supply;
        supply = _supplyBefore - _value;

        // old_locked can have either expired <= timestamp or zero end
        // _locked has only 0 end
        // Both can have >= 0 amount
        _checkpoint(msg.sender, _oldLocked, _locked);

        require(ERC20(token).transfer(msg.sender, _value), "Transfer failed");

        emit Withdraw(msg.sender, _value, block.timestamp);
        emit Supply(_supplyBefore, _supplyBefore - _value);
    }

    // The following ERC20/minime-compatible methods are not real balanceOf and supply!
    // They measure the weights for the purpose of voting, so they don't represent
    // real coins.

    /***
     * @notice Binary search to estimate epoch for block number
     * @param block_ Block to find
     * @param maxEpoch_ Don't go beyond this epoch
     * @return Approximate epoch for block
     */
    function findBlockEpoch(
        uint256 block_,
        uint256 maxEpoch_
    ) internal view returns (uint256) {
        // Binary search
        uint256 _min;
        uint256 _max = maxEpoch_;
        unchecked {
            for (uint256 i; i < 128; ++i) {
                // Will be always enough for 128-bit numbers
                if (_min >= _max) {
                    break;
                }
                uint256 _mid = (_min + _max + 1) / 2;
                if (pointHistory[_mid].blk <= block_) {
                    _min = _mid;
                } else {
                    _max = _mid - 1;
                }
            }
        }
        return _min;
    }

    /***
     * @notice Get the current voting power for `msg.sender`
     * @dev Adheres to the ERC20 `balanceOf` interface for Aragon compatibility
     * @param addr_ User wallet address
     * @param t_ Epoch time to return voting power at
     * @return User voting power
     */
    function balanceOf(
        address addr_,
        uint256 t_
    ) external view returns (uint256) {
        uint256 epoch_ = userPointEpoch[addr_];
        if (epoch_ == 0) {
            return 0;
        } else {
            Point memory lastPoint = userPointHistory[addr_][epoch_];
            lastPoint.bias -=
                lastPoint.slope *
                int128(int256(t_) - int256(lastPoint.ts));
            if (lastPoint.bias < 0) {
                lastPoint.bias = 0;
            }
            return uint256(int256(lastPoint.bias));
        }
    }

    /***
     * @notice Get the current voting power for `msg.sender`
     * @dev Adheres to the ERC20 `balanceOf` interface for Aragon compatibility
     * @param addr_ User wallet address
     * @return User voting power
     */
    function balanceOf(address addr_) external view returns (uint256) {
        uint256 epoch_ = userPointEpoch[addr_];
        if (epoch_ == 0) {
            return 0;
        } else {
            Point memory lastPoint = userPointHistory[addr_][epoch_];
            lastPoint.bias -=
                lastPoint.slope *
                int128(int256(block.timestamp) - int256(lastPoint.ts));
            if (lastPoint.bias < 0) {
                lastPoint.bias = 0;
            }
            return uint256(int256(lastPoint.bias));
        }
    }

    /***
     * @notice Measure voting power of `addr` at block height `_block`
     * @dev Adheres to MiniMe `balanceOfAt` interface: https://github.com/Giveth/minime
     * @param addr_ User's wallet address
     * @param block_ Block to calculate the voting power at
     * @return Voting power
     */
    function balanceOfAt(
        address addr_,
        uint256 block_
    ) external view returns (uint256) {
        // Copying and pasting totalSupply code because Vyper cannot pass by
        // reference yet
        require(block_ <= block.number, "Cannot look up future block");

        // Binary search
        uint256 min_;
        uint256 max_ = userPointEpoch[addr_];

        unchecked {
            for (uint i; i < 128; ++i) {
                // Will be always enough for 128-bit numbers
                if (min_ >= max_) {
                    break;
                }
                uint256 mid_ = (min_ + max_ + 1) / 2;
                if (userPointHistory[addr_][mid_].blk <= block_) {
                    min_ = mid_;
                } else {
                    max_ = mid_ - 1;
                }
            }
        }

        Point memory _upoint = userPointHistory[addr_][min_];
        uint256 _maxEpoch = epoch;
        uint256 _epoch = findBlockEpoch(block_, _maxEpoch);
        Point memory _point0 = pointHistory[_epoch];
        uint256 _dBlock;
        uint256 _dt;

        if (_epoch < _maxEpoch) {
            Point memory _point1 = pointHistory[_epoch + 1];
            _dBlock = _point1.blk - _point0.blk;
            _dt = _point1.ts - _point0.ts;
        } else {
            _dBlock = block.number - _point0.blk;
            _dt = block.timestamp - _point0.ts;
        }

        uint256 _blockTime = _point0.ts;
        if (_dBlock != 0) {
            _blockTime += (_dt * (block_ - _point0.blk)) / _dBlock;
        }

        _upoint.bias -=
            _upoint.slope *
            int128(int256(_blockTime) - int256(_upoint.ts));
        if (_upoint.bias >= 0) {
            return uint256(int256(_upoint.bias));
        } else {
            return 0;
        }
    }

    /***
     * @notice Calculate total voting power at some point in the past
     * @param point_ The point (bias/slope) to start search from
     * @param t_ Time to calculate the total voting power at
     * @return Total voting power at that time
     */
    function supplyAt(
        Point memory point_,
        uint256 t_
    ) internal view returns (uint256) {
        Point memory _lastPoint = point_;
        uint256 _ti;
        unchecked {
            _ti = (_lastPoint.ts / WEEK) * WEEK;
        }
        for (uint256 i; i < 255; ) {
            _ti += WEEK;
            int128 _dSlope;
            if (_ti > t_) {
                _ti = t_;
            } else {
                _dSlope = slopeChanges[_ti];
            }
            _lastPoint.bias -=
                _lastPoint.slope *
                int128(int256(_ti) - int256(_lastPoint.ts));
            if (_ti == t_) {
                break;
            }
            _lastPoint.slope += _dSlope;
            _lastPoint.ts = _ti;
            unchecked {
                ++i;
            }
        }

        if (_lastPoint.bias < 0) {
            _lastPoint.bias = 0;
        }
        return uint256(int256(_lastPoint.bias));
    }

    /***
     * @notice Calculate total voting power
     * @dev Adheres to the ERC20 `totalSupply` interface for Aragon compatibility
     * @param t_ Time to calculate the total voting power at
     * @return Total voting power
     */
    function totalSupply(uint256 t_) external view returns (uint256) {
        uint256 _epoch = epoch;
        Point memory _lastPoint = pointHistory[_epoch];
        return supplyAt(_lastPoint, t_);
    }

    /***
     * @notice Calculate total voting power
     * @dev Adheres to the ERC20 `totalSupply` interface for Aragon compatibility
     * @return Total voting power
     */
    function totalSupply() external view returns (uint256) {
        uint256 _epoch = epoch;
        Point memory _lastPoint = pointHistory[_epoch];
        return supplyAt(_lastPoint, block.timestamp);
    }

    /***
     * @notice Calculate total voting power at some point in the past
     * @param block_ Block to calculate the total voting power at
     * @return Total voting power at `_block`
     */
    function totalSupplyAt(uint256 block_) external view returns (uint256) {
        require(block_ <= block.number, "Invalid block number");
        uint256 _epoch = epoch;
        uint256 _targetEpoch = findBlockEpoch(block_, _epoch);

        Point memory _point = pointHistory[_targetEpoch];
        if (_point.blk > block_) {
            return 0;
        }
        uint256 _dt;
        if (_targetEpoch < _epoch) {
            Point memory _pointNext = pointHistory[_targetEpoch + 1];
            if (_point.blk != _pointNext.blk) {
                _dt =
                    ((block_ - _point.blk) * (_pointNext.ts - _point.ts)) /
                    (_pointNext.blk - _point.blk);
            }
        } else {
            if (_point.blk != block.number) {
                _dt =
                    ((block_ - _point.blk) * (block.timestamp - _point.ts)) /
                    (block.number - _point.blk);
            }
        }
        // Now _dt contains info on how far are we beyond point
        return supplyAt(_point, _point.ts + _dt);
    }
}

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

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

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

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

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * 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}.
     *
     * 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 default value returned by this function, unless
     * it's 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;
            // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
            // decrementing then incrementing.
            _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;
        unchecked {
            // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
            _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;
            // Overflow not possible: amount <= accountBalance <= totalSupply.
            _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 {}
}

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (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;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

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

pragma solidity ^0.8.0;

/**
 * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
 * checks.
 *
 * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
 * easily result in undesired exploitation or bugs, since developers usually
 * assume that overflows raise errors. `SafeCast` restores this intuition by
 * reverting the transaction when such an operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 *
 * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing
 * all math on `uint256` and `int256` and then downcasting.
 */
library SafeCast {
    /**
     * @dev Returns the downcasted uint248 from uint256, reverting on
     * overflow (when the input is greater than largest uint248).
     *
     * Counterpart to Solidity's `uint248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     *
     * _Available since v4.7._
     */
    function toUint248(uint256 value) internal pure returns (uint248) {
        require(value <= type(uint248).max, "SafeCast: value doesn't fit in 248 bits");
        return uint248(value);
    }

    /**
     * @dev Returns the downcasted uint240 from uint256, reverting on
     * overflow (when the input is greater than largest uint240).
     *
     * Counterpart to Solidity's `uint240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     *
     * _Available since v4.7._
     */
    function toUint240(uint256 value) internal pure returns (uint240) {
        require(value <= type(uint240).max, "SafeCast: value doesn't fit in 240 bits");
        return uint240(value);
    }

    /**
     * @dev Returns the downcasted uint232 from uint256, reverting on
     * overflow (when the input is greater than largest uint232).
     *
     * Counterpart to Solidity's `uint232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     *
     * _Available since v4.7._
     */
    function toUint232(uint256 value) internal pure returns (uint232) {
        require(value <= type(uint232).max, "SafeCast: value doesn't fit in 232 bits");
        return uint232(value);
    }

    /**
     * @dev Returns the downcasted uint224 from uint256, reverting on
     * overflow (when the input is greater than largest uint224).
     *
     * Counterpart to Solidity's `uint224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     *
     * _Available since v4.2._
     */
    function toUint224(uint256 value) internal pure returns (uint224) {
        require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits");
        return uint224(value);
    }

    /**
     * @dev Returns the downcasted uint216 from uint256, reverting on
     * overflow (when the input is greater than largest uint216).
     *
     * Counterpart to Solidity's `uint216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     *
     * _Available since v4.7._
     */
    function toUint216(uint256 value) internal pure returns (uint216) {
        require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits");
        return uint216(value);
    }

    /**
     * @dev Returns the downcasted uint208 from uint256, reverting on
     * overflow (when the input is greater than largest uint208).
     *
     * Counterpart to Solidity's `uint208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     *
     * _Available since v4.7._
     */
    function toUint208(uint256 value) internal pure returns (uint208) {
        require(value <= type(uint208).max, "SafeCast: value doesn't fit in 208 bits");
        return uint208(value);
    }

    /**
     * @dev Returns the downcasted uint200 from uint256, reverting on
     * overflow (when the input is greater than largest uint200).
     *
     * Counterpart to Solidity's `uint200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     *
     * _Available since v4.7._
     */
    function toUint200(uint256 value) internal pure returns (uint200) {
        require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits");
        return uint200(value);
    }

    /**
     * @dev Returns the downcasted uint192 from uint256, reverting on
     * overflow (when the input is greater than largest uint192).
     *
     * Counterpart to Solidity's `uint192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     *
     * _Available since v4.7._
     */
    function toUint192(uint256 value) internal pure returns (uint192) {
        require(value <= type(uint192).max, "SafeCast: value doesn't fit in 192 bits");
        return uint192(value);
    }

    /**
     * @dev Returns the downcasted uint184 from uint256, reverting on
     * overflow (when the input is greater than largest uint184).
     *
     * Counterpart to Solidity's `uint184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     *
     * _Available since v4.7._
     */
    function toUint184(uint256 value) internal pure returns (uint184) {
        require(value <= type(uint184).max, "SafeCast: value doesn't fit in 184 bits");
        return uint184(value);
    }

    /**
     * @dev Returns the downcasted uint176 from uint256, reverting on
     * overflow (when the input is greater than largest uint176).
     *
     * Counterpart to Solidity's `uint176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     *
     * _Available since v4.7._
     */
    function toUint176(uint256 value) internal pure returns (uint176) {
        require(value <= type(uint176).max, "SafeCast: value doesn't fit in 176 bits");
        return uint176(value);
    }

    /**
     * @dev Returns the downcasted uint168 from uint256, reverting on
     * overflow (when the input is greater than largest uint168).
     *
     * Counterpart to Solidity's `uint168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     *
     * _Available since v4.7._
     */
    function toUint168(uint256 value) internal pure returns (uint168) {
        require(value <= type(uint168).max, "SafeCast: value doesn't fit in 168 bits");
        return uint168(value);
    }

    /**
     * @dev Returns the downcasted uint160 from uint256, reverting on
     * overflow (when the input is greater than largest uint160).
     *
     * Counterpart to Solidity's `uint160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     *
     * _Available since v4.7._
     */
    function toUint160(uint256 value) internal pure returns (uint160) {
        require(value <= type(uint160).max, "SafeCast: value doesn't fit in 160 bits");
        return uint160(value);
    }

    /**
     * @dev Returns the downcasted uint152 from uint256, reverting on
     * overflow (when the input is greater than largest uint152).
     *
     * Counterpart to Solidity's `uint152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     *
     * _Available since v4.7._
     */
    function toUint152(uint256 value) internal pure returns (uint152) {
        require(value <= type(uint152).max, "SafeCast: value doesn't fit in 152 bits");
        return uint152(value);
    }

    /**
     * @dev Returns the downcasted uint144 from uint256, reverting on
     * overflow (when the input is greater than largest uint144).
     *
     * Counterpart to Solidity's `uint144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     *
     * _Available since v4.7._
     */
    function toUint144(uint256 value) internal pure returns (uint144) {
        require(value <= type(uint144).max, "SafeCast: value doesn't fit in 144 bits");
        return uint144(value);
    }

    /**
     * @dev Returns the downcasted uint136 from uint256, reverting on
     * overflow (when the input is greater than largest uint136).
     *
     * Counterpart to Solidity's `uint136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     *
     * _Available since v4.7._
     */
    function toUint136(uint256 value) internal pure returns (uint136) {
        require(value <= type(uint136).max, "SafeCast: value doesn't fit in 136 bits");
        return uint136(value);
    }

    /**
     * @dev Returns the downcasted uint128 from uint256, reverting on
     * overflow (when the input is greater than largest uint128).
     *
     * Counterpart to Solidity's `uint128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     *
     * _Available since v2.5._
     */
    function toUint128(uint256 value) internal pure returns (uint128) {
        require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits");
        return uint128(value);
    }

    /**
     * @dev Returns the downcasted uint120 from uint256, reverting on
     * overflow (when the input is greater than largest uint120).
     *
     * Counterpart to Solidity's `uint120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     *
     * _Available since v4.7._
     */
    function toUint120(uint256 value) internal pure returns (uint120) {
        require(value <= type(uint120).max, "SafeCast: value doesn't fit in 120 bits");
        return uint120(value);
    }

    /**
     * @dev Returns the downcasted uint112 from uint256, reverting on
     * overflow (when the input is greater than largest uint112).
     *
     * Counterpart to Solidity's `uint112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     *
     * _Available since v4.7._
     */
    function toUint112(uint256 value) internal pure returns (uint112) {
        require(value <= type(uint112).max, "SafeCast: value doesn't fit in 112 bits");
        return uint112(value);
    }

    /**
     * @dev Returns the downcasted uint104 from uint256, reverting on
     * overflow (when the input is greater than largest uint104).
     *
     * Counterpart to Solidity's `uint104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     *
     * _Available since v4.7._
     */
    function toUint104(uint256 value) internal pure returns (uint104) {
        require(value <= type(uint104).max, "SafeCast: value doesn't fit in 104 bits");
        return uint104(value);
    }

    /**
     * @dev Returns the downcasted uint96 from uint256, reverting on
     * overflow (when the input is greater than largest uint96).
     *
     * Counterpart to Solidity's `uint96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     *
     * _Available since v4.2._
     */
    function toUint96(uint256 value) internal pure returns (uint96) {
        require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits");
        return uint96(value);
    }

    /**
     * @dev Returns the downcasted uint88 from uint256, reverting on
     * overflow (when the input is greater than largest uint88).
     *
     * Counterpart to Solidity's `uint88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     *
     * _Available since v4.7._
     */
    function toUint88(uint256 value) internal pure returns (uint88) {
        require(value <= type(uint88).max, "SafeCast: value doesn't fit in 88 bits");
        return uint88(value);
    }

    /**
     * @dev Returns the downcasted uint80 from uint256, reverting on
     * overflow (when the input is greater than largest uint80).
     *
     * Counterpart to Solidity's `uint80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     *
     * _Available since v4.7._
     */
    function toUint80(uint256 value) internal pure returns (uint80) {
        require(value <= type(uint80).max, "SafeCast: value doesn't fit in 80 bits");
        return uint80(value);
    }

    /**
     * @dev Returns the downcasted uint72 from uint256, reverting on
     * overflow (when the input is greater than largest uint72).
     *
     * Counterpart to Solidity's `uint72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     *
     * _Available since v4.7._
     */
    function toUint72(uint256 value) internal pure returns (uint72) {
        require(value <= type(uint72).max, "SafeCast: value doesn't fit in 72 bits");
        return uint72(value);
    }

    /**
     * @dev Returns the downcasted uint64 from uint256, reverting on
     * overflow (when the input is greater than largest uint64).
     *
     * Counterpart to Solidity's `uint64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     *
     * _Available since v2.5._
     */
    function toUint64(uint256 value) internal pure returns (uint64) {
        require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits");
        return uint64(value);
    }

    /**
     * @dev Returns the downcasted uint56 from uint256, reverting on
     * overflow (when the input is greater than largest uint56).
     *
     * Counterpart to Solidity's `uint56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     *
     * _Available since v4.7._
     */
    function toUint56(uint256 value) internal pure returns (uint56) {
        require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits");
        return uint56(value);
    }

    /**
     * @dev Returns the downcasted uint48 from uint256, reverting on
     * overflow (when the input is greater than largest uint48).
     *
     * Counterpart to Solidity's `uint48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     *
     * _Available since v4.7._
     */
    function toUint48(uint256 value) internal pure returns (uint48) {
        require(value <= type(uint48).max, "SafeCast: value doesn't fit in 48 bits");
        return uint48(value);
    }

    /**
     * @dev Returns the downcasted uint40 from uint256, reverting on
     * overflow (when the input is greater than largest uint40).
     *
     * Counterpart to Solidity's `uint40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     *
     * _Available since v4.7._
     */
    function toUint40(uint256 value) internal pure returns (uint40) {
        require(value <= type(uint40).max, "SafeCast: value doesn't fit in 40 bits");
        return uint40(value);
    }

    /**
     * @dev Returns the downcasted uint32 from uint256, reverting on
     * overflow (when the input is greater than largest uint32).
     *
     * Counterpart to Solidity's `uint32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     *
     * _Available since v2.5._
     */
    function toUint32(uint256 value) internal pure returns (uint32) {
        require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits");
        return uint32(value);
    }

    /**
     * @dev Returns the downcasted uint24 from uint256, reverting on
     * overflow (when the input is greater than largest uint24).
     *
     * Counterpart to Solidity's `uint24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     *
     * _Available since v4.7._
     */
    function toUint24(uint256 value) internal pure returns (uint24) {
        require(value <= type(uint24).max, "SafeCast: value doesn't fit in 24 bits");
        return uint24(value);
    }

    /**
     * @dev Returns the downcasted uint16 from uint256, reverting on
     * overflow (when the input is greater than largest uint16).
     *
     * Counterpart to Solidity's `uint16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     *
     * _Available since v2.5._
     */
    function toUint16(uint256 value) internal pure returns (uint16) {
        require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits");
        return uint16(value);
    }

    /**
     * @dev Returns the downcasted uint8 from uint256, reverting on
     * overflow (when the input is greater than largest uint8).
     *
     * Counterpart to Solidity's `uint8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     *
     * _Available since v2.5._
     */
    function toUint8(uint256 value) internal pure returns (uint8) {
        require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits");
        return uint8(value);
    }

    /**
     * @dev Converts a signed int256 into an unsigned uint256.
     *
     * Requirements:
     *
     * - input must be greater than or equal to 0.
     *
     * _Available since v3.0._
     */
    function toUint256(int256 value) internal pure returns (uint256) {
        require(value >= 0, "SafeCast: value must be positive");
        return uint256(value);
    }

    /**
     * @dev Returns the downcasted int248 from int256, reverting on
     * overflow (when the input is less than smallest int248 or
     * greater than largest int248).
     *
     * Counterpart to Solidity's `int248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     *
     * _Available since v4.7._
     */
    function toInt248(int256 value) internal pure returns (int248 downcasted) {
        downcasted = int248(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 248 bits");
    }

    /**
     * @dev Returns the downcasted int240 from int256, reverting on
     * overflow (when the input is less than smallest int240 or
     * greater than largest int240).
     *
     * Counterpart to Solidity's `int240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     *
     * _Available since v4.7._
     */
    function toInt240(int256 value) internal pure returns (int240 downcasted) {
        downcasted = int240(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 240 bits");
    }

    /**
     * @dev Returns the downcasted int232 from int256, reverting on
     * overflow (when the input is less than smallest int232 or
     * greater than largest int232).
     *
     * Counterpart to Solidity's `int232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     *
     * _Available since v4.7._
     */
    function toInt232(int256 value) internal pure returns (int232 downcasted) {
        downcasted = int232(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 232 bits");
    }

    /**
     * @dev Returns the downcasted int224 from int256, reverting on
     * overflow (when the input is less than smallest int224 or
     * greater than largest int224).
     *
     * Counterpart to Solidity's `int224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     *
     * _Available since v4.7._
     */
    function toInt224(int256 value) internal pure returns (int224 downcasted) {
        downcasted = int224(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 224 bits");
    }

    /**
     * @dev Returns the downcasted int216 from int256, reverting on
     * overflow (when the input is less than smallest int216 or
     * greater than largest int216).
     *
     * Counterpart to Solidity's `int216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     *
     * _Available since v4.7._
     */
    function toInt216(int256 value) internal pure returns (int216 downcasted) {
        downcasted = int216(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 216 bits");
    }

    /**
     * @dev Returns the downcasted int208 from int256, reverting on
     * overflow (when the input is less than smallest int208 or
     * greater than largest int208).
     *
     * Counterpart to Solidity's `int208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     *
     * _Available since v4.7._
     */
    function toInt208(int256 value) internal pure returns (int208 downcasted) {
        downcasted = int208(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 208 bits");
    }

    /**
     * @dev Returns the downcasted int200 from int256, reverting on
     * overflow (when the input is less than smallest int200 or
     * greater than largest int200).
     *
     * Counterpart to Solidity's `int200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     *
     * _Available since v4.7._
     */
    function toInt200(int256 value) internal pure returns (int200 downcasted) {
        downcasted = int200(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 200 bits");
    }

    /**
     * @dev Returns the downcasted int192 from int256, reverting on
     * overflow (when the input is less than smallest int192 or
     * greater than largest int192).
     *
     * Counterpart to Solidity's `int192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     *
     * _Available since v4.7._
     */
    function toInt192(int256 value) internal pure returns (int192 downcasted) {
        downcasted = int192(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 192 bits");
    }

    /**
     * @dev Returns the downcasted int184 from int256, reverting on
     * overflow (when the input is less than smallest int184 or
     * greater than largest int184).
     *
     * Counterpart to Solidity's `int184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     *
     * _Available since v4.7._
     */
    function toInt184(int256 value) internal pure returns (int184 downcasted) {
        downcasted = int184(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 184 bits");
    }

    /**
     * @dev Returns the downcasted int176 from int256, reverting on
     * overflow (when the input is less than smallest int176 or
     * greater than largest int176).
     *
     * Counterpart to Solidity's `int176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     *
     * _Available since v4.7._
     */
    function toInt176(int256 value) internal pure returns (int176 downcasted) {
        downcasted = int176(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 176 bits");
    }

    /**
     * @dev Returns the downcasted int168 from int256, reverting on
     * overflow (when the input is less than smallest int168 or
     * greater than largest int168).
     *
     * Counterpart to Solidity's `int168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     *
     * _Available since v4.7._
     */
    function toInt168(int256 value) internal pure returns (int168 downcasted) {
        downcasted = int168(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 168 bits");
    }

    /**
     * @dev Returns the downcasted int160 from int256, reverting on
     * overflow (when the input is less than smallest int160 or
     * greater than largest int160).
     *
     * Counterpart to Solidity's `int160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     *
     * _Available since v4.7._
     */
    function toInt160(int256 value) internal pure returns (int160 downcasted) {
        downcasted = int160(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 160 bits");
    }

    /**
     * @dev Returns the downcasted int152 from int256, reverting on
     * overflow (when the input is less than smallest int152 or
     * greater than largest int152).
     *
     * Counterpart to Solidity's `int152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     *
     * _Available since v4.7._
     */
    function toInt152(int256 value) internal pure returns (int152 downcasted) {
        downcasted = int152(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 152 bits");
    }

    /**
     * @dev Returns the downcasted int144 from int256, reverting on
     * overflow (when the input is less than smallest int144 or
     * greater than largest int144).
     *
     * Counterpart to Solidity's `int144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     *
     * _Available since v4.7._
     */
    function toInt144(int256 value) internal pure returns (int144 downcasted) {
        downcasted = int144(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 144 bits");
    }

    /**
     * @dev Returns the downcasted int136 from int256, reverting on
     * overflow (when the input is less than smallest int136 or
     * greater than largest int136).
     *
     * Counterpart to Solidity's `int136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     *
     * _Available since v4.7._
     */
    function toInt136(int256 value) internal pure returns (int136 downcasted) {
        downcasted = int136(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 136 bits");
    }

    /**
     * @dev Returns the downcasted int128 from int256, reverting on
     * overflow (when the input is less than smallest int128 or
     * greater than largest int128).
     *
     * Counterpart to Solidity's `int128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     *
     * _Available since v3.1._
     */
    function toInt128(int256 value) internal pure returns (int128 downcasted) {
        downcasted = int128(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 128 bits");
    }

    /**
     * @dev Returns the downcasted int120 from int256, reverting on
     * overflow (when the input is less than smallest int120 or
     * greater than largest int120).
     *
     * Counterpart to Solidity's `int120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     *
     * _Available since v4.7._
     */
    function toInt120(int256 value) internal pure returns (int120 downcasted) {
        downcasted = int120(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 120 bits");
    }

    /**
     * @dev Returns the downcasted int112 from int256, reverting on
     * overflow (when the input is less than smallest int112 or
     * greater than largest int112).
     *
     * Counterpart to Solidity's `int112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     *
     * _Available since v4.7._
     */
    function toInt112(int256 value) internal pure returns (int112 downcasted) {
        downcasted = int112(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 112 bits");
    }

    /**
     * @dev Returns the downcasted int104 from int256, reverting on
     * overflow (when the input is less than smallest int104 or
     * greater than largest int104).
     *
     * Counterpart to Solidity's `int104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     *
     * _Available since v4.7._
     */
    function toInt104(int256 value) internal pure returns (int104 downcasted) {
        downcasted = int104(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 104 bits");
    }

    /**
     * @dev Returns the downcasted int96 from int256, reverting on
     * overflow (when the input is less than smallest int96 or
     * greater than largest int96).
     *
     * Counterpart to Solidity's `int96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     *
     * _Available since v4.7._
     */
    function toInt96(int256 value) internal pure returns (int96 downcasted) {
        downcasted = int96(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 96 bits");
    }

    /**
     * @dev Returns the downcasted int88 from int256, reverting on
     * overflow (when the input is less than smallest int88 or
     * greater than largest int88).
     *
     * Counterpart to Solidity's `int88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     *
     * _Available since v4.7._
     */
    function toInt88(int256 value) internal pure returns (int88 downcasted) {
        downcasted = int88(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 88 bits");
    }

    /**
     * @dev Returns the downcasted int80 from int256, reverting on
     * overflow (when the input is less than smallest int80 or
     * greater than largest int80).
     *
     * Counterpart to Solidity's `int80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     *
     * _Available since v4.7._
     */
    function toInt80(int256 value) internal pure returns (int80 downcasted) {
        downcasted = int80(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 80 bits");
    }

    /**
     * @dev Returns the downcasted int72 from int256, reverting on
     * overflow (when the input is less than smallest int72 or
     * greater than largest int72).
     *
     * Counterpart to Solidity's `int72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     *
     * _Available since v4.7._
     */
    function toInt72(int256 value) internal pure returns (int72 downcasted) {
        downcasted = int72(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 72 bits");
    }

    /**
     * @dev Returns the downcasted int64 from int256, reverting on
     * overflow (when the input is less than smallest int64 or
     * greater than largest int64).
     *
     * Counterpart to Solidity's `int64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     *
     * _Available since v3.1._
     */
    function toInt64(int256 value) internal pure returns (int64 downcasted) {
        downcasted = int64(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 64 bits");
    }

    /**
     * @dev Returns the downcasted int56 from int256, reverting on
     * overflow (when the input is less than smallest int56 or
     * greater than largest int56).
     *
     * Counterpart to Solidity's `int56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     *
     * _Available since v4.7._
     */
    function toInt56(int256 value) internal pure returns (int56 downcasted) {
        downcasted = int56(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 56 bits");
    }

    /**
     * @dev Returns the downcasted int48 from int256, reverting on
     * overflow (when the input is less than smallest int48 or
     * greater than largest int48).
     *
     * Counterpart to Solidity's `int48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     *
     * _Available since v4.7._
     */
    function toInt48(int256 value) internal pure returns (int48 downcasted) {
        downcasted = int48(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 48 bits");
    }

    /**
     * @dev Returns the downcasted int40 from int256, reverting on
     * overflow (when the input is less than smallest int40 or
     * greater than largest int40).
     *
     * Counterpart to Solidity's `int40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     *
     * _Available since v4.7._
     */
    function toInt40(int256 value) internal pure returns (int40 downcasted) {
        downcasted = int40(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 40 bits");
    }

    /**
     * @dev Returns the downcasted int32 from int256, reverting on
     * overflow (when the input is less than smallest int32 or
     * greater than largest int32).
     *
     * Counterpart to Solidity's `int32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     *
     * _Available since v3.1._
     */
    function toInt32(int256 value) internal pure returns (int32 downcasted) {
        downcasted = int32(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 32 bits");
    }

    /**
     * @dev Returns the downcasted int24 from int256, reverting on
     * overflow (when the input is less than smallest int24 or
     * greater than largest int24).
     *
     * Counterpart to Solidity's `int24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     *
     * _Available since v4.7._
     */
    function toInt24(int256 value) internal pure returns (int24 downcasted) {
        downcasted = int24(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 24 bits");
    }

    /**
     * @dev Returns the downcasted int16 from int256, reverting on
     * overflow (when the input is less than smallest int16 or
     * greater than largest int16).
     *
     * Counterpart to Solidity's `int16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     *
     * _Available since v3.1._
     */
    function toInt16(int256 value) internal pure returns (int16 downcasted) {
        downcasted = int16(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 16 bits");
    }

    /**
     * @dev Returns the downcasted int8 from int256, reverting on
     * overflow (when the input is less than smallest int8 or
     * greater than largest int8).
     *
     * Counterpart to Solidity's `int8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     *
     * _Available since v3.1._
     */
    function toInt8(int256 value) internal pure returns (int8 downcasted) {
        downcasted = int8(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 8 bits");
    }

    /**
     * @dev Converts an unsigned uint256 into a signed int256.
     *
     * Requirements:
     *
     * - input must be less than or equal to maxInt256.
     *
     * _Available since v3.0._
     */
    function toInt256(uint256 value) internal pure returns (int256) {
        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
        require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256");
        return int256(value);
    }
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"tokenAddr_","type":"address"},{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"provider","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"locktime","type":"uint256"},{"indexed":false,"internalType":"uint128","name":"_type","type":"uint128"},{"indexed":false,"internalType":"uint256","name":"ts","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"prevSupply","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"supply","type":"uint256"}],"name":"Supply","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"provider","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"ts","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"MAXTIME","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MULTIPLIER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WEEK","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr_","type":"address"},{"internalType":"uint256","name":"t_","type":"uint256"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr_","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr_","type":"address"},{"internalType":"uint256","name":"block_","type":"uint256"}],"name":"balanceOfAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"checkpoint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value_","type":"uint256"},{"internalType":"uint256","name":"unlockTime_","type":"uint256"}],"name":"createLock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr_","type":"address"},{"internalType":"uint256","name":"value_","type":"uint256"}],"name":"depositFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"depositForAllAllowed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"depositForAllowed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"epoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr_","type":"address"}],"name":"getLastUserSlope","outputs":[{"internalType":"int128","name":"","type":"int128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"value_","type":"uint256"}],"name":"increaseAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"unlockTime_","type":"uint256"}],"name":"increaseUnlockTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"locked","outputs":[{"internalType":"int128","name":"amount","type":"int128"},{"internalType":"uint256","name":"end","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr_","type":"address"}],"name":"lockedEnd","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"pointHistory","outputs":[{"internalType":"int128","name":"bias","type":"int128"},{"internalType":"int128","name":"slope","type":"int128"},{"internalType":"uint256","name":"ts","type":"uint256"},{"internalType":"uint256","name":"blk","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"slopeChanges","outputs":[{"internalType":"int128","name":"","type":"int128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"supply","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":"toggleDepositForAllApproval","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"depositor_","type":"address"}],"name":"toggleDepositForApproval","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"t_","type":"uint256"}],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"block_","type":"uint256"}],"name":"totalSupplyAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userPointEpoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"userPointHistory","outputs":[{"internalType":"int128","name":"bias","type":"int128"},{"internalType":"int128","name":"slope","type":"int128"},{"internalType":"uint256","name":"ts","type":"uint256"},{"internalType":"uint256","name":"blk","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr_","type":"address"},{"internalType":"uint256","name":"idx_","type":"uint256"}],"name":"userPointHistoryTs","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b5060405162002fc438038062002fc4833981016040819052620000349162000205565b6001600081815581546001600160a01b0319166001600160a01b038616908117909255805260056020908152437f05b8ccbb9d4d8fb16ea74ce3c29a41f1b461fbdaff4714a0d9a8eb05499746be55427f05b8ccbb9d4d8fb16ea74ce3c29a41f1b461fbdaff4714a0d9a8eb05499746bd556040805163313ce56760e01b8152905163313ce567926004808401939192918290030181865afa158015620000df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200010591906200028f565b600d805460ff191660ff92909216919091179055600b6200012783826200034a565b50600c6200013682826200034a565b5050505062000416565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200016857600080fd5b81516001600160401b038082111562000185576200018562000140565b604051601f8301601f19908116603f01168101908282118183101715620001b057620001b062000140565b81604052838152602092508683858801011115620001cd57600080fd5b600091505b83821015620001f15785820183015181830184015290820190620001d2565b600093810190920192909252949350505050565b6000806000606084860312156200021b57600080fd5b83516001600160a01b03811681146200023357600080fd5b60208501519093506001600160401b03808211156200025157600080fd5b6200025f8783880162000156565b935060408601519150808211156200027657600080fd5b50620002858682870162000156565b9150509250925092565b600060208284031215620002a257600080fd5b815160ff81168114620002b457600080fd5b9392505050565b600181811c90821680620002d057607f821691505b602082108103620002f157634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200034557600081815260208120601f850160051c81016020861015620003205750805b601f850160051c820191505b8181101562000341578281556001016200032c565b5050505b505050565b81516001600160401b0381111562000366576200036662000140565b6200037e81620003778454620002bb565b84620002f7565b602080601f831160018114620003b657600084156200039d5750858301515b600019600386901b1c1916600185901b17855562000341565b600085815260208120601f198616915b82811015620003e757888601518255948401946001909101908401620003c6565b5085821015620004065787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b612b9e80620004266000396000f3fe608060405234801561001057600080fd5b50600436106102095760003560e01c80637c616fe61161012a578063c2c4c5c1116100bd578063ee00ef3a1161008c578063f4359ce511610071578063f4359ce514610681578063f52a36f71461068b578063fc0c546a146106ae57600080fd5b8063ee00ef3a14610603578063f3a6d6081461060e57600080fd5b8063c2c4c5c11461052b578063cbf9fe5f14610533578063d98eaf831461057b578063eac6a667146105bd57600080fd5b806395d89b41116100f957806395d89b41146104ea578063981b24d0146104f2578063b52c05fe14610505578063bd85b0391461051857600080fd5b80637c616fe61461046357806381fc83bb146104765780638ad4c44714610496578063900cf0cf146104e157600080fd5b80632eef5f83116101a25780633ccfd60b116101715780633ccfd60b146103fc5780634deafcae146104045780634ee2cd7e1461043d57806370a082311461045057600080fd5b80632eef5f83146102df5780632f4f21e21461034c578063313ce5671461035f57806334d901a41461037e57600080fd5b806306fdde03116101de57806306fdde031461027f57806315456eba14610294578063154cc69e146102a957806318160ddd146102d757600080fd5b8062e491de1461020e578062fdd58e14610246578063047fc9aa14610267578063059f8b1614610270575b600080fd5b61023161021c3660046127c0565b600a6020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b6102596102543660046127e2565b6106f3565b60405190815260200161023d565b61025960025481565b610259670de0b6b3a764000081565b6102876107f7565b60405161023d919061280c565b6102a76102a2366004612878565b610885565b005b6102316102b7366004612891565b600960209081526000928352604080842090915290825290205460ff1681565b6102596109f5565b6102a76102ed3660046127c0565b73ffffffffffffffffffffffffffffffffffffffff1660009081526009602090815260408083203384529091529020805460ff8116157fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00909116179055565b6102a761035a3660046127e2565b610a61565b600d5461036c9060ff1681565b60405160ff909116815260200161023d565b6103d461038c3660046127e2565b6006602090815260009283526040808420909152908252902080546001820154600290920154600f82810b93700100000000000000000000000000000000909304900b919084565b60408051600f95860b81529390940b602084015292820152606081019190915260800161023d565b6102a7610cfb565b6102596104123660046127c0565b73ffffffffffffffffffffffffffffffffffffffff1660009081526003602052604090206001015490565b61025961044b3660046127e2565b610fb2565b61025961045e3660046127c0565b6112e0565b6102a7610471366004612878565b6113df565b6102596104843660046127c0565b60076020526000908152604090205481565b6103d46104a4366004612878565b600560205260009081526040902080546001820154600290920154600f82810b93700100000000000000000000000000000000909304900b919084565b61025960045481565b61028761158c565b610259610500366004612878565b611599565b6102a76105133660046128c4565b6117af565b610259610526366004612878565b611989565b6102a76119f6565b6105616105413660046127c0565b60036020526000908152604090208054600190910154600f9190910b9082565b60408051600f9390930b835260208301919091520161023d565b6102a7336000908152600a6020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00811660ff90911615179055565b6102596105cb3660046127e2565b73ffffffffffffffffffffffffffffffffffffffff919091166000908152600660209081526040808320938352929052206001015490565b610259630784ce0081565b61066e61061c3660046127c0565b73ffffffffffffffffffffffffffffffffffffffff16600090815260076020908152604080832054600683528184209084529091529020547001000000000000000000000000000000009004600f0b90565b604051600f9190910b815260200161023d565b61025962093a8081565b61066e610699366004612878565b600860205260009081526040902054600f0b81565b6001546106ce9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161023d565b73ffffffffffffffffffffffffffffffffffffffff821660009081526007602052604081205480820361072a5760009150506107f1565b73ffffffffffffffffffffffffffffffffffffffff8416600090815260066020908152604080832084845282529182902082516080810184528154600f81810b8352700100000000000000000000000000000000909104900b928101929092526001810154928201839052600201546060820152906107a99085612915565b81602001516107b89190612935565b815182906107c7908390612955565b600f90810b90915282516000910b121590506107e257600081525b51600f0b91506107f19050565b505b92915050565b600b8054610804906129a3565b80601f0160208091040260200160405190810160405280929190818152602001828054610830906129a3565b801561087d5780601f106108525761010080835404028352916020019161087d565b820191906000526020600020905b81548152906001019060200180831161086057829003601f168201915b505050505081565b61088d611a2a565b3360009081526003602090815260409182902082518084019093528054600f0b83526001015490820152816109095760405162461bcd60e51b815260206004820152601360248201527f4e656564206e6f6e2d7a65726f2076616c75650000000000000000000000000060448201526064015b60405180910390fd5b60008160000151600f0b136109605760405162461bcd60e51b815260206004820152601660248201527f4e6f206578697374696e67206c6f636b20666f756e64000000000000000000006044820152606401610900565b428160200151116109d85760405162461bcd60e51b8152602060048201526024808201527f43616e6e6f742061646420746f2065787069726564206c6f636b2e205769746860448201527f64726177000000000000000000000000000000000000000000000000000000006064820152608401610900565b6109e733836000846002611a83565b506109f26001600055565b50565b600454600081815260056020908152604080832081516080810183528154600f81810b8352700100000000000000000000000000000000909104900b93810193909352600181015491830191909152600201546060820152909190610a5a8142611d2b565b9250505090565b610a69611a2a565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600a602052604090205460ff1680610acd575033600090815260096020908152604080832073ffffffffffffffffffffffffffffffffffffffff8616845290915290205460ff165b610b3f5760405162461bcd60e51b815260206004820152602760248201527f4e6f7420616c6c6f77656420746f206465706f73697420666f7220746869732060448201527f61646472657373000000000000000000000000000000000000000000000000006064820152608401610900565b73ffffffffffffffffffffffffffffffffffffffff821660009081526003602090815260409182902082518084019093528054600f0b8352600101549082015281610bcc5760405162461bcd60e51b815260206004820152601360248201527f4e656564206e6f6e2d7a65726f2076616c7565000000000000000000000000006044820152606401610900565b60008160000151600f0b13610c235760405162461bcd60e51b815260206004820152601660248201527f4e6f206578697374696e67206c6f636b20666f756e64000000000000000000006044820152606401610900565b42816020015111610c9b5760405162461bcd60e51b8152602060048201526024808201527f43616e6e6f742061646420746f2065787069726564206c6f636b2e205769746860448201527f64726177000000000000000000000000000000000000000000000000000000006064820152608401610900565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260036020908152604080832081518083019092528054600f0b82526001015491810191909152610cec91859185919081611a83565b50610cf76001600055565b5050565b610d03611a2a565b604080518082018252336000818152600360208181529482208054600f0b85529290915283526001015491810182905290421015610d835760405162461bcd60e51b815260206004820152601660248201527f546865206c6f636b206469646e277420657870697265000000000000000000006044820152606401610900565b8051604080518082018252336000818152600360208181528583208054600f81810b8852868652848452600183018054858a0152848c01878152878d528a51808c01909b528c51830b8b52518a8601908152979096529390925295516fffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffff0000000000000000000000000000000090911617909455905190556002549290910b91610e2f83826129f0565b600255610e3d338386611e19565b6001546040517fa9059cbb0000000000000000000000000000000000000000000000000000000081523360048201526024810185905273ffffffffffffffffffffffffffffffffffffffff9091169063a9059cbb906044016020604051808303816000875af1158015610eb4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed89190612a03565b610f245760405162461bcd60e51b815260206004820152600f60248201527f5472616e73666572206661696c656400000000000000000000000000000000006044820152606401610900565b6040805184815242602082015233917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b568910160405180910390a27f5e2aa66efd74cce82b21852e317e5490d9ecc9e6bb953ae24d90851258cc2f5c81610f8a85826129f0565b6040805192835260208301919091520160405180910390a150505050610fb06001600055565b565b6000438211156110045760405162461bcd60e51b815260206004820152601b60248201527f43616e6e6f74206c6f6f6b2075702066757475726520626c6f636b00000000006044820152606401610900565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260076020526040812054815b608081101561109957818310156110995773ffffffffffffffffffffffffffffffffffffffff8616600090815260066020908152604080832060028688016001018190048086529190935292200154861061108957809350611090565b6001810392505b5060010161102c565b5073ffffffffffffffffffffffffffffffffffffffff85166000908152600660209081526040808320858452825280832081516080810183528154600f81810b8352700100000000000000000000000000000000909104900b93810193909352600181015491830191909152600201546060820152600454909161111d8783612625565b600081815260056020908152604080832081516080810183528154600f81810b8352700100000000000000000000000000000000909104900b93810193909352600181015491830191909152600201546060820152919250808484101561121657600060058161118e876001612a54565b8152602080820192909252604090810160002081516080810183528154600f81810b8352700100000000000000000000000000000000909104900b938101939093526001810154918301919091526002015460608083018290528601519192506111f891906129f0565b92508360400151816040015161120e91906129f0565b91505061123a565b606083015161122590436129f0565b915082604001514261123791906129f0565b90505b60408301518215611277578284606001518c61125691906129f0565b6112609084612a67565b61126a9190612a7e565b6112749082612a54565b90505b60408701516112869082612915565b87602001516112959190612935565b875188906112a4908390612955565b600f90810b90915288516000910b1290506112ce5750509351600f0b96506107f195505050505050565b600099505050505050505050506107f1565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600760205260408120548082036113165750600092915050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260066020908152604080832084845282529182902082516080810184528154600f81810b8352700100000000000000000000000000000000909104900b928101929092526001810154928201839052600201546060820152906113959042612915565b81602001516113a49190612935565b815182906113b3908390612955565b600f90810b90915282516000910b121590506113ce57600081525b51600f0b9392505050565b50919050565b6113e7611a2a565b3360009081526003602090815260409182902082518084019093528054600f0b83526001015490820181905262093a808084040290421061146a5760405162461bcd60e51b815260206004820152600c60248201527f4c6f636b206578706972656400000000000000000000000000000000000000006044820152606401610900565b60008260000151600f0b136114c15760405162461bcd60e51b815260206004820152601160248201527f4e6f7468696e67206973206c6f636b65640000000000000000000000000000006044820152606401610900565b816020015181116115145760405162461bcd60e51b815260206004820152601f60248201527f43616e206f6e6c7920696e637265617365206c6f636b206475726174696f6e006044820152606401610900565b611522630784ce0042612a54565b8111156115715760405162461bcd60e51b815260206004820152601e60248201527f566f74696e67206c6f636b2063616e2062652034207965617273206d617800006044820152606401610900565b61158033600083856003611a83565b50506109f26001600055565b600c8054610804906129a3565b6000438211156115eb5760405162461bcd60e51b815260206004820152601460248201527f496e76616c696420626c6f636b206e756d6265720000000000000000000000006044820152606401610900565b60045460006115fa8483612625565b60008181526005602090815260409182902082516080810184528154600f81810b8352700100000000000000000000000000000000909104900b92810192909252600181015492820192909252600290910154606082018190529192509085101561166a57506000949350505050565b60008383101561173d576000600581611684866001612a54565b8152602080820192909252604090810160002081516080810183528154600f81810b8352700100000000000000000000000000000000909104900b938101939093526001810154918301919091526002015460608083018290528501519192501461173757826060015181606001516116fd91906129f0565b8360400151826040015161171191906129f0565b6060850151611720908a6129f0565b61172a9190612a67565b6117349190612a7e565b91505b5061178c565b4382606001511461178c57606082015161175790436129f0565b604083015161176690426129f0565b606084015161177590896129f0565b61177f9190612a67565b6117899190612a7e565b90505b6117a5828284604001516117a09190612a54565b611d2b565b9695505050505050565b6117b7611a2a565b600062093a806117c78184612a7e565b6117d19190612a67565b3360009081526003602090815260409182902082518084019093528054600f0b835260010154908201529091508361184b5760405162461bcd60e51b815260206004820152601360248201527f4e656564206e6f6e2d7a65726f2076616c7565000000000000000000000000006044820152606401610900565b8051600f0b1561189d5760405162461bcd60e51b815260206004820152601960248201527f5769746864726177206f6c6420746f6b656e73206669727374000000000000006044820152606401610900565b4282116119125760405162461bcd60e51b815260206004820152602660248201527f43616e206f6e6c79206c6f636b20756e74696c2074696d6520696e207468652060448201527f66757475726500000000000000000000000000000000000000000000000000006064820152608401610900565b611920630784ce0042612a54565b82111561196f5760405162461bcd60e51b815260206004820152601e60248201527f566f74696e67206c6f636b2063616e2062652034207965617273206d617800006044820152606401610900565b61197d338584846001611a83565b5050610cf76001600055565b600454600081815260056020908152604080832081516080810183528154600f81810b8352700100000000000000000000000000000000909104900b938101939093526001810154918301919091526002015460608201529091906119ee8185611d2b565b949350505050565b60408051808201909152600080825260208201526040805180820190915260008082526020820152610cf760008383611e19565b600260005403611a7c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610900565b6002600055565b6040805180820182528351600f90810b825260208086018051828501528451808601909552865190920b8452905190830152600254909190611ac58782612a54565b600255611ad9611ad488612681565b61271d565b83518490611ae8908390612ab9565b600f0b9052508515611afc57602083018690525b73ffffffffffffffffffffffffffffffffffffffff88166000908152600360209081526040909120845181547fffffffffffffffffffffffffffffffff00000000000000000000000000000000166fffffffffffffffffffffffffffffffff90911617815590840151600190910155611b76888385611e19565b8615611c6b576001546040517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8a81166004830152306024830152604482018a9052909116906323b872dd906064016020604051808303816000875af1158015611bfb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c1f9190612a03565b611c6b5760405162461bcd60e51b815260206004820152600f60248201527f5472616e73666572206661696c656400000000000000000000000000000000006044820152606401610900565b602080840151604080518a81526fffffffffffffffffffffffffffffffff88169381019390935242908301529073ffffffffffffffffffffffffffffffffffffffff8a16907fe6b4b2f1b9fef6bea3326b5f3efe29731e48b50360a2b8a10bf751c4cd0cd0239060600160405180910390a37f5e2aa66efd74cce82b21852e317e5490d9ecc9e6bb953ae24d90851258cc2f5c81611d098982612a54565b6040805192835260208301919091520160405180910390a15050505050505050565b600080839050600062093a8080836040015181611d4a57611d4a612a25565b0402905060005b60ff811015611df757611d6762093a8083612a54565b9150600085831115611d7b57859250611d8f565b50600082815260086020526040902054600f0b5b6040840151611d9e9084612915565b8460200151611dad9190612935565b84518590611dbc908390612955565b600f0b905250858303611dcf5750611df7565b8084602001818151611de19190612ab9565b600f0b9052505060408301829052600101611d51565b5060008260000151600f0b1215611e0d57600082525b5051600f0b9392505050565b604080516080810182526000808252602082018190529181018290526060810191909152604080516080810182526000808252602082018190529181018290526060810191909152600454600090819073ffffffffffffffffffffffffffffffffffffffff881615611f9f57428760200151118015611e9f575060008760000151600f0b135b15611edf578651630784ce0090600f0b05600f0b602080870191909152870151611eca9042906129f0565b8560200151611ed99190612935565b600f0b85525b428660200151118015611ef9575060008660000151600f0b135b15611f48578551630784ce00906fffffffffffffffffffffffffffffffff1604600f0b602080860191909152860151611f339042906129f0565b8460200151611f429190612935565b600f0b84525b602080880151600090815260088252604090205490870151600f9190910b935015611f9f578660200151866020015103611f8457829150611f9f565b602080870151600090815260089091526040902054600f0b91505b6040805160808101825260008082526020820152429181019190915243606082015281156120235750604080516080810182526000838152600560208181528483208054600f81810b8752700100000000000000000000000000000000909104900b8286015260018101549585019590955291859052905260029091015460608201525b600081604001519050600060405180608001604052808460000151600f0b81526020018460200151600f0b81526020018460400151815260200184606001518152509050600083604001514211156120b257604084015161208490426129f0565b606085015161209390436129f0565b6120a590670de0b6b3a7640000612a67565b6120af9190612a7e565b90505b62093a808084040260005b60ff811015612267576120d362093a8083612a54565b91506000428311156120e7574292506120fb565b50600082815260086020526040902054600f0b5b6121058684612b07565b87602001516121149190612935565b87518890612123908390612955565b600f0b90525060208701805182919061213d908390612ab9565b600f90810b90915288516000910b1215905061215857600087525b60008760200151600f0b121561217057600060208801525b60408088018490528501519295508592670de0b6b3a76400009061219490856129f0565b61219e9086612a67565b6121a89190612a7e565b85606001516121b79190612a54565b60608801526121c588612b30565b97504283036121da5750436060870152612267565b604080516080810182528851600f90810b82526020808b015190910b8183019081528a8401518385019081526060808d015190850190815260008e8152600590945294909220925190516fffffffffffffffffffffffffffffffff9081167001000000000000000000000000000000000291161782555160018201559051600290910155506001016120bd565b50600486905573ffffffffffffffffffffffffffffffffffffffff8d1615612307578960200151896020015161229d9190612955565b856020018181516122ae9190612ab9565b600f0b905250895189516122c29190612955565b855186906122d1908390612ab9565b600f90810b90915260208701516000910b121590506122f257600060208601525b60008560000151600f0b121561230757600085525b6000868152600560209081526040918290208751918801516fffffffffffffffffffffffffffffffff90811670010000000000000000000000000000000002921691909117815590860151600182015560608601516002909101558c73ffffffffffffffffffffffffffffffffffffffff81161561261557428d60200151111561240c5760208b015161239a908a612ab9565b98508c602001518c60200151036123bd5760208a01516123ba908a612955565b98505b60208d810151600090815260089091526040902080547fffffffffffffffffffffffffffffffff00000000000000000000000000000000166fffffffffffffffffffffffffffffffff8b161790555b428c602001511115612488578c602001518c6020015111156124885760208a01516124379089612955565b60208d810151600090815260089091526040902080547fffffffffffffffffffffffffffffffff00000000000000000000000000000000166fffffffffffffffffffffffffffffffff831617905597505b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600101905080600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550428b6040018181525050438b60600181815250508a600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002060008201518160000160006101000a8154816fffffffffffffffffffffffffffffffff0219169083600f0b6fffffffffffffffffffffffffffffffff16021790555060208201518160000160106101000a8154816fffffffffffffffffffffffffffffffff0219169083600f0b6fffffffffffffffffffffffffffffffff1602179055506040820151816001015560608201518160020155905050505b5050505050505050505050505050565b60008082815b6080811015612677578183101561267757600282840160010181900460008181526005602052604090209091015487106126675780935061266e565b6001810392505b5060010161262b565b5090949350505050565b60007f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8211156127195760405162461bcd60e51b815260206004820152602860248201527f53616665436173743a2076616c756520646f65736e27742066697420696e206160448201527f6e20696e743235360000000000000000000000000000000000000000000000006064820152608401610900565b5090565b80600f81900b81146127975760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203160448201527f32382062697473000000000000000000000000000000000000000000000000006064820152608401610900565b919050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461279757600080fd5b6000602082840312156127d257600080fd5b6127db8261279c565b9392505050565b600080604083850312156127f557600080fd5b6127fe8361279c565b946020939093013593505050565b600060208083528351808285015260005b818110156128395785810183015185820160400152820161281d565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b60006020828403121561288a57600080fd5b5035919050565b600080604083850312156128a457600080fd5b6128ad8361279c565b91506128bb6020840161279c565b90509250929050565b600080604083850312156128d757600080fd5b50508035926020909101359150565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b81810360008312801583831316838312821617156107ef576107ef6128e6565b600082600f0b82600f0b0280600f0b91508082146107ef576107ef6128e6565b600f82810b9082900b037fffffffffffffffffffffffffffffffff8000000000000000000000000000000081126f7fffffffffffffffffffffffffffffff821317156107f1576107f16128e6565b600181811c908216806129b757607f821691505b6020821081036113d9577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b818103818111156107f1576107f16128e6565b600060208284031215612a1557600080fd5b815180151581146127db57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b808201808211156107f1576107f16128e6565b80820281158282048414176107f1576107f16128e6565b600082612ab4577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b600f81810b9083900b016f7fffffffffffffffffffffffffffffff81137fffffffffffffffffffffffffffffffff80000000000000000000000000000000821217156107f1576107f16128e6565b6fffffffffffffffffffffffffffffffff8281168282160390808211156107ef576107ef6128e6565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612b6157612b616128e6565b506001019056fea2646970667358221220f0702b81d665a7a832edc550c7e5c9d05090dbeaffe5b44c9a260526ac93f16164736f6c6343000813003300000000000000000000000015dac05c93e1c5f31a29547340997ba9f6ec4f87000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000018566f74696e672d657363726f7765642059616d6177616b65000000000000000000000000000000000000000000000000000000000000000000000000000000067665594d574b0000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102095760003560e01c80637c616fe61161012a578063c2c4c5c1116100bd578063ee00ef3a1161008c578063f4359ce511610071578063f4359ce514610681578063f52a36f71461068b578063fc0c546a146106ae57600080fd5b8063ee00ef3a14610603578063f3a6d6081461060e57600080fd5b8063c2c4c5c11461052b578063cbf9fe5f14610533578063d98eaf831461057b578063eac6a667146105bd57600080fd5b806395d89b41116100f957806395d89b41146104ea578063981b24d0146104f2578063b52c05fe14610505578063bd85b0391461051857600080fd5b80637c616fe61461046357806381fc83bb146104765780638ad4c44714610496578063900cf0cf146104e157600080fd5b80632eef5f83116101a25780633ccfd60b116101715780633ccfd60b146103fc5780634deafcae146104045780634ee2cd7e1461043d57806370a082311461045057600080fd5b80632eef5f83146102df5780632f4f21e21461034c578063313ce5671461035f57806334d901a41461037e57600080fd5b806306fdde03116101de57806306fdde031461027f57806315456eba14610294578063154cc69e146102a957806318160ddd146102d757600080fd5b8062e491de1461020e578062fdd58e14610246578063047fc9aa14610267578063059f8b1614610270575b600080fd5b61023161021c3660046127c0565b600a6020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b6102596102543660046127e2565b6106f3565b60405190815260200161023d565b61025960025481565b610259670de0b6b3a764000081565b6102876107f7565b60405161023d919061280c565b6102a76102a2366004612878565b610885565b005b6102316102b7366004612891565b600960209081526000928352604080842090915290825290205460ff1681565b6102596109f5565b6102a76102ed3660046127c0565b73ffffffffffffffffffffffffffffffffffffffff1660009081526009602090815260408083203384529091529020805460ff8116157fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00909116179055565b6102a761035a3660046127e2565b610a61565b600d5461036c9060ff1681565b60405160ff909116815260200161023d565b6103d461038c3660046127e2565b6006602090815260009283526040808420909152908252902080546001820154600290920154600f82810b93700100000000000000000000000000000000909304900b919084565b60408051600f95860b81529390940b602084015292820152606081019190915260800161023d565b6102a7610cfb565b6102596104123660046127c0565b73ffffffffffffffffffffffffffffffffffffffff1660009081526003602052604090206001015490565b61025961044b3660046127e2565b610fb2565b61025961045e3660046127c0565b6112e0565b6102a7610471366004612878565b6113df565b6102596104843660046127c0565b60076020526000908152604090205481565b6103d46104a4366004612878565b600560205260009081526040902080546001820154600290920154600f82810b93700100000000000000000000000000000000909304900b919084565b61025960045481565b61028761158c565b610259610500366004612878565b611599565b6102a76105133660046128c4565b6117af565b610259610526366004612878565b611989565b6102a76119f6565b6105616105413660046127c0565b60036020526000908152604090208054600190910154600f9190910b9082565b60408051600f9390930b835260208301919091520161023d565b6102a7336000908152600a6020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00811660ff90911615179055565b6102596105cb3660046127e2565b73ffffffffffffffffffffffffffffffffffffffff919091166000908152600660209081526040808320938352929052206001015490565b610259630784ce0081565b61066e61061c3660046127c0565b73ffffffffffffffffffffffffffffffffffffffff16600090815260076020908152604080832054600683528184209084529091529020547001000000000000000000000000000000009004600f0b90565b604051600f9190910b815260200161023d565b61025962093a8081565b61066e610699366004612878565b600860205260009081526040902054600f0b81565b6001546106ce9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161023d565b73ffffffffffffffffffffffffffffffffffffffff821660009081526007602052604081205480820361072a5760009150506107f1565b73ffffffffffffffffffffffffffffffffffffffff8416600090815260066020908152604080832084845282529182902082516080810184528154600f81810b8352700100000000000000000000000000000000909104900b928101929092526001810154928201839052600201546060820152906107a99085612915565b81602001516107b89190612935565b815182906107c7908390612955565b600f90810b90915282516000910b121590506107e257600081525b51600f0b91506107f19050565b505b92915050565b600b8054610804906129a3565b80601f0160208091040260200160405190810160405280929190818152602001828054610830906129a3565b801561087d5780601f106108525761010080835404028352916020019161087d565b820191906000526020600020905b81548152906001019060200180831161086057829003601f168201915b505050505081565b61088d611a2a565b3360009081526003602090815260409182902082518084019093528054600f0b83526001015490820152816109095760405162461bcd60e51b815260206004820152601360248201527f4e656564206e6f6e2d7a65726f2076616c75650000000000000000000000000060448201526064015b60405180910390fd5b60008160000151600f0b136109605760405162461bcd60e51b815260206004820152601660248201527f4e6f206578697374696e67206c6f636b20666f756e64000000000000000000006044820152606401610900565b428160200151116109d85760405162461bcd60e51b8152602060048201526024808201527f43616e6e6f742061646420746f2065787069726564206c6f636b2e205769746860448201527f64726177000000000000000000000000000000000000000000000000000000006064820152608401610900565b6109e733836000846002611a83565b506109f26001600055565b50565b600454600081815260056020908152604080832081516080810183528154600f81810b8352700100000000000000000000000000000000909104900b93810193909352600181015491830191909152600201546060820152909190610a5a8142611d2b565b9250505090565b610a69611a2a565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600a602052604090205460ff1680610acd575033600090815260096020908152604080832073ffffffffffffffffffffffffffffffffffffffff8616845290915290205460ff165b610b3f5760405162461bcd60e51b815260206004820152602760248201527f4e6f7420616c6c6f77656420746f206465706f73697420666f7220746869732060448201527f61646472657373000000000000000000000000000000000000000000000000006064820152608401610900565b73ffffffffffffffffffffffffffffffffffffffff821660009081526003602090815260409182902082518084019093528054600f0b8352600101549082015281610bcc5760405162461bcd60e51b815260206004820152601360248201527f4e656564206e6f6e2d7a65726f2076616c7565000000000000000000000000006044820152606401610900565b60008160000151600f0b13610c235760405162461bcd60e51b815260206004820152601660248201527f4e6f206578697374696e67206c6f636b20666f756e64000000000000000000006044820152606401610900565b42816020015111610c9b5760405162461bcd60e51b8152602060048201526024808201527f43616e6e6f742061646420746f2065787069726564206c6f636b2e205769746860448201527f64726177000000000000000000000000000000000000000000000000000000006064820152608401610900565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260036020908152604080832081518083019092528054600f0b82526001015491810191909152610cec91859185919081611a83565b50610cf76001600055565b5050565b610d03611a2a565b604080518082018252336000818152600360208181529482208054600f0b85529290915283526001015491810182905290421015610d835760405162461bcd60e51b815260206004820152601660248201527f546865206c6f636b206469646e277420657870697265000000000000000000006044820152606401610900565b8051604080518082018252336000818152600360208181528583208054600f81810b8852868652848452600183018054858a0152848c01878152878d528a51808c01909b528c51830b8b52518a8601908152979096529390925295516fffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffff0000000000000000000000000000000090911617909455905190556002549290910b91610e2f83826129f0565b600255610e3d338386611e19565b6001546040517fa9059cbb0000000000000000000000000000000000000000000000000000000081523360048201526024810185905273ffffffffffffffffffffffffffffffffffffffff9091169063a9059cbb906044016020604051808303816000875af1158015610eb4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed89190612a03565b610f245760405162461bcd60e51b815260206004820152600f60248201527f5472616e73666572206661696c656400000000000000000000000000000000006044820152606401610900565b6040805184815242602082015233917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b568910160405180910390a27f5e2aa66efd74cce82b21852e317e5490d9ecc9e6bb953ae24d90851258cc2f5c81610f8a85826129f0565b6040805192835260208301919091520160405180910390a150505050610fb06001600055565b565b6000438211156110045760405162461bcd60e51b815260206004820152601b60248201527f43616e6e6f74206c6f6f6b2075702066757475726520626c6f636b00000000006044820152606401610900565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260076020526040812054815b608081101561109957818310156110995773ffffffffffffffffffffffffffffffffffffffff8616600090815260066020908152604080832060028688016001018190048086529190935292200154861061108957809350611090565b6001810392505b5060010161102c565b5073ffffffffffffffffffffffffffffffffffffffff85166000908152600660209081526040808320858452825280832081516080810183528154600f81810b8352700100000000000000000000000000000000909104900b93810193909352600181015491830191909152600201546060820152600454909161111d8783612625565b600081815260056020908152604080832081516080810183528154600f81810b8352700100000000000000000000000000000000909104900b93810193909352600181015491830191909152600201546060820152919250808484101561121657600060058161118e876001612a54565b8152602080820192909252604090810160002081516080810183528154600f81810b8352700100000000000000000000000000000000909104900b938101939093526001810154918301919091526002015460608083018290528601519192506111f891906129f0565b92508360400151816040015161120e91906129f0565b91505061123a565b606083015161122590436129f0565b915082604001514261123791906129f0565b90505b60408301518215611277578284606001518c61125691906129f0565b6112609084612a67565b61126a9190612a7e565b6112749082612a54565b90505b60408701516112869082612915565b87602001516112959190612935565b875188906112a4908390612955565b600f90810b90915288516000910b1290506112ce5750509351600f0b96506107f195505050505050565b600099505050505050505050506107f1565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600760205260408120548082036113165750600092915050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260066020908152604080832084845282529182902082516080810184528154600f81810b8352700100000000000000000000000000000000909104900b928101929092526001810154928201839052600201546060820152906113959042612915565b81602001516113a49190612935565b815182906113b3908390612955565b600f90810b90915282516000910b121590506113ce57600081525b51600f0b9392505050565b50919050565b6113e7611a2a565b3360009081526003602090815260409182902082518084019093528054600f0b83526001015490820181905262093a808084040290421061146a5760405162461bcd60e51b815260206004820152600c60248201527f4c6f636b206578706972656400000000000000000000000000000000000000006044820152606401610900565b60008260000151600f0b136114c15760405162461bcd60e51b815260206004820152601160248201527f4e6f7468696e67206973206c6f636b65640000000000000000000000000000006044820152606401610900565b816020015181116115145760405162461bcd60e51b815260206004820152601f60248201527f43616e206f6e6c7920696e637265617365206c6f636b206475726174696f6e006044820152606401610900565b611522630784ce0042612a54565b8111156115715760405162461bcd60e51b815260206004820152601e60248201527f566f74696e67206c6f636b2063616e2062652034207965617273206d617800006044820152606401610900565b61158033600083856003611a83565b50506109f26001600055565b600c8054610804906129a3565b6000438211156115eb5760405162461bcd60e51b815260206004820152601460248201527f496e76616c696420626c6f636b206e756d6265720000000000000000000000006044820152606401610900565b60045460006115fa8483612625565b60008181526005602090815260409182902082516080810184528154600f81810b8352700100000000000000000000000000000000909104900b92810192909252600181015492820192909252600290910154606082018190529192509085101561166a57506000949350505050565b60008383101561173d576000600581611684866001612a54565b8152602080820192909252604090810160002081516080810183528154600f81810b8352700100000000000000000000000000000000909104900b938101939093526001810154918301919091526002015460608083018290528501519192501461173757826060015181606001516116fd91906129f0565b8360400151826040015161171191906129f0565b6060850151611720908a6129f0565b61172a9190612a67565b6117349190612a7e565b91505b5061178c565b4382606001511461178c57606082015161175790436129f0565b604083015161176690426129f0565b606084015161177590896129f0565b61177f9190612a67565b6117899190612a7e565b90505b6117a5828284604001516117a09190612a54565b611d2b565b9695505050505050565b6117b7611a2a565b600062093a806117c78184612a7e565b6117d19190612a67565b3360009081526003602090815260409182902082518084019093528054600f0b835260010154908201529091508361184b5760405162461bcd60e51b815260206004820152601360248201527f4e656564206e6f6e2d7a65726f2076616c7565000000000000000000000000006044820152606401610900565b8051600f0b1561189d5760405162461bcd60e51b815260206004820152601960248201527f5769746864726177206f6c6420746f6b656e73206669727374000000000000006044820152606401610900565b4282116119125760405162461bcd60e51b815260206004820152602660248201527f43616e206f6e6c79206c6f636b20756e74696c2074696d6520696e207468652060448201527f66757475726500000000000000000000000000000000000000000000000000006064820152608401610900565b611920630784ce0042612a54565b82111561196f5760405162461bcd60e51b815260206004820152601e60248201527f566f74696e67206c6f636b2063616e2062652034207965617273206d617800006044820152606401610900565b61197d338584846001611a83565b5050610cf76001600055565b600454600081815260056020908152604080832081516080810183528154600f81810b8352700100000000000000000000000000000000909104900b938101939093526001810154918301919091526002015460608201529091906119ee8185611d2b565b949350505050565b60408051808201909152600080825260208201526040805180820190915260008082526020820152610cf760008383611e19565b600260005403611a7c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610900565b6002600055565b6040805180820182528351600f90810b825260208086018051828501528451808601909552865190920b8452905190830152600254909190611ac58782612a54565b600255611ad9611ad488612681565b61271d565b83518490611ae8908390612ab9565b600f0b9052508515611afc57602083018690525b73ffffffffffffffffffffffffffffffffffffffff88166000908152600360209081526040909120845181547fffffffffffffffffffffffffffffffff00000000000000000000000000000000166fffffffffffffffffffffffffffffffff90911617815590840151600190910155611b76888385611e19565b8615611c6b576001546040517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8a81166004830152306024830152604482018a9052909116906323b872dd906064016020604051808303816000875af1158015611bfb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c1f9190612a03565b611c6b5760405162461bcd60e51b815260206004820152600f60248201527f5472616e73666572206661696c656400000000000000000000000000000000006044820152606401610900565b602080840151604080518a81526fffffffffffffffffffffffffffffffff88169381019390935242908301529073ffffffffffffffffffffffffffffffffffffffff8a16907fe6b4b2f1b9fef6bea3326b5f3efe29731e48b50360a2b8a10bf751c4cd0cd0239060600160405180910390a37f5e2aa66efd74cce82b21852e317e5490d9ecc9e6bb953ae24d90851258cc2f5c81611d098982612a54565b6040805192835260208301919091520160405180910390a15050505050505050565b600080839050600062093a8080836040015181611d4a57611d4a612a25565b0402905060005b60ff811015611df757611d6762093a8083612a54565b9150600085831115611d7b57859250611d8f565b50600082815260086020526040902054600f0b5b6040840151611d9e9084612915565b8460200151611dad9190612935565b84518590611dbc908390612955565b600f0b905250858303611dcf5750611df7565b8084602001818151611de19190612ab9565b600f0b9052505060408301829052600101611d51565b5060008260000151600f0b1215611e0d57600082525b5051600f0b9392505050565b604080516080810182526000808252602082018190529181018290526060810191909152604080516080810182526000808252602082018190529181018290526060810191909152600454600090819073ffffffffffffffffffffffffffffffffffffffff881615611f9f57428760200151118015611e9f575060008760000151600f0b135b15611edf578651630784ce0090600f0b05600f0b602080870191909152870151611eca9042906129f0565b8560200151611ed99190612935565b600f0b85525b428660200151118015611ef9575060008660000151600f0b135b15611f48578551630784ce00906fffffffffffffffffffffffffffffffff1604600f0b602080860191909152860151611f339042906129f0565b8460200151611f429190612935565b600f0b84525b602080880151600090815260088252604090205490870151600f9190910b935015611f9f578660200151866020015103611f8457829150611f9f565b602080870151600090815260089091526040902054600f0b91505b6040805160808101825260008082526020820152429181019190915243606082015281156120235750604080516080810182526000838152600560208181528483208054600f81810b8752700100000000000000000000000000000000909104900b8286015260018101549585019590955291859052905260029091015460608201525b600081604001519050600060405180608001604052808460000151600f0b81526020018460200151600f0b81526020018460400151815260200184606001518152509050600083604001514211156120b257604084015161208490426129f0565b606085015161209390436129f0565b6120a590670de0b6b3a7640000612a67565b6120af9190612a7e565b90505b62093a808084040260005b60ff811015612267576120d362093a8083612a54565b91506000428311156120e7574292506120fb565b50600082815260086020526040902054600f0b5b6121058684612b07565b87602001516121149190612935565b87518890612123908390612955565b600f0b90525060208701805182919061213d908390612ab9565b600f90810b90915288516000910b1215905061215857600087525b60008760200151600f0b121561217057600060208801525b60408088018490528501519295508592670de0b6b3a76400009061219490856129f0565b61219e9086612a67565b6121a89190612a7e565b85606001516121b79190612a54565b60608801526121c588612b30565b97504283036121da5750436060870152612267565b604080516080810182528851600f90810b82526020808b015190910b8183019081528a8401518385019081526060808d015190850190815260008e8152600590945294909220925190516fffffffffffffffffffffffffffffffff9081167001000000000000000000000000000000000291161782555160018201559051600290910155506001016120bd565b50600486905573ffffffffffffffffffffffffffffffffffffffff8d1615612307578960200151896020015161229d9190612955565b856020018181516122ae9190612ab9565b600f0b905250895189516122c29190612955565b855186906122d1908390612ab9565b600f90810b90915260208701516000910b121590506122f257600060208601525b60008560000151600f0b121561230757600085525b6000868152600560209081526040918290208751918801516fffffffffffffffffffffffffffffffff90811670010000000000000000000000000000000002921691909117815590860151600182015560608601516002909101558c73ffffffffffffffffffffffffffffffffffffffff81161561261557428d60200151111561240c5760208b015161239a908a612ab9565b98508c602001518c60200151036123bd5760208a01516123ba908a612955565b98505b60208d810151600090815260089091526040902080547fffffffffffffffffffffffffffffffff00000000000000000000000000000000166fffffffffffffffffffffffffffffffff8b161790555b428c602001511115612488578c602001518c6020015111156124885760208a01516124379089612955565b60208d810151600090815260089091526040902080547fffffffffffffffffffffffffffffffff00000000000000000000000000000000166fffffffffffffffffffffffffffffffff831617905597505b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600101905080600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550428b6040018181525050438b60600181815250508a600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002060008201518160000160006101000a8154816fffffffffffffffffffffffffffffffff0219169083600f0b6fffffffffffffffffffffffffffffffff16021790555060208201518160000160106101000a8154816fffffffffffffffffffffffffffffffff0219169083600f0b6fffffffffffffffffffffffffffffffff1602179055506040820151816001015560608201518160020155905050505b5050505050505050505050505050565b60008082815b6080811015612677578183101561267757600282840160010181900460008181526005602052604090209091015487106126675780935061266e565b6001810392505b5060010161262b565b5090949350505050565b60007f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8211156127195760405162461bcd60e51b815260206004820152602860248201527f53616665436173743a2076616c756520646f65736e27742066697420696e206160448201527f6e20696e743235360000000000000000000000000000000000000000000000006064820152608401610900565b5090565b80600f81900b81146127975760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203160448201527f32382062697473000000000000000000000000000000000000000000000000006064820152608401610900565b919050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461279757600080fd5b6000602082840312156127d257600080fd5b6127db8261279c565b9392505050565b600080604083850312156127f557600080fd5b6127fe8361279c565b946020939093013593505050565b600060208083528351808285015260005b818110156128395785810183015185820160400152820161281d565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b60006020828403121561288a57600080fd5b5035919050565b600080604083850312156128a457600080fd5b6128ad8361279c565b91506128bb6020840161279c565b90509250929050565b600080604083850312156128d757600080fd5b50508035926020909101359150565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b81810360008312801583831316838312821617156107ef576107ef6128e6565b600082600f0b82600f0b0280600f0b91508082146107ef576107ef6128e6565b600f82810b9082900b037fffffffffffffffffffffffffffffffff8000000000000000000000000000000081126f7fffffffffffffffffffffffffffffff821317156107f1576107f16128e6565b600181811c908216806129b757607f821691505b6020821081036113d9577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b818103818111156107f1576107f16128e6565b600060208284031215612a1557600080fd5b815180151581146127db57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b808201808211156107f1576107f16128e6565b80820281158282048414176107f1576107f16128e6565b600082612ab4577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b600f81810b9083900b016f7fffffffffffffffffffffffffffffff81137fffffffffffffffffffffffffffffffff80000000000000000000000000000000821217156107f1576107f16128e6565b6fffffffffffffffffffffffffffffffff8281168282160390808211156107ef576107ef6128e6565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612b6157612b616128e6565b506001019056fea2646970667358221220f0702b81d665a7a832edc550c7e5c9d05090dbeaffe5b44c9a260526ac93f16164736f6c63430008130033

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

00000000000000000000000015dac05c93e1c5f31a29547340997ba9f6ec4f87000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000018566f74696e672d657363726f7765642059616d6177616b65000000000000000000000000000000000000000000000000000000000000000000000000000000067665594d574b0000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : tokenAddr_ (address): 0x15Dac05C93e1c5F31a29547340997BA9f6ec4F87
Arg [1] : name_ (string): Voting-escrowed Yamawake
Arg [2] : symbol_ (string): veYMWK

-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 00000000000000000000000015dac05c93e1c5f31a29547340997ba9f6ec4f87
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [2] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000018
Arg [4] : 566f74696e672d657363726f7765642059616d6177616b650000000000000000
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000006
Arg [6] : 7665594d574b0000000000000000000000000000000000000000000000000000


Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]

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