Sonic Blaze Testnet

Contract

0x5fEE901C16E4c6015634700D058eb708DC6C41d0

Overview

S Balance

Sonic Blaze LogoSonic Blaze LogoSonic Blaze Logo0 S

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To
52846992024-12-19 8:33:0019 mins ago1734597180
0x5fEE901C...8DC6C41d0
0 S
52845252024-12-19 8:32:0120 mins ago1734597121
0x5fEE901C...8DC6C41d0
0 S
52845252024-12-19 8:32:0120 mins ago1734597121
0x5fEE901C...8DC6C41d0
0 S
52845252024-12-19 8:32:0120 mins ago1734597121
0x5fEE901C...8DC6C41d0
0 S
52845252024-12-19 8:32:0120 mins ago1734597121
0x5fEE901C...8DC6C41d0
0 S
52845252024-12-19 8:32:0120 mins ago1734597121
0x5fEE901C...8DC6C41d0
0 S
52845252024-12-19 8:32:0120 mins ago1734597121
0x5fEE901C...8DC6C41d0
0 S
52845252024-12-19 8:32:0120 mins ago1734597121
0x5fEE901C...8DC6C41d0
0 S
52845252024-12-19 8:32:0120 mins ago1734597121
0x5fEE901C...8DC6C41d0
0 S
52845252024-12-19 8:32:0120 mins ago1734597121
0x5fEE901C...8DC6C41d0
0 S
52845252024-12-19 8:32:0120 mins ago1734597121
0x5fEE901C...8DC6C41d0
0 S
52792652024-12-19 8:03:0149 mins ago1734595381
0x5fEE901C...8DC6C41d0
0 S
52788962024-12-19 8:01:0051 mins ago1734595260
0x5fEE901C...8DC6C41d0
0 S
52788962024-12-19 8:01:0051 mins ago1734595260
0x5fEE901C...8DC6C41d0
0 S
52788962024-12-19 8:01:0051 mins ago1734595260
0x5fEE901C...8DC6C41d0
0 S
52788962024-12-19 8:01:0051 mins ago1734595260
0x5fEE901C...8DC6C41d0
0 S
52788962024-12-19 8:01:0051 mins ago1734595260
0x5fEE901C...8DC6C41d0
0 S
52788962024-12-19 8:01:0051 mins ago1734595260
0x5fEE901C...8DC6C41d0
0 S
52788962024-12-19 8:01:0051 mins ago1734595260
0x5fEE901C...8DC6C41d0
0 S
52788962024-12-19 8:01:0051 mins ago1734595260
0x5fEE901C...8DC6C41d0
0 S
52788962024-12-19 8:01:0051 mins ago1734595260
0x5fEE901C...8DC6C41d0
0 S
52788962024-12-19 8:01:0051 mins ago1734595260
0x5fEE901C...8DC6C41d0
0 S
52737492024-12-19 7:33:001 hr ago1734593580
0x5fEE901C...8DC6C41d0
0 S
52735682024-12-19 7:32:011 hr ago1734593521
0x5fEE901C...8DC6C41d0
0 S
52735682024-12-19 7:32:011 hr ago1734593521
0x5fEE901C...8DC6C41d0
0 S
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
MinterUpgradeable

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 13 : MinterUpgradeable.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.13;

import "./libraries/Math.sol";
import "./libraries/Constants.sol";
import "./interfaces/IMinter.sol";
import "./interfaces/IRewardsDistributor.sol";
import "./interfaces/ISWPx.sol";
import "./interfaces/IVoter.sol";
import "./interfaces/IVotingEscrow.sol";
import "./interfaces/IMasterchef.sol";

import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";

// codifies the minting rules as per ve(3,3), abstracted from the token to support any token that allows minting

contract MinterUpgradeable is IMinter, OwnableUpgradeable {

    bool public isFirstMint;

    uint public EMISSION;
    uint public TAIL_EMISSION;
    uint public REBASE_MAX;
    uint public REBASE_MIN;
    uint public REBASE_STEP;
    uint public currentRebaseRate;
    uint public constant PRECISION = 1000;
    uint public teamRate;
    uint public referralRate;
    uint public surplusTokens;
    uint public constant MAX_TEAM_RATE = 50; // 5%
    uint public constant MAX_REFERRAL_RATE = 100; // 10%

    uint public weekly; // represents a starting weekly emission of 2.0M SWPx (SWPx has 18 decimals)
    uint public active_period;
    bool public isEpochsStarted;
    uint public weekNumber;
    uint public constant LOCK = 86400 * 7 * 52 * 2;

    address public team;
    address public pendingTeam;
    address public referralAddress;

    ISWPx public _swpx;
    IVoter public _voter;
    IVotingEscrow public _ve;
    IRewardsDistributor public _rewards_distributor;
    IMasterchef public masterchef;

    event Mint(address indexed sender, uint weekly, uint circulating_supply, uint circulating_emission);
    event EpochChanged(uint256 epochStartTime);

    constructor() {}

    function initialize(
        address __voter, // the voting & distribution system
        address __ve, // the ve(3,3) system that will be locked into
        address __rewards_distributor, // the distribution system that ensures users aren't diluted
        address _masterchef,
        address _initialMintRecipient
    ) initializer public {
        __Ownable_init();

        team = msg.sender;

        teamRate = 30; // 300 bps = 3%
        referralRate = 50;

        EMISSION = 990;
        TAIL_EMISSION = 2;
        REBASE_MAX = 300;
        REBASE_MIN = 100;
        REBASE_STEP = 10;

        _swpx = ISWPx(IVotingEscrow(__ve).token());
        _voter = IVoter(__voter);
        _ve = IVotingEscrow(__ve);
        _rewards_distributor = IRewardsDistributor(__rewards_distributor);
        masterchef = IMasterchef(_masterchef);

        _swpx.initialMint(_initialMintRecipient);

        weekly = 2_000_000 * 1e18; // represents a starting weekly emission of 2M SWPx (SWPx has 18 decimals)
        isFirstMint = true;
    }

    function startEpoch() external onlyOwner {
        require(!isEpochsStarted, "Already started");

        active_period = (block.timestamp / Constants.EPOCH_LENGTH) * Constants.EPOCH_LENGTH;
        isEpochsStarted = true;

        emit EpochChanged(active_period);
    }

    function setTeam(address _team) external {
        require(msg.sender == team, "not team");
        pendingTeam = _team;
    }

    function acceptTeam() external {
        require(msg.sender == pendingTeam, "not pending team");
        team = pendingTeam;
    }

    function setVoter(address __voter) external {
        require(__voter != address(0));
        require(msg.sender == team, "not team");
        _voter = IVoter(__voter);
    }

    function setTeamRate(uint _teamRate) external {
        require(msg.sender == team, "not team");
        require(_teamRate <= MAX_TEAM_RATE, "rate too high");
        teamRate = _teamRate;
    }

    function setEmission(uint _emission) external {
        require(msg.sender == team, "not team");
        require(_emission <= PRECISION * 150 / 100, "rate too high");
        EMISSION = _emission;
    }

    function setReferralRate(uint _referralRate) external {
        require(msg.sender == team, "not team");
        require(_referralRate <= MAX_REFERRAL_RATE, "rate too high");
        referralRate = _referralRate;
    }

    function setReferralAddress(address _referralAddress) external {
        require(_referralAddress != address(0));
        require(msg.sender == team, "not team");
        referralAddress = _referralAddress;
    }

    // calculate circulating supply as total token supply - locked supply
    function circulating_supply() public view returns (uint) {
        return _swpx.totalSupply() - _swpx.balanceOf(address(_ve));
    }

    // emission calculation is 1% of available supply to mint adjusted by circulating / total supply
    function calculate_emission() public view returns (uint) {
        return (weekly * EMISSION) / PRECISION;
    }

    function circulating_emission() public view returns (uint) {
        return (circulating_supply() * TAIL_EMISSION) / PRECISION;
    }

    // calculate inflation and adjust ve balances accordingly
    function calculate_rebase(uint _weeklyMint) public view returns (uint, uint) {
        if (weekNumber == 0) {
            return (0, 0);
        }

        uint256 _currentRebaseRate = currentRebaseRate;
        if (_currentRebaseRate == 0) {
            _currentRebaseRate = REBASE_MIN;
        } else if (_currentRebaseRate < REBASE_MAX) {
            _currentRebaseRate += REBASE_STEP;
        }

        uint256 rebaseAmount = _weeklyMint * _currentRebaseRate / PRECISION;

        return (_currentRebaseRate, rebaseAmount);
    }

    // update period can only be called once per cycle (1 week)
    function update_period() external returns (uint) {
        uint _period = active_period;
        if (block.timestamp >= _period + Constants.EPOCH_LENGTH && isEpochsStarted) { // only trigger if new week
            _period = (block.timestamp / Constants.EPOCH_LENGTH) * Constants.EPOCH_LENGTH;
            active_period = _period;

            if(!isFirstMint){
                weekly = calculate_emission();
            } else {
                isFirstMint = false;
            }

            uint _rebase;
            (currentRebaseRate, _rebase) = calculate_rebase(weekly);
            uint _teamEmissions = weekly * teamRate / PRECISION;
            uint _referralEmissions = weekly * referralRate / PRECISION;
            uint _required = weekly + surplusTokens;

            uint _gauge = weekly + surplusTokens - _rebase - _teamEmissions - _referralEmissions;
            delete surplusTokens;

            uint _balanceOf = _swpx.balanceOf(address(this));
            if (_balanceOf < _required) {
                _swpx.mint(address(this), _required - _balanceOf);
            }

            if (weekNumber < 12) {
                masterchef.setDistributionRateExtra(_teamEmissions);
                require(_swpx.transfer(address(masterchef), _teamEmissions));
            } else {
                require(_swpx.transfer(team, _teamEmissions));
            }

            if(referralAddress != address(0)) require(_swpx.transfer(referralAddress, _referralEmissions));
            require(_swpx.transfer(address(_rewards_distributor), _rebase));
            _rewards_distributor.checkpoint_token(); // checkpoint token balance that was just minted in rewards distributor
            _rewards_distributor.checkpoint_total_supply(); // checkpoint supply

            require(_swpx.approve(address(_voter), _gauge));
            _voter.notifyRewardAmount(_gauge);

            emit EpochChanged(_period);
            emit Mint(msg.sender, weekly, circulating_supply(), circulating_emission());

            ++weekNumber;
        }
        return _period;
    }

    function returnSurplusTokens(uint256 amount) external {
        require(msg.sender == referralAddress, "!referralAddress");

        surplusTokens += amount;

        require(_swpx.transferFrom(msg.sender, address(this), amount));
    }

    function check() external view returns(bool){
        uint _period = active_period;
        return (block.timestamp >= _period + Constants.EPOCH_LENGTH && isEpochsStarted);
    }

    function period() external view returns(uint){
        return(block.timestamp / Constants.EPOCH_LENGTH) * Constants.EPOCH_LENGTH;
    }
    function setRewardDistributor(address _rewardDistro) external {
        require(msg.sender == team);
        _rewards_distributor = IRewardsDistributor(_rewardDistro);
    }
}

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

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal onlyInitializing {
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _transferOwnership(_msgSender());
    }

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

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

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

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

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

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

    /**
     * @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[49] private __gap;
}

File 3 of 13 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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]
 * ```
 * 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 Internal function that returns the initialized version. Returns `_initialized`
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Internal function that returns the initialized version. Returns `_initializing`
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}

File 4 of 13 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library 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
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

File 5 of 13 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @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 ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.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;
}

File 6 of 13 : IMasterchef.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.13;


interface IMasterchef {
    struct PoolInfo {
        uint256 accRewardPerShare;
        uint256 accRewardPerShareExtra;
        uint256 lastRewardTime;
    }

    function setDistributionRate(uint256 amount) external;

    function setDistributionRateExtra(uint256 amount) external;

    function updatePool() external returns (PoolInfo memory pool);
}

File 7 of 13 : IMinter.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

interface IMinter {
    function update_period() external returns (uint);
    function check() external view returns(bool);
    function period() external view returns(uint);
    function active_period() external view returns(uint);
}

File 8 of 13 : IRewardsDistributor.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

interface IRewardsDistributor {
    function checkpoint_token() external;
    function voting_escrow() external view returns(address);
    function checkpoint_total_supply() external;
    function claimable(uint _tokenId) external view returns (uint);
}

File 9 of 13 : ISWPx.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

interface ISWPx {
    function initialMint(address _recipient) external;
    function totalSupply() external view returns (uint);
    function balanceOf(address) external view returns (uint);
    function approve(address spender, uint value) external returns (bool);
    function transfer(address, uint) external returns (bool);
    function transferFrom(address,address,uint) external returns (bool);
    function mint(address, uint) external returns (bool);
    function minter() external returns (address);
}

File 10 of 13 : IVoter.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

interface IVoter {
    function _ve() external view returns (address);
    function gauges(address _pair) external view returns (address);
    function isGauge(address _gauge) external view returns (bool);
    function poolForGauge(address _gauge) external view returns (address);
    function factory() external view returns (address);
    function minter() external view returns(address);
    function isWhitelisted(address token) external view returns (bool);
    function notifyRewardAmount(uint amount) external;
    function distributeAll() external;
    function distributeFees(address[] memory _gauges) external;

    function internal_bribes(address _gauge) external view returns (address);
    function external_bribes(address _gauge) external view returns (address);

    function usedWeights(uint id) external view returns(uint);
    function lastVoted(uint id) external view returns(uint);
    function poolVote(uint id, uint _index) external view returns(address _pair);
    function votes(uint id, address _pool) external view returns(uint votes);
    function poolVoteLength(uint tokenId) external view returns(uint);
    
}

File 11 of 13 : IVotingEscrow.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

interface IVotingEscrow {

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

    struct LockedBalance {
        int128 amount;
        uint start;
        uint end;
    }

    function create_lock_for(uint _value, uint _lock_duration, address _to) external returns (uint);

    function locked(uint id) external view returns(LockedBalance memory);
    function tokenOfOwnerByIndex(address _owner, uint _tokenIndex) external view returns (uint);

    function token() external view returns (address);
    function team() external returns (address);
    function epoch() external view returns (uint);
    function point_history(uint loc) external view returns (Point memory);
    function user_point_history(uint tokenId, uint loc) external view returns (Point memory);
    function user_point_epoch(uint tokenId) external view returns (uint);

    function ownerOf(uint) external view returns (address);
    function isApprovedOrOwner(address, uint) external view returns (bool);
    function transferFrom(address, address, uint) external;

    function voted(uint) external view returns (bool);
    function attachments(uint) external view returns (uint);
    function voting(uint tokenId) external;
    function abstain(uint tokenId) external;
    function attach(uint tokenId) external;
    function detach(uint tokenId) external;

    function checkpoint() external;
    function deposit_for(uint tokenId, uint value) external;

    function balanceOfAtNFT(uint _tokenId, uint _block) external view returns (uint);
    function balanceOfNFT(uint _id) external view returns (uint);
    function balanceOf(address _owner) external view returns (uint);
    function totalSupply() external view returns (uint);
    function supply() external view returns (uint);


    function decimals() external view returns(uint8);
}

File 12 of 13 : Constants.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

library Constants {
    uint256 internal constant EPOCH_LENGTH = 30 minutes; //7 days;
}

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

library Math {
    function max(uint a, uint b) internal pure returns (uint) {
        return a >= b ? a : b;
    }
    function min(uint a, uint b) internal pure returns (uint) {
        return a < b ? a : b;
    }
    function sqrt(uint y) internal pure returns (uint z) {
        if (y > 3) {
            z = y;
            uint x = y / 2 + 1;
            while (x < z) {
                z = x;
                x = (y / x + x) / 2;
            }
        } else if (y != 0) {
            z = 1;
        }
    }
    function cbrt(uint256 n) internal pure returns (uint256) { unchecked {
        uint256 x = 0;
        for (uint256 y = 1 << 255; y > 0; y >>= 3) {
            x <<= 1;
            uint256 z = 3 * x * (x + 1) + 1;
            if (n / y >= z) {
                n -= y * z;
                x += 1;
            }
        }
        return x;
    }}
}

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

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"epochStartTime","type":"uint256"}],"name":"EpochChanged","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":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"weekly","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"circulating_supply","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"circulating_emission","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"EMISSION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LOCK","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_REFERRAL_RATE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_TEAM_RATE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REBASE_MAX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REBASE_MIN","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REBASE_STEP","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TAIL_EMISSION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_rewards_distributor","outputs":[{"internalType":"contract IRewardsDistributor","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_swpx","outputs":[{"internalType":"contract ISWPx","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_ve","outputs":[{"internalType":"contract IVotingEscrow","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_voter","outputs":[{"internalType":"contract IVoter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptTeam","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"active_period","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"calculate_emission","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_weeklyMint","type":"uint256"}],"name":"calculate_rebase","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"check","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"circulating_emission","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"circulating_supply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentRebaseRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"__voter","type":"address"},{"internalType":"address","name":"__ve","type":"address"},{"internalType":"address","name":"__rewards_distributor","type":"address"},{"internalType":"address","name":"_masterchef","type":"address"},{"internalType":"address","name":"_initialMintRecipient","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isEpochsStarted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isFirstMint","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"masterchef","outputs":[{"internalType":"contract IMasterchef","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingTeam","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"period","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"referralAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"referralRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"returnSurplusTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_emission","type":"uint256"}],"name":"setEmission","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_referralAddress","type":"address"}],"name":"setReferralAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_referralRate","type":"uint256"}],"name":"setReferralRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardDistro","type":"address"}],"name":"setRewardDistributor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_team","type":"address"}],"name":"setTeam","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_teamRate","type":"uint256"}],"name":"setTeamRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"__voter","type":"address"}],"name":"setVoter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startEpoch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"surplusTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"team","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"teamRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"update_period","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"weekNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"weekly","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b5061192f806100206000396000f3fe608060405234801561001057600080fd5b50600436106102955760003560e01c80638dd598fb11610167578063b3caba5a116100ce578063e038c75a11610087578063e038c75a14610512578063ed29fc111461051a578063ef78d4fd14610522578063f2fde38b1461052a578063fb1db2781461053d578063fff09d381461055057600080fd5b8063b3caba5a146104bf578063b5cc143a146104d2578063b9edd5ff146104da578063ca4863fd146104e3578063d1399608146104f6578063ddce102f146104ff57600080fd5b8063a18cb95611610120578063a18cb95614610484578063a2c8b1771461048d578063a2e23a5114610495578063a4f0d7d01461049e578063a9abf7ec146104a9578063aaf5eb68146104b657600080fd5b80638dd598fb14610412578063919840ad146104255780639c809ff71461042d578063a053ce1f14610440578063a129cfbf14610449578063a1809b951461047157600080fd5b80634b1cd5da1161020b5780635ef5cc4a116101c45780635ef5cc4a146103cb5780635f8a325d146103d4578063715018a6146103dd57806378ef7f02146103e557806385f2aef2146103ee5780638da5cb5b1461040157600080fd5b80634b1cd5da1461036d5780634bc2a657146103805780634e5242061461039357806350b9e2c61461039c578063548dd3fe146103a557806359d46ffc146103b857600080fd5b80631eebae801161025d5780631eebae8014610325578063260edaaa1461032d57806326cfc17b146103365780632e8f7b1f1461033f57806336d96faf146103525780633db9b42a1461035a57600080fd5b806301c8e6fd1461029a578063095cf5c6146102b55780631459457a146102ca57806315a88d22146102dd5780631e6ff7b114610308575b600080fd5b6102a2603281565b6040519081526020015b60405180910390f35b6102c86102c33660046116c0565b610558565b005b6102c86102d83660046116e4565b6105ad565b6075546102f0906001600160a01b031681565b6040516001600160a01b0390911681526020016102ac565b6071546103159060ff1681565b60405190151581526020016102ac565b6102a2610822565b6102a2606e5481565b6102a2606f5481565b6102c861034d366004611755565b61084b565b6102a261089b565b6077546102f0906001600160a01b031681565b6079546102f0906001600160a01b031681565b6102c861038e3660046116c0565b6108b0565b6102a2606b5481565b6102a260695481565b6076546102f0906001600160a01b031681565b6074546102f0906001600160a01b031681565b6102a260725481565b6102a2606a5481565b6102c861090f565b6102a2606c5481565b6073546102f0906001600160a01b031681565b6033546001600160a01b03166102f0565b6078546102f0906001600160a01b031681565b610315610923565b6102c861043b366004611755565b61094c565b6102a2606d5481565b61045c610457366004611755565b610a37565b604080519283526020830191909152016102ac565b6102c861047f3660046116c0565b610aa3565b6102a260665481565b6102c8610adc565b6102a260675481565b6102a26303bfc40081565b6065546103159060ff1681565b6102a26103e881565b6102c86104cd3660046116c0565b610b8e565b6102c8610bed565b6102a260685481565b6102c86104f1366004611755565b610c5e565b6102a260705481565b6102c861050d366004611755565b610cae565b6102a2610d15565b6102a2610e0b565b6102a2611511565b6102c86105383660046116c0565b61152a565b607a546102f0906001600160a01b031681565b6102a2606481565b6073546001600160a01b0316331461058b5760405162461bcd60e51b81526004016105829061176e565b60405180910390fd5b607480546001600160a01b0319166001600160a01b0392909216919091179055565b600054610100900460ff16158080156105cd5750600054600160ff909116105b806105e75750303b1580156105e7575060005460ff166001145b61064a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610582565b6000805460ff19166001179055801561066d576000805461ff0019166101001790555b6106756115a0565b607380546001600160a01b03191633179055601e606c556032606d556103de606655600260675561012c6068556064606955600a606a5560408051637e062a3560e11b815290516001600160a01b0387169163fc0c546a9160048281019260209291908290030181865afa1580156106f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107159190611790565b607680546001600160a01b03199081166001600160a01b039384169081179092556077805482168a8516179055607880548216898516179055607980548216888516179055607a80549091168684161790556040516361347cdd60e11b815291841660048301529063c268f9ba90602401600060405180830381600087803b1580156107a057600080fd5b505af11580156107b4573d6000803e3d6000fd5b50506a01a784379d99db42000000606f5550506065805460ff19166001179055801561081a576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b60006103e8606754610832610d15565b61083c91906117c3565b61084691906117e2565b905090565b6073546001600160a01b031633146108755760405162461bcd60e51b81526004016105829061176e565b60328111156108965760405162461bcd60e51b815260040161058290611804565b606c55565b60006103e8606654606f5461083c91906117c3565b6001600160a01b0381166108c357600080fd5b6073546001600160a01b031633146108ed5760405162461bcd60e51b81526004016105829061176e565b607780546001600160a01b0319166001600160a01b0392909216919091179055565b6109176115cf565b6109216000611629565b565b6070546000906109356107088261182b565b4210158015610946575060715460ff165b91505090565b6075546001600160a01b031633146109995760405162461bcd60e51b815260206004820152601060248201526f21726566657272616c4164647265737360801b6044820152606401610582565b80606e60008282546109ab919061182b565b90915550506076546040516323b872dd60e01b8152336004820152306024820152604481018390526001600160a01b03909116906323b872dd906064016020604051808303816000875af1158015610a07573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a2b9190611843565b610a3457600080fd5b50565b600080607254600003610a4f57506000928392509050565b606b546000819003610a645750606954610a7e565b606854811015610a7e57606a54610a7b908261182b565b90505b60006103e8610a8d83876117c3565b610a9791906117e2565b91959194509092505050565b6073546001600160a01b03163314610aba57600080fd5b607980546001600160a01b0319166001600160a01b0392909216919091179055565b610ae46115cf565b60715460ff1615610b295760405162461bcd60e51b815260206004820152600f60248201526e105b1c9958591e481cdd185c9d1959608a1b6044820152606401610582565b610708610b3681426117e2565b610b4091906117c3565b60708190556071805460ff191660011790556040517ff9f27cb0d471614697655d6ae068b7d5bf89e1532a5c259d7f9c5387d6dcf9e891610b849190815260200190565b60405180910390a1565b6001600160a01b038116610ba157600080fd5b6073546001600160a01b03163314610bcb5760405162461bcd60e51b81526004016105829061176e565b607580546001600160a01b0319166001600160a01b0392909216919091179055565b6074546001600160a01b03163314610c3a5760405162461bcd60e51b815260206004820152601060248201526f6e6f742070656e64696e67207465616d60801b6044820152606401610582565b607454607380546001600160a01b0319166001600160a01b03909216919091179055565b6073546001600160a01b03163314610c885760405162461bcd60e51b81526004016105829061176e565b6064811115610ca95760405162461bcd60e51b815260040161058290611804565b606d55565b6073546001600160a01b03163314610cd85760405162461bcd60e51b81526004016105829061176e565b6064610ce76103e860966117c3565b610cf191906117e2565b811115610d105760405162461bcd60e51b815260040161058290611804565b606655565b6076546078546040516370a0823160e01b81526001600160a01b03918216600482015260009291909116906370a0823190602401602060405180830381865afa158015610d66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d8a9190611865565b607660009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ddd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e019190611865565b610846919061187e565b607054600090610e1d6107088261182b565b4210158015610e2e575060715460ff165b1561150c57610708610e4081426117e2565b610e4a91906117c3565b607081905560655490915060ff16610e6c57610e6461089b565b606f55610e77565b6065805460ff191690555b6000610e84606f54610a37565b606b91909155606c54606f549192506000916103e891610ea3916117c3565b610ead91906117e2565b905060006103e8606d54606f54610ec491906117c3565b610ece91906117e2565b90506000606e54606f54610ee2919061182b565b90506000828486606e54606f54610ef9919061182b565b610f03919061187e565b610f0d919061187e565b610f17919061187e565b6000606e8190556076546040516370a0823160e01b815230600482015292935090916001600160a01b03909116906370a0823190602401602060405180830381865afa158015610f6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f8f9190611865565b905082811015611026576076546001600160a01b03166340c10f1930610fb5848761187e565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015611000573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110249190611843565b505b600c607254101561111657607a5460405163d34395fb60e01b8152600481018790526001600160a01b039091169063d34395fb90602401600060405180830381600087803b15801561107757600080fd5b505af115801561108b573d6000803e3d6000fd5b5050607654607a5460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018a90529116925063a9059cbb91506044016020604051808303816000875af11580156110e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111089190611843565b61111157600080fd5b611198565b60765460735460405163a9059cbb60e01b81526001600160a01b0391821660048201526024810188905291169063a9059cbb906044016020604051808303816000875af115801561116b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061118f9190611843565b61119857600080fd5b6075546001600160a01b03161561122b5760765460755460405163a9059cbb60e01b81526001600160a01b0391821660048201526024810187905291169063a9059cbb906044016020604051808303816000875af11580156111fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112229190611843565b61122b57600080fd5b60765460795460405163a9059cbb60e01b81526001600160a01b0391821660048201526024810189905291169063a9059cbb906044016020604051808303816000875af1158015611280573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112a49190611843565b6112ad57600080fd5b607960009054906101000a90046001600160a01b03166001600160a01b031663811a40fe6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156112fd57600080fd5b505af1158015611311573d6000803e3d6000fd5b50505050607960009054906101000a90046001600160a01b03166001600160a01b031663b21ed5026040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561136557600080fd5b505af1158015611379573d6000803e3d6000fd5b505060765460775460405163095ea7b360e01b81526001600160a01b039182166004820152602481018790529116925063095ea7b391506044016020604051808303816000875af11580156113d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113f69190611843565b6113ff57600080fd5b607754604051633c6b16ab60e01b8152600481018490526001600160a01b0390911690633c6b16ab90602401600060405180830381600087803b15801561144557600080fd5b505af1158015611459573d6000803e3d6000fd5b505050507ff9f27cb0d471614697655d6ae068b7d5bf89e1532a5c259d7f9c5387d6dcf9e88760405161148e91815260200190565b60405180910390a1336001600160a01b03167fb4c03061fb5b7fed76389d5af8f2e0ddb09f8c70d1333abbb62582835e10accb606f546114cc610d15565b6114d4610822565b6040805193845260208401929092529082015260600160405180910390a260726000815461150190611895565b909155505050505050505b919050565b600061070861152081426117e2565b61084691906117c3565b6115326115cf565b6001600160a01b0381166115975760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610582565b610a3481611629565b600054610100900460ff166115c75760405162461bcd60e51b8152600401610582906118ae565b61092161167b565b6033546001600160a01b031633146109215760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610582565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166116a25760405162461bcd60e51b8152600401610582906118ae565b61092133611629565b6001600160a01b0381168114610a3457600080fd5b6000602082840312156116d257600080fd5b81356116dd816116ab565b9392505050565b600080600080600060a086880312156116fc57600080fd5b8535611707816116ab565b94506020860135611717816116ab565b93506040860135611727816116ab565b92506060860135611737816116ab565b91506080860135611747816116ab565b809150509295509295909350565b60006020828403121561176757600080fd5b5035919050565b6020808252600890820152676e6f74207465616d60c01b604082015260600190565b6000602082840312156117a257600080fd5b81516116dd816116ab565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156117dd576117dd6117ad565b500290565b6000826117ff57634e487b7160e01b600052601260045260246000fd5b500490565b6020808252600d908201526c0e4c2e8ca40e8dede40d0d2ced609b1b604082015260600190565b6000821982111561183e5761183e6117ad565b500190565b60006020828403121561185557600080fd5b815180151581146116dd57600080fd5b60006020828403121561187757600080fd5b5051919050565b600082821015611890576118906117ad565b500390565b6000600182016118a7576118a76117ad565b5060010190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fea2646970667358221220cec1e6365ef614f4e23f7e60967ce1f15328de1fed964a35dcde02e80cc1cf1764736f6c634300080d0033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102955760003560e01c80638dd598fb11610167578063b3caba5a116100ce578063e038c75a11610087578063e038c75a14610512578063ed29fc111461051a578063ef78d4fd14610522578063f2fde38b1461052a578063fb1db2781461053d578063fff09d381461055057600080fd5b8063b3caba5a146104bf578063b5cc143a146104d2578063b9edd5ff146104da578063ca4863fd146104e3578063d1399608146104f6578063ddce102f146104ff57600080fd5b8063a18cb95611610120578063a18cb95614610484578063a2c8b1771461048d578063a2e23a5114610495578063a4f0d7d01461049e578063a9abf7ec146104a9578063aaf5eb68146104b657600080fd5b80638dd598fb14610412578063919840ad146104255780639c809ff71461042d578063a053ce1f14610440578063a129cfbf14610449578063a1809b951461047157600080fd5b80634b1cd5da1161020b5780635ef5cc4a116101c45780635ef5cc4a146103cb5780635f8a325d146103d4578063715018a6146103dd57806378ef7f02146103e557806385f2aef2146103ee5780638da5cb5b1461040157600080fd5b80634b1cd5da1461036d5780634bc2a657146103805780634e5242061461039357806350b9e2c61461039c578063548dd3fe146103a557806359d46ffc146103b857600080fd5b80631eebae801161025d5780631eebae8014610325578063260edaaa1461032d57806326cfc17b146103365780632e8f7b1f1461033f57806336d96faf146103525780633db9b42a1461035a57600080fd5b806301c8e6fd1461029a578063095cf5c6146102b55780631459457a146102ca57806315a88d22146102dd5780631e6ff7b114610308575b600080fd5b6102a2603281565b6040519081526020015b60405180910390f35b6102c86102c33660046116c0565b610558565b005b6102c86102d83660046116e4565b6105ad565b6075546102f0906001600160a01b031681565b6040516001600160a01b0390911681526020016102ac565b6071546103159060ff1681565b60405190151581526020016102ac565b6102a2610822565b6102a2606e5481565b6102a2606f5481565b6102c861034d366004611755565b61084b565b6102a261089b565b6077546102f0906001600160a01b031681565b6079546102f0906001600160a01b031681565b6102c861038e3660046116c0565b6108b0565b6102a2606b5481565b6102a260695481565b6076546102f0906001600160a01b031681565b6074546102f0906001600160a01b031681565b6102a260725481565b6102a2606a5481565b6102c861090f565b6102a2606c5481565b6073546102f0906001600160a01b031681565b6033546001600160a01b03166102f0565b6078546102f0906001600160a01b031681565b610315610923565b6102c861043b366004611755565b61094c565b6102a2606d5481565b61045c610457366004611755565b610a37565b604080519283526020830191909152016102ac565b6102c861047f3660046116c0565b610aa3565b6102a260665481565b6102c8610adc565b6102a260675481565b6102a26303bfc40081565b6065546103159060ff1681565b6102a26103e881565b6102c86104cd3660046116c0565b610b8e565b6102c8610bed565b6102a260685481565b6102c86104f1366004611755565b610c5e565b6102a260705481565b6102c861050d366004611755565b610cae565b6102a2610d15565b6102a2610e0b565b6102a2611511565b6102c86105383660046116c0565b61152a565b607a546102f0906001600160a01b031681565b6102a2606481565b6073546001600160a01b0316331461058b5760405162461bcd60e51b81526004016105829061176e565b60405180910390fd5b607480546001600160a01b0319166001600160a01b0392909216919091179055565b600054610100900460ff16158080156105cd5750600054600160ff909116105b806105e75750303b1580156105e7575060005460ff166001145b61064a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610582565b6000805460ff19166001179055801561066d576000805461ff0019166101001790555b6106756115a0565b607380546001600160a01b03191633179055601e606c556032606d556103de606655600260675561012c6068556064606955600a606a5560408051637e062a3560e11b815290516001600160a01b0387169163fc0c546a9160048281019260209291908290030181865afa1580156106f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107159190611790565b607680546001600160a01b03199081166001600160a01b039384169081179092556077805482168a8516179055607880548216898516179055607980548216888516179055607a80549091168684161790556040516361347cdd60e11b815291841660048301529063c268f9ba90602401600060405180830381600087803b1580156107a057600080fd5b505af11580156107b4573d6000803e3d6000fd5b50506a01a784379d99db42000000606f5550506065805460ff19166001179055801561081a576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b60006103e8606754610832610d15565b61083c91906117c3565b61084691906117e2565b905090565b6073546001600160a01b031633146108755760405162461bcd60e51b81526004016105829061176e565b60328111156108965760405162461bcd60e51b815260040161058290611804565b606c55565b60006103e8606654606f5461083c91906117c3565b6001600160a01b0381166108c357600080fd5b6073546001600160a01b031633146108ed5760405162461bcd60e51b81526004016105829061176e565b607780546001600160a01b0319166001600160a01b0392909216919091179055565b6109176115cf565b6109216000611629565b565b6070546000906109356107088261182b565b4210158015610946575060715460ff165b91505090565b6075546001600160a01b031633146109995760405162461bcd60e51b815260206004820152601060248201526f21726566657272616c4164647265737360801b6044820152606401610582565b80606e60008282546109ab919061182b565b90915550506076546040516323b872dd60e01b8152336004820152306024820152604481018390526001600160a01b03909116906323b872dd906064016020604051808303816000875af1158015610a07573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a2b9190611843565b610a3457600080fd5b50565b600080607254600003610a4f57506000928392509050565b606b546000819003610a645750606954610a7e565b606854811015610a7e57606a54610a7b908261182b565b90505b60006103e8610a8d83876117c3565b610a9791906117e2565b91959194509092505050565b6073546001600160a01b03163314610aba57600080fd5b607980546001600160a01b0319166001600160a01b0392909216919091179055565b610ae46115cf565b60715460ff1615610b295760405162461bcd60e51b815260206004820152600f60248201526e105b1c9958591e481cdd185c9d1959608a1b6044820152606401610582565b610708610b3681426117e2565b610b4091906117c3565b60708190556071805460ff191660011790556040517ff9f27cb0d471614697655d6ae068b7d5bf89e1532a5c259d7f9c5387d6dcf9e891610b849190815260200190565b60405180910390a1565b6001600160a01b038116610ba157600080fd5b6073546001600160a01b03163314610bcb5760405162461bcd60e51b81526004016105829061176e565b607580546001600160a01b0319166001600160a01b0392909216919091179055565b6074546001600160a01b03163314610c3a5760405162461bcd60e51b815260206004820152601060248201526f6e6f742070656e64696e67207465616d60801b6044820152606401610582565b607454607380546001600160a01b0319166001600160a01b03909216919091179055565b6073546001600160a01b03163314610c885760405162461bcd60e51b81526004016105829061176e565b6064811115610ca95760405162461bcd60e51b815260040161058290611804565b606d55565b6073546001600160a01b03163314610cd85760405162461bcd60e51b81526004016105829061176e565b6064610ce76103e860966117c3565b610cf191906117e2565b811115610d105760405162461bcd60e51b815260040161058290611804565b606655565b6076546078546040516370a0823160e01b81526001600160a01b03918216600482015260009291909116906370a0823190602401602060405180830381865afa158015610d66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d8a9190611865565b607660009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ddd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e019190611865565b610846919061187e565b607054600090610e1d6107088261182b565b4210158015610e2e575060715460ff165b1561150c57610708610e4081426117e2565b610e4a91906117c3565b607081905560655490915060ff16610e6c57610e6461089b565b606f55610e77565b6065805460ff191690555b6000610e84606f54610a37565b606b91909155606c54606f549192506000916103e891610ea3916117c3565b610ead91906117e2565b905060006103e8606d54606f54610ec491906117c3565b610ece91906117e2565b90506000606e54606f54610ee2919061182b565b90506000828486606e54606f54610ef9919061182b565b610f03919061187e565b610f0d919061187e565b610f17919061187e565b6000606e8190556076546040516370a0823160e01b815230600482015292935090916001600160a01b03909116906370a0823190602401602060405180830381865afa158015610f6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f8f9190611865565b905082811015611026576076546001600160a01b03166340c10f1930610fb5848761187e565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015611000573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110249190611843565b505b600c607254101561111657607a5460405163d34395fb60e01b8152600481018790526001600160a01b039091169063d34395fb90602401600060405180830381600087803b15801561107757600080fd5b505af115801561108b573d6000803e3d6000fd5b5050607654607a5460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018a90529116925063a9059cbb91506044016020604051808303816000875af11580156110e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111089190611843565b61111157600080fd5b611198565b60765460735460405163a9059cbb60e01b81526001600160a01b0391821660048201526024810188905291169063a9059cbb906044016020604051808303816000875af115801561116b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061118f9190611843565b61119857600080fd5b6075546001600160a01b03161561122b5760765460755460405163a9059cbb60e01b81526001600160a01b0391821660048201526024810187905291169063a9059cbb906044016020604051808303816000875af11580156111fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112229190611843565b61122b57600080fd5b60765460795460405163a9059cbb60e01b81526001600160a01b0391821660048201526024810189905291169063a9059cbb906044016020604051808303816000875af1158015611280573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112a49190611843565b6112ad57600080fd5b607960009054906101000a90046001600160a01b03166001600160a01b031663811a40fe6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156112fd57600080fd5b505af1158015611311573d6000803e3d6000fd5b50505050607960009054906101000a90046001600160a01b03166001600160a01b031663b21ed5026040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561136557600080fd5b505af1158015611379573d6000803e3d6000fd5b505060765460775460405163095ea7b360e01b81526001600160a01b039182166004820152602481018790529116925063095ea7b391506044016020604051808303816000875af11580156113d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113f69190611843565b6113ff57600080fd5b607754604051633c6b16ab60e01b8152600481018490526001600160a01b0390911690633c6b16ab90602401600060405180830381600087803b15801561144557600080fd5b505af1158015611459573d6000803e3d6000fd5b505050507ff9f27cb0d471614697655d6ae068b7d5bf89e1532a5c259d7f9c5387d6dcf9e88760405161148e91815260200190565b60405180910390a1336001600160a01b03167fb4c03061fb5b7fed76389d5af8f2e0ddb09f8c70d1333abbb62582835e10accb606f546114cc610d15565b6114d4610822565b6040805193845260208401929092529082015260600160405180910390a260726000815461150190611895565b909155505050505050505b919050565b600061070861152081426117e2565b61084691906117c3565b6115326115cf565b6001600160a01b0381166115975760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610582565b610a3481611629565b600054610100900460ff166115c75760405162461bcd60e51b8152600401610582906118ae565b61092161167b565b6033546001600160a01b031633146109215760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610582565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166116a25760405162461bcd60e51b8152600401610582906118ae565b61092133611629565b6001600160a01b0381168114610a3457600080fd5b6000602082840312156116d257600080fd5b81356116dd816116ab565b9392505050565b600080600080600060a086880312156116fc57600080fd5b8535611707816116ab565b94506020860135611717816116ab565b93506040860135611727816116ab565b92506060860135611737816116ab565b91506080860135611747816116ab565b809150509295509295909350565b60006020828403121561176757600080fd5b5035919050565b6020808252600890820152676e6f74207465616d60c01b604082015260600190565b6000602082840312156117a257600080fd5b81516116dd816116ab565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156117dd576117dd6117ad565b500290565b6000826117ff57634e487b7160e01b600052601260045260246000fd5b500490565b6020808252600d908201526c0e4c2e8ca40e8dede40d0d2ced609b1b604082015260600190565b6000821982111561183e5761183e6117ad565b500190565b60006020828403121561185557600080fd5b815180151581146116dd57600080fd5b60006020828403121561187757600080fd5b5051919050565b600082821015611890576118906117ad565b500390565b6000600182016118a7576118a76117ad565b5060010190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fea2646970667358221220cec1e6365ef614f4e23f7e60967ce1f15328de1fed964a35dcde02e80cc1cf1764736f6c634300080d0033

Block Transaction Gas Used Reward
view all blocks produced

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

Validator Index Block Amount
View All Withdrawals

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

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