Address Details
contract

0x03d4f4aa8eF65c1fd4497A3E912262432fc3B832

Contract Name
GoodGhostingCelo
Creator
0x23e874–ca0416 at 0x0ac3e5–216446
Balance
0 CELO ( )
Locked CELO Balance
0.00 CELO
Voting CELO Balance
0.00 CELO
Pending Unlocked Gold
0.00 CELO
Tokens
Fetching tokens...
Transactions
Fetching transactions...
Transfers
Fetching transfers...
Gas Used
Fetching gas used...
Last Balance Update
5176863
This contract has been verified via Sourcify. View contract in Sourcify repository
Contract name:
GoodGhostingCelo




Optimization enabled
true
Compiler version
v0.6.11+commit.5ef660b1




Optimization runs
1500
EVM Version
istanbul




Verified at
2022-09-30T07:51:20.855398Z

/Users/virazmalhotra/Development/goodghosting-smart-contracts/contracts/GoodGhostingCelo.sol

// SPDX-License-Identifier: UNLICENSED

pragma solidity 0.6.11;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./aave/ILendingPoolAddressesProvider.sol";
import "./moola/MILendingPool.sol";
import "./moola/MAToken.sol";
import "./moola/ILendingPoolCore.sol";
import "./GoodGhostingWhitelisted.sol";
/**
 * Play the save game.
 *
 */

contract GoodGhostingCelo is Ownable, Pausable, GoodGhostingWhitelisted {
    using SafeMath for uint256;

    // Controls if tokens were redeemed or not from the pool
    bool public redeemed;
    // Stores the total amount of interest received in the game.
    uint256 public totalGameInterest;
    //  total principal amount
    uint256 public totalGamePrincipal;

    uint256 public adminFeeAmount;

    bool public adminWithdraw;

    // Token that players use to buy in the game - DAI
    IERC20 public immutable daiToken;
    // Pointer to aDAI
    MAToken public immutable adaiToken;
    // Which Aave instance we use to swap DAI to interest bearing aDAI
    ILendingPoolAddressesProvider public lendingPoolAddressProvider;
    MILendingPool public lendingPool;

    uint256 public immutable segmentPayment;
    uint256 public immutable lastSegment;
    uint256 public immutable firstSegmentStart;
    uint256 public immutable segmentLength;
    uint256 public immutable earlyWithdrawalFee;
    uint256 public immutable customFee;

    struct Player {
        address addr;
        bool withdrawn;
        bool canRejoin;
        uint256 mostRecentSegmentPaid;
        uint256 amountPaid;
    }
    mapping(address => Player) public players;
    // we need to differentiate the deposit amount to aave or any other protocol for each window hence this mapping segment no => total deposit amount for that
    mapping(uint256 => uint256) public segmentDeposit;
    address[] public iterablePlayers;
    address[] public winners;

    event JoinedGame(address indexed player, uint256 amount);
    event Deposit(
        address indexed player,
        uint256 indexed segment,
        uint256 amount
    );
    event Withdrawal(address indexed player, uint256 amount);
    event FundsDepositedIntoExternalPool(uint256 amount);
    event FundsRedeemedFromExternalPool(
        uint256 totalAmount,
        uint256 totalGamePrincipal,
        uint256 totalGameInterest
    );
    event WinnersAnnouncement(address[] winners);
    event EarlyWithdrawal(address indexed player, uint256 amount);
    event AdminWithdrawal(
        address indexed admin,
        uint256 totalGameInterest,
        uint256 adminFeeAmount
    );

    modifier whenGameIsCompleted() {
        require(isGameCompleted(), "Game is not completed");
        _;
    }

    modifier whenGameIsNotCompleted() {
        require(!isGameCompleted(), "Game is already completed");
        _;
    }

    /**
        Creates a new instance of GoodGhosting game
        @param _inboundCurrency Smart contract address of inbound currency used for the game.
        @param _segmentCount Number of segments in the game.
        @param _segmentLength Lenght of each segment, in seconds (i.e., 180 (sec) => 3 minutes).
        @param _segmentPayment Amount of tokens each player needs to contribute per segment (i.e. 10*10**18 equals to 10 DAI - note that DAI uses 18 decimal places).
        @param _earlyWithdrawalFee Fee paid by users on early withdrawals (before the game completes). Used as an integer percentage (i.e., 10 represents 10%).
        customFee
        @param merkleRoot_ merkel root to verify players on chain to allow only whitelisted users join.
     */
    constructor(
        IERC20 _inboundCurrency,
        ILendingPoolAddressesProvider _lendingPoolAddressProvider,
        uint256 _segmentCount,
        uint256 _segmentLength,
        uint256 _segmentPayment,
        uint256 _earlyWithdrawalFee,
        uint256 _customFee,
        MILendingPool _lendingPool,
        bytes32 merkleRoot_
    ) GoodGhostingWhitelisted(merkleRoot_) public {
        require(_customFee <= 20);
        require(_earlyWithdrawalFee <= 10);
        require(_earlyWithdrawalFee > 0);
        // Initializes default variables
        firstSegmentStart = block.timestamp; //gets current time
        lastSegment = _segmentCount;
        segmentLength = _segmentLength;
        segmentPayment = _segmentPayment;
        earlyWithdrawalFee = _earlyWithdrawalFee;
        customFee = _customFee;
        daiToken = _inboundCurrency;
        ILendingPoolCore lendingPoolCore = ILendingPoolCore(_lendingPoolAddressProvider.getLendingPoolCore());
        lendingPool = _lendingPool;
        address adaiTokenAddress = lendingPoolCore.getReserveATokenAddress(address(_inboundCurrency));
        require(adaiTokenAddress != address(0), "Aave doesn't support _inboundCurrency");
        adaiToken = MAToken(adaiTokenAddress);
        // Allows the lending pool to convert DAI deposited on this contract to aDAI on lending pool
        uint MAX_ALLOWANCE = 2**256 - 1;
        _inboundCurrency.approve(address(lendingPoolCore), MAX_ALLOWANCE);
    }

    function getNumberOfPlayers() public view returns (uint256) {
        return iterablePlayers.length;
    }

    function pause() external onlyOwner whenNotPaused {
        _pause();
    }

    function unpause() external onlyOwner whenPaused {
        _unpause();
    }

    /**
       Allowing the admin to withdraw the pool fees
    */
    function adminFeeWithdraw() external onlyOwner whenGameIsCompleted {
        require(!adminWithdraw, "Admin has already withdrawn");
        require(adminFeeAmount > 0, "No Fees Earned");
        adminWithdraw = true;
        emit AdminWithdrawal(owner(), totalGameInterest, adminFeeAmount);
        require(
            IERC20(daiToken).transfer(owner(), adminFeeAmount),
            "Fail to transfer ER20 tokens to admin"
        );
    }

    function _transferDaiToContract() internal {
        // users pays dai in to the smart contract, which he pre-approved to spend the DAI for him
        // convert DAI to aDAI using the lending pool
        // this doesn't make sense since we are already transferring
        require(
            daiToken.allowance(msg.sender, address(this)) >= segmentPayment,
            "You need to have allowance to do transfer DAI on the smart contract"
        );

        uint256 currentSegment = getCurrentSegment();

        players[msg.sender].mostRecentSegmentPaid = currentSegment;
        players[msg.sender].amountPaid = players[msg.sender].amountPaid.add(
            segmentPayment
        );
        totalGamePrincipal = totalGamePrincipal.add(segmentPayment);
        segmentDeposit[currentSegment] = segmentDeposit[currentSegment].add(
            segmentPayment
        );
        // SECURITY NOTE:
        // Interacting with the external contracts should be the last action in the logic to avoid re-entracy attacks.
        // Re-entrancy: https://solidity.readthedocs.io/en/v0.6.12/security-considerations.html#re-entrancy
        // Check-Effects-Interactions Pattern: https://solidity.readthedocs.io/en/v0.6.12/security-considerations.html#use-the-checks-effects-interactions-pattern
        require(
            daiToken.transferFrom(msg.sender, address(this), segmentPayment),
            "Transfer failed"
        );
    }

    /**
        Returns the current segment of the game using a 0-based index (returns 0 for the 1st segment ).
        @dev solidity does not return floating point numbers this will always return a whole number
     */
    function getCurrentSegment() public view returns (uint256) {
        return block.timestamp.sub(firstSegmentStart).div(segmentLength);
    }

    function isGameCompleted() public view returns (bool) {
        // Game is completed when the current segment is greater than "lastSegment" of the game.
        return getCurrentSegment() > lastSegment;
    }

    function joinGame(uint256 index, bytes32[] calldata merkleProof) external whenNotPaused {
        require(getCurrentSegment() == 0, "Game has already started");
        address player = msg.sender;
        claim(index, player, true, merkleProof);
        // require(isValidPlayer, "Not whitelisted player");
        require(
            players[msg.sender].addr != msg.sender || players[msg.sender].canRejoin,
            "Cannot join the game more than once"
        );
        Player memory newPlayer = Player({
            addr: msg.sender,
            mostRecentSegmentPaid: 0,
            amountPaid: 0,
            withdrawn: false,
            canRejoin: false
        });
        players[msg.sender] = newPlayer;
        iterablePlayers.push(msg.sender);
        emit JoinedGame(msg.sender, segmentPayment);

        // payment for first segment
        _transferDaiToContract();
    }

    /**
       @dev Allows anyone to deposit the previous segment funds into the underlying protocol.
       Deposits into the protocol can happen at any moment after segment 0 (first deposit window)
       is completed, as long as the game is not completed.
    */
    function depositIntoExternalPool()
        external
        whenNotPaused
        whenGameIsNotCompleted
    {
        uint256 currentSegment = getCurrentSegment();
        require(
            currentSegment > 0,
            "Cannot deposit into underlying protocol during segment zero"
        );
        uint256 amount = segmentDeposit[currentSegment.sub(1)];
        // balance safety check
        uint256 currentBalance = daiToken.balanceOf(address(this));
        if (amount > currentBalance) {
            amount = currentBalance;
        }
        require(
            amount > 0,
            "No amount from previous segment to deposit into protocol"
        );

        // Sets deposited amount for previous segment to 0, avoiding double deposits into the protocol using funds from the current segment
        segmentDeposit[currentSegment.sub(1)] = 0;

        // require(balance >= amount, "insufficient amount");
        emit FundsDepositedIntoExternalPool(amount);
        // gg refferal code 155
        lendingPool.deposit(address(daiToken), amount, 155);
    }

    /**
       @dev Allows player to withdraw funds in the middle of the game with an early withdrawal fee deducted from the user's principal.
       earlyWithdrawalFee is set via constructor
    */
    function earlyWithdraw() external whenNotPaused whenGameIsNotCompleted {
        Player storage player = players[msg.sender];
        // Makes sure player didn't withdraw; otherwise, player could withdraw multiple times.
        require(!player.withdrawn, "Player has already withdrawn");
        // since atokenunderlying has 1:1 ratio so we redeem the amount paid by the player
        player.withdrawn = true;
        // In an early withdraw, users get their principal minus the earlyWithdrawalFee % defined in the constructor.
        // So if earlyWithdrawalFee is 10% and deposit amount is 10 dai, player will get 9 dai back, keeping 1 dai in the pool.
        uint256 withdrawAmount = player.amountPaid.sub(
            player.amountPaid.mul(earlyWithdrawalFee).div(100)
        );
        // Decreases the totalGamePrincipal on earlyWithdraw
        totalGamePrincipal = totalGamePrincipal.sub(withdrawAmount);
        // BUG FIX - Deposit External Pool Tx reverted after an early withdraw
        // Fixed by first checking at what segment early withdraw happens if > 0 then re-assign current segment as -1
        // Since in deposit external pool the amount is calculated from the segmentDeposit mapping
        // and the amount is reduced by withdrawAmount
        uint256 currentSegment = getCurrentSegment();
        // commented this for now just need to verify with some unit tests once
        // if (currentSegment > 0) {
        //     currentSegment = currentSegment.sub(1);
        // }
        if (segmentDeposit[currentSegment] > 0) {
            if (segmentDeposit[currentSegment] >= withdrawAmount) {
                segmentDeposit[currentSegment] = segmentDeposit[currentSegment]
                    .sub(withdrawAmount);
            } else {
                segmentDeposit[currentSegment] = 0;
            }
        }

        uint256 contractBalance = IERC20(daiToken).balanceOf(address(this));

        if (currentSegment == 0) {
            player.canRejoin = true;
        }

        emit EarlyWithdrawal(msg.sender, withdrawAmount);

        // Only withdraw funds from underlying pool if contract doesn't have enough balance to fulfill the early withdraw.
        // there is no redeem function in v2 it is replaced by withdraw in v2
        if (contractBalance < withdrawAmount) {
            adaiToken.redeem(adaiToken.balanceOf(address(this)));
        }
        require(
            IERC20(daiToken).transfer(msg.sender, withdrawAmount),
            "Fail to transfer ERC20 tokens on early withdraw"
        );
    }

    /**
        Reedems funds from external pool and calculates total amount of interest for the game.
        @dev This method only redeems funds from the external pool, without doing any allocation of balances
             to users. This helps to prevent running out of gas and having funds locked into the external pool.
    */
    function redeemFromExternalPool() public virtual whenGameIsCompleted {
        require(!redeemed, "Redeem operation already happened for the game");
        redeemed = true;
        // aave has 1:1 peg for tokens and atokens
        // there is no redeem function in v2 it is replaced by withdraw in v2
        // Aave docs recommends using uint(-1) to withdraw the full balance. This is actually an overflow that results in the max uint256 value.
        if (adaiToken.balanceOf(address(this)) > 0) {
            adaiToken.redeem(adaiToken.balanceOf(address(this)));
        }
        uint256 totalBalance = IERC20(daiToken).balanceOf(address(this));
        // recording principal amount separately since adai balance will have interest has well
        uint256 grossInterest = totalBalance.sub(totalGamePrincipal);
        // deduction of a fee % usually 1 % as part of pool fees.
        uint256 _adminFeeAmount;
        if (customFee > 0) {
            _adminFeeAmount = (grossInterest.mul(customFee)).div(100);
            totalGameInterest = grossInterest.sub(_adminFeeAmount);
        } else {
            _adminFeeAmount = 0;
            totalGameInterest = grossInterest;
        }

        if (winners.length == 0) {
            adminFeeAmount = grossInterest;
        } else {
            adminFeeAmount = _adminFeeAmount;
        }

        emit FundsRedeemedFromExternalPool(
            totalBalance,
            totalGamePrincipal,
            totalGameInterest
        );
        emit WinnersAnnouncement(winners);
    }

    // to be called by individual players to get the amount back once it is redeemed following the solidity withdraw pattern
    function withdraw() external {
        Player storage player = players[msg.sender];
        require(!player.withdrawn, "Player has already withdrawn");
        player.withdrawn = true;

        uint256 payout = player.amountPaid;
        if (player.mostRecentSegmentPaid == lastSegment.sub(1)) {
            // Player is a winner and gets a bonus!
            // No need to worry about if winners.length = 0
            // If we're in this block then the user is a winner
            payout = payout.add(totalGameInterest.div(winners.length));
        }
        emit Withdrawal(msg.sender, payout);

        // First player to withdraw redeems everyone's funds
        if (!redeemed) {
            redeemFromExternalPool();
        }

        require(
            IERC20(daiToken).transfer(msg.sender, payout),
            "Fail to transfer ERC20 tokens on withdraw"
        );
    }

    function makeDeposit() external whenNotPaused {
        // only registered players can deposit
        require(
            !players[msg.sender].withdrawn,
            "Player already withdraw from game"
        );
        require(
            players[msg.sender].addr == msg.sender,
            "Sender is not a player"
        );

        uint256 currentSegment = getCurrentSegment();
        // User can only deposit between segment 1 and segmetn n-1 (where n the number of segments for the game).
        // Details:
        // Segment 0 is paid when user joins the game (the first deposit window).
        // Last segment doesn't accept payments, because the payment window for the last
        // segment happens on segment n-1 (penultimate segment).
        // Any segment greather than the last segment means the game is completed, and cannot
        // receive payments
        require(
            currentSegment > 0 && currentSegment < lastSegment,
            "Deposit available only between segment 1 and segment n-1 (penultimate)"
        );

        //check if current segment is currently unpaid
        require(
            players[msg.sender].mostRecentSegmentPaid != currentSegment,
            "Player already paid current segment"
        );

        // check player has made payments up to the previous segment
        require(
            players[msg.sender].mostRecentSegmentPaid == currentSegment.sub(1),
            "Player didn't pay the previous segment - game over!"
        );

        // check if this is deposit for the last segment
        // if so, the user is a winner
        if (currentSegment == lastSegment.sub(1)) {
            winners.push(msg.sender);
        }

        emit Deposit(msg.sender, currentSegment, segmentPayment);

        //:moneybag:allow deposit to happen
        _transferDaiToContract();
    }
}
        

/Users/virazmalhotra/Development/goodghosting-smart-contracts/contracts/GoodGhostingWhitelisted.sol

// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.6.11;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/cryptography/MerkleProof.sol";
import "./merkel/IMerkleDistributor.sol";

contract GoodGhostingWhitelisted is IMerkleDistributor {
    bytes32 public immutable override merkleRoot;

    constructor(bytes32 merkleRoot_) public {
        merkleRoot = merkleRoot_;
    }

    function claim(uint256 index, address account, bool isValid, bytes32[] calldata merkleProof) public view override {
        // Verify the merkle proof.
        bytes32 node = keccak256(abi.encodePacked(index, account, isValid));
        require(MerkleProof.verify(merkleProof, merkleRoot, node), 'MerkleDistributor: Invalid proof');
    }
}
          

/Users/virazmalhotra/Development/goodghosting-smart-contracts/contracts/aave/ILendingPoolAddressesProvider.sol

// SPDX-License-Identifier: UNLICENSED

pragma solidity 0.6.11;

/**
@title ILendingPoolAddressesProvider interface
@notice provides the interface to fetch the LendingPoolCore address
 */

abstract contract ILendingPoolAddressesProvider {

    function getLendingPool() public virtual view returns (address);
    function setLendingPoolImpl(address _pool) public virtual;
    function getAddress(bytes32 id) public virtual view returns (address);

    function getLendingPoolCore() public virtual view returns (address payable);
    function setLendingPoolCoreImpl(address _lendingPoolCore) public virtual;

    function getLendingPoolConfigurator() public virtual view returns (address);
    function setLendingPoolConfiguratorImpl(address _configurator) public virtual;

    function getLendingPoolDataProvider() public virtual view returns (address);
    function setLendingPoolDataProviderImpl(address _provider) public virtual;

    function getLendingPoolParametersProvider() public virtual view returns (address);
    function setLendingPoolParametersProviderImpl(address _parametersProvider) public virtual;

    function getTokenDistributor() public virtual view returns (address);
    function setTokenDistributor(address _tokenDistributor) public virtual;


    function getFeeProvider() public virtual view returns (address);
    function setFeeProviderImpl(address _feeProvider) public virtual;

    function getLendingPoolLiquidationManager() public virtual view returns (address);
    function setLendingPoolLiquidationManager(address _manager) public virtual;

    function getLendingPoolManager() public virtual view returns (address);
    function setLendingPoolManager(address _lendingPoolManager) public virtual;

    function getPriceOracle() public virtual view returns (address);
    function setPriceOracle(address _priceOracle) public virtual;

    function getLendingRateOracle() public virtual view returns (address);
    function setLendingRateOracle(address _lendingRateOracle) public virtual;

}
          

/Users/virazmalhotra/Development/goodghosting-smart-contracts/contracts/merkel/IMerkleDistributor.sol

// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.5.0;

// Allows anyone to claim a token if they exist in a merkle root.
interface IMerkleDistributor {
    // Returns the merkle root of the merkle tree containing account balances available to claim.
    function merkleRoot() external view returns (bytes32);
    // Claim the given amount of the token to the given address. Reverts if the inputs are invalid.
    function claim(uint256 index, address account, bool isValid, bytes32[] calldata merkleProof) external view;
}
          

/Users/virazmalhotra/Development/goodghosting-smart-contracts/contracts/moola/ILendingPoolCore.sol

pragma solidity 0.6.11;

interface ILendingPoolCore {
    function getReserveATokenAddress(address _reserve) external returns (address);
}
          

/Users/virazmalhotra/Development/goodghosting-smart-contracts/contracts/moola/MAToken.sol

pragma solidity 0.6.11;

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

    function redeem(uint256 _amount) external;

}
          

/Users/virazmalhotra/Development/goodghosting-smart-contracts/contracts/moola/MILendingPool.sol

pragma solidity 0.6.11;

interface MILendingPool {
    function deposit( address _reserve, uint256 _amount, uint16 _referralCode) external;
    //see: https://github.com/aave/aave-protocol/blob/1ff8418eb5c73ce233ac44bfb7541d07828b273f/contracts/tokenization/AToken.sol#L218
    function withdraw(address asset, uint amount, address to) external;
}
          

/_openzeppelin/contracts/access/Ownable.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor () internal {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

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

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

/_openzeppelin/contracts/cryptography/MerkleProof.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev These functions deal with verification of Merkle trees (hash trees),
 */
library MerkleProof {
    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     */
    function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
        bytes32 computedHash = leaf;

        for (uint256 i = 0; i < proof.length; i++) {
            bytes32 proofElement = proof[i];

            if (computedHash <= proofElement) {
                // Hash(current computed hash + current element of the proof)
                computedHash = keccak256(abi.encodePacked(computedHash, proofElement));
            } else {
                // Hash(current element of the proof + current computed hash)
                computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
            }
        }

        // Check if the computed hash (root) is equal to the provided root
        return computedHash == root;
    }
}
          

/_openzeppelin/contracts/math/SafeMath.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @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, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        uint256 c = a + b;
        if (c < a) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b > a) return (false, 0);
        return (true, a - b);
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, 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 (true, 0);
        uint256 c = a * b;
        if (c / a != b) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a / b);
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a % b);
    }

    /**
     * @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) {
        require(b <= a, "SafeMath: subtraction overflow");
        return a - b;
    }

    /**
     * @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) {
        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, reverting 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) {
        require(b > 0, "SafeMath: division by zero");
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting 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) {
        require(b > 0, "SafeMath: modulo by zero");
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        return a - b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryDiv}.
     *
     * 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, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * 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, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a % b;
    }
}
          

/_openzeppelin/contracts/token/ERC20/IERC20.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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);
}
          

/_openzeppelin/contracts/utils/Context.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/*
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with GSN meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}
          

/_openzeppelin/contracts/utils/Pausable.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "./Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor () internal {
        _paused = false;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        require(!paused(), "Pausable: paused");
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        require(paused(), "Pausable: not paused");
        _;
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}
          

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_inboundCurrency","internalType":"contract IERC20"},{"type":"address","name":"_lendingPoolAddressProvider","internalType":"contract ILendingPoolAddressesProvider"},{"type":"uint256","name":"_segmentCount","internalType":"uint256"},{"type":"uint256","name":"_segmentLength","internalType":"uint256"},{"type":"uint256","name":"_segmentPayment","internalType":"uint256"},{"type":"uint256","name":"_earlyWithdrawalFee","internalType":"uint256"},{"type":"uint256","name":"_customFee","internalType":"uint256"},{"type":"address","name":"_lendingPool","internalType":"contract MILendingPool"},{"type":"bytes32","name":"merkleRoot_","internalType":"bytes32"}]},{"type":"event","name":"AdminWithdrawal","inputs":[{"type":"address","name":"admin","internalType":"address","indexed":true},{"type":"uint256","name":"totalGameInterest","internalType":"uint256","indexed":false},{"type":"uint256","name":"adminFeeAmount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Deposit","inputs":[{"type":"address","name":"player","internalType":"address","indexed":true},{"type":"uint256","name":"segment","internalType":"uint256","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"EarlyWithdrawal","inputs":[{"type":"address","name":"player","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"FundsDepositedIntoExternalPool","inputs":[{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"FundsRedeemedFromExternalPool","inputs":[{"type":"uint256","name":"totalAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"totalGamePrincipal","internalType":"uint256","indexed":false},{"type":"uint256","name":"totalGameInterest","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"JoinedGame","inputs":[{"type":"address","name":"player","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Paused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"Unpaused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"WinnersAnnouncement","inputs":[{"type":"address[]","name":"winners","internalType":"address[]","indexed":false}],"anonymous":false},{"type":"event","name":"Withdrawal","inputs":[{"type":"address","name":"player","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract MAToken"}],"name":"adaiToken","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"adminFeeAmount","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"adminFeeWithdraw","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"adminWithdraw","inputs":[]},{"type":"function","stateMutability":"view","outputs":[],"name":"claim","inputs":[{"type":"uint256","name":"index","internalType":"uint256"},{"type":"address","name":"account","internalType":"address"},{"type":"bool","name":"isValid","internalType":"bool"},{"type":"bytes32[]","name":"merkleProof","internalType":"bytes32[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"customFee","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IERC20"}],"name":"daiToken","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"depositIntoExternalPool","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"earlyWithdraw","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"earlyWithdrawalFee","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"firstSegmentStart","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getCurrentSegment","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getNumberOfPlayers","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isGameCompleted","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"iterablePlayers","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"joinGame","inputs":[{"type":"uint256","name":"index","internalType":"uint256"},{"type":"bytes32[]","name":"merkleProof","internalType":"bytes32[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"lastSegment","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract MILendingPool"}],"name":"lendingPool","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract ILendingPoolAddressesProvider"}],"name":"lendingPoolAddressProvider","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"makeDeposit","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"merkleRoot","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"pause","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"paused","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"addr","internalType":"address"},{"type":"bool","name":"withdrawn","internalType":"bool"},{"type":"bool","name":"canRejoin","internalType":"bool"},{"type":"uint256","name":"mostRecentSegmentPaid","internalType":"uint256"},{"type":"uint256","name":"amountPaid","internalType":"uint256"}],"name":"players","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"redeemFromExternalPool","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"redeemed","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"segmentDeposit","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"segmentLength","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"segmentPayment","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalGameInterest","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalGamePrincipal","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unpause","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"winners","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdraw","inputs":[]}]
              

Contract Creation Code

0x6101a06040523480156200001257600080fd5b50604051620031c1380380620031c183398181016040526101208110156200003957600080fd5b508051602082015160408301516060840151608085015160a086015160c087015160e0880151610100909801519697959694959394929391929091908060006200008b6001600160e01b036200034216565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3506000805460ff60a01b191690556080526014831115620000f457600080fd5b600a8411156200010357600080fd5b600084116200011157600080fd5b426101205261010087905261014086905260e08590526101608490526101808390526001600160601b031960608a901b1660a0526040805163076b7fbb60e51b815290516000916001600160a01b038b169163ed6ff76091600480820192602092909190829003018186803b1580156200018a57600080fd5b505afa1580156200019f573d6000803e3d6000fd5b505050506040513d6020811015620001b657600080fd5b5051600580546001600160a01b0319166001600160a01b038681169190911790915560408051631a59df7760e11b81528d831660048201529051929350600092918416916334b3beee9160248082019260209290919082900301818787803b1580156200022257600080fd5b505af115801562000237573d6000803e3d6000fd5b505050506040513d60208110156200024e57600080fd5b505190506001600160a01b038116620002995760405162461bcd60e51b81526004018080602001828103825260258152602001806200319c6025913960400191505060405180910390fd5b6001600160601b0319606082901b1660c0526040805163095ea7b360e01b81526001600160a01b038481166004830152600019602483018190529251908e169163095ea7b39160448083019260209291908290030181600087803b1580156200030157600080fd5b505af115801562000316573d6000803e3d6000fd5b505050506040513d60208110156200032d57600080fd5b50620003469c50505050505050505050505050565b3390565b60805160a05160601c60c05160601c60e0516101005161012051610140516101605161018051612d576200044560003980611268528061227752806122a65250806108255280610bd25250806115115280611f17525080610e2c5280611f3c5250806105b35280610ca0528061104c528061115f52806114e252508061058f52806111e85280611d3852806126ec52806127f3528061283c528061287e52806128f0525080610a0b528061148b528061204052806120d85250806109215280610b1b5280610d7752806114bc528061165052806117d05280611a2d52806121e4528061271652806129205250806106635280610bf65250612d576000f3fe608060405234801561001057600080fd5b50600436106102775760003560e01c80638da5cb5b11610160578063df62856c116100d8578063f18d20be1161008c578063f5c9786711610071578063f5c9786714610575578063f8dd5ad31461057d578063fd6673f51461058557610277565b8063f18d20be14610547578063f2fde38b1461054f57610277565b8063e1e48a00116100bd578063e1e48a001461046d578063e231bff0146104e4578063e2eb41ff146104ec57610277565b8063df62856c1461045d578063e0236a181461046557610277565b8063a98a5c941161012f578063be22f54611610114578063be22f54614610445578063c39b583c1461044d578063d013666e1461045557610277565b8063a98a5c9414610420578063aad739f51461042857610277565b80638da5cb5b146103eb57806395224b33146103f3578063a2fb1175146103fb578063a59a99731461041857610277565b806340732c89116101f35780635faeea37116101c2578063715018a6116101a7578063715018a6146103d35780637a23032c146103db5780638456cb59146103e357610277565b80635faeea37146103a757806363380300146103af57610277565b806340732c891461035e5780634ae71a5a146103665780635c975abb146103835780635edafd5a1461039f57610277565b806316330d401161024a5780633ccfd60b1161022f5780633ccfd60b146103465780633e7433eb1461034e5780633f4ba83a1461035657610277565b806316330d40146103365780632eb4a7ab1461033e57610277565b80630c8ac6451461027c57806311b2e2d91461029657806315485e4d1461029e57806315d74bb31461032e575b600080fd5b61028461058d565b60408051918252519081900360200190f35b6102846105b1565b61032c600480360360808110156102b457600080fd5b8135916001600160a01b03602082013516916040820135151591908101906080810160608201356401000000008111156102ed57600080fd5b8201836020820111156102ff57600080fd5b8035906020019184602083028401116401000000008311171561032157600080fd5b5090925090506105d5565b005b61032c6106e7565b610284610bd0565b610284610bf4565b61032c610c18565b610284610e2a565b61032c610e4e565b61032c610f25565b6102846004803603602081101561037c57600080fd5b5035611244565b61038b611256565b604080519115158252519081900360200190f35b610284611266565b61028461128a565b6103b7611290565b604080516001600160a01b039092168252519081900360200190f35b61032c6112a4565b61028461136f565b61032c611375565b6103b761143e565b61028461144d565b6103b76004803603602081101561041157600080fd5b5035611453565b6103b761147a565b6103b7611489565b6103b76004803603602081101561043e57600080fd5b50356114ad565b6103b76114ba565b61038b6114de565b61028461150f565b61032c611533565b61032c61184e565b61032c6004803603604081101561048357600080fd5b813591908101906040810160208201356401000000008111156104a557600080fd5b8201836020820111156104b757600080fd5b803590602001918460208302840111640100000000831117156104d957600080fd5b509092509050611b1b565b61038b611d98565b6105126004803603602081101561050257600080fd5b50356001600160a01b0316611da8565b604080516001600160a01b03909616865293151560208601529115158484015260608401526080830152519081900360a00190f35b61038b611de6565b61032c6004803603602081101561056557600080fd5b50356001600160a01b0316611def565b610284611f10565b61032c611f6b565b6102846123d6565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b6040805160208082018890527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606088901b168284015285151560f81b60548301528251603581840301815260558301808552815191830191909120607592860280850184019095528582529361068e939192879287928392909101908490808284376000920191909152507f000000000000000000000000000000000000000000000000000000000000000092508591506123dc9050565b6106df576040805162461bcd60e51b815260206004820181905260248201527f4d65726b6c654469737472696275746f723a20496e76616c69642070726f6f66604482015290519081900360640190fd5b505050505050565b6106ef611256565b15610734576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b61073c6114de565b1561078e576040805162461bcd60e51b815260206004820152601960248201527f47616d6520697320616c726561647920636f6d706c6574656400000000000000604482015290519081900360640190fd5b3360009081526006602052604090208054600160a01b900460ff16156107fb576040805162461bcd60e51b815260206004820152601c60248201527f506c617965722068617320616c72656164792077697468647261776e00000000604482015290519081900360640190fd5b805460ff60a01b1916600160a01b178155600281015460009061086c9061085b9060649061084f907f000000000000000000000000000000000000000000000000000000000000000063ffffffff61248516565b9063ffffffff6124e716565b60028401549063ffffffff61254e16565b600254909150610882908263ffffffff61254e16565b600255600061088f611f10565b600081815260076020526040902054909150156108fe5760008181526007602052604090205482116108ee576000818152600760205260409020546108da908363ffffffff61254e16565b6000828152600760205260409020556108fe565b6000818152600760205260408120555b604080516370a0823160e01b815230600482015290516000916001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916370a0823191602480820192602092909190829003018186803b15801561096857600080fd5b505afa15801561097c573d6000803e3d6000fd5b505050506040513d602081101561099257600080fd5b50519050816109ad57835460ff60a81b1916600160a81b1784555b60408051848152905133917fdbe734feb03404aea3972424443538fed86ff1b94a0f8b96ec26c452ecb77eac919081900360200190a282811015610af457604080516370a0823160e01b815230600482015290516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163db006a759183916370a08231916024808301926020929190829003018186803b158015610a5957600080fd5b505afa158015610a6d573d6000803e3d6000fd5b505050506040513d6020811015610a8357600080fd5b5051604080517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b168152600481019290925251602480830192600092919082900301818387803b158015610adb57600080fd5b505af1158015610aef573d6000803e3d6000fd5b505050505b6040805163a9059cbb60e01b81523360048201526024810185905290516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163a9059cbb9160448083019260209291908290030181600087803b158015610b6357600080fd5b505af1158015610b77573d6000803e3d6000fd5b505050506040513d6020811015610b8d57600080fd5b5051610bca5760405162461bcd60e51b815260040180806020018281038252602f815260200180612a9a602f913960400191505060405180910390fd5b50505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b3360009081526006602052604090208054600160a01b900460ff1615610c85576040805162461bcd60e51b815260206004820152601c60248201527f506c617965722068617320616c72656164792077697468647261776e00000000604482015290519081900360640190fd5b805460ff60a01b1916600160a01b1781556002810154610ccc7f0000000000000000000000000000000000000000000000000000000000000000600163ffffffff61254e16565b82600101541415610d0157600954600154610cfe91610cf1919063ffffffff6124e716565b829063ffffffff6125ab16565b90505b60408051828152905133917f7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65919081900360200190a2600054600160a81b900460ff16610d5057610d50611f6b565b6040805163a9059cbb60e01b81523360048201526024810183905290516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163a9059cbb9160448083019260209291908290030181600087803b158015610dbf57600080fd5b505af1158015610dd3573d6000803e3d6000fd5b505050506040513d6020811015610de957600080fd5b5051610e265760405162461bcd60e51b8152600401808060200182810382526029815260200180612bfb6029913960400191505060405180910390fd5b5050565b7f000000000000000000000000000000000000000000000000000000000000000081565b610e56612605565b6001600160a01b0316610e6761143e565b6001600160a01b031614610ec2576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b610eca611256565b610f1b576040805162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604482015290519081900360640190fd5b610f23612609565b565b610f2d611256565b15610f72576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b33600090815260066020526040902054600160a01b900460ff1615610fc85760405162461bcd60e51b8152600401808060200182810382526021815260200180612c886021913960400191505060405180910390fd5b336000818152600660205260409020546001600160a01b031614611033576040805162461bcd60e51b815260206004820152601660248201527f53656e646572206973206e6f74206120706c6179657200000000000000000000604482015290519081900360640190fd5b600061103d611f10565b905060008111801561106e57507f000000000000000000000000000000000000000000000000000000000000000081105b6110a95760405162461bcd60e51b8152600401808060200182810382526046815260200180612b7a6046913960600191505060405180910390fd5b336000908152600660205260409020600101548114156110fa5760405162461bcd60e51b8152600401808060200182810382526023815260200180612ccc6023913960400191505060405180910390fd5b61110b81600163ffffffff61254e16565b336000908152600660205260409020600101541461115a5760405162461bcd60e51b8152600401808060200182810382526033815260200180612cef6033913960400191505060405180910390fd5b61118b7f0000000000000000000000000000000000000000000000000000000000000000600163ffffffff61254e16565b8114156111e257600980546001810182556000919091527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af01805473ffffffffffffffffffffffffffffffffffffffff1916331790555b604080517f000000000000000000000000000000000000000000000000000000000000000081529051829133917f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159181900360200190a36112416126b5565b50565b60076020526000908152604090205481565b600054600160a01b900460ff1690565b7f000000000000000000000000000000000000000000000000000000000000000081565b60025481565b60045461010090046001600160a01b031681565b6112ac612605565b6001600160a01b03166112bd61143e565b6001600160a01b031614611318576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36000805473ffffffffffffffffffffffffffffffffffffffff19169055565b60035481565b61137d612605565b6001600160a01b031661138e61143e565b6001600160a01b0316146113e9576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6113f1611256565b15611436576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b610f236129e2565b6000546001600160a01b031690565b60015481565b6009818154811061146057fe5b6000918252602090912001546001600160a01b0316905081565b6005546001600160a01b031681565b7f000000000000000000000000000000000000000000000000000000000000000081565b6008818154811061146057fe5b7f000000000000000000000000000000000000000000000000000000000000000081565b60007f0000000000000000000000000000000000000000000000000000000000000000611509611f10565b11905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b61153b611256565b15611580576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6115886114de565b156115da576040805162461bcd60e51b815260206004820152601960248201527f47616d6520697320616c726561647920636f6d706c6574656400000000000000604482015290519081900360640190fd5b60006115e4611f10565b9050600081116116255760405162461bcd60e51b815260040180806020018281038252603b815260200180612bc0603b913960400191505060405180910390fd5b600060078161163b84600163ffffffff61254e16565b815260200190815260200160002054905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b1580156116c457600080fd5b505afa1580156116d8573d6000803e3d6000fd5b505050506040513d60208110156116ee57600080fd5b50519050808211156116fe578091505b6000821161173d5760405162461bcd60e51b8152600401808060200182810382526038815260200180612af76038913960400191505060405180910390fd5b600060078161175386600163ffffffff61254e16565b8152602001908152602001600020819055507fb0e0c7a93b238af0c2eb040f97310552326f421a9dfbf2023c441b4abae122d9826040518082815260200191505060405180910390a1600554604080517fd2d0e0660000000000000000000000000000000000000000000000000000000081526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116600483015260248201869052609b60448301529151919092169163d2d0e06691606480830192600092919082900301818387803b15801561183157600080fd5b505af1158015611845573d6000803e3d6000fd5b50505050505050565b611856612605565b6001600160a01b031661186761143e565b6001600160a01b0316146118c2576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6118ca6114de565b61191b576040805162461bcd60e51b815260206004820152601560248201527f47616d65206973206e6f7420636f6d706c657465640000000000000000000000604482015290519081900360640190fd5b60045460ff1615611973576040805162461bcd60e51b815260206004820152601b60248201527f41646d696e2068617320616c72656164792077697468647261776e0000000000604482015290519081900360640190fd5b6000600354116119ca576040805162461bcd60e51b815260206004820152600e60248201527f4e6f2046656573204561726e6564000000000000000000000000000000000000604482015290519081900360640190fd5b6004805460ff191660011790556119df61143e565b6001600160a01b03167f766b63950f3939375480c9204d7b6bfb28296ac63930596ff0a547026e1d8936600154600354604051808381526020018281526020019250505060405180910390a27f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663a9059cbb611a6261143e565b6003546040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015611ab457600080fd5b505af1158015611ac8573d6000803e3d6000fd5b505050506040513d6020811015611ade57600080fd5b5051610f235760405162461bcd60e51b8152600401808060200182810382526025815260200180612b556025913960400191505060405180910390fd5b611b23611256565b15611b68576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b611b70611f10565b15611bc2576040805162461bcd60e51b815260206004820152601860248201527f47616d652068617320616c726561647920737461727465640000000000000000604482015290519081900360640190fd5b33611bd18482600186866105d5565b336000818152600660205260409020546001600160a01b0316141580611c0d575033600090815260066020526040902054600160a81b900460ff165b611c485760405162461bcd60e51b8152600401808060200182810382526023815260200180612ca96023913960400191505060405180910390fd5b611c50612a6b565b506040805160a081018252338082526000602080840182815284860183815260608601848152608087018581528686526006855288862088518154955194511515600160a81b0260ff60a81b19951515600160a01b0260ff60a01b196001600160a01b039390931673ffffffffffffffffffffffffffffffffffffffff1998891617929092169190911794909416939093178355905160018381019190915590516002909201919091556008805491820181559093527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee39092018054909216831790915583517f000000000000000000000000000000000000000000000000000000000000000081529351929391927f485fd86c2a7d2d9ca3bf02e2ba776ea24271bc62274265b0bd5f478b3b7a1ca49281900390910190a2611d916126b5565b5050505050565b600054600160a81b900460ff1681565b6006602052600090815260409020805460018201546002909201546001600160a01b0382169260ff600160a01b8404811693600160a81b9004169185565b60045460ff1681565b611df7612605565b6001600160a01b0316611e0861143e565b6001600160a01b031614611e63576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116611ea85760405162461bcd60e51b8152600401808060200182810382526026815260200180612b2f6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6000611f667f000000000000000000000000000000000000000000000000000000000000000061084f427f000000000000000000000000000000000000000000000000000000000000000063ffffffff61254e16565b905090565b611f736114de565b611fc4576040805162461bcd60e51b815260206004820152601560248201527f47616d65206973206e6f7420636f6d706c657465640000000000000000000000604482015290519081900360640190fd5b600054600160a81b900460ff161561200d5760405162461bcd60e51b815260040180806020018281038252602e815260200180612ac9602e913960400191505060405180910390fd5b6000805460ff60a81b1916600160a81b178155604080516370a0823160e01b815230600482015290516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916370a08231916024808301926020929190829003018186803b15801561208657600080fd5b505afa15801561209a573d6000803e3d6000fd5b505050506040513d60208110156120b057600080fd5b505111156121c157604080516370a0823160e01b815230600482015290516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163db006a759183916370a08231916024808301926020929190829003018186803b15801561212657600080fd5b505afa15801561213a573d6000803e3d6000fd5b505050506040513d602081101561215057600080fd5b5051604080517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b168152600481019290925251602480830192600092919082900301818387803b1580156121a857600080fd5b505af11580156121bc573d6000803e3d6000fd5b505050505b604080516370a0823160e01b815230600482015290516000916001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916370a0823191602480820192602092909190829003018186803b15801561222b57600080fd5b505afa15801561223f573d6000803e3d6000fd5b505050506040513d602081101561225557600080fd5b505160025490915060009061227190839063ffffffff61254e16565b905060007f0000000000000000000000000000000000000000000000000000000000000000156122ea576122d0606461084f847f000000000000000000000000000000000000000000000000000000000000000063ffffffff61248516565b90506122e2828263ffffffff61254e16565b6001556122f3565b50600181905560005b60095461230457600382905561230a565b60038190555b60025460015460408051868152602081019390935282810191909152517f5801666a7bdced00832d7e119bf290f426c0431001d5560c5f4c3718b73cf6df9181900360600190a17fdbb9607e18553d40c255226e09883b48f92a108f6f895b0f37db6ae0d7fd56e66009604051808060200182810382528381815481526020019150805480156123c357602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116123a5575b50509250505060405180910390a1505050565b60085490565b600081815b855181101561247a5760008682815181106123f857fe5b6020026020010151905080831161243f5782816040516020018083815260200182815260200192505050604051602081830303815290604052805190602001209250612471565b808360405160200180838152602001828152602001925050506040516020818303038152906040528051906020012092505b506001016123e1565b509092149392505050565b600082612494575060006124e1565b828202828482816124a157fe5b04146124de5760405162461bcd60e51b8152600401808060200182810382526021815260200180612c246021913960400191505060405180910390fd5b90505b92915050565b600080821161253d576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161254657fe5b049392505050565b6000828211156125a5576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6000828201838110156124de576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b3390565b612611611256565b612662576040805162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604482015290519081900360640190fd5b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa612698612605565b604080516001600160a01b039092168252519081900360200190a1565b604080517fdd62ed3e00000000000000000000000000000000000000000000000000000000815233600482015230602482015290517f0000000000000000000000000000000000000000000000000000000000000000916001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163dd62ed3e91604480820192602092909190829003018186803b15801561275d57600080fd5b505afa158015612771573d6000803e3d6000fd5b505050506040513d602081101561278757600080fd5b505110156127c65760405162461bcd60e51b8152600401808060200182810382526043815260200180612c456043913960600191505060405180910390fd5b60006127d0611f10565b336000908152600660205260409020600181018290556002015490915061281d907f000000000000000000000000000000000000000000000000000000000000000063ffffffff6125ab16565b33600090815260066020526040902060029081019190915554612866907f000000000000000000000000000000000000000000000000000000000000000063ffffffff6125ab16565b6002556000818152600760205260409020546128a8907f000000000000000000000000000000000000000000000000000000000000000063ffffffff6125ab16565b60008281526007602090815260408083209390935582517f23b872dd0000000000000000000000000000000000000000000000000000000081523360048201523060248201527f0000000000000000000000000000000000000000000000000000000000000000604482015292516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016936323b872dd9360648083019493928390030190829087803b15801561296557600080fd5b505af1158015612979573d6000803e3d6000fd5b505050506040513d602081101561298f57600080fd5b5051611241576040805162461bcd60e51b815260206004820152600f60248201527f5472616e73666572206661696c65640000000000000000000000000000000000604482015290519081900360640190fd5b6129ea611256565b15612a2f576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612698612605565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fe4661696c20746f207472616e7366657220455243323020746f6b656e73206f6e206561726c7920776974686472617752656465656d206f7065726174696f6e20616c72656164792068617070656e656420666f72207468652067616d654e6f20616d6f756e742066726f6d2070726576696f7573207365676d656e7420746f206465706f73697420696e746f2070726f746f636f6c4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734661696c20746f207472616e73666572204552323020746f6b656e7320746f2061646d696e4465706f73697420617661696c61626c65206f6e6c79206265747765656e207365676d656e74203120616e64207365676d656e74206e2d31202870656e756c74696d6174652943616e6e6f74206465706f73697420696e746f20756e6465726c79696e672070726f746f636f6c20647572696e67207365676d656e74207a65726f4661696c20746f207472616e7366657220455243323020746f6b656e73206f6e207769746864726177536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77596f75206e65656420746f206861766520616c6c6f77616e636520746f20646f207472616e7366657220444149206f6e2074686520736d61727420636f6e7472616374506c6179657220616c72656164792077697468647261772066726f6d2067616d6543616e6e6f74206a6f696e207468652067616d65206d6f7265207468616e206f6e6365506c6179657220616c726561647920706169642063757272656e74207365676d656e74506c61796572206469646e277420706179207468652070726576696f7573207365676d656e74202d2067616d65206f76657221a26469706673582212201557594754950898ab41433952a6d965527f8cdb7cd71a3bb0bb619b52bee90f64736f6c634300060b00334161766520646f65736e277420737570706f7274205f696e626f756e6443757272656e637900000000000000000000000010c892a6ec43a53e45d0b916b4b7d383b1b78c0f0000000000000000000000006eae47cceff3c3ac94971704ccd25c782012148300000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000278d000000000000000000000000000000000000000000000000056bc75e2d63100000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000886f74eeec443fbb6907fb5528b57c28e8131296b393b724acd3191a521c9a485f505fecf9ce2497b77fad513bf661d3fddb012

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106102775760003560e01c80638da5cb5b11610160578063df62856c116100d8578063f18d20be1161008c578063f5c9786711610071578063f5c9786714610575578063f8dd5ad31461057d578063fd6673f51461058557610277565b8063f18d20be14610547578063f2fde38b1461054f57610277565b8063e1e48a00116100bd578063e1e48a001461046d578063e231bff0146104e4578063e2eb41ff146104ec57610277565b8063df62856c1461045d578063e0236a181461046557610277565b8063a98a5c941161012f578063be22f54611610114578063be22f54614610445578063c39b583c1461044d578063d013666e1461045557610277565b8063a98a5c9414610420578063aad739f51461042857610277565b80638da5cb5b146103eb57806395224b33146103f3578063a2fb1175146103fb578063a59a99731461041857610277565b806340732c89116101f35780635faeea37116101c2578063715018a6116101a7578063715018a6146103d35780637a23032c146103db5780638456cb59146103e357610277565b80635faeea37146103a757806363380300146103af57610277565b806340732c891461035e5780634ae71a5a146103665780635c975abb146103835780635edafd5a1461039f57610277565b806316330d401161024a5780633ccfd60b1161022f5780633ccfd60b146103465780633e7433eb1461034e5780633f4ba83a1461035657610277565b806316330d40146103365780632eb4a7ab1461033e57610277565b80630c8ac6451461027c57806311b2e2d91461029657806315485e4d1461029e57806315d74bb31461032e575b600080fd5b61028461058d565b60408051918252519081900360200190f35b6102846105b1565b61032c600480360360808110156102b457600080fd5b8135916001600160a01b03602082013516916040820135151591908101906080810160608201356401000000008111156102ed57600080fd5b8201836020820111156102ff57600080fd5b8035906020019184602083028401116401000000008311171561032157600080fd5b5090925090506105d5565b005b61032c6106e7565b610284610bd0565b610284610bf4565b61032c610c18565b610284610e2a565b61032c610e4e565b61032c610f25565b6102846004803603602081101561037c57600080fd5b5035611244565b61038b611256565b604080519115158252519081900360200190f35b610284611266565b61028461128a565b6103b7611290565b604080516001600160a01b039092168252519081900360200190f35b61032c6112a4565b61028461136f565b61032c611375565b6103b761143e565b61028461144d565b6103b76004803603602081101561041157600080fd5b5035611453565b6103b761147a565b6103b7611489565b6103b76004803603602081101561043e57600080fd5b50356114ad565b6103b76114ba565b61038b6114de565b61028461150f565b61032c611533565b61032c61184e565b61032c6004803603604081101561048357600080fd5b813591908101906040810160208201356401000000008111156104a557600080fd5b8201836020820111156104b757600080fd5b803590602001918460208302840111640100000000831117156104d957600080fd5b509092509050611b1b565b61038b611d98565b6105126004803603602081101561050257600080fd5b50356001600160a01b0316611da8565b604080516001600160a01b03909616865293151560208601529115158484015260608401526080830152519081900360a00190f35b61038b611de6565b61032c6004803603602081101561056557600080fd5b50356001600160a01b0316611def565b610284611f10565b61032c611f6b565b6102846123d6565b7f0000000000000000000000000000000000000000000000056bc75e2d6310000081565b7f000000000000000000000000000000000000000000000000000000000000000381565b6040805160208082018890527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606088901b168284015285151560f81b60548301528251603581840301815260558301808552815191830191909120607592860280850184019095528582529361068e939192879287928392909101908490808284376000920191909152507f6b393b724acd3191a521c9a485f505fecf9ce2497b77fad513bf661d3fddb01292508591506123dc9050565b6106df576040805162461bcd60e51b815260206004820181905260248201527f4d65726b6c654469737472696275746f723a20496e76616c69642070726f6f66604482015290519081900360640190fd5b505050505050565b6106ef611256565b15610734576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b61073c6114de565b1561078e576040805162461bcd60e51b815260206004820152601960248201527f47616d6520697320616c726561647920636f6d706c6574656400000000000000604482015290519081900360640190fd5b3360009081526006602052604090208054600160a01b900460ff16156107fb576040805162461bcd60e51b815260206004820152601c60248201527f506c617965722068617320616c72656164792077697468647261776e00000000604482015290519081900360640190fd5b805460ff60a01b1916600160a01b178155600281015460009061086c9061085b9060649061084f907f000000000000000000000000000000000000000000000000000000000000000163ffffffff61248516565b9063ffffffff6124e716565b60028401549063ffffffff61254e16565b600254909150610882908263ffffffff61254e16565b600255600061088f611f10565b600081815260076020526040902054909150156108fe5760008181526007602052604090205482116108ee576000818152600760205260409020546108da908363ffffffff61254e16565b6000828152600760205260409020556108fe565b6000818152600760205260408120555b604080516370a0823160e01b815230600482015290516000916001600160a01b037f00000000000000000000000010c892a6ec43a53e45d0b916b4b7d383b1b78c0f16916370a0823191602480820192602092909190829003018186803b15801561096857600080fd5b505afa15801561097c573d6000803e3d6000fd5b505050506040513d602081101561099257600080fd5b50519050816109ad57835460ff60a81b1916600160a81b1784555b60408051848152905133917fdbe734feb03404aea3972424443538fed86ff1b94a0f8b96ec26c452ecb77eac919081900360200190a282811015610af457604080516370a0823160e01b815230600482015290516001600160a01b037f00000000000000000000000032974c7335e649932b5766c5ae15595afc269160169163db006a759183916370a08231916024808301926020929190829003018186803b158015610a5957600080fd5b505afa158015610a6d573d6000803e3d6000fd5b505050506040513d6020811015610a8357600080fd5b5051604080517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b168152600481019290925251602480830192600092919082900301818387803b158015610adb57600080fd5b505af1158015610aef573d6000803e3d6000fd5b505050505b6040805163a9059cbb60e01b81523360048201526024810185905290516001600160a01b037f00000000000000000000000010c892a6ec43a53e45d0b916b4b7d383b1b78c0f169163a9059cbb9160448083019260209291908290030181600087803b158015610b6357600080fd5b505af1158015610b77573d6000803e3d6000fd5b505050506040513d6020811015610b8d57600080fd5b5051610bca5760405162461bcd60e51b815260040180806020018281038252602f815260200180612a9a602f913960400191505060405180910390fd5b50505050565b7f000000000000000000000000000000000000000000000000000000000000000181565b7f6b393b724acd3191a521c9a485f505fecf9ce2497b77fad513bf661d3fddb01281565b3360009081526006602052604090208054600160a01b900460ff1615610c85576040805162461bcd60e51b815260206004820152601c60248201527f506c617965722068617320616c72656164792077697468647261776e00000000604482015290519081900360640190fd5b805460ff60a01b1916600160a01b1781556002810154610ccc7f0000000000000000000000000000000000000000000000000000000000000003600163ffffffff61254e16565b82600101541415610d0157600954600154610cfe91610cf1919063ffffffff6124e716565b829063ffffffff6125ab16565b90505b60408051828152905133917f7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65919081900360200190a2600054600160a81b900460ff16610d5057610d50611f6b565b6040805163a9059cbb60e01b81523360048201526024810183905290516001600160a01b037f00000000000000000000000010c892a6ec43a53e45d0b916b4b7d383b1b78c0f169163a9059cbb9160448083019260209291908290030181600087803b158015610dbf57600080fd5b505af1158015610dd3573d6000803e3d6000fd5b505050506040513d6020811015610de957600080fd5b5051610e265760405162461bcd60e51b8152600401808060200182810382526029815260200180612bfb6029913960400191505060405180910390fd5b5050565b7f0000000000000000000000000000000000000000000000000000000060a2233181565b610e56612605565b6001600160a01b0316610e6761143e565b6001600160a01b031614610ec2576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b610eca611256565b610f1b576040805162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604482015290519081900360640190fd5b610f23612609565b565b610f2d611256565b15610f72576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b33600090815260066020526040902054600160a01b900460ff1615610fc85760405162461bcd60e51b8152600401808060200182810382526021815260200180612c886021913960400191505060405180910390fd5b336000818152600660205260409020546001600160a01b031614611033576040805162461bcd60e51b815260206004820152601660248201527f53656e646572206973206e6f74206120706c6179657200000000000000000000604482015290519081900360640190fd5b600061103d611f10565b905060008111801561106e57507f000000000000000000000000000000000000000000000000000000000000000381105b6110a95760405162461bcd60e51b8152600401808060200182810382526046815260200180612b7a6046913960600191505060405180910390fd5b336000908152600660205260409020600101548114156110fa5760405162461bcd60e51b8152600401808060200182810382526023815260200180612ccc6023913960400191505060405180910390fd5b61110b81600163ffffffff61254e16565b336000908152600660205260409020600101541461115a5760405162461bcd60e51b8152600401808060200182810382526033815260200180612cef6033913960400191505060405180910390fd5b61118b7f0000000000000000000000000000000000000000000000000000000000000003600163ffffffff61254e16565b8114156111e257600980546001810182556000919091527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af01805473ffffffffffffffffffffffffffffffffffffffff1916331790555b604080517f0000000000000000000000000000000000000000000000056bc75e2d6310000081529051829133917f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159181900360200190a36112416126b5565b50565b60076020526000908152604090205481565b600054600160a01b900460ff1690565b7f000000000000000000000000000000000000000000000000000000000000000081565b60025481565b60045461010090046001600160a01b031681565b6112ac612605565b6001600160a01b03166112bd61143e565b6001600160a01b031614611318576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36000805473ffffffffffffffffffffffffffffffffffffffff19169055565b60035481565b61137d612605565b6001600160a01b031661138e61143e565b6001600160a01b0316146113e9576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6113f1611256565b15611436576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b610f236129e2565b6000546001600160a01b031690565b60015481565b6009818154811061146057fe5b6000918252602090912001546001600160a01b0316905081565b6005546001600160a01b031681565b7f00000000000000000000000032974c7335e649932b5766c5ae15595afc26916081565b6008818154811061146057fe5b7f00000000000000000000000010c892a6ec43a53e45d0b916b4b7d383b1b78c0f81565b60007f0000000000000000000000000000000000000000000000000000000000000003611509611f10565b11905090565b7f0000000000000000000000000000000000000000000000000000000000278d0081565b61153b611256565b15611580576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6115886114de565b156115da576040805162461bcd60e51b815260206004820152601960248201527f47616d6520697320616c726561647920636f6d706c6574656400000000000000604482015290519081900360640190fd5b60006115e4611f10565b9050600081116116255760405162461bcd60e51b815260040180806020018281038252603b815260200180612bc0603b913960400191505060405180910390fd5b600060078161163b84600163ffffffff61254e16565b815260200190815260200160002054905060007f00000000000000000000000010c892a6ec43a53e45d0b916b4b7d383b1b78c0f6001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b1580156116c457600080fd5b505afa1580156116d8573d6000803e3d6000fd5b505050506040513d60208110156116ee57600080fd5b50519050808211156116fe578091505b6000821161173d5760405162461bcd60e51b8152600401808060200182810382526038815260200180612af76038913960400191505060405180910390fd5b600060078161175386600163ffffffff61254e16565b8152602001908152602001600020819055507fb0e0c7a93b238af0c2eb040f97310552326f421a9dfbf2023c441b4abae122d9826040518082815260200191505060405180910390a1600554604080517fd2d0e0660000000000000000000000000000000000000000000000000000000081526001600160a01b037f00000000000000000000000010c892a6ec43a53e45d0b916b4b7d383b1b78c0f8116600483015260248201869052609b60448301529151919092169163d2d0e06691606480830192600092919082900301818387803b15801561183157600080fd5b505af1158015611845573d6000803e3d6000fd5b50505050505050565b611856612605565b6001600160a01b031661186761143e565b6001600160a01b0316146118c2576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6118ca6114de565b61191b576040805162461bcd60e51b815260206004820152601560248201527f47616d65206973206e6f7420636f6d706c657465640000000000000000000000604482015290519081900360640190fd5b60045460ff1615611973576040805162461bcd60e51b815260206004820152601b60248201527f41646d696e2068617320616c72656164792077697468647261776e0000000000604482015290519081900360640190fd5b6000600354116119ca576040805162461bcd60e51b815260206004820152600e60248201527f4e6f2046656573204561726e6564000000000000000000000000000000000000604482015290519081900360640190fd5b6004805460ff191660011790556119df61143e565b6001600160a01b03167f766b63950f3939375480c9204d7b6bfb28296ac63930596ff0a547026e1d8936600154600354604051808381526020018281526020019250505060405180910390a27f00000000000000000000000010c892a6ec43a53e45d0b916b4b7d383b1b78c0f6001600160a01b031663a9059cbb611a6261143e565b6003546040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015611ab457600080fd5b505af1158015611ac8573d6000803e3d6000fd5b505050506040513d6020811015611ade57600080fd5b5051610f235760405162461bcd60e51b8152600401808060200182810382526025815260200180612b556025913960400191505060405180910390fd5b611b23611256565b15611b68576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b611b70611f10565b15611bc2576040805162461bcd60e51b815260206004820152601860248201527f47616d652068617320616c726561647920737461727465640000000000000000604482015290519081900360640190fd5b33611bd18482600186866105d5565b336000818152600660205260409020546001600160a01b0316141580611c0d575033600090815260066020526040902054600160a81b900460ff165b611c485760405162461bcd60e51b8152600401808060200182810382526023815260200180612ca96023913960400191505060405180910390fd5b611c50612a6b565b506040805160a081018252338082526000602080840182815284860183815260608601848152608087018581528686526006855288862088518154955194511515600160a81b0260ff60a81b19951515600160a01b0260ff60a01b196001600160a01b039390931673ffffffffffffffffffffffffffffffffffffffff1998891617929092169190911794909416939093178355905160018381019190915590516002909201919091556008805491820181559093527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee39092018054909216831790915583517f0000000000000000000000000000000000000000000000056bc75e2d6310000081529351929391927f485fd86c2a7d2d9ca3bf02e2ba776ea24271bc62274265b0bd5f478b3b7a1ca49281900390910190a2611d916126b5565b5050505050565b600054600160a81b900460ff1681565b6006602052600090815260409020805460018201546002909201546001600160a01b0382169260ff600160a01b8404811693600160a81b9004169185565b60045460ff1681565b611df7612605565b6001600160a01b0316611e0861143e565b6001600160a01b031614611e63576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116611ea85760405162461bcd60e51b8152600401808060200182810382526026815260200180612b2f6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6000611f667f0000000000000000000000000000000000000000000000000000000000278d0061084f427f0000000000000000000000000000000000000000000000000000000060a2233163ffffffff61254e16565b905090565b611f736114de565b611fc4576040805162461bcd60e51b815260206004820152601560248201527f47616d65206973206e6f7420636f6d706c657465640000000000000000000000604482015290519081900360640190fd5b600054600160a81b900460ff161561200d5760405162461bcd60e51b815260040180806020018281038252602e815260200180612ac9602e913960400191505060405180910390fd5b6000805460ff60a81b1916600160a81b178155604080516370a0823160e01b815230600482015290516001600160a01b037f00000000000000000000000032974c7335e649932b5766c5ae15595afc26916016916370a08231916024808301926020929190829003018186803b15801561208657600080fd5b505afa15801561209a573d6000803e3d6000fd5b505050506040513d60208110156120b057600080fd5b505111156121c157604080516370a0823160e01b815230600482015290516001600160a01b037f00000000000000000000000032974c7335e649932b5766c5ae15595afc269160169163db006a759183916370a08231916024808301926020929190829003018186803b15801561212657600080fd5b505afa15801561213a573d6000803e3d6000fd5b505050506040513d602081101561215057600080fd5b5051604080517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b168152600481019290925251602480830192600092919082900301818387803b1580156121a857600080fd5b505af11580156121bc573d6000803e3d6000fd5b505050505b604080516370a0823160e01b815230600482015290516000916001600160a01b037f00000000000000000000000010c892a6ec43a53e45d0b916b4b7d383b1b78c0f16916370a0823191602480820192602092909190829003018186803b15801561222b57600080fd5b505afa15801561223f573d6000803e3d6000fd5b505050506040513d602081101561225557600080fd5b505160025490915060009061227190839063ffffffff61254e16565b905060007f0000000000000000000000000000000000000000000000000000000000000000156122ea576122d0606461084f847f000000000000000000000000000000000000000000000000000000000000000063ffffffff61248516565b90506122e2828263ffffffff61254e16565b6001556122f3565b50600181905560005b60095461230457600382905561230a565b60038190555b60025460015460408051868152602081019390935282810191909152517f5801666a7bdced00832d7e119bf290f426c0431001d5560c5f4c3718b73cf6df9181900360600190a17fdbb9607e18553d40c255226e09883b48f92a108f6f895b0f37db6ae0d7fd56e66009604051808060200182810382528381815481526020019150805480156123c357602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116123a5575b50509250505060405180910390a1505050565b60085490565b600081815b855181101561247a5760008682815181106123f857fe5b6020026020010151905080831161243f5782816040516020018083815260200182815260200192505050604051602081830303815290604052805190602001209250612471565b808360405160200180838152602001828152602001925050506040516020818303038152906040528051906020012092505b506001016123e1565b509092149392505050565b600082612494575060006124e1565b828202828482816124a157fe5b04146124de5760405162461bcd60e51b8152600401808060200182810382526021815260200180612c246021913960400191505060405180910390fd5b90505b92915050565b600080821161253d576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161254657fe5b049392505050565b6000828211156125a5576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6000828201838110156124de576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b3390565b612611611256565b612662576040805162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604482015290519081900360640190fd5b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa612698612605565b604080516001600160a01b039092168252519081900360200190a1565b604080517fdd62ed3e00000000000000000000000000000000000000000000000000000000815233600482015230602482015290517f0000000000000000000000000000000000000000000000056bc75e2d63100000916001600160a01b037f00000000000000000000000010c892a6ec43a53e45d0b916b4b7d383b1b78c0f169163dd62ed3e91604480820192602092909190829003018186803b15801561275d57600080fd5b505afa158015612771573d6000803e3d6000fd5b505050506040513d602081101561278757600080fd5b505110156127c65760405162461bcd60e51b8152600401808060200182810382526043815260200180612c456043913960600191505060405180910390fd5b60006127d0611f10565b336000908152600660205260409020600181018290556002015490915061281d907f0000000000000000000000000000000000000000000000056bc75e2d6310000063ffffffff6125ab16565b33600090815260066020526040902060029081019190915554612866907f0000000000000000000000000000000000000000000000056bc75e2d6310000063ffffffff6125ab16565b6002556000818152600760205260409020546128a8907f0000000000000000000000000000000000000000000000056bc75e2d6310000063ffffffff6125ab16565b60008281526007602090815260408083209390935582517f23b872dd0000000000000000000000000000000000000000000000000000000081523360048201523060248201527f0000000000000000000000000000000000000000000000056bc75e2d63100000604482015292516001600160a01b037f00000000000000000000000010c892a6ec43a53e45d0b916b4b7d383b1b78c0f16936323b872dd9360648083019493928390030190829087803b15801561296557600080fd5b505af1158015612979573d6000803e3d6000fd5b505050506040513d602081101561298f57600080fd5b5051611241576040805162461bcd60e51b815260206004820152600f60248201527f5472616e73666572206661696c65640000000000000000000000000000000000604482015290519081900360640190fd5b6129ea611256565b15612a2f576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612698612605565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fe4661696c20746f207472616e7366657220455243323020746f6b656e73206f6e206561726c7920776974686472617752656465656d206f7065726174696f6e20616c72656164792068617070656e656420666f72207468652067616d654e6f20616d6f756e742066726f6d2070726576696f7573207365676d656e7420746f206465706f73697420696e746f2070726f746f636f6c4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734661696c20746f207472616e73666572204552323020746f6b656e7320746f2061646d696e4465706f73697420617661696c61626c65206f6e6c79206265747765656e207365676d656e74203120616e64207365676d656e74206e2d31202870656e756c74696d6174652943616e6e6f74206465706f73697420696e746f20756e6465726c79696e672070726f746f636f6c20647572696e67207365676d656e74207a65726f4661696c20746f207472616e7366657220455243323020746f6b656e73206f6e207769746864726177536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77596f75206e65656420746f206861766520616c6c6f77616e636520746f20646f207472616e7366657220444149206f6e2074686520736d61727420636f6e7472616374506c6179657220616c72656164792077697468647261772066726f6d2067616d6543616e6e6f74206a6f696e207468652067616d65206d6f7265207468616e206f6e6365506c6179657220616c726561647920706169642063757272656e74207365676d656e74506c61796572206469646e277420706179207468652070726576696f7573207365676d656e74202d2067616d65206f76657221a26469706673582212201557594754950898ab41433952a6d965527f8cdb7cd71a3bb0bb619b52bee90f64736f6c634300060b0033