S Price: $0.604099 (-0.36%)

Contract

0x1cEaeda3D17936916D0F3E866Aa5Ef861F544840

Overview

S Balance

Sonic LogoSonic LogoSonic Logo84 S

S Value

$50.74 (@ $0.60/S)
Transaction Hash
Method
Block
From
To
Onswap161280162025-03-26 16:28:351 hrs ago1743006515IN
0x1cEaeda3...61F544840
703 S0.0239371656.19
Onswap161117162025-03-26 14:57:242 hrs ago1743001044IN
0x1cEaeda3...61F544840
1 S0.0156671350.0001
Onswap159434052025-03-25 20:24:2121 hrs ago1742934261IN
0x1cEaeda3...61F544840
27.4 S0.0091487155.01
Onswap159239742025-03-25 18:28:3522 hrs ago1742927315IN
0x1cEaeda3...61F544840
1 S0.0281533455.01
Onswap158597052025-03-25 11:56:1129 hrs ago1742903771IN
0x1cEaeda3...61F544840
1 S0.0168035350.0001
Onswap158227012025-03-25 7:58:2233 hrs ago1742889502IN
0x1cEaeda3...61F544840
45 S0.0091487155.01
Onswap156432242025-03-24 12:08:572 days ago1742818137IN
0x1cEaeda3...61F544840
1 S0.0558342650.0001
Onswap156389482025-03-24 11:42:452 days ago1742816565IN
0x1cEaeda3...61F544840
54 S0.0091487155.01
Onswap156294832025-03-24 10:48:372 days ago1742813317IN
0x1cEaeda3...61F544840
1 S0.0164510350.0001
Onswap154157172025-03-23 11:50:293 days ago1742730629IN
0x1cEaeda3...61F544840
1 S0.0161240955.01
Onswap154099512025-03-23 11:14:223 days ago1742728462IN
0x1cEaeda3...61F544840
51 S0.0091487155.01
Onswap152251112025-03-22 12:53:444 days ago1742648024IN
0x1cEaeda3...61F544840
65 S0.009145955.01
Onswap150635652025-03-21 17:36:594 days ago1742578619IN
0x1cEaeda3...61F544840
1 S0.0140952250.0001
Onswap149944212025-03-21 9:20:105 days ago1742548810IN
0x1cEaeda3...61F544840
59 S0.0091487155.01
Onswap149116352025-03-20 21:54:595 days ago1742507699IN
0x1cEaeda3...61F544840
50 S0.0220064255.01
Onswap148028392025-03-20 9:11:006 days ago1742461860IN
0x1cEaeda3...61F544840
3,255 S0.0091500855.01
Onswap148019912025-03-20 9:04:496 days ago1742461489IN
0x1cEaeda3...61F544840
81.5 S0.0104775363
Onswap147191402025-03-19 22:36:106 days ago1742423770IN
0x1cEaeda3...61F544840
631 S0.0091500855.01
Onswap147186752025-03-19 22:32:426 days ago1742423562IN
0x1cEaeda3...61F544840
625 S0.0081578755.01
Onswap147184702025-03-19 22:31:046 days ago1742423464IN
0x1cEaeda3...61F544840
1,401 S0.0081578755.01
Onswap147181342025-03-19 22:28:276 days ago1742423307IN
0x1cEaeda3...61F544840
1,220 S0.0091500855.01
Onswap146982892025-03-19 20:13:276 days ago1742415207IN
0x1cEaeda3...61F544840
1 S0.0146974750.0001
Onswap146737612025-03-19 17:37:106 days ago1742405830IN
0x1cEaeda3...61F544840
1 S0.0153620350.0001
Onswap144414772025-03-18 13:23:588 days ago1742304238IN
0x1cEaeda3...61F544840
152 S0.0091487155.01
Onswap144001882025-03-18 8:24:248 days ago1742286264IN
0x1cEaeda3...61F544840
884.5 S0.0091500855.01
View all transactions

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To
161280162025-03-26 16:28:351 hrs ago1743006515
0x1cEaeda3...61F544840
702 S
159434052025-03-25 20:24:2121 hrs ago1742934261
0x1cEaeda3...61F544840
26.4 S
158227012025-03-25 7:58:2233 hrs ago1742889502
0x1cEaeda3...61F544840
44 S
156389482025-03-24 11:42:452 days ago1742816565
0x1cEaeda3...61F544840
53 S
154099512025-03-23 11:14:223 days ago1742728462
0x1cEaeda3...61F544840
50 S
152251112025-03-22 12:53:444 days ago1742648024
0x1cEaeda3...61F544840
64 S
149944212025-03-21 9:20:105 days ago1742548810
0x1cEaeda3...61F544840
58 S
149116352025-03-20 21:54:595 days ago1742507699
0x1cEaeda3...61F544840
49 S
148028392025-03-20 9:11:006 days ago1742461860
0x1cEaeda3...61F544840
3,254 S
148019912025-03-20 9:04:496 days ago1742461489
0x1cEaeda3...61F544840
80.5 S
147191402025-03-19 22:36:106 days ago1742423770
0x1cEaeda3...61F544840
630 S
147186752025-03-19 22:32:426 days ago1742423562
0x1cEaeda3...61F544840
624 S
147184702025-03-19 22:31:046 days ago1742423464
0x1cEaeda3...61F544840
1,400 S
147181342025-03-19 22:28:276 days ago1742423307
0x1cEaeda3...61F544840
1,219 S
144414772025-03-18 13:23:588 days ago1742304238
0x1cEaeda3...61F544840
151 S
144001882025-03-18 8:24:248 days ago1742286264
0x1cEaeda3...61F544840
883.5 S
143998622025-03-18 8:21:578 days ago1742286117
0x1cEaeda3...61F544840
745 S
143254472025-03-17 22:22:538 days ago1742250173
0x1cEaeda3...61F544840
1,230 S
142713062025-03-17 16:09:389 days ago1742227778
0x1cEaeda3...61F544840
827 S
142712392025-03-17 16:09:109 days ago1742227750
0x1cEaeda3...61F544840
336 S
142710942025-03-17 16:08:179 days ago1742227697
0x1cEaeda3...61F544840
995 S
142269112025-03-17 11:01:039 days ago1742209263
0x1cEaeda3...61F544840
740 S
140259052025-03-16 9:06:0810 days ago1742115968
0x1cEaeda3...61F544840
933 S
140255582025-03-16 9:03:3010 days ago1742115810
0x1cEaeda3...61F544840
2,496 S
138680412025-03-15 12:46:1711 days ago1742042777
0x1cEaeda3...61F544840
1,436.5 S
View All Internal 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
File 1 of 7 : OnchainSwapV3.sol
// 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);
        }
    }
}

File 2 of 7 : Ownable.sol
// 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);
    }
}

File 3 of 7 : IERC20.sol
// 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);
}

File 4 of 7 : SafeERC20.sol
// 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");
        }
    }
}

File 5 of 7 : Address.sol
// 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);
            }
        }
    }
}

File 6 of 7 : Context.sol
// 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

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.