FTM Price: $1.01 (-0.15%)
Gas: 96 GWei

Contract

0x83792AA9D3A67d7AADB8a47Ddf852c634168aCa7
 

Overview

FTM Balance

Fantom LogoFantom LogoFantom Logo0 FTM

FTM Value

$0.00

Sponsored

Transaction Hash
Method
Block
From
To
Value
0x61014060568533692023-03-03 10:26:35391 days ago1677839195IN
 Create: HStargate
0 FTM0.0444093730.03119076

Latest 2 internal transactions

Parent Txn Hash Block From To Value
568547902023-03-03 11:02:35391 days ago1677841355
0x83792AA9...34168aCa7
1.96207291 FTM
568533692023-03-03 10:26:35391 days ago1677839195  Contract Creation0 FTM
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
HStargate

Compiler Version
v0.8.10+commit.fc410830

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 15 : HStargate.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.10;

import {HandlerBase} from "../HandlerBase.sol";
import {IStargateRouter, IStargateWidget} from "./IStargateRouter.sol";
import {IStargateRouterETH} from "./IStargateRouterETH.sol";
import {IStargateToken} from "./IStargateToken.sol";
import {IFactory, IPool} from "./IFactory.sol";

contract HStargate is HandlerBase {
    address public immutable router;
    address public immutable routerETH;
    address public immutable stgToken;
    address public immutable factory;
    address public immutable widgetSwap;
    bytes2 public immutable partnerId;

    constructor(
        address router_,
        address routerETH_,
        address stgToken_,
        address factory_,
        address widgetSwap_,
        bytes2 partnerId_
    ) {
        router = router_;
        routerETH = routerETH_;
        stgToken = stgToken_;
        factory = factory_;
        widgetSwap = widgetSwap_;
        partnerId = partnerId_;
    }

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

    function swapETH(
        uint256 value,
        uint16 dstChainId,
        address payable refundAddress,
        uint256 fee,
        uint256 amountOutMin,
        address to
    ) external payable {
        _requireMsg(to != address(0), "swapETH", "to zero address");

        value = _getBalance(NATIVE_TOKEN_ADDRESS, value);

        // Swap ETH
        try
            IStargateRouterETH(routerETH).swapETH{value: value}(
                dstChainId,
                refundAddress,
                abi.encodePacked(to),
                value - fee,
                amountOutMin
            )
        {} catch Error(string memory reason) {
            _revertMsg("swapETH", reason);
        } catch {
            _revertMsg("swapETH");
        }

        // Partnership
        IStargateWidget(widgetSwap).partnerSwap(partnerId);
    }

    function swap(
        uint16 dstChainId,
        uint256 srcPoolId,
        uint256 dstPoolId,
        address payable refundAddress,
        uint256 amountIn,
        uint256 fee,
        uint256 amountOutMin,
        address to
    ) external payable {
        _requireMsg(to != address(0), "swap", "to zero address");

        // Approve input token to Stargate
        IPool pool = IFactory(factory).getPool(srcPoolId);
        _requireMsg(address(pool) != address(0), "swap", "pool not found");
        address tokenIn = pool.token();
        amountIn = _getBalance(tokenIn, amountIn);
        _tokenApprove(tokenIn, router, amountIn);

        // Swap input token
        try
            IStargateRouter(router).swap{value: fee}(
                dstChainId,
                srcPoolId,
                dstPoolId,
                refundAddress,
                amountIn,
                amountOutMin,
                IStargateRouter.lzTxObj(0, 0, "0x"), // no destination gas
                abi.encodePacked(to),
                bytes("") // no data
            )
        {} catch Error(string memory reason) {
            _revertMsg("swap", reason);
        } catch {
            _revertMsg("swap");
        }

        // Reset Approval
        _tokenApproveZero(tokenIn, router);

        // Partnership
        IStargateWidget(widgetSwap).partnerSwap(partnerId);
    }

    function sendTokens(
        uint16 dstChainId,
        address to,
        uint256 amountIn,
        uint256 fee,
        uint256 dstGas
    ) external payable {
        _requireMsg(to != address(0), "sendTokens", "to zero address");
        _requireMsg(amountIn != 0, "sendTokens", "zero amountIn");

        amountIn = _getBalance(stgToken, amountIn);

        // Swap STG token
        try
            IStargateToken(stgToken).sendTokens{value: fee}(
                dstChainId,
                abi.encodePacked(to),
                amountIn,
                address(0),
                abi.encodePacked(uint16(1) /* version */, dstGas)
            )
        {} catch Error(string memory reason) {
            _revertMsg("sendTokens", reason);
        } catch {
            _revertMsg("sendTokens");
        }

        // Partnership
        IStargateWidget(widgetSwap).partnerSwap(partnerId);
    }
}

File 2 of 15 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^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 3 of 15 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library 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'
        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 {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(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
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 4 of 15 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^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;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 5 of 15 : Config.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.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 6 of 15 : Storage.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./lib/LibCache.sol";
import "./lib/LibStack.sol";

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

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

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

File 7 of 15 : HandlerBase.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../interface/IERC20Usdt.sol";

import "../Config.sol";
import "../Storage.sol";

abstract contract HandlerBase is Storage, Config {
    using SafeERC20 for IERC20;
    using LibStack for bytes32[];

    address public constant NATIVE_TOKEN_ADDRESS =
        0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

    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 {
        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 pure {
        revert(
            string(
                abi.encodePacked(
                    getContractName(),
                    "_",
                    functionName,
                    ": ",
                    reason
                )
            )
        );
    }

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

    function _requireMsg(
        bool condition,
        string memory functionName,
        string memory reason
    ) internal pure {
        if (!condition) _revertMsg(functionName, reason);
    }

    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 != type(uint256).max) {
            return amount;
        }

        // ETH case
        if (token == address(0) || token == NATIVE_TOKEN_ADDRESS) {
            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);
        }
    }

    function _tokenApproveZero(address token, address spender) internal {
        if (IERC20Usdt(token).allowance(address(this), spender) > 0) {
            try IERC20Usdt(token).approve(spender, 0) {} catch {
                IERC20Usdt(token).approve(spender, 1);
            }
        }
    }

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

File 8 of 15 : IFactory.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.8.0;

import "./IPool.sol";

interface IFactory {
   function getPool(uint256 poolId) external view returns(IPool); 
}

File 9 of 15 : IPool.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.8.0;

interface IPool {
    function token() external view returns(address);
}

File 10 of 15 : IStargateRouter.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.8.0;

interface IStargateWidget {
    function partnerSwap(bytes2 _partnerId) external;
    event PartnerSwap(bytes2 indexed partnerId);
}

interface IStargateRouter {
    struct lzTxObj {
        uint256 dstGasForCall;
        uint256 dstNativeAmount;
        bytes dstNativeAddr;
    }

    function swap(
        uint16 _dstChainId,
        uint256 _srcPoolId,
        uint256 _dstPoolId,
        address payable _refundAddress,
        uint256 _amountLD,
        uint256 _minAmountLD,
        lzTxObj memory _lzTxParams,
        bytes calldata _to,
        bytes calldata _payload
    ) external payable;

    function quoteLayerZeroFee(
        uint16 _dstChainId,
        uint8 _functionType,
        bytes calldata _toAddress,
        bytes calldata _transferAndCallPayload,
        lzTxObj memory _lzTxParams
    ) external view returns (uint256 /*nativeFee*/, uint256 /*layerZeroFee*/);
}

File 11 of 15 : IStargateRouterETH.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.8.0;

interface IStargateRouterETH {         
    function swapETH(
        uint16 _dstChainId,                         // destination Stargate chainId
        address payable _refundAddress,             // refund additional messageFee to this address
        bytes calldata _toAddress,                  // the receiver of the destination ETH
        uint256 _amountLD,                          // the amount, in Local Decimals, to be swapped
        uint256 _minAmountLD                        // the minimum amount accepted out on destination
    ) external payable;
}

File 12 of 15 : IStargateToken.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.8.0;

interface IStargateToken {
    event SendToChain(uint16 dstChainId, bytes to, uint256 qty);

    function isMain() external returns(bool);

    function sendTokens(
        uint16 _dstChainId, // send tokens to this chainId
        bytes calldata _to, // where to deliver the tokens on the destination chain
        uint256 _qty, // how many tokens to send
        address zroPaymentAddress, // ZRO payment address
        bytes calldata adapterParam // txParameters
    ) external payable;
}

File 13 of 15 : IERC20Usdt.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.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 14 of 15 : LibCache.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.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 15 of 15 : LibStack.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../Config.sol";

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) {
        uint256 length = _stack.length;
        require(length > 0, "stack empty");
        ret = _stack[length - 1];
    }

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

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"router_","type":"address"},{"internalType":"address","name":"routerETH_","type":"address"},{"internalType":"address","name":"stgToken_","type":"address"},{"internalType":"address","name":"factory_","type":"address"},{"internalType":"address","name":"widgetSwap_","type":"address"},{"internalType":"bytes2","name":"partnerId_","type":"bytes2"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"MSG_SENDER_KEY","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NATIVE_TOKEN_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"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":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"cache","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getContractName","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"partnerId","outputs":[{"internalType":"bytes2","name":"","type":"bytes2"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"postProcess","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"router","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"routerETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"dstChainId","type":"uint16"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"uint256","name":"dstGas","type":"uint256"}],"name":"sendTokens","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"stack","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stgToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"dstChainId","type":"uint16"},{"internalType":"uint256","name":"srcPoolId","type":"uint256"},{"internalType":"uint256","name":"dstPoolId","type":"uint256"},{"internalType":"address payable","name":"refundAddress","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"swap","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint16","name":"dstChainId","type":"uint16"},{"internalType":"address payable","name":"refundAddress","type":"address"},{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"swapETH","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"widgetSwap","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

6101406040523480156200001257600080fd5b5060405162001b8938038062001b8983398101604081905262000035916200008c565b6001600160a01b0395861660805293851660a05291841660c052831660e052909116610100526001600160f01b031916610120526200011e565b80516001600160a01b03811681146200008757600080fd5b919050565b60008060008060008060c08789031215620000a657600080fd5b620000b1876200006f565b9550620000c1602088016200006f565b9450620000d1604088016200006f565b9350620000e1606088016200006f565b9250620000f1608088016200006f565b60a08801519092506001600160f01b0319811681146200011057600080fd5b809150509295509295509295565b60805160a05160c05160e05161010051610120516119c0620001c960003960008181610219015281816105d3015281816108cf0152610d730152600081816102f6015281816105fa015281816108f60152610d9a0152600081816102a20152610a430152600081816101ba0152818161072b0152610754015260008181610266015261047c01526000818161039d01528181610b9301528181610bba0152610d3701526119c06000f3fe6080604052600436106100fe5760003560e01c8063c272291611610095578063df2ebdbb11610064578063df2ebdbb14610318578063e43d821a14610340578063f5f5ba7214610353578063f887ea401461038b578063fa2901a5146103bf57600080fd5b8063c272291614610288578063c45a015514610290578063dc9031c4146102c4578063dd1bc08e146102e457600080fd5b80639afb25de116100d15780639afb25de146101a85780639c00286a146101f4578063aa37db6c14610207578063bcf8699f1461025457600080fd5b80630f532d18146101035780634a05f04e1461014a57806387c139431461015f57806399eb59b91461017b575b600080fd5b34801561010f57600080fd5b506101377fb2f2618cecbbb6e7468cc0f2aa43858ad8d153e0280b22285e28e853bb9d453a81565b6040519081526020015b60405180910390f35b61015d6101583660046114c9565b6103f3565b005b34801561016b57600080fd5b50610137670de0b6b3a764000081565b34801561018757600080fd5b5061013761019636600461152e565b60016020526000908152604090205481565b3480156101b457600080fd5b506101dc7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610141565b61015d610202366004611547565b610666565b34801561021357600080fd5b5061023b7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160f01b03199091168152602001610141565b34801561026057600080fd5b506101dc7f000000000000000000000000000000000000000000000000000000000000000081565b61015d610961565b34801561029c57600080fd5b506101dc7f000000000000000000000000000000000000000000000000000000000000000081565b3480156102d057600080fd5b506101376102df36600461152e565b6109a5565b3480156102f057600080fd5b506101dc7f000000000000000000000000000000000000000000000000000000000000000081565b34801561032457600080fd5b506101dc73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b61015d61034e366004611596565b6109c6565b34801561035f57600080fd5b50604080518082018252600981526848537461726761746560b81b60208201529051610141919061166c565b34801561039757600080fd5b506101dc7f000000000000000000000000000000000000000000000000000000000000000081565b3480156103cb57600080fd5b506103da636139148b60e11b81565b6040516001600160e01b03199091168152602001610141565b61045a60006001600160a01b0316826001600160a01b03161415604051806040016040528060078152602001660e6eec2e08aa8960cb1b8152506040518060400160405280600f81526020016e746f207a65726f206164647265737360881b815250610e0a565b61047873eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee87610e1e565b95507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316631114cd2a878787856040516020016104d0919060609190911b6001600160601b031916815260140190565b60408051601f198184030181529190526104ea898d61167f565b886040518763ffffffff1660e01b815260040161050b9594939291906116a4565b6000604051808303818588803b15801561052457600080fd5b505af193505050508015610536575060015b6105bb576105426116e6565b806308c379a01415610591575061055761173d565b806105625750610593565b61058b604051806040016040528060078152602001660e6eec2e08aa8960cb1b81525082610edf565b506105bb565b505b6105bb604051806040016040528060078152602001660e6eec2e08aa8960cb1b815250610f39565b60405163a87376e960e01b81526001600160f01b03197f00000000000000000000000000000000000000000000000000000000000000001660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a87376e990602401600060405180830381600087803b15801561064657600080fd5b505af115801561065a573d6000803e3d6000fd5b50505050505050505050565b6106d060006001600160a01b0316856001600160a01b031614156040518060400160405280600a81526020016973656e64546f6b656e7360b01b8152506040518060400160405280600f81526020016e746f207a65726f206164647265737360881b815250610e0a565b61072683600014156040518060400160405280600a81526020016973656e64546f6b656e7360b01b8152506040518060400160405280600d81526020016c3d32b9379030b6b7bab73a24b760991b815250610e0a565b6107507f000000000000000000000000000000000000000000000000000000000000000084610e1e565b92507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316632e15238c8387876040516020016107a7919060609190911b6001600160601b031916815260140190565b60408051601f1981840301815290829052600160f01b6020830152602282018790529088906000906042016040516020818303038152906040526040518763ffffffff1660e01b81526004016108019594939291906117c7565b6000604051808303818588803b15801561081a57600080fd5b505af19350505050801561082c575060015b6108b7576108386116e6565b806308c379a0141561088a575061084d61173d565b80610858575061088c565b6108846040518060400160405280600a81526020016973656e64546f6b656e7360b01b81525082610edf565b506108b7565b505b6108b76040518060400160405280600a81526020016973656e64546f6b656e7360b01b815250610f39565b60405163a87376e960e01b81526001600160f01b03197f00000000000000000000000000000000000000000000000000000000000000001660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a87376e990602401600060405180830381600087803b15801561094257600080fd5b505af1158015610956573d6000803e3d6000fd5b505050505050505050565b60405162461bcd60e51b8152602060048201526014602482015273496e76616c696420706f73742070726f6365737360601b60448201526064015b60405180910390fd5b600081815481106109b557600080fd5b600091825260209091200154905081565b610a2a60006001600160a01b0316826001600160a01b03161415604051806040016040528060048152602001630737761760e41b8152506040518060400160405280600f81526020016e746f207a65726f206164647265737360881b815250610e0a565b60405163068bcd8d60e01b8152600481018890526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063068bcd8d90602401602060405180830381865afa158015610a92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab69190611818565b9050610b1b60006001600160a01b0316826001600160a01b03161415604051806040016040528060048152602001630737761760e41b8152506040518060400160405280600e81526020016d1c1bdbdb081b9bdd08199bdd5b9960921b815250610e0a565b6000816001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b5b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b7f9190611818565b9050610b8b8187610e1e565b9550610bb8817f000000000000000000000000000000000000000000000000000000000000000088610f69565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639fbf10fc868c8c8c8c8c8b6040518060600160405280600081526020016000815260200160405180604001604052806002815260200161060f60f31b8152508152508c604051602001610c49919060609190911b6001600160601b031916815260140190565b60408051601f198184030181526020830182526000835290516001600160e01b031960e08d901b168152610c87999897969594939290600401611835565b6000604051808303818588803b158015610ca057600080fd5b505af193505050508015610cb2575060015b610d3157610cbe6116e6565b806308c379a01415610d0a5750610cd361173d565b80610cde5750610d0c565b610d04604051806040016040528060048152602001630737761760e41b81525082610edf565b50610d31565b505b610d31604051806040016040528060048152602001630737761760e41b815250610f39565b610d5b817f0000000000000000000000000000000000000000000000000000000000000000610ff1565b60405163a87376e960e01b81526001600160f01b03197f00000000000000000000000000000000000000000000000000000000000000001660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a87376e990602401600060405180830381600087803b158015610de657600080fd5b505af1158015610dfa573d6000803e3d6000fd5b5050505050505050505050505050565b82610e1957610e198282610edf565b505050565b60006000198214610e30575080610ed9565b6001600160a01b0383161580610e6257506001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee145b15610e6e575047610ed9565b6040516370a0823160e01b81523060048201526001600160a01b038416906370a0823190602401602060405180830381865afa158015610eb2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed691906118d3565b90505b92915050565b60408051808201909152600981526848537461726761746560b81b60208201528282604051602001610f13939291906118ec565b60408051601f198184030181529082905262461bcd60e51b825261099c9160040161166c565b610f66816040518060400160405280600b81526020016a155b9cdc1958da599a595960aa1b815250610edf565b50565b60405163095ea7b360e01b81526001600160a01b0383811660048301526024820183905284169063095ea7b390604401600060405180830381600087803b158015610fb357600080fd5b505af1925050508015610fc4575060015b610e1957610fdd6001600160a01b038416836000611131565b610e196001600160a01b0384168383611131565b604051636eb1769f60e11b81523060048201526001600160a01b0382811660248301526000919084169063dd62ed3e90604401602060405180830381865afa158015611041573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106591906118d3565b111561112d5760405163095ea7b360e01b81526001600160a01b0382811660048301526000602483015283169063095ea7b390604401600060405180830381600087803b1580156110b557600080fd5b505af19250505080156110c6575060015b61112d5760405163095ea7b360e01b81526001600160a01b0382811660048301526001602483015283169063095ea7b390604401600060405180830381600087803b15801561111457600080fd5b505af1158015611128573d6000803e3d6000fd5b505050505b5050565b8015806111ab5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015611185573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a991906118d3565b155b6112165760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b606482015260840161099c565b604080516001600160a01b03848116602483015260448083018590528351808403909101815260649092018352602080830180516001600160e01b031663095ea7b360e01b17905283518085019094528084527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656490840152610e19928692916000916112a6918516908490611323565b805190915015610e1957808060200190518101906112c4919061194c565b610e195760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161099c565b6060611332848460008561133c565b90505b9392505050565b60608247101561139d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161099c565b843b6113eb5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161099c565b600080866001600160a01b03168587604051611407919061196e565b60006040518083038185875af1925050503d8060008114611444576040519150601f19603f3d011682016040523d82523d6000602084013e611449565b606091505b5091509150611459828286611464565b979650505050505050565b60608315611473575081611335565b8251156114835782518084602001fd5b8160405162461bcd60e51b815260040161099c919061166c565b803561ffff811681146114af57600080fd5b919050565b6001600160a01b0381168114610f6657600080fd5b60008060008060008060c087890312156114e257600080fd5b863595506114f26020880161149d565b94506040870135611502816114b4565b9350606087013592506080870135915060a0870135611520816114b4565b809150509295509295509295565b60006020828403121561154057600080fd5b5035919050565b600080600080600060a0868803121561155f57600080fd5b6115688661149d565b94506020860135611578816114b4565b94979496505050506040830135926060810135926080909101359150565b600080600080600080600080610100898b0312156115b357600080fd5b6115bc8961149d565b9750602089013596506040890135955060608901356115da816114b4565b94506080890135935060a0890135925060c0890135915060e08901356115ff816114b4565b809150509295985092959890939650565b60005b8381101561162b578181015183820152602001611613565b8381111561163a576000848401525b50505050565b60008151808452611658816020860160208601611610565b601f01601f19169290920160200192915050565b602081526000610ed66020830184611640565b60008282101561169f57634e487b7160e01b600052601160045260246000fd5b500390565b61ffff861681526001600160a01b038516602082015260a0604082018190526000906116d290830186611640565b606083019490945250608001529392505050565b600060033d11156116ff5760046000803e5060005160e01c5b90565b601f8201601f1916810167ffffffffffffffff8111828210171561173657634e487b7160e01b600052604160045260246000fd5b6040525050565b600060443d101561174b5790565b6040516003193d81016004833e81513d67ffffffffffffffff816024840111818411171561177b57505050505090565b82850191508151818111156117935750505050505090565b843d87010160208285010111156117ad5750505050505090565b6117bc60208286010187611702565b509095945050505050565b61ffff8616815260a0602082015260006117e460a0830187611640565b604083018690526001600160a01b0385166060840152828103608084015261180c8185611640565b98975050505050505050565b60006020828403121561182a57600080fd5b8151611335816114b4565b600061012061ffff8c1683528a602084015289604084015260018060a01b03891660608401528760808401528660a08401528060c08401528551818401525060208501516101408301526040850151606061016084015261189a610180840182611640565b905082810360e08401526118ae8186611640565b90508281036101008401526118c38185611640565b9c9b505050505050505050505050565b6000602082840312156118e557600080fd5b5051919050565b600084516118fe818460208901611610565b605f60f81b908301908152845161191c816001840160208901611610565b6101d160f51b60019290910191820152835161193f816003840160208801611610565b0160030195945050505050565b60006020828403121561195e57600080fd5b8151801515811461133557600080fd5b60008251611980818460208701611610565b919091019291505056fea2646970667358221220e62e68a4c0325a6a66dbdf1ea23bf7c86bb5a94f49c95771a69b4f6da9c0a22164736f6c634300080a0033000000000000000000000000af5191b0de278c7286d6c7cc6ab6bb8a73ba2cd600000000000000000000000000000000000000000000000000000000000000000000000000000000000000002f6f07cdcf3588944bf4c42ac74ff24bf56e75900000000000000000000000009d1b1669c73b033dfe47ae5a0164ab96df25b9440000000000000000000000007ea8d498d4db3a8895454f4bf3bd56385ba809680013000000000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x6080604052600436106100fe5760003560e01c8063c272291611610095578063df2ebdbb11610064578063df2ebdbb14610318578063e43d821a14610340578063f5f5ba7214610353578063f887ea401461038b578063fa2901a5146103bf57600080fd5b8063c272291614610288578063c45a015514610290578063dc9031c4146102c4578063dd1bc08e146102e457600080fd5b80639afb25de116100d15780639afb25de146101a85780639c00286a146101f4578063aa37db6c14610207578063bcf8699f1461025457600080fd5b80630f532d18146101035780634a05f04e1461014a57806387c139431461015f57806399eb59b91461017b575b600080fd5b34801561010f57600080fd5b506101377fb2f2618cecbbb6e7468cc0f2aa43858ad8d153e0280b22285e28e853bb9d453a81565b6040519081526020015b60405180910390f35b61015d6101583660046114c9565b6103f3565b005b34801561016b57600080fd5b50610137670de0b6b3a764000081565b34801561018757600080fd5b5061013761019636600461152e565b60016020526000908152604090205481565b3480156101b457600080fd5b506101dc7f0000000000000000000000002f6f07cdcf3588944bf4c42ac74ff24bf56e759081565b6040516001600160a01b039091168152602001610141565b61015d610202366004611547565b610666565b34801561021357600080fd5b5061023b7f001300000000000000000000000000000000000000000000000000000000000081565b6040516001600160f01b03199091168152602001610141565b34801561026057600080fd5b506101dc7f000000000000000000000000000000000000000000000000000000000000000081565b61015d610961565b34801561029c57600080fd5b506101dc7f0000000000000000000000009d1b1669c73b033dfe47ae5a0164ab96df25b94481565b3480156102d057600080fd5b506101376102df36600461152e565b6109a5565b3480156102f057600080fd5b506101dc7f0000000000000000000000007ea8d498d4db3a8895454f4bf3bd56385ba8096881565b34801561032457600080fd5b506101dc73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b61015d61034e366004611596565b6109c6565b34801561035f57600080fd5b50604080518082018252600981526848537461726761746560b81b60208201529051610141919061166c565b34801561039757600080fd5b506101dc7f000000000000000000000000af5191b0de278c7286d6c7cc6ab6bb8a73ba2cd681565b3480156103cb57600080fd5b506103da636139148b60e11b81565b6040516001600160e01b03199091168152602001610141565b61045a60006001600160a01b0316826001600160a01b03161415604051806040016040528060078152602001660e6eec2e08aa8960cb1b8152506040518060400160405280600f81526020016e746f207a65726f206164647265737360881b815250610e0a565b61047873eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee87610e1e565b95507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316631114cd2a878787856040516020016104d0919060609190911b6001600160601b031916815260140190565b60408051601f198184030181529190526104ea898d61167f565b886040518763ffffffff1660e01b815260040161050b9594939291906116a4565b6000604051808303818588803b15801561052457600080fd5b505af193505050508015610536575060015b6105bb576105426116e6565b806308c379a01415610591575061055761173d565b806105625750610593565b61058b604051806040016040528060078152602001660e6eec2e08aa8960cb1b81525082610edf565b506105bb565b505b6105bb604051806040016040528060078152602001660e6eec2e08aa8960cb1b815250610f39565b60405163a87376e960e01b81526001600160f01b03197f00130000000000000000000000000000000000000000000000000000000000001660048201527f0000000000000000000000007ea8d498d4db3a8895454f4bf3bd56385ba809686001600160a01b03169063a87376e990602401600060405180830381600087803b15801561064657600080fd5b505af115801561065a573d6000803e3d6000fd5b50505050505050505050565b6106d060006001600160a01b0316856001600160a01b031614156040518060400160405280600a81526020016973656e64546f6b656e7360b01b8152506040518060400160405280600f81526020016e746f207a65726f206164647265737360881b815250610e0a565b61072683600014156040518060400160405280600a81526020016973656e64546f6b656e7360b01b8152506040518060400160405280600d81526020016c3d32b9379030b6b7bab73a24b760991b815250610e0a565b6107507f0000000000000000000000002f6f07cdcf3588944bf4c42ac74ff24bf56e759084610e1e565b92507f0000000000000000000000002f6f07cdcf3588944bf4c42ac74ff24bf56e75906001600160a01b0316632e15238c8387876040516020016107a7919060609190911b6001600160601b031916815260140190565b60408051601f1981840301815290829052600160f01b6020830152602282018790529088906000906042016040516020818303038152906040526040518763ffffffff1660e01b81526004016108019594939291906117c7565b6000604051808303818588803b15801561081a57600080fd5b505af19350505050801561082c575060015b6108b7576108386116e6565b806308c379a0141561088a575061084d61173d565b80610858575061088c565b6108846040518060400160405280600a81526020016973656e64546f6b656e7360b01b81525082610edf565b506108b7565b505b6108b76040518060400160405280600a81526020016973656e64546f6b656e7360b01b815250610f39565b60405163a87376e960e01b81526001600160f01b03197f00130000000000000000000000000000000000000000000000000000000000001660048201527f0000000000000000000000007ea8d498d4db3a8895454f4bf3bd56385ba809686001600160a01b03169063a87376e990602401600060405180830381600087803b15801561094257600080fd5b505af1158015610956573d6000803e3d6000fd5b505050505050505050565b60405162461bcd60e51b8152602060048201526014602482015273496e76616c696420706f73742070726f6365737360601b60448201526064015b60405180910390fd5b600081815481106109b557600080fd5b600091825260209091200154905081565b610a2a60006001600160a01b0316826001600160a01b03161415604051806040016040528060048152602001630737761760e41b8152506040518060400160405280600f81526020016e746f207a65726f206164647265737360881b815250610e0a565b60405163068bcd8d60e01b8152600481018890526000907f0000000000000000000000009d1b1669c73b033dfe47ae5a0164ab96df25b9446001600160a01b03169063068bcd8d90602401602060405180830381865afa158015610a92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab69190611818565b9050610b1b60006001600160a01b0316826001600160a01b03161415604051806040016040528060048152602001630737761760e41b8152506040518060400160405280600e81526020016d1c1bdbdb081b9bdd08199bdd5b9960921b815250610e0a565b6000816001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b5b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b7f9190611818565b9050610b8b8187610e1e565b9550610bb8817f000000000000000000000000af5191b0de278c7286d6c7cc6ab6bb8a73ba2cd688610f69565b7f000000000000000000000000af5191b0de278c7286d6c7cc6ab6bb8a73ba2cd66001600160a01b0316639fbf10fc868c8c8c8c8c8b6040518060600160405280600081526020016000815260200160405180604001604052806002815260200161060f60f31b8152508152508c604051602001610c49919060609190911b6001600160601b031916815260140190565b60408051601f198184030181526020830182526000835290516001600160e01b031960e08d901b168152610c87999897969594939290600401611835565b6000604051808303818588803b158015610ca057600080fd5b505af193505050508015610cb2575060015b610d3157610cbe6116e6565b806308c379a01415610d0a5750610cd361173d565b80610cde5750610d0c565b610d04604051806040016040528060048152602001630737761760e41b81525082610edf565b50610d31565b505b610d31604051806040016040528060048152602001630737761760e41b815250610f39565b610d5b817f000000000000000000000000af5191b0de278c7286d6c7cc6ab6bb8a73ba2cd6610ff1565b60405163a87376e960e01b81526001600160f01b03197f00130000000000000000000000000000000000000000000000000000000000001660048201527f0000000000000000000000007ea8d498d4db3a8895454f4bf3bd56385ba809686001600160a01b03169063a87376e990602401600060405180830381600087803b158015610de657600080fd5b505af1158015610dfa573d6000803e3d6000fd5b5050505050505050505050505050565b82610e1957610e198282610edf565b505050565b60006000198214610e30575080610ed9565b6001600160a01b0383161580610e6257506001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee145b15610e6e575047610ed9565b6040516370a0823160e01b81523060048201526001600160a01b038416906370a0823190602401602060405180830381865afa158015610eb2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed691906118d3565b90505b92915050565b60408051808201909152600981526848537461726761746560b81b60208201528282604051602001610f13939291906118ec565b60408051601f198184030181529082905262461bcd60e51b825261099c9160040161166c565b610f66816040518060400160405280600b81526020016a155b9cdc1958da599a595960aa1b815250610edf565b50565b60405163095ea7b360e01b81526001600160a01b0383811660048301526024820183905284169063095ea7b390604401600060405180830381600087803b158015610fb357600080fd5b505af1925050508015610fc4575060015b610e1957610fdd6001600160a01b038416836000611131565b610e196001600160a01b0384168383611131565b604051636eb1769f60e11b81523060048201526001600160a01b0382811660248301526000919084169063dd62ed3e90604401602060405180830381865afa158015611041573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106591906118d3565b111561112d5760405163095ea7b360e01b81526001600160a01b0382811660048301526000602483015283169063095ea7b390604401600060405180830381600087803b1580156110b557600080fd5b505af19250505080156110c6575060015b61112d5760405163095ea7b360e01b81526001600160a01b0382811660048301526001602483015283169063095ea7b390604401600060405180830381600087803b15801561111457600080fd5b505af1158015611128573d6000803e3d6000fd5b505050505b5050565b8015806111ab5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015611185573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a991906118d3565b155b6112165760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b606482015260840161099c565b604080516001600160a01b03848116602483015260448083018590528351808403909101815260649092018352602080830180516001600160e01b031663095ea7b360e01b17905283518085019094528084527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656490840152610e19928692916000916112a6918516908490611323565b805190915015610e1957808060200190518101906112c4919061194c565b610e195760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161099c565b6060611332848460008561133c565b90505b9392505050565b60608247101561139d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161099c565b843b6113eb5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161099c565b600080866001600160a01b03168587604051611407919061196e565b60006040518083038185875af1925050503d8060008114611444576040519150601f19603f3d011682016040523d82523d6000602084013e611449565b606091505b5091509150611459828286611464565b979650505050505050565b60608315611473575081611335565b8251156114835782518084602001fd5b8160405162461bcd60e51b815260040161099c919061166c565b803561ffff811681146114af57600080fd5b919050565b6001600160a01b0381168114610f6657600080fd5b60008060008060008060c087890312156114e257600080fd5b863595506114f26020880161149d565b94506040870135611502816114b4565b9350606087013592506080870135915060a0870135611520816114b4565b809150509295509295509295565b60006020828403121561154057600080fd5b5035919050565b600080600080600060a0868803121561155f57600080fd5b6115688661149d565b94506020860135611578816114b4565b94979496505050506040830135926060810135926080909101359150565b600080600080600080600080610100898b0312156115b357600080fd5b6115bc8961149d565b9750602089013596506040890135955060608901356115da816114b4565b94506080890135935060a0890135925060c0890135915060e08901356115ff816114b4565b809150509295985092959890939650565b60005b8381101561162b578181015183820152602001611613565b8381111561163a576000848401525b50505050565b60008151808452611658816020860160208601611610565b601f01601f19169290920160200192915050565b602081526000610ed66020830184611640565b60008282101561169f57634e487b7160e01b600052601160045260246000fd5b500390565b61ffff861681526001600160a01b038516602082015260a0604082018190526000906116d290830186611640565b606083019490945250608001529392505050565b600060033d11156116ff5760046000803e5060005160e01c5b90565b601f8201601f1916810167ffffffffffffffff8111828210171561173657634e487b7160e01b600052604160045260246000fd5b6040525050565b600060443d101561174b5790565b6040516003193d81016004833e81513d67ffffffffffffffff816024840111818411171561177b57505050505090565b82850191508151818111156117935750505050505090565b843d87010160208285010111156117ad5750505050505090565b6117bc60208286010187611702565b509095945050505050565b61ffff8616815260a0602082015260006117e460a0830187611640565b604083018690526001600160a01b0385166060840152828103608084015261180c8185611640565b98975050505050505050565b60006020828403121561182a57600080fd5b8151611335816114b4565b600061012061ffff8c1683528a602084015289604084015260018060a01b03891660608401528760808401528660a08401528060c08401528551818401525060208501516101408301526040850151606061016084015261189a610180840182611640565b905082810360e08401526118ae8186611640565b90508281036101008401526118c38185611640565b9c9b505050505050505050505050565b6000602082840312156118e557600080fd5b5051919050565b600084516118fe818460208901611610565b605f60f81b908301908152845161191c816001840160208901611610565b6101d160f51b60019290910191820152835161193f816003840160208801611610565b0160030195945050505050565b60006020828403121561195e57600080fd5b8151801515811461133557600080fd5b60008251611980818460208701611610565b919091019291505056fea2646970667358221220e62e68a4c0325a6a66dbdf1ea23bf7c86bb5a94f49c95771a69b4f6da9c0a22164736f6c634300080a0033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000af5191b0de278c7286d6c7cc6ab6bb8a73ba2cd600000000000000000000000000000000000000000000000000000000000000000000000000000000000000002f6f07cdcf3588944bf4c42ac74ff24bf56e75900000000000000000000000009d1b1669c73b033dfe47ae5a0164ab96df25b9440000000000000000000000007ea8d498d4db3a8895454f4bf3bd56385ba809680013000000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : router_ (address): 0xAf5191B0De278C7286d6C7CC6ab6BB8A73bA2Cd6
Arg [1] : routerETH_ (address): 0x0000000000000000000000000000000000000000
Arg [2] : stgToken_ (address): 0x2F6F07CDcf3588944Bf4C42aC74ff24bF56e7590
Arg [3] : factory_ (address): 0x9d1B1669c73b033DFe47ae5a0164Ab96df25B944
Arg [4] : widgetSwap_ (address): 0x7eA8d498d4db3a8895454F4BF3bD56385ba80968
Arg [5] : partnerId_ (bytes2): 0x0013

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 000000000000000000000000af5191b0de278c7286d6c7cc6ab6bb8a73ba2cd6
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [2] : 0000000000000000000000002f6f07cdcf3588944bf4c42ac74ff24bf56e7590
Arg [3] : 0000000000000000000000009d1b1669c73b033dfe47ae5a0164ab96df25b944
Arg [4] : 0000000000000000000000007ea8d498d4db3a8895454f4bf3bd56385ba80968
Arg [5] : 0013000000000000000000000000000000000000000000000000000000000000


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  ]
[ 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.