Address io1cww74zudw6u802ahhsk59322zn74dtpcdfmm4r

Txn Hash
Block
From
To
Value [Txn Fee]
9ca909563d90feb2e9ebbc3c27d72caf869dcf966e1405b33ae7dad45a9b5bd8 22122649 2023-02-13 14:50:05 +0000 UTC one year ago io1jl2mqehuerysuv2uhreq2rv9jp6jrg5dphpczw  IN    Contract: BonusRewards 0 IOTX 0.246751
2f0b964b127a9f54ff8af3cd84ff7d24b5cb2b7d59325b992fb4e53835edd57d 21089624 2022-12-15 15:44:05 +0000 UTC one year ago io1jl2mqehuerysuv2uhreq2rv9jp6jrg5dphpczw  IN    Contract: BonusRewards 0 IOTX 0.084944
e2e1f828ab17154708097f8e31f217baf868d4e839fa8276a62c8bbb75979387 21089447 2022-12-15 15:29:20 +0000 UTC one year ago io1jl2mqehuerysuv2uhreq2rv9jp6jrg5dphpczw  IN    Contract: BonusRewards 0 IOTX 0.178426
42400a44b4a9e13eb05244a177e7fdbcb8265de28f3a49ae4604f689428fed04 21015526 2022-12-11 08:07:10 +0000 UTC one year ago io1jl2mqehuerysuv2uhreq2rv9jp6jrg5dphpczw  IN    Contract: BonusRewards 0 IOTX 0.178426
b31e547769c15a46eed1bbc38887896f6846b393bec15189b2c77311adc3c58c 20988510 2022-12-09 18:35:05 +0000 UTC one year ago io1jl2mqehuerysuv2uhreq2rv9jp6jrg5dphpczw  IN    Contract: BonusRewards 0 IOTX 0.254239
4055b7a24bbe67e6b9b2b2f2e5728c7503a85d9b8937c014cf99587f4cab62ed 20620478 2022-11-18 10:48:15 +0000 UTC one year ago io1mc07n8yrqa3z0sn5l2yez8jd7ldfec2m5qtpwj  IN    Contract: BonusRewards 0 IOTX 0.092444
9c9c3074204db654918d7df395cf7f4c255e13dd1fe7f2b4723af57038a7cc76 20620463 2022-11-18 10:47:00 +0000 UTC one year ago io1mc07n8yrqa3z0sn5l2yez8jd7ldfec2m5qtpwj  IN    Contract: BonusRewards 0 IOTX 0.163426
b62701d683fd93c499e7f0e2d7566790102a95dfc815dfe059865b83836fc5bb 20369101 2022-11-03 21:07:00 +0000 UTC one year ago io1mc07n8yrqa3z0sn5l2yez8jd7ldfec2m5qtpwj  IN    Contract: BonusRewards 0 IOTX 0.254239
40988c2928252f04d8d4e37baaed322fa639aeb564eb1ee7428b3889a0dc8822 20346334 2022-11-02 13:28:55 +0000 UTC one year ago io1watpvn77m3e6yr4jtff69veud40ygn0a62a54d  IN    Contract: BonusRewards 0 IOTX 0.092444
0090e4fe0ec5c4d5561b755a413274555b36c18447d8b4887bfff82ae49e7bb3 20346295 2022-11-02 13:25:40 +0000 UTC one year ago io1watpvn77m3e6yr4jtff69veud40ygn0a62a54d  IN    Contract: BonusRewards 0 IOTX 0.163426
600a37edd550bfbfdded2093f2420a03d914a84eb482f005deab46d4295e1ece 20346273 2022-11-02 13:23:50 +0000 UTC one year ago io1watpvn77m3e6yr4jtff69veud40ygn0a62a54d  IN    Contract: BonusRewards 0 IOTX 0.254239
f1eeae66b3bcee19e17f6d67566f1083613bce1ec2ec4b20d03d16554ba234fe 20122494 2022-10-20 14:24:20 +0000 UTC 2 years ago io1sr6qa4ph626e0szrz7admy3clalzhu3sqcnqps  IN    Contract: BonusRewards 0 IOTX 0.269239
e3d8a0af8592b842c0065cbcc8c339800e9c9e6fedd0f60b3a6db6b95389989a 19987404 2022-10-12 18:28:30 +0000 UTC 2 years ago io1ue5d4phj3720x6htrgslra0mm35pyvl9d3v06a  IN    Contract: BonusRewards 0 IOTX 0.092444
85c8d2ccce2c2462c7b3450927db6a036c8994c0182c7483d532785148dd6528 19145591 2022-08-24 22:05:00 +0000 UTC 2 years ago io1264yldp0wla2sx6u5rft8j4n87qgn9jguhs2j3  IN    Contract: BonusRewards 0 IOTX 0.084944
a689abe7aa73d0a17b9c3964fe62d436e8c3ad4ff0483579a5e4a0358c2c06ba 19144937 2022-08-24 21:10:30 +0000 UTC 2 years ago io1264yldp0wla2sx6u5rft8j4n87qgn9jguhs2j3  IN    Contract: BonusRewards 0 IOTX 0.163426
92f5aab707625178b95497800889b9a5cfa8e64d61a69a1de0bb8fa30468cdb1 19144850 2022-08-24 21:03:15 +0000 UTC 2 years ago io1264yldp0wla2sx6u5rft8j4n87qgn9jguhs2j3  IN    Contract: BonusRewards 0 IOTX 0.254239
4ea19c1ec411c34f2d6a2c9686641b294a0bffef1de2fe1eb81033175767fbe4 19119258 2022-08-23 09:30:10 +0000 UTC 2 years ago io1sef2u0zzcry2xz4waxhqgl6k2vg6dgxkrgsvw4  IN    Contract: BonusRewards 0 IOTX 0.092444
770a801f38d5235e0c008572804eb2ab838e2581b9cb8a1d63afb4a8795de8c7 19119244 2022-08-23 09:29:00 +0000 UTC 2 years ago io1sef2u0zzcry2xz4waxhqgl6k2vg6dgxkrgsvw4  IN    Contract: BonusRewards 0 IOTX 0.254239
8c048bf00ca7ced5bacac1eacaeb311782c7e54c1b5eb4685a7c9b4e1eed393b 19077907 2022-08-21 00:02:15 +0000 UTC 2 years ago io1ue5d4phj3720x6htrgslra0mm35pyvl9d3v06a  IN    Contract: BonusRewards 0 IOTX 0.231151
1da35b99b110272dbd74b875711da23152820881d2f0079adbc0c1c6a3da3b9b 19000834 2022-08-16 12:58:55 +0000 UTC 2 years ago io1wy57thrzm3gdcx20rnmunnnqn2p5ru2qrf3sxz  IN    Contract: BonusRewards 0 IOTX 0.092444
9dfcca4ed01b6fa5dcb494261dea75c2c7a04efa47c95b33e2801d1c666a775a 18987351 2022-08-15 18:15:10 +0000 UTC 2 years ago io1s44svnmlty70jxxxgzwvcg33x5pxgjfxxz5xlw  IN    Contract: BonusRewards 0 IOTX 0.092444
a9ca12fb0c2c69d74731edf88a5105f9c0f7bf11e991b2871bb97e7fcba2173f 18961699 2022-08-14 06:37:25 +0000 UTC 2 years ago io1cugrhwpcnggemrdmteyty8rsvls7cxajnwmnxq  IN    Contract: BonusRewards 0 IOTX 0.092444
7513657364637dde8a261f30ce1b7ed4c5aa0118b1e9c682dfc0cabf4970f21e 18954593 2022-08-13 20:45:10 +0000 UTC 2 years ago io1cugrhwpcnggemrdmteyty8rsvls7cxajnwmnxq  IN    Contract: BonusRewards 0 IOTX 0.163426
f57e848ac5ab04d91dd28bb6268c2c7de4d52b70bff3d52cf75675de5f60ee0d 18953616 2022-08-13 19:23:45 +0000 UTC 2 years ago io1cugrhwpcnggemrdmteyty8rsvls7cxajnwmnxq  IN    Contract: BonusRewards 0 IOTX 0.254239
f4a0bb462b622de11f7b2698b0f596da20cd861ad3c7bcd9db1cb5e54fc9d0a0 18929677 2022-08-12 10:08:05 +0000 UTC 2 years ago io1wy57thrzm3gdcx20rnmunnnqn2p5ru2qrf3sxz  IN    Contract: BonusRewards 0 IOTX 0.231151
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
BonusRewards

Compiler Version
v0.8.7+commit.e28d00a7

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, None license

Contract Source Code (Solidity)

/**
 *Submitted for verification at arbiscan.io on 2021-09-25
*/

/**
 *Submitted for verification at Etherscan.io on 2021-07-08
*/

// SPDX-License-Identifier: NONE

pragma solidity ^0.8.0;



// Part: Address

library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // According to EIP-1052, 0x0 is the value returned for not-yet created accounts
        // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
        // for accounts without code, i.e. `keccak256('')`
        bytes32 codehash;


            bytes32 accountHash
         = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
        // solhint-disable-next-line no-inline-assembly
        assembly {
            codehash := extcodehash(account)
        }
        return (codehash != accountHash && codehash != 0x0);
    }

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

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call{value: amount}("");
        require(
            success,
            "Address: unable to send value, recipient may have reverted"
        );
    }

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

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

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

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

    function _functionCallWithValue(
        address target,
        bytes memory data,
        uint256 weiValue,
        string memory errorMessage
    ) private returns (bytes memory) {
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{value: weiValue}(
            data
        );
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

// Part: IBonusRewards

/**
 * @title Cover Protocol Bonus Token Rewards Interface
 * @author crypto-pumpkin
 */
interface IBonusRewards {
    event Deposit(
        address indexed user,
        address indexed lpToken,
        uint256 amount
    );
    event Withdraw(
        address indexed user,
        address indexed lpToken,
        uint256 amount
    );

    struct Bonus {
        address bonusTokenAddr; // the external bonus token, like CRV
        uint48 startTime;
        uint48 endTime;
        uint256 weeklyRewards; // total amount to be distributed from start to end
        uint256 accRewardsPerToken; // accumulated bonus to the lastUpdated Time
        uint256 remBonus; // remaining bonus in contract
    }

    struct Pool {
        Bonus[] bonuses;
        uint256 lastUpdatedAt; // last accumulated bonus update timestamp
        uint256 amount;
    }

    struct User {
        uint256 amount;
        uint256[] rewardsWriteoffs; // the amount of bonus tokens to write off when calculate rewards from last update
    }

    function getPoolList() external view returns (address[] memory);

    function getResponders() external view returns (address[] memory);

    function getPool(address _lpToken) external view returns (Pool memory);

    function getUser(address _lpToken, address _account)
        external
        view
        returns (User memory _user, uint256[] memory _rewards);

    function getAuthorizers(address _lpToken, address _bonusTokenAddr)
        external
        view
        returns (address[] memory);

    function viewRewards(address _lpToken, address _user)
        external
        view
        returns (uint256[] memory);

    function claimRewardsForPools(address[] calldata _lpTokens) external;

    function deposit(address _lpToken, uint256 _amount) external;

    function withdraw(address _lpToken, uint256 _amount) external;

    function emergencyWithdraw(address[] calldata _lpTokens) external;

    function addBonus(
        address _lpToken,
        address _bonusTokenAddr,
        uint48 _startTime,
        uint256 _weeklyRewards,
        uint256 _transferAmount
    ) external;

    function extendBonus(
        address _lpToken,
        uint256 _poolBonusId,
        address _bonusTokenAddr,
        uint256 _transferAmount
    ) external;

    function updateBonus(
        address _lpToken,
        address _bonusTokenAddr,
        uint256 _weeklyRewards,
        uint48 _startTime
    ) external;

    // only owner
    function setResponders(address[] calldata _responders) external;

    function setPaused(bool _paused) external;

    function collectDust(
        address _token,
        address _lpToken,
        uint256 _poolBonusId
    ) external;

    function addPoolsAndAllowBonus(
        address[] calldata _lpTokens,
        address[] calldata _bonusTokenAddrs,
        address[] calldata _authorizers
    ) external;
}

// Part: IERC20

/**
 * @title Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(
        address indexed owner,
        address indexed spender,
        uint256 value
    );

    function decimals() external view returns (uint8);

    function balanceOf(address account) external view returns (uint256);

    function totalSupply() external view returns (uint256);

    function transfer(address recipient, uint256 amount)
        external
        returns (bool);

    function allowance(address owner, address spender)
        external
        view
        returns (uint256);

    function approve(address spender, uint256 amount) external returns (bool);

    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    function increaseAllowance(address spender, uint256 addedValue)
        external
        returns (bool);

    function decreaseAllowance(address spender, uint256 subtractedValue)
        external
        returns (bool);
}

// Part: Ownable

/**
 * @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.
 * @author crypto-pumpkin@github
 *
 * By initialization, the owner account will be the one that called initializeOwner. This
 * can later be changed with {transferOwnership}.
 */
contract Ownable {
    address private _owner;

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

    /**
     * @dev COVER: Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _owner = msg.sender;
        emit OwnershipTransferred(address(0), _owner);
    }

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

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

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

// Part: ReentrancyGuard

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

// Part: SafeERC20

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

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

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

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

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

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) - value;
        _callOptionalReturn(
            token,
            abi.encodeWithSelector(
                token.approve.selector,
                spender,
                newAllowance
            )
        );
    }

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

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

// File: BonusRewards.sol

/**
 * @title Cover Protocol Bonus Token Rewards contract
 * @author crypto-pumpkin
 * @notice ETH is not allowed to be an bonus token, use wETH instead
 * @notice We support multiple bonus tokens for each pool. However, each pool will have 1 bonus token normally, may have 2 in rare cases
 */
contract BonusRewards is IBonusRewards, Ownable, ReentrancyGuard {
    using SafeERC20 for IERC20;

    bool public paused;
    uint256 private constant WEEK = 7 days;
    // help calculate rewards/bonus PerToken only. 1e12 will allow meaningful $1 deposit in a $1bn pool
    uint256 private constant CAL_MULTIPLIER = 1e30;
    // use array to allow convenient replacement. Size of responders should be very small to 0 till a reputable responder multi-sig within DeFi or Yearn ecosystem is established
    address[] private responders;
    address[] private poolList;
    // lpToken => Pool
    mapping(address => Pool) private pools;
    // lpToken => User address => User data
    mapping(address => mapping(address => User)) private users;
    // use array to allow convenient replacement. Size of Authorizers should be very small (one or two partner addresses for the pool and bonus)
    // lpToken => bonus token => [] allowed authorizers to add bonus tokens
    mapping(address => mapping(address => address[]))
        private allowedTokenAuthorizers;
    // bonusTokenAddr => 1, used to avoid collecting bonus token when not ready
    mapping(address => uint8) private bonusTokenAddrMap;

    modifier notPaused() {
        require(!paused, "BonusRewards: paused");
        _;
    }

    function claimRewardsForPools(address[] calldata _lpTokens)
        external
        override
        nonReentrant
        notPaused
    {
        for (uint256 i = 0; i < _lpTokens.length; i++) {
            address lpToken = _lpTokens[i];
            User memory user = users[lpToken][msg.sender];
            if (user.amount == 0) continue;
            _updatePool(lpToken);
            _claimRewards(lpToken, user);
            _updateUserWriteoffs(lpToken);
        }
    }

    function deposit(address _lpToken, uint256 _amount)
        external
        override
        nonReentrant
        notPaused
    {
        require(
            pools[_lpToken].lastUpdatedAt > 0,
            "Blacksmith: pool does not exists"
        );
        require(
            IERC20(_lpToken).balanceOf(msg.sender) >= _amount,
            "Blacksmith: insufficient balance"
        );

        _updatePool(_lpToken);
        User storage user = users[_lpToken][msg.sender];
        _claimRewards(_lpToken, user);

        IERC20 token = IERC20(_lpToken);
        uint256 balanceBefore = token.balanceOf(address(this));
        token.safeTransferFrom(msg.sender, address(this), _amount);
        uint256 received = token.balanceOf(address(this)) - balanceBefore;

        user.amount = user.amount + received;
        pools[_lpToken].amount = pools[_lpToken].amount + received;
        _updateUserWriteoffs(_lpToken);
        emit Deposit(msg.sender, _lpToken, received);
    }

    /// @notice withdraw up to all user deposited
    function withdraw(address _lpToken, uint256 _amount)
        external
        override
        nonReentrant
        notPaused
    {
        require(
            pools[_lpToken].lastUpdatedAt > 0,
            "Blacksmith: pool does not exists"
        );
        _updatePool(_lpToken);

        User storage user = users[_lpToken][msg.sender];
        _claimRewards(_lpToken, user);
        uint256 amount = user.amount > _amount ? _amount : user.amount;
        user.amount = user.amount - amount;
        pools[_lpToken].amount = pools[_lpToken].amount - amount;
        _updateUserWriteoffs(_lpToken);

        _safeTransfer(_lpToken, amount);
        emit Withdraw(msg.sender, _lpToken, amount);
    }

    /// @notice withdraw all without rewards
    function emergencyWithdraw(address[] calldata _lpTokens)
        external
        override
        nonReentrant
    {
        for (uint256 i = 0; i < _lpTokens.length; i++) {
            User storage user = users[_lpTokens[i]][msg.sender];
            uint256 amount = user.amount;
            user.amount = 0;
            pools[_lpTokens[i]].amount = pools[_lpTokens[i]].amount - amount;
            _safeTransfer(_lpTokens[i], amount);
            emit Withdraw(msg.sender, _lpTokens[i], amount);
        }
    }

    /// @notice called by authorizers only
    function addBonus(
        address _lpToken,
        address _bonusTokenAddr,
        uint48 _startTime,
        uint256 _weeklyRewards,
        uint256 _transferAmount
    ) external override nonReentrant notPaused {
        require(
            _isAuthorized(allowedTokenAuthorizers[_lpToken][_bonusTokenAddr]),
            "BonusRewards: not authorized caller"
        );
        require(
            _startTime >= block.timestamp,
            "BonusRewards: startTime in the past"
        );

        // make sure the pool is in the right state (exist with no active bonus at the moment) to add new bonus tokens
        Pool memory pool = pools[_lpToken];
        require(pool.lastUpdatedAt > 0, "BonusRewards: pool does not exist");
        Bonus[] memory bonuses = pool.bonuses;
        for (uint256 i = 0; i < bonuses.length; i++) {
            if (bonuses[i].bonusTokenAddr == _bonusTokenAddr) {
                // when there is alreay a bonus program with the same bonus token, make sure the program has ended properly
                require(
                    bonuses[i].endTime + WEEK < block.timestamp,
                    "BonusRewards: last bonus period hasn't ended"
                );
                require(
                    bonuses[i].remBonus == 0,
                    "BonusRewards: last bonus not all claimed"
                );
            }
        }

        IERC20 bonusTokenAddr = IERC20(_bonusTokenAddr);
        uint256 balanceBefore = bonusTokenAddr.balanceOf(address(this));
        bonusTokenAddr.safeTransferFrom(
            msg.sender,
            address(this),
            _transferAmount
        );
        uint256 received = bonusTokenAddr.balanceOf(address(this)) -
            balanceBefore;
        // endTime is based on how much tokens transfered v.s. planned weekly rewards
        uint48 endTime = uint48(
            (received * WEEK) / _weeklyRewards + _startTime
        );

        pools[_lpToken].bonuses.push(
            Bonus({
                bonusTokenAddr: _bonusTokenAddr,
                startTime: _startTime,
                endTime: endTime,
                weeklyRewards: _weeklyRewards,
                accRewardsPerToken: 0,
                remBonus: received
            })
        );
    }

    /// @notice called by authorizers only, update weeklyRewards (if not ended), or update startTime (only if rewards not started, 0 is ignored)
    function updateBonus(
        address _lpToken,
        address _bonusTokenAddr,
        uint256 _weeklyRewards,
        uint48 _startTime
    ) external override nonReentrant notPaused {
        require(
            _isAuthorized(allowedTokenAuthorizers[_lpToken][_bonusTokenAddr]),
            "BonusRewards: not authorized caller"
        );
        require(
            _startTime == 0 || _startTime > block.timestamp,
            "BonusRewards: startTime in the past"
        );

        // make sure the pool is in the right state (exist with no active bonus at the moment) to add new bonus tokens
        Pool memory pool = pools[_lpToken];
        require(pool.lastUpdatedAt > 0, "BonusRewards: pool does not exist");
        Bonus[] memory bonuses = pool.bonuses;
        for (uint256 i = 0; i < bonuses.length; i++) {
            if (
                bonuses[i].bonusTokenAddr == _bonusTokenAddr &&
                bonuses[i].endTime > block.timestamp
            ) {
                Bonus storage bonus = pools[_lpToken].bonuses[i];
                _updatePool(_lpToken); // update pool with old weeklyReward to this block
                if (bonus.startTime >= block.timestamp) {
                    // only honor new start time, if program has not started
                    if (_startTime >= block.timestamp) {
                        bonus.startTime = _startTime;
                    }
                    bonus.endTime = uint48(
                        (bonus.remBonus * WEEK) /
                            _weeklyRewards +
                            bonus.startTime
                    );
                } else {
                    // remaining bonus to distribute * week
                    uint256 remBonusToDistribute = (bonus.endTime -
                        block.timestamp) * bonus.weeklyRewards;
                    bonus.endTime = uint48(
                        remBonusToDistribute / _weeklyRewards + block.timestamp
                    );
                }
                bonus.weeklyRewards = _weeklyRewards;
            }
        }
    }

    /// @notice extend the current bonus program, the program has to be active (endTime is in the future)
    function extendBonus(
        address _lpToken,
        uint256 _poolBonusId,
        address _bonusTokenAddr,
        uint256 _transferAmount
    ) external override nonReentrant notPaused {
        require(
            _isAuthorized(allowedTokenAuthorizers[_lpToken][_bonusTokenAddr]),
            "BonusRewards: not authorized caller"
        );

        Bonus memory bonus = pools[_lpToken].bonuses[_poolBonusId];
        require(
            bonus.bonusTokenAddr == _bonusTokenAddr,
            "BonusRewards: bonus and id dont match"
        );
        require(
            bonus.endTime > block.timestamp,
            "BonusRewards: bonus program ended, please start a new one"
        );

        IERC20 bonusTokenAddr = IERC20(_bonusTokenAddr);
        uint256 balanceBefore = bonusTokenAddr.balanceOf(address(this));
        bonusTokenAddr.safeTransferFrom(
            msg.sender,
            address(this),
            _transferAmount
        );
        uint256 received = bonusTokenAddr.balanceOf(address(this)) -
            balanceBefore;
        // endTime is based on how much tokens transfered v.s. planned weekly rewards
        uint48 endTime = uint48(
            (received * WEEK) / bonus.weeklyRewards + bonus.endTime
        );

        pools[_lpToken].bonuses[_poolBonusId].endTime = endTime;
        pools[_lpToken].bonuses[_poolBonusId].remBonus =
            bonus.remBonus +
            received;
    }

    /// @notice add pools and authorizers to add bonus tokens for pools, combine two calls into one. Only reason we add pools is when bonus tokens will be added
    function addPoolsAndAllowBonus(
        address[] calldata _lpTokens,
        address[] calldata _bonusTokenAddrs,
        address[] calldata _authorizers
    ) external override onlyOwner notPaused {
        // add pools
        uint256 currentTime = block.timestamp;
        for (uint256 i = 0; i < _lpTokens.length; i++) {
            address _lpToken = _lpTokens[i];
            require(
                IERC20(_lpToken).decimals() <= 18,
                "BonusRewards: lptoken decimals > 18"
            );
            if (pools[_lpToken].lastUpdatedAt == 0) {
                pools[_lpToken].lastUpdatedAt = currentTime;
                poolList.push(_lpToken);
            }

            // add bonus tokens and their authorizers (who are allowed to add the token to pool)
            for (uint256 j = 0; j < _bonusTokenAddrs.length; j++) {
                address _bonusTokenAddr = _bonusTokenAddrs[j];
                allowedTokenAuthorizers[_lpToken][
                    _bonusTokenAddr
                ] = _authorizers;
                bonusTokenAddrMap[_bonusTokenAddr] = 1;
            }
        }
    }

    /// @notice collect bonus token dust to treasury
    function collectDust(
        address _token,
        address _lpToken,
        uint256 _poolBonusId
    ) external override onlyOwner {
        require(
            pools[_token].lastUpdatedAt == 0,
            "BonusRewards: lpToken, not allowed"
        );

        if (_token == address(0)) {
            // token address(0) = ETH
            payable(owner()).transfer(address(this).balance);
        } else {
            uint256 balance = IERC20(_token).balanceOf(address(this));
            if (bonusTokenAddrMap[_token] == 1) {
                // bonus token
                Bonus memory bonus = pools[_lpToken].bonuses[_poolBonusId];
                require(
                    bonus.bonusTokenAddr == _token,
                    "BonusRewards: wrong pool"
                );
                require(
                    bonus.endTime + WEEK < block.timestamp,
                    "BonusRewards: not ready"
                );
                balance = bonus.remBonus;
                pools[_lpToken].bonuses[_poolBonusId].remBonus = 0;
            }

            IERC20(_token).transfer(owner(), balance);
        }
    }

    function setResponders(address[] calldata _responders)
        external
        override
        onlyOwner
    {
        responders = _responders;
    }

    function setPaused(bool _paused) external override {
        require(
            _isAuthorized(responders),
            "BonusRewards: caller not responder"
        );
        paused = _paused;
    }

    function getPool(address _lpToken)
        external
        view
        override
        returns (Pool memory)
    {
        return pools[_lpToken];
    }

    function getUser(address _lpToken, address _account)
        external
        view
        override
        returns (User memory, uint256[] memory)
    {
        return (users[_lpToken][_account], viewRewards(_lpToken, _account));
    }

    function getAuthorizers(address _lpToken, address _bonusTokenAddr)
        external
        view
        override
        returns (address[] memory)
    {
        return allowedTokenAuthorizers[_lpToken][_bonusTokenAddr];
    }

    function getResponders() external view override returns (address[] memory) {
        return responders;
    }

    function viewRewards(address _lpToken, address _user)
        public
        view
        override
        returns (uint256[] memory)
    {
        Pool memory pool = pools[_lpToken];
        User memory user = users[_lpToken][_user];
        uint256[] memory rewards = new uint256[](pool.bonuses.length);
        if (user.amount <= 0) return rewards;

        uint256 rewardsWriteoffsLen = user.rewardsWriteoffs.length;
        for (uint256 i = 0; i < rewards.length; i++) {
            Bonus memory bonus = pool.bonuses[i];
            if (bonus.startTime < block.timestamp && bonus.remBonus > 0) {
                uint256 lpTotal = pool.amount;
                uint256 bonusForTime = _calRewardsForTime(
                    bonus,
                    pool.lastUpdatedAt
                );
                uint256 bonusPerToken = bonus.accRewardsPerToken +
                    bonusForTime /
                    lpTotal;
                uint256 rewardsWriteoff = rewardsWriteoffsLen <= i
                    ? 0
                    : user.rewardsWriteoffs[i];
                uint256 reward = (user.amount * bonusPerToken) /
                    CAL_MULTIPLIER -
                    rewardsWriteoff;
                rewards[i] = reward < bonus.remBonus ? reward : bonus.remBonus;
            }
        }
        return rewards;
    }

    function getPoolList() external view override returns (address[] memory) {
        return poolList;
    }

    /// @notice update pool's bonus per staked token till current block timestamp, do nothing if pool does not exist
    function _updatePool(address _lpToken) private {
        Pool storage pool = pools[_lpToken];
        uint256 poolLastUpdatedAt = pool.lastUpdatedAt;
        if (poolLastUpdatedAt == 0 || block.timestamp <= poolLastUpdatedAt)
            return;
        pool.lastUpdatedAt = block.timestamp;
        uint256 lpTotal = pool.amount;
        if (lpTotal == 0) return;

        for (uint256 i = 0; i < pool.bonuses.length; i++) {
            Bonus storage bonus = pool.bonuses[i];
            if (
                poolLastUpdatedAt < bonus.endTime &&
                bonus.startTime < block.timestamp
            ) {
                uint256 bonusForTime = _calRewardsForTime(
                    bonus,
                    poolLastUpdatedAt
                );
                bonus.accRewardsPerToken =
                    bonus.accRewardsPerToken +
                    bonusForTime /
                    lpTotal;
            }
        }
    }

    function _updateUserWriteoffs(address _lpToken) private {
        Bonus[] memory bonuses = pools[_lpToken].bonuses;
        User storage user = users[_lpToken][msg.sender];
        for (uint256 i = 0; i < bonuses.length; i++) {
            // update writeoff to match current acc rewards per token
            if (user.rewardsWriteoffs.length == i) {
                user.rewardsWriteoffs.push(
                    (user.amount * bonuses[i].accRewardsPerToken) /
                        CAL_MULTIPLIER
                );
            } else {
                user.rewardsWriteoffs[i] =
                    (user.amount * bonuses[i].accRewardsPerToken) /
                    CAL_MULTIPLIER;
            }
        }
    }

    /// @notice transfer upto what the contract has
    function _safeTransfer(address _token, uint256 _amount)
        private
        returns (uint256 _transferred)
    {
        IERC20 token = IERC20(_token);
        uint256 balance = token.balanceOf(address(this));
        if (balance > _amount) {
            token.safeTransfer(msg.sender, _amount);
            _transferred = _amount;
        } else if (balance > 0) {
            token.safeTransfer(msg.sender, balance);
            _transferred = balance;
        }
    }

    function _calRewardsForTime(Bonus memory _bonus, uint256 _lastUpdatedAt)
        internal
        view
        returns (uint256)
    {
        if (_bonus.endTime <= _lastUpdatedAt) return 0;

        uint256 calEndTime = block.timestamp > _bonus.endTime
            ? _bonus.endTime
            : block.timestamp;
        uint256 calStartTime = _lastUpdatedAt > _bonus.startTime
            ? _lastUpdatedAt
            : _bonus.startTime;
        uint256 timePassed = calEndTime - calStartTime;
        return (_bonus.weeklyRewards * CAL_MULTIPLIER * timePassed) / WEEK;
    }

    function _claimRewards(address _lpToken, User memory _user) private {
        // only claim if user has deposited before
        if (_user.amount == 0) return;
        uint256 rewardsWriteoffsLen = _user.rewardsWriteoffs.length;
        Bonus[] memory bonuses = pools[_lpToken].bonuses;
        for (uint256 i = 0; i < bonuses.length; i++) {
            uint256 rewardsWriteoff = rewardsWriteoffsLen <= i
                ? 0
                : _user.rewardsWriteoffs[i];
            uint256 bonusSinceLastUpdate = (_user.amount *
                bonuses[i].accRewardsPerToken) /
                CAL_MULTIPLIER -
                rewardsWriteoff;
            uint256 toTransfer = bonuses[i].remBonus < bonusSinceLastUpdate
                ? bonuses[i].remBonus
                : bonusSinceLastUpdate;
            if (toTransfer == 0) continue;
            uint256 transferred = _safeTransfer(
                bonuses[i].bonusTokenAddr,
                toTransfer
            );
            pools[_lpToken].bonuses[i].remBonus =
                bonuses[i].remBonus -
                transferred;
        }
    }

    // only owner or authorized users from list
    function _isAuthorized(address[] memory checkList)
        private
        view
        returns (bool)
    {
        if (msg.sender == owner()) return true;

        for (uint256 i = 0; i < checkList.length; i++) {
            if (msg.sender == checkList[i]) {
                return true;
            }
        }
        return false;
    }
}

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"lpToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"lpToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[{"internalType":"address","name":"_lpToken","type":"address"},{"internalType":"address","name":"_bonusTokenAddr","type":"address"},{"internalType":"uint48","name":"_startTime","type":"uint48"},{"internalType":"uint256","name":"_weeklyRewards","type":"uint256"},{"internalType":"uint256","name":"_transferAmount","type":"uint256"}],"name":"addBonus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_lpTokens","type":"address[]"},{"internalType":"address[]","name":"_bonusTokenAddrs","type":"address[]"},{"internalType":"address[]","name":"_authorizers","type":"address[]"}],"name":"addPoolsAndAllowBonus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_lpTokens","type":"address[]"}],"name":"claimRewardsForPools","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_lpToken","type":"address"},{"internalType":"uint256","name":"_poolBonusId","type":"uint256"}],"name":"collectDust","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_lpToken","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_lpTokens","type":"address[]"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_lpToken","type":"address"},{"internalType":"uint256","name":"_poolBonusId","type":"uint256"},{"internalType":"address","name":"_bonusTokenAddr","type":"address"},{"internalType":"uint256","name":"_transferAmount","type":"uint256"}],"name":"extendBonus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_lpToken","type":"address"},{"internalType":"address","name":"_bonusTokenAddr","type":"address"}],"name":"getAuthorizers","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_lpToken","type":"address"}],"name":"getPool","outputs":[{"components":[{"components":[{"internalType":"address","name":"bonusTokenAddr","type":"address"},{"internalType":"uint48","name":"startTime","type":"uint48"},{"internalType":"uint48","name":"endTime","type":"uint48"},{"internalType":"uint256","name":"weeklyRewards","type":"uint256"},{"internalType":"uint256","name":"accRewardsPerToken","type":"uint256"},{"internalType":"uint256","name":"remBonus","type":"uint256"}],"internalType":"struct IBonusRewards.Bonus[]","name":"bonuses","type":"tuple[]"},{"internalType":"uint256","name":"lastUpdatedAt","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct IBonusRewards.Pool","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPoolList","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getResponders","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_lpToken","type":"address"},{"internalType":"address","name":"_account","type":"address"}],"name":"getUser","outputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256[]","name":"rewardsWriteoffs","type":"uint256[]"}],"internalType":"struct IBonusRewards.User","name":"","type":"tuple"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_paused","type":"bool"}],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_responders","type":"address[]"}],"name":"setResponders","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_lpToken","type":"address"},{"internalType":"address","name":"_bonusTokenAddr","type":"address"},{"internalType":"uint256","name":"_weeklyRewards","type":"uint256"},{"internalType":"uint48","name":"_startTime","type":"uint48"}],"name":"updateBonus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_lpToken","type":"address"},{"internalType":"address","name":"_user","type":"address"}],"name":"viewRewards","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_lpToken","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

Contract Creation Code

608060405234801561001057600080fd5b506004361061012c5760003560e01c80638da5cb5b116100ad578063bbe4f6db11610071578063bbe4f6db14610288578063bed4df20146102a8578063d41dcbea146102bb578063f2fde38b146102c3578063f3fef3a3146102d657600080fd5b80638da5cb5b1461021357806390bde5171461022e578063a55c38681461024f578063abca8a2e14610262578063bb10aa991461027557600080fd5b806347e7ef24116100f457806347e7ef241461019d57806352985ac6146101b05780635c975abb146101d0578063664c0bf9146101ed5780638c880e021461020057600080fd5b806301c1dfba1461013157806312faae931461014657806316c38b3c146101645780631eaa7a7b146101775780632c43e2ef1461018a575b600080fd5b61014461013f366004613627565b6102e9565b005b61014e6104e5565b60405161015b91906137d0565b60405180910390f35b610144610172366004613703565b610547565b6101446101853660046134db565b610614565b610144610198366004613627565b6109ee565b6101446101ab3660046135b9565b610b3a565b6101c36101be3660046134a8565b610f13565b60405161015b919061381d565b6002546101dd9060ff1681565b604051901515815260200161015b565b6101446101fb366004613627565b611237565b61014461020e366004613669565b61126d565b6000546040516001600160a01b03909116815260200161015b565b61024161023c3660046134a8565b6114fc565b60405161015b929190613a72565b61014461025d3660046135e3565b6115bf565b610144610270366004613517565b611a35565b61014e6102833660046134a8565b611e49565b61029b610296366004613486565b611ecc565b60405161015b91906139c4565b6101446102b6366004613564565b611fd6565b61014e6125ef565b6101446102d1366004613486565b61264f565b6101446102e43660046135b9565b612739565b600260015414156103155760405162461bcd60e51b815260040161030c9061398d565b60405180910390fd5b600260015560005b818110156104dc5760006006600085858581811061033d5761033d613b82565b90506020020160208101906103529190613486565b6001600160a01b03168152602080820192909252604090810160009081203382529092528120805482825590925090819060059087878781811061039857610398613b82565b90506020020160208101906103ad9190613486565b6001600160a01b03166001600160a01b03168152602001908152602001600020600201546103db9190613b0e565b600560008787878181106103f1576103f1613b82565b90506020020160208101906104069190613486565b6001600160a01b0316815260208101919091526040016000206002015561045385858581811061043857610438613b82565b905060200201602081019061044d9190613486565b8261294f565b5084848481811061046657610466613b82565b905060200201602081019061047b9190613486565b6001600160a01b0316336001600160a01b03167f9b1bfa7fa9ee420a16e124f794c35ac9f90472acc99140eb2f6447c714cad8eb836040516104bf91815260200190565b60405180910390a3505080806104d490613b51565b91505061031d565b50506001805550565b6060600380548060200260200160405190810160405280929190818152602001828054801561053d57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161051f575b5050505050905090565b6105aa60038054806020026020016040519081016040528092919081815260200182805480156105a057602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610582575b5050505050612a19565b6106015760405162461bcd60e51b815260206004820152602260248201527f426f6e7573526577617264733a2063616c6c6572206e6f7420726573706f6e6460448201526132b960f11b606482015260840161030c565b6002805460ff1916911515919091179055565b6000546001600160a01b0316331461063e5760405162461bcd60e51b815260040161030c90613915565b6001600160a01b038316600090815260056020526040902060010154156106b25760405162461bcd60e51b815260206004820152602260248201527f426f6e7573526577617264733a206c70546f6b656e2c206e6f7420616c6c6f77604482015261195960f21b606482015260840161030c565b6001600160a01b03831661070057600080546040516001600160a01b03909116914780156108fc02929091818181858888f193505050501580156106fa573d6000803e3d6000fd5b50505050565b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a082319060240160206040518083038186803b15801561074257600080fd5b505afa158015610756573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061077a919061373d565b6001600160a01b03851660009081526008602052604090205490915060ff1660011415610945576001600160a01b03831660009081526005602052604081208054849081106107cb576107cb613b82565b60009182526020918290206040805160c081018252600490930290910180546001600160a01b0380821680865265ffffffffffff600160a01b8404811697870197909752600160d01b9092049095169284019290925260018101546060840152600281015460808401526003015460a0830152909250908616146108915760405162461bcd60e51b815260206004820152601860248201527f426f6e7573526577617264733a2077726f6e6720706f6f6c0000000000000000604482015260640161030c565b4262093a80826040015165ffffffffffff166108ad9190613ab5565b106108fa5760405162461bcd60e51b815260206004820152601760248201527f426f6e7573526577617264733a206e6f74207265616479000000000000000000604482015260640161030c565b60a08101516001600160a01b0385166000908152600560205260408120805492945090918590811061092e5761092e613b82565b906000526020600020906004020160030181905550505b836001600160a01b031663a9059cbb6109666000546001600160a01b031690565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101849052604401602060405180830381600087803b1580156109ae57600080fd5b505af11580156109c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e69190613720565b50505b505050565b60026001541415610a115760405162461bcd60e51b815260040161030c9061398d565b600260018190555460ff1615610a395760405162461bcd60e51b815260040161030c906138e7565b60005b818110156104dc576000838383818110610a5857610a58613b82565b9050602002016020810190610a6d9190613486565b6001600160a01b03811660009081526006602090815260408083203384528252808320815180830183528154815260018201805484518187028101870190955280855296975094959094919385810193929190830182828015610aef57602002820191906000526020600020905b815481526020019060010190808311610adb575b505050919092525050815191925050610b09575050610b28565b610b1282612a98565b610b1c8282612be9565b610b2582612e50565b50505b80610b3281613b51565b915050610a3c565b60026001541415610b5d5760405162461bcd60e51b815260040161030c9061398d565b600260018190555460ff1615610b855760405162461bcd60e51b815260040161030c906138e7565b6001600160a01b038216600090815260056020526040902060010154610bed5760405162461bcd60e51b815260206004820181905260248201527f426c61636b736d6974683a20706f6f6c20646f6573206e6f7420657869737473604482015260640161030c565b6040516370a0823160e01b815233600482015281906001600160a01b038416906370a082319060240160206040518083038186803b158015610c2e57600080fd5b505afa158015610c42573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c66919061373d565b1015610cb45760405162461bcd60e51b815260206004820181905260248201527f426c61636b736d6974683a20696e73756666696369656e742062616c616e6365604482015260640161030c565b610cbd82612a98565b6001600160a01b038216600090815260066020908152604080832033845282529182902082518084018452815481526001820180548551818602810186019096528086529294610d5094889487938583019392909190830182828015610d4257602002820191906000526020600020905b815481526020019060010190808311610d2e575b505050505081525050612be9565b6040516370a0823160e01b815230600482015283906000906001600160a01b038316906370a082319060240160206040518083038186803b158015610d9457600080fd5b505afa158015610da8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcc919061373d565b9050610de36001600160a01b038316333087613026565b6040516370a0823160e01b815230600482015260009082906001600160a01b038516906370a082319060240160206040518083038186803b158015610e2757600080fd5b505afa158015610e3b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e5f919061373d565b610e699190613b0e565b8454909150610e79908290613ab5565b84556001600160a01b038616600090815260056020526040902060020154610ea2908290613ab5565b6001600160a01b038716600090815260056020526040902060020155610ec786612e50565b6040518181526001600160a01b0387169033907f5548c837ab068cf56a2c2479df0882a4922fd203edb7517321831d95078c5f629060200160405180910390a350506001805550505050565b6001600160a01b038216600090815260056020908152604080832081518154608094810282018501909352606081810184815290959491938492849190879085015b82821015610fd85760008481526020908190206040805160c0810182526004860290920180546001600160a01b038116845265ffffffffffff600160a01b8204811685870152600160d01b909104169183019190915260018082015460608401526002820154608084015260039091015460a08301529083529092019101610f55565b505050908252506001828101546020808401919091526002909301546040928301526001600160a01b038089166000908152600685528381209189168152908452828120835180850185528154815292810180548551818802810188019096528086529697509195929490938582019390929183018282801561107a57602002820191906000526020600020905b815481526020019060010190808311611066575b5050505050815250509050600082600001515167ffffffffffffffff8111156110a5576110a5613b98565b6040519080825280602002602001820160405280156110ce578160200160208202803683370190505b5082519091506110e2579250611231915050565b60208201515160005b82518110156112295760008560000151828151811061110c5761110c613b82565b6020026020010151905042816020015165ffffffffffff16108015611135575060008160a00151115b15611216576000866040015190506000611153838960200151613091565b905060006111618383613acd565b84608001516111709190613ab5565b905060008587111561119f578860200151868151811061119257611192613b82565b60200260200101516111a2565b60005b90506000816c0c9f2c9cd04674edea40000000848c600001516111c59190613aef565b6111cf9190613acd565b6111d99190613b0e565b90508560a0015181106111f0578560a001516111f2565b805b89888151811061120457611204613b82565b60200260200101818152505050505050505b508061122181613b51565b9150506110eb565b509093505050505b92915050565b6000546001600160a01b031633146112615760405162461bcd60e51b815260040161030c90613915565b6109e960038383613397565b6000546001600160a01b031633146112975760405162461bcd60e51b815260040161030c90613915565b60025460ff16156112ba5760405162461bcd60e51b815260040161030c906138e7565b4260005b868110156114f25760008888838181106112da576112da613b82565b90506020020160208101906112ef9190613486565b90506012816001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561132c57600080fd5b505afa158015611340573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113649190613756565b60ff1611156113c15760405162461bcd60e51b815260206004820152602360248201527f426f6e7573526577617264733a206c70746f6b656e20646563696d616c73203e60448201526204062760eb1b606482015260840161030c565b6001600160a01b038116600090815260056020526040902060010154611441576001600160a01b038116600081815260056020526040812060019081018690556004805491820181559091527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0180546001600160a01b03191690911790555b60005b868110156114dd57600088888381811061146057611460613b82565b90506020020160208101906114759190613486565b6001600160a01b0380851660009081526007602090815260408083209385168352929052209091506114a8908888613397565b506001600160a01b03166000908152600860205260409020805460ff19166001179055806114d581613b51565b915050611444565b505080806114ea90613b51565b9150506112be565b5050505050505050565b6040805180820190915260008152606060208201526001600160a01b0380841660009081526006602090815260408083209386168352929052206060906115438585610f13565b8160405180604001604052908160008201548152602001600182018054806020026020016040519081016040528092919081815260200182805480156115a857602002820191906000526020600020905b815481526020019060010190808311611594575b5050505050815250509150915091505b9250929050565b600260015414156115e25760405162461bcd60e51b815260040161030c9061398d565b600260018190555460ff161561160a5760405162461bcd60e51b815260040161030c906138e7565b6001600160a01b038085166000908152600760209081526040808320938616835292815290829020805483518184028101840190945280845261168993928301828280156105a0576020028201919060005260206000209081546001600160a01b03168152600190910190602001808311610582575050505050612a19565b6116a55760405162461bcd60e51b815260040161030c9061394a565b6001600160a01b03841660009081526005602052604081208054859081106116cf576116cf613b82565b60009182526020918290206040805160c081018252600490930290910180546001600160a01b0380821680865265ffffffffffff600160a01b8404811697870197909752600160d01b9092049095169284019290925260018101546060840152600281015460808401526003015460a0830152909250908416146117a35760405162461bcd60e51b815260206004820152602560248201527f426f6e7573526577617264733a20626f6e757320616e6420696420646f6e74206044820152640dac2e8c6d60db1b606482015260840161030c565b42816040015165ffffffffffff16116118245760405162461bcd60e51b815260206004820152603960248201527f426f6e7573526577617264733a20626f6e75732070726f6772616d20656e646560448201527f642c20706c656173652073746172742061206e6577206f6e6500000000000000606482015260840161030c565b6040516370a0823160e01b815230600482015283906000906001600160a01b038316906370a082319060240160206040518083038186803b15801561186857600080fd5b505afa15801561187c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118a0919061373d565b90506118b76001600160a01b038316333087613026565b6040516370a0823160e01b815230600482015260009082906001600160a01b038516906370a082319060240160206040518083038186803b1580156118fb57600080fd5b505afa15801561190f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611933919061373d565b61193d9190613b0e565b90506000846040015165ffffffffffff16856060015162093a80846119629190613aef565b61196c9190613acd565b6119769190613ab5565b6001600160a01b038a166000908152600560205260409020805491925082918a9081106119a5576119a5613b82565b9060005260206000209060040201600001601a6101000a81548165ffffffffffff021916908365ffffffffffff160217905550818560a001516119e89190613ab5565b6001600160a01b038a16600090815260056020526040902080548a908110611a1257611a12613b82565b600091825260209091206003600490920201015550506001805550505050505050565b60026001541415611a585760405162461bcd60e51b815260040161030c9061398d565b600260018190555460ff1615611a805760405162461bcd60e51b815260040161030c906138e7565b6001600160a01b0380851660009081526007602090815260408083209387168352928152908290208054835181840281018401909452808452611aff93928301828280156105a0576020028201919060005260206000209081546001600160a01b03168152600190910190602001808311610582575050505050612a19565b611b1b5760405162461bcd60e51b815260040161030c9061394a565b65ffffffffffff81161580611b375750428165ffffffffffff16115b611b535760405162461bcd60e51b815260040161030c90613863565b6001600160a01b03841660009081526005602090815260408083208151815460809481028201850190935260608101838152909391928492849190879085015b82821015611c165760008481526020908190206040805160c0810182526004860290920180546001600160a01b038116845265ffffffffffff600160a01b8204811685870152600160d01b909104169183019190915260018082015460608401526002820154608084015260039091015460a08301529083529092019101611b93565b5050505081526020016001820154815260200160028201548152505090506000816020015111611c585760405162461bcd60e51b815260040161030c906138a6565b805160005b8151811015611e3c57856001600160a01b0316828281518110611c8257611c82613b82565b6020026020010151600001516001600160a01b0316148015611cc8575042828281518110611cb257611cb2613b82565b60200260200101516040015165ffffffffffff16115b15611e2a576001600160a01b0387166000908152600560205260408120805483908110611cf757611cf7613b82565b90600052602060002090600402019050611d1088612a98565b805442600160a01b90910465ffffffffffff1610611dba57428565ffffffffffff1610611d5857805465ffffffffffff60a01b1916600160a01b65ffffffffffff8716021781555b80546003820154600160a01b90910465ffffffffffff16908790611d809062093a8090613aef565b611d8a9190613acd565b611d949190613ab5565b815465ffffffffffff91909116600160d01b026001600160d01b03909116178155611e23565b6001810154815460009190611ddf904290600160d01b900465ffffffffffff16613b0e565b611de99190613aef565b905042611df68883613acd565b611e009190613ab5565b825465ffffffffffff91909116600160d01b026001600160d01b03909116178255505b6001018590555b80611e3481613b51565b915050611c5d565b5050600180555050505050565b6001600160a01b038083166000908152600760209081526040808320938516835292815290829020805483518184028101840190945280845260609392830182828015611ebf57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611ea1575b5050505050905092915050565b611ef060405180606001604052806060815260200160008152602001600081525090565b6001600160a01b03821660009081526005602090815260408083208151815460809481028201850190935260608101838152909491938593919285929185015b82821015611fb35760008481526020908190206040805160c0810182526004860290920180546001600160a01b038116845265ffffffffffff600160a01b8204811685870152600160d01b909104169183019190915260018082015460608401526002820154608084015260039091015460a08301529083529092019101611f30565b505050508152602001600182015481526020016002820154815250509050919050565b60026001541415611ff95760405162461bcd60e51b815260040161030c9061398d565b600260018190555460ff16156120215760405162461bcd60e51b815260040161030c906138e7565b6001600160a01b03808616600090815260076020908152604080832093881683529281529082902080548351818402810184019094528084526120a093928301828280156105a0576020028201919060005260206000209081546001600160a01b03168152600190910190602001808311610582575050505050612a19565b6120bc5760405162461bcd60e51b815260040161030c9061394a565b428365ffffffffffff1610156120e45760405162461bcd60e51b815260040161030c90613863565b6001600160a01b03851660009081526005602090815260408083208151815460809481028201850190935260608101838152909391928492849190879085015b828210156121a75760008481526020908190206040805160c0810182526004860290920180546001600160a01b038116845265ffffffffffff600160a01b8204811685870152600160d01b909104169183019190915260018082015460608401526002820154608084015260039091015460a08301529083529092019101612124565b50505050815260200160018201548152602001600282015481525050905060008160200151116121e95760405162461bcd60e51b815260040161030c906138a6565b805160005b815181101561235557866001600160a01b031682828151811061221357612213613b82565b6020026020010151600001516001600160a01b03161415612343574262093a8083838151811061224557612245613b82565b60200260200101516040015165ffffffffffff166122639190613ab5565b106122c55760405162461bcd60e51b815260206004820152602c60248201527f426f6e7573526577617264733a206c61737420626f6e757320706572696f642060448201526b1a185cdb89dd08195b99195960a21b606482015260840161030c565b8181815181106122d7576122d7613b82565b602002602001015160a001516000146123435760405162461bcd60e51b815260206004820152602860248201527f426f6e7573526577617264733a206c61737420626f6e7573206e6f7420616c6c6044820152670818db185a5b595960c21b606482015260840161030c565b8061234d81613b51565b9150506121ee565b506040516370a0823160e01b815230600482015286906000906001600160a01b038316906370a082319060240160206040518083038186803b15801561239a57600080fd5b505afa1580156123ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123d2919061373d565b90506123e96001600160a01b038316333088613026565b6040516370a0823160e01b815230600482015260009082906001600160a01b038516906370a082319060240160206040518083038186803b15801561242d57600080fd5b505afa158015612441573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612465919061373d565b61246f9190613b0e565b9050600065ffffffffffff89168861248a62093a8085613aef565b6124949190613acd565b61249e9190613ab5565b9050600560008c6001600160a01b03166001600160a01b031681526020019081526020016000206000016040518060c001604052808c6001600160a01b031681526020018b65ffffffffffff1681526020018365ffffffffffff1681526020018a81526020016000815260200184815250908060018154018082558091505060019003906000526020600020906004020160009091909190915060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060208201518160000160146101000a81548165ffffffffffff021916908365ffffffffffff160217905550604082015181600001601a6101000a81548165ffffffffffff021916908365ffffffffffff160217905550606082015181600101556080820151816002015560a082015181600301555050505050505050600180819055505050505050565b6060600480548060200260200160405190810160405280929190818152602001828054801561053d576020028201919060005260206000209081546001600160a01b0316815260019091019060200180831161051f575050505050905090565b6000546001600160a01b031633146126795760405162461bcd60e51b815260040161030c90613915565b6001600160a01b0381166126de5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161030c565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6002600154141561275c5760405162461bcd60e51b815260040161030c9061398d565b600260018190555460ff16156127845760405162461bcd60e51b815260040161030c906138e7565b6001600160a01b0382166000908152600560205260409020600101546127ec5760405162461bcd60e51b815260206004820181905260248201527f426c61636b736d6974683a20706f6f6c20646f6573206e6f7420657869737473604482015260640161030c565b6127f582612a98565b6001600160a01b03821660009081526006602090815260408083203384528252918290208251808401845281548152600182018054855181860281018601909652808652929461288694889487938583019392909190830182828015610d425760200282019190600052602060002090815481526020019060010190808311610d2e57505050505081525050612be9565b60008282600001541161289a57815461289c565b825b82549091506128ac908290613b0e565b82556001600160a01b0384166000908152600560205260409020600201546128d5908290613b0e565b6001600160a01b0385166000908152600560205260409020600201556128fa84612e50565b612904848261294f565b506040518181526001600160a01b0385169033907f9b1bfa7fa9ee420a16e124f794c35ac9f90472acc99140eb2f6447c714cad8eb9060200160405180910390a35050600180555050565b6040516370a0823160e01b8152306004820152600090839082906001600160a01b038316906370a082319060240160206040518083038186803b15801561299557600080fd5b505afa1580156129a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129cd919061373d565b9050838111156129f3576129eb6001600160a01b0383163386613152565b839250612a11565b8015612a1157612a0d6001600160a01b0383163383613152565b8092505b505092915050565b600080546001600160a01b0316331415612a3557506001919050565b60005b8251811015612a8f57828181518110612a5357612a53613b82565b60200260200101516001600160a01b0316336001600160a01b03161415612a7d5750600192915050565b80612a8781613b51565b915050612a38565b50600092915050565b6001600160a01b03811660009081526005602052604090206001810154801580612ac25750804211155b15612acc57505050565b426001830155600282015480612ae25750505050565b60005b83548110156109e6576000846000018281548110612b0557612b05613b82565b600091825260209091206004909102018054909150600160d01b900465ffffffffffff1684108015612b475750805442600160a01b90910465ffffffffffff16105b15612bd6576040805160c08101825282546001600160a01b038116825265ffffffffffff600160a01b820481166020840152600160d01b90910416918101919091526001820154606082015260028201546080820152600382015460a0820152600090612bb49086613091565b9050612bc08482613acd565b8260020154612bcf9190613ab5565b6002830155505b5080612be181613b51565b915050612ae5565b8051612bf3575050565b602080820151516001600160a01b03841660009081526005835260408082208054825181870281018701909352808352939492939192909190849084015b82821015612cb45760008481526020908190206040805160c0810182526004860290920180546001600160a01b038116845265ffffffffffff600160a01b8204811685870152600160d01b909104169183019190915260018082015460608401526002820154608084015260039091015460a08301529083529092019101612c31565b50505050905060005b81518110156109e657600081841115612cf35784602001518281518110612ce657612ce6613b82565b6020026020010151612cf6565b60005b90506000816c0c9f2c9cd04674edea40000000858581518110612d1b57612d1b613b82565b6020026020010151608001518860000151612d369190613aef565b612d409190613acd565b612d4a9190613b0e565b9050600081858581518110612d6157612d61613b82565b602002602001015160a0015110612d785781612d97565b848481518110612d8a57612d8a613b82565b602002602001015160a001515b905080612da657505050612e3e565b6000612dcf868681518110612dbd57612dbd613b82565b6020026020010151600001518361294f565b905080868681518110612de457612de4613b82565b602002602001015160a00151612dfa9190613b0e565b6001600160a01b038a166000908152600560205260409020805487908110612e2457612e24613b82565b906000526020600020906004020160030181905550505050505b80612e4881613b51565b915050612cbd565b6001600160a01b038116600090815260056020908152604080832080548251818502810185019093528083529192909190849084015b82821015612f095760008481526020908190206040805160c0810182526004860290920180546001600160a01b038116845265ffffffffffff600160a01b8204811685870152600160d01b909104169183019190915260018082015460608401526002820154608084015260039091015460a08301529083529092019101612e86565b505050506001600160a01b038316600090815260066020908152604080832033845290915281209192505b82518110156106fa576001820154811415612fad57816001016c0c9f2c9cd04674edea40000000848381518110612f6d57612f6d613b82565b6020026020010151608001518460000154612f889190613aef565b612f929190613acd565b81546001810183556000928352602090922090910155613014565b6c0c9f2c9cd04674edea40000000838281518110612fcd57612fcd613b82565b6020026020010151608001518360000154612fe89190613aef565b612ff29190613acd565b82600101828154811061300757613007613b82565b6000918252602090912001555b8061301e81613b51565b915050612f34565b6040516001600160a01b03808516602483015283166044820152606481018290526106fa9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152613182565b600081836040015165ffffffffffff16116130ae57506000611231565b6000836040015165ffffffffffff1642116130c957426130d7565b836040015165ffffffffffff165b90506000846020015165ffffffffffff16841161310057846020015165ffffffffffff16613102565b835b905060006131108284613b0e565b905062093a80816c0c9f2c9cd04674edea4000000088606001516131349190613aef565b61313e9190613aef565b6131489190613acd565b9695505050505050565b6040516001600160a01b0383166024820152604481018290526109e990849063a9059cbb60e01b9060640161305a565b60006131d7826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166132549092919063ffffffff16565b8051909150156109e957808060200190518101906131f59190613720565b6109e95760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161030c565b6060613263848460008561326b565b949350505050565b60606132768561335e565b6132c25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161030c565b600080866001600160a01b031685876040516132de91906137b4565b60006040518083038185875af1925050503d806000811461331b576040519150601f19603f3d011682016040523d82523d6000602084013e613320565b606091505b509150915081156133345791506132639050565b8051156133445780518082602001fd5b8360405162461bcd60e51b815260040161030c9190613830565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470818114801590613263575050151592915050565b8280548282559060005260206000209081019282156133ea579160200282015b828111156133ea5781546001600160a01b0319166001600160a01b038435161782556020909201916001909101906133b7565b506133f69291506133fa565b5090565b5b808211156133f657600081556001016133fb565b80356001600160a01b038116811461342657600080fd5b919050565b60008083601f84011261343d57600080fd5b50813567ffffffffffffffff81111561345557600080fd5b6020830191508360208260051b85010111156115b857600080fd5b803565ffffffffffff8116811461342657600080fd5b60006020828403121561349857600080fd5b6134a18261340f565b9392505050565b600080604083850312156134bb57600080fd5b6134c48361340f565b91506134d26020840161340f565b90509250929050565b6000806000606084860312156134f057600080fd5b6134f98461340f565b92506135076020850161340f565b9150604084013590509250925092565b6000806000806080858703121561352d57600080fd5b6135368561340f565b93506135446020860161340f565b92506040850135915061355960608601613470565b905092959194509250565b600080600080600060a0868803121561357c57600080fd5b6135858661340f565b94506135936020870161340f565b93506135a160408701613470565b94979396509394606081013594506080013592915050565b600080604083850312156135cc57600080fd5b6135d58361340f565b946020939093013593505050565b600080600080608085870312156135f957600080fd5b6136028561340f565b9350602085013592506136176040860161340f565b9396929550929360600135925050565b6000806020838503121561363a57600080fd5b823567ffffffffffffffff81111561365157600080fd5b61365d8582860161342b565b90969095509350505050565b6000806000806000806060878903121561368257600080fd5b863567ffffffffffffffff8082111561369a57600080fd5b6136a68a838b0161342b565b909850965060208901359150808211156136bf57600080fd5b6136cb8a838b0161342b565b909650945060408901359150808211156136e457600080fd5b506136f189828a0161342b565b979a9699509497509295939492505050565b60006020828403121561371557600080fd5b81356134a181613bae565b60006020828403121561373257600080fd5b81516134a181613bae565b60006020828403121561374f57600080fd5b5051919050565b60006020828403121561376857600080fd5b815160ff811681146134a157600080fd5b600081518084526020808501945080840160005b838110156137a95781518752958201959082019060010161378d565b509495945050505050565b600082516137c6818460208701613b25565b9190910192915050565b6020808252825182820181905260009190848201906040850190845b818110156138115783516001600160a01b0316835292840192918401916001016137ec565b50909695505050505050565b6020815260006134a16020830184613779565b602081526000825180602084015261384f816040850160208701613b25565b601f01601f19169190910160400192915050565b60208082526023908201527f426f6e7573526577617264733a20737461727454696d6520696e207468652070604082015262185cdd60ea1b606082015260800190565b60208082526021908201527f426f6e7573526577617264733a20706f6f6c20646f6573206e6f7420657869736040820152601d60fa1b606082015260800190565b602080825260149082015273109bdb9d5cd4995dd85c991cce881c185d5cd95960621b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526023908201527f426f6e7573526577617264733a206e6f7420617574686f72697a65642063616c6040820152623632b960e91b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60006020808352608080840185516060808588015282825180855260a094508489019150868401935060005b81811015613a4f57845180516001600160a01b031684528881015165ffffffffffff9081168a8601526040808301519091169085015284810151858501528781015188850152860151868401529387019360c0909201916001016139f0565b505085890151604089015260408901518289015280965050505050505092915050565b60408152825160408201526000602084015160406060840152613a986080840182613779565b90508281036020840152613aac8185613779565b95945050505050565b60008219821115613ac857613ac8613b6c565b500190565b600082613aea57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615613b0957613b09613b6c565b500290565b600082821015613b2057613b20613b6c565b500390565b60005b83811015613b40578181015183820152602001613b28565b838111156106fa5750506000910152565b6000600019821415613b6557613b65613b6c565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b8015158114613bbc57600080fd5b5056fea2646970667358221220bd5bbb218c7d71829788b8cf710da6487fadcf5211aaab7a8652c3a703bf4b4b64736f6c63430008070033

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.