S Price: $0.067202 (-2.88%)
Gas: 55 Gwei

Contract

0x1cEaeda3D17936916D0F3E866Aa5Ef861F544840

Overview

S Balance

Sonic LogoSonic LogoSonic Logo20 S

S Value

$1.34 (@ $0.07/S)

More Info

Private Name Tags

Transaction Hash
Block
From
To
Onswap591945612025-12-29 19:17:3727 days ago1767035857IN
0x1cEaeda3...61F544840
773.4 S0.0092721755
Onswap584195932025-12-20 10:38:3036 days ago1766227110IN
0x1cEaeda3...61F544840
137.1 S0.007527450
Onswap582586032025-12-18 14:29:4938 days ago1766068189IN
0x1cEaeda3...61F544840
1 S0.017235455
Onswap564464772025-11-26 4:44:5461 days ago1764132294IN
0x1cEaeda3...61F544840
1 S0.016134855
Onswap560623152025-11-21 21:22:4265 days ago1763760162IN
0x1cEaeda3...61F544840
1 S0.0333189455
Onswap559967932025-11-21 10:31:1065 days ago1763721070IN
0x1cEaeda3...61F544840
13,063.8 S0.008332950
Onswap559957822025-11-21 10:21:2765 days ago1763720487IN
0x1cEaeda3...61F544840
1 S0.0111833460
Onswap559942072025-11-21 10:06:1865 days ago1763719578IN
0x1cEaeda3...61F544840
1 S0.0102569555
Onswap559940522025-11-21 10:05:1365 days ago1763719513IN
0x1cEaeda3...61F544840
1 S0.0103633255
Onswap559939392025-11-21 10:04:1265 days ago1763719452IN
0x1cEaeda3...61F544840
1 S0.0113069460
Onswap559937842025-11-21 10:03:0265 days ago1763719382IN
0x1cEaeda3...61F544840
1 S0.0099123759.95
Onswap559249082025-11-20 20:02:3166 days ago1763668951IN
0x1cEaeda3...61F544840
11,304.3 S0.0091661955
Onswap558172972025-11-19 20:25:5667 days ago1763583956IN
0x1cEaeda3...61F544840
1 S0.0144807750.0001
Onswap558132222025-11-19 19:33:4967 days ago1763580829IN
0x1cEaeda3...61F544840
1,500 S0.0681682155
Onswap557589972025-11-19 8:54:2567 days ago1763542465IN
0x1cEaeda3...61F544840
1 S0.0225003955
Onswap553153092025-11-15 2:42:5472 days ago1763174574IN
0x1cEaeda3...61F544840
1 S0.1356251250.0001
Onswap536669882025-11-04 23:34:5582 days ago1762299295IN
0x1cEaeda3...61F544840
1 S0.0329306455
Onswap536437832025-11-04 20:57:3082 days ago1762289850IN
0x1cEaeda3...61F544840
1 S0.0163272455
Onswap533576112025-11-03 10:38:4483 days ago1762166324IN
0x1cEaeda3...61F544840
1 S0.0671914682.5
Onswap512396582025-10-19 18:49:1598 days ago1760899755IN
0x1cEaeda3...61F544840
1 S0.2131822750.0001
Onswap504793872025-10-13 15:34:11104 days ago1760369651IN
0x1cEaeda3...61F544840
12,687 S0.0981589450.0001
Onswap501550572025-10-11 8:46:04106 days ago1760172364IN
0x1cEaeda3...61F544840
1 S0.1047554550.0001
Onswap501191632025-10-11 4:07:40107 days ago1760155660IN
0x1cEaeda3...61F544840
1 S0.0924611654.268
Onswap497545082025-10-08 8:19:01109 days ago1759911541IN
0x1cEaeda3...61F544840
1 S0.1767613655
Onswap491993482025-10-03 11:20:05114 days ago1759490405IN
0x1cEaeda3...61F544840
1 S0.0348224150.0001
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
591945612025-12-29 19:17:3727 days ago1767035857
0x1cEaeda3...61F544840
772.4 S
584195932025-12-20 10:38:3036 days ago1766227110
0x1cEaeda3...61F544840
136.1 S
559967932025-11-21 10:31:1065 days ago1763721070
0x1cEaeda3...61F544840
13,062.8 S
559249082025-11-20 20:02:3166 days ago1763668951
0x1cEaeda3...61F544840
11,303.3 S
558132222025-11-19 19:33:4967 days ago1763580829
0x1cEaeda3...61F544840
1,499 S
509426952025-10-17 6:36:39100 days ago1760682999
0x1cEaeda3...61F544840
1,383 S
504793872025-10-13 15:34:11104 days ago1760369651
0x1cEaeda3...61F544840
12,686 S
480184092025-09-24 11:08:37123 days ago1758712117
0x1cEaeda3...61F544840
18 S
480112932025-09-24 9:32:56123 days ago1758706376
0x1cEaeda3...61F544840
83.7 S
480111942025-09-24 9:31:53123 days ago1758706313
0x1cEaeda3...61F544840
104.4 S
479496312025-09-23 20:42:48124 days ago1758660168
0x1cEaeda3...61F544840
914.7 S
463054212025-09-09 20:44:21138 days ago1757450661
0x1cEaeda3...61F544840
46.08367 S
458059352025-09-05 4:57:16143 days ago1757048236
0x1cEaeda3...61F544840
19 S
458054792025-09-05 4:50:19143 days ago1757047819
0x1cEaeda3...61F544840
24 S
448693842025-08-28 12:54:53150 days ago1756385693
0x1cEaeda3...61F544840
83.3 S
448692952025-08-28 12:53:59150 days ago1756385639
0x1cEaeda3...61F544840
83.36 S
448692362025-08-28 12:53:19150 days ago1756385599
0x1cEaeda3...61F544840
83.36 S
448691512025-08-28 12:52:26150 days ago1756385546
0x1cEaeda3...61F544840
83.36 S
448404612025-08-28 7:27:30150 days ago1756366050
0x1cEaeda3...61F544840
192.7 S
448404012025-08-28 7:26:49150 days ago1756366009
0x1cEaeda3...61F544840
150.3 S
439450862025-08-21 11:04:26157 days ago1755774266
0x1cEaeda3...61F544840
1 S
437976652025-08-20 11:09:19158 days ago1755688159
0x1cEaeda3...61F544840
108.6589 S
437885882025-08-20 9:30:19158 days ago1755682219
0x1cEaeda3...61F544840
35 S
436538882025-08-19 10:35:20159 days ago1755599720
0x1cEaeda3...61F544840
150.47 S
436537882025-08-19 10:34:13159 days ago1755599653
0x1cEaeda3...61F544840
150.47 S
View All Internal Transactions
Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
OnchainSwapV3

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 2000 runs

Other Settings:
default evmVersion
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./OnchainGateway.sol";
import '@openzeppelin/contracts/access/Ownable.sol';



contract OnchainSwapV3 is Context, Ownable{

    uint256 public fee = 0.05 ether;

    event ClaimedTokens(address to, uint256 balance);
    event OnchainSwap(address token, uint256 amount, uint256 fee);

    OnchainGateway public onchainGateway;

    constructor() {
        onchainGateway = new OnchainGateway(address(this));
    }

    modifier hasFee() {
        require(msg.value >= fee);
        _;
    }

    function onswap(
        address token,
        uint256 amount,
        address dex,
        address dexgateway,
        bytes memory calldata_
    ) external payable hasFee {

        if(token!=address(0)) {
            onchainGateway.claimTokens(
                token,
                _msgSender(),
                amount
            );

            if (dexgateway == address(0)) {
                forceApprove(token, dex, amount);
            } else {
                forceApprove(token, dexgateway, amount);
            }
        }

        require(dex != address(onchainGateway), "OnchainSwap: call to onchain gateway");

        {
            uint256 size;
            address toCheck = dex;

            assembly {
                size := extcodesize(toCheck)
            }

            require(size != 0, "OnchainSwap: call for a non-contract account");
        }


        (bool swapPassed, ) = dex.call{value: msg.value - fee}(
            calldata_
        );

        require(swapPassed, "OnchainSwap: Fail to call");
        emit OnchainSwap(token, amount, fee);
    }

    function changeFee(uint256 _newFee) public onlyOwner {
        fee = _newFee;
    }

    function claimTokens(address _to) public onlyOwner {
        uint256 balance = address(this).balance;
        (bool sent, ) = _to.call{value: balance}("");
        require(sent, "Failed to send Ether");
        emit ClaimedTokens(_to, balance);
    }

    function forceApprove(address _token, address _recipient, uint256 _value) internal {
        IERC20 erc20token = IERC20(_token);
        if (erc20token.allowance(address(this), _recipient) < _value) {
            SafeERC20.safeApprove(erc20token, _recipient, 0);
            SafeERC20.safeApprove(erc20token, _recipient, type(uint256).max);
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

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

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

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

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

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

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

File 7 of 7 : OnchainGateway.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.0;

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

contract OnchainGateway {
    address public onchainSwap;

    modifier onlyOnchainSwap() {
        require(onchainSwap == msg.sender, "Symb: caller is not the onchainSwap");
        _;
    }

    constructor(address _onchainSwap) {
        onchainSwap = _onchainSwap;
    }

    function claimTokens(
        address _token,
        address _from,
        uint256 _amount
    ) external onlyOnchainSwap {
        SafeERC20.safeTransferFrom(IERC20(_token), _from, onchainSwap, _amount);
    }
}

Settings
{
  "viaIR": true,
  "optimizer": {
    "enabled": true,
    "runs": 2000
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"balance","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"OnchainSwap","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"uint256","name":"_newFee","type":"uint256"}],"name":"changeFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"}],"name":"claimTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"onchainGateway","outputs":[{"internalType":"contract OnchainGateway","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"dex","type":"address"},{"internalType":"address","name":"dexgateway","type":"address"},{"internalType":"bytes","name":"calldata_","type":"bytes"}],"name":"onswap","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608080604052346100ca5760008054336001600160a01b031980831682178455936001600160a01b03939290919084167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08480a366b1a2bc2ec50000600155610501818101906001600160401b038211838310176100b6576020918391610e12833930815203019082f09081156100aa575016906002541617600255604051610d4290816100d08239f35b604051903d90823e3d90fd5b634e487b7160e01b84526041600452602484fd5b600080fdfe6080604052600436101561001257600080fd5b6000803560e01c90816321c69a191461009a575080636a1db1bf14610095578063715018a6146100905780638da5cb5b1461008b578063c20bb33c14610086578063ddca3f4314610081578063df8de3e71461007c5763f2fde38b1461007757600080fd5b610421565b610355565b610337565b610310565b6102e9565b610273565b610239565b60a0600319360112610130576100ae610133565b6100b661014e565b6100be610164565b6084359167ffffffffffffffff831161012c573660238401121561012c57826004013593856100ec8661021d565b946100fa60405196876101fa565b8686523660248883010111610128578661012597602460209301838901378601015260243590610578565b80f35b5080fd5b8480fd5b80fd5b600435906001600160a01b038216820361014957565b600080fd5b604435906001600160a01b038216820361014957565b606435906001600160a01b038216820361014957565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b67ffffffffffffffff81116101bd57604052565b61017a565b6040810190811067ffffffffffffffff8211176101bd57604052565b6080810190811067ffffffffffffffff8211176101bd57604052565b90601f601f19910116810190811067ffffffffffffffff8211176101bd57604052565b67ffffffffffffffff81116101bd57601f01601f191660200190565b34610149576020600319360112610149576102606001600160a01b036000541633146104cd565b600435600155005b600091031261014957565b3461014957600080600319360112610130578080547fffffffffffffffffffffffff00000000000000000000000000000000000000006001600160a01b038216916102bf3384146104cd565b1682557f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b346101495760006003193601126101495760206001600160a01b0360005416604051908152f35b346101495760006003193601126101495760206001600160a01b0360025416604051908152f35b34610149576000600319360112610149576020600154604051908152f35b346101495760206003193601126101495761036e610133565b6000906103866001600160a01b0383541633146104cd565b478280808084865af1610397610871565b50156103dd57604080516001600160a01b0393909316835260208301919091527fe9aa550fd75d0d28e07fa9dd67d3ae705678776f6c4a75abd09534f93e7d790791a180f35b606460405162461bcd60e51b815260206004820152601460248201527f4661696c656420746f2073656e642045746865720000000000000000000000006044820152fd5b346101495760206003193601126101495761043a610133565b6001600160a01b03610451816000541633146104cd565b8116156104635761046190610518565b005b608460405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b156104d457565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b600054906001600160a01b0380911691827fffffffffffffffffffffffff0000000000000000000000000000000000000000821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b919390926001543410610149576001600160a01b0390818416610652575b506000610621927f61a4ff3bb8bbf861e1aa28d574e4b88959510ac2ae1b845521bb8c13c33d566b966105f283946105e86105dc6105dc6002546001600160a01b031690565b6001600160a01b031690565b9083161415610754565b6105fe813b15156107c4565b61060a60015434610835565b602083519301915af161061b610871565b506108a1565b61064d600154604051938493846040919493926001600160a01b03606083019616825260208201520152565b0390a1565b90916106696105dc6002546001600160a01b031690565b90813b15610149576040517f9fc314c80000000000000000000000000000000000000000000000000000000081526001600160a01b038616600482015233602482015260448101879052916000908390606490829084905af1968715610748576105f26106219560009586957f61a4ff3bb8bbf861e1aa28d574e4b88959510ac2ae1b845521bb8c13c33d566b9b61072f575b5089828216158714610720576107149150848a6108fb565b94505096509250610596565b61072a918a6108fb565b610714565b8061073c610742926101a9565b80610268565b386106fc565b6040513d6000823e3d90fd5b1561075b57565b608460405162461bcd60e51b8152602060048201526024808201527f4f6e636861696e537761703a2063616c6c20746f206f6e636861696e2067617460448201527f65776179000000000000000000000000000000000000000000000000000000006064820152fd5b156107cb57565b608460405162461bcd60e51b815260206004820152602c60248201527f4f6e636861696e537761703a2063616c6c20666f722061206e6f6e2d636f6e7460448201527f72616374206163636f756e7400000000000000000000000000000000000000006064820152fd5b9190820391821161084257565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b3d1561089c573d906108828261021d565b9161089060405193846101fa565b82523d6000602084013e565b606090565b156108a857565b606460405162461bcd60e51b815260206004820152601960248201527f4f6e636861696e537761703a204661696c20746f2063616c6c000000000000006044820152fd5b90816020910312610149575190565b6040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038381166024830152939184169190602081604481865afa908115610748576000916109b9575b501061096057505050565b6109b26109b793604051907f095ea7b30000000000000000000000000000000000000000000000000000000060208301528416602482015260006044820152604481526109ac816101de565b82610bc2565b6109e7565b565b6109da915060203d81116109e0575b6109d281836101fa565b8101906108ec565b38610955565b503d6109c8565b6040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0383811660248301529291906020816044818588165afa90811561074857600091610b1b575b50610ab1576109b792604051927f095ea7b30000000000000000000000000000000000000000000000000000000060208501521660248301527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff604483015260448252610aac826101de565b610bc2565b608460405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152fd5b610b33915060203d81116109e0576109d281836101fa565b38610a40565b90816020910312610149575180151581036101495790565b15610b5857565b608460405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b6001600160a01b03169060405190610bd9826101c2565b6020928383527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656484840152803b15610c505760008281928287610c2b9796519301915af1610c25610871565b90610c94565b80519081610c3857505050565b826109b793610c4b938301019101610b39565b610b51565b6064846040519062461bcd60e51b82526004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b90919015610ca0575090565b815115610cb05750805190602001fd5b6040519062461bcd60e51b825281602080600483015282519283602484015260005b848110610cf557505050601f19601f836000604480968601015201168101030190fd5b818101830151868201604401528593508201610cd256fea2646970667358221220b869d4c5065d9d00110f6c4f32fa20354dbfc3f4bf92229eaebd4ed272ef630664736f6c6343000813003360803461007457601f61050138819003918201601f19168301916001600160401b038311848410176100795780849260209460405283398101031261007457516001600160a01b0381169081900361007457600080546001600160a01b03191691909117905560405161047190816100908239f35b600080fd5b634e487b7160e01b600052604160045260246000fdfe6080604052600436101561001257600080fd5b6000803560e01c80632ec60903146101bb57639fc314c81461003357600080fd5b346101b85760606003193601126101b85761004c6101ed565b610054610215565b73ffffffffffffffffffffffffffffffffffffffff90818454169233840361014e5761012393859284849316916040519560208701927f23b872dd00000000000000000000000000000000000000000000000000000000845216602487015260448601526044356064860152606485526100cd85610267565b82604051956100db87610288565b602087527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65646020880152610111843b151561032d565b51925af161011d610378565b906103c3565b80518061012e578280f35b816020806101439361014895010191016102a4565b6102bc565b38808280f35b608460405162461bcd60e51b815260206004820152602360248201527f53796d623a2063616c6c6572206973206e6f7420746865206f6e636861696e5360448201527f77617000000000000000000000000000000000000000000000000000000000006064820152fd5b80fd5b50346101b857806003193601126101b85773ffffffffffffffffffffffffffffffffffffffff90541660805260206080f35b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361021057565b600080fd5b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361021057565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60a0810190811067ffffffffffffffff82111761028357604052565b610238565b6040810190811067ffffffffffffffff82111761028357604052565b90816020910312610210575180151581036102105790565b156102c357565b608460405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b1561033457565b606460405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b3d156103be5767ffffffffffffffff903d8281116102835760405192601f19603f81601f8501160116840190848210908211176102835760405282523d6000602084013e565b606090565b909190156103cf575090565b8151156103df5750805190602001fd5b6040519062461bcd60e51b825281602080600483015282519283602484015260005b84811061042457505050601f19601f836000604480968601015201168101030190fd5b81810183015186820160440152859350820161040156fea2646970667358221220f88047a423878f1ccc2f743b8dbf724d53b051678fb5e50ffa7017671aa836fd64736f6c63430008130033

Deployed Bytecode

0x6080604052600436101561001257600080fd5b6000803560e01c90816321c69a191461009a575080636a1db1bf14610095578063715018a6146100905780638da5cb5b1461008b578063c20bb33c14610086578063ddca3f4314610081578063df8de3e71461007c5763f2fde38b1461007757600080fd5b610421565b610355565b610337565b610310565b6102e9565b610273565b610239565b60a0600319360112610130576100ae610133565b6100b661014e565b6100be610164565b6084359167ffffffffffffffff831161012c573660238401121561012c57826004013593856100ec8661021d565b946100fa60405196876101fa565b8686523660248883010111610128578661012597602460209301838901378601015260243590610578565b80f35b5080fd5b8480fd5b80fd5b600435906001600160a01b038216820361014957565b600080fd5b604435906001600160a01b038216820361014957565b606435906001600160a01b038216820361014957565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b67ffffffffffffffff81116101bd57604052565b61017a565b6040810190811067ffffffffffffffff8211176101bd57604052565b6080810190811067ffffffffffffffff8211176101bd57604052565b90601f601f19910116810190811067ffffffffffffffff8211176101bd57604052565b67ffffffffffffffff81116101bd57601f01601f191660200190565b34610149576020600319360112610149576102606001600160a01b036000541633146104cd565b600435600155005b600091031261014957565b3461014957600080600319360112610130578080547fffffffffffffffffffffffff00000000000000000000000000000000000000006001600160a01b038216916102bf3384146104cd565b1682557f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b346101495760006003193601126101495760206001600160a01b0360005416604051908152f35b346101495760006003193601126101495760206001600160a01b0360025416604051908152f35b34610149576000600319360112610149576020600154604051908152f35b346101495760206003193601126101495761036e610133565b6000906103866001600160a01b0383541633146104cd565b478280808084865af1610397610871565b50156103dd57604080516001600160a01b0393909316835260208301919091527fe9aa550fd75d0d28e07fa9dd67d3ae705678776f6c4a75abd09534f93e7d790791a180f35b606460405162461bcd60e51b815260206004820152601460248201527f4661696c656420746f2073656e642045746865720000000000000000000000006044820152fd5b346101495760206003193601126101495761043a610133565b6001600160a01b03610451816000541633146104cd565b8116156104635761046190610518565b005b608460405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b156104d457565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b600054906001600160a01b0380911691827fffffffffffffffffffffffff0000000000000000000000000000000000000000821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b919390926001543410610149576001600160a01b0390818416610652575b506000610621927f61a4ff3bb8bbf861e1aa28d574e4b88959510ac2ae1b845521bb8c13c33d566b966105f283946105e86105dc6105dc6002546001600160a01b031690565b6001600160a01b031690565b9083161415610754565b6105fe813b15156107c4565b61060a60015434610835565b602083519301915af161061b610871565b506108a1565b61064d600154604051938493846040919493926001600160a01b03606083019616825260208201520152565b0390a1565b90916106696105dc6002546001600160a01b031690565b90813b15610149576040517f9fc314c80000000000000000000000000000000000000000000000000000000081526001600160a01b038616600482015233602482015260448101879052916000908390606490829084905af1968715610748576105f26106219560009586957f61a4ff3bb8bbf861e1aa28d574e4b88959510ac2ae1b845521bb8c13c33d566b9b61072f575b5089828216158714610720576107149150848a6108fb565b94505096509250610596565b61072a918a6108fb565b610714565b8061073c610742926101a9565b80610268565b386106fc565b6040513d6000823e3d90fd5b1561075b57565b608460405162461bcd60e51b8152602060048201526024808201527f4f6e636861696e537761703a2063616c6c20746f206f6e636861696e2067617460448201527f65776179000000000000000000000000000000000000000000000000000000006064820152fd5b156107cb57565b608460405162461bcd60e51b815260206004820152602c60248201527f4f6e636861696e537761703a2063616c6c20666f722061206e6f6e2d636f6e7460448201527f72616374206163636f756e7400000000000000000000000000000000000000006064820152fd5b9190820391821161084257565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b3d1561089c573d906108828261021d565b9161089060405193846101fa565b82523d6000602084013e565b606090565b156108a857565b606460405162461bcd60e51b815260206004820152601960248201527f4f6e636861696e537761703a204661696c20746f2063616c6c000000000000006044820152fd5b90816020910312610149575190565b6040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038381166024830152939184169190602081604481865afa908115610748576000916109b9575b501061096057505050565b6109b26109b793604051907f095ea7b30000000000000000000000000000000000000000000000000000000060208301528416602482015260006044820152604481526109ac816101de565b82610bc2565b6109e7565b565b6109da915060203d81116109e0575b6109d281836101fa565b8101906108ec565b38610955565b503d6109c8565b6040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0383811660248301529291906020816044818588165afa90811561074857600091610b1b575b50610ab1576109b792604051927f095ea7b30000000000000000000000000000000000000000000000000000000060208501521660248301527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff604483015260448252610aac826101de565b610bc2565b608460405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152fd5b610b33915060203d81116109e0576109d281836101fa565b38610a40565b90816020910312610149575180151581036101495790565b15610b5857565b608460405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b6001600160a01b03169060405190610bd9826101c2565b6020928383527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656484840152803b15610c505760008281928287610c2b9796519301915af1610c25610871565b90610c94565b80519081610c3857505050565b826109b793610c4b938301019101610b39565b610b51565b6064846040519062461bcd60e51b82526004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b90919015610ca0575090565b815115610cb05750805190602001fd5b6040519062461bcd60e51b825281602080600483015282519283602484015260005b848110610cf557505050601f19601f836000604480968601015201168101030190fd5b818101830151868201604401528593508201610cd256fea2646970667358221220b869d4c5065d9d00110f6c4f32fa20354dbfc3f4bf92229eaebd4ed272ef630664736f6c63430008130033

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