FTM Price: $0.701703 (+1.90%)
 

Overview

FTM Balance

Fantom LogoFantom LogoFantom Logo0 FTM

FTM Value

$0.00

Sponsored

Transaction Hash
Method
Block
From
To
0x61014060577552702023-03-17 6:42:36571 days ago1679035356IN
 Create: HStargate
0 FTM0.0800748353.88351186

Latest 13 internal transactions

Parent Transaction Hash Block From To
811973112024-05-19 0:42:28143 days ago1716079348
0xa2fB8ADb...5E449eFA1
0.39211966 FTM
721693122023-12-07 16:20:36306 days ago1701966036
0xa2fB8ADb...5E449eFA1
1.18311404 FTM
701039162023-11-02 13:29:56341 days ago1698931796
0xa2fB8ADb...5E449eFA1
1.35230646 FTM
692209142023-10-11 14:19:16363 days ago1697033956
0xa2fB8ADb...5E449eFA1
2.04914933 FTM
676590942023-08-31 10:08:02404 days ago1693476482
0xa2fB8ADb...5E449eFA1
3.19924759 FTM
669131512023-08-12 16:46:03423 days ago1691858763
0xa2fB8ADb...5E449eFA1
3.40263989 FTM
669121152023-08-12 16:05:31423 days ago1691856331
0xa2fB8ADb...5E449eFA1
3.27109881 FTM
665877282023-08-03 19:17:46432 days ago1691090266
0xa2fB8ADb...5E449eFA1
4.62141346 FTM
646956052023-06-26 13:46:29470 days ago1687787189
0xa2fB8ADb...5E449eFA1
2.5031089 FTM
622824142023-05-14 14:29:50513 days ago1684074590
0xa2fB8ADb...5E449eFA1
3.2706417 FTM
612724132023-05-02 4:29:15525 days ago1683001755
0xa2fB8ADb...5E449eFA1
0.96030758 FTM
583565052023-03-25 16:44:51563 days ago1679762691
0xa2fB8ADb...5E449eFA1
0.163589 FTM
577552702023-03-17 6:42:36571 days ago1679035356  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
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(
        uint16 dstChainId,
        address payable refundAddress,
        uint256 amountIn,
        uint256 fee,
        uint256 amountOutMin,
        address to
    ) external payable {
        _requireMsg(to != address(0), "swapETH", "to zero address");

        uint256 value;
        if (amountIn != type(uint256).max) {
            value = amountIn + fee;
        } else {
            value = address(this).balance;
            amountIn = value - fee;
        }

        // Swap ETH
        try
            IStargateRouterETH(routerETH).swapETH{value: value}(
                dstChainId,
                refundAddress,
                abi.encodePacked(to),
                amountIn,
                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);

        // Send 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":"uint16","name":"dstChainId","type":"uint16"},{"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":"swapETH","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"widgetSwap","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

6101406040523480156200001257600080fd5b5060405162001bab38038062001bab83398101604081905262000035916200008c565b6001600160a01b0395861660805293851660a05291841660c052831660e052909116610100526001600160f01b031916610120526200011e565b80516001600160a01b03811681146200008757600080fd5b919050565b60008060008060008060c08789031215620000a657600080fd5b620000b1876200006f565b9550620000c1602088016200006f565b9450620000d1604088016200006f565b9350620000e1606088016200006f565b9250620000f1608088016200006f565b60a08801519092506001600160f01b0319811681146200011057600080fd5b809150509295509295509295565b60805160a05160c05160e05161010051610120516119e2620001c9600039600081816102060152818161065c015281816109130152610d750152600081816102f6015281816106830152818161093a0152610d9c01526000818161028f0152610a450152600081816101a5015281816104b801526104e101526000818161025301526107c601526000818161039d01528181610b9501528181610bbc0152610d3901526119e26000f3fe6080604052600436106100fe5760003560e01c8063c45a015511610095578063df2ebdbb11610064578063df2ebdbb14610318578063e43d821a14610340578063f5f5ba7214610353578063f887ea401461038b578063fa2901a5146103bf57600080fd5b8063c45a01551461027d578063d99919a6146102b1578063dc9031c4146102c4578063dd1bc08e146102e457600080fd5b80639c00286a116100d15780639c00286a146101df578063aa37db6c146101f4578063bcf8699f14610241578063c27229161461027557600080fd5b80630f532d181461010357806387c139431461014a57806399eb59b9146101665780639afb25de14610193575b600080fd5b34801561010f57600080fd5b506101377fb2f2618cecbbb6e7468cc0f2aa43858ad8d153e0280b22285e28e853bb9d453a81565b6040519081526020015b60405180910390f35b34801561015657600080fd5b50610137670de0b6b3a764000081565b34801561017257600080fd5b5061013761018136600461149f565b60016020526000908152604090205481565b34801561019f57600080fd5b506101c77f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610141565b6101f26101ed3660046114e4565b6103f3565b005b34801561020057600080fd5b506102287f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160f01b03199091168152602001610141565b34801561024d57600080fd5b506101c77f000000000000000000000000000000000000000000000000000000000000000081565b6101f26106ee565b34801561028957600080fd5b506101c77f000000000000000000000000000000000000000000000000000000000000000081565b6101f26102bf366004611533565b610732565b3480156102d057600080fd5b506101376102df36600461149f565b6109a7565b3480156102f057600080fd5b506101c77f000000000000000000000000000000000000000000000000000000000000000081565b34801561032457600080fd5b506101c773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b6101f261034e366004611598565b6109c8565b34801561035f57600080fd5b50604080518082018252600981526848537461726761746560b81b60208201529051610141919061166e565b34801561039757600080fd5b506101c77f000000000000000000000000000000000000000000000000000000000000000081565b3480156103cb57600080fd5b506103da636139148b60e11b81565b6040516001600160e01b03199091168152602001610141565b61045d60006001600160a01b0316856001600160a01b031614156040518060400160405280600a81526020016973656e64546f6b656e7360b01b8152506040518060400160405280600f81526020016e746f207a65726f206164647265737360881b815250610e0c565b6104b383600014156040518060400160405280600a81526020016973656e64546f6b656e7360b01b8152506040518060400160405280600d81526020016c3d32b9379030b6b7bab73a24b760991b815250610e0c565b6104dd7f000000000000000000000000000000000000000000000000000000000000000084610e20565b92507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316632e15238c838787604051602001610534919060609190911b6001600160601b031916815260140190565b60408051601f1981840301815290829052600160f01b6020830152602282018790529088906000906042016040516020818303038152906040526040518763ffffffff1660e01b815260040161058e959493929190611681565b6000604051808303818588803b1580156105a757600080fd5b505af1935050505080156105b9575060015b610644576105c56116d2565b806308c379a0141561061757506105da611729565b806105e55750610619565b6106116040518060400160405280600a81526020016973656e64546f6b656e7360b01b81525082610ee1565b50610644565b505b6106446040518060400160405280600a81526020016973656e64546f6b656e7360b01b815250610f3b565b60405163a87376e960e01b81526001600160f01b03197f00000000000000000000000000000000000000000000000000000000000000001660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a87376e990602401600060405180830381600087803b1580156106cf57600080fd5b505af11580156106e3573d6000803e3d6000fd5b505050505050505050565b60405162461bcd60e51b8152602060048201526014602482015273496e76616c696420706f73742070726f6365737360601b60448201526064015b60405180910390fd5b61079960006001600160a01b0316826001600160a01b03161415604051806040016040528060078152602001660e6eec2e08aa8960cb1b8152506040518060400160405280600f81526020016e746f207a65726f206164647265737360881b815250610e0c565b600060001985146107b5576107ae84866117c9565b90506107c4565b50476107c184826117e1565b94505b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316631114cd2a8289898660405160200161081a919060609190911b6001600160601b031916815260140190565b6040516020818303038152906040528a896040518763ffffffff1660e01b815260040161084b9594939291906117f8565b6000604051808303818588803b15801561086457600080fd5b505af193505050508015610876575060015b6108fb576108826116d2565b806308c379a014156108d15750610897611729565b806108a257506108d3565b6108cb604051806040016040528060078152602001660e6eec2e08aa8960cb1b81525082610ee1565b506108fb565b505b6108fb604051806040016040528060078152602001660e6eec2e08aa8960cb1b815250610f3b565b60405163a87376e960e01b81526001600160f01b03197f00000000000000000000000000000000000000000000000000000000000000001660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a87376e990602401600060405180830381600087803b15801561098657600080fd5b505af115801561099a573d6000803e3d6000fd5b5050505050505050505050565b600081815481106109b757600080fd5b600091825260209091200154905081565b610a2c60006001600160a01b0316826001600160a01b03161415604051806040016040528060048152602001630737761760e41b8152506040518060400160405280600f81526020016e746f207a65726f206164647265737360881b815250610e0c565b60405163068bcd8d60e01b8152600481018890526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063068bcd8d90602401602060405180830381865afa158015610a94573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab8919061183a565b9050610b1d60006001600160a01b0316826001600160a01b03161415604051806040016040528060048152602001630737761760e41b8152506040518060400160405280600e81526020016d1c1bdbdb081b9bdd08199bdd5b9960921b815250610e0c565b6000816001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b81919061183a565b9050610b8d8187610e20565b9550610bba817f000000000000000000000000000000000000000000000000000000000000000088610f6b565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639fbf10fc868c8c8c8c8c8b6040518060600160405280600081526020016000815260200160405180604001604052806002815260200161060f60f31b8152508152508c604051602001610c4b919060609190911b6001600160601b031916815260140190565b60408051601f198184030181526020830182526000835290516001600160e01b031960e08d901b168152610c89999897969594939290600401611857565b6000604051808303818588803b158015610ca257600080fd5b505af193505050508015610cb4575060015b610d3357610cc06116d2565b806308c379a01415610d0c5750610cd5611729565b80610ce05750610d0e565b610d06604051806040016040528060048152602001630737761760e41b81525082610ee1565b50610d33565b505b610d33604051806040016040528060048152602001630737761760e41b815250610f3b565b610d5d817f0000000000000000000000000000000000000000000000000000000000000000610ff3565b60405163a87376e960e01b81526001600160f01b03197f00000000000000000000000000000000000000000000000000000000000000001660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a87376e990602401600060405180830381600087803b158015610de857600080fd5b505af1158015610dfc573d6000803e3d6000fd5b5050505050505050505050505050565b82610e1b57610e1b8282610ee1565b505050565b60006000198214610e32575080610edb565b6001600160a01b0383161580610e6457506001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee145b15610e70575047610edb565b6040516370a0823160e01b81523060048201526001600160a01b038416906370a0823190602401602060405180830381865afa158015610eb4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed891906118f5565b90505b92915050565b60408051808201909152600981526848537461726761746560b81b60208201528282604051602001610f159392919061190e565b60408051601f198184030181529082905262461bcd60e51b82526107299160040161166e565b610f68816040518060400160405280600b81526020016a155b9cdc1958da599a595960aa1b815250610ee1565b50565b60405163095ea7b360e01b81526001600160a01b0383811660048301526024820183905284169063095ea7b390604401600060405180830381600087803b158015610fb557600080fd5b505af1925050508015610fc6575060015b610e1b57610fdf6001600160a01b038416836000611133565b610e1b6001600160a01b0384168383611133565b604051636eb1769f60e11b81523060048201526001600160a01b0382811660248301526000919084169063dd62ed3e90604401602060405180830381865afa158015611043573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106791906118f5565b111561112f5760405163095ea7b360e01b81526001600160a01b0382811660048301526000602483015283169063095ea7b390604401600060405180830381600087803b1580156110b757600080fd5b505af19250505080156110c8575060015b61112f5760405163095ea7b360e01b81526001600160a01b0382811660048301526001602483015283169063095ea7b390604401600060405180830381600087803b15801561111657600080fd5b505af115801561112a573d6000803e3d6000fd5b505050505b5050565b8015806111ad5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015611187573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ab91906118f5565b155b6112185760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610729565b604080516001600160a01b03848116602483015260448083018590528351808403909101815260649092018352602080830180516001600160e01b031663095ea7b360e01b17905283518085019094528084527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656490840152610e1b928692916000916112a8918516908490611325565b805190915015610e1b57808060200190518101906112c6919061196e565b610e1b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610729565b6060611334848460008561133e565b90505b9392505050565b60608247101561139f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610729565b843b6113ed5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610729565b600080866001600160a01b031685876040516114099190611990565b60006040518083038185875af1925050503d8060008114611446576040519150601f19603f3d011682016040523d82523d6000602084013e61144b565b606091505b509150915061145b828286611466565b979650505050505050565b60608315611475575081611337565b8251156114855782518084602001fd5b8160405162461bcd60e51b8152600401610729919061166e565b6000602082840312156114b157600080fd5b5035919050565b803561ffff811681146114ca57600080fd5b919050565b6001600160a01b0381168114610f6857600080fd5b600080600080600060a086880312156114fc57600080fd5b611505866114b8565b94506020860135611515816114cf565b94979496505050506040830135926060810135926080909101359150565b60008060008060008060c0878903121561154c57600080fd5b611555876114b8565b95506020870135611565816114cf565b945060408701359350606087013592506080870135915060a087013561158a816114cf565b809150509295509295509295565b600080600080600080600080610100898b0312156115b557600080fd5b6115be896114b8565b9750602089013596506040890135955060608901356115dc816114cf565b94506080890135935060a0890135925060c0890135915060e0890135611601816114cf565b809150509295985092959890939650565b60005b8381101561162d578181015183820152602001611615565b8381111561163c576000848401525b50505050565b6000815180845261165a816020860160208601611612565b601f01601f19169290920160200192915050565b602081526000610ed86020830184611642565b61ffff8616815260a06020820152600061169e60a0830187611642565b604083018690526001600160a01b038516606084015282810360808401526116c68185611642565b98975050505050505050565b600060033d11156116eb5760046000803e5060005160e01c5b90565b601f8201601f1916810167ffffffffffffffff8111828210171561172257634e487b7160e01b600052604160045260246000fd5b6040525050565b600060443d10156117375790565b6040516003193d81016004833e81513d67ffffffffffffffff816024840111818411171561176757505050505090565b828501915081518181111561177f5750505050505090565b843d87010160208285010111156117995750505050505090565b6117a8602082860101876116ee565b509095945050505050565b634e487b7160e01b600052601160045260246000fd5b600082198211156117dc576117dc6117b3565b500190565b6000828210156117f3576117f36117b3565b500390565b61ffff861681526001600160a01b038516602082015260a06040820181905260009061182690830186611642565b606083019490945250608001529392505050565b60006020828403121561184c57600080fd5b8151611337816114cf565b600061012061ffff8c1683528a602084015289604084015260018060a01b03891660608401528760808401528660a08401528060c0840152855181840152506020850151610140830152604085015160606101608401526118bc610180840182611642565b905082810360e08401526118d08186611642565b90508281036101008401526118e58185611642565b9c9b505050505050505050505050565b60006020828403121561190757600080fd5b5051919050565b60008451611920818460208901611612565b605f60f81b908301908152845161193e816001840160208901611612565b6101d160f51b600192909101918201528351611961816003840160208801611612565b0160030195945050505050565b60006020828403121561198057600080fd5b8151801515811461133757600080fd5b600082516119a2818460208701611612565b919091019291505056fea2646970667358221220e357e44511924f13989dc81068ec7e8bd82550d4830a1124f0daa998f6e15e3d64736f6c634300080a0033000000000000000000000000af5191b0de278c7286d6c7cc6ab6bb8a73ba2cd600000000000000000000000000000000000000000000000000000000000000000000000000000000000000002f6f07cdcf3588944bf4c42ac74ff24bf56e75900000000000000000000000009d1b1669c73b033dfe47ae5a0164ab96df25b9440000000000000000000000007ea8d498d4db3a8895454f4bf3bd56385ba809680013000000000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x6080604052600436106100fe5760003560e01c8063c45a015511610095578063df2ebdbb11610064578063df2ebdbb14610318578063e43d821a14610340578063f5f5ba7214610353578063f887ea401461038b578063fa2901a5146103bf57600080fd5b8063c45a01551461027d578063d99919a6146102b1578063dc9031c4146102c4578063dd1bc08e146102e457600080fd5b80639c00286a116100d15780639c00286a146101df578063aa37db6c146101f4578063bcf8699f14610241578063c27229161461027557600080fd5b80630f532d181461010357806387c139431461014a57806399eb59b9146101665780639afb25de14610193575b600080fd5b34801561010f57600080fd5b506101377fb2f2618cecbbb6e7468cc0f2aa43858ad8d153e0280b22285e28e853bb9d453a81565b6040519081526020015b60405180910390f35b34801561015657600080fd5b50610137670de0b6b3a764000081565b34801561017257600080fd5b5061013761018136600461149f565b60016020526000908152604090205481565b34801561019f57600080fd5b506101c77f0000000000000000000000002f6f07cdcf3588944bf4c42ac74ff24bf56e759081565b6040516001600160a01b039091168152602001610141565b6101f26101ed3660046114e4565b6103f3565b005b34801561020057600080fd5b506102287f001300000000000000000000000000000000000000000000000000000000000081565b6040516001600160f01b03199091168152602001610141565b34801561024d57600080fd5b506101c77f000000000000000000000000000000000000000000000000000000000000000081565b6101f26106ee565b34801561028957600080fd5b506101c77f0000000000000000000000009d1b1669c73b033dfe47ae5a0164ab96df25b94481565b6101f26102bf366004611533565b610732565b3480156102d057600080fd5b506101376102df36600461149f565b6109a7565b3480156102f057600080fd5b506101c77f0000000000000000000000007ea8d498d4db3a8895454f4bf3bd56385ba8096881565b34801561032457600080fd5b506101c773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b6101f261034e366004611598565b6109c8565b34801561035f57600080fd5b50604080518082018252600981526848537461726761746560b81b60208201529051610141919061166e565b34801561039757600080fd5b506101c77f000000000000000000000000af5191b0de278c7286d6c7cc6ab6bb8a73ba2cd681565b3480156103cb57600080fd5b506103da636139148b60e11b81565b6040516001600160e01b03199091168152602001610141565b61045d60006001600160a01b0316856001600160a01b031614156040518060400160405280600a81526020016973656e64546f6b656e7360b01b8152506040518060400160405280600f81526020016e746f207a65726f206164647265737360881b815250610e0c565b6104b383600014156040518060400160405280600a81526020016973656e64546f6b656e7360b01b8152506040518060400160405280600d81526020016c3d32b9379030b6b7bab73a24b760991b815250610e0c565b6104dd7f0000000000000000000000002f6f07cdcf3588944bf4c42ac74ff24bf56e759084610e20565b92507f0000000000000000000000002f6f07cdcf3588944bf4c42ac74ff24bf56e75906001600160a01b0316632e15238c838787604051602001610534919060609190911b6001600160601b031916815260140190565b60408051601f1981840301815290829052600160f01b6020830152602282018790529088906000906042016040516020818303038152906040526040518763ffffffff1660e01b815260040161058e959493929190611681565b6000604051808303818588803b1580156105a757600080fd5b505af1935050505080156105b9575060015b610644576105c56116d2565b806308c379a0141561061757506105da611729565b806105e55750610619565b6106116040518060400160405280600a81526020016973656e64546f6b656e7360b01b81525082610ee1565b50610644565b505b6106446040518060400160405280600a81526020016973656e64546f6b656e7360b01b815250610f3b565b60405163a87376e960e01b81526001600160f01b03197f00130000000000000000000000000000000000000000000000000000000000001660048201527f0000000000000000000000007ea8d498d4db3a8895454f4bf3bd56385ba809686001600160a01b03169063a87376e990602401600060405180830381600087803b1580156106cf57600080fd5b505af11580156106e3573d6000803e3d6000fd5b505050505050505050565b60405162461bcd60e51b8152602060048201526014602482015273496e76616c696420706f73742070726f6365737360601b60448201526064015b60405180910390fd5b61079960006001600160a01b0316826001600160a01b03161415604051806040016040528060078152602001660e6eec2e08aa8960cb1b8152506040518060400160405280600f81526020016e746f207a65726f206164647265737360881b815250610e0c565b600060001985146107b5576107ae84866117c9565b90506107c4565b50476107c184826117e1565b94505b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316631114cd2a8289898660405160200161081a919060609190911b6001600160601b031916815260140190565b6040516020818303038152906040528a896040518763ffffffff1660e01b815260040161084b9594939291906117f8565b6000604051808303818588803b15801561086457600080fd5b505af193505050508015610876575060015b6108fb576108826116d2565b806308c379a014156108d15750610897611729565b806108a257506108d3565b6108cb604051806040016040528060078152602001660e6eec2e08aa8960cb1b81525082610ee1565b506108fb565b505b6108fb604051806040016040528060078152602001660e6eec2e08aa8960cb1b815250610f3b565b60405163a87376e960e01b81526001600160f01b03197f00130000000000000000000000000000000000000000000000000000000000001660048201527f0000000000000000000000007ea8d498d4db3a8895454f4bf3bd56385ba809686001600160a01b03169063a87376e990602401600060405180830381600087803b15801561098657600080fd5b505af115801561099a573d6000803e3d6000fd5b5050505050505050505050565b600081815481106109b757600080fd5b600091825260209091200154905081565b610a2c60006001600160a01b0316826001600160a01b03161415604051806040016040528060048152602001630737761760e41b8152506040518060400160405280600f81526020016e746f207a65726f206164647265737360881b815250610e0c565b60405163068bcd8d60e01b8152600481018890526000907f0000000000000000000000009d1b1669c73b033dfe47ae5a0164ab96df25b9446001600160a01b03169063068bcd8d90602401602060405180830381865afa158015610a94573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab8919061183a565b9050610b1d60006001600160a01b0316826001600160a01b03161415604051806040016040528060048152602001630737761760e41b8152506040518060400160405280600e81526020016d1c1bdbdb081b9bdd08199bdd5b9960921b815250610e0c565b6000816001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b81919061183a565b9050610b8d8187610e20565b9550610bba817f000000000000000000000000af5191b0de278c7286d6c7cc6ab6bb8a73ba2cd688610f6b565b7f000000000000000000000000af5191b0de278c7286d6c7cc6ab6bb8a73ba2cd66001600160a01b0316639fbf10fc868c8c8c8c8c8b6040518060600160405280600081526020016000815260200160405180604001604052806002815260200161060f60f31b8152508152508c604051602001610c4b919060609190911b6001600160601b031916815260140190565b60408051601f198184030181526020830182526000835290516001600160e01b031960e08d901b168152610c89999897969594939290600401611857565b6000604051808303818588803b158015610ca257600080fd5b505af193505050508015610cb4575060015b610d3357610cc06116d2565b806308c379a01415610d0c5750610cd5611729565b80610ce05750610d0e565b610d06604051806040016040528060048152602001630737761760e41b81525082610ee1565b50610d33565b505b610d33604051806040016040528060048152602001630737761760e41b815250610f3b565b610d5d817f000000000000000000000000af5191b0de278c7286d6c7cc6ab6bb8a73ba2cd6610ff3565b60405163a87376e960e01b81526001600160f01b03197f00130000000000000000000000000000000000000000000000000000000000001660048201527f0000000000000000000000007ea8d498d4db3a8895454f4bf3bd56385ba809686001600160a01b03169063a87376e990602401600060405180830381600087803b158015610de857600080fd5b505af1158015610dfc573d6000803e3d6000fd5b5050505050505050505050505050565b82610e1b57610e1b8282610ee1565b505050565b60006000198214610e32575080610edb565b6001600160a01b0383161580610e6457506001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee145b15610e70575047610edb565b6040516370a0823160e01b81523060048201526001600160a01b038416906370a0823190602401602060405180830381865afa158015610eb4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed891906118f5565b90505b92915050565b60408051808201909152600981526848537461726761746560b81b60208201528282604051602001610f159392919061190e565b60408051601f198184030181529082905262461bcd60e51b82526107299160040161166e565b610f68816040518060400160405280600b81526020016a155b9cdc1958da599a595960aa1b815250610ee1565b50565b60405163095ea7b360e01b81526001600160a01b0383811660048301526024820183905284169063095ea7b390604401600060405180830381600087803b158015610fb557600080fd5b505af1925050508015610fc6575060015b610e1b57610fdf6001600160a01b038416836000611133565b610e1b6001600160a01b0384168383611133565b604051636eb1769f60e11b81523060048201526001600160a01b0382811660248301526000919084169063dd62ed3e90604401602060405180830381865afa158015611043573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106791906118f5565b111561112f5760405163095ea7b360e01b81526001600160a01b0382811660048301526000602483015283169063095ea7b390604401600060405180830381600087803b1580156110b757600080fd5b505af19250505080156110c8575060015b61112f5760405163095ea7b360e01b81526001600160a01b0382811660048301526001602483015283169063095ea7b390604401600060405180830381600087803b15801561111657600080fd5b505af115801561112a573d6000803e3d6000fd5b505050505b5050565b8015806111ad5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015611187573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ab91906118f5565b155b6112185760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610729565b604080516001600160a01b03848116602483015260448083018590528351808403909101815260649092018352602080830180516001600160e01b031663095ea7b360e01b17905283518085019094528084527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656490840152610e1b928692916000916112a8918516908490611325565b805190915015610e1b57808060200190518101906112c6919061196e565b610e1b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610729565b6060611334848460008561133e565b90505b9392505050565b60608247101561139f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610729565b843b6113ed5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610729565b600080866001600160a01b031685876040516114099190611990565b60006040518083038185875af1925050503d8060008114611446576040519150601f19603f3d011682016040523d82523d6000602084013e61144b565b606091505b509150915061145b828286611466565b979650505050505050565b60608315611475575081611337565b8251156114855782518084602001fd5b8160405162461bcd60e51b8152600401610729919061166e565b6000602082840312156114b157600080fd5b5035919050565b803561ffff811681146114ca57600080fd5b919050565b6001600160a01b0381168114610f6857600080fd5b600080600080600060a086880312156114fc57600080fd5b611505866114b8565b94506020860135611515816114cf565b94979496505050506040830135926060810135926080909101359150565b60008060008060008060c0878903121561154c57600080fd5b611555876114b8565b95506020870135611565816114cf565b945060408701359350606087013592506080870135915060a087013561158a816114cf565b809150509295509295509295565b600080600080600080600080610100898b0312156115b557600080fd5b6115be896114b8565b9750602089013596506040890135955060608901356115dc816114cf565b94506080890135935060a0890135925060c0890135915060e0890135611601816114cf565b809150509295985092959890939650565b60005b8381101561162d578181015183820152602001611615565b8381111561163c576000848401525b50505050565b6000815180845261165a816020860160208601611612565b601f01601f19169290920160200192915050565b602081526000610ed86020830184611642565b61ffff8616815260a06020820152600061169e60a0830187611642565b604083018690526001600160a01b038516606084015282810360808401526116c68185611642565b98975050505050505050565b600060033d11156116eb5760046000803e5060005160e01c5b90565b601f8201601f1916810167ffffffffffffffff8111828210171561172257634e487b7160e01b600052604160045260246000fd5b6040525050565b600060443d10156117375790565b6040516003193d81016004833e81513d67ffffffffffffffff816024840111818411171561176757505050505090565b828501915081518181111561177f5750505050505090565b843d87010160208285010111156117995750505050505090565b6117a8602082860101876116ee565b509095945050505050565b634e487b7160e01b600052601160045260246000fd5b600082198211156117dc576117dc6117b3565b500190565b6000828210156117f3576117f36117b3565b500390565b61ffff861681526001600160a01b038516602082015260a06040820181905260009061182690830186611642565b606083019490945250608001529392505050565b60006020828403121561184c57600080fd5b8151611337816114cf565b600061012061ffff8c1683528a602084015289604084015260018060a01b03891660608401528760808401528660a08401528060c0840152855181840152506020850151610140830152604085015160606101608401526118bc610180840182611642565b905082810360e08401526118d08186611642565b90508281036101008401526118e58185611642565b9c9b505050505050505050505050565b60006020828403121561190757600080fd5b5051919050565b60008451611920818460208901611612565b605f60f81b908301908152845161193e816001840160208901611612565b6101d160f51b600192909101918201528351611961816003840160208801611612565b0160030195945050505050565b60006020828403121561198057600080fd5b8151801515811461133757600080fd5b600082516119a2818460208701611612565b919091019291505056fea2646970667358221220e357e44511924f13989dc81068ec7e8bd82550d4830a1124f0daa998f6e15e3d64736f6c634300080a0033

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 Gas Used Reward
view all blocks produced

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

Validator Index Block Amount
View All Withdrawals

Transaction 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.