false
true
0

Contract Address Details

0x002F5CeC9303dAbcf1f47b3d91a4c47D9ca7fC73

Contract Name
BetEthPrice
Creator
0xb580f7–5bbe66 at 0x630a8a–a1f421
Balance
0 PLS ( )
Tokens
Fetching tokens...
Transactions
Fetching transactions...
Transfers
Fetching transfers...
Gas Used
Fetching gas used...
Last Balance Update
26349372
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
This contract has been partially verified via Sourcify. View contract in Sourcify repository
Contract name:
BetEthPrice




Optimization enabled
true
Compiler version
v0.5.17+commit.d19bba13




Optimization runs
200
EVM Version
istanbul




Verified at
2026-04-22T03:09:21.635641Z

BetEthPrice.sol

pragma solidity ^0.5.16;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return sub(a, b, "SafeMath: subtraction overflow");
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     * - Subtraction cannot overflow.
     *
     * _Available since v2.4.0._
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        uint256 c = a - b;

        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return div(a, b, "SafeMath: division by zero");
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     *
     * _Available since v2.4.0._
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        // Solidity only automatically asserts when dividing by 0
        require(b > 0, errorMessage);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return mod(a, b, "SafeMath: modulo by zero");
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts with custom message when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     *
     * _Available since v2.4.0._
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}


interface TokenInterface {
    function decimals() external view returns (uint);
    function allowance(address, address) external view returns (uint);
    function balanceOf(address) external view returns (uint);
    function approve(address, uint) external;
    function transfer(address, uint) external returns (bool);
    function transferFrom(address, address, uint) external returns (bool);
    function deposit() external payable;
    function withdraw(uint) external;
}

contract ETHUSD {
    function read() external view returns (bytes32);
}

contract BetEthPrice {
    using SafeMath for uint256;

    struct Bet {
        uint256 betCoef;
        uint256 amountUsd;
    }

    mapping(address => Bet) public betsHighPrice;
    mapping(address => Bet) public betsLowPrice;

    bool public isExistsBetsHighPrice;
    bool public isExistsBetsLowPrice;

    ETHUSD public oracleUsd;
    TokenInterface public usdToken;

    uint256 public targetPrice;
    uint256 public endTime;

    bool public isFinalized;
    bool public isCanceled;

    bool public isHighPriceWin;

    uint256 public totalHighPriceCoef;
    uint256 public totalLowPriceCoef;

    uint256 public finalBalance;

    // TODO: params
    constructor() public {
        oracleUsd = ETHUSD(0x729D19f657BD0614b4985Cf1D82531c67569197B);  // MainNet Medianizer MakerDao (pip): 0x729D19f657BD0614b4985Cf1D82531c67569197B
        usdToken = TokenInterface(0xdAC17F958D2ee523a2206206994597C13D831ec7);  // MainNet USDT: 0xdAC17F958D2ee523a2206206994597C13D831ec7

        targetPrice = 70 * 1e18;  // equals 80.000 eth (1e18) – price should multiple of 10
        endTime = 1588291200;  // 01.05.2020 @ 12:00am (UTC)
    }


    function betOnHighPrice(uint256 amount) public {
        _bet(msg.sender, amount, true);
    }

    function betOnHighPrice(address beneficiary, uint256 amount) public {
        _bet(beneficiary, amount, true);
    }


    function betOnLowPrice(uint256 amount) public {
        _bet(msg.sender, amount, false);
    }

    function betOnLowPrice(address beneficiary, uint256 amount) public {
        _bet(beneficiary, amount, false);
    }

    // finalize Betting (time is over or price is lower than targetPrice)
    function finalize() public {
        require(!isFinalized, "Have already finilized");

        bool isLowWin = (getCurPriceUsd() <= targetPrice);
        bool isHighWin = (!isLowWin && (now >= endTime));
        require(isLowWin || isHighWin, "Betting is active");

        // set win bets
        isHighPriceWin = isHighWin;

        // if no winners – cancel betting
        if ((isHighWin && !isExistsBetsHighPrice)
         || (!isHighWin && !isExistsBetsLowPrice)) {
            isCanceled = true;
            return;
        }

        finalBalance = usdToken.balanceOf(address(this));
        isFinalized = true;
    }

    function withdrawPrize() public  {
        require(isFinalized, "Betting is active or cancel");

        uint256 amount = 0;
        if (isHighPriceWin) {
            amount = finalBalance.mul(betsHighPrice[msg.sender].betCoef).div(totalHighPriceCoef);

            // set user's betCoef state as 0
            betsHighPrice[msg.sender].betCoef = 0;
        } else {
            amount = finalBalance.mul(betsLowPrice[msg.sender].betCoef).div(totalLowPriceCoef);

            // set user's betCoef state as 0
            betsLowPrice[msg.sender].betCoef = 0;
        }

        // transfer prize to user
        usdToken.transfer(msg.sender, amount);
    }

    function withdrawCanceled() public {
        require(isCanceled, "Betting is not canceled");

        // transfer user's bet to user
        usdToken.transfer(msg.sender, betsLowPrice[msg.sender].amountUsd.add(betsHighPrice[msg.sender].amountUsd));
    }


    // **VIEW functions**

    // function getUsdtBalance() public view returns(uint256 usdtBalance) {
    //     usdtBalance = usdToken.balanceOf(address(this));
    // }

    function getCurPriceUsd() public view returns(uint256) {
        return uint256(oracleUsd.read());  // USD price call to MakerDao Oracles – Medianizer contract
    }

    function getTimeLeft() public view returns(uint256) {
        uint256 curEndTime = endTime;
        if (curEndTime > now) {
            return curEndTime - now;
        }

        return 0;
    }


    // **INTERNAL functions**

    function _bet(address beneficiary, uint256 amount, bool isHighPrice) internal {
        require(now < endTime, "Betting time is over");
        require(amount > 0, "USD should be more than 0");

        // transfer USD from msg.sender to this contract
        usdToken.transferFrom(msg.sender, address(this), amount);

        uint256 priceUsd = getCurPriceUsd();
        uint256 timeLeft = getTimeLeft();
        uint256 curBetCoef = 0;

        if (isHighPrice) {
            curBetCoef = amount.mul(timeLeft).mul(1e21).div(priceUsd);  // amount * timeLeft / priceUsd

            // set states
            betsHighPrice[beneficiary].betCoef = betsHighPrice[beneficiary].betCoef.add(curBetCoef);
            totalHighPriceCoef = totalHighPriceCoef.add(curBetCoef);

            betsHighPrice[beneficiary].amountUsd = betsHighPrice[beneficiary].amountUsd.add(amount);
        } else {
            curBetCoef = amount.mul(timeLeft).mul(priceUsd).div(1e18);  // amount * timeLeft * priceUsd

            // set states
            betsLowPrice[beneficiary].betCoef = betsLowPrice[beneficiary].betCoef.add(curBetCoef);
            totalLowPriceCoef = totalLowPriceCoef.add(curBetCoef);

            betsLowPrice[beneficiary].amountUsd = betsLowPrice[beneficiary].amountUsd.add(amount);
        }

        // if no betters
        if (!isExistsBetsHighPrice && isHighPrice) {
            isExistsBetsHighPrice = true;
        } else if (!isExistsBetsLowPrice && !isHighPrice) {
            isExistsBetsLowPrice = true;
        }
    }
}
        

Compiler Settings

{"remappings":[],"optimizer":{"runs":200,"enabled":true},"libraries":{},"evmVersion":"istanbul","compilationTarget":{"BetEthPrice.sol":"BetEthPrice"}}
              

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","payable":false,"inputs":[]},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"betOnHighPrice","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"betOnHighPrice","inputs":[{"type":"address","name":"beneficiary","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"betOnLowPrice","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"betOnLowPrice","inputs":[{"type":"address","name":"beneficiary","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"betCoef","internalType":"uint256"},{"type":"uint256","name":"amountUsd","internalType":"uint256"}],"name":"betsHighPrice","inputs":[{"type":"address","name":"","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"betCoef","internalType":"uint256"},{"type":"uint256","name":"amountUsd","internalType":"uint256"}],"name":"betsLowPrice","inputs":[{"type":"address","name":"","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"endTime","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"finalBalance","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"finalize","inputs":[],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getCurPriceUsd","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getTimeLeft","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isCanceled","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isExistsBetsHighPrice","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isExistsBetsLowPrice","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isFinalized","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isHighPriceWin","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"contract ETHUSD"}],"name":"oracleUsd","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"targetPrice","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalHighPriceCoef","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalLowPriceCoef","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"contract TokenInterface"}],"name":"usdToken","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"withdrawCanceled","inputs":[],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"withdrawPrize","inputs":[],"constant":false}]
              

Contract Creation Code

Verify & Publish
0x608060405234801561001057600080fd5b506002805475729d19f657bd0614b4985cf1d82531c67569197b000062010000600160b01b0319909116179055600380546001600160a01b03191673dac17f958d2ee523a2206206994597c13d831ec71790556803cb71f51fc5580000600455635eab6680600555610e18806100876000396000f3fe608060405234801561001057600080fd5b506004361061014d5760003560e01c80636f3fce63116100c3578063c7e284b81161007c578063c7e284b81461026c578063dc38679c14610274578063e693561d1461027c578063eb396ce7146102bb578063f6c577f8146102e1578063f897a22b1461030d5761014d565b80636f3fce63146101e75780637214de1414610204578063739da009146102305780638d4e408314610238578063bc4835ef14610240578063bcfdf549146102485761014d565b80633197cbb6116101155780633197cbb6146101b757806348d37a58146101bf5780634bb278f3146101c7578063512a3342146101cf57806351f7cb07146101d7578063616a5920146101df5761014d565b8063010b03ee146101525780630aa971f3146101715780630ed5a9331461018b5780631a63cca5146101a75780632129e25a146101af575b600080fd5b61016f6004803603602081101561016857600080fd5b5035610315565b005b610179610324565b60408051918252519081900360200190f35b6101936103a5565b604080519115158252519081900360200190f35b6101936103b3565b6101796103bc565b6101796103c2565b61016f6103c8565b61016f610542565b6101936106f3565b610179610701565b610179610707565b61016f600480360360208110156101fd57600080fd5b503561070d565b61016f6004803603604081101561021a57600080fd5b506001600160a01b038135169060200135610719565b61016f610729565b610193610844565b61019361084d565b61025061085c565b604080516001600160a01b039092168252519081900360200190f35b610179610871565b610179610891565b6102a26004803603602081101561029257600080fd5b50356001600160a01b0316610897565b6040805192835260208301919091528051918290030190f35b6102a2600480360360208110156102d157600080fd5b50356001600160a01b03166108b0565b61016f600480360360408110156102f757600080fd5b506001600160a01b0381351690602001356108c9565b6102506108d5565b610321338260016108e4565b50565b60006002809054906101000a90046001600160a01b03166001600160a01b03166357de26a46040518163ffffffff1660e01b815260040160206040518083038186803b15801561037357600080fd5b505afa158015610387573d6000803e3d6000fd5b505050506040513d602081101561039d57600080fd5b505190505b90565b600654610100900460ff1681565b60025460ff1681565b60095481565b60055481565b60065460ff1661041f576040805162461bcd60e51b815260206004820152601b60248201527f42657474696e6720697320616374697665206f722063616e63656c0000000000604482015290519081900360640190fd5b60065460009062010000900460ff1615610481576007543360009081526020819052604090205460095461046a929161045e919063ffffffff610c2216565b9063ffffffff610c8416565b3360009081526020819052604081205590506104bf565b600854336000908152600160205260409020546009546104ac929161045e919063ffffffff610c2216565b3360009081526001602052604081205590505b6003546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b15801561051357600080fd5b505af1158015610527573d6000803e3d6000fd5b505050506040513d602081101561053d57600080fd5b505050565b60065460ff1615610593576040805162461bcd60e51b815260206004820152601660248201527512185d9948185b1c9958591e48199a5b9a5b1a5e995960521b604482015290519081900360640190fd5b60006004546105a0610324565b1180159150600090826105b557506005544210155b905081806105c05750805b610605576040805162461bcd60e51b815260206004820152601160248201527042657474696e672069732061637469766560781b604482015290519081900360640190fd5b6006805482158015620100000262ff000019909216919091179091558190610630575060025460ff16155b8061064c57508015801561064c5750600254610100900460ff16155b156106675750506006805461ff0019166101001790556106f1565b600354604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b1580156106b257600080fd5b505afa1580156106c6573d6000803e3d6000fd5b505050506040513d60208110156106dc57600080fd5b505160095550506006805460ff191660011790555b565b600254610100900460ff1681565b60075481565b60085481565b610321338260006108e4565b610725828260016108e4565b5050565b600654610100900460ff16610785576040805162461bcd60e51b815260206004820152601760248201527f42657474696e67206973206e6f742063616e63656c6564000000000000000000604482015290519081900360640190fd5b60035433600081815260208181526040808320600190810154928190529220909101546001600160a01b039093169263a9059cbb92916107cb919063ffffffff610cc616565b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561081a57600080fd5b505af115801561082e573d6000803e3d6000fd5b505050506040513d602081101561072557600080fd5b60065460ff1681565b60065462010000900460ff1681565b6002546201000090046001600160a01b031681565b600554600090428111156108895742900390506103a2565b600091505090565b60045481565b6000602081905290815260409020805460019091015482565b6001602081905260009182526040909120805491015482565b610725828260006108e4565b6003546001600160a01b031681565b6005544210610931576040805162461bcd60e51b81526020600482015260146024820152732132ba3a34b733903a34b6b29034b99037bb32b960611b604482015290519081900360640190fd5b60008211610986576040805162461bcd60e51b815260206004820152601960248201527f5553442073686f756c64206265206d6f7265207468616e203000000000000000604482015290519081900360640190fd5b600354604080516323b872dd60e01b81523360048201523060248201526044810185905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b1580156109e057600080fd5b505af11580156109f4573d6000803e3d6000fd5b505050506040513d6020811015610a0a57600080fd5b5060009050610a17610324565b90506000610a23610871565b905060008315610b0257610a5a8361045e683635c9adc5dea00000610a4e898763ffffffff610c2216565b9063ffffffff610c2216565b6001600160a01b038716600090815260208190526040902054909150610a86908263ffffffff610cc616565b6001600160a01b038716600090815260208190526040902055600754610ab2908263ffffffff610cc616565b6007556001600160a01b038616600090815260208190526040902060010154610ae1908663ffffffff610cc616565b6001600160a01b038716600090815260208190526040902060010155610bc8565b610b22670de0b6b3a764000061045e85610a4e898763ffffffff610c2216565b6001600160a01b038716600090815260016020526040902054909150610b4e908263ffffffff610cc616565b6001600160a01b038716600090815260016020526040902055600854610b7a908263ffffffff610cc616565b6008556001600160a01b03861660009081526001602081905260409091200154610baa908663ffffffff610cc616565b6001600160a01b038716600090815260016020819052604090912001555b60025460ff16158015610bd85750835b15610bef576002805460ff19166001179055610c1a565b600254610100900460ff16158015610c05575083155b15610c1a576002805461ff0019166101001790555b505050505050565b600082610c3157506000610c7e565b82820282848281610c3e57fe5b0414610c7b5760405162461bcd60e51b8152600401808060200182810382526021815260200180610dc36021913960400191505060405180910390fd5b90505b92915050565b6000610c7b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610d20565b600082820183811015610c7b576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60008183610dac5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610d71578181015183820152602001610d59565b50505050905090810190601f168015610d9e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581610db857fe5b049594505050505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a265627a7a72315820c6a9de3da7dfea2d01ff5680caf90b6a2fbd1f2ddeee5e7267cb2c5ac929d93c64736f6c63430005110032

Deployed ByteCode

0x608060405234801561001057600080fd5b506004361061014d5760003560e01c80636f3fce63116100c3578063c7e284b81161007c578063c7e284b81461026c578063dc38679c14610274578063e693561d1461027c578063eb396ce7146102bb578063f6c577f8146102e1578063f897a22b1461030d5761014d565b80636f3fce63146101e75780637214de1414610204578063739da009146102305780638d4e408314610238578063bc4835ef14610240578063bcfdf549146102485761014d565b80633197cbb6116101155780633197cbb6146101b757806348d37a58146101bf5780634bb278f3146101c7578063512a3342146101cf57806351f7cb07146101d7578063616a5920146101df5761014d565b8063010b03ee146101525780630aa971f3146101715780630ed5a9331461018b5780631a63cca5146101a75780632129e25a146101af575b600080fd5b61016f6004803603602081101561016857600080fd5b5035610315565b005b610179610324565b60408051918252519081900360200190f35b6101936103a5565b604080519115158252519081900360200190f35b6101936103b3565b6101796103bc565b6101796103c2565b61016f6103c8565b61016f610542565b6101936106f3565b610179610701565b610179610707565b61016f600480360360208110156101fd57600080fd5b503561070d565b61016f6004803603604081101561021a57600080fd5b506001600160a01b038135169060200135610719565b61016f610729565b610193610844565b61019361084d565b61025061085c565b604080516001600160a01b039092168252519081900360200190f35b610179610871565b610179610891565b6102a26004803603602081101561029257600080fd5b50356001600160a01b0316610897565b6040805192835260208301919091528051918290030190f35b6102a2600480360360208110156102d157600080fd5b50356001600160a01b03166108b0565b61016f600480360360408110156102f757600080fd5b506001600160a01b0381351690602001356108c9565b6102506108d5565b610321338260016108e4565b50565b60006002809054906101000a90046001600160a01b03166001600160a01b03166357de26a46040518163ffffffff1660e01b815260040160206040518083038186803b15801561037357600080fd5b505afa158015610387573d6000803e3d6000fd5b505050506040513d602081101561039d57600080fd5b505190505b90565b600654610100900460ff1681565b60025460ff1681565b60095481565b60055481565b60065460ff1661041f576040805162461bcd60e51b815260206004820152601b60248201527f42657474696e6720697320616374697665206f722063616e63656c0000000000604482015290519081900360640190fd5b60065460009062010000900460ff1615610481576007543360009081526020819052604090205460095461046a929161045e919063ffffffff610c2216565b9063ffffffff610c8416565b3360009081526020819052604081205590506104bf565b600854336000908152600160205260409020546009546104ac929161045e919063ffffffff610c2216565b3360009081526001602052604081205590505b6003546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b15801561051357600080fd5b505af1158015610527573d6000803e3d6000fd5b505050506040513d602081101561053d57600080fd5b505050565b60065460ff1615610593576040805162461bcd60e51b815260206004820152601660248201527512185d9948185b1c9958591e48199a5b9a5b1a5e995960521b604482015290519081900360640190fd5b60006004546105a0610324565b1180159150600090826105b557506005544210155b905081806105c05750805b610605576040805162461bcd60e51b815260206004820152601160248201527042657474696e672069732061637469766560781b604482015290519081900360640190fd5b6006805482158015620100000262ff000019909216919091179091558190610630575060025460ff16155b8061064c57508015801561064c5750600254610100900460ff16155b156106675750506006805461ff0019166101001790556106f1565b600354604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b1580156106b257600080fd5b505afa1580156106c6573d6000803e3d6000fd5b505050506040513d60208110156106dc57600080fd5b505160095550506006805460ff191660011790555b565b600254610100900460ff1681565b60075481565b60085481565b610321338260006108e4565b610725828260016108e4565b5050565b600654610100900460ff16610785576040805162461bcd60e51b815260206004820152601760248201527f42657474696e67206973206e6f742063616e63656c6564000000000000000000604482015290519081900360640190fd5b60035433600081815260208181526040808320600190810154928190529220909101546001600160a01b039093169263a9059cbb92916107cb919063ffffffff610cc616565b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561081a57600080fd5b505af115801561082e573d6000803e3d6000fd5b505050506040513d602081101561072557600080fd5b60065460ff1681565b60065462010000900460ff1681565b6002546201000090046001600160a01b031681565b600554600090428111156108895742900390506103a2565b600091505090565b60045481565b6000602081905290815260409020805460019091015482565b6001602081905260009182526040909120805491015482565b610725828260006108e4565b6003546001600160a01b031681565b6005544210610931576040805162461bcd60e51b81526020600482015260146024820152732132ba3a34b733903a34b6b29034b99037bb32b960611b604482015290519081900360640190fd5b60008211610986576040805162461bcd60e51b815260206004820152601960248201527f5553442073686f756c64206265206d6f7265207468616e203000000000000000604482015290519081900360640190fd5b600354604080516323b872dd60e01b81523360048201523060248201526044810185905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b1580156109e057600080fd5b505af11580156109f4573d6000803e3d6000fd5b505050506040513d6020811015610a0a57600080fd5b5060009050610a17610324565b90506000610a23610871565b905060008315610b0257610a5a8361045e683635c9adc5dea00000610a4e898763ffffffff610c2216565b9063ffffffff610c2216565b6001600160a01b038716600090815260208190526040902054909150610a86908263ffffffff610cc616565b6001600160a01b038716600090815260208190526040902055600754610ab2908263ffffffff610cc616565b6007556001600160a01b038616600090815260208190526040902060010154610ae1908663ffffffff610cc616565b6001600160a01b038716600090815260208190526040902060010155610bc8565b610b22670de0b6b3a764000061045e85610a4e898763ffffffff610c2216565b6001600160a01b038716600090815260016020526040902054909150610b4e908263ffffffff610cc616565b6001600160a01b038716600090815260016020526040902055600854610b7a908263ffffffff610cc616565b6008556001600160a01b03861660009081526001602081905260409091200154610baa908663ffffffff610cc616565b6001600160a01b038716600090815260016020819052604090912001555b60025460ff16158015610bd85750835b15610bef576002805460ff19166001179055610c1a565b600254610100900460ff16158015610c05575083155b15610c1a576002805461ff0019166101001790555b505050505050565b600082610c3157506000610c7e565b82820282848281610c3e57fe5b0414610c7b5760405162461bcd60e51b8152600401808060200182810382526021815260200180610dc36021913960400191505060405180910390fd5b90505b92915050565b6000610c7b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610d20565b600082820183811015610c7b576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60008183610dac5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610d71578181015183820152602001610d59565b50505050905090810190601f168015610d9e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581610db857fe5b049594505050505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a265627a7a72315820c6a9de3da7dfea2d01ff5680caf90b6a2fbd1f2ddeee5e7267cb2c5ac929d93c64736f6c63430005110032