Contract 0x84B63312B446e539E214fd0998c91173f7ffC190

 
Txn Hash Method
Block
From
To
Value
0x193fa05c074cde3a2f44a7e5f353f08c010c3e606b80060809bcd1ad5dd0bcb00x608060401139954052023-12-26 11:19:4765 days 12 hrs ago0x34ad8d8c3e12b5a500fe983c43f2a0306dcf0ad1 IN  Create: SpeedMarketsAMMData0 ETH0.0029925011890.006689373
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
SpeedMarketsAMMData

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 11 : SpeedMarketsAMMData.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

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

// internal
import "../utils/proxy/solidity-0.8.0/ProxyOwned.sol";
import "../utils/proxy/solidity-0.8.0/ProxyPausable.sol";

import "../interfaces/ISpeedMarketsAMM.sol";
import "../interfaces/IChainedSpeedMarketsAMM.sol";

import "./SpeedMarket.sol";
import "./ChainedSpeedMarket.sol";

/// @title An AMM data fetching for Thales speed markets
contract SpeedMarketsAMMData is Initializable, ProxyOwned, ProxyPausable {
    address public speedMarketsAMM;

    address public chainedSpeedMarketsAMM;

    struct MarketData {
        address user;
        bytes32 asset;
        uint64 strikeTime;
        int64 strikePrice;
        SpeedMarket.Direction direction;
        uint buyinAmount;
        bool resolved;
        int64 finalPrice;
        SpeedMarket.Direction result;
        bool isUserWinner;
        uint safeBoxImpact;
        uint lpFee;
        uint256 createdAt;
    }

    struct ChainedMarketData {
        address user;
        bytes32 asset;
        uint64 timeFrame;
        uint64 initialStrikeTime;
        uint64 strikeTime;
        int64 initialStrikePrice;
        SpeedMarket.Direction[] directions;
        int64[] strikePrices;
        int64[] finalPrices;
        uint buyinAmount;
        uint payoutMultiplier;
        bool resolved;
        bool isUserWinner;
        uint safeBoxImpact;
        uint256 createdAt;
    }

    struct Risk {
        uint current;
        uint max;
    }

    struct RiskPerDirection {
        SpeedMarket.Direction direction;
        uint current;
        uint max;
    }

    struct SpeedMarketsAMMParameters {
        uint numActiveMarkets;
        uint numMaturedMarkets;
        uint numActiveMarketsPerUser;
        uint numMaturedMarketsPerUser;
        uint minBuyinAmount;
        uint maxBuyinAmount;
        uint minimalTimeToMaturity;
        uint maximalTimeToMaturity;
        uint64 maximumPriceDelay;
        uint64 maximumPriceDelayForResolving;
        uint[] timeThresholdsForFees;
        uint[] lpFees;
        uint lpFee;
        uint maxSkewImpact;
        uint safeBoxImpact;
        bool isAddressWhitelisted;
    }

    struct ChainedSpeedMarketsAMMParameters {
        uint numActiveMarkets;
        uint numMaturedMarkets;
        uint numActiveMarketsPerUser;
        uint numMaturedMarketsPerUser;
        uint minChainedMarkets;
        uint maxChainedMarkets;
        uint64 minTimeFrame;
        uint64 maxTimeFrame;
        uint minBuyinAmount;
        uint maxBuyinAmount;
        uint maxProfitPerIndividualMarket;
        Risk risk;
        uint[] payoutMultipliers;
    }

    function initialize(address _owner, address _speedMarketsAMM) external initializer {
        setOwner(_owner);
        speedMarketsAMM = _speedMarketsAMM;
    }

    /// @notice Set speed and chained speed markets AMM addresses
    /// @param _speedMarketsAMM to use address for fetching speed AMM data
    /// @param _chainedSpeedMarketsAMM to use address for fetching chained speed AMM data
    function setSpeedMarketsAMM(address _speedMarketsAMM, address _chainedSpeedMarketsAMM) external onlyOwner {
        speedMarketsAMM = _speedMarketsAMM;
        chainedSpeedMarketsAMM = _chainedSpeedMarketsAMM;
        emit SetSpeedMarketsAMM(_speedMarketsAMM, _chainedSpeedMarketsAMM);
    }

    //////////////////getters/////////////////

    /// @notice return all speed market data for an array of markets
    function getMarketsData(address[] calldata marketsArray) external view returns (MarketData[] memory) {
        MarketData[] memory markets = new MarketData[](marketsArray.length);
        for (uint i = 0; i < marketsArray.length; i++) {
            SpeedMarket market = SpeedMarket(marketsArray[i]);
            markets[i].user = market.user();
            markets[i].asset = market.asset();
            markets[i].strikeTime = market.strikeTime();
            markets[i].strikePrice = market.strikePrice();
            markets[i].direction = market.direction();
            markets[i].buyinAmount = market.buyinAmount();
            markets[i].resolved = market.resolved();
            markets[i].finalPrice = market.finalPrice();
            markets[i].result = market.result();
            markets[i].isUserWinner = market.isUserWinner();

            if (ISpeedMarketsAMM(speedMarketsAMM).marketHasFeeAttribute(marketsArray[i])) {
                markets[i].safeBoxImpact = market.safeBoxImpact();
                markets[i].lpFee = market.lpFee();
            }
            if (ISpeedMarketsAMM(speedMarketsAMM).marketHasCreatedAtAttribute(marketsArray[i])) {
                markets[i].createdAt = market.createdAt();
            }
        }
        return markets;
    }

    /// @notice return all chained speed market data for an array of markets
    function getChainedMarketsData(address[] calldata marketsArray) external view returns (ChainedMarketData[] memory) {
        ChainedMarketData[] memory markets = new ChainedMarketData[](marketsArray.length);
        for (uint i = 0; i < marketsArray.length; i++) {
            ChainedSpeedMarket market = ChainedSpeedMarket(marketsArray[i]);
            markets[i].user = market.user();
            markets[i].asset = market.asset();
            markets[i].timeFrame = market.timeFrame();
            markets[i].initialStrikeTime = market.initialStrikeTime();
            markets[i].strikeTime = market.strikeTime();
            markets[i].initialStrikePrice = market.initialStrikePrice();

            SpeedMarket.Direction[] memory marketDirections = new SpeedMarket.Direction[](market.numOfDirections());
            int64[] memory marketStrikePrices = new int64[](market.numOfPrices());
            int64[] memory marketFinalPrices = new int64[](market.numOfPrices());
            for (uint j = 0; j < market.numOfDirections(); j++) {
                marketDirections[j] = market.directions(j);
                if (j < market.numOfPrices()) {
                    marketStrikePrices[j] = market.strikePrices(j);
                    marketFinalPrices[j] = market.finalPrices(j);
                }
            }
            markets[i].directions = marketDirections;
            markets[i].strikePrices = marketStrikePrices;
            markets[i].finalPrices = marketFinalPrices;

            markets[i].buyinAmount = market.buyinAmount();
            markets[i].payoutMultiplier = market.payoutMultiplier();
            markets[i].resolved = market.resolved();
            markets[i].isUserWinner = market.isUserWinner();
            markets[i].safeBoxImpact = market.safeBoxImpact();
            markets[i].createdAt = market.createdAt();
        }
        return markets;
    }

    /// @notice return all risk data (current and max) by specified asset
    function getRiskPerAsset(bytes32 asset) external view returns (Risk memory) {
        Risk memory risk;
        risk.current = ISpeedMarketsAMM(speedMarketsAMM).currentRiskPerAsset(asset);
        risk.max = ISpeedMarketsAMM(speedMarketsAMM).maxRiskPerAsset(asset);
        return risk;
    }

    /// @notice return all risk data (direction, current and max) for both directions (Up and Down) by specified asset
    function getDirectionalRiskPerAsset(bytes32 asset) external view returns (RiskPerDirection[] memory) {
        SpeedMarket.Direction[] memory directions = new SpeedMarket.Direction[](2);
        directions[0] = SpeedMarket.Direction.Up;
        directions[1] = SpeedMarket.Direction.Down;

        RiskPerDirection[] memory risks = new RiskPerDirection[](directions.length);
        for (uint i = 0; i < directions.length; i++) {
            SpeedMarket.Direction currentDirection = directions[i];
            risks[i].direction = currentDirection;
            risks[i].current = ISpeedMarketsAMM(speedMarketsAMM).currentRiskPerAssetAndDirection(asset, currentDirection);
            risks[i].max = ISpeedMarketsAMM(speedMarketsAMM).maxRiskPerAssetAndDirection(asset, currentDirection);
        }

        return risks;
    }

    /// @notice return all speed AMM parameters
    function getSpeedMarketsAMMParameters(address _walletAddress) external view returns (SpeedMarketsAMMParameters memory) {
        uint[5] memory allLengths = ISpeedMarketsAMM(speedMarketsAMM).getLengths(_walletAddress);

        uint lpFeesLength = allLengths[4];
        uint[] memory timeThresholdsForFees = new uint[](lpFeesLength);
        uint[] memory lpFees = new uint[](lpFeesLength);
        for (uint i = 0; i < lpFeesLength; i++) {
            timeThresholdsForFees[i] = ISpeedMarketsAMM(speedMarketsAMM).timeThresholdsForFees(i);
            lpFees[i] = ISpeedMarketsAMM(speedMarketsAMM).lpFees(i);
        }

        return
            SpeedMarketsAMMParameters(
                allLengths[0], // numActiveMarkets
                allLengths[1], // numMaturedMarkets
                _walletAddress != address(0) ? allLengths[2] : 0, // numActiveMarketsPerUser
                _walletAddress != address(0) ? allLengths[3] : 0, // numMaturedMarketsPerUser
                ISpeedMarketsAMM(speedMarketsAMM).minBuyinAmount(),
                ISpeedMarketsAMM(speedMarketsAMM).maxBuyinAmount(),
                ISpeedMarketsAMM(speedMarketsAMM).minimalTimeToMaturity(),
                ISpeedMarketsAMM(speedMarketsAMM).maximalTimeToMaturity(),
                ISpeedMarketsAMM(speedMarketsAMM).maximumPriceDelay(),
                ISpeedMarketsAMM(speedMarketsAMM).maximumPriceDelayForResolving(),
                timeThresholdsForFees,
                lpFees,
                ISpeedMarketsAMM(speedMarketsAMM).lpFee(),
                ISpeedMarketsAMM(speedMarketsAMM).maxSkewImpact(),
                ISpeedMarketsAMM(speedMarketsAMM).safeBoxImpact(),
                _walletAddress != address(0) ? ISpeedMarketsAMM(speedMarketsAMM).whitelistedAddresses(_walletAddress) : false
            );
    }

    /// @notice return all chained speed AMM parameters
    function getChainedSpeedMarketsAMMParameters(address _walletAddress)
        external
        view
        returns (ChainedSpeedMarketsAMMParameters memory)
    {
        uint[4] memory allLengths = IChainedSpeedMarketsAMM(chainedSpeedMarketsAMM).getLengths(_walletAddress);

        Risk memory risk;
        risk.current = IChainedSpeedMarketsAMM(chainedSpeedMarketsAMM).currentRisk();
        risk.max = IChainedSpeedMarketsAMM(chainedSpeedMarketsAMM).maxRisk();

        uint minChainedMarkets = IChainedSpeedMarketsAMM(chainedSpeedMarketsAMM).minChainedMarkets();
        uint maxChainedMarkets = IChainedSpeedMarketsAMM(chainedSpeedMarketsAMM).maxChainedMarkets();
        uint differentChainedMarketsSize = maxChainedMarkets - minChainedMarkets + 1;

        uint[] memory payoutMultipliers = new uint[](differentChainedMarketsSize);
        for (uint i = 0; i < differentChainedMarketsSize; i++) {
            payoutMultipliers[i] = IChainedSpeedMarketsAMM(chainedSpeedMarketsAMM).payoutMultipliers(i);
        }

        return
            ChainedSpeedMarketsAMMParameters(
                allLengths[0], // numActiveMarkets
                allLengths[1], // numMaturedMarkets
                _walletAddress != address(0) ? allLengths[2] : 0, // numActiveMarketsPerUser
                _walletAddress != address(0) ? allLengths[3] : 0, // numMaturedMarketsPerUser
                minChainedMarkets,
                maxChainedMarkets,
                IChainedSpeedMarketsAMM(chainedSpeedMarketsAMM).minTimeFrame(),
                IChainedSpeedMarketsAMM(chainedSpeedMarketsAMM).maxTimeFrame(),
                IChainedSpeedMarketsAMM(chainedSpeedMarketsAMM).minBuyinAmount(),
                IChainedSpeedMarketsAMM(chainedSpeedMarketsAMM).maxBuyinAmount(),
                IChainedSpeedMarketsAMM(chainedSpeedMarketsAMM).maxProfitPerIndividualMarket(),
                risk,
                payoutMultipliers
            );
    }

    //////////////////events/////////////////

    event SetSpeedMarketsAMM(address _speedMarketsAMM, address _chainedSpeedMarketsAMM);
}

File 2 of 11 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol)

pragma solidity ^0.8.0;

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 a proxied contract can't have 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.
 *
 * 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 initialize the implementation contract, you can either invoke the
 * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() initializer {}
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

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

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        // If the contract is initializing we ignore whether _initialized is set in order to support multiple
        // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the
        // contract may have been reentered.
        require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

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

    function _isConstructor() private view returns (bool) {
        return !AddressUpgradeable.isContract(address(this));
    }
}

File 3 of 11 : ProxyOwned.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

// Clone of syntetix contract without constructor
contract ProxyOwned {
    address public owner;
    address public nominatedOwner;
    bool private _initialized;
    bool private _transferredAtInit;

    function setOwner(address _owner) public {
        require(_owner != address(0), "Owner address cannot be 0");
        require(!_initialized, "Already initialized, use nominateNewOwner");
        _initialized = true;
        owner = _owner;
        emit OwnerChanged(address(0), _owner);
    }

    function nominateNewOwner(address _owner) external onlyOwner {
        nominatedOwner = _owner;
        emit OwnerNominated(_owner);
    }

    function acceptOwnership() external {
        require(msg.sender == nominatedOwner, "You must be nominated before you can accept ownership");
        emit OwnerChanged(owner, nominatedOwner);
        owner = nominatedOwner;
        nominatedOwner = address(0);
    }

    function transferOwnershipAtInit(address proxyAddress) external onlyOwner {
        require(proxyAddress != address(0), "Invalid address");
        require(!_transferredAtInit, "Already transferred");
        owner = proxyAddress;
        _transferredAtInit = true;
        emit OwnerChanged(owner, proxyAddress);
    }

    modifier onlyOwner {
        _onlyOwner();
        _;
    }

    function _onlyOwner() private view {
        require(msg.sender == owner, "Only the contract owner may perform this action");
    }

    event OwnerNominated(address newOwner);
    event OwnerChanged(address oldOwner, address newOwner);
}

File 4 of 11 : ProxyPausable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

// Inheritance
import "./ProxyOwned.sol";

// Clone of syntetix contract without constructor

contract ProxyPausable is ProxyOwned {
    uint public lastPauseTime;
    bool public paused;

    

    /**
     * @notice Change the paused state of the contract
     * @dev Only the contract owner may call this.
     */
    function setPaused(bool _paused) external onlyOwner {
        // Ensure we're actually changing the state before we do anything
        if (_paused == paused) {
            return;
        }

        // Set our paused state.
        paused = _paused;

        // If applicable, set the last pause time.
        if (paused) {
            lastPauseTime = block.timestamp;
        }

        // Let everyone know that our pause state has changed.
        emit PauseChanged(paused);
    }

    event PauseChanged(bool isPaused);

    modifier notPaused {
        require(!paused, "This action cannot be performed while the contract is paused");
        _;
    }
}

File 5 of 11 : ISpeedMarketsAMM.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.5.16;

import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";

import "../SpeedMarkets/SpeedMarket.sol";

interface ISpeedMarketsAMM {
    struct Params {
        bool supportedAsset;
        bytes32 pythId;
        uint safeBoxImpact;
        uint64 maximumPriceDelay;
    }

    function sUSD() external view returns (IERC20Upgradeable);

    function supportedAsset(bytes32 _asset) external view returns (bool);

    function assetToPythId(bytes32 _asset) external view returns (bytes32);

    function minBuyinAmount() external view returns (uint);

    function maxBuyinAmount() external view returns (uint);

    function minimalTimeToMaturity() external view returns (uint);

    function maximalTimeToMaturity() external view returns (uint);

    function maximumPriceDelay() external view returns (uint64);

    function maximumPriceDelayForResolving() external view returns (uint64);

    function timeThresholdsForFees(uint _index) external view returns (uint);

    function lpFees(uint _index) external view returns (uint);

    function lpFee() external view returns (uint);

    function maxSkewImpact() external view returns (uint);

    function safeBoxImpact() external view returns (uint);

    function marketHasCreatedAtAttribute(address _market) external view returns (bool);

    function marketHasFeeAttribute(address _market) external view returns (bool);

    function maxRiskPerAsset(bytes32 _asset) external view returns (uint);

    function currentRiskPerAsset(bytes32 _asset) external view returns (uint);

    function maxRiskPerAssetAndDirection(bytes32 _asset, SpeedMarket.Direction _direction) external view returns (uint);

    function currentRiskPerAssetAndDirection(bytes32 _asset, SpeedMarket.Direction _direction) external view returns (uint);

    function whitelistedAddresses(address _wallet) external view returns (bool);

    function getLengths(address _user) external view returns (uint[5] memory);

    function getParams(bytes32 _asset) external view returns (Params memory);
}

File 6 of 11 : IChainedSpeedMarketsAMM.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.5.16;

import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";

import "../SpeedMarkets/SpeedMarket.sol";
import "../SpeedMarkets/ChainedSpeedMarket.sol";

interface IChainedSpeedMarketsAMM {
    function sUSD() external view returns (IERC20Upgradeable);

    function minChainedMarkets() external view returns (uint);

    function maxChainedMarkets() external view returns (uint);

    function minTimeFrame() external view returns (uint64);

    function maxTimeFrame() external view returns (uint64);

    function minBuyinAmount() external view returns (uint);

    function maxBuyinAmount() external view returns (uint);

    function maxProfitPerIndividualMarket() external view returns (uint);

    function payoutMultipliers(uint _index) external view returns (uint);

    function maxRisk() external view returns (uint);

    function currentRisk() external view returns (uint);

    function getLengths(address _user) external view returns (uint[4] memory);
}

File 7 of 11 : SpeedMarket.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";

import "../interfaces/ISpeedMarketsAMM.sol";

contract SpeedMarket {
    using SafeERC20Upgradeable for IERC20Upgradeable;

    struct InitParams {
        address _speedMarketsAMM;
        address _user;
        bytes32 _asset;
        uint64 _strikeTime;
        int64 _strikePrice;
        Direction _direction;
        uint _buyinAmount;
        uint _safeBoxImpact;
        uint _lpFee;
    }

    enum Direction {
        Up,
        Down
    }

    address public user;
    bytes32 public asset;
    uint64 public strikeTime;
    int64 public strikePrice;
    Direction public direction;
    uint public buyinAmount;

    bool public resolved;
    int64 public finalPrice;
    Direction public result;

    ISpeedMarketsAMM public speedMarketsAMM;

    uint public safeBoxImpact;
    uint public lpFee;

    uint256 public createdAt;

    /* ========== CONSTRUCTOR ========== */

    bool public initialized = false;

    function initialize(InitParams calldata params) external {
        require(!initialized, "Speed market already initialized");
        initialized = true;
        speedMarketsAMM = ISpeedMarketsAMM(params._speedMarketsAMM);
        user = params._user;
        asset = params._asset;
        strikeTime = params._strikeTime;
        strikePrice = params._strikePrice;
        direction = params._direction;
        buyinAmount = params._buyinAmount;
        safeBoxImpact = params._safeBoxImpact;
        lpFee = params._lpFee;
        speedMarketsAMM.sUSD().approve(params._speedMarketsAMM, type(uint256).max);
        createdAt = block.timestamp;
    }

    function resolve(int64 _finalPrice) external onlyAMM {
        require(!resolved, "already resolved");
        require(block.timestamp > strikeTime, "not ready to be resolved");
        resolved = true;
        finalPrice = _finalPrice;

        if (finalPrice < strikePrice) {
            result = Direction.Down;
        } else if (finalPrice > strikePrice) {
            result = Direction.Up;
        } else {
            result = direction == Direction.Up ? Direction.Down : Direction.Up;
        }

        if (direction == result) {
            speedMarketsAMM.sUSD().safeTransfer(user, speedMarketsAMM.sUSD().balanceOf(address(this)));
        } else {
            speedMarketsAMM.sUSD().safeTransfer(address(speedMarketsAMM), speedMarketsAMM.sUSD().balanceOf(address(this)));
        }

        emit Resolved(finalPrice, result, direction == result);
    }

    function isUserWinner() external view returns (bool) {
        return resolved && (direction == result);
    }

    modifier onlyAMM() {
        require(msg.sender == address(speedMarketsAMM), "only the AMM may perform these methods");
        _;
    }

    event Resolved(int64 finalPrice, Direction result, bool userIsWinner);
}

File 8 of 11 : ChainedSpeedMarket.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

// external
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";

// internal
import "../interfaces/IChainedSpeedMarketsAMM.sol";

import "./SpeedMarket.sol";

contract ChainedSpeedMarket {
    using SafeERC20Upgradeable for IERC20Upgradeable;

    struct InitParams {
        address _chainedMarketsAMM;
        address _user;
        bytes32 _asset;
        uint64 _timeFrame;
        uint64 _initialStrikeTime;
        uint64 _strikeTime;
        int64 _initialStrikePrice;
        SpeedMarket.Direction[] _directions;
        uint _buyinAmount;
        uint _safeBoxImpact;
        uint _payoutMultiplier;
    }

    address public user;
    bytes32 public asset;
    uint64 public timeFrame;
    uint64 public initialStrikeTime;
    uint64 public strikeTime;
    int64 public initialStrikePrice;
    int64[] public strikePrices;
    SpeedMarket.Direction[] public directions;
    uint public buyinAmount;
    uint public safeBoxImpact;
    uint public payoutMultiplier;

    bool public resolved;
    int64[] public finalPrices;
    bool public isUserWinner;

    uint256 public createdAt;

    IChainedSpeedMarketsAMM public chainedMarketsAMM;

    /* ========== CONSTRUCTOR ========== */

    bool public initialized = false;

    function initialize(InitParams calldata params) external {
        require(!initialized, "Chained market already initialized");
        initialized = true;
        chainedMarketsAMM = IChainedSpeedMarketsAMM(params._chainedMarketsAMM);
        user = params._user;
        asset = params._asset;
        timeFrame = params._timeFrame;
        initialStrikeTime = params._initialStrikeTime;
        strikeTime = params._strikeTime;
        initialStrikePrice = params._initialStrikePrice;
        directions = params._directions;
        buyinAmount = params._buyinAmount;
        safeBoxImpact = params._safeBoxImpact;
        payoutMultiplier = params._payoutMultiplier;
        chainedMarketsAMM.sUSD().approve(params._chainedMarketsAMM, type(uint256).max);
        createdAt = block.timestamp;
    }

    function resolve(int64[] calldata _finalPrices, bool _isManually) external onlyAMM {
        require(!resolved, "already resolved");
        require(block.timestamp > initialStrikeTime + (timeFrame * (_finalPrices.length - 1)), "not ready to be resolved");
        require(_finalPrices.length <= directions.length, "more prices than directions");

        finalPrices = _finalPrices;

        for (uint i = 0; i < _finalPrices.length; i++) {
            strikePrices.push(i == 0 ? initialStrikePrice : _finalPrices[i - 1]); // previous final price is current strike price
            bool userLostDirection = _finalPrices[i] > 0 &&
                strikePrices[i] > 0 &&
                ((_finalPrices[i] >= strikePrices[i] && directions[i] == SpeedMarket.Direction.Down) ||
                    (_finalPrices[i] <= strikePrices[i] && directions[i] == SpeedMarket.Direction.Up));

            // user lost stop checking rest of directions
            if (userLostDirection) {
                resolved = true;
                break;
            }
            // when last final price for last direction user won
            if (i == directions.length - 1) {
                require(!_isManually, "Can not resolve manually");
                isUserWinner = true;
                resolved = true;
            }
        }

        require(resolved, "Not ready to resolve");

        if (isUserWinner) {
            chainedMarketsAMM.sUSD().safeTransfer(user, chainedMarketsAMM.sUSD().balanceOf(address(this)));
        } else {
            chainedMarketsAMM.sUSD().safeTransfer(
                address(chainedMarketsAMM),
                chainedMarketsAMM.sUSD().balanceOf(address(this))
            );
        }

        emit Resolved(finalPrices, isUserWinner);
    }

    /// @notice numOfDirections returns number of directions (speed markets in chain)
    /// @return uint8
    function numOfDirections() external view returns (uint8) {
        return uint8(directions.length);
    }

    /// @notice numOfPrices returns number of strike/finales
    /// @return uint
    function numOfPrices() external view returns (uint) {
        return strikePrices.length;
    }

    modifier onlyAMM() {
        require(msg.sender == address(chainedMarketsAMM), "only the AMM may perform these methods");
        _;
    }

    event Resolved(int64[] finalPrices, bool userIsWinner);
}

File 9 of 11 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)

pragma solidity ^0.8.0;

/**
 * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 10 of 11 : IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20Upgradeable {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

File 11 of 11 : SafeERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerNominated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"isPaused","type":"bool"}],"name":"PauseChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_speedMarketsAMM","type":"address"},{"indexed":false,"internalType":"address","name":"_chainedSpeedMarketsAMM","type":"address"}],"name":"SetSpeedMarketsAMM","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"chainedSpeedMarketsAMM","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"marketsArray","type":"address[]"}],"name":"getChainedMarketsData","outputs":[{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"bytes32","name":"asset","type":"bytes32"},{"internalType":"uint64","name":"timeFrame","type":"uint64"},{"internalType":"uint64","name":"initialStrikeTime","type":"uint64"},{"internalType":"uint64","name":"strikeTime","type":"uint64"},{"internalType":"int64","name":"initialStrikePrice","type":"int64"},{"internalType":"enum SpeedMarket.Direction[]","name":"directions","type":"uint8[]"},{"internalType":"int64[]","name":"strikePrices","type":"int64[]"},{"internalType":"int64[]","name":"finalPrices","type":"int64[]"},{"internalType":"uint256","name":"buyinAmount","type":"uint256"},{"internalType":"uint256","name":"payoutMultiplier","type":"uint256"},{"internalType":"bool","name":"resolved","type":"bool"},{"internalType":"bool","name":"isUserWinner","type":"bool"},{"internalType":"uint256","name":"safeBoxImpact","type":"uint256"},{"internalType":"uint256","name":"createdAt","type":"uint256"}],"internalType":"struct SpeedMarketsAMMData.ChainedMarketData[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_walletAddress","type":"address"}],"name":"getChainedSpeedMarketsAMMParameters","outputs":[{"components":[{"internalType":"uint256","name":"numActiveMarkets","type":"uint256"},{"internalType":"uint256","name":"numMaturedMarkets","type":"uint256"},{"internalType":"uint256","name":"numActiveMarketsPerUser","type":"uint256"},{"internalType":"uint256","name":"numMaturedMarketsPerUser","type":"uint256"},{"internalType":"uint256","name":"minChainedMarkets","type":"uint256"},{"internalType":"uint256","name":"maxChainedMarkets","type":"uint256"},{"internalType":"uint64","name":"minTimeFrame","type":"uint64"},{"internalType":"uint64","name":"maxTimeFrame","type":"uint64"},{"internalType":"uint256","name":"minBuyinAmount","type":"uint256"},{"internalType":"uint256","name":"maxBuyinAmount","type":"uint256"},{"internalType":"uint256","name":"maxProfitPerIndividualMarket","type":"uint256"},{"components":[{"internalType":"uint256","name":"current","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"internalType":"struct SpeedMarketsAMMData.Risk","name":"risk","type":"tuple"},{"internalType":"uint256[]","name":"payoutMultipliers","type":"uint256[]"}],"internalType":"struct SpeedMarketsAMMData.ChainedSpeedMarketsAMMParameters","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"asset","type":"bytes32"}],"name":"getDirectionalRiskPerAsset","outputs":[{"components":[{"internalType":"enum SpeedMarket.Direction","name":"direction","type":"uint8"},{"internalType":"uint256","name":"current","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"internalType":"struct SpeedMarketsAMMData.RiskPerDirection[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"marketsArray","type":"address[]"}],"name":"getMarketsData","outputs":[{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"bytes32","name":"asset","type":"bytes32"},{"internalType":"uint64","name":"strikeTime","type":"uint64"},{"internalType":"int64","name":"strikePrice","type":"int64"},{"internalType":"enum SpeedMarket.Direction","name":"direction","type":"uint8"},{"internalType":"uint256","name":"buyinAmount","type":"uint256"},{"internalType":"bool","name":"resolved","type":"bool"},{"internalType":"int64","name":"finalPrice","type":"int64"},{"internalType":"enum SpeedMarket.Direction","name":"result","type":"uint8"},{"internalType":"bool","name":"isUserWinner","type":"bool"},{"internalType":"uint256","name":"safeBoxImpact","type":"uint256"},{"internalType":"uint256","name":"lpFee","type":"uint256"},{"internalType":"uint256","name":"createdAt","type":"uint256"}],"internalType":"struct SpeedMarketsAMMData.MarketData[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"asset","type":"bytes32"}],"name":"getRiskPerAsset","outputs":[{"components":[{"internalType":"uint256","name":"current","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"internalType":"struct SpeedMarketsAMMData.Risk","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_walletAddress","type":"address"}],"name":"getSpeedMarketsAMMParameters","outputs":[{"components":[{"internalType":"uint256","name":"numActiveMarkets","type":"uint256"},{"internalType":"uint256","name":"numMaturedMarkets","type":"uint256"},{"internalType":"uint256","name":"numActiveMarketsPerUser","type":"uint256"},{"internalType":"uint256","name":"numMaturedMarketsPerUser","type":"uint256"},{"internalType":"uint256","name":"minBuyinAmount","type":"uint256"},{"internalType":"uint256","name":"maxBuyinAmount","type":"uint256"},{"internalType":"uint256","name":"minimalTimeToMaturity","type":"uint256"},{"internalType":"uint256","name":"maximalTimeToMaturity","type":"uint256"},{"internalType":"uint64","name":"maximumPriceDelay","type":"uint64"},{"internalType":"uint64","name":"maximumPriceDelayForResolving","type":"uint64"},{"internalType":"uint256[]","name":"timeThresholdsForFees","type":"uint256[]"},{"internalType":"uint256[]","name":"lpFees","type":"uint256[]"},{"internalType":"uint256","name":"lpFee","type":"uint256"},{"internalType":"uint256","name":"maxSkewImpact","type":"uint256"},{"internalType":"uint256","name":"safeBoxImpact","type":"uint256"},{"internalType":"bool","name":"isAddressWhitelisted","type":"bool"}],"internalType":"struct SpeedMarketsAMMData.SpeedMarketsAMMParameters","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_speedMarketsAMM","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lastPauseTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"nominateNewOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nominatedOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_paused","type":"bool"}],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_speedMarketsAMM","type":"address"},{"internalType":"address","name":"_chainedSpeedMarketsAMM","type":"address"}],"name":"setSpeedMarketsAMM","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"speedMarketsAMM","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"proxyAddress","type":"address"}],"name":"transferOwnershipAtInit","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50614304806100206000396000f3fe608060405234801561001057600080fd5b50600436106101215760003560e01c80635c975abb116100ad578063b7c46c1e11610071578063b7c46c1e14610290578063c3b83f5f146102b0578063d01b279e146102c3578063d9a10e94146102e3578063dc17ea5b146102fb57600080fd5b80635c975abb1461021b57806379ba5097146102385780638da5cb5b1461024057806391b4ded9146102595780639f293fb11461027057600080fd5b80631ca7415c116100f45780631ca7415c1461018a5780632c303f62146101aa578063485cc955146101ca57806353a47bb7146101dd57806358dc0d631461020857600080fd5b806301a494341461012657806313af40351461014f5780631627540c1461016457806316c38b3c14610177575b600080fd5b6101396101343660046139f9565b61030e565b6040516101469190614140565b60405180910390f35b61016261015d3660046139f9565b610c4b565b005b6101626101723660046139f9565b610d8b565b610162610185366004613bee565b610de1565b61019d610198366004613c26565b610e57565b6040516101469190613fe5565b6101bd6101b8366004613a70565b611208565b6040516101469190613da2565b6101626101d8366004613a38565b612162565b6001546101f0906001600160a01b031681565b6040516001600160a01b039091168152602001610146565b610162610216366004613a38565b612246565b6003546102289060ff1681565b6040519015158152602001610146565b6101626122c9565b6000546101f0906201000090046001600160a01b031681565b61026260025481565b604051908152602001610146565b61028361027e366004613a70565b6123c6565b6040516101469190613ef1565b6102a361029e3660046139f9565b612f65565b604051610146919061404c565b6101626102be3660046139f9565b61369c565b6102d66102d1366004613c26565b6137b5565b6040516101469190614129565b6003546101f09061010090046001600160a01b031681565b6004546101f0906001600160a01b031681565b6103a2604051806102000160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160006001600160401b0316815260200160006001600160401b0316815260200160608152602001606081526020016000815260200160008152602001600081526020016000151581525090565b60035460405163023fb25960e01b81526001600160a01b0384811660048301526000926101009004169063023fb2599060240160a06040518083038186803b1580156103ed57600080fd5b505afa158015610401573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104259190613b6c565b60808101519091506000816001600160401b0381111561045557634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561047e578160200160208202803683370190505b5090506000826001600160401b038111156104a957634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156104d2578160200160208202803683370190505b50905060005b8381101561064857600354604051632b18dfc560e11b8152600481018390526101009091046001600160a01b031690635631bf8a9060240160206040518083038186803b15801561052857600080fd5b505afa15801561053c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105609190613c3e565b83828151811061058057634e487b7160e01b600052603260045260246000fd5b6020908102919091010152600354604051634eb7c43b60e01b8152600481018390526101009091046001600160a01b031690634eb7c43b9060240160206040518083038186803b1580156105d357600080fd5b505afa1580156105e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060b9190613c3e565b82828151811061062b57634e487b7160e01b600052603260045260246000fd5b6020908102919091010152806106408161427a565b9150506104d8565b50604080516102008101825285518152602080870151908201529081016001600160a01b03881661067a576000610680565b60408601515b81526020016001600160a01b03881661069a5760006106a0565b60608601515b8152602001600360019054906101000a90046001600160a01b03166001600160a01b03166312aa38336040518163ffffffff1660e01b815260040160206040518083038186803b1580156106f357600080fd5b505afa158015610707573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072b9190613c3e565b8152602001600360019054906101000a90046001600160a01b03166001600160a01b03166307b53bb46040518163ffffffff1660e01b815260040160206040518083038186803b15801561077e57600080fd5b505afa158015610792573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b69190613c3e565b8152602001600360019054906101000a90046001600160a01b03166001600160a01b0316633e7ad1de6040518163ffffffff1660e01b815260040160206040518083038186803b15801561080957600080fd5b505afa15801561081d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108419190613c3e565b8152602001600360019054906101000a90046001600160a01b03166001600160a01b0316635403f80f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561089457600080fd5b505afa1580156108a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108cc9190613c3e565b8152602001600360019054906101000a90046001600160a01b03166001600160a01b031663a201b3076040518163ffffffff1660e01b815260040160206040518083038186803b15801561091f57600080fd5b505afa158015610933573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109579190613c96565b6001600160401b03168152602001600360019054906101000a90046001600160a01b03166001600160a01b031663cf898ca96040518163ffffffff1660e01b815260040160206040518083038186803b1580156109b357600080fd5b505afa1580156109c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109eb9190613c96565b6001600160401b03168152602001838152602001828152602001600360019054906101000a90046001600160a01b03166001600160a01b031663704ce43e6040518163ffffffff1660e01b815260040160206040518083038186803b158015610a5357600080fd5b505afa158015610a67573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8b9190613c3e565b8152602001600360019054906101000a90046001600160a01b03166001600160a01b031663e91558666040518163ffffffff1660e01b815260040160206040518083038186803b158015610ade57600080fd5b505afa158015610af2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b169190613c3e565b8152602001600360019054906101000a90046001600160a01b03166001600160a01b031663d69fb6686040518163ffffffff1660e01b815260040160206040518083038186803b158015610b6957600080fd5b505afa158015610b7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba19190613c3e565b81526020016001600160a01b038816610bbb576000610c3d565b60035460405162d9267b60e31b81526001600160a01b038a81166004830152610100909204909116906306c933d89060240160206040518083038186803b158015610c0557600080fd5b505afa158015610c19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c3d9190613c0a565b151590529695505050505050565b6001600160a01b038116610ca65760405162461bcd60e51b815260206004820152601960248201527f4f776e657220616464726573732063616e6e6f7420626520300000000000000060448201526064015b60405180910390fd5b600154600160a01b900460ff1615610d125760405162461bcd60e51b815260206004820152602960248201527f416c726561647920696e697469616c697a65642c20757365206e6f6d696e617460448201526832a732bba7bbb732b960b91b6064820152608401610c9d565b6001805460ff60a01b1916600160a01b179055600080546001600160a01b03831662010000810262010000600160b01b03199092169190911782556040805192835260208301919091527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c91015b60405180910390a150565b610d936138ea565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce2290602001610d80565b610de96138ea565b60035460ff1615158115151415610dfd5750565b6003805460ff191682151590811790915560ff1615610e1b57426002555b60035460405160ff909116151581527f8fb6c181ee25a520cf3dd6565006ef91229fcfe5a989566c2a3b8c115570cec590602001610d80565b50565b60408051600280825260608083018452926000929190602083019080368337019050509050600081600081518110610e9f57634e487b7160e01b600052603260045260246000fd5b60200260200101906001811115610ec657634e487b7160e01b600052602160045260246000fd5b90816001811115610ee757634e487b7160e01b600052602160045260246000fd5b81525050600181600181518110610f0e57634e487b7160e01b600052603260045260246000fd5b60200260200101906001811115610f3557634e487b7160e01b600052602160045260246000fd5b90816001811115610f5657634e487b7160e01b600052602160045260246000fd5b81525050600081516001600160401b03811115610f8357634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610fd957816020015b610fc66040805160608101909152806000815260200160008152602001600081525090565b815260200190600190039081610fa15790505b50905060005b825181101561120057600083828151811061100a57634e487b7160e01b600052603260045260246000fd5b602002602001015190508083838151811061103557634e487b7160e01b600052603260045260246000fd5b602002602001015160000190600181111561106057634e487b7160e01b600052602160045260246000fd5b9081600181111561108157634e487b7160e01b600052602160045260246000fd5b90525060035460405163016ff7f560e21b81526101009091046001600160a01b0316906305bfdfd4906110ba9089908590600401614038565b60206040518083038186803b1580156110d257600080fd5b505afa1580156110e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061110a9190613c3e565b83838151811061112a57634e487b7160e01b600052603260045260246000fd5b602090810291909101810151015260035460405163e11f951d60e01b81526101009091046001600160a01b03169063e11f951d9061116e9089908590600401614038565b60206040518083038186803b15801561118657600080fd5b505afa15801561119a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111be9190613c3e565b8383815181106111de57634e487b7160e01b600052603260045260246000fd5b60209081029190910101516040015250806111f88161427a565b915050610fdf565b509392505050565b60606000826001600160401b0381111561123257634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156112d857816020015b604080516101e0810182526000808252602080830182905292820181905260608083018290526080830182905260a0830182905260c0830181905260e0830181905261010083015261012082018190526101408201819052610160820181905261018082018190526101a082018190526101c082015282526000199092019101816112505790505b50905060005b8381101561215857600085858381811061130857634e487b7160e01b600052603260045260246000fd5b905060200201602081019061131d91906139f9565b9050806001600160a01b0316634f8632ba6040518163ffffffff1660e01b815260040160206040518083038186803b15801561135857600080fd5b505afa15801561136c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113909190613a1c565b8383815181106113b057634e487b7160e01b600052603260045260246000fd5b6020026020010151600001906001600160a01b031690816001600160a01b031681525050806001600160a01b03166338d52e0f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561140d57600080fd5b505afa158015611421573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114459190613c3e565b83838151811061146557634e487b7160e01b600052603260045260246000fd5b60200260200101516020018181525050806001600160a01b0316638b13b64b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156114ae57600080fd5b505afa1580156114c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114e69190613c96565b83838151811061150657634e487b7160e01b600052603260045260246000fd5b6020026020010151604001906001600160401b031690816001600160401b031681525050806001600160a01b03166320c1bb466040518163ffffffff1660e01b815260040160206040518083038186803b15801561156357600080fd5b505afa158015611577573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061159b9190613c96565b8383815181106115bb57634e487b7160e01b600052603260045260246000fd5b6020026020010151606001906001600160401b031690816001600160401b031681525050806001600160a01b03166351d8044f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561161857600080fd5b505afa15801561162c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116509190613c96565b83838151811061167057634e487b7160e01b600052603260045260246000fd5b6020026020010151608001906001600160401b031690816001600160401b031681525050806001600160a01b031663855d68cb6040518163ffffffff1660e01b815260040160206040518083038186803b1580156116cd57600080fd5b505afa1580156116e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117059190613c75565b83838151811061172557634e487b7160e01b600052603260045260246000fd5b602002602001015160a0019060070b908160070b815250506000816001600160a01b031663e004b5bf6040518163ffffffff1660e01b815260040160206040518083038186803b15801561177857600080fd5b505afa15801561178c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117b09190613cbd565b60ff166001600160401b038111156117d857634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611801578160200160208202803683370190505b5090506000826001600160a01b03166377680bb56040518163ffffffff1660e01b815260040160206040518083038186803b15801561183f57600080fd5b505afa158015611853573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118779190613c3e565b6001600160401b0381111561189c57634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156118c5578160200160208202803683370190505b5090506000836001600160a01b03166377680bb56040518163ffffffff1660e01b815260040160206040518083038186803b15801561190357600080fd5b505afa158015611917573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061193b9190613c3e565b6001600160401b0381111561196057634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611989578160200160208202803683370190505b50905060005b846001600160a01b031663e004b5bf6040518163ffffffff1660e01b815260040160206040518083038186803b1580156119c857600080fd5b505afa1580156119dc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a009190613cbd565b60ff16811015611cd757604051635f51b5c760e01b8152600481018290526001600160a01b03861690635f51b5c79060240160206040518083038186803b158015611a4a57600080fd5b505afa158015611a5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a829190613c56565b848281518110611aa257634e487b7160e01b600052603260045260246000fd5b60200260200101906001811115611ac957634e487b7160e01b600052602160045260246000fd5b90816001811115611aea57634e487b7160e01b600052602160045260246000fd5b81525050846001600160a01b03166377680bb56040518163ffffffff1660e01b815260040160206040518083038186803b158015611b2757600080fd5b505afa158015611b3b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b5f9190613c3e565b811015611cc5576040516317a569fb60e11b8152600481018290526001600160a01b03861690632f4ad3f69060240160206040518083038186803b158015611ba657600080fd5b505afa158015611bba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bde9190613c75565b838281518110611bfe57634e487b7160e01b600052603260045260246000fd5b602002602001019060070b908160070b81525050846001600160a01b0316634e2c1460826040518263ffffffff1660e01b8152600401611c4091815260200190565b60206040518083038186803b158015611c5857600080fd5b505afa158015611c6c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c909190613c75565b828281518110611cb057634e487b7160e01b600052603260045260246000fd5b602002602001019060070b908160070b815250505b80611ccf8161427a565b91505061198f565b5082868681518110611cf957634e487b7160e01b600052603260045260246000fd5b602002602001015160c0018190525081868681518110611d2957634e487b7160e01b600052603260045260246000fd5b602002602001015160e0018190525080868681518110611d5957634e487b7160e01b600052603260045260246000fd5b60200260200101516101000181905250836001600160a01b0316631fcc8bb26040518163ffffffff1660e01b815260040160206040518083038186803b158015611da257600080fd5b505afa158015611db6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dda9190613c3e565b868681518110611dfa57634e487b7160e01b600052603260045260246000fd5b6020026020010151610120018181525050836001600160a01b0316635c8127376040518163ffffffff1660e01b815260040160206040518083038186803b158015611e4457600080fd5b505afa158015611e58573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e7c9190613c3e565b868681518110611e9c57634e487b7160e01b600052603260045260246000fd5b6020026020010151610140018181525050836001600160a01b0316633f6fa6556040518163ffffffff1660e01b815260040160206040518083038186803b158015611ee657600080fd5b505afa158015611efa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1e9190613c0a565b868681518110611f3e57634e487b7160e01b600052603260045260246000fd5b6020026020010151610160019015159081151581525050836001600160a01b0316633a2c1e556040518163ffffffff1660e01b815260040160206040518083038186803b158015611f8e57600080fd5b505afa158015611fa2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fc69190613c0a565b868681518110611fe657634e487b7160e01b600052603260045260246000fd5b6020026020010151610180019015159081151581525050836001600160a01b031663d69fb6686040518163ffffffff1660e01b815260040160206040518083038186803b15801561203657600080fd5b505afa15801561204a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061206e9190613c3e565b86868151811061208e57634e487b7160e01b600052603260045260246000fd5b60200260200101516101a0018181525050836001600160a01b031663cf09e0d06040518163ffffffff1660e01b815260040160206040518083038186803b1580156120d857600080fd5b505afa1580156120ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121109190613c3e565b86868151811061213057634e487b7160e01b600052603260045260246000fd5b60200260200101516101c00181815250505050505080806121509061427a565b9150506112de565b5090505b92915050565b600054610100900460ff1661217d5760005460ff1615612181565b303b155b6121e45760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610c9d565b600054610100900460ff16158015612206576000805461ffff19166101011790555b61220f83610c4b565b60038054610100600160a81b0319166101006001600160a01b038516021790558015612241576000805461ff00191690555b505050565b61224e6138ea565b60038054610100600160a81b0319166101006001600160a01b0385811691820292909217909255600480546001600160a01b03191691841691821790556040805192835260208301919091527f58cdb7e3ecb56fe758429959e8977ca9e1de157dc08685f4b5de5c6db99037e0910160405180910390a15050565b6001546001600160a01b031633146123415760405162461bcd60e51b815260206004820152603560248201527f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7560448201527402063616e20616363657074206f776e65727368697605c1b6064820152608401610c9d565b60005460015460408051620100009093046001600160a01b03908116845290911660208301527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a1600180546000805462010000600160b01b0319166001600160a01b03831662010000021790556001600160a01b0319169055565b60606000826001600160401b038111156123f057634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561248757816020015b604080516101a08101825260008082526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082018190526101608201819052610180820152825260001990920191018161240e5790505b50905060005b838110156121585760008585838181106124b757634e487b7160e01b600052603260045260246000fd5b90506020020160208101906124cc91906139f9565b9050806001600160a01b0316634f8632ba6040518163ffffffff1660e01b815260040160206040518083038186803b15801561250757600080fd5b505afa15801561251b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061253f9190613a1c565b83838151811061255f57634e487b7160e01b600052603260045260246000fd5b6020026020010151600001906001600160a01b031690816001600160a01b031681525050806001600160a01b03166338d52e0f6040518163ffffffff1660e01b815260040160206040518083038186803b1580156125bc57600080fd5b505afa1580156125d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125f49190613c3e565b83838151811061261457634e487b7160e01b600052603260045260246000fd5b60200260200101516020018181525050806001600160a01b03166351d8044f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561265d57600080fd5b505afa158015612671573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126959190613c96565b8383815181106126b557634e487b7160e01b600052603260045260246000fd5b6020026020010151604001906001600160401b031690816001600160401b031681525050806001600160a01b031663c52987cf6040518163ffffffff1660e01b815260040160206040518083038186803b15801561271257600080fd5b505afa158015612726573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061274a9190613c75565b83838151811061276a57634e487b7160e01b600052603260045260246000fd5b60200260200101516060019060070b908160070b81525050806001600160a01b031663645539ed6040518163ffffffff1660e01b815260040160206040518083038186803b1580156127bb57600080fd5b505afa1580156127cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127f39190613c56565b83838151811061281357634e487b7160e01b600052603260045260246000fd5b602002602001015160800190600181111561283e57634e487b7160e01b600052602160045260246000fd5b9081600181111561285f57634e487b7160e01b600052602160045260246000fd5b81525050806001600160a01b0316631fcc8bb26040518163ffffffff1660e01b815260040160206040518083038186803b15801561289c57600080fd5b505afa1580156128b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128d49190613c3e565b8383815181106128f457634e487b7160e01b600052603260045260246000fd5b602002602001015160a0018181525050806001600160a01b0316633f6fa6556040518163ffffffff1660e01b815260040160206040518083038186803b15801561293d57600080fd5b505afa158015612951573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129759190613c0a565b83838151811061299557634e487b7160e01b600052603260045260246000fd5b602002602001015160c0019015159081151581525050806001600160a01b031663a6b513ee6040518163ffffffff1660e01b815260040160206040518083038186803b1580156129e457600080fd5b505afa1580156129f8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a1c9190613c75565b838381518110612a3c57634e487b7160e01b600052603260045260246000fd5b602002602001015160e0019060070b908160070b81525050806001600160a01b031663653721476040518163ffffffff1660e01b815260040160206040518083038186803b158015612a8d57600080fd5b505afa158015612aa1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ac59190613c56565b838381518110612ae557634e487b7160e01b600052603260045260246000fd5b602002602001015161010001906001811115612b1157634e487b7160e01b600052602160045260246000fd5b90816001811115612b3257634e487b7160e01b600052602160045260246000fd5b81525050806001600160a01b0316633a2c1e556040518163ffffffff1660e01b815260040160206040518083038186803b158015612b6f57600080fd5b505afa158015612b83573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ba79190613c0a565b838381518110612bc757634e487b7160e01b600052603260045260246000fd5b60209081029190910101519015156101209091015260035461010090046001600160a01b031663fd6e9b97878785818110612c1257634e487b7160e01b600052603260045260246000fd5b9050602002016020810190612c2791906139f9565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b158015612c6657600080fd5b505afa158015612c7a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c9e9190613c0a565b15612de857806001600160a01b031663d69fb6686040518163ffffffff1660e01b815260040160206040518083038186803b158015612cdc57600080fd5b505afa158015612cf0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d149190613c3e565b838381518110612d3457634e487b7160e01b600052603260045260246000fd5b6020026020010151610140018181525050806001600160a01b031663704ce43e6040518163ffffffff1660e01b815260040160206040518083038186803b158015612d7e57600080fd5b505afa158015612d92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612db69190613c3e565b838381518110612dd657634e487b7160e01b600052603260045260246000fd5b60200260200101516101600181815250505b60035461010090046001600160a01b03166301bea636878785818110612e1e57634e487b7160e01b600052603260045260246000fd5b9050602002016020810190612e3391906139f9565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b158015612e7257600080fd5b505afa158015612e86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612eaa9190613c0a565b15612f5257806001600160a01b031663cf09e0d06040518163ffffffff1660e01b815260040160206040518083038186803b158015612ee857600080fd5b505afa158015612efc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f209190613c3e565b838381518110612f4057634e487b7160e01b600052603260045260246000fd5b60200260200101516101800181815250505b5080612f5d8161427a565b91505061248d565b612f6d613964565b6004805460405163023fb25960e01b81526001600160a01b03858116938201939093526000929091169063023fb2599060240160806040518083038186803b158015612fb857600080fd5b505afa158015612fcc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ff09190613adf565b905061300f604051806040016040528060008152602001600081525090565b600480546040805160016221f06960e01b0319815290516001600160a01b039092169263ffde0f97928282019260209290829003018186803b15801561305457600080fd5b505afa158015613068573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061308c9190613c3e565b8152600480546040805163dc56e7b360e01b815290516001600160a01b039092169263dc56e7b3928282019260209290829003018186803b1580156130d057600080fd5b505afa1580156130e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131089190613c3e565b8160200181815250506000600460009054906101000a90046001600160a01b03166001600160a01b03166323b312156040518163ffffffff1660e01b815260040160206040518083038186803b15801561316157600080fd5b505afa158015613175573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131999190613c3e565b90506000600460009054906101000a90046001600160a01b03166001600160a01b031663f823c6436040518163ffffffff1660e01b815260040160206040518083038186803b1580156131eb57600080fd5b505afa1580156131ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132239190613c3e565b905060006132318383614263565b61323c90600161424b565b90506000816001600160401b0381111561326657634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561328f578160200160208202803683370190505b50905060005b82811015613354576004805460405163c80a4fa560e01b81529182018390526001600160a01b03169063c80a4fa59060240160206040518083038186803b1580156132df57600080fd5b505afa1580156132f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133179190613c3e565b82828151811061333757634e487b7160e01b600052603260045260246000fd5b60209081029190910101528061334c8161427a565b915050613295565b50604080516101a08101825287518152602080890151908201529081016001600160a01b038a1661338657600061338c565b60408801515b81526020016001600160a01b038a166133a65760006133ac565b60608801515b8152602001858152602001848152602001600460009054906101000a90046001600160a01b03166001600160a01b03166335f127526040518163ffffffff1660e01b815260040160206040518083038186803b15801561340b57600080fd5b505afa15801561341f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134439190613c96565b6001600160401b03168152602001600460009054906101000a90046001600160a01b03166001600160a01b0316631b1ad49d6040518163ffffffff1660e01b815260040160206040518083038186803b15801561349f57600080fd5b505afa1580156134b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134d79190613c96565b6001600160401b03168152602001600460009054906101000a90046001600160a01b03166001600160a01b03166312aa38336040518163ffffffff1660e01b815260040160206040518083038186803b15801561353357600080fd5b505afa158015613547573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061356b9190613c3e565b8152602001600460009054906101000a90046001600160a01b03166001600160a01b03166307b53bb46040518163ffffffff1660e01b815260040160206040518083038186803b1580156135be57600080fd5b505afa1580156135d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135f69190613c3e565b8152602001600460009054906101000a90046001600160a01b03166001600160a01b0316636c9259f46040518163ffffffff1660e01b815260040160206040518083038186803b15801561364957600080fd5b505afa15801561365d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136819190613c3e565b81526020810196909652604090950152509195945050505050565b6136a46138ea565b6001600160a01b0381166136ec5760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b6044820152606401610c9d565b600154600160a81b900460ff161561373c5760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481d1c985b9cd9995c9c9959606a1b6044820152606401610c9d565b600080546001600160a01b038381166201000081810262010000600160b01b031990941693909317938490556001805460ff60a81b1916600160a81b1790556040805193909404909116825260208201527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9101610d80565b6040805180820190915260008082526020820152604080518082019091526000808252602082015260035460405163e60a4d2560e01b8152600481018590526101009091046001600160a01b03169063e60a4d259060240160206040518083038186803b15801561382557600080fd5b505afa158015613839573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061385d9190613c3e565b81526003546040516362298c0160e11b8152600481018590526101009091046001600160a01b03169063c45318029060240160206040518083038186803b1580156138a757600080fd5b505afa1580156138bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138df9190613c3e565b602082015292915050565b6000546201000090046001600160a01b031633146139625760405162461bcd60e51b815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201526e37b936903a3434b99030b1ba34b7b760891b6064820152608401610c9d565b565b604051806101a0016040528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160006001600160401b0316815260200160006001600160401b031681526020016000815260200160008152602001600081526020016139ec604051806040016040528060008152602001600081525090565b8152602001606081525090565b600060208284031215613a0a578081fd5b8135613a15816142ab565b9392505050565b600060208284031215613a2d578081fd5b8151613a15816142ab565b60008060408385031215613a4a578081fd5b8235613a55816142ab565b91506020830135613a65816142ab565b809150509250929050565b60008060208385031215613a82578182fd5b82356001600160401b0380821115613a98578384fd5b818501915085601f830112613aab578384fd5b813581811115613ab9578485fd5b8660208260051b8501011115613acd578485fd5b60209290920196919550909350505050565b600060808284031215613af0578081fd5b82601f830112613afe578081fd5b604051608081018181106001600160401b0382111715613b2c57634e487b7160e01b83526041600452602483fd5b604052808360808101861015613b40578384fd5b835b6004811015613b61578151835260209283019290910190600101613b42565b509195945050505050565b600060a08284031215613b7d578081fd5b82601f830112613b8b578081fd5b60405160a081018181106001600160401b0382111715613bb957634e487b7160e01b83526041600452602483fd5b604052808360a08101861015613bcd578384fd5b835b6005811015613b61578151835260209283019290910190600101613bcf565b600060208284031215613bff578081fd5b8135613a15816142c0565b600060208284031215613c1b578081fd5b8151613a15816142c0565b600060208284031215613c37578081fd5b5035919050565b600060208284031215613c4f578081fd5b5051919050565b600060208284031215613c67578081fd5b815160028110613a15578182fd5b600060208284031215613c86578081fd5b81518060070b8114613a15578182fd5b600060208284031215613ca7578081fd5b81516001600160401b0381168114613a15578182fd5b600060208284031215613cce578081fd5b815160ff81168114613a15578182fd5b6000815180845260208085019450808401835b83811015613d1457613d04878351613d80565b9582019590820190600101613cf1565b509495945050505050565b6000815180845260208085019450808401835b83811015613d1457815160070b87529582019590820190600101613d32565b6000815180845260208085019450808401835b83811015613d1457815187529582019590820190600101613d64565b60028110613d9e57634e487b7160e01b600052602160045260246000fd5b9052565b60006020808301818452808551808352604092508286019150828160051b870101848801865b83811015613ee357888303603f19018552815180516001600160a01b031684528781015188850152868101516001600160401b03908116888601526060808301518216908601526080808301519091169085015260a08082015160070b9085015260c0808201516101e08287018190529190613e4683880182613cde565b9250505060e08083015186830382880152613e618382613d1f565b925050506101008083015186830382880152613e7d8382613d1f565b9250505061012080830151818701525061014080830151818701525061016080830151613ead8288018215159052565b5050610180828101511515908601526101a080830151908601526101c09182015191909401529386019390860190600101613dc8565b509098975050505050505050565b602080825282518282018190526000919060409081850190868401855b82811015613fd857815180516001600160a01b031685528681015187860152858101516001600160401b03168686015260608082015160070b90860152608080820151613f5d82880182613d80565b505060a0818101519086015260c08082015115159086015260e08082015160070b9086015261010080820151613f9582880182613d80565b5050610120818101511515908601526101408082015190860152610160808201519086015261018090810151908501526101a09093019290850190600101613f0e565b5091979650505050505050565b602080825282518282018190526000919060409081850190868401855b82811015613fd8578151614017858251613d80565b80870151858801528501518585015260609093019290850190600101614002565b82815260408101613a156020830184613d80565b6020815281516020820152602082015160408201526040820151606082015260608201516080820152608082015160a082015260a082015160c0820152600060c08301516140a560e08401826001600160401b03169052565b5060e08301516101006140c2818501836001600160401b03169052565b84015161012084810191909152840151610140808501919091528401516101608085019190915284015190506101806141078185018380518252602090810151910152565b8401516101c08481015290506141216101e0840182613d51565b949350505050565b81518152602080830151908201526040810161215c565b6020815281516020820152602082015160408201526040820151606082015260608201516080820152608082015160a082015260a082015160c082015260c082015160e0820152600060e08301516101008181850152808501519150506101206141b4818501836001600160401b03169052565b84015190506101406141d0848201836001600160401b03169052565b8085015191505061020061016081818601526141f0610220860184613d51565b9250808601519050610180601f1986850301818701526142108483613d51565b908701516101a0878101919091528701516101c0808801919091528701516101e0808801919091529096015115159190940152509192915050565b6000821982111561425e5761425e614295565b500190565b60008282101561427557614275614295565b500390565b600060001982141561428e5761428e614295565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114610e5457600080fd5b8015158114610e5457600080fdfea26469706673582212208178057bed6776203b24b07aa374cae576567e5ab7e958ee28643ded8d0b55d564736f6c63430008040033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101215760003560e01c80635c975abb116100ad578063b7c46c1e11610071578063b7c46c1e14610290578063c3b83f5f146102b0578063d01b279e146102c3578063d9a10e94146102e3578063dc17ea5b146102fb57600080fd5b80635c975abb1461021b57806379ba5097146102385780638da5cb5b1461024057806391b4ded9146102595780639f293fb11461027057600080fd5b80631ca7415c116100f45780631ca7415c1461018a5780632c303f62146101aa578063485cc955146101ca57806353a47bb7146101dd57806358dc0d631461020857600080fd5b806301a494341461012657806313af40351461014f5780631627540c1461016457806316c38b3c14610177575b600080fd5b6101396101343660046139f9565b61030e565b6040516101469190614140565b60405180910390f35b61016261015d3660046139f9565b610c4b565b005b6101626101723660046139f9565b610d8b565b610162610185366004613bee565b610de1565b61019d610198366004613c26565b610e57565b6040516101469190613fe5565b6101bd6101b8366004613a70565b611208565b6040516101469190613da2565b6101626101d8366004613a38565b612162565b6001546101f0906001600160a01b031681565b6040516001600160a01b039091168152602001610146565b610162610216366004613a38565b612246565b6003546102289060ff1681565b6040519015158152602001610146565b6101626122c9565b6000546101f0906201000090046001600160a01b031681565b61026260025481565b604051908152602001610146565b61028361027e366004613a70565b6123c6565b6040516101469190613ef1565b6102a361029e3660046139f9565b612f65565b604051610146919061404c565b6101626102be3660046139f9565b61369c565b6102d66102d1366004613c26565b6137b5565b6040516101469190614129565b6003546101f09061010090046001600160a01b031681565b6004546101f0906001600160a01b031681565b6103a2604051806102000160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160006001600160401b0316815260200160006001600160401b0316815260200160608152602001606081526020016000815260200160008152602001600081526020016000151581525090565b60035460405163023fb25960e01b81526001600160a01b0384811660048301526000926101009004169063023fb2599060240160a06040518083038186803b1580156103ed57600080fd5b505afa158015610401573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104259190613b6c565b60808101519091506000816001600160401b0381111561045557634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561047e578160200160208202803683370190505b5090506000826001600160401b038111156104a957634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156104d2578160200160208202803683370190505b50905060005b8381101561064857600354604051632b18dfc560e11b8152600481018390526101009091046001600160a01b031690635631bf8a9060240160206040518083038186803b15801561052857600080fd5b505afa15801561053c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105609190613c3e565b83828151811061058057634e487b7160e01b600052603260045260246000fd5b6020908102919091010152600354604051634eb7c43b60e01b8152600481018390526101009091046001600160a01b031690634eb7c43b9060240160206040518083038186803b1580156105d357600080fd5b505afa1580156105e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060b9190613c3e565b82828151811061062b57634e487b7160e01b600052603260045260246000fd5b6020908102919091010152806106408161427a565b9150506104d8565b50604080516102008101825285518152602080870151908201529081016001600160a01b03881661067a576000610680565b60408601515b81526020016001600160a01b03881661069a5760006106a0565b60608601515b8152602001600360019054906101000a90046001600160a01b03166001600160a01b03166312aa38336040518163ffffffff1660e01b815260040160206040518083038186803b1580156106f357600080fd5b505afa158015610707573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072b9190613c3e565b8152602001600360019054906101000a90046001600160a01b03166001600160a01b03166307b53bb46040518163ffffffff1660e01b815260040160206040518083038186803b15801561077e57600080fd5b505afa158015610792573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b69190613c3e565b8152602001600360019054906101000a90046001600160a01b03166001600160a01b0316633e7ad1de6040518163ffffffff1660e01b815260040160206040518083038186803b15801561080957600080fd5b505afa15801561081d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108419190613c3e565b8152602001600360019054906101000a90046001600160a01b03166001600160a01b0316635403f80f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561089457600080fd5b505afa1580156108a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108cc9190613c3e565b8152602001600360019054906101000a90046001600160a01b03166001600160a01b031663a201b3076040518163ffffffff1660e01b815260040160206040518083038186803b15801561091f57600080fd5b505afa158015610933573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109579190613c96565b6001600160401b03168152602001600360019054906101000a90046001600160a01b03166001600160a01b031663cf898ca96040518163ffffffff1660e01b815260040160206040518083038186803b1580156109b357600080fd5b505afa1580156109c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109eb9190613c96565b6001600160401b03168152602001838152602001828152602001600360019054906101000a90046001600160a01b03166001600160a01b031663704ce43e6040518163ffffffff1660e01b815260040160206040518083038186803b158015610a5357600080fd5b505afa158015610a67573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8b9190613c3e565b8152602001600360019054906101000a90046001600160a01b03166001600160a01b031663e91558666040518163ffffffff1660e01b815260040160206040518083038186803b158015610ade57600080fd5b505afa158015610af2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b169190613c3e565b8152602001600360019054906101000a90046001600160a01b03166001600160a01b031663d69fb6686040518163ffffffff1660e01b815260040160206040518083038186803b158015610b6957600080fd5b505afa158015610b7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba19190613c3e565b81526020016001600160a01b038816610bbb576000610c3d565b60035460405162d9267b60e31b81526001600160a01b038a81166004830152610100909204909116906306c933d89060240160206040518083038186803b158015610c0557600080fd5b505afa158015610c19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c3d9190613c0a565b151590529695505050505050565b6001600160a01b038116610ca65760405162461bcd60e51b815260206004820152601960248201527f4f776e657220616464726573732063616e6e6f7420626520300000000000000060448201526064015b60405180910390fd5b600154600160a01b900460ff1615610d125760405162461bcd60e51b815260206004820152602960248201527f416c726561647920696e697469616c697a65642c20757365206e6f6d696e617460448201526832a732bba7bbb732b960b91b6064820152608401610c9d565b6001805460ff60a01b1916600160a01b179055600080546001600160a01b03831662010000810262010000600160b01b03199092169190911782556040805192835260208301919091527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c91015b60405180910390a150565b610d936138ea565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce2290602001610d80565b610de96138ea565b60035460ff1615158115151415610dfd5750565b6003805460ff191682151590811790915560ff1615610e1b57426002555b60035460405160ff909116151581527f8fb6c181ee25a520cf3dd6565006ef91229fcfe5a989566c2a3b8c115570cec590602001610d80565b50565b60408051600280825260608083018452926000929190602083019080368337019050509050600081600081518110610e9f57634e487b7160e01b600052603260045260246000fd5b60200260200101906001811115610ec657634e487b7160e01b600052602160045260246000fd5b90816001811115610ee757634e487b7160e01b600052602160045260246000fd5b81525050600181600181518110610f0e57634e487b7160e01b600052603260045260246000fd5b60200260200101906001811115610f3557634e487b7160e01b600052602160045260246000fd5b90816001811115610f5657634e487b7160e01b600052602160045260246000fd5b81525050600081516001600160401b03811115610f8357634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610fd957816020015b610fc66040805160608101909152806000815260200160008152602001600081525090565b815260200190600190039081610fa15790505b50905060005b825181101561120057600083828151811061100a57634e487b7160e01b600052603260045260246000fd5b602002602001015190508083838151811061103557634e487b7160e01b600052603260045260246000fd5b602002602001015160000190600181111561106057634e487b7160e01b600052602160045260246000fd5b9081600181111561108157634e487b7160e01b600052602160045260246000fd5b90525060035460405163016ff7f560e21b81526101009091046001600160a01b0316906305bfdfd4906110ba9089908590600401614038565b60206040518083038186803b1580156110d257600080fd5b505afa1580156110e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061110a9190613c3e565b83838151811061112a57634e487b7160e01b600052603260045260246000fd5b602090810291909101810151015260035460405163e11f951d60e01b81526101009091046001600160a01b03169063e11f951d9061116e9089908590600401614038565b60206040518083038186803b15801561118657600080fd5b505afa15801561119a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111be9190613c3e565b8383815181106111de57634e487b7160e01b600052603260045260246000fd5b60209081029190910101516040015250806111f88161427a565b915050610fdf565b509392505050565b60606000826001600160401b0381111561123257634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156112d857816020015b604080516101e0810182526000808252602080830182905292820181905260608083018290526080830182905260a0830182905260c0830181905260e0830181905261010083015261012082018190526101408201819052610160820181905261018082018190526101a082018190526101c082015282526000199092019101816112505790505b50905060005b8381101561215857600085858381811061130857634e487b7160e01b600052603260045260246000fd5b905060200201602081019061131d91906139f9565b9050806001600160a01b0316634f8632ba6040518163ffffffff1660e01b815260040160206040518083038186803b15801561135857600080fd5b505afa15801561136c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113909190613a1c565b8383815181106113b057634e487b7160e01b600052603260045260246000fd5b6020026020010151600001906001600160a01b031690816001600160a01b031681525050806001600160a01b03166338d52e0f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561140d57600080fd5b505afa158015611421573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114459190613c3e565b83838151811061146557634e487b7160e01b600052603260045260246000fd5b60200260200101516020018181525050806001600160a01b0316638b13b64b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156114ae57600080fd5b505afa1580156114c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114e69190613c96565b83838151811061150657634e487b7160e01b600052603260045260246000fd5b6020026020010151604001906001600160401b031690816001600160401b031681525050806001600160a01b03166320c1bb466040518163ffffffff1660e01b815260040160206040518083038186803b15801561156357600080fd5b505afa158015611577573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061159b9190613c96565b8383815181106115bb57634e487b7160e01b600052603260045260246000fd5b6020026020010151606001906001600160401b031690816001600160401b031681525050806001600160a01b03166351d8044f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561161857600080fd5b505afa15801561162c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116509190613c96565b83838151811061167057634e487b7160e01b600052603260045260246000fd5b6020026020010151608001906001600160401b031690816001600160401b031681525050806001600160a01b031663855d68cb6040518163ffffffff1660e01b815260040160206040518083038186803b1580156116cd57600080fd5b505afa1580156116e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117059190613c75565b83838151811061172557634e487b7160e01b600052603260045260246000fd5b602002602001015160a0019060070b908160070b815250506000816001600160a01b031663e004b5bf6040518163ffffffff1660e01b815260040160206040518083038186803b15801561177857600080fd5b505afa15801561178c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117b09190613cbd565b60ff166001600160401b038111156117d857634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611801578160200160208202803683370190505b5090506000826001600160a01b03166377680bb56040518163ffffffff1660e01b815260040160206040518083038186803b15801561183f57600080fd5b505afa158015611853573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118779190613c3e565b6001600160401b0381111561189c57634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156118c5578160200160208202803683370190505b5090506000836001600160a01b03166377680bb56040518163ffffffff1660e01b815260040160206040518083038186803b15801561190357600080fd5b505afa158015611917573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061193b9190613c3e565b6001600160401b0381111561196057634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611989578160200160208202803683370190505b50905060005b846001600160a01b031663e004b5bf6040518163ffffffff1660e01b815260040160206040518083038186803b1580156119c857600080fd5b505afa1580156119dc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a009190613cbd565b60ff16811015611cd757604051635f51b5c760e01b8152600481018290526001600160a01b03861690635f51b5c79060240160206040518083038186803b158015611a4a57600080fd5b505afa158015611a5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a829190613c56565b848281518110611aa257634e487b7160e01b600052603260045260246000fd5b60200260200101906001811115611ac957634e487b7160e01b600052602160045260246000fd5b90816001811115611aea57634e487b7160e01b600052602160045260246000fd5b81525050846001600160a01b03166377680bb56040518163ffffffff1660e01b815260040160206040518083038186803b158015611b2757600080fd5b505afa158015611b3b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b5f9190613c3e565b811015611cc5576040516317a569fb60e11b8152600481018290526001600160a01b03861690632f4ad3f69060240160206040518083038186803b158015611ba657600080fd5b505afa158015611bba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bde9190613c75565b838281518110611bfe57634e487b7160e01b600052603260045260246000fd5b602002602001019060070b908160070b81525050846001600160a01b0316634e2c1460826040518263ffffffff1660e01b8152600401611c4091815260200190565b60206040518083038186803b158015611c5857600080fd5b505afa158015611c6c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c909190613c75565b828281518110611cb057634e487b7160e01b600052603260045260246000fd5b602002602001019060070b908160070b815250505b80611ccf8161427a565b91505061198f565b5082868681518110611cf957634e487b7160e01b600052603260045260246000fd5b602002602001015160c0018190525081868681518110611d2957634e487b7160e01b600052603260045260246000fd5b602002602001015160e0018190525080868681518110611d5957634e487b7160e01b600052603260045260246000fd5b60200260200101516101000181905250836001600160a01b0316631fcc8bb26040518163ffffffff1660e01b815260040160206040518083038186803b158015611da257600080fd5b505afa158015611db6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dda9190613c3e565b868681518110611dfa57634e487b7160e01b600052603260045260246000fd5b6020026020010151610120018181525050836001600160a01b0316635c8127376040518163ffffffff1660e01b815260040160206040518083038186803b158015611e4457600080fd5b505afa158015611e58573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e7c9190613c3e565b868681518110611e9c57634e487b7160e01b600052603260045260246000fd5b6020026020010151610140018181525050836001600160a01b0316633f6fa6556040518163ffffffff1660e01b815260040160206040518083038186803b158015611ee657600080fd5b505afa158015611efa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1e9190613c0a565b868681518110611f3e57634e487b7160e01b600052603260045260246000fd5b6020026020010151610160019015159081151581525050836001600160a01b0316633a2c1e556040518163ffffffff1660e01b815260040160206040518083038186803b158015611f8e57600080fd5b505afa158015611fa2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fc69190613c0a565b868681518110611fe657634e487b7160e01b600052603260045260246000fd5b6020026020010151610180019015159081151581525050836001600160a01b031663d69fb6686040518163ffffffff1660e01b815260040160206040518083038186803b15801561203657600080fd5b505afa15801561204a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061206e9190613c3e565b86868151811061208e57634e487b7160e01b600052603260045260246000fd5b60200260200101516101a0018181525050836001600160a01b031663cf09e0d06040518163ffffffff1660e01b815260040160206040518083038186803b1580156120d857600080fd5b505afa1580156120ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121109190613c3e565b86868151811061213057634e487b7160e01b600052603260045260246000fd5b60200260200101516101c00181815250505050505080806121509061427a565b9150506112de565b5090505b92915050565b600054610100900460ff1661217d5760005460ff1615612181565b303b155b6121e45760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610c9d565b600054610100900460ff16158015612206576000805461ffff19166101011790555b61220f83610c4b565b60038054610100600160a81b0319166101006001600160a01b038516021790558015612241576000805461ff00191690555b505050565b61224e6138ea565b60038054610100600160a81b0319166101006001600160a01b0385811691820292909217909255600480546001600160a01b03191691841691821790556040805192835260208301919091527f58cdb7e3ecb56fe758429959e8977ca9e1de157dc08685f4b5de5c6db99037e0910160405180910390a15050565b6001546001600160a01b031633146123415760405162461bcd60e51b815260206004820152603560248201527f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7560448201527402063616e20616363657074206f776e65727368697605c1b6064820152608401610c9d565b60005460015460408051620100009093046001600160a01b03908116845290911660208301527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a1600180546000805462010000600160b01b0319166001600160a01b03831662010000021790556001600160a01b0319169055565b60606000826001600160401b038111156123f057634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561248757816020015b604080516101a08101825260008082526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082018190526101608201819052610180820152825260001990920191018161240e5790505b50905060005b838110156121585760008585838181106124b757634e487b7160e01b600052603260045260246000fd5b90506020020160208101906124cc91906139f9565b9050806001600160a01b0316634f8632ba6040518163ffffffff1660e01b815260040160206040518083038186803b15801561250757600080fd5b505afa15801561251b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061253f9190613a1c565b83838151811061255f57634e487b7160e01b600052603260045260246000fd5b6020026020010151600001906001600160a01b031690816001600160a01b031681525050806001600160a01b03166338d52e0f6040518163ffffffff1660e01b815260040160206040518083038186803b1580156125bc57600080fd5b505afa1580156125d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125f49190613c3e565b83838151811061261457634e487b7160e01b600052603260045260246000fd5b60200260200101516020018181525050806001600160a01b03166351d8044f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561265d57600080fd5b505afa158015612671573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126959190613c96565b8383815181106126b557634e487b7160e01b600052603260045260246000fd5b6020026020010151604001906001600160401b031690816001600160401b031681525050806001600160a01b031663c52987cf6040518163ffffffff1660e01b815260040160206040518083038186803b15801561271257600080fd5b505afa158015612726573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061274a9190613c75565b83838151811061276a57634e487b7160e01b600052603260045260246000fd5b60200260200101516060019060070b908160070b81525050806001600160a01b031663645539ed6040518163ffffffff1660e01b815260040160206040518083038186803b1580156127bb57600080fd5b505afa1580156127cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127f39190613c56565b83838151811061281357634e487b7160e01b600052603260045260246000fd5b602002602001015160800190600181111561283e57634e487b7160e01b600052602160045260246000fd5b9081600181111561285f57634e487b7160e01b600052602160045260246000fd5b81525050806001600160a01b0316631fcc8bb26040518163ffffffff1660e01b815260040160206040518083038186803b15801561289c57600080fd5b505afa1580156128b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128d49190613c3e565b8383815181106128f457634e487b7160e01b600052603260045260246000fd5b602002602001015160a0018181525050806001600160a01b0316633f6fa6556040518163ffffffff1660e01b815260040160206040518083038186803b15801561293d57600080fd5b505afa158015612951573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129759190613c0a565b83838151811061299557634e487b7160e01b600052603260045260246000fd5b602002602001015160c0019015159081151581525050806001600160a01b031663a6b513ee6040518163ffffffff1660e01b815260040160206040518083038186803b1580156129e457600080fd5b505afa1580156129f8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a1c9190613c75565b838381518110612a3c57634e487b7160e01b600052603260045260246000fd5b602002602001015160e0019060070b908160070b81525050806001600160a01b031663653721476040518163ffffffff1660e01b815260040160206040518083038186803b158015612a8d57600080fd5b505afa158015612aa1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ac59190613c56565b838381518110612ae557634e487b7160e01b600052603260045260246000fd5b602002602001015161010001906001811115612b1157634e487b7160e01b600052602160045260246000fd5b90816001811115612b3257634e487b7160e01b600052602160045260246000fd5b81525050806001600160a01b0316633a2c1e556040518163ffffffff1660e01b815260040160206040518083038186803b158015612b6f57600080fd5b505afa158015612b83573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ba79190613c0a565b838381518110612bc757634e487b7160e01b600052603260045260246000fd5b60209081029190910101519015156101209091015260035461010090046001600160a01b031663fd6e9b97878785818110612c1257634e487b7160e01b600052603260045260246000fd5b9050602002016020810190612c2791906139f9565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b158015612c6657600080fd5b505afa158015612c7a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c9e9190613c0a565b15612de857806001600160a01b031663d69fb6686040518163ffffffff1660e01b815260040160206040518083038186803b158015612cdc57600080fd5b505afa158015612cf0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d149190613c3e565b838381518110612d3457634e487b7160e01b600052603260045260246000fd5b6020026020010151610140018181525050806001600160a01b031663704ce43e6040518163ffffffff1660e01b815260040160206040518083038186803b158015612d7e57600080fd5b505afa158015612d92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612db69190613c3e565b838381518110612dd657634e487b7160e01b600052603260045260246000fd5b60200260200101516101600181815250505b60035461010090046001600160a01b03166301bea636878785818110612e1e57634e487b7160e01b600052603260045260246000fd5b9050602002016020810190612e3391906139f9565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b158015612e7257600080fd5b505afa158015612e86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612eaa9190613c0a565b15612f5257806001600160a01b031663cf09e0d06040518163ffffffff1660e01b815260040160206040518083038186803b158015612ee857600080fd5b505afa158015612efc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f209190613c3e565b838381518110612f4057634e487b7160e01b600052603260045260246000fd5b60200260200101516101800181815250505b5080612f5d8161427a565b91505061248d565b612f6d613964565b6004805460405163023fb25960e01b81526001600160a01b03858116938201939093526000929091169063023fb2599060240160806040518083038186803b158015612fb857600080fd5b505afa158015612fcc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ff09190613adf565b905061300f604051806040016040528060008152602001600081525090565b600480546040805160016221f06960e01b0319815290516001600160a01b039092169263ffde0f97928282019260209290829003018186803b15801561305457600080fd5b505afa158015613068573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061308c9190613c3e565b8152600480546040805163dc56e7b360e01b815290516001600160a01b039092169263dc56e7b3928282019260209290829003018186803b1580156130d057600080fd5b505afa1580156130e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131089190613c3e565b8160200181815250506000600460009054906101000a90046001600160a01b03166001600160a01b03166323b312156040518163ffffffff1660e01b815260040160206040518083038186803b15801561316157600080fd5b505afa158015613175573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131999190613c3e565b90506000600460009054906101000a90046001600160a01b03166001600160a01b031663f823c6436040518163ffffffff1660e01b815260040160206040518083038186803b1580156131eb57600080fd5b505afa1580156131ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132239190613c3e565b905060006132318383614263565b61323c90600161424b565b90506000816001600160401b0381111561326657634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561328f578160200160208202803683370190505b50905060005b82811015613354576004805460405163c80a4fa560e01b81529182018390526001600160a01b03169063c80a4fa59060240160206040518083038186803b1580156132df57600080fd5b505afa1580156132f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133179190613c3e565b82828151811061333757634e487b7160e01b600052603260045260246000fd5b60209081029190910101528061334c8161427a565b915050613295565b50604080516101a08101825287518152602080890151908201529081016001600160a01b038a1661338657600061338c565b60408801515b81526020016001600160a01b038a166133a65760006133ac565b60608801515b8152602001858152602001848152602001600460009054906101000a90046001600160a01b03166001600160a01b03166335f127526040518163ffffffff1660e01b815260040160206040518083038186803b15801561340b57600080fd5b505afa15801561341f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134439190613c96565b6001600160401b03168152602001600460009054906101000a90046001600160a01b03166001600160a01b0316631b1ad49d6040518163ffffffff1660e01b815260040160206040518083038186803b15801561349f57600080fd5b505afa1580156134b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134d79190613c96565b6001600160401b03168152602001600460009054906101000a90046001600160a01b03166001600160a01b03166312aa38336040518163ffffffff1660e01b815260040160206040518083038186803b15801561353357600080fd5b505afa158015613547573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061356b9190613c3e565b8152602001600460009054906101000a90046001600160a01b03166001600160a01b03166307b53bb46040518163ffffffff1660e01b815260040160206040518083038186803b1580156135be57600080fd5b505afa1580156135d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135f69190613c3e565b8152602001600460009054906101000a90046001600160a01b03166001600160a01b0316636c9259f46040518163ffffffff1660e01b815260040160206040518083038186803b15801561364957600080fd5b505afa15801561365d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136819190613c3e565b81526020810196909652604090950152509195945050505050565b6136a46138ea565b6001600160a01b0381166136ec5760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b6044820152606401610c9d565b600154600160a81b900460ff161561373c5760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481d1c985b9cd9995c9c9959606a1b6044820152606401610c9d565b600080546001600160a01b038381166201000081810262010000600160b01b031990941693909317938490556001805460ff60a81b1916600160a81b1790556040805193909404909116825260208201527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9101610d80565b6040805180820190915260008082526020820152604080518082019091526000808252602082015260035460405163e60a4d2560e01b8152600481018590526101009091046001600160a01b03169063e60a4d259060240160206040518083038186803b15801561382557600080fd5b505afa158015613839573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061385d9190613c3e565b81526003546040516362298c0160e11b8152600481018590526101009091046001600160a01b03169063c45318029060240160206040518083038186803b1580156138a757600080fd5b505afa1580156138bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138df9190613c3e565b602082015292915050565b6000546201000090046001600160a01b031633146139625760405162461bcd60e51b815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201526e37b936903a3434b99030b1ba34b7b760891b6064820152608401610c9d565b565b604051806101a0016040528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160006001600160401b0316815260200160006001600160401b031681526020016000815260200160008152602001600081526020016139ec604051806040016040528060008152602001600081525090565b8152602001606081525090565b600060208284031215613a0a578081fd5b8135613a15816142ab565b9392505050565b600060208284031215613a2d578081fd5b8151613a15816142ab565b60008060408385031215613a4a578081fd5b8235613a55816142ab565b91506020830135613a65816142ab565b809150509250929050565b60008060208385031215613a82578182fd5b82356001600160401b0380821115613a98578384fd5b818501915085601f830112613aab578384fd5b813581811115613ab9578485fd5b8660208260051b8501011115613acd578485fd5b60209290920196919550909350505050565b600060808284031215613af0578081fd5b82601f830112613afe578081fd5b604051608081018181106001600160401b0382111715613b2c57634e487b7160e01b83526041600452602483fd5b604052808360808101861015613b40578384fd5b835b6004811015613b61578151835260209283019290910190600101613b42565b509195945050505050565b600060a08284031215613b7d578081fd5b82601f830112613b8b578081fd5b60405160a081018181106001600160401b0382111715613bb957634e487b7160e01b83526041600452602483fd5b604052808360a08101861015613bcd578384fd5b835b6005811015613b61578151835260209283019290910190600101613bcf565b600060208284031215613bff578081fd5b8135613a15816142c0565b600060208284031215613c1b578081fd5b8151613a15816142c0565b600060208284031215613c37578081fd5b5035919050565b600060208284031215613c4f578081fd5b5051919050565b600060208284031215613c67578081fd5b815160028110613a15578182fd5b600060208284031215613c86578081fd5b81518060070b8114613a15578182fd5b600060208284031215613ca7578081fd5b81516001600160401b0381168114613a15578182fd5b600060208284031215613cce578081fd5b815160ff81168114613a15578182fd5b6000815180845260208085019450808401835b83811015613d1457613d04878351613d80565b9582019590820190600101613cf1565b509495945050505050565b6000815180845260208085019450808401835b83811015613d1457815160070b87529582019590820190600101613d32565b6000815180845260208085019450808401835b83811015613d1457815187529582019590820190600101613d64565b60028110613d9e57634e487b7160e01b600052602160045260246000fd5b9052565b60006020808301818452808551808352604092508286019150828160051b870101848801865b83811015613ee357888303603f19018552815180516001600160a01b031684528781015188850152868101516001600160401b03908116888601526060808301518216908601526080808301519091169085015260a08082015160070b9085015260c0808201516101e08287018190529190613e4683880182613cde565b9250505060e08083015186830382880152613e618382613d1f565b925050506101008083015186830382880152613e7d8382613d1f565b9250505061012080830151818701525061014080830151818701525061016080830151613ead8288018215159052565b5050610180828101511515908601526101a080830151908601526101c09182015191909401529386019390860190600101613dc8565b509098975050505050505050565b602080825282518282018190526000919060409081850190868401855b82811015613fd857815180516001600160a01b031685528681015187860152858101516001600160401b03168686015260608082015160070b90860152608080820151613f5d82880182613d80565b505060a0818101519086015260c08082015115159086015260e08082015160070b9086015261010080820151613f9582880182613d80565b5050610120818101511515908601526101408082015190860152610160808201519086015261018090810151908501526101a09093019290850190600101613f0e565b5091979650505050505050565b602080825282518282018190526000919060409081850190868401855b82811015613fd8578151614017858251613d80565b80870151858801528501518585015260609093019290850190600101614002565b82815260408101613a156020830184613d80565b6020815281516020820152602082015160408201526040820151606082015260608201516080820152608082015160a082015260a082015160c0820152600060c08301516140a560e08401826001600160401b03169052565b5060e08301516101006140c2818501836001600160401b03169052565b84015161012084810191909152840151610140808501919091528401516101608085019190915284015190506101806141078185018380518252602090810151910152565b8401516101c08481015290506141216101e0840182613d51565b949350505050565b81518152602080830151908201526040810161215c565b6020815281516020820152602082015160408201526040820151606082015260608201516080820152608082015160a082015260a082015160c082015260c082015160e0820152600060e08301516101008181850152808501519150506101206141b4818501836001600160401b03169052565b84015190506101406141d0848201836001600160401b03169052565b8085015191505061020061016081818601526141f0610220860184613d51565b9250808601519050610180601f1986850301818701526142108483613d51565b908701516101a0878101919091528701516101c0808801919091528701516101e0808801919091529096015115159190940152509192915050565b6000821982111561425e5761425e614295565b500190565b60008282101561427557614275614295565b500390565b600060001982141561428e5761428e614295565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114610e5457600080fd5b8015158114610e5457600080fdfea26469706673582212208178057bed6776203b24b07aa374cae576567e5ab7e958ee28643ded8d0b55d564736f6c63430008040033

Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.