ETH Price: $1,913.82 (-1.51%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading
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:
RewardGaugeV1

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 10000 runs

Other Settings:
default evmVersion
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.19;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "./interfaces/IGaugeController.sol";
import "./interfaces/IYMWK.sol";
import "./interfaces/IMinter.sol";
import "./interfaces/IVotingEscrow.sol";
import "./UUPSBase.sol";

/// @title RewardGaugeV1
/// @author DeFiGeek Community Japan
/// @notice Calculate YMWK token rewards for veYMWK holders
contract RewardGaugeV1 is UUPSBase {
    event CheckpointToken(uint256 time, uint256 tokens);

    uint256 public constant WEEK = 604800;
    uint256 public startTime;
    address public token;
    address public votingEscrow;
    address public minter;
    address public gaugeController;
    uint256 public futureEpochTime;
    uint256 public inflationRate;
    uint256 public timeCursor;
    uint256 public tokenTimeCursor;

    uint256 public isKilled;

    mapping(address => uint256) public timeCursorOf; // user -> timestamp
    mapping(address => uint256) public userEpochOf; // user -> user epoch
    mapping(uint256 => uint256) public tokensPerWeek;
    mapping(uint256 => uint256) public veSupply; // VE total supply at week bounds
    mapping(address => uint256) public integrateFraction;

    /***
     * @notice initializer
     * @param minter_
     * @param startTime_
     */
    function initialize(
        address minter_,
        uint256 startTime_
    ) public initializer {
        __UUPSBase_init();

        minter = minter_;
        token = IMinter(minter).token();
        gaugeController = IMinter(minter).controller();
        votingEscrow = IGaugeController(gaugeController).votingEscrow();

        inflationRate = IYMWK(token).rate();
        futureEpochTime = IYMWK(token).futureEpochTimeWrite();

        // Determine the start week of the rewards
        uint256 _t = (startTime_ / WEEK) * WEEK;
        startTime = _t;
        tokenTimeCursor = _t;
        timeCursor = _t;
    }

    /***
     * @notice
     * @dev Calculate the distribution of YMWK tokens for up to a maximum of 20 weeks from the tokenTimeCursor,
     *      and allocate them for each week.
     */
    function _checkpointToken() internal {
        uint256 _toDistribute;

        uint256 _rate = inflationRate;
        uint256 _prevFutureEpoch = futureEpochTime;
        uint256 _newRate = _rate;

        uint256 _t = tokenTimeCursor; // timestamp for the start of the week when the calculation of tokensPerWeek starts this time
        uint256 _thisWeek = (_t / WEEK) * WEEK; // (=tokenTimeCursor)
        uint256 _nextWeek;
        uint256 _roundedTimestamp = (block.timestamp / WEEK) * WEEK; // timestamp for the start of the current week.

        // If the next YMWK inflation rate update time set in the current Gauge is
        // in the future compared to the most recent token checkpoint and less than the start of this week,
        // apply an update at this checkpoint as it spans a YMWK epoch.
        if (_prevFutureEpoch >= _t && _prevFutureEpoch < _roundedTimestamp) {
            futureEpochTime = IYMWK(token).futureEpochTimeWrite();
            _newRate = IYMWK(token).rate();
            inflationRate = _newRate;
        }

        if (isKilled == 1) {
            _rate = 0;
            _newRate = 0; // Stop distributing inflation as soon as killed
        }

        // Update Gauge state
        IGaugeController(gaugeController).checkpointGauge(address(this));

        for (uint256 i; i < 20; ) {
            if (_thisWeek >= _roundedTimestamp) {
                // If it is currently in the middle of the second week,
                // calculate the rewards for the first week only,
                // and do not calculate the rewards for the second week until entering the third week.
                // |---|-x-|
                // 1   2   3
                break;
            }
            _nextWeek = _thisWeek + WEEK;
            uint256 _w = IGaugeController(gaugeController).gaugeRelativeWeight(
                address(this),
                _thisWeek
            );

            // Calculate the reward amount for this week and add it to this week's token distribution
            if (_prevFutureEpoch >= _t && _prevFutureEpoch < _nextWeek) {
                // If we went across one or multiple epochs, apply the rate
                // of the first epoch until it ends, and then the rate of
                // the last epoch.
                // If more than one epoch is crossed - the gauge gets less,
                // but that'd meen it wasn't called for more than 1 year
                uint _dt1 = _prevFutureEpoch - _t;
                uint _dt2 = _nextWeek - _prevFutureEpoch;
                _toDistribute = (_w * (_rate * _dt1 + _newRate * _dt2)) / 1e18;
                _rate = _newRate;
            } else {
                _toDistribute = (_w * _rate * (_nextWeek - _t)) / 1e18;
            }
            tokensPerWeek[_thisWeek] += _toDistribute;

            _t = _nextWeek;
            _thisWeek = _nextWeek;

            unchecked {
                ++i;
            }
        }
        // Store the week when the next update of tokensPerWeek will begin.
        tokenTimeCursor = _t;
        emit CheckpointToken(block.timestamp, _toDistribute);
    }

    /***
     * @notice Update the token checkpoint
     * @dev Calculates the total number of tokens to be distributed in a given week.
            This function is callable by anyone if the current week has advanced beyond tokenTimeCursor.
     */
    function checkpointToken() external {
        uint256 _thisWeek = (block.timestamp / WEEK) * WEEK;
        // Do not calculate the tokenCheckpoint until the week following the tokenTimeCursor (the week when the next reward calculation will start)
        require(
            msg.sender == admin || _thisWeek > tokenTimeCursor,
            "Unauthorized"
        );
        _checkpointToken();
    }

    function _findTimestampEpoch(
        address ve_,
        uint256 timestamp_
    ) internal view returns (uint256) {
        uint256 _min;
        uint256 _max = IVotingEscrow(ve_).epoch();

        unchecked {
            for (uint256 i; i < 128; ++i) {
                if (_min >= _max) {
                    break;
                }
                uint256 _mid = (_min + _max + 2) / 2;
                IVotingEscrow.Point memory _pt = IVotingEscrow(ve_)
                    .pointHistory(_mid);
                if (_pt.ts <= timestamp_) {
                    _min = _mid;
                } else {
                    _max = _mid - 1;
                }
            }
        }
        return _min;
    }

    function _findTimestampUserEpoch(
        address ve_,
        address user_,
        uint256 timestamp_,
        uint256 maxUserEpoch_
    ) internal view returns (uint256) {
        uint256 _min;
        uint256 _max = maxUserEpoch_;

        unchecked {
            for (uint256 i; i < 128; ++i) {
                if (_min >= _max) {
                    break;
                }
                uint256 _mid = (_min + _max + 2) / 2;
                IVotingEscrow.Point memory _pt = IVotingEscrow(ve_)
                    .userPointHistory(user_, _mid);
                if (_pt.ts <= timestamp_) {
                    _min = _mid;
                } else {
                    _max = _mid - 1;
                }
            }
        }
        return _min;
    }

    /***
     * @notice Get the veYNWK balance for `user_` at `timestamp_`
     * @param user_ Address to query balance for
     * @param timestamp_ Epoch time
     * @return uint256 veYNWK balance
     */
    function veForAt(
        address user_,
        uint256 timestamp_
    ) external view returns (uint256) {
        address _ve = votingEscrow;
        uint256 _maxUserEpoch = IVotingEscrow(_ve).userPointEpoch(user_);
        uint256 _epoch = _findTimestampUserEpoch(
            _ve,
            user_,
            timestamp_,
            _maxUserEpoch
        );
        IVotingEscrow.Point memory _pt = IVotingEscrow(_ve).userPointHistory(
            user_,
            _epoch
        );
        int128 _balance = _pt.bias -
            _pt.slope *
            int128(int256(timestamp_ - _pt.ts));
        if (_balance < 0) {
            return 0;
        } else {
            return uint256(uint128(_balance));
        }
    }

    function _checkpointTotalSupply() internal {
        address _ve = votingEscrow;
        uint256 _t = timeCursor;
        uint256 _roundedTimestamp = (block.timestamp / WEEK) * WEEK;
        IVotingEscrow(_ve).checkpoint(); // max 255 week

        for (uint256 i; i < 20; ) {
            if (_t > _roundedTimestamp) {
                break;
            } else {
                uint256 _epoch = _findTimestampEpoch(_ve, _t);
                IVotingEscrow.Point memory _pt = IVotingEscrow(_ve)
                    .pointHistory(_epoch);
                int128 _dt;
                if (_t > _pt.ts) {
                    _dt = int128(int256(_t) - int256(_pt.ts));
                }

                int128 _balance = _pt.bias - _pt.slope * _dt;
                if (_balance < 0) {
                    veSupply[_t] = 0;
                } else {
                    veSupply[_t] = uint256(uint128(_balance));
                }

                _t += WEEK;
            }
            unchecked {
                ++i;
            }
        }

        timeCursor = _t;
    }

    /***
     * @notice Update the veYMWK total supply checkpoint
     * @dev The checkpoint is also updated by the first claimant each new epoch week. This function may be called independently of a claim, to reduce claiming gas costs.
     */
    function checkpointTotalSupply() external {
        _checkpointTotalSupply();
    }

    function _checkpoint(address addr_) internal {
        if (block.timestamp >= timeCursor) {
            _checkpointTotalSupply(); // Update max 20 weeks
        }
        uint256 _timeCursor = timeCursor;
        uint256 _tokenTimeCursor = tokenTimeCursor;
        uint256 _thisWeek = (block.timestamp / WEEK) * WEEK;

        if (_thisWeek > tokenTimeCursor) {
            // If the current time is in the week following the tokenTimeCursor (the week when the next reward calculation starts) or later,
            // calculate the rewards.
            _checkpointToken(); // Update max 20 weeks
            _tokenTimeCursor = tokenTimeCursor;
        }

        address ve = votingEscrow;
        // Minimal user_epoch is 0 (if user had no point)
        uint256 _userEpoch;
        uint256 _toDistribute;

        uint256 _maxUserEpoch = IVotingEscrow(ve).userPointEpoch(addr_);
        uint256 _startTime = startTime;

        if (_maxUserEpoch == 0) {
            // No lock = no fees
            return;
        }

        uint256 _weekCursor = timeCursorOf[addr_];
        if (_weekCursor == 0) {
            // Need to do the initial binary search
            _userEpoch = _findTimestampUserEpoch(
                ve,
                addr_,
                _startTime,
                _maxUserEpoch
            );
        } else {
            _userEpoch = userEpochOf[addr_];
        }

        if (_userEpoch == 0) {
            _userEpoch = 1;
        }

        IVotingEscrow.Point memory _userPoint = IVotingEscrow(ve)
            .userPointHistory(addr_, _userEpoch);

        if (_weekCursor == 0) {
            _weekCursor = ((_userPoint.ts + WEEK - 1) / WEEK) * WEEK;
        }

        if (_weekCursor >= _timeCursor || _weekCursor >= _tokenTimeCursor) {
            // Stop here if _weekCursor >= _timeCursor as the sync of ve totalSupply is not complete.
            // Stop here if _weekCursor >= _tokenTimeCursor as the calculation of tokens to be distributed per week is not complete
            return;
        }

        if (_weekCursor < _startTime) {
            _weekCursor = _startTime;
        }

        IVotingEscrow.Point memory _oldUserPoint = IVotingEscrow.Point({
            bias: 0,
            slope: 0,
            ts: 0,
            blk: 0
        });

        // Iterate over weeks
        for (uint256 i; i < 50; ) {
            if (_weekCursor >= _timeCursor || _weekCursor >= _tokenTimeCursor) {
                // Stop here if _weekCursor >= _timeCursor as the sync of ve totalSupply is not complete.
                // Stop here if _weekCursor >= _tokenTimeCursor as the calculation of tokens to be distributed per week is not complete
                break;
            } else if (
                _weekCursor >= _userPoint.ts && _userEpoch <= _maxUserEpoch
            ) {
                ++_userEpoch;
                _oldUserPoint = IVotingEscrow.Point({
                    bias: _userPoint.bias,
                    slope: _userPoint.slope,
                    ts: _userPoint.ts,
                    blk: _userPoint.blk
                });
                if (_userEpoch > _maxUserEpoch) {
                    _userPoint = IVotingEscrow.Point({
                        bias: 0,
                        slope: 0,
                        ts: 0,
                        blk: 0
                    });
                } else {
                    _userPoint = IVotingEscrow(ve).userPointHistory(
                        addr_,
                        _userEpoch
                    );
                }
            } else {
                int256 _dt = int256(_weekCursor) - int256(_oldUserPoint.ts);
                int256 _balanceOf = int256(_oldUserPoint.bias) -
                    _dt *
                    int256(_oldUserPoint.slope);
                if (_balanceOf < 0) {
                    _balanceOf = 0;
                }

                if (_balanceOf == 0 && _userEpoch > _maxUserEpoch) {
                    // If the ve balance is zero and there are no further ve histories, end the sync here.
                    break;
                }
                if (_balanceOf > 0) {
                    _toDistribute +=
                        (uint256(_balanceOf) * tokensPerWeek[_weekCursor]) /
                        veSupply[_weekCursor];
                }
                _weekCursor += WEEK;
            }
            unchecked {
                ++i;
            }
        }

        _userEpoch = min(_maxUserEpoch, _userEpoch - 1);
        userEpochOf[addr_] = _userEpoch;
        timeCursorOf[addr_] = _weekCursor;

        integrateFraction[addr_] += _toDistribute;
    }

    function userCheckpoint(address addr_) external returns (bool) {
        require(
            msg.sender == addr_ || msg.sender == minter,
            "dev: unauthorized"
        );
        _checkpoint(addr_);
        return true;
    }

    function setKilled(bool isKilled_) external onlyAdmin {
        isKilled = isKilled_ ? 1 : 0;
    }

    function claimableTokens(address addr_) external returns (uint256) {
        _checkpoint(addr_);
        return
            integrateFraction[addr_] -
            IMinter(minter).minted(addr_, address(this));
    }

    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }
}

File 2 of 18 : draft-IERC1822Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)

pragma solidity ^0.8.0;

/**
 * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified
 * proxy whose upgrades are fully controlled by the current implementation.
 */
interface IERC1822ProxiableUpgradeable {
    /**
     * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation
     * address.
     *
     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
     * function revert if invoked through a proxy.
     */
    function proxiableUUID() external view returns (bytes32);
}

File 3 of 18 : IERC1967Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)

pragma solidity ^0.8.0;

/**
 * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.
 *
 * _Available since v4.8.3._
 */
interface IERC1967Upgradeable {
    /**
     * @dev Emitted when the implementation is upgraded.
     */
    event Upgraded(address indexed implementation);

    /**
     * @dev Emitted when the admin account has changed.
     */
    event AdminChanged(address previousAdmin, address newAdmin);

    /**
     * @dev Emitted when the beacon is changed.
     */
    event BeaconUpgraded(address indexed beacon);
}

File 4 of 18 : IBeaconUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)

pragma solidity ^0.8.0;

/**
 * @dev This is the interface that {BeaconProxy} expects of its beacon.
 */
interface IBeaconUpgradeable {
    /**
     * @dev Must return an address that can be used as a delegate call target.
     *
     * {BeaconProxy} will check that this address is a contract.
     */
    function implementation() external view returns (address);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)

pragma solidity ^0.8.2;

import "../beacon/IBeaconUpgradeable.sol";
import "../../interfaces/IERC1967Upgradeable.sol";
import "../../interfaces/draft-IERC1822Upgradeable.sol";
import "../../utils/AddressUpgradeable.sol";
import "../../utils/StorageSlotUpgradeable.sol";
import {Initializable} from "../utils/Initializable.sol";

/**
 * @dev This abstract contract provides getters and event emitting update functions for
 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
 *
 * _Available since v4.1._
 */
abstract contract ERC1967UpgradeUpgradeable is Initializable, IERC1967Upgradeable {
    // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1
    bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;

    /**
     * @dev Storage slot with the address of the current implementation.
     * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    function __ERC1967Upgrade_init() internal onlyInitializing {
    }

    function __ERC1967Upgrade_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev Returns the current implementation address.
     */
    function _getImplementation() internal view returns (address) {
        return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 implementation slot.
     */
    function _setImplementation(address newImplementation) private {
        require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract");
        StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
    }

    /**
     * @dev Perform implementation upgrade
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeTo(address newImplementation) internal {
        _setImplementation(newImplementation);
        emit Upgraded(newImplementation);
    }

    /**
     * @dev Perform implementation upgrade with additional setup call.
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {
        _upgradeTo(newImplementation);
        if (data.length > 0 || forceCall) {
            AddressUpgradeable.functionDelegateCall(newImplementation, data);
        }
    }

    /**
     * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {
        // Upgrades from old implementations will perform a rollback test. This test requires the new
        // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing
        // this special case will break upgrade paths from old UUPS implementation to new ones.
        if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {
            _setImplementation(newImplementation);
        } else {
            try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {
                require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID");
            } catch {
                revert("ERC1967Upgrade: new implementation is not UUPS");
            }
            _upgradeToAndCall(newImplementation, data, forceCall);
        }
    }

    /**
     * @dev Storage slot with the admin of the contract.
     * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

    /**
     * @dev Returns the current admin.
     */
    function _getAdmin() internal view returns (address) {
        return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 admin slot.
     */
    function _setAdmin(address newAdmin) private {
        require(newAdmin != address(0), "ERC1967: new admin is the zero address");
        StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;
    }

    /**
     * @dev Changes the admin of the proxy.
     *
     * Emits an {AdminChanged} event.
     */
    function _changeAdmin(address newAdmin) internal {
        emit AdminChanged(_getAdmin(), newAdmin);
        _setAdmin(newAdmin);
    }

    /**
     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
     * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.
     */
    bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;

    /**
     * @dev Returns the current beacon.
     */
    function _getBeacon() internal view returns (address) {
        return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;
    }

    /**
     * @dev Stores a new beacon in the EIP1967 beacon slot.
     */
    function _setBeacon(address newBeacon) private {
        require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract");
        require(
            AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),
            "ERC1967: beacon implementation is not a contract"
        );
        StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;
    }

    /**
     * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does
     * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).
     *
     * Emits a {BeaconUpgraded} event.
     */
    function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {
        _setBeacon(newBeacon);
        emit BeaconUpgraded(newBeacon);
        if (data.length > 0 || forceCall) {
            AddressUpgradeable.functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);
        }
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```solidity
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 *
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized != type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/UUPSUpgradeable.sol)

pragma solidity ^0.8.0;

import "../../interfaces/draft-IERC1822Upgradeable.sol";
import "../ERC1967/ERC1967UpgradeUpgradeable.sol";
import {Initializable} from "./Initializable.sol";

/**
 * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an
 * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.
 *
 * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is
 * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing
 * `UUPSUpgradeable` with a custom implementation of upgrades.
 *
 * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.
 *
 * _Available since v4.1._
 */
abstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {
    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
    address private immutable __self = address(this);

    /**
     * @dev Check that the execution is being performed through a delegatecall call and that the execution context is
     * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case
     * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a
     * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to
     * fail.
     */
    modifier onlyProxy() {
        require(address(this) != __self, "Function must be called through delegatecall");
        require(_getImplementation() == __self, "Function must be called through active proxy");
        _;
    }

    /**
     * @dev Check that the execution is not being performed through a delegate call. This allows a function to be
     * callable on the implementing contract but not through proxies.
     */
    modifier notDelegated() {
        require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall");
        _;
    }

    function __UUPSUpgradeable_init() internal onlyInitializing {
    }

    function __UUPSUpgradeable_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the
     * implementation. It is used to validate the implementation's compatibility when performing an upgrade.
     *
     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
     * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.
     */
    function proxiableUUID() external view virtual override notDelegated returns (bytes32) {
        return _IMPLEMENTATION_SLOT;
    }

    /**
     * @dev Upgrade the implementation of the proxy to `newImplementation`.
     *
     * Calls {_authorizeUpgrade}.
     *
     * Emits an {Upgraded} event.
     *
     * @custom:oz-upgrades-unsafe-allow-reachable delegatecall
     */
    function upgradeTo(address newImplementation) public virtual onlyProxy {
        _authorizeUpgrade(newImplementation);
        _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);
    }

    /**
     * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call
     * encoded in `data`.
     *
     * Calls {_authorizeUpgrade}.
     *
     * Emits an {Upgraded} event.
     *
     * @custom:oz-upgrades-unsafe-allow-reachable delegatecall
     */
    function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {
        _authorizeUpgrade(newImplementation);
        _upgradeToAndCallUUPS(newImplementation, data, true);
    }

    /**
     * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by
     * {upgradeTo} and {upgradeToAndCall}.
     *
     * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.
     *
     * ```solidity
     * function _authorizeUpgrade(address) internal override onlyOwner {}
     * ```
     */
    function _authorizeUpgrade(address newImplementation) internal virtual;

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC1967 implementation slot:
 * ```solidity
 * contract ERC1967 {
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 *
 * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._
 * _Available since v4.9 for `string`, `bytes`._
 */
library StorageSlotUpgradeable {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    struct StringSlot {
        string value;
    }

    struct BytesSlot {
        bytes value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` with member `value` located at `slot`.
     */
    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.
     */
    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` with member `value` located at `slot`.
     */
    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
     */
    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }
}

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

// SPDX-License-Identifier: MIT

pragma solidity 0.8.19;

interface IGaugeController {
    function gaugeTypes(address addr_) external view returns (uint256);

    function votingEscrow() external view returns (address);

    function checkpointGauge(address addr) external;

    function addType(string memory name_, uint256 weight_) external;

    function addGauge(
        address addr_,
        int128 gaugeType_,
        uint256 weight_
    ) external;

    function gaugeRelativeWeight(
        address addr,
        uint256 time
    ) external view returns (uint256);
}

// SPDX-License-Identifier: MIT

pragma solidity 0.8.19;

interface IMinter {
    function token() external view returns (address);

    function controller() external view returns (address);

    function minted(
        address user_,
        address gauge_
    ) external view returns (uint256);
}

// SPDX-License-Identifier: MIT

pragma solidity 0.8.19;

interface IVotingEscrow {
    struct Point {
        int128 bias;
        int128 slope;
        uint256 ts;
        uint256 blk;
    }

    function balanceOf(address addr, uint256 t) external view returns (uint256);

    function balanceOf(address addr) external view returns (uint256);

    function checkpoint() external;

    function epoch() external view returns (uint256);

    function getLastUserSlope(address addr) external view returns (int128);

    function lockedEnd(address addr) external view returns (uint256);

    function pointHistory(uint256 loc) external view returns (Point memory);

    function totalSupply(uint256 t) external view returns (uint256);

    function userPointEpoch(address user) external view returns (uint256);

    function userPointHistory(
        address addr,
        uint256 loc
    ) external view returns (Point memory);

    function userPointHistoryTs(
        address addr,
        uint256 epoch
    ) external view returns (uint256);
}

// interface IVotingEscrow {
//     function userPointEpoch(address addr) external view returns (uint256);

//     function epoch() external view returns (uint256);

//     function userPointHistory(
//         address addr,
//         uint256 loc
//     ) external view returns (Point memory);

//     function pointHistory(uint256 loc) external view returns (Point memory);

//     function checkpoint() external;
// }

// SPDX-License-Identifier: MIT

pragma solidity 0.8.19;

interface IYMWK {
    function mint(address to_, uint256 value_) external returns (bool);

    function approve(address spender_, uint256 value_) external;

    function rate() external view returns (uint256);

    function futureEpochTimeWrite() external returns (uint256);
}

// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.19;

import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";

/// @title UUPSBase
/// @author DeFiGeek Community Japan
contract UUPSBase is UUPSUpgradeable {
    event CommitOwnership(address admin);
    event ApplyOwnership(address admin);

    address public admin;
    address public futureAdmin;

    function __UUPSBase_init() internal onlyInitializing {
        __UUPSBase_init_unchained();
    }

    function __UUPSBase_init_unchained() internal onlyInitializing {
        admin = msg.sender;
    }

    function _authorizeUpgrade(
        address newImplementation
    ) internal override onlyAdmin {}

    /***
     * @notice Transfer ownership of GaugeController to `addr`
     * @param addr_ Address to have ownership transferred to
     */
    function commitTransferOwnership(address addr_) external onlyAdmin {
        futureAdmin = addr_;
        emit CommitOwnership(addr_);
    }

    /***
     * @notice Apply pending ownership transfer
     */
    function applyTransferOwnership() external onlyAdmin {
        address _admin = futureAdmin;
        require(_admin != address(0), "admin not set");
        admin = _admin;
        emit ApplyOwnership(_admin);
    }

    modifier onlyAdmin() {
        require(admin == msg.sender, "admin only");
        _;
    }
}

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
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"admin","type":"address"}],"name":"ApplyOwnership","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"time","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokens","type":"uint256"}],"name":"CheckpointToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"admin","type":"address"}],"name":"CommitOwnership","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"WEEK","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"applyTransferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"checkpointToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"checkpointTotalSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr_","type":"address"}],"name":"claimableTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr_","type":"address"}],"name":"commitTransferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"futureAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"futureEpochTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gaugeController","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"inflationRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"minter_","type":"address"},{"internalType":"uint256","name":"startTime_","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"integrateFraction","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isKilled","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"isKilled_","type":"bool"}],"name":"setKilled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"timeCursor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"timeCursorOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenTimeCursor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokensPerWeek","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"addr_","type":"address"}],"name":"userCheckpoint","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userEpochOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user_","type":"address"},{"internalType":"uint256","name":"timestamp_","type":"uint256"}],"name":"veForAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"veSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"votingEscrow","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60a06040523060805234801561001457600080fd5b50608051612bf761004c6000396000818161061d015281816106b3015281816107ba01528181610850015261094b0152612bf76000f3fe6080604052600436106101cd5760003560e01c8063899519be116100f7578063caa0b9ed11610095578063f364824111610064578063f36482411461051b578063f4359ce51461053b578063f851a44014610552578063fc0c546a1461057257600080fd5b8063caa0b9ed14610499578063cd6dc687146104c6578063df0ab9d3146104e6578063e1cebf0b146104fb57600080fd5b80639e48d35e116100d15780639e48d35e14610411578063b07b709b14610427578063bee5dc3214610457578063c7f1ec501461046c57600080fd5b8063899519be146103ae5780638fe8a101146103db57806399eecb3b146103f157600080fd5b80634f1ef2861161016f57806378e979251161013e57806378e979251461034c57806384abf0661461036257806384d24226146103785780638736659b1461039857600080fd5b80634f1ef286146102d75780634f2bfe5b146102ea57806352d1902d1461030a578063786479cd1461031f57600080fd5b806331f9e35b116101ab57806331f9e35b1461026c578063326a9407146102825780633659cfe6146102975780634cb654af146102b757600080fd5b806307546172146101d2578063095995041461020f5780630f6592ef14610231575b600080fd5b3480156101de57600080fd5b50606a546101f2906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561021b57600080fd5b5061022f61022a3660046126ad565b610592565b005b34801561023d57600080fd5b5061025e61024c3660046126cf565b60746020526000908152604090205481565b604051908152602001610206565b34801561027857600080fd5b5061025e606d5481565b34801561028e57600080fd5b5061022f610609565b3480156102a357600080fd5b5061022f6102b23660046126fd565b610613565b3480156102c357600080fd5b506066546101f2906001600160a01b031681565b61022f6102e5366004612798565b6107b0565b3480156102f657600080fd5b506069546101f2906001600160a01b031681565b34801561031657600080fd5b5061025e61093e565b34801561032b57600080fd5b5061025e61033a3660046126fd565b60726020526000908152604090205481565b34801561035857600080fd5b5061025e60675481565b34801561036e57600080fd5b5061025e606f5481565b34801561038457600080fd5b5061025e6103933660046126fd565b610a03565b3480156103a457600080fd5b5061025e606e5481565b3480156103ba57600080fd5b5061025e6103c93660046126cf565b60736020526000908152604090205481565b3480156103e757600080fd5b5061025e60705481565b3480156103fd57600080fd5b50606b546101f2906001600160a01b031681565b34801561041d57600080fd5b5061025e606c5481565b34801561043357600080fd5b506104476104423660046126fd565b610ac4565b6040519015158152602001610206565b34801561046357600080fd5b5061022f610b44565b34801561047857600080fd5b5061025e6104873660046126fd565b60716020526000908152604090205481565b3480156104a557600080fd5b5061025e6104b43660046126fd565b60756020526000908152604090205481565b3480156104d257600080fd5b5061022f6104e136600461285e565b610bcf565b3480156104f257600080fd5b5061022f6110c3565b34801561050757600080fd5b5061022f6105163660046126fd565b6111e3565b34801561052757600080fd5b5061025e61053636600461285e565b6112a3565b34801561054757600080fd5b5061025e62093a8081565b34801561055e57600080fd5b506065546101f2906001600160a01b031681565b34801561057e57600080fd5b506068546101f2906001600160a01b031681565b6065546001600160a01b031633146105f15760405162461bcd60e51b815260206004820152600a60248201527f61646d696e206f6e6c790000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b806105fd576000610600565b60015b60ff1660705550565b610611611438565b565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036106b15760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c000000000000000000000000000000000000000060648201526084016105e8565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661070c7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b0316146107885760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f6163746976652070726f7879000000000000000000000000000000000000000060648201526084016105e8565b61079181611609565b604080516000808252602082019092526107ad91839190611663565b50565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016300361084e5760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c000000000000000000000000000000000000000060648201526084016105e8565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166108a97f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b0316146109255760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f6163746976652070726f7879000000000000000000000000000000000000000060648201526084016105e8565b61092e82611609565b61093a82826001611663565b5050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146109de5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c000000000000000060648201526084016105e8565b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc90565b6000610a0e82611821565b606a546040517f8b752bb00000000000000000000000000000000000000000000000000000000081526001600160a01b03848116600483015230602483015290911690638b752bb090604401602060405180830381865afa158015610a77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9b919061288a565b6001600160a01b038316600090815260756020526040902054610abe91906128d2565b92915050565b6000336001600160a01b0383161480610ae75750606a546001600160a01b031633145b610b335760405162461bcd60e51b815260206004820152601160248201527f6465763a20756e617574686f72697a656400000000000000000000000000000060448201526064016105e8565b610b3c82611821565b506001919050565b600062093a80610b5481426128e5565b610b5e9190612920565b6065549091506001600160a01b0316331480610b7b5750606f5481115b610bc75760405162461bcd60e51b815260206004820152600c60248201527f556e617574686f72697a6564000000000000000000000000000000000000000060448201526064016105e8565b6107ad611d07565b600054610100900460ff1615808015610bef5750600054600160ff909116105b80610c095750303b158015610c09575060005460ff166001145b610c7b5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016105e8565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558015610cd957600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b610ce16120d4565b606a80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038516908117909155604080517ffc0c546a000000000000000000000000000000000000000000000000000000008152905163fc0c546a916004808201926020929091908290030181865afa158015610d6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d8f9190612937565b606880547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03928316179055606a54604080517ff77c47910000000000000000000000000000000000000000000000000000000081529051919092169163f77c47919160048083019260209291908290030181865afa158015610e1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e429190612937565b606b80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03929092169182179055604080517f4f2bfe5b0000000000000000000000000000000000000000000000000000000081529051634f2bfe5b916004808201926020929091908290030181865afa158015610ecd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef19190612937565b606980547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03928316179055606854604080517f2c4e722e00000000000000000000000000000000000000000000000000000000815290519190921691632c4e722e9160048083019260209291908290030181865afa158015610f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fa4919061288a565b606d55606854604080517f277dbafb00000000000000000000000000000000000000000000000000000000815290516001600160a01b039092169163277dbafb9160048082019260209290919082900301816000875af115801561100c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611030919061288a565b606c55600062093a8061104381856128e5565b61104d9190612920565b6067819055606f819055606e555080156110be57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b6065546001600160a01b0316331461111d5760405162461bcd60e51b815260206004820152600a60248201527f61646d696e206f6e6c790000000000000000000000000000000000000000000060448201526064016105e8565b6066546001600160a01b0316806111765760405162461bcd60e51b815260206004820152600d60248201527f61646d696e206e6f74207365740000000000000000000000000000000000000060448201526064016105e8565b606580547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383169081179091556040519081527febee2d5739011062cb4f14113f3b36bf0ffe3da5c0568f64189d1012a1189105906020015b60405180910390a150565b6065546001600160a01b0316331461123d5760405162461bcd60e51b815260206004820152600a60248201527f61646d696e206f6e6c790000000000000000000000000000000000000000000060448201526064016105e8565b606680547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383169081179091556040519081527f2f56810a6bf40af059b96d3aea4db54081f378029a518390491093a7b67032e9906020016111d8565b6069546040517f81fc83bb0000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301526000921690829082906381fc83bb90602401602060405180830381865afa15801561130b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061132f919061288a565b9050600061133f83878785612159565b6040517f34d901a40000000000000000000000000000000000000000000000000000000081526001600160a01b038881166004830152602482018390529192506000918516906334d901a490604401608060405180830381865afa1580156113ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113cf919061296b565b905060008160400151876113e391906128d2565b82602001516113f291906129dd565b82516113fe9190612a04565b9050600081600f0b121561141a57600095505050505050610abe565b6fffffffffffffffffffffffffffffffff169450610abe9350505050565b606954606e546001600160a01b0390911690600062093a8061145a81426128e5565b6114649190612920565b9050826001600160a01b031663c2c4c5c16040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156114a157600080fd5b505af11580156114b5573d6000803e3d6000fd5b5050505060005b6014811015611601578183116116015760006114d8858561223a565b6040517f8ad4c447000000000000000000000000000000000000000000000000000000008152600481018290529091506000906001600160a01b03871690638ad4c44790602401608060405180830381865afa15801561153c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611560919061296b565b90506000816040015186111561158257604082015161157f9087612a52565b90505b600081836020015161159491906129dd565b83516115a09190612a04565b9050600081600f0b12156115c2576000878152607460205260408120556115e6565b60008781526074602052604090206fffffffffffffffffffffffffffffffff821690555b6115f362093a8088612a72565b9650505050506001016114bc565b5050606e5550565b6065546001600160a01b031633146107ad5760405162461bcd60e51b815260206004820152600a60248201527f61646d696e206f6e6c790000000000000000000000000000000000000000000060448201526064016105e8565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615611696576110be83612375565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa92505050801561170e575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820190925261170b9181019061288a565b60015b6117805760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201527f6f6e206973206e6f74205555505300000000000000000000000000000000000060648201526084016105e8565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc81146118155760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f7860448201527f6961626c6555554944000000000000000000000000000000000000000000000060648201526084016105e8565b506110be83838361244b565b606e54421061183257611832611438565b606e54606f54600062093a8061184881426128e5565b6118529190612920565b9050606f5481111561186c57611866611d07565b606f5491505b6069546040517f81fc83bb0000000000000000000000000000000000000000000000000000000081526001600160a01b038681166004830152909116906000908190819084906381fc83bb90602401602060405180830381865afa1580156118d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118fc919061288a565b606754909150600082900361191657505050505050505050565b6001600160a01b0389166000908152607160205260408120549081900361194a57611943868b8486612159565b9450611966565b6001600160a01b038a1660009081526072602052604090205494505b8460000361197357600194505b6040517f34d901a40000000000000000000000000000000000000000000000000000000081526001600160a01b038b8116600483015260248201879052600091908816906334d901a490604401608060405180830381865afa1580156119dd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a01919061296b565b905081600003611a465762093a8080600162093a808460400151611a259190612a72565b611a2f91906128d2565b611a3991906128e5565b611a439190612920565b91505b8982101580611a555750888210155b15611a67575050505050505050505050565b82821015611a73578291505b6040805160808101825260008082526020820181905291810182905260608101829052905b6032811015611c9b578b84101580611ab057508a8410155b611c9b5782604001518410158015611ac85750858811155b15611bdc57611ad688612a85565b975060405180608001604052808460000151600f0b81526020018460200151600f0b8152602001846040015181526020018460600151815250915085881115611b4b5760405180608001604052806000600f0b81526020016000600f0b81526020016000815260200160008152509250611c93565b6040517f34d901a40000000000000000000000000000000000000000000000000000000081526001600160a01b038e81166004830152602482018a90528a16906334d901a490604401608060405180830381865afa158015611bb1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bd5919061296b565b9250611c93565b6000826040015185611bee9190612a52565b905060008360200151600f0b82611c059190612abd565b8451611c149190600f0b612a52565b90506000811215611c23575060005b80158015611c305750878a115b15611c3c575050611c9b565b6000811315611c8157600086815260746020908152604080832054607390925290912054611c6a9083612920565b611c7491906128e5565b611c7e908a612a72565b98505b611c8e62093a8087612a72565b955050505b600101611a98565b50611cb085611cab60018a6128d2565b612476565b6001600160a01b038d166000908152607260209081526040808320849055607182528083208790556075909152812080549299508892909190611cf4908490612a72565b9091555050505050505050505050505050565b606d54606c54606f54600092919082908462093a80611d2681846128e5565b611d309190612920565b905060008062093a80611d4381426128e5565b611d4d9190612920565b9050838610158015611d5e57508086105b15611e6e57606860009054906101000a90046001600160a01b03166001600160a01b031663277dbafb6040518163ffffffff1660e01b81526004016020604051808303816000875af1158015611db8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ddc919061288a565b606c55606854604080517f2c4e722e00000000000000000000000000000000000000000000000000000000815290516001600160a01b0390921691632c4e722e916004808201926020929091908290030181865afa158015611e42573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e66919061288a565b606d81905594505b607054600103611e815760009650600094505b606b546040517f8aca6a230000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0390911690638aca6a2390602401600060405180830381600087803b158015611edf57600080fd5b505af1158015611ef3573d6000803e3d6000fd5b5050505060005b601481101561208b578184101561208b57611f1862093a8085612a72565b606b546040517f65c60468000000000000000000000000000000000000000000000000000000008152306004820152602481018790529194506000916001600160a01b03909116906365c6046890604401602060405180830381865afa158015611f86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611faa919061288a565b9050858810158015611fbb57508388105b15612023576000611fcc878a6128d2565b90506000611fda8a876128d2565b9050670de0b6b3a7640000611fef828b612920565b611ff9848e612920565b6120039190612a72565b61200d9085612920565b61201791906128e5565b9b50889a505050612057565b670de0b6b3a764000061203687866128d2565b6120408b84612920565b61204a9190612920565b61205491906128e5565b99505b600085815260736020526040812080548c9290612075908490612a72565b9091555093955085945084935050600101611efa565b50606f84905560408051428152602081018a90527fce749457b74e10f393f2c6b1ce4261b78791376db5a3f501477a809f03f500d6910160405180910390a15050505050505050565b600054610100900460ff166121515760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016105e8565b61061161248e565b60008082815b608081101561222c578183101561222c576040517f34d901a40000000000000000000000000000000000000000000000000000000081526001600160a01b038881166004830152600284860181010460248301819052916000918b16906334d901a490604401608060405180830381865afa1580156121e2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612206919061296b565b90508781604001511161221b57819450612222565b6001820393505b505060010161215f565b50909150505b949350505050565b6000806000846001600160a01b031663900cf0cf6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561227d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122a1919061288a565b905060005b608081101561236b578183101561236b576040517f8ad4c447000000000000000000000000000000000000000000000000000000008152600283850181010460048201819052906000906001600160a01b03891690638ad4c44790602401608060405180830381865afa158015612321573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612345919061296b565b90508681604001511161235a57819450612361565b6001820393505b50506001016122a6565b5090949350505050565b6001600160a01b0381163b6123f25760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e74726163740000000000000000000000000000000000000060648201526084016105e8565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b61245483612537565b6000825111806124615750805b156110be576124708383612577565b50505050565b60008183106124855781612487565b825b9392505050565b600054610100900460ff1661250b5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016105e8565b606580547fffffffffffffffffffffffff00000000000000000000000000000000000000001633179055565b61254081612375565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606124878383604051806060016040528060278152602001612b9b602791396060600080856001600160a01b0316856040516125b49190612b2d565b600060405180830381855af49150503d80600081146125ef576040519150601f19603f3d011682016040523d82523d6000602084013e6125f4565b606091505b50915091506126058683838761260f565b9695505050505050565b6060831561267e578251600003612677576001600160a01b0385163b6126775760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105e8565b5081612232565b61223283838151156126935781518083602001fd5b8060405162461bcd60e51b81526004016105e89190612b49565b6000602082840312156126bf57600080fd5b8135801515811461248757600080fd5b6000602082840312156126e157600080fd5b5035919050565b6001600160a01b03811681146107ad57600080fd5b60006020828403121561270f57600080fd5b8135612487816126e8565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156127905761279061271a565b604052919050565b600080604083850312156127ab57600080fd5b82356127b6816126e8565b915060208381013567ffffffffffffffff808211156127d457600080fd5b818601915086601f8301126127e857600080fd5b8135818111156127fa576127fa61271a565b61282a847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601612749565b9150808252878482850101111561284057600080fd5b80848401858401376000848284010152508093505050509250929050565b6000806040838503121561287157600080fd5b823561287c816126e8565b946020939093013593505050565b60006020828403121561289c57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b81810381811115610abe57610abe6128a3565b60008261291b577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b8082028115828204841417610abe57610abe6128a3565b60006020828403121561294957600080fd5b8151612487816126e8565b8051600f81900b811461296657600080fd5b919050565b60006080828403121561297d57600080fd5b6040516080810181811067ffffffffffffffff821117156129a0576129a061271a565b6040526129ac83612954565b81526129ba60208401612954565b602082015260408301516040820152606083015160608201528091505092915050565b600082600f0b82600f0b0280600f0b91508082146129fd576129fd6128a3565b5092915050565b600f82810b9082900b037fffffffffffffffffffffffffffffffff8000000000000000000000000000000081126f7fffffffffffffffffffffffffffffff82131715610abe57610abe6128a3565b81810360008312801583831316838312821617156129fd576129fd6128a3565b80820180821115610abe57610abe6128a3565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612ab657612ab66128a3565b5060010190565b808202600082127f800000000000000000000000000000000000000000000000000000000000000084141615612af557612af56128a3565b8181058314821517610abe57610abe6128a3565b60005b83811015612b24578181015183820152602001612b0c565b50506000910152565b60008251612b3f818460208701612b09565b9190910192915050565b6020815260008251806020840152612b68816040850160208701612b09565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212207df2b77d71467a9119b6672e15332ef759717e8ac44ba071612c2f709d4d328864736f6c63430008130033

Deployed Bytecode

0x6080604052600436106101cd5760003560e01c8063899519be116100f7578063caa0b9ed11610095578063f364824111610064578063f36482411461051b578063f4359ce51461053b578063f851a44014610552578063fc0c546a1461057257600080fd5b8063caa0b9ed14610499578063cd6dc687146104c6578063df0ab9d3146104e6578063e1cebf0b146104fb57600080fd5b80639e48d35e116100d15780639e48d35e14610411578063b07b709b14610427578063bee5dc3214610457578063c7f1ec501461046c57600080fd5b8063899519be146103ae5780638fe8a101146103db57806399eecb3b146103f157600080fd5b80634f1ef2861161016f57806378e979251161013e57806378e979251461034c57806384abf0661461036257806384d24226146103785780638736659b1461039857600080fd5b80634f1ef286146102d75780634f2bfe5b146102ea57806352d1902d1461030a578063786479cd1461031f57600080fd5b806331f9e35b116101ab57806331f9e35b1461026c578063326a9407146102825780633659cfe6146102975780634cb654af146102b757600080fd5b806307546172146101d2578063095995041461020f5780630f6592ef14610231575b600080fd5b3480156101de57600080fd5b50606a546101f2906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561021b57600080fd5b5061022f61022a3660046126ad565b610592565b005b34801561023d57600080fd5b5061025e61024c3660046126cf565b60746020526000908152604090205481565b604051908152602001610206565b34801561027857600080fd5b5061025e606d5481565b34801561028e57600080fd5b5061022f610609565b3480156102a357600080fd5b5061022f6102b23660046126fd565b610613565b3480156102c357600080fd5b506066546101f2906001600160a01b031681565b61022f6102e5366004612798565b6107b0565b3480156102f657600080fd5b506069546101f2906001600160a01b031681565b34801561031657600080fd5b5061025e61093e565b34801561032b57600080fd5b5061025e61033a3660046126fd565b60726020526000908152604090205481565b34801561035857600080fd5b5061025e60675481565b34801561036e57600080fd5b5061025e606f5481565b34801561038457600080fd5b5061025e6103933660046126fd565b610a03565b3480156103a457600080fd5b5061025e606e5481565b3480156103ba57600080fd5b5061025e6103c93660046126cf565b60736020526000908152604090205481565b3480156103e757600080fd5b5061025e60705481565b3480156103fd57600080fd5b50606b546101f2906001600160a01b031681565b34801561041d57600080fd5b5061025e606c5481565b34801561043357600080fd5b506104476104423660046126fd565b610ac4565b6040519015158152602001610206565b34801561046357600080fd5b5061022f610b44565b34801561047857600080fd5b5061025e6104873660046126fd565b60716020526000908152604090205481565b3480156104a557600080fd5b5061025e6104b43660046126fd565b60756020526000908152604090205481565b3480156104d257600080fd5b5061022f6104e136600461285e565b610bcf565b3480156104f257600080fd5b5061022f6110c3565b34801561050757600080fd5b5061022f6105163660046126fd565b6111e3565b34801561052757600080fd5b5061025e61053636600461285e565b6112a3565b34801561054757600080fd5b5061025e62093a8081565b34801561055e57600080fd5b506065546101f2906001600160a01b031681565b34801561057e57600080fd5b506068546101f2906001600160a01b031681565b6065546001600160a01b031633146105f15760405162461bcd60e51b815260206004820152600a60248201527f61646d696e206f6e6c790000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b806105fd576000610600565b60015b60ff1660705550565b610611611438565b565b6001600160a01b037f000000000000000000000000b075e39594c3c4b397e11c537ae4e5d18235ef101630036106b15760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c000000000000000000000000000000000000000060648201526084016105e8565b7f000000000000000000000000b075e39594c3c4b397e11c537ae4e5d18235ef106001600160a01b031661070c7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b0316146107885760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f6163746976652070726f7879000000000000000000000000000000000000000060648201526084016105e8565b61079181611609565b604080516000808252602082019092526107ad91839190611663565b50565b6001600160a01b037f000000000000000000000000b075e39594c3c4b397e11c537ae4e5d18235ef1016300361084e5760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c000000000000000000000000000000000000000060648201526084016105e8565b7f000000000000000000000000b075e39594c3c4b397e11c537ae4e5d18235ef106001600160a01b03166108a97f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b0316146109255760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f6163746976652070726f7879000000000000000000000000000000000000000060648201526084016105e8565b61092e82611609565b61093a82826001611663565b5050565b6000306001600160a01b037f000000000000000000000000b075e39594c3c4b397e11c537ae4e5d18235ef1016146109de5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c000000000000000060648201526084016105e8565b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc90565b6000610a0e82611821565b606a546040517f8b752bb00000000000000000000000000000000000000000000000000000000081526001600160a01b03848116600483015230602483015290911690638b752bb090604401602060405180830381865afa158015610a77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9b919061288a565b6001600160a01b038316600090815260756020526040902054610abe91906128d2565b92915050565b6000336001600160a01b0383161480610ae75750606a546001600160a01b031633145b610b335760405162461bcd60e51b815260206004820152601160248201527f6465763a20756e617574686f72697a656400000000000000000000000000000060448201526064016105e8565b610b3c82611821565b506001919050565b600062093a80610b5481426128e5565b610b5e9190612920565b6065549091506001600160a01b0316331480610b7b5750606f5481115b610bc75760405162461bcd60e51b815260206004820152600c60248201527f556e617574686f72697a6564000000000000000000000000000000000000000060448201526064016105e8565b6107ad611d07565b600054610100900460ff1615808015610bef5750600054600160ff909116105b80610c095750303b158015610c09575060005460ff166001145b610c7b5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016105e8565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558015610cd957600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b610ce16120d4565b606a80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038516908117909155604080517ffc0c546a000000000000000000000000000000000000000000000000000000008152905163fc0c546a916004808201926020929091908290030181865afa158015610d6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d8f9190612937565b606880547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03928316179055606a54604080517ff77c47910000000000000000000000000000000000000000000000000000000081529051919092169163f77c47919160048083019260209291908290030181865afa158015610e1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e429190612937565b606b80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03929092169182179055604080517f4f2bfe5b0000000000000000000000000000000000000000000000000000000081529051634f2bfe5b916004808201926020929091908290030181865afa158015610ecd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef19190612937565b606980547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03928316179055606854604080517f2c4e722e00000000000000000000000000000000000000000000000000000000815290519190921691632c4e722e9160048083019260209291908290030181865afa158015610f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fa4919061288a565b606d55606854604080517f277dbafb00000000000000000000000000000000000000000000000000000000815290516001600160a01b039092169163277dbafb9160048082019260209290919082900301816000875af115801561100c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611030919061288a565b606c55600062093a8061104381856128e5565b61104d9190612920565b6067819055606f819055606e555080156110be57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b6065546001600160a01b0316331461111d5760405162461bcd60e51b815260206004820152600a60248201527f61646d696e206f6e6c790000000000000000000000000000000000000000000060448201526064016105e8565b6066546001600160a01b0316806111765760405162461bcd60e51b815260206004820152600d60248201527f61646d696e206e6f74207365740000000000000000000000000000000000000060448201526064016105e8565b606580547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383169081179091556040519081527febee2d5739011062cb4f14113f3b36bf0ffe3da5c0568f64189d1012a1189105906020015b60405180910390a150565b6065546001600160a01b0316331461123d5760405162461bcd60e51b815260206004820152600a60248201527f61646d696e206f6e6c790000000000000000000000000000000000000000000060448201526064016105e8565b606680547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383169081179091556040519081527f2f56810a6bf40af059b96d3aea4db54081f378029a518390491093a7b67032e9906020016111d8565b6069546040517f81fc83bb0000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301526000921690829082906381fc83bb90602401602060405180830381865afa15801561130b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061132f919061288a565b9050600061133f83878785612159565b6040517f34d901a40000000000000000000000000000000000000000000000000000000081526001600160a01b038881166004830152602482018390529192506000918516906334d901a490604401608060405180830381865afa1580156113ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113cf919061296b565b905060008160400151876113e391906128d2565b82602001516113f291906129dd565b82516113fe9190612a04565b9050600081600f0b121561141a57600095505050505050610abe565b6fffffffffffffffffffffffffffffffff169450610abe9350505050565b606954606e546001600160a01b0390911690600062093a8061145a81426128e5565b6114649190612920565b9050826001600160a01b031663c2c4c5c16040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156114a157600080fd5b505af11580156114b5573d6000803e3d6000fd5b5050505060005b6014811015611601578183116116015760006114d8858561223a565b6040517f8ad4c447000000000000000000000000000000000000000000000000000000008152600481018290529091506000906001600160a01b03871690638ad4c44790602401608060405180830381865afa15801561153c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611560919061296b565b90506000816040015186111561158257604082015161157f9087612a52565b90505b600081836020015161159491906129dd565b83516115a09190612a04565b9050600081600f0b12156115c2576000878152607460205260408120556115e6565b60008781526074602052604090206fffffffffffffffffffffffffffffffff821690555b6115f362093a8088612a72565b9650505050506001016114bc565b5050606e5550565b6065546001600160a01b031633146107ad5760405162461bcd60e51b815260206004820152600a60248201527f61646d696e206f6e6c790000000000000000000000000000000000000000000060448201526064016105e8565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615611696576110be83612375565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa92505050801561170e575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820190925261170b9181019061288a565b60015b6117805760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201527f6f6e206973206e6f74205555505300000000000000000000000000000000000060648201526084016105e8565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc81146118155760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f7860448201527f6961626c6555554944000000000000000000000000000000000000000000000060648201526084016105e8565b506110be83838361244b565b606e54421061183257611832611438565b606e54606f54600062093a8061184881426128e5565b6118529190612920565b9050606f5481111561186c57611866611d07565b606f5491505b6069546040517f81fc83bb0000000000000000000000000000000000000000000000000000000081526001600160a01b038681166004830152909116906000908190819084906381fc83bb90602401602060405180830381865afa1580156118d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118fc919061288a565b606754909150600082900361191657505050505050505050565b6001600160a01b0389166000908152607160205260408120549081900361194a57611943868b8486612159565b9450611966565b6001600160a01b038a1660009081526072602052604090205494505b8460000361197357600194505b6040517f34d901a40000000000000000000000000000000000000000000000000000000081526001600160a01b038b8116600483015260248201879052600091908816906334d901a490604401608060405180830381865afa1580156119dd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a01919061296b565b905081600003611a465762093a8080600162093a808460400151611a259190612a72565b611a2f91906128d2565b611a3991906128e5565b611a439190612920565b91505b8982101580611a555750888210155b15611a67575050505050505050505050565b82821015611a73578291505b6040805160808101825260008082526020820181905291810182905260608101829052905b6032811015611c9b578b84101580611ab057508a8410155b611c9b5782604001518410158015611ac85750858811155b15611bdc57611ad688612a85565b975060405180608001604052808460000151600f0b81526020018460200151600f0b8152602001846040015181526020018460600151815250915085881115611b4b5760405180608001604052806000600f0b81526020016000600f0b81526020016000815260200160008152509250611c93565b6040517f34d901a40000000000000000000000000000000000000000000000000000000081526001600160a01b038e81166004830152602482018a90528a16906334d901a490604401608060405180830381865afa158015611bb1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bd5919061296b565b9250611c93565b6000826040015185611bee9190612a52565b905060008360200151600f0b82611c059190612abd565b8451611c149190600f0b612a52565b90506000811215611c23575060005b80158015611c305750878a115b15611c3c575050611c9b565b6000811315611c8157600086815260746020908152604080832054607390925290912054611c6a9083612920565b611c7491906128e5565b611c7e908a612a72565b98505b611c8e62093a8087612a72565b955050505b600101611a98565b50611cb085611cab60018a6128d2565b612476565b6001600160a01b038d166000908152607260209081526040808320849055607182528083208790556075909152812080549299508892909190611cf4908490612a72565b9091555050505050505050505050505050565b606d54606c54606f54600092919082908462093a80611d2681846128e5565b611d309190612920565b905060008062093a80611d4381426128e5565b611d4d9190612920565b9050838610158015611d5e57508086105b15611e6e57606860009054906101000a90046001600160a01b03166001600160a01b031663277dbafb6040518163ffffffff1660e01b81526004016020604051808303816000875af1158015611db8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ddc919061288a565b606c55606854604080517f2c4e722e00000000000000000000000000000000000000000000000000000000815290516001600160a01b0390921691632c4e722e916004808201926020929091908290030181865afa158015611e42573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e66919061288a565b606d81905594505b607054600103611e815760009650600094505b606b546040517f8aca6a230000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0390911690638aca6a2390602401600060405180830381600087803b158015611edf57600080fd5b505af1158015611ef3573d6000803e3d6000fd5b5050505060005b601481101561208b578184101561208b57611f1862093a8085612a72565b606b546040517f65c60468000000000000000000000000000000000000000000000000000000008152306004820152602481018790529194506000916001600160a01b03909116906365c6046890604401602060405180830381865afa158015611f86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611faa919061288a565b9050858810158015611fbb57508388105b15612023576000611fcc878a6128d2565b90506000611fda8a876128d2565b9050670de0b6b3a7640000611fef828b612920565b611ff9848e612920565b6120039190612a72565b61200d9085612920565b61201791906128e5565b9b50889a505050612057565b670de0b6b3a764000061203687866128d2565b6120408b84612920565b61204a9190612920565b61205491906128e5565b99505b600085815260736020526040812080548c9290612075908490612a72565b9091555093955085945084935050600101611efa565b50606f84905560408051428152602081018a90527fce749457b74e10f393f2c6b1ce4261b78791376db5a3f501477a809f03f500d6910160405180910390a15050505050505050565b600054610100900460ff166121515760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016105e8565b61061161248e565b60008082815b608081101561222c578183101561222c576040517f34d901a40000000000000000000000000000000000000000000000000000000081526001600160a01b038881166004830152600284860181010460248301819052916000918b16906334d901a490604401608060405180830381865afa1580156121e2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612206919061296b565b90508781604001511161221b57819450612222565b6001820393505b505060010161215f565b50909150505b949350505050565b6000806000846001600160a01b031663900cf0cf6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561227d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122a1919061288a565b905060005b608081101561236b578183101561236b576040517f8ad4c447000000000000000000000000000000000000000000000000000000008152600283850181010460048201819052906000906001600160a01b03891690638ad4c44790602401608060405180830381865afa158015612321573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612345919061296b565b90508681604001511161235a57819450612361565b6001820393505b50506001016122a6565b5090949350505050565b6001600160a01b0381163b6123f25760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e74726163740000000000000000000000000000000000000060648201526084016105e8565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b61245483612537565b6000825111806124615750805b156110be576124708383612577565b50505050565b60008183106124855781612487565b825b9392505050565b600054610100900460ff1661250b5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016105e8565b606580547fffffffffffffffffffffffff00000000000000000000000000000000000000001633179055565b61254081612375565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606124878383604051806060016040528060278152602001612b9b602791396060600080856001600160a01b0316856040516125b49190612b2d565b600060405180830381855af49150503d80600081146125ef576040519150601f19603f3d011682016040523d82523d6000602084013e6125f4565b606091505b50915091506126058683838761260f565b9695505050505050565b6060831561267e578251600003612677576001600160a01b0385163b6126775760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105e8565b5081612232565b61223283838151156126935781518083602001fd5b8060405162461bcd60e51b81526004016105e89190612b49565b6000602082840312156126bf57600080fd5b8135801515811461248757600080fd5b6000602082840312156126e157600080fd5b5035919050565b6001600160a01b03811681146107ad57600080fd5b60006020828403121561270f57600080fd5b8135612487816126e8565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156127905761279061271a565b604052919050565b600080604083850312156127ab57600080fd5b82356127b6816126e8565b915060208381013567ffffffffffffffff808211156127d457600080fd5b818601915086601f8301126127e857600080fd5b8135818111156127fa576127fa61271a565b61282a847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601612749565b9150808252878482850101111561284057600080fd5b80848401858401376000848284010152508093505050509250929050565b6000806040838503121561287157600080fd5b823561287c816126e8565b946020939093013593505050565b60006020828403121561289c57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b81810381811115610abe57610abe6128a3565b60008261291b577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b8082028115828204841417610abe57610abe6128a3565b60006020828403121561294957600080fd5b8151612487816126e8565b8051600f81900b811461296657600080fd5b919050565b60006080828403121561297d57600080fd5b6040516080810181811067ffffffffffffffff821117156129a0576129a061271a565b6040526129ac83612954565b81526129ba60208401612954565b602082015260408301516040820152606083015160608201528091505092915050565b600082600f0b82600f0b0280600f0b91508082146129fd576129fd6128a3565b5092915050565b600f82810b9082900b037fffffffffffffffffffffffffffffffff8000000000000000000000000000000081126f7fffffffffffffffffffffffffffffff82131715610abe57610abe6128a3565b81810360008312801583831316838312821617156129fd576129fd6128a3565b80820180821115610abe57610abe6128a3565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612ab657612ab66128a3565b5060010190565b808202600082127f800000000000000000000000000000000000000000000000000000000000000084141615612af557612af56128a3565b8181058314821517610abe57610abe6128a3565b60005b83811015612b24578181015183820152602001612b0c565b50506000910152565b60008251612b3f818460208701612b09565b9190910192915050565b6020815260008251806020840152612b68816040850160208701612b09565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212207df2b77d71467a9119b6672e15332ef759717e8ac44ba071612c2f709d4d328864736f6c63430008130033

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

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.