MATIC Price: $0.99 (+0.94%)
Gas: 62 Gwei
 

Overview

MATIC Balance

Polygon PoS Chain LogoPolygon PoS Chain LogoPolygon PoS Chain Logo0 MATIC

MATIC Value

$0.00

Sponsored

Transaction Hash
Method
Block
From
To
Value
0x60806040249177912022-02-14 4:31:31740 days 34 mins ago1644813091IN
 Create: HParaSwapV5
0 MATIC0.0306079131.913

Parent Txn Hash Block From To Value
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
HParaSwapV5

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license

Contract Source Code (Solidity)

/**
 *Submitted for verification at polygonscan.com on 2022-02-14
*/

// SPDX-License-Identifier: MIT

// File: contracts/lib/LibCache.sol

pragma solidity ^0.6.0;

library LibCache {
    function set(
        mapping(bytes32 => bytes32) storage _cache,
        bytes32 _key,
        bytes32 _value
    ) internal {
        _cache[_key] = _value;
    }

    function setAddress(
        mapping(bytes32 => bytes32) storage _cache,
        bytes32 _key,
        address _value
    ) internal {
        _cache[_key] = bytes32(uint256(uint160(_value)));
    }

    function setUint256(
        mapping(bytes32 => bytes32) storage _cache,
        bytes32 _key,
        uint256 _value
    ) internal {
        _cache[_key] = bytes32(_value);
    }

    function getAddress(
        mapping(bytes32 => bytes32) storage _cache,
        bytes32 _key
    ) internal view returns (address ret) {
        ret = address(uint160(uint256(_cache[_key])));
    }

    function getUint256(
        mapping(bytes32 => bytes32) storage _cache,
        bytes32 _key
    ) internal view returns (uint256 ret) {
        ret = uint256(_cache[_key]);
    }

    function get(mapping(bytes32 => bytes32) storage _cache, bytes32 _key)
        internal
        view
        returns (bytes32 ret)
    {
        ret = _cache[_key];
    }
}

// File: contracts/Config.sol

pragma solidity ^0.6.0;

contract Config {
    // function signature of "postProcess()"
    bytes4 public constant POSTPROCESS_SIG = 0xc2722916;

    // The base amount of percentage function
    uint256 public constant PERCENTAGE_BASE = 1 ether;

    // Handler post-process type. Others should not happen now.
    enum HandlerType {Token, Custom, Others}
}

// File: contracts/lib/LibStack.sol

pragma solidity ^0.6.0;


library LibStack {
    function setAddress(bytes32[] storage _stack, address _input) internal {
        _stack.push(bytes32(uint256(uint160(_input))));
    }

    function set(bytes32[] storage _stack, bytes32 _input) internal {
        _stack.push(_input);
    }

    function setHandlerType(bytes32[] storage _stack, Config.HandlerType _input)
        internal
    {
        _stack.push(bytes12(uint96(_input)));
    }

    function getAddress(bytes32[] storage _stack)
        internal
        returns (address ret)
    {
        ret = address(uint160(uint256(peek(_stack))));
        _stack.pop();
    }

    function getSig(bytes32[] storage _stack) internal returns (bytes4 ret) {
        ret = bytes4(peek(_stack));
        _stack.pop();
    }

    function get(bytes32[] storage _stack) internal returns (bytes32 ret) {
        ret = peek(_stack);
        _stack.pop();
    }

    function peek(bytes32[] storage _stack)
        internal
        view
        returns (bytes32 ret)
    {
        require(_stack.length > 0, "stack empty");
        ret = _stack[_stack.length - 1];
    }
}

// File: contracts/Storage.sol

pragma solidity ^0.6.0;



/// @notice A cache structure composed by a bytes32 array
contract Storage {
    using LibCache for mapping(bytes32 => bytes32);
    using LibStack for bytes32[];

    bytes32[] public stack;
    mapping(bytes32 => bytes32) public cache;

    // keccak256 hash of "msg.sender"
    // prettier-ignore
    bytes32 public constant MSG_SENDER_KEY = 0xb2f2618cecbbb6e7468cc0f2aa43858ad8d153e0280b22285e28e853bb9d453a;

    // keccak256 hash of "cube.counter"
    // prettier-ignore
    bytes32 public constant CUBE_COUNTER_KEY = 0xf9543f11459ccccd21306c8881aaab675ff49d988c1162fd1dd9bbcdbe4446be;

    modifier isStackEmpty() {
        require(stack.length == 0, "Stack not empty");
        _;
    }

    modifier isCubeCounterZero() {
        require(_getCubeCounter() == 0, "Cube counter not zero");
        _;
    }

    modifier isInitialized() {
        require(_getSender() != address(0), "Sender is not initialized");
        _;
    }

    modifier isNotInitialized() {
        require(_getSender() == address(0), "Sender is initialized");
        _;
    }

    function _setSender() internal isNotInitialized {
        cache.setAddress(MSG_SENDER_KEY, msg.sender);
    }

    function _resetSender() internal {
        cache.setAddress(MSG_SENDER_KEY, address(0));
    }

    function _getSender() internal view returns (address) {
        return cache.getAddress(MSG_SENDER_KEY);
    }

    function _addCubeCounter() internal {
        cache.setUint256(CUBE_COUNTER_KEY, _getCubeCounter() + 1);
    }

    function _resetCubeCounter() internal {
        cache.setUint256(CUBE_COUNTER_KEY, 0);
    }

    function _getCubeCounter() internal view returns (uint256) {
        return cache.getUint256(CUBE_COUNTER_KEY);
    }
}

// File: contracts/interface/IERC20Usdt.sol

pragma solidity ^0.6.0;

interface IERC20Usdt {
    function totalSupply() external view returns (uint256);

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

    function transfer(address recipient, uint256 amount) external;

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

    function approve(address spender, uint256 amount) external;

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

    event Transfer(address indexed from, address indexed to, uint256 value);

    event Approval(address indexed owner, address indexed spender, uint256 value);
}

// File: @openzeppelin/contracts/utils/Address.sol



pragma solidity >=0.6.2 <0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
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) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 0;
    }

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

        // 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");
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: value }(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

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

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

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

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

// File: @openzeppelin/contracts/math/SafeMath.sol



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, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

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

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

        return c;
    }

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

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

        return c;
    }

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

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

        return c;
    }

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

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

// File: @openzeppelin/contracts/token/ERC20/IERC20.sol



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);
}

// File: @openzeppelin/contracts/token/ERC20/SafeERC20.sol



pragma solidity >=0.6.0 <0.8.0;




/**
 * @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 SafeMath for uint256;
    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).add(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).sub(value, "SafeERC20: decreased allowance below zero");
        _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: contracts/handlers/HandlerBase.sol

pragma solidity ^0.6.0;





abstract contract HandlerBase is Storage, Config {
    using SafeERC20 for IERC20;

    address private constant MATIC_TOKEN =
        0x0000000000000000000000000000000000001010;

    function postProcess() external payable virtual {
        revert("Invalid post process");
        /* Implementation template
        bytes4 sig = stack.getSig();
        if (sig == bytes4(keccak256(bytes("handlerFunction_1()")))) {
            // Do something
        } else if (sig == bytes4(keccak256(bytes("handlerFunction_2()")))) {
            bytes32 temp = stack.get();
            // Do something
        } else revert("Invalid post process");
        */
    }

    function _updateToken(address token) internal {
        _notMaticToken(token);
        stack.setAddress(token);
        // Ignore token type to fit old handlers
        // stack.setHandlerType(uint256(HandlerType.Token));
    }

    function _updatePostProcess(bytes32[] memory params) internal {
        for (uint256 i = params.length; i > 0; i--) {
            stack.set(params[i - 1]);
        }
        stack.set(msg.sig);
        stack.setHandlerType(HandlerType.Custom);
    }

    function getContractName() public pure virtual returns (string memory);

    function _revertMsg(string memory functionName, string memory reason)
        internal
        view
    {
        revert(
            string(
                abi.encodePacked(
                    _uint2String(_getCubeCounter()),
                    "_",
                    getContractName(),
                    "_",
                    functionName,
                    ": ",
                    reason
                )
            )
        );
    }

    function _revertMsg(string memory functionName) internal view {
        _revertMsg(functionName, "Unspecified");
    }

    function _uint2String(uint256 n) internal pure returns (string memory) {
        if (n == 0) {
            return "0";
        } else {
            uint256 len = 0;
            for (uint256 temp = n; temp > 0; temp /= 10) {
                len++;
            }
            bytes memory str = new bytes(len);
            for (uint256 i = len; i > 0; i--) {
                str[i - 1] = bytes1(uint8(48 + (n % 10)));
                n /= 10;
            }
            return string(str);
        }
    }

    function _getBalance(address token, uint256 amount)
        internal
        view
        returns (uint256)
    {
        if (amount != uint256(-1)) {
            return amount;
        }

        // ETH case
        if (
            token == address(0) ||
            token == address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
        ) {
            return address(this).balance;
        }
        // ERC20 token case
        return IERC20(token).balanceOf(address(this));
    }

    function _tokenApprove(
        address token,
        address spender,
        uint256 amount
    ) internal {
        try IERC20Usdt(token).approve(spender, amount) {} catch {
            IERC20(token).safeApprove(spender, 0);
            IERC20(token).safeApprove(spender, amount);
        }
    }

    // Do not support matic token (0x0000...1010)
    function _notMaticToken(address token) internal pure {
        require(token != MATIC_TOKEN, "Not support matic token");
    }

    function _notMaticToken(address[] memory tokens) internal pure {
        for (uint256 i = 0; i < tokens.length; i++) {
            require(tokens[i] != MATIC_TOKEN, "Not support matic token");
        }
    }
}

// File: contracts/handlers/paraswapv5/HParaSwapV5.sol



pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;




contract HParaSwapV5 is HandlerBase {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    // prettier-ignore
    address public constant AUGUSTUS_SWAPPER = 0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57;
    // prettier-ignore
    address public constant TOKEN_TRANSFER_PROXY = 0x216B4B4Ba9F3e719726886d34a177484278Bfcae;
    // prettier-ignore
    address private constant NATIVE_TOKEN = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

    function getContractName() public pure override returns (string memory) {
        return "HParaSwapV5";
    }

    function swap(
        address srcToken,
        uint256 amount,
        address destToken,
        bytes calldata data
    ) external payable returns (uint256) {
        _notMaticToken(srcToken);
        _notMaticToken(destToken);

        uint256 destTokenBalanceBefore =
            _getBalance(destToken, type(uint256).max);

        if (_isNotNativeToken(srcToken)) {
            // ERC20 token need to approve before paraswap
            _tokenApprove(srcToken, TOKEN_TRANSFER_PROXY, amount);
            _paraswapCall(0, data);
        } else {
            _paraswapCall(amount, data);
        }

        uint256 destTokenBalanceAfter =
            _getBalance(destToken, type(uint256).max);

        uint256 destTokenDelta =
            destTokenBalanceAfter.sub(destTokenBalanceBefore);

        if (destTokenDelta == 0) {
            _revertMsg("swap", "Invalid output token amount");
        }

        if (_isNotNativeToken(destToken)) {
            _updateToken(destToken);
        }

        return destTokenDelta;
    }

    function _paraswapCall(uint256 value, bytes calldata data) internal {
        // Interact with paraswap through contract call with data
        (bool success, bytes memory returnData) =
            AUGUSTUS_SWAPPER.call{value: value}(data);

        if (!success) {
            if (returnData.length < 68) {
                // If the returnData length is less than 68, then the transaction failed silently.
                _revertMsg("_paraswapCall");
            } else {
                // Look for revert reason and bubble it up if present
                assembly {
                    returnData := add(returnData, 0x04)
                }
                _revertMsg("_paraswapCall", abi.decode(returnData, (string)));
            }
        }
    }

    function _isNotNativeToken(address token) internal pure returns (bool) {
        return (token != address(0) && token != NATIVE_TOKEN);
    }
}

Contract Security Audit

Contract ABI

[{"inputs":[],"name":"AUGUSTUS_SWAPPER","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CUBE_COUNTER_KEY","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MSG_SENDER_KEY","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERCENTAGE_BASE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"POSTPROCESS_SIG","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TOKEN_TRANSFER_PROXY","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"cache","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getContractName","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"postProcess","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"stack","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"srcToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"destToken","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"swap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"}]

608060405234801561001057600080fd5b50611063806100206000396000f3fe60806040526004361061009c5760003560e01c806390e148991161006457806390e148991461012b57806399eb59b914610140578063c272291614610160578063dc9031c41461016a578063f5f5ba721461018a578063fa2901a5146101ac5761009c565b80630f532d18146100a15780631413dc7d146100cc5780635517b99a146100e15780637f0f41d71461010357806387c1394314610116575b600080fd5b3480156100ad57600080fd5b506100b66101ce565b6040516100c39190610e15565b60405180910390f35b3480156100d857600080fd5b506100b66101f2565b3480156100ed57600080fd5b506100f6610216565b6040516100c39190610dce565b6100b6610111366004610b9f565b61022e565b34801561012257600080fd5b506100b661033c565b34801561013757600080fd5b506100f6610348565b34801561014c57600080fd5b506100b661015b366004610c59565b610360565b610168610372565b005b34801561017657600080fd5b506100b6610185366004610c59565b610393565b34801561019657600080fd5b5061019f6103b1565b6040516100c39190610e33565b3480156101b857600080fd5b506101c16103d6565b6040516100c39190610e1e565b7fb2f2618cecbbb6e7468cc0f2aa43858ad8d153e0280b22285e28e853bb9d453a81565b7ff9543f11459ccccd21306c8881aaab675ff49d988c1162fd1dd9bbcdbe4446be81565b73def171fe48cf0115b1d80b88dc8eab59176fee5781565b6000610239866103e1565b610242846103e1565b60006102508560001961040f565b905061025b876104e4565b156102905761027f8773216b4b4ba9f3e719726886d34a177484278bfcae88610523565b61028b600085856105ae565b61029b565b61029b8685856105ae565b60006102a98660001961040f565b905060006102b782846106b9565b90508061031957610319604051806040016040528060048152602001630737761760e41b8152506040518060400160405280601b81526020017f496e76616c6964206f757470757420746f6b656e20616d6f756e7400000000008152506106fb565b610322876104e4565b15610330576103308761074e565b98975050505050505050565b670de0b6b3a764000081565b73216b4b4ba9f3e719726886d34a177484278bfcae81565b60016020526000908152604090205481565b60405162461bcd60e51b815260040161038a90610eac565b60405180910390fd5b600081815481106103a057fe5b600091825260209091200154905081565b60408051808201909152600b81526a485061726153776170563560a81b602082015290565b636139148b60e11b81565b6001600160a01b038116611010141561040c5760405162461bcd60e51b815260040161038a90610eda565b50565b600060001982146104215750806104de565b6001600160a01b038316158061045357506001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee145b1561045f5750476104de565b6040516370a0823160e01b81526001600160a01b038416906370a082319061048b903090600401610dce565b60206040518083038186803b1580156104a357600080fd5b505afa1580156104b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104db9190610d0c565b90505b92915050565b60006001600160a01b0382161580159061051b57506001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14155b90505b919050565b60405163095ea7b360e01b81526001600160a01b0384169063095ea7b3906105519085908590600401610dfc565b600060405180830381600087803b15801561056b57600080fd5b505af192505050801561057c575060015b6105a9576105956001600160a01b038416836000610762565b6105a96001600160a01b0384168383610762565b505050565b6000606073def171fe48cf0115b1d80b88dc8eab59176fee576001600160a01b03168585856040516105e1929190610d24565b60006040518083038185875af1925050503d806000811461061e576040519150601f19603f3d011682016040523d82523d6000602084013e610623565b606091505b5091509150816106b25760448151101561066a576106656040518060400160405280600d81526020016c17dc185c985cddd85c10d85b1b609a1b81525061085c565b6106b2565b6004810190506106b26040518060400160405280600d81526020016c17dc185c985cddd85c10d85b1b609a1b815250828060200190518101906106ad9190610c71565b6106fb565b5050505050565b60006104db83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610889565b61070b6107066108ba565b6108ec565b6107136103b1565b83836040516020016107289493929190610d50565b60408051601f198184030181529082905262461bcd60e51b825261038a91600401610e33565b610757816103e1565b61040c6000826109c4565b8015806107ea5750604051636eb1769f60e11b81526001600160a01b0384169063dd62ed3e906107989030908690600401610de2565b60206040518083038186803b1580156107b057600080fd5b505afa1580156107c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e89190610d0c565b155b6108065760405162461bcd60e51b815260040161038a90610f92565b6105a98363095ea7b360e01b8484604051602401610825929190610dfc565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526109e6565b61040c816040518060400160405280600b81526020016a155b9cdc1958da599a595960aa1b8152506106fb565b600081848411156108ad5760405162461bcd60e51b815260040161038a9190610e33565b50508183035b9392505050565b60006108e760017ff9543f11459ccccd21306c8881aaab675ff49d988c1162fd1dd9bbcdbe4446be610a75565b905090565b60608161091157506040805180820190915260018152600360fc1b602082015261051e565b6000825b801561092b5760019190910190600a9004610915565b5060608167ffffffffffffffff8111801561094557600080fd5b506040519080825280601f01601f191660200182016040528015610970576020820181803683370190505b509050815b80156109ba57600a850660300160f81b82600183038151811061099457fe5b60200101906001600160f81b031916908160001a905350600a8504945060001901610975565b50915061051e9050565b8154600181018355600092835260209092206001600160a01b03909116910155565b6060610a3b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610a889092919063ffffffff16565b8051909150156105a95780806020019051810190610a599190610c39565b6105a95760405162461bcd60e51b815260040161038a90610f48565b6000908152602091909152604090205490565b6060610a978484600085610a9f565b949350505050565b606082471015610ac15760405162461bcd60e51b815260040161038a90610e66565b610aca85610b60565b610ae65760405162461bcd60e51b815260040161038a90610f11565b60006060866001600160a01b03168587604051610b039190610d34565b60006040518083038185875af1925050503d8060008114610b40576040519150601f19603f3d011682016040523d82523d6000602084013e610b45565b606091505b5091509150610b55828286610b66565b979650505050505050565b3b151590565b60608315610b755750816108b3565b825115610b855782518084602001fd5b8160405162461bcd60e51b815260040161038a9190610e33565b600080600080600060808688031215610bb6578081fd5b8535610bc181611018565b9450602086013593506040860135610bd881611018565b9250606086013567ffffffffffffffff80821115610bf4578283fd5b818801915088601f830112610c07578283fd5b813581811115610c15578384fd5b896020828501011115610c26578384fd5b9699959850939650602001949392505050565b600060208284031215610c4a578081fd5b815180151581146108b3578182fd5b600060208284031215610c6a578081fd5b5035919050565b600060208284031215610c82578081fd5b815167ffffffffffffffff80821115610c99578283fd5b818401915084601f830112610cac578283fd5b815181811115610cba578384fd5b604051601f8201601f191681016020018381118282101715610cda578586fd5b604052818152838201602001871015610cf1578485fd5b610d02826020830160208701610fe8565b9695505050505050565b600060208284031215610d1d578081fd5b5051919050565b6000828483379101908152919050565b60008251610d46818460208701610fe8565b9190910192915050565b60008551610d62818460208a01610fe8565b8083019050605f60f81b8082528651610d82816001850160208b01610fe8565b60019201918201528451610d9d816002840160208901610fe8565b6101d160f51b600292909101918201528351610dc0816004840160208801610fe8565b016004019695505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b03929092168252602082015260400190565b90815260200190565b6001600160e01b031991909116815260200190565b6000602082528251806020840152610e52816040850160208701610fe8565b601f01601f19169190910160400192915050565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6040820152651c8818d85b1b60d21b606082015260800190565b602080825260149082015273496e76616c696420706f73742070726f6365737360601b604082015260600190565b60208082526017908201527f4e6f7420737570706f7274206d6174696320746f6b656e000000000000000000604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b60208082526036908201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60408201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b606082015260800190565b60005b83811015611003578181015183820152602001610feb565b83811115611012576000848401525b50505050565b6001600160a01b038116811461040c57600080fdfea2646970667358221220b2f9daca2c98f25fa6c46784339998671ecffce5ff59efc420de4e8d0caf596164736f6c634300060c0033

Deployed Bytecode

0x60806040526004361061009c5760003560e01c806390e148991161006457806390e148991461012b57806399eb59b914610140578063c272291614610160578063dc9031c41461016a578063f5f5ba721461018a578063fa2901a5146101ac5761009c565b80630f532d18146100a15780631413dc7d146100cc5780635517b99a146100e15780637f0f41d71461010357806387c1394314610116575b600080fd5b3480156100ad57600080fd5b506100b66101ce565b6040516100c39190610e15565b60405180910390f35b3480156100d857600080fd5b506100b66101f2565b3480156100ed57600080fd5b506100f6610216565b6040516100c39190610dce565b6100b6610111366004610b9f565b61022e565b34801561012257600080fd5b506100b661033c565b34801561013757600080fd5b506100f6610348565b34801561014c57600080fd5b506100b661015b366004610c59565b610360565b610168610372565b005b34801561017657600080fd5b506100b6610185366004610c59565b610393565b34801561019657600080fd5b5061019f6103b1565b6040516100c39190610e33565b3480156101b857600080fd5b506101c16103d6565b6040516100c39190610e1e565b7fb2f2618cecbbb6e7468cc0f2aa43858ad8d153e0280b22285e28e853bb9d453a81565b7ff9543f11459ccccd21306c8881aaab675ff49d988c1162fd1dd9bbcdbe4446be81565b73def171fe48cf0115b1d80b88dc8eab59176fee5781565b6000610239866103e1565b610242846103e1565b60006102508560001961040f565b905061025b876104e4565b156102905761027f8773216b4b4ba9f3e719726886d34a177484278bfcae88610523565b61028b600085856105ae565b61029b565b61029b8685856105ae565b60006102a98660001961040f565b905060006102b782846106b9565b90508061031957610319604051806040016040528060048152602001630737761760e41b8152506040518060400160405280601b81526020017f496e76616c6964206f757470757420746f6b656e20616d6f756e7400000000008152506106fb565b610322876104e4565b15610330576103308761074e565b98975050505050505050565b670de0b6b3a764000081565b73216b4b4ba9f3e719726886d34a177484278bfcae81565b60016020526000908152604090205481565b60405162461bcd60e51b815260040161038a90610eac565b60405180910390fd5b600081815481106103a057fe5b600091825260209091200154905081565b60408051808201909152600b81526a485061726153776170563560a81b602082015290565b636139148b60e11b81565b6001600160a01b038116611010141561040c5760405162461bcd60e51b815260040161038a90610eda565b50565b600060001982146104215750806104de565b6001600160a01b038316158061045357506001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee145b1561045f5750476104de565b6040516370a0823160e01b81526001600160a01b038416906370a082319061048b903090600401610dce565b60206040518083038186803b1580156104a357600080fd5b505afa1580156104b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104db9190610d0c565b90505b92915050565b60006001600160a01b0382161580159061051b57506001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14155b90505b919050565b60405163095ea7b360e01b81526001600160a01b0384169063095ea7b3906105519085908590600401610dfc565b600060405180830381600087803b15801561056b57600080fd5b505af192505050801561057c575060015b6105a9576105956001600160a01b038416836000610762565b6105a96001600160a01b0384168383610762565b505050565b6000606073def171fe48cf0115b1d80b88dc8eab59176fee576001600160a01b03168585856040516105e1929190610d24565b60006040518083038185875af1925050503d806000811461061e576040519150601f19603f3d011682016040523d82523d6000602084013e610623565b606091505b5091509150816106b25760448151101561066a576106656040518060400160405280600d81526020016c17dc185c985cddd85c10d85b1b609a1b81525061085c565b6106b2565b6004810190506106b26040518060400160405280600d81526020016c17dc185c985cddd85c10d85b1b609a1b815250828060200190518101906106ad9190610c71565b6106fb565b5050505050565b60006104db83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610889565b61070b6107066108ba565b6108ec565b6107136103b1565b83836040516020016107289493929190610d50565b60408051601f198184030181529082905262461bcd60e51b825261038a91600401610e33565b610757816103e1565b61040c6000826109c4565b8015806107ea5750604051636eb1769f60e11b81526001600160a01b0384169063dd62ed3e906107989030908690600401610de2565b60206040518083038186803b1580156107b057600080fd5b505afa1580156107c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e89190610d0c565b155b6108065760405162461bcd60e51b815260040161038a90610f92565b6105a98363095ea7b360e01b8484604051602401610825929190610dfc565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526109e6565b61040c816040518060400160405280600b81526020016a155b9cdc1958da599a595960aa1b8152506106fb565b600081848411156108ad5760405162461bcd60e51b815260040161038a9190610e33565b50508183035b9392505050565b60006108e760017ff9543f11459ccccd21306c8881aaab675ff49d988c1162fd1dd9bbcdbe4446be610a75565b905090565b60608161091157506040805180820190915260018152600360fc1b602082015261051e565b6000825b801561092b5760019190910190600a9004610915565b5060608167ffffffffffffffff8111801561094557600080fd5b506040519080825280601f01601f191660200182016040528015610970576020820181803683370190505b509050815b80156109ba57600a850660300160f81b82600183038151811061099457fe5b60200101906001600160f81b031916908160001a905350600a8504945060001901610975565b50915061051e9050565b8154600181018355600092835260209092206001600160a01b03909116910155565b6060610a3b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610a889092919063ffffffff16565b8051909150156105a95780806020019051810190610a599190610c39565b6105a95760405162461bcd60e51b815260040161038a90610f48565b6000908152602091909152604090205490565b6060610a978484600085610a9f565b949350505050565b606082471015610ac15760405162461bcd60e51b815260040161038a90610e66565b610aca85610b60565b610ae65760405162461bcd60e51b815260040161038a90610f11565b60006060866001600160a01b03168587604051610b039190610d34565b60006040518083038185875af1925050503d8060008114610b40576040519150601f19603f3d011682016040523d82523d6000602084013e610b45565b606091505b5091509150610b55828286610b66565b979650505050505050565b3b151590565b60608315610b755750816108b3565b825115610b855782518084602001fd5b8160405162461bcd60e51b815260040161038a9190610e33565b600080600080600060808688031215610bb6578081fd5b8535610bc181611018565b9450602086013593506040860135610bd881611018565b9250606086013567ffffffffffffffff80821115610bf4578283fd5b818801915088601f830112610c07578283fd5b813581811115610c15578384fd5b896020828501011115610c26578384fd5b9699959850939650602001949392505050565b600060208284031215610c4a578081fd5b815180151581146108b3578182fd5b600060208284031215610c6a578081fd5b5035919050565b600060208284031215610c82578081fd5b815167ffffffffffffffff80821115610c99578283fd5b818401915084601f830112610cac578283fd5b815181811115610cba578384fd5b604051601f8201601f191681016020018381118282101715610cda578586fd5b604052818152838201602001871015610cf1578485fd5b610d02826020830160208701610fe8565b9695505050505050565b600060208284031215610d1d578081fd5b5051919050565b6000828483379101908152919050565b60008251610d46818460208701610fe8565b9190910192915050565b60008551610d62818460208a01610fe8565b8083019050605f60f81b8082528651610d82816001850160208b01610fe8565b60019201918201528451610d9d816002840160208901610fe8565b6101d160f51b600292909101918201528351610dc0816004840160208801610fe8565b016004019695505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b03929092168252602082015260400190565b90815260200190565b6001600160e01b031991909116815260200190565b6000602082528251806020840152610e52816040850160208701610fe8565b601f01601f19169190910160400192915050565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6040820152651c8818d85b1b60d21b606082015260800190565b602080825260149082015273496e76616c696420706f73742070726f6365737360601b604082015260600190565b60208082526017908201527f4e6f7420737570706f7274206d6174696320746f6b656e000000000000000000604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b60208082526036908201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60408201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b606082015260800190565b60005b83811015611003578181015183820152602001610feb565b83811115611012576000848401525b50505050565b6001600160a01b038116811461040c57600080fdfea2646970667358221220b2f9daca2c98f25fa6c46784339998671ecffce5ff59efc420de4e8d0caf596164736f6c634300060c0033

Deployed Bytecode Sourcemap

28293:2581:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3288:107;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;3469:109;;;;;;;;;;;;;:::i;28428:85::-;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;28874:1069::-;;;;;;:::i;:::-;;:::i;1532:49::-;;;;;;;;;;;;;:::i;28544:89::-;;;;;;;;;;;;;:::i;3176:40::-;;;;;;;;;;-1:-1:-1;3176:40:0;;;;;:::i;:::-;;:::i;24733:479::-;;;:::i;:::-;;3147:22;;;;;;;;;;-1:-1:-1;3147:22:0;;;;;:::i;:::-;;:::i;28755:111::-;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;1425:51::-;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;3288:107::-;3329:66;3288:107;:::o;3469:109::-;3512:66;3469:109;:::o;28428:85::-;28471:42;28428:85;:::o;28874:1069::-;29031:7;29051:24;29066:8;29051:14;:24::i;:::-;29086:25;29101:9;29086:14;:25::i;:::-;29124:30;29170:41;29182:9;-1:-1:-1;;29170:11:0;:41::i;:::-;29124:87;;29228:27;29246:8;29228:17;:27::i;:::-;29224:270;;;29332:53;29346:8;28591:42;29378:6;29332:13;:53::i;:::-;29400:22;29414:1;29417:4;;29400:13;:22::i;:::-;29224:270;;;29455:27;29469:6;29477:4;;29455:13;:27::i;:::-;29506:29;29551:41;29563:9;-1:-1:-1;;29551:11:0;:41::i;:::-;29506:86;-1:-1:-1;29605:22:0;29643:49;29506:86;29669:22;29643:25;:49::i;:::-;29605:87;-1:-1:-1;29709:19:0;29705:101;;29745:49;;;;;;;;;;;;;;-1:-1:-1;;;29745:49:0;;;;;;;;;;;;;;;;;;;;:10;:49::i;:::-;29822:28;29840:9;29822:17;:28::i;:::-;29818:84;;;29867:23;29880:9;29867:12;:23::i;:::-;29921:14;28874:1069;-1:-1:-1;;;;;;;;28874:1069:0:o;1532:49::-;1574:7;1532:49;:::o;28544:89::-;28591:42;28544:89;:::o;3176:40::-;;;;;;;;;;;;;:::o;24733:479::-;24792:30;;-1:-1:-1;;;24792:30:0;;;;;;;:::i;:::-;;;;;;;;3147:22;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;3147:22:0;:::o;28755:111::-;28838:20;;;;;;;;;;;;-1:-1:-1;;;28838:20:0;;;;28755:111;:::o;1425:51::-;-1:-1:-1;;;1425:51:0;:::o;27808:128::-;-1:-1:-1;;;;;27880:20:0;;24682:42;27880:20;;27872:56;;;;-1:-1:-1;;;27872:56:0;;;;;;;:::i;:::-;27808:128;:::o;26932:500::-;27034:7;-1:-1:-1;;27063:6:0;:21;27059:67;;-1:-1:-1;27108:6:0;27101:13;;27059:67;-1:-1:-1;;;;;27177:19:0;;;;:96;;-1:-1:-1;;;;;;27213:60:0;;27230:42;27213:60;27177:96;27159:181;;;-1:-1:-1;27307:21:0;27300:28;;27159:181;27386:38;;-1:-1:-1;;;27386:38:0;;-1:-1:-1;;;;;27386:23:0;;;;;:38;;27418:4;;27386:38;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;27379:45;;26932:500;;;;;:::o;30728:143::-;30793:4;-1:-1:-1;;;;;30818:19:0;;;;;;:44;;-1:-1:-1;;;;;;30841:21:0;;28704:42;30841:21;;30818:44;30810:53;;30728:143;;;;:::o;27440:309::-;27569:42;;-1:-1:-1;;;27569:42:0;;-1:-1:-1;;;;;27569:25:0;;;;;:42;;27595:7;;27604:6;;27569:42;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;27565:177;;27636:37;-1:-1:-1;;;;;27636:25:0;;27662:7;27671:1;27636:25;:37::i;:::-;27688:42;-1:-1:-1;;;;;27688:25:0;;27714:7;27723:6;27688:25;:42::i;:::-;27440:309;;;:::o;29951:769::-;30098:12;30112:23;28471:42;-1:-1:-1;;;;;30152:21:0;30181:5;30188:4;;30152:41;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30097:96;;;;30211:7;30206:507;;30259:2;30239:10;:17;:22;30235:467;;;30382:27;;;;;;;;;;;;;;-1:-1:-1;;;30382:27:0;;;:10;:27::i;:::-;30235:467;;;30583:4;30571:10;30567:21;30553:35;;30625:61;;;;;;;;;;;;;;-1:-1:-1;;;30625:61:0;;;30664:10;30653:32;;;;;;;;;;;;:::i;:::-;30625:10;:61::i;:::-;29951:769;;;;;:::o;13915:136::-;13973:7;14000:43;14004:1;14007;14000:43;;;;;;;;;;;;;;;;;:3;:43::i;25802:470::-;26005:31;26018:17;:15;:17::i;:::-;26005:12;:31::i;:::-;26085:17;:15;:17::i;:::-;26151:12;26213:6;25966:272;;;;;;;;;;;:::i;:::-;;;;-1:-1:-1;;25966:272:0;;;;;;;;;;-1:-1:-1;;;25920:344:0;;;;;;;:::i;25220:232::-;25277:21;25292:5;25277:14;:21::i;:::-;25309:23;:5;25326;25309:16;:23::i;22047:622::-;22417:10;;;22416:62;;-1:-1:-1;22433:39:0;;-1:-1:-1;;;22433:39:0;;-1:-1:-1;;;;;22433:15:0;;;;;:39;;22457:4;;22464:7;;22433:39;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:44;22416:62;22408:152;;;;-1:-1:-1;;;22408:152:0;;;;;;;:::i;:::-;22571:90;22591:5;22621:22;;;22645:7;22654:5;22598:62;;;;;;;;;:::i;:::-;;;;-1:-1:-1;;22598:62:0;;;;;;;;;;;;;;-1:-1:-1;;;;;22598:62:0;-1:-1:-1;;;;;;22598:62:0;;;;;;;;;;22571:19;:90::i;26280:120::-;26353:39;26364:12;26353:39;;;;;;;;;;;;;-1:-1:-1;;;26353:39:0;;;:10;:39::i;14354:192::-;14440:7;14476:12;14468:6;;;;14460:29;;;;-1:-1:-1;;;14460:29:0;;;;;;;;:::i;:::-;-1:-1:-1;;14512:5:0;;;14354:192;;;;;;:::o;4639:119::-;4689:7;4716:34;:5;3512:66;4716:16;:34::i;:::-;4709:41;;4639:119;:::o;26408:516::-;26464:13;26494:6;26490:427;;-1:-1:-1;26517:10:0;;;;;;;;;;;;-1:-1:-1;;;26517:10:0;;;;;;26490:427;26560:11;26610:1;26590:85;26613:8;;26590:85;;26654:5;;;;;;26631:2;26623:10;;26590:85;;;;26689:16;26718:3;26708:14;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;26708:14:0;-1:-1:-1;26689:33:0;-1:-1:-1;26754:3:0;26737:136;26759:5;;26737:136;;26826:2;26822:1;:6;26816:2;:13;26803:28;;26790:3;26798:1;26794;:5;26790:10;;;;;;;;;;;:41;-1:-1:-1;;;;;26790:41:0;;;;;;;;-1:-1:-1;26855:2:0;26850:7;;;-1:-1:-1;;;26766:3:0;26737:136;;;-1:-1:-1;26901:3:0;-1:-1:-1;26887:18:0;;-1:-1:-1;26887:18:0;1794:136;1876:46;;;;;;;1888:33;1876:46;;;;;;;-1:-1:-1;;;;;1896:24:0;;;1876:46;;;1794:136::o;23693:761::-;24117:23;24143:69;24171:4;24143:69;;;;;;;;;;;;;;;;;24151:5;-1:-1:-1;;;;;24143:27:0;;;:69;;;;;:::i;:::-;24227:17;;24117:95;;-1:-1:-1;24227:21:0;24223:224;;24369:10;24358:30;;;;;;;;;;;;:::i;:::-;24350:85;;;;-1:-1:-1;;;24350:85:0;;;;;;;:::i;920:185::-;1046:11;1084:12;;;;;;;;;;;;;920:185::o;9181:195::-;9284:12;9316:52;9338:6;9346:4;9352:1;9355:12;9316:21;:52::i;:::-;9309:59;9181:195;-1:-1:-1;;;;9181:195:0:o;10233:530::-;10360:12;10418:5;10393:21;:30;;10385:81;;;;-1:-1:-1;;;10385:81:0;;;;;;;:::i;:::-;10485:18;10496:6;10485:10;:18::i;:::-;10477:60;;;;-1:-1:-1;;;10477:60:0;;;;;;;:::i;:::-;10611:12;10625:23;10652:6;-1:-1:-1;;;;;10652:11:0;10672:5;10680:4;10652:33;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10610:75;;;;10703:52;10721:7;10730:10;10742:12;10703:17;:52::i;:::-;10696:59;10233:530;-1:-1:-1;;;;;;;10233:530:0:o;6263:422::-;6630:20;6669:8;;;6263:422::o;11769:742::-;11884:12;11913:7;11909:595;;;-1:-1:-1;11944:10:0;11937:17;;11909:595;12058:17;;:21;12054:439;;12321:10;12315:17;12382:15;12369:10;12365:2;12361:19;12354:44;12269:148;12464:12;12457:20;;-1:-1:-1;;;12457:20:0;;;;;;;;:::i;1503:741:-1:-;;;;;;1677:3;1665:9;1656:7;1652:23;1648:33;1645:2;;;-1:-1;;1684:12;1645:2;85:6;72:20;97:33;124:5;97:33;:::i;:::-;1736:63;-1:-1;1836:2;1875:22;;1292:20;;-1:-1;1944:2;1983:22;;72:20;97:33;72:20;97:33;:::i;:::-;1952:63;-1:-1;2080:2;2065:18;;2052:32;2104:18;2093:30;;;2090:2;;;-1:-1;;2126:12;2090:2;2211:6;2200:9;2196:22;;;542:3;535:4;527:6;523:17;519:27;509:2;;-1:-1;;550:12;509:2;593:6;580:20;2104:18;612:6;609:30;606:2;;;-1:-1;;642:12;606:2;737:3;1836:2;717:17;678:6;703:32;;700:41;697:2;;;-1:-1;;744:12;697:2;1639:605;;;;-1:-1;1639:605;;-1:-1;1836:2;674:17;;2146:82;1639:605;-1:-1;;;1639:605::o;2251:257::-;;2363:2;2351:9;2342:7;2338:23;2334:32;2331:2;;;-1:-1;;2369:12;2331:2;223:6;217:13;17697:5;16493:13;16486:21;17675:5;17672:32;17662:2;;-1:-1;;17708:12;2515:241;;2619:2;2607:9;2598:7;2594:23;2590:32;2587:2;;;-1:-1;;2625:12;2587:2;-1:-1;344:20;;2581:175;-1:-1;2581:175::o;2763:362::-;;2888:2;2876:9;2867:7;2863:23;2859:32;2856:2;;;-1:-1;;2894:12;2856:2;2945:17;2939:24;2983:18;;2975:6;2972:30;2969:2;;;-1:-1;;3005:12;2969:2;3092:6;3081:9;3077:22;;;886:3;879:4;871:6;867:17;863:27;853:2;;-1:-1;;894:12;853:2;934:6;928:13;2983:18;15400:6;15397:30;15394:2;;;-1:-1;;15430:12;15394:2;15063;15057:9;15503;15484:17;;-1:-1;;15480:33;15089:17;;2888:2;15089:17;15149:34;;;15185:22;;;15146:62;15143:2;;;-1:-1;;15211:12;15143:2;15063;15230:22;1027:21;;;1127:16;;;2888:2;1127:16;1124:25;-1:-1;1121:2;;;-1:-1;;1152:12;1121:2;1172:39;1204:6;2888:2;1103:5;1099:16;2888:2;1069:6;1065:17;1172:39;:::i;:::-;3025:84;2850:275;-1:-1;;;;;;2850:275::o;3380:263::-;;3495:2;3483:9;3474:7;3470:23;3466:32;3463:2;;;-1:-1;;3501:12;3463:2;-1:-1;1440:13;;3457:186;-1:-1;3457:186::o;8412:291::-;;17038:6;17033:3;17028;17015:30;17076:16;;17069:27;;;17076:16;8556:147;-1:-1;8556:147::o;8710:271::-;;4508:5;15680:12;4619:52;4664:6;4659:3;4652:4;4645:5;4641:16;4619:52;:::i;:::-;4683:16;;;;;8844:137;-1:-1;;8844:137::o;8988:1559::-;;4508:5;15680:12;4619:52;4664:6;4659:3;4652:4;4645:5;4641:16;4619:52;:::i;:::-;4692:6;4687:3;4683:16;4676:23;;-1:-1;;;7111:3;7098:11;7091:24;4508:5;15680:12;4619:52;4664:6;7076:1;7138:3;7134:11;4652:4;4645:5;4641:16;4619:52;:::i;:::-;7076:1;4683:16;;;;;7091:24;15680:12;;4619:52;15680:12;7134:11;;;4652:4;4641:16;;4619:52;:::i;:::-;-1:-1;;;7134:11;4683:16;;;;;;;7823:25;15680:12;;4619:52;15680:12;7867:11;;;4652:4;4641:16;;4619:52;:::i;:::-;4683:16;7867:11;4683:16;;9571:976;-1:-1;;;;;;9571:976::o;10554:222::-;-1:-1;;;;;16811:54;;;;3721:37;;10681:2;10666:18;;10652:124::o;10783:333::-;-1:-1;;;;;16811:54;;;3721:37;;16811:54;;11102:2;11087:18;;3721:37;10938:2;10923:18;;10909:207::o;11123:333::-;-1:-1;;;;;16811:54;;;;3721:37;;11442:2;11427:18;;3841:37;11278:2;11263:18;;11249:207::o;11463:222::-;3841:37;;;11590:2;11575:18;;11561:124::o;11692:218::-;-1:-1;;;;;;16659:78;;;;3959:36;;11817:2;11802:18;;11788:122::o;11917:310::-;;12064:2;12085:17;12078:47;4856:5;15680:12;16119:6;12064:2;12053:9;12049:18;16107:19;4950:52;4995:6;16147:14;12053:9;16147:14;12064:2;4976:5;4972:16;4950:52;:::i;:::-;15503:9;17455:14;-1:-1;;17451:28;5014:39;;;;16147:14;5014:39;;12035:192;-1:-1;;12035:192::o;12234:416::-;12434:2;12448:47;;;5657:2;12419:18;;;16107:19;5693:34;16147:14;;;5673:55;-1:-1;;;5748:12;;;5741:30;5790:12;;;12405:245::o;12657:416::-;12857:2;12871:47;;;6041:2;12842:18;;;16107:19;-1:-1;;;16147:14;;;6057:43;6119:12;;;12828:245::o;13080:416::-;13280:2;13294:47;;;6370:2;13265:18;;;16107:19;6406:25;16147:14;;;6386:46;6451:12;;;13251:245::o;13503:416::-;13703:2;13717:47;;;6702:2;13688:18;;;16107:19;6738:31;16147:14;;;6718:52;6789:12;;;13674:245::o;13926:416::-;14126:2;14140:47;;;7384:2;14111:18;;;16107:19;7420:34;16147:14;;;7400:55;-1:-1;;;7475:12;;;7468:34;7521:12;;;14097:245::o;14349:416::-;14549:2;14563:47;;;8117:2;14534:18;;;16107:19;8153:34;16147:14;;;8133:55;-1:-1;;;8208:12;;;8201:46;8266:12;;;14520:245::o;17111:268::-;17176:1;17183:101;17197:6;17194:1;17191:13;17183:101;;;17264:11;;;17258:18;17245:11;;;17238:39;17219:2;17212:10;17183:101;;;17299:6;17296:1;17293:13;17290:2;;;17176:1;17355:6;17350:3;17346:16;17339:27;17290:2;;17160:219;;;:::o;17492:117::-;-1:-1;;;;;16811:54;;17551:35;;17541:2;;17600:1;;17590:12

Swarm Source

ipfs://b2f9daca2c98f25fa6c46784339998671ecffce5ff59efc420de4e8d0caf5961

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Txn Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.