Sonic Blaze Testnet

Contract

0x00105dB9Dc8c03837D25B57a2f3B7A8d936622Ce

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 1 internal transaction

Parent Transaction Hash Block From To
31700662024-12-11 12:37:1210 days ago1733920632
0x00105dB9...d936622Ce
0 S
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
PairAPI

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 15 : PairAPI.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;


import '../libraries/Math.sol';
import '../libraries/Constants.sol';
import '../interfaces/IBribeAPI.sol';
import '../interfaces/IGaugeAPI.sol';
import '../interfaces/IGaugeFactory.sol';
import '../interfaces/IERC20.sol';
import '../interfaces/IMinter.sol';
import '../interfaces/IPair.sol';
import '../interfaces/IPairInfo.sol';
import '../interfaces/IPairFactory.sol';
import '../interfaces/IVoter.sol';
import '../interfaces/IVotingEscrow.sol';


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


interface IHypervisor{
    function pool() external view returns(address);
    function getTotalAmounts() external view returns(uint tot0,uint tot1);
}

interface IAlgebraFactory{
    function poolByPair(address, address) external view returns(address);
}

contract PairAPI is Initializable {


    struct PairInfo {
        // pair info
        address pair_address; 			// pair contract address
        uint decimals; 			        // pair decimals
        PoolType pooltype; 				// pair pool type
        uint total_supply; 			    // pair tokens supply

        // token pair info
        address token0; 				// pair 1st token address
        string token0_symbol; 			// pair 1st token symbol
        uint token0_decimals; 		    // pair 1st token decimals
        uint reserve0; 			        // pair 1st token reserves (nr. of tokens in the contract)

        address token1; 				// pair 2nd token address
        string token1_symbol;           // pair 2nd token symbol
        uint token1_decimals;    		// pair 2nd token decimals
        uint reserve1; 			        // pair 2nd token reserves (nr. of tokens in the contract)

        // pairs gauge
        address gauge; 				    // pair gauge address
        uint gauge_total_supply; 		// pair staked tokens (less/eq than/to pair total supply)
        address fee; 				    // pair fees contract address
        address bribe; 				    // pair bribes contract address
        uint emissions; 			    // pair emissions (per second)
        address emissions_token; 		// pair emissions token address
        uint emissions_token_decimals; 	// pair emissions token decimals

    }

    struct UserInfo {

        // User deposit

        address pair_address; 			// pair contract address
        uint claimable0;                // claimable 1st token from fees (for unstaked positions)
        uint claimable1; 			    // claimable 2nd token from fees (for unstaked positions)
        uint account_lp_balance; 		// account LP tokens balance
        uint account_gauge_balance;     // account pair staked in gauge balance
        uint account_gauge_earned; 		// account earned emissions for this pair
    }


    struct tokenBribe {
        address token;
        uint8 decimals;
        uint256 amount;
        string symbol;
    }


    struct pairBribeEpoch {
        uint256 epochTimestamp;
        uint256 totalVotes;
        address pair;
        tokenBribe[] bribes;
    }

    // stable/volatile classic x*y=k, CL = conc. liquidity algebra
    enum PoolType {STABLE, VOLATILE, CL}

    uint256 public constant MAX_PAIRS = 1000;
    uint256 public constant MAX_EPOCHS = 200;
    uint256 public constant MAX_REWARDS = 16;


    IPairFactory public pairFactory;
    IAlgebraFactory public algebraFactory;
    IVoter public voter;

    address public underlyingToken;

    address public owner;


    event Owner(address oldOwner, address newOwner);
    event Voter(address oldVoter, address newVoter);
    event WBF(address oldWBF, address newWBF);

    constructor() {}

    function initialize(address _voter, address _algebraFactory) initializer public {

        owner = msg.sender;

        voter = IVoter(_voter);

        pairFactory = IPairFactory(voter.factory());
        underlyingToken = IVotingEscrow(voter._ve()).token();

        algebraFactory = IAlgebraFactory(_algebraFactory);
    }


    // valid only for sAMM and vAMM
    function getAllPair(uint _amounts, uint _offset) external view returns(PairInfo[] memory Pairs){


        require(_amounts <= MAX_PAIRS, 'too many pair');

        Pairs = new PairInfo[](_amounts);

        uint i = _offset;
        uint totPairs = pairFactory.allPairsLength();
        address _pair;

        for(i; i < _offset + _amounts; i++){
            // if totalPairs is reached, break.
            if(i == totPairs) {
                break;
            }
            _pair = pairFactory.allPairs(i);
            Pairs[i - _offset] = _pairAddressToInfo(_pair);
        }
    }

    function getMultiplePair(address[] calldata pairs) external view returns(PairInfo[] memory Pairs){
        require(pairs.length <= MAX_PAIRS, 'too many pair');
        Pairs = new PairInfo[](pairs.length );
        address _pair;
        for(uint256 i = 0; i < pairs.length; i++){
            _pair = pairs[i];
            Pairs[i] = _pairAddressToInfo(_pair);
        }
    }


    function getPairAccount(address _pair, address _account) external view returns(UserInfo memory _UserInfo){
        return _pairAddressForAccount(_pair, _account);
    }

    // backward compatibility
    function getPair(address _pair, address /*account*/) external view returns(PairInfo memory _PairInfo){
        return _pairAddressToInfo(_pair);
    }

    function getPairSingle(address _pair) external view returns(PairInfo memory _PairInfo){
        return _pairAddressToInfo(_pair);
    }

    function _pairAddressForAccount(address _pair, address _account) internal view returns(UserInfo memory _UserInfo) {

        IPair ipair = IPair(_pair);

        IGaugeAPI _gauge = IGaugeAPI(voter.gauges(_pair));
        uint accountGaugeLPAmount = 0;
        uint earned = 0;

        if(address(_gauge) != address(0)){
            if(_account != address(0)){
                accountGaugeLPAmount = _gauge.balanceOf(_account);
                earned = _gauge.earned(_account);
            } else {
                accountGaugeLPAmount = 0;
                earned = 0;
            }
        }

        // checkout is v2 or v3? if v3 then load algebra pool
        bool _type = IPairFactory(pairFactory).isPair(_pair);

        // Account Info
        _UserInfo.pair_address = _pair;
        _UserInfo.claimable0 = _type == false ? 0 : ipair.claimable0(_account);
        _UserInfo.claimable1 = _type == false ? 0 : ipair.claimable1(_account);
        _UserInfo.account_lp_balance = IERC20(_pair).balanceOf(_account);
        _UserInfo.account_gauge_balance = accountGaugeLPAmount;
        _UserInfo.account_gauge_earned = earned;

    }

    function _pairAddressToInfo(address _pair) internal view returns(PairInfo memory _PairInfo) {

        IPair ipair = IPair(_pair);
        address token_0 = ipair.token0();
        address token_1 = ipair.token1();
        uint r0;
        uint r1;

        // checkout is v2 or v3? if v3 then load algebra pool
        bool _type = IPairFactory(pairFactory).isPair(_pair);
        PoolType _pooltype;

        if(_type == false){
            // hypervisor totalAmounts = algebra.pool + gamma.unused
            (r0,r1) = IHypervisor(_pair).getTotalAmounts();
            _pooltype = PoolType(2);
        } else {
            (r0,r1,) = ipair.getReserves();
            _pooltype = ipair.isStable() == true ? PoolType(0) : PoolType(1);
        }

        IGaugeAPI _gauge = IGaugeAPI(voter.gauges(_pair));
        uint gaugeTotalSupply = 0;
        uint emissions = 0;


        if(address(_gauge) != address(0)){
            gaugeTotalSupply = _gauge.totalSupply();
            emissions = _gauge.rewardRate();
        }


        // Pair General Info
        _PairInfo.pair_address = _pair;
        _PairInfo.decimals = ipair.decimals();
        _PairInfo.pooltype = _pooltype;
        _PairInfo.total_supply = ipair.totalSupply();

        // Token0 Info
        _PairInfo.token0 = token_0;
        _PairInfo.token0_decimals = IERC20(token_0).decimals();
        _PairInfo.token0_symbol = IERC20(token_0).symbol();
        _PairInfo.reserve0 = r0;

        // Token1 Info
        _PairInfo.token1 = token_1;
        _PairInfo.token1_decimals = IERC20(token_1).decimals();
        _PairInfo.token1_symbol = IERC20(token_1).symbol();
        _PairInfo.reserve1 = r1;

        // Pair's gauge Info
        _PairInfo.gauge = address(_gauge);
        _PairInfo.gauge_total_supply = gaugeTotalSupply;
        _PairInfo.emissions = emissions;
        _PairInfo.emissions_token = underlyingToken;
        _PairInfo.emissions_token_decimals = IERC20(underlyingToken).decimals();

        // external address
        _PairInfo.fee = voter.internal_bribes(address(_gauge));
        _PairInfo.bribe = voter.external_bribes(address(_gauge));


    }

    function getPairBribe(uint _amounts, uint _offset, address _pair) external view returns(pairBribeEpoch[] memory _pairEpoch){

        require(_amounts <= MAX_EPOCHS, 'too many epochs');

        _pairEpoch = new pairBribeEpoch[](_amounts);

        address _gauge = voter.gauges(_pair);
        if(_gauge == address(0)) return _pairEpoch;

        IBribeAPI bribe  = IBribeAPI(voter.external_bribes(_gauge));

        // check bribe and checkpoints exists
        if(address(0) == address(bribe)) return _pairEpoch;


        // scan bribes
        // get latest balance and epoch start for bribes
        uint _epochStartTimestamp = bribe.firstBribeTimestamp();

        // if 0 then no bribe created so far
        if(_epochStartTimestamp == 0){
            return _pairEpoch;
        }

        uint _supply;
        uint i = _offset;

        for(i; i < _offset + _amounts; i++){

            _supply            = bribe.totalSupplyAt(_epochStartTimestamp);
            _pairEpoch[i-_offset].epochTimestamp = _epochStartTimestamp;
            _pairEpoch[i-_offset].pair = _pair;
            _pairEpoch[i-_offset].totalVotes = _supply;
            _pairEpoch[i-_offset].bribes = _bribe(_epochStartTimestamp, address(bribe));

            _epochStartTimestamp += Constants.EPOCH_LENGTH;

        }

    }

    function _bribe(uint _ts, address _br) internal view returns(tokenBribe[] memory _tb){

        IBribeAPI _wb = IBribeAPI(_br);
        uint tokenLen = _wb.rewardsListLength();

        _tb = new tokenBribe[](tokenLen);

        uint k;
        uint _rewPerEpoch;
        IERC20 _t;
        for(k = 0; k < tokenLen; k++){
            _t = IERC20(_wb.rewardTokens(k));
            IBribeAPI.Reward memory _reward = _wb.rewardData(address(_t), _ts);
            _rewPerEpoch = _reward.rewardsPerEpoch;
            if(_rewPerEpoch > 0){
                _tb[k].token = address(_t);
                _tb[k].symbol = _t.symbol();
                _tb[k].decimals = _t.decimals();
                _tb[k].amount = _rewPerEpoch;
            } else {
                _tb[k].token = address(_t);
                _tb[k].symbol = _t.symbol();
                _tb[k].decimals = _t.decimals();
                _tb[k].amount = 0;
            }
        }
    }


    function setOwner(address _owner) external {
        require(msg.sender == owner, 'not owner');
        require(_owner != address(0), 'zeroAddr');
        owner = _owner;
        emit Owner(msg.sender, _owner);
    }


    function setVoter(address _voter) external {
        require(msg.sender == owner, 'not owner');
        require(_voter != address(0), 'zeroAddr');
        address _oldVoter = address(voter);
        voter = IVoter(_voter);

        // update variable depending on voter
        pairFactory = IPairFactory(voter.factory());
        underlyingToken = IVotingEscrow(voter._ve()).token();

        emit Voter(_oldVoter, _voter);
    }

    function left(address _pair, address _token) external view returns(uint256 _rewPerEpoch){
        address _gauge = voter.gauges(_pair);
        IBribeAPI bribe  = IBribeAPI(voter.internal_bribes(_gauge));

        uint256 _ts = bribe.getEpochStart();
        IBribeAPI.Reward memory _reward = bribe.rewardData(_token, _ts);
        _rewPerEpoch = _reward.rewardsPerEpoch;

    }


}

File 2 of 15 : 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 3 of 15 : 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 4 of 15 : IBribeAPI.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

interface IBribeAPI {

    struct Reward {
        uint256 periodFinish;
        uint256 rewardsPerEpoch;
        uint256 lastUpdateTime; 
    }
    function rewardData(address _token, uint256 ts) external view returns(Reward memory _Reward);
    function _deposit(uint amount, uint tokenId) external;
    function _withdraw(uint amount, uint tokenId) external;
    function getRewardForOwner(uint tokenId, address[] memory tokens) external;
    function notifyRewardAmount(address token, uint amount) external;
    function left(address token) external view returns (uint);
    function rewardsListLength() external view returns (uint);
    function supplyNumCheckpoints() external view returns (uint);
    //function getEpochStart(uint timestamp) external pure returns (uint);
    function getEpochStart() external pure returns (uint);
    function getNextEpochStart() external pure returns (uint);
    function getPriorSupplyIndex(uint timestamp) external view returns (uint);
    function rewardTokens(uint index) external view returns (address);
    function rewardsPerEpoch(address token,uint ts) external view returns (uint);
    function supplyCheckpoints(uint _index) external view returns(uint timestamp, uint supplyd);
    function earned(uint tokenId, address token) external view returns (uint);
    function earned(address user, address token) external view returns (uint);
    function firstBribeTimestamp() external view returns(uint);
    function totalSupplyAt(uint256 _timestamp) external view returns (uint256);
    function balanceOfAt(uint256 tokenId, uint256 _timestamp) external view returns (uint256);
    function balanceOfOwnerAt(address _owner, uint256 _timestamp) external view returns (uint256);


}

File 5 of 15 : IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

interface IERC20 {
    function totalSupply() external view returns (uint256);
    function transfer(address recipient, uint amount) external returns (bool);
    function decimals() external view returns (uint8);
    function symbol() external view returns (string memory);
    function balanceOf(address) external view returns (uint);
    function transferFrom(address sender, address recipient, uint amount) external returns (bool);
    function allowance(address owner, address spender) external view returns (uint);
    function approve(address spender, uint value) external returns (bool);

    event Transfer(address indexed from, address indexed to, uint value);
    event Approval(address indexed owner, address indexed spender, uint value);
}

File 6 of 15 : IGaugeAPI.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

interface IGaugeAPI {
    function notifyRewardAmount(address token, uint amount) external;
    function getReward(address account, address[] memory tokens) external;
    function claimFees() external returns (uint claimed0, uint claimed1);
    function left(address token) external view returns (uint);
    function rewardRate() external view returns (uint);
    function balanceOf(address _account) external view returns (uint);
    function isForPair() external view returns (bool);
    function totalSupply() external view returns (uint);
    function earned(address account) external view returns (uint);
    
}

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

interface IGaugeFactory {
    function createGauge(address, address, address, address, bool, address[] memory) external returns (address);
    function createGaugeV2(address _rewardToken,address _ve,address _token,address _distribution, address _internal_bribe, address _external_bribe, bool _isPair) external returns (address) ;
}

File 8 of 15 : 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 9 of 15 : IPair.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

interface IPair {
    function metadata() external view returns (uint dec0, uint dec1, uint r0, uint r1, bool st, address t0, address t1);
    function claimFees() external returns (uint, uint);
    function tokens() external view returns (address, address);
    function token0() external view returns (address);
    function token1() external view returns (address);
    function transferFrom(address src, address dst, uint amount) external returns (bool);
    function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
    function burn(address to) external returns (uint amount0, uint amount1);
    function mint(address to) external returns (uint liquidity);
    function getReserves() external view returns (uint _reserve0, uint _reserve1, uint _blockTimestampLast);
    function getAmountOut(uint, address) external view returns (uint);

    function name() external view returns(string memory);
    function symbol() external view returns(string memory);
    function totalSupply() external view returns (uint);
    function decimals() external view returns (uint8);

    function claimable0(address _user) external view returns (uint);
    function claimable1(address _user) external view returns (uint);

    function isStable() external view returns(bool);


}

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

interface IPairFactory {
    function allPairsLength() external view returns (uint);
    function isPair(address pair) external view returns (bool);
    function allPairs(uint index) external view returns (address);
    function stakingFeeHandler() external view returns (address);
    function dibs() external view returns (address);
    function MAX_TREASURY_FEE() external view returns (uint256);
    function stakingNFTFee() external view returns (uint256);
    function isPaused() external view returns (bool);
    function pairCodeHash() external pure returns (bytes32);
    function getPair(address tokenA, address token, bool stable) external view returns (address);
    function createPair(address tokenA, address tokenB, bool stable) external returns (address pair);
    function getInitializable() external view returns (address, address, bool);
    function getFee(bool _stable) external view returns(uint256);
}

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

interface IPairInfo {

    function token0() external view returns(address);
    function reserve0() external view returns(uint);
    function decimals0() external view returns(uint);
    function token1() external view returns(address);
    function reserve1() external view returns(uint);
    function decimals1() external view returns(uint);
    function isPair(address _pair) external view returns(bool);
}

File 12 of 15 : 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 13 of 15 : 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 14 of 15 : Constants.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

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

File 15 of 15 : 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":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"Owner","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldVoter","type":"address"},{"indexed":false,"internalType":"address","name":"newVoter","type":"address"}],"name":"Voter","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldWBF","type":"address"},{"indexed":false,"internalType":"address","name":"newWBF","type":"address"}],"name":"WBF","type":"event"},{"inputs":[],"name":"MAX_EPOCHS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_PAIRS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_REWARDS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"algebraFactory","outputs":[{"internalType":"contract IAlgebraFactory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amounts","type":"uint256"},{"internalType":"uint256","name":"_offset","type":"uint256"}],"name":"getAllPair","outputs":[{"components":[{"internalType":"address","name":"pair_address","type":"address"},{"internalType":"uint256","name":"decimals","type":"uint256"},{"internalType":"enum PairAPI.PoolType","name":"pooltype","type":"uint8"},{"internalType":"uint256","name":"total_supply","type":"uint256"},{"internalType":"address","name":"token0","type":"address"},{"internalType":"string","name":"token0_symbol","type":"string"},{"internalType":"uint256","name":"token0_decimals","type":"uint256"},{"internalType":"uint256","name":"reserve0","type":"uint256"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"string","name":"token1_symbol","type":"string"},{"internalType":"uint256","name":"token1_decimals","type":"uint256"},{"internalType":"uint256","name":"reserve1","type":"uint256"},{"internalType":"address","name":"gauge","type":"address"},{"internalType":"uint256","name":"gauge_total_supply","type":"uint256"},{"internalType":"address","name":"fee","type":"address"},{"internalType":"address","name":"bribe","type":"address"},{"internalType":"uint256","name":"emissions","type":"uint256"},{"internalType":"address","name":"emissions_token","type":"address"},{"internalType":"uint256","name":"emissions_token_decimals","type":"uint256"}],"internalType":"struct PairAPI.PairInfo[]","name":"Pairs","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"pairs","type":"address[]"}],"name":"getMultiplePair","outputs":[{"components":[{"internalType":"address","name":"pair_address","type":"address"},{"internalType":"uint256","name":"decimals","type":"uint256"},{"internalType":"enum PairAPI.PoolType","name":"pooltype","type":"uint8"},{"internalType":"uint256","name":"total_supply","type":"uint256"},{"internalType":"address","name":"token0","type":"address"},{"internalType":"string","name":"token0_symbol","type":"string"},{"internalType":"uint256","name":"token0_decimals","type":"uint256"},{"internalType":"uint256","name":"reserve0","type":"uint256"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"string","name":"token1_symbol","type":"string"},{"internalType":"uint256","name":"token1_decimals","type":"uint256"},{"internalType":"uint256","name":"reserve1","type":"uint256"},{"internalType":"address","name":"gauge","type":"address"},{"internalType":"uint256","name":"gauge_total_supply","type":"uint256"},{"internalType":"address","name":"fee","type":"address"},{"internalType":"address","name":"bribe","type":"address"},{"internalType":"uint256","name":"emissions","type":"uint256"},{"internalType":"address","name":"emissions_token","type":"address"},{"internalType":"uint256","name":"emissions_token_decimals","type":"uint256"}],"internalType":"struct PairAPI.PairInfo[]","name":"Pairs","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_pair","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"getPair","outputs":[{"components":[{"internalType":"address","name":"pair_address","type":"address"},{"internalType":"uint256","name":"decimals","type":"uint256"},{"internalType":"enum PairAPI.PoolType","name":"pooltype","type":"uint8"},{"internalType":"uint256","name":"total_supply","type":"uint256"},{"internalType":"address","name":"token0","type":"address"},{"internalType":"string","name":"token0_symbol","type":"string"},{"internalType":"uint256","name":"token0_decimals","type":"uint256"},{"internalType":"uint256","name":"reserve0","type":"uint256"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"string","name":"token1_symbol","type":"string"},{"internalType":"uint256","name":"token1_decimals","type":"uint256"},{"internalType":"uint256","name":"reserve1","type":"uint256"},{"internalType":"address","name":"gauge","type":"address"},{"internalType":"uint256","name":"gauge_total_supply","type":"uint256"},{"internalType":"address","name":"fee","type":"address"},{"internalType":"address","name":"bribe","type":"address"},{"internalType":"uint256","name":"emissions","type":"uint256"},{"internalType":"address","name":"emissions_token","type":"address"},{"internalType":"uint256","name":"emissions_token_decimals","type":"uint256"}],"internalType":"struct PairAPI.PairInfo","name":"_PairInfo","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_pair","type":"address"},{"internalType":"address","name":"_account","type":"address"}],"name":"getPairAccount","outputs":[{"components":[{"internalType":"address","name":"pair_address","type":"address"},{"internalType":"uint256","name":"claimable0","type":"uint256"},{"internalType":"uint256","name":"claimable1","type":"uint256"},{"internalType":"uint256","name":"account_lp_balance","type":"uint256"},{"internalType":"uint256","name":"account_gauge_balance","type":"uint256"},{"internalType":"uint256","name":"account_gauge_earned","type":"uint256"}],"internalType":"struct PairAPI.UserInfo","name":"_UserInfo","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amounts","type":"uint256"},{"internalType":"uint256","name":"_offset","type":"uint256"},{"internalType":"address","name":"_pair","type":"address"}],"name":"getPairBribe","outputs":[{"components":[{"internalType":"uint256","name":"epochTimestamp","type":"uint256"},{"internalType":"uint256","name":"totalVotes","type":"uint256"},{"internalType":"address","name":"pair","type":"address"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"string","name":"symbol","type":"string"}],"internalType":"struct PairAPI.tokenBribe[]","name":"bribes","type":"tuple[]"}],"internalType":"struct PairAPI.pairBribeEpoch[]","name":"_pairEpoch","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_pair","type":"address"}],"name":"getPairSingle","outputs":[{"components":[{"internalType":"address","name":"pair_address","type":"address"},{"internalType":"uint256","name":"decimals","type":"uint256"},{"internalType":"enum PairAPI.PoolType","name":"pooltype","type":"uint8"},{"internalType":"uint256","name":"total_supply","type":"uint256"},{"internalType":"address","name":"token0","type":"address"},{"internalType":"string","name":"token0_symbol","type":"string"},{"internalType":"uint256","name":"token0_decimals","type":"uint256"},{"internalType":"uint256","name":"reserve0","type":"uint256"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"string","name":"token1_symbol","type":"string"},{"internalType":"uint256","name":"token1_decimals","type":"uint256"},{"internalType":"uint256","name":"reserve1","type":"uint256"},{"internalType":"address","name":"gauge","type":"address"},{"internalType":"uint256","name":"gauge_total_supply","type":"uint256"},{"internalType":"address","name":"fee","type":"address"},{"internalType":"address","name":"bribe","type":"address"},{"internalType":"uint256","name":"emissions","type":"uint256"},{"internalType":"address","name":"emissions_token","type":"address"},{"internalType":"uint256","name":"emissions_token_decimals","type":"uint256"}],"internalType":"struct PairAPI.PairInfo","name":"_PairInfo","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_voter","type":"address"},{"internalType":"address","name":"_algebraFactory","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_pair","type":"address"},{"internalType":"address","name":"_token","type":"address"}],"name":"left","outputs":[{"internalType":"uint256","name":"_rewPerEpoch","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pairFactory","outputs":[{"internalType":"contract IPairFactory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_voter","type":"address"}],"name":"setVoter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"underlyingToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"voter","outputs":[{"internalType":"contract IVoter","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b50612abe806100206000396000f3fe608060405234801561001057600080fd5b50600436106101165760003560e01c8063771133db116100a2578063a7b64b0411610071578063a7b64b04146102ac578063c8b72f8f146102bf578063e14f870d146102c7578063e6a43905146102e0578063fb5478b3146102f357600080fd5b8063771133db1461025d5780638da5cb5b14610270578063996cf233146102835780639b1aef701461028c57600080fd5b806346c96aac116100e957806346c96aac146101e3578063485cc955146101f65780634bc2a657146102095780636180c3f91461021c5780636ad948af1461023d57600080fd5b806313af40351461011b5780632495a599146101305780633e25316414610160578063404cba50146101c3575b600080fd5b61012e6101293660046123a7565b6102fb565b005b600354610143906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61017361016e3660046123c4565b6103e2565b604051610157919081516001600160a01b031681526020808301519082015260408083015190820152606080830151908201526080808301519082015260a0918201519181019190915260c00190565b6101d66101d13660046123fd565b6103fb565b6040516101579190612492565b600254610143906001600160a01b031681565b61012e6102043660046123c4565b6107b4565b61012e6102173660046123a7565b610a5d565b61022f61022a3660046123c4565b610cad565b604051908152602001610157565b61025061024b366004612597565b610e7f565b604051610157919061273e565b61025061026b3660046127a0565b611071565b600454610143906001600160a01b031681565b61022f6103e881565b61029f61029a3660046123a7565b611180565b6040516101579190612815565b600154610143906001600160a01b031681565b61022f60c881565b600054610143906201000090046001600160a01b031681565b61029f6102ee3660046123c4565b611197565b61022f601081565b6004546001600160a01b031633146103465760405162461bcd60e51b81526020600482015260096024820152683737ba1037bbb732b960b91b60448201526064015b60405180910390fd5b6001600160a01b0381166103875760405162461bcd60e51b81526020600482015260086024820152673d32b937a0b2323960c11b604482015260640161033d565b600480546001600160a01b0319166001600160a01b0383169081179091556040805133815260208101929092527fc53ee02035d465398c0648e0bca1462281006a266ec38c7192bce1c24e0b64a3910160405180910390a150565b6103ea612288565b6103f483836111a8565b9392505050565b606060c88411156104405760405162461bcd60e51b815260206004820152600f60248201526e746f6f206d616e792065706f63687360881b604482015260640161033d565b8367ffffffffffffffff81111561045957610459612828565b6040519080825280602002602001820160405280156104be57816020015b6104ab6040518060800160405280600081526020016000815260200160006001600160a01b03168152602001606081525090565b8152602001906001900390816104775790505b5060025460405163b9a09fd560e01b81526001600160a01b0385811660048301529293506000929091169063b9a09fd590602401602060405180830381865afa15801561050f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610533919061283e565b90506001600160a01b03811661054957506103f4565b60025460405163ae21c4cb60e01b81526001600160a01b038381166004830152600092169063ae21c4cb90602401602060405180830381865afa158015610594573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b8919061283e565b90506001600160a01b0381166000036105d25750506103f4565b6000816001600160a01b03166355288eea6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610612573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610636919061285b565b905080600003610648575050506103f4565b6000865b610656898961288a565b8110156107a857604051630981b24d60e41b8152600481018490526001600160a01b0385169063981b24d090602401602060405180830381865afa1580156106a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c6919061285b565b915082866106d48a846128a2565b815181106106e4576106e46128b9565b60209081029190910101515286866106fc8a846128a2565b8151811061070c5761070c6128b9565b60209081029190910101516001600160a01b0390911660409091015281866107348a846128a2565b81518110610744576107446128b9565b6020026020010151602001818152505061075e838561152f565b866107698a846128a2565b81518110610779576107796128b9565b6020908102919091010151606001526107946107088461288a565b9250806107a0816128cf565b91505061064c565b50505050509392505050565b600054610100900460ff16158080156107d45750600054600160ff909116105b806107ee5750303b1580156107ee575060005460ff166001145b6108515760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161033d565b6000805460ff191660011790558015610874576000805461ff0019166101001790555b600480546001600160a01b031990811633178255600280546001600160a01b0387169216821790556040805163c45a015560e01b81529051919263c45a01559282820192602092908290030181865afa1580156108d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108f9919061283e565b6000805462010000600160b01b031916620100006001600160a01b039384160217905560025460408051638dd598fb60e01b815290519190921691638dd598fb9160048083019260209291908290030181865afa15801561095e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610982919061283e565b6001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e3919061283e565b600380546001600160a01b03199081166001600160a01b0393841617909155600180549091169184169190911790558015610a58576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b6004546001600160a01b03163314610aa35760405162461bcd60e51b81526020600482015260096024820152683737ba1037bbb732b960b91b604482015260640161033d565b6001600160a01b038116610ae45760405162461bcd60e51b81526020600482015260086024820152673d32b937a0b2323960c11b604482015260640161033d565b600280546001600160a01b038381166001600160a01b0319831681179093556040805163c45a015560e01b8152905191909216929163c45a01559160048083019260209291908290030181865afa158015610b43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b67919061283e565b6000805462010000600160b01b031916620100006001600160a01b039384160217905560025460408051638dd598fb60e01b815290519190921691638dd598fb9160048083019260209291908290030181865afa158015610bcc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf0919061283e565b6001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c51919061283e565b600380546001600160a01b0319166001600160a01b0392831617905560408051838316815291841660208301527f710c23d7ab8af94af228e05f80f3472774722958ef63a866cdb227de1b2a8f2c910160405180910390a15050565b60025460405163b9a09fd560e01b81526001600160a01b038481166004830152600092839291169063b9a09fd590602401602060405180830381865afa158015610cfb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1f919061283e565b600254604051637572079360e11b81526001600160a01b0380841660048301529293506000929091169063eae40f2690602401602060405180830381865afa158015610d6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d93919061283e565b90506000816001600160a01b031663a4a3e0356040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dd5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df9919061285b565b604051631c0ba43160e11b81526001600160a01b03878116600483015260248201839052919250600091841690633817486290604401606060405180830381865afa158015610e4c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7091906128e8565b60200151979650505050505050565b60606103e8831115610ec35760405162461bcd60e51b815260206004820152600d60248201526c3a37b79036b0b73c903830b4b960991b604482015260640161033d565b8267ffffffffffffffff811115610edc57610edc612828565b604051908082528060200260200182016040528015610f1557816020015b610f026122c7565b815260200190600190039081610efa5790505b509050600082905060008060029054906101000a90046001600160a01b03166001600160a01b031663574f2ba36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f95919061285b565b905060005b610fa4868661288a565b8310156110685782821461106857600054604051631e3dd18b60e01b815260048101859052620100009091046001600160a01b031690631e3dd18b90602401602060405180830381865afa158015611000573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611024919061283e565b905061102f81611a04565b8461103a87866128a2565b8151811061104a5761104a6128b9565b60200260200101819052508280611060906128cf565b935050610f9a565b50505092915050565b60606103e88211156110b55760405162461bcd60e51b815260206004820152600d60248201526c3a37b79036b0b73c903830b4b960991b604482015260640161033d565b8167ffffffffffffffff8111156110ce576110ce612828565b60405190808252806020026020018201604052801561110757816020015b6110f46122c7565b8152602001906001900390816110ec5790505b5090506000805b8381101561117857848482818110611128576111286128b9565b905060200201602081019061113d91906123a7565b915061114882611a04565b83828151811061115a5761115a6128b9565b60200260200101819052508080611170906128cf565b91505061110e565b505092915050565b6111886122c7565b61119182611a04565b92915050565b61119f6122c7565b6103f483611a04565b6111b0612288565b60025460405163b9a09fd560e01b81526001600160a01b038086166004830152859260009291169063b9a09fd590602401602060405180830381865afa1580156111fe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611222919061283e565b90506000806001600160a01b03831615611329576001600160a01b03861615611322576040516370a0823160e01b81526001600160a01b0387811660048301528416906370a0823190602401602060405180830381865afa15801561128b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112af919061285b565b6040516246613160e11b81526001600160a01b03888116600483015291935090841690628cc26290602401602060405180830381865afa1580156112f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061131b919061285b565b9050611329565b5060009050805b6000805460405163e5e31b1360e01b81526001600160a01b038a81166004830152620100009092049091169063e5e31b1390602401602060405180830381865afa15801561137b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061139f9190612944565b6001600160a01b038916875290508015611422576040516326ad4fc560e11b81526001600160a01b038881166004830152861690634d5a9f8a90602401602060405180830381865afa1580156113f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061141d919061285b565b611425565b60005b6020870152801561149f5760405163a1ac4d1360e01b81526001600160a01b03888116600483015286169063a1ac4d1390602401602060405180830381865afa158015611476573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061149a919061285b565b6114a2565b60005b604087810191909152516370a0823160e01b81526001600160a01b0388811660048301528916906370a0823190602401602060405180830381865afa1580156114ef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611513919061285b565b606087015250608085019190915260a084015250909392505050565b606060008290506000816001600160a01b031663e68863966040518163ffffffff1660e01b8152600401602060405180830381865afa158015611576573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061159a919061285b565b90508067ffffffffffffffff8111156115b5576115b5612828565b60405190808252806020026020018201604052801561160657816020015b60408051608081018252600080825260208083018290529282015260608082015282526000199092019101816115d35790505b509250600080805b838310156119f957604051637bb7bed160e01b8152600481018490526001600160a01b03861690637bb7bed190602401602060405180830381865afa15801561165b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061167f919061283e565b604051631c0ba43160e11b81526001600160a01b038083166004830152602482018b9052919250600091871690633817486290604401606060405180830381865afa1580156116d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116f691906128e8565b60208101519350905082156118775781878581518110611718576117186128b9565b6020026020010151600001906001600160a01b031690816001600160a01b031681525050816001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa15801561177a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526117a29190810190612966565b8785815181106117b4576117b46128b9565b602002602001015160600181905250816001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611801573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118259190612a13565b878581518110611837576118376128b9565b60200260200101516020019060ff16908160ff168152505082878581518110611862576118626128b9565b602002602001015160400181815250506119e6565b8187858151811061188a5761188a6128b9565b6020026020010151600001906001600160a01b031690816001600160a01b031681525050816001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa1580156118ec573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526119149190810190612966565b878581518110611926576119266128b9565b602002602001015160600181905250816001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611973573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119979190612a13565b8785815181106119a9576119a96128b9565b60200260200101516020019060ff16908160ff168152505060008785815181106119d5576119d56128b9565b602002602001015160400181815250505b50826119f1816128cf565b93505061160e565b505050505092915050565b611a0c6122c7565b60008290506000816001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a51573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a75919061283e565b90506000826001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611ab7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611adb919061283e565b6000805460405163e5e31b1360e01b81526001600160a01b0389811660048301529394509192839283926201000090049091169063e5e31b1390602401602060405180830381865afa158015611b35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b599190612944565b905060008115158103611bd557886001600160a01b031663c4a7761e6040518163ffffffff1660e01b81526004016040805180830381865afa158015611ba3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bc79190612a36565b909450925060029050611cb8565b866001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa158015611c13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c379190612a5a565b508094508195505050866001600160a01b03166309047bdd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611c7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ca29190612944565b1515600114611cb2576001611cb5565b60005b90505b60025460405163b9a09fd560e01b81526001600160a01b038b81166004830152600092169063b9a09fd590602401602060405180830381865afa158015611d03573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d27919061283e565b90506000806001600160a01b03831615611e0457826001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611d79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d9d919061285b565b9150826001600160a01b0316637b0a47ee6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611ddd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e01919061285b565b90505b6001600160a01b03808d168c526040805163313ce56760e01b81529051918c169163313ce567916004808201926020929091908290030181865afa158015611e50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e749190612a13565b60ff1660208c015260408b01846002811115611e9257611e926125b9565b90816002811115611ea557611ea56125b9565b81525050896001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611ee7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f0b919061285b565b60608c01526001600160a01b03891660808c018190526040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa158015611f5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f809190612a13565b60ff168b60c0018181525050886001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa158015611fca573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611ff29190810190612966565b60a08c015260e08b018790526001600160a01b0388166101008c018190526040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa15801561204b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061206f9190612a13565b60ff168b610140018181525050876001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa1580156120ba573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526120e29190810190612966565b6101208c01526101608b018690526001600160a01b038084166101808d01526101a08c018390526102008c01829052600354166102208c018190526040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa158015612158573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061217c9190612a13565b60ff166102408c0152600254604051637572079360e11b81526001600160a01b0385811660048301529091169063eae40f2690602401602060405180830381865afa1580156121cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121f3919061283e565b6001600160a01b039081166101c08d015260025460405163ae21c4cb60e01b8152858316600482015291169063ae21c4cb90602401602060405180830381865afa158015612245573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612269919061283e565b6001600160a01b03166101e08c015250989a9950505050505050505050565b6040518060c0016040528060006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001600081525090565b6040805161026081018252600080825260208201819052909182019081526020016000815260200160006001600160a01b0316815260200160608152602001600081526020016000815260200160006001600160a01b0316815260200160608152602001600081526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b0316815260200160006001600160a01b031681526020016000815260200160006001600160a01b03168152602001600081525090565b6001600160a01b03811681146123a457600080fd5b50565b6000602082840312156123b957600080fd5b81356103f48161238f565b600080604083850312156123d757600080fd5b82356123e28161238f565b915060208301356123f28161238f565b809150509250929050565b60008060006060848603121561241257600080fd5b8335925060208401359150604084013561242b8161238f565b809150509250925092565b60005b83811015612451578181015183820152602001612439565b83811115612460576000848401525b50505050565b6000815180845261247e816020860160208601612436565b601f01601f19169290920160200192915050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b8381101561258957603f198984030185528151805184528781015188850152868101516001600160a01b039081168886015260609182015160808387018190528151908701819052908a019260a0600583901b880181019391929088019060005b8181101561257057898603609f1901835286518051851687528e81015160ff168f8801528d8101518e880152850151608086880181905261255d90880182612466565b978f0197965050918d019160010161251a565b505050978a0197509094505050908601906001016124b9565b509098975050505050505050565b600080604083850312156125aa57600080fd5b50508035926020909101359150565b634e487b7160e01b600052602160045260246000fd5b600381106125ed57634e487b7160e01b600052602160045260246000fd5b9052565b80516001600160a01b03168252600061026060208301516020850152604083015161261f60408601826125cf565b5060608301516060850152608083015161264460808601826001600160a01b03169052565b5060a08301518160a086015261265c82860182612466565b91505060c083015160c085015260e083015160e08501526101008084015161268e828701826001600160a01b03169052565b505061012080840151858303828701526126a88382612466565b92505050610140808401518186015250610160808401518186015250610180808401516126df828701826001600160a01b03169052565b50506101a083810151908501526101c0808401516001600160a01b03908116918601919091526101e080850151821690860152610200808501519086015261022080850151909116908501526102409283015192909301919091525090565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561279357603f198886030184526127818583516125f1565b94509285019290850190600101612765565b5092979650505050505050565b600080602083850312156127b357600080fd5b823567ffffffffffffffff808211156127cb57600080fd5b818501915085601f8301126127df57600080fd5b8135818111156127ee57600080fd5b8660208260051b850101111561280357600080fd5b60209290920196919550909350505050565b6020815260006103f460208301846125f1565b634e487b7160e01b600052604160045260246000fd5b60006020828403121561285057600080fd5b81516103f48161238f565b60006020828403121561286d57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b6000821982111561289d5761289d612874565b500190565b6000828210156128b4576128b4612874565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600182016128e1576128e1612874565b5060010190565b6000606082840312156128fa57600080fd5b6040516060810181811067ffffffffffffffff8211171561291d5761291d612828565b80604052508251815260208301516020820152604083015160408201528091505092915050565b60006020828403121561295657600080fd5b815180151581146103f457600080fd5b60006020828403121561297857600080fd5b815167ffffffffffffffff8082111561299057600080fd5b818401915084601f8301126129a457600080fd5b8151818111156129b6576129b6612828565b604051601f8201601f19908116603f011681019083821181831017156129de576129de612828565b816040528281528760208487010111156129f757600080fd5b612a08836020830160208801612436565b979650505050505050565b600060208284031215612a2557600080fd5b815160ff811681146103f457600080fd5b60008060408385031215612a4957600080fd5b505080516020909101519092909150565b600080600060608486031215612a6f57600080fd5b835192506020840151915060408401519050925092509256fea2646970667358221220bd555569a23bed3bca955db84fcaaed9b04ed13456af7fbd4174a28bd9dc144d64736f6c634300080d0033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101165760003560e01c8063771133db116100a2578063a7b64b0411610071578063a7b64b04146102ac578063c8b72f8f146102bf578063e14f870d146102c7578063e6a43905146102e0578063fb5478b3146102f357600080fd5b8063771133db1461025d5780638da5cb5b14610270578063996cf233146102835780639b1aef701461028c57600080fd5b806346c96aac116100e957806346c96aac146101e3578063485cc955146101f65780634bc2a657146102095780636180c3f91461021c5780636ad948af1461023d57600080fd5b806313af40351461011b5780632495a599146101305780633e25316414610160578063404cba50146101c3575b600080fd5b61012e6101293660046123a7565b6102fb565b005b600354610143906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61017361016e3660046123c4565b6103e2565b604051610157919081516001600160a01b031681526020808301519082015260408083015190820152606080830151908201526080808301519082015260a0918201519181019190915260c00190565b6101d66101d13660046123fd565b6103fb565b6040516101579190612492565b600254610143906001600160a01b031681565b61012e6102043660046123c4565b6107b4565b61012e6102173660046123a7565b610a5d565b61022f61022a3660046123c4565b610cad565b604051908152602001610157565b61025061024b366004612597565b610e7f565b604051610157919061273e565b61025061026b3660046127a0565b611071565b600454610143906001600160a01b031681565b61022f6103e881565b61029f61029a3660046123a7565b611180565b6040516101579190612815565b600154610143906001600160a01b031681565b61022f60c881565b600054610143906201000090046001600160a01b031681565b61029f6102ee3660046123c4565b611197565b61022f601081565b6004546001600160a01b031633146103465760405162461bcd60e51b81526020600482015260096024820152683737ba1037bbb732b960b91b60448201526064015b60405180910390fd5b6001600160a01b0381166103875760405162461bcd60e51b81526020600482015260086024820152673d32b937a0b2323960c11b604482015260640161033d565b600480546001600160a01b0319166001600160a01b0383169081179091556040805133815260208101929092527fc53ee02035d465398c0648e0bca1462281006a266ec38c7192bce1c24e0b64a3910160405180910390a150565b6103ea612288565b6103f483836111a8565b9392505050565b606060c88411156104405760405162461bcd60e51b815260206004820152600f60248201526e746f6f206d616e792065706f63687360881b604482015260640161033d565b8367ffffffffffffffff81111561045957610459612828565b6040519080825280602002602001820160405280156104be57816020015b6104ab6040518060800160405280600081526020016000815260200160006001600160a01b03168152602001606081525090565b8152602001906001900390816104775790505b5060025460405163b9a09fd560e01b81526001600160a01b0385811660048301529293506000929091169063b9a09fd590602401602060405180830381865afa15801561050f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610533919061283e565b90506001600160a01b03811661054957506103f4565b60025460405163ae21c4cb60e01b81526001600160a01b038381166004830152600092169063ae21c4cb90602401602060405180830381865afa158015610594573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b8919061283e565b90506001600160a01b0381166000036105d25750506103f4565b6000816001600160a01b03166355288eea6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610612573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610636919061285b565b905080600003610648575050506103f4565b6000865b610656898961288a565b8110156107a857604051630981b24d60e41b8152600481018490526001600160a01b0385169063981b24d090602401602060405180830381865afa1580156106a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c6919061285b565b915082866106d48a846128a2565b815181106106e4576106e46128b9565b60209081029190910101515286866106fc8a846128a2565b8151811061070c5761070c6128b9565b60209081029190910101516001600160a01b0390911660409091015281866107348a846128a2565b81518110610744576107446128b9565b6020026020010151602001818152505061075e838561152f565b866107698a846128a2565b81518110610779576107796128b9565b6020908102919091010151606001526107946107088461288a565b9250806107a0816128cf565b91505061064c565b50505050509392505050565b600054610100900460ff16158080156107d45750600054600160ff909116105b806107ee5750303b1580156107ee575060005460ff166001145b6108515760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161033d565b6000805460ff191660011790558015610874576000805461ff0019166101001790555b600480546001600160a01b031990811633178255600280546001600160a01b0387169216821790556040805163c45a015560e01b81529051919263c45a01559282820192602092908290030181865afa1580156108d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108f9919061283e565b6000805462010000600160b01b031916620100006001600160a01b039384160217905560025460408051638dd598fb60e01b815290519190921691638dd598fb9160048083019260209291908290030181865afa15801561095e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610982919061283e565b6001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e3919061283e565b600380546001600160a01b03199081166001600160a01b0393841617909155600180549091169184169190911790558015610a58576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b6004546001600160a01b03163314610aa35760405162461bcd60e51b81526020600482015260096024820152683737ba1037bbb732b960b91b604482015260640161033d565b6001600160a01b038116610ae45760405162461bcd60e51b81526020600482015260086024820152673d32b937a0b2323960c11b604482015260640161033d565b600280546001600160a01b038381166001600160a01b0319831681179093556040805163c45a015560e01b8152905191909216929163c45a01559160048083019260209291908290030181865afa158015610b43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b67919061283e565b6000805462010000600160b01b031916620100006001600160a01b039384160217905560025460408051638dd598fb60e01b815290519190921691638dd598fb9160048083019260209291908290030181865afa158015610bcc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf0919061283e565b6001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c51919061283e565b600380546001600160a01b0319166001600160a01b0392831617905560408051838316815291841660208301527f710c23d7ab8af94af228e05f80f3472774722958ef63a866cdb227de1b2a8f2c910160405180910390a15050565b60025460405163b9a09fd560e01b81526001600160a01b038481166004830152600092839291169063b9a09fd590602401602060405180830381865afa158015610cfb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1f919061283e565b600254604051637572079360e11b81526001600160a01b0380841660048301529293506000929091169063eae40f2690602401602060405180830381865afa158015610d6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d93919061283e565b90506000816001600160a01b031663a4a3e0356040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dd5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df9919061285b565b604051631c0ba43160e11b81526001600160a01b03878116600483015260248201839052919250600091841690633817486290604401606060405180830381865afa158015610e4c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7091906128e8565b60200151979650505050505050565b60606103e8831115610ec35760405162461bcd60e51b815260206004820152600d60248201526c3a37b79036b0b73c903830b4b960991b604482015260640161033d565b8267ffffffffffffffff811115610edc57610edc612828565b604051908082528060200260200182016040528015610f1557816020015b610f026122c7565b815260200190600190039081610efa5790505b509050600082905060008060029054906101000a90046001600160a01b03166001600160a01b031663574f2ba36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f95919061285b565b905060005b610fa4868661288a565b8310156110685782821461106857600054604051631e3dd18b60e01b815260048101859052620100009091046001600160a01b031690631e3dd18b90602401602060405180830381865afa158015611000573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611024919061283e565b905061102f81611a04565b8461103a87866128a2565b8151811061104a5761104a6128b9565b60200260200101819052508280611060906128cf565b935050610f9a565b50505092915050565b60606103e88211156110b55760405162461bcd60e51b815260206004820152600d60248201526c3a37b79036b0b73c903830b4b960991b604482015260640161033d565b8167ffffffffffffffff8111156110ce576110ce612828565b60405190808252806020026020018201604052801561110757816020015b6110f46122c7565b8152602001906001900390816110ec5790505b5090506000805b8381101561117857848482818110611128576111286128b9565b905060200201602081019061113d91906123a7565b915061114882611a04565b83828151811061115a5761115a6128b9565b60200260200101819052508080611170906128cf565b91505061110e565b505092915050565b6111886122c7565b61119182611a04565b92915050565b61119f6122c7565b6103f483611a04565b6111b0612288565b60025460405163b9a09fd560e01b81526001600160a01b038086166004830152859260009291169063b9a09fd590602401602060405180830381865afa1580156111fe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611222919061283e565b90506000806001600160a01b03831615611329576001600160a01b03861615611322576040516370a0823160e01b81526001600160a01b0387811660048301528416906370a0823190602401602060405180830381865afa15801561128b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112af919061285b565b6040516246613160e11b81526001600160a01b03888116600483015291935090841690628cc26290602401602060405180830381865afa1580156112f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061131b919061285b565b9050611329565b5060009050805b6000805460405163e5e31b1360e01b81526001600160a01b038a81166004830152620100009092049091169063e5e31b1390602401602060405180830381865afa15801561137b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061139f9190612944565b6001600160a01b038916875290508015611422576040516326ad4fc560e11b81526001600160a01b038881166004830152861690634d5a9f8a90602401602060405180830381865afa1580156113f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061141d919061285b565b611425565b60005b6020870152801561149f5760405163a1ac4d1360e01b81526001600160a01b03888116600483015286169063a1ac4d1390602401602060405180830381865afa158015611476573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061149a919061285b565b6114a2565b60005b604087810191909152516370a0823160e01b81526001600160a01b0388811660048301528916906370a0823190602401602060405180830381865afa1580156114ef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611513919061285b565b606087015250608085019190915260a084015250909392505050565b606060008290506000816001600160a01b031663e68863966040518163ffffffff1660e01b8152600401602060405180830381865afa158015611576573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061159a919061285b565b90508067ffffffffffffffff8111156115b5576115b5612828565b60405190808252806020026020018201604052801561160657816020015b60408051608081018252600080825260208083018290529282015260608082015282526000199092019101816115d35790505b509250600080805b838310156119f957604051637bb7bed160e01b8152600481018490526001600160a01b03861690637bb7bed190602401602060405180830381865afa15801561165b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061167f919061283e565b604051631c0ba43160e11b81526001600160a01b038083166004830152602482018b9052919250600091871690633817486290604401606060405180830381865afa1580156116d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116f691906128e8565b60208101519350905082156118775781878581518110611718576117186128b9565b6020026020010151600001906001600160a01b031690816001600160a01b031681525050816001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa15801561177a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526117a29190810190612966565b8785815181106117b4576117b46128b9565b602002602001015160600181905250816001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611801573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118259190612a13565b878581518110611837576118376128b9565b60200260200101516020019060ff16908160ff168152505082878581518110611862576118626128b9565b602002602001015160400181815250506119e6565b8187858151811061188a5761188a6128b9565b6020026020010151600001906001600160a01b031690816001600160a01b031681525050816001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa1580156118ec573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526119149190810190612966565b878581518110611926576119266128b9565b602002602001015160600181905250816001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611973573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119979190612a13565b8785815181106119a9576119a96128b9565b60200260200101516020019060ff16908160ff168152505060008785815181106119d5576119d56128b9565b602002602001015160400181815250505b50826119f1816128cf565b93505061160e565b505050505092915050565b611a0c6122c7565b60008290506000816001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a51573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a75919061283e565b90506000826001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611ab7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611adb919061283e565b6000805460405163e5e31b1360e01b81526001600160a01b0389811660048301529394509192839283926201000090049091169063e5e31b1390602401602060405180830381865afa158015611b35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b599190612944565b905060008115158103611bd557886001600160a01b031663c4a7761e6040518163ffffffff1660e01b81526004016040805180830381865afa158015611ba3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bc79190612a36565b909450925060029050611cb8565b866001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa158015611c13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c379190612a5a565b508094508195505050866001600160a01b03166309047bdd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611c7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ca29190612944565b1515600114611cb2576001611cb5565b60005b90505b60025460405163b9a09fd560e01b81526001600160a01b038b81166004830152600092169063b9a09fd590602401602060405180830381865afa158015611d03573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d27919061283e565b90506000806001600160a01b03831615611e0457826001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611d79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d9d919061285b565b9150826001600160a01b0316637b0a47ee6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611ddd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e01919061285b565b90505b6001600160a01b03808d168c526040805163313ce56760e01b81529051918c169163313ce567916004808201926020929091908290030181865afa158015611e50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e749190612a13565b60ff1660208c015260408b01846002811115611e9257611e926125b9565b90816002811115611ea557611ea56125b9565b81525050896001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611ee7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f0b919061285b565b60608c01526001600160a01b03891660808c018190526040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa158015611f5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f809190612a13565b60ff168b60c0018181525050886001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa158015611fca573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611ff29190810190612966565b60a08c015260e08b018790526001600160a01b0388166101008c018190526040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa15801561204b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061206f9190612a13565b60ff168b610140018181525050876001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa1580156120ba573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526120e29190810190612966565b6101208c01526101608b018690526001600160a01b038084166101808d01526101a08c018390526102008c01829052600354166102208c018190526040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa158015612158573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061217c9190612a13565b60ff166102408c0152600254604051637572079360e11b81526001600160a01b0385811660048301529091169063eae40f2690602401602060405180830381865afa1580156121cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121f3919061283e565b6001600160a01b039081166101c08d015260025460405163ae21c4cb60e01b8152858316600482015291169063ae21c4cb90602401602060405180830381865afa158015612245573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612269919061283e565b6001600160a01b03166101e08c015250989a9950505050505050505050565b6040518060c0016040528060006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001600081525090565b6040805161026081018252600080825260208201819052909182019081526020016000815260200160006001600160a01b0316815260200160608152602001600081526020016000815260200160006001600160a01b0316815260200160608152602001600081526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b0316815260200160006001600160a01b031681526020016000815260200160006001600160a01b03168152602001600081525090565b6001600160a01b03811681146123a457600080fd5b50565b6000602082840312156123b957600080fd5b81356103f48161238f565b600080604083850312156123d757600080fd5b82356123e28161238f565b915060208301356123f28161238f565b809150509250929050565b60008060006060848603121561241257600080fd5b8335925060208401359150604084013561242b8161238f565b809150509250925092565b60005b83811015612451578181015183820152602001612439565b83811115612460576000848401525b50505050565b6000815180845261247e816020860160208601612436565b601f01601f19169290920160200192915050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b8381101561258957603f198984030185528151805184528781015188850152868101516001600160a01b039081168886015260609182015160808387018190528151908701819052908a019260a0600583901b880181019391929088019060005b8181101561257057898603609f1901835286518051851687528e81015160ff168f8801528d8101518e880152850151608086880181905261255d90880182612466565b978f0197965050918d019160010161251a565b505050978a0197509094505050908601906001016124b9565b509098975050505050505050565b600080604083850312156125aa57600080fd5b50508035926020909101359150565b634e487b7160e01b600052602160045260246000fd5b600381106125ed57634e487b7160e01b600052602160045260246000fd5b9052565b80516001600160a01b03168252600061026060208301516020850152604083015161261f60408601826125cf565b5060608301516060850152608083015161264460808601826001600160a01b03169052565b5060a08301518160a086015261265c82860182612466565b91505060c083015160c085015260e083015160e08501526101008084015161268e828701826001600160a01b03169052565b505061012080840151858303828701526126a88382612466565b92505050610140808401518186015250610160808401518186015250610180808401516126df828701826001600160a01b03169052565b50506101a083810151908501526101c0808401516001600160a01b03908116918601919091526101e080850151821690860152610200808501519086015261022080850151909116908501526102409283015192909301919091525090565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561279357603f198886030184526127818583516125f1565b94509285019290850190600101612765565b5092979650505050505050565b600080602083850312156127b357600080fd5b823567ffffffffffffffff808211156127cb57600080fd5b818501915085601f8301126127df57600080fd5b8135818111156127ee57600080fd5b8660208260051b850101111561280357600080fd5b60209290920196919550909350505050565b6020815260006103f460208301846125f1565b634e487b7160e01b600052604160045260246000fd5b60006020828403121561285057600080fd5b81516103f48161238f565b60006020828403121561286d57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b6000821982111561289d5761289d612874565b500190565b6000828210156128b4576128b4612874565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600182016128e1576128e1612874565b5060010190565b6000606082840312156128fa57600080fd5b6040516060810181811067ffffffffffffffff8211171561291d5761291d612828565b80604052508251815260208301516020820152604083015160408201528091505092915050565b60006020828403121561295657600080fd5b815180151581146103f457600080fd5b60006020828403121561297857600080fd5b815167ffffffffffffffff8082111561299057600080fd5b818401915084601f8301126129a457600080fd5b8151818111156129b6576129b6612828565b604051601f8201601f19908116603f011681019083821181831017156129de576129de612828565b816040528281528760208487010111156129f757600080fd5b612a08836020830160208801612436565b979650505050505050565b600060208284031215612a2557600080fd5b815160ff811681146103f457600080fd5b60008060408385031215612a4957600080fd5b505080516020909101519092909150565b600080600060608486031215612a6f57600080fd5b835192506020840151915060408401519050925092509256fea2646970667358221220bd555569a23bed3bca955db84fcaaed9b04ed13456af7fbd4174a28bd9dc144d64736f6c634300080d0033

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.