ETH Price: $1,784.25 (+8.56%)
 

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Swap ETH293136572025-04-23 13:57:412 mins ago1745416661IN
0x7d6Dbe08...Fb9fAeCC7
0.0114 ETH0.000002810.0049047
Swap ETH293136052025-04-23 13:55:574 mins ago1745416557IN
0x7d6Dbe08...Fb9fAeCC7
0.022 ETH0.000002140.00590972
Swap ETH293135282025-04-23 13:53:237 mins ago1745416403IN
0x7d6Dbe08...Fb9fAeCC7
0.006 ETH0.000004110.00583651
Swap ETH293134812025-04-23 13:51:498 mins ago1745416309IN
0x7d6Dbe08...Fb9fAeCC7
0.008 ETH0.000003210.0055699
Swap ETH293134612025-04-23 13:51:099 mins ago1745416269IN
0x7d6Dbe08...Fb9fAeCC7
0.01128752 ETH0.000004680.00657719
Swap ETH293134272025-04-23 13:50:0110 mins ago1745416201IN
0x7d6Dbe08...Fb9fAeCC7
0.006 ETH0.000002940.00561409
Swap ETH293132352025-04-23 13:43:3716 mins ago1745415817IN
0x7d6Dbe08...Fb9fAeCC7
0.00577162 ETH0.000001260.00599686
Swap ETH293093962025-04-23 11:35:392 hrs ago1745408139IN
0x7d6Dbe08...Fb9fAeCC7
0.02467016 ETH0.000001420.00246479
Swap ETH293092702025-04-23 11:31:272 hrs ago1745407887IN
0x7d6Dbe08...Fb9fAeCC7
0.82 ETH0.000004490.0020716
Swap ETH293054442025-04-23 9:23:554 hrs ago1745400235IN
0x7d6Dbe08...Fb9fAeCC7
0.00095302 ETH0.000001250.00201054
Swap ETH293039152025-04-23 8:32:575 hrs ago1745397177IN
0x7d6Dbe08...Fb9fAeCC7
0.00057821 ETH0.000001150.00191167
Swap ETH293038022025-04-23 8:29:115 hrs ago1745396951IN
0x7d6Dbe08...Fb9fAeCC7
0.00045863 ETH0.00000090.00190576
Swap ETH293010032025-04-23 6:55:537 hrs ago1745391353IN
0x7d6Dbe08...Fb9fAeCC7
0.003 ETH0.000001180.00234252
Swap ETH292974992025-04-23 4:59:059 hrs ago1745384345IN
0x7d6Dbe08...Fb9fAeCC7
1.08 ETH0.000000570.00194773
Swap ETH292914272025-04-23 1:36:4112 hrs ago1745372201IN
0x7d6Dbe08...Fb9fAeCC7
0.00005 ETH0.000005420.00770282
Swap ETH292914112025-04-23 1:36:0912 hrs ago1745372169IN
0x7d6Dbe08...Fb9fAeCC7
0.00005 ETH0.000005350.00768528
Swap ETH292913962025-04-23 1:35:3912 hrs ago1745372139IN
0x7d6Dbe08...Fb9fAeCC7
0.00005 ETH0.000003560.00768598
Swap ETH292913802025-04-23 1:35:0712 hrs ago1745372107IN
0x7d6Dbe08...Fb9fAeCC7
0.00005 ETH0.000004030.00768077
Swap ETH292913642025-04-23 1:34:3512 hrs ago1745372075IN
0x7d6Dbe08...Fb9fAeCC7
0.00005 ETH0.000003960.0076775
Swap ETH292913482025-04-23 1:34:0312 hrs ago1745372043IN
0x7d6Dbe08...Fb9fAeCC7
0.00005 ETH0.000004040.00769063
Swap ETH292913322025-04-23 1:33:3112 hrs ago1745372011IN
0x7d6Dbe08...Fb9fAeCC7
0.00005 ETH0.000003070.00770068
Swap ETH292913002025-04-23 1:32:2712 hrs ago1745371947IN
0x7d6Dbe08...Fb9fAeCC7
0.00005 ETH0.000002130.00771633
Swap ETH292912842025-04-23 1:31:5512 hrs ago1745371915IN
0x7d6Dbe08...Fb9fAeCC7
0.00005 ETH0.000002670.00772614
Swap ETH292912692025-04-23 1:31:2512 hrs ago1745371885IN
0x7d6Dbe08...Fb9fAeCC7
0.00005 ETH0.000005460.00773538
Swap ETH292912532025-04-23 1:30:5312 hrs ago1745371853IN
0x7d6Dbe08...Fb9fAeCC7
0.00005 ETH0.00000580.00774638
View all transactions

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To
293136572025-04-23 13:57:412 mins ago1745416661
0x7d6Dbe08...Fb9fAeCC7
0.011343 ETH
293136572025-04-23 13:57:412 mins ago1745416661
0x7d6Dbe08...Fb9fAeCC7
0.000057 ETH
293136052025-04-23 13:55:574 mins ago1745416557
0x7d6Dbe08...Fb9fAeCC7
0.02189 ETH
293136052025-04-23 13:55:574 mins ago1745416557
0x7d6Dbe08...Fb9fAeCC7
0.00011 ETH
293135282025-04-23 13:53:237 mins ago1745416403
0x7d6Dbe08...Fb9fAeCC7
0.00597 ETH
293135282025-04-23 13:53:237 mins ago1745416403
0x7d6Dbe08...Fb9fAeCC7
0.00003 ETH
293135042025-04-23 13:52:357 mins ago1745416355
0x7d6Dbe08...Fb9fAeCC7
0.00775896 ETH
293135042025-04-23 13:52:357 mins ago1745416355
0x7d6Dbe08...Fb9fAeCC7
0.00775896 ETH
293134812025-04-23 13:51:498 mins ago1745416309
0x7d6Dbe08...Fb9fAeCC7
0.00796 ETH
293134812025-04-23 13:51:498 mins ago1745416309
0x7d6Dbe08...Fb9fAeCC7
0.00004 ETH
293134612025-04-23 13:51:099 mins ago1745416269
0x7d6Dbe08...Fb9fAeCC7
0.01123108 ETH
293134612025-04-23 13:51:099 mins ago1745416269
0x7d6Dbe08...Fb9fAeCC7
0.00005643 ETH
293134452025-04-23 13:50:379 mins ago1745416237
0x7d6Dbe08...Fb9fAeCC7
0.00596783 ETH
293134452025-04-23 13:50:379 mins ago1745416237
0x7d6Dbe08...Fb9fAeCC7
0.00596783 ETH
293134272025-04-23 13:50:0110 mins ago1745416201
0x7d6Dbe08...Fb9fAeCC7
0.00597 ETH
293134272025-04-23 13:50:0110 mins ago1745416201
0x7d6Dbe08...Fb9fAeCC7
0.00003 ETH
293132612025-04-23 13:44:2915 mins ago1745415869
0x7d6Dbe08...Fb9fAeCC7
0.00569662 ETH
293132612025-04-23 13:44:2915 mins ago1745415869
0x7d6Dbe08...Fb9fAeCC7
0.00569662 ETH
293132352025-04-23 13:43:3716 mins ago1745415817
0x7d6Dbe08...Fb9fAeCC7
0.00574276 ETH
293132352025-04-23 13:43:3716 mins ago1745415817
0x7d6Dbe08...Fb9fAeCC7
0.00002885 ETH
293094272025-04-23 11:36:412 hrs ago1745408201
0x7d6Dbe08...Fb9fAeCC7
0.02450384 ETH
293094272025-04-23 11:36:412 hrs ago1745408201
0x7d6Dbe08...Fb9fAeCC7
0.02450384 ETH
293093962025-04-23 11:35:392 hrs ago1745408139
0x7d6Dbe08...Fb9fAeCC7
0.02454681 ETH
293093962025-04-23 11:35:392 hrs ago1745408139
0x7d6Dbe08...Fb9fAeCC7
0.00012335 ETH
293092702025-04-23 11:31:272 hrs ago1745407887
0x7d6Dbe08...Fb9fAeCC7
0.8159 ETH
View All Internal Transactions

Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x71D72534...657F6Ef84
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
MetaAggregatorSwapContract

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 125 runs

Other Settings:
london EvmVersion, Unlicense license
File 1 of 4 : MetaAggregatorSwapContract.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.17;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IMetaAggregatorSwapContract} from "./interfaces/IMetaAggregatorSwapContract.sol";
import {TransferHelper} from "./libraries/TransferHelper.sol";

/**
 * @title MetaAggregatorSwapContract
 * @dev Facilitates swapping between ETH and ERC20 tokens or between two ERC20 tokens using an aggregator.
 */
contract MetaAggregatorSwapContract is IMetaAggregatorSwapContract {
    address constant nativeToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; // Represent native ETH token
    address immutable usdt; // Address of USDT token
    address immutable SWAP_TARGET; // Address of the swap target for delegatecall operations
    address immutable _this; // Address of this contract instance
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;
    uint256 private _status;

    // Custom error messages for efficient error handling
    error CannotSwapTokens();
    error AmountInMustBeGreaterThanZero();
    error MinAmountOutMustBeGreaterThanZero();
    error TokenInAndTokenOutCannotBeSame();
    error IncorrectEtherAmountSent();
    error CannotSwapETHToETH();
    error InvalidReceiver();
    error InvalidENSOAddress();
    error InvalidUSDTAddress();
    error InsufficientOutputBalance();
    error InsufficientETHOutAmount();
    error InsufficientTokenOutAmount();
    error SwapFailed();
    error CannotSwapETH();
    error FeeTransferFailed();

    //   Event emitted when Tokens are swapped
    event TokenSwapped(
        address indexed sender,
        address indexed tokenIn,
        address receiver,
        address tokenOut,
        address feeReceiver,
        address aggregator,
        uint256 indexed amountIn,
        uint256 amountOut,
        uint256 minAmountOut,
        uint256 fee,
        bool isDelegate
    );

    /**
     * @dev Initializes the contract with the swap target and USDT addresses.
     * @param _ensoSwapContract The address of the swap target contract.
     * @param _usdt The address of the USDT token.
     */
    constructor(address _ensoSwapContract, address _usdt) {
        if (_ensoSwapContract == address(0)) revert InvalidENSOAddress();
        if (_usdt == address(0)) revert InvalidUSDTAddress();
        SWAP_TARGET = _ensoSwapContract;
        usdt = _usdt;
        _this = address(this);
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    /**
     * @dev only checks for re-entrancy when the call is not delegate.
     */
    function _nonReentrantBefore() private {
        if (address(this) == _this) {
            // On the first call to nonReentrant, _status will be _NOT_ENTERED
            require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

            // Any calls to nonReentrant after this point will fail
            _status = _ENTERED;
        }
    }

    /**
     * @dev only checks for re-entrancy when the call is not delegate.
     */
    function _nonReentrantAfter() private {
        if (address(this) == _this) {
            // By storing the original value once again, a refund is triggered (see
            // https://eips.ethereum.org/EIPS/eip-2200)
            _status = _NOT_ENTERED;
        }
    }

    /**
     * @dev Swaps ETH for an ERC20 token.
     * @param params SwapETHParams
     */
    function swapETH(
        SwapETHParams calldata params
    ) external payable nonReentrant {
        if (address(params.tokenIn) != nativeToken) {
            revert CannotSwapTokens();
        }
        (uint256 amountOut, uint256 fee) = _swapETH(params);
        emit TokenSwapped(
            address(params.sender),
            address(params.tokenIn),
            address(params.receiver),
            address(params.tokenOut),
            params.feeRecipient,
            params.aggregator,
            params.amountIn,
            amountOut,
            params.minAmountOut,
            fee,
            params.isDelegate
        );
    }

    /**
     * @dev Swaps one ERC20 token for another ERC20 token or native ETH.
     * @param params SwapERC20Params
     */
    function swapERC20(SwapERC20Params calldata params) external nonReentrant {
        (uint256 amountOut, uint256 fee) = _swapERC20(params);
        emit TokenSwapped(
            address(params.sender),
            address(params.tokenIn),
            address(params.receiver),
            address(params.tokenOut),
            params.feeRecipient,
            params.aggregator,
            params.amountIn,
            amountOut,
            params.minAmountOut,
            fee,
            params.isDelegate
        );
    }

    /**
     * @dev Internal function to perform the swap from ETH to ERC20.
     * @param params SwapETHParams
     */
    function _swapETH(
        SwapETHParams memory params
    ) internal returns (uint256, uint256) {
        IERC20 tokenOut = params.tokenOut;
        uint256 amountIn = params.amountIn;
        uint256 minAmountOut = params.minAmountOut;
        address receiver = params.receiver;
        address feeRecipient = params.feeRecipient;
        uint256 feeBps = params.feeBps;
        _validateInputs(
            params.tokenIn,
            address(tokenOut),
            amountIn,
            minAmountOut,
            receiver
        );

        if (msg.value < amountIn) revert IncorrectEtherAmountSent();
        uint256 fee;
        if (feeRecipient != address(0) || feeBps != 0) {
            fee = (amountIn * feeBps) / 10000;
            amountIn -= fee;
            (bool success, ) = payable(feeRecipient).call{value: fee}("");
            if (!success) revert FeeTransferFailed();
        }

        uint256 balanceBefore = tokenOut.balanceOf(address(this));
        _executeAggregatorCall(
            params.swapData,
            params.isDelegate,
            params.aggregator,
            amountIn
        );
        uint256 amountOut = tokenOut.balanceOf(address(this)) - balanceBefore;

        if (amountOut < minAmountOut) revert InsufficientOutputBalance();
        if (receiver != address(this)) {
            TransferHelper.safeTransfer(address(tokenOut), receiver, amountOut);
        }
        return (amountOut, fee);
    }

    /**
     * @dev Internal function to swap ERC20 tokens or ERC20 to native ETH.
     * @param params SwapERC20Params
     */
    function _swapERC20(
        SwapERC20Params memory params
    ) internal returns (uint256, uint256) {
        IERC20 tokenIn = params.tokenIn;
        IERC20 tokenOut = params.tokenOut;
        address aggregator = params.aggregator;
        address receiver = params.receiver;
        address feeRecipient = params.feeRecipient;
        uint256 amountIn = params.amountIn;
        uint256 minAmountOut = params.minAmountOut;
        uint256 feeBps = params.feeBps;
        bytes memory swapData = params.swapData;
        bool isDelegate = params.isDelegate;
        _validateInputs(
            address(tokenIn),
            address(tokenOut),
            amountIn,
            minAmountOut,
            receiver
        );

        if (!isDelegate) {
            if (address(tokenIn) == usdt)
                TransferHelper.safeApprove(address(tokenIn), aggregator, 0);
            TransferHelper.safeApprove(address(tokenIn), aggregator, amountIn);
        }
        uint256 fee;
        if (feeRecipient != address(0) || feeBps != 0) {
            fee = (amountIn * feeBps) / 10000;
            amountIn -= fee;
            TransferHelper.safeTransfer(address(tokenIn), feeRecipient, fee);
        }

        uint256 amountOut;
        if (address(tokenOut) == nativeToken) {
            uint256 balanceBefore = address(this).balance;
            _executeAggregatorCall(swapData, isDelegate, aggregator, 0);
            amountOut = address(this).balance - balanceBefore;
            if (amountOut < minAmountOut) revert InsufficientETHOutAmount();
            if (receiver != address(this)) {
                (bool success, ) = receiver.call{value: amountOut}("");
                if (!success) revert SwapFailed();
            }
        } else {
            uint256 balanceBefore = tokenOut.balanceOf(address(this));
            _executeAggregatorCall(swapData, isDelegate, aggregator, 0);
            amountOut = tokenOut.balanceOf(address(this)) - balanceBefore;
            if (amountOut < minAmountOut) revert InsufficientTokenOutAmount();

            if (receiver != address(this)) {
                TransferHelper.safeTransfer(
                    address(tokenOut),
                    receiver,
                    amountOut
                );
            }
        }

        return (amountOut, fee);
    }

    /**
     * @dev Executes a swap call via the aggregator or delegatecall context.
     * @param swapData The data required for the swap.
     * @param isDelegate Indicates if the swap is in a delegatecall context.
     * @param aggregator The address of the aggregator to use for the swap.
     * @param value The amount of ETH to send with the call (if applicable).
     */
    function _executeAggregatorCall(
        bytes memory swapData,
        bool isDelegate,
        address aggregator,
        uint256 value
    ) internal {
        (bool success, bytes memory returnData) = isDelegate
            ? SWAP_TARGET.delegatecall(swapData)
            : aggregator.call{value: value}(swapData);

        if (!success) {
            assembly {
                let size := mload(returnData)
                revert(add(32, returnData), size)
            }
        }
    }

    /**
     * @dev Validates the swap inputs for consistency and correctness.
     * @param tokenIn address of tokenIn
     * @param tokenOut address of tokenIn
     * @param amountIn The amount of tokenIn to swap.
     * @param minAmountOut The minimum amount of tokenOut expected.
     * @param receiver The address to receive the tokenOut.
     */
    function _validateInputs(
        address tokenIn,
        address tokenOut,
        uint256 amountIn,
        uint256 minAmountOut,
        address receiver
    ) internal pure {
        if (receiver == address(0)) revert InvalidReceiver();
        if (amountIn == 0) revert AmountInMustBeGreaterThanZero();
        if (minAmountOut == 0) revert MinAmountOutMustBeGreaterThanZero();
        if (tokenIn == tokenOut) revert TokenInAndTokenOutCannotBeSame();
    }

    /**
     * @dev Allows the contract to receive ETH.
     */
    receive() external payable {}
}

File 2 of 4 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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);

    /**
     * @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 `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, 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 `from` to `to` 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 from,
        address to,
        uint256 amount
    ) external returns (bool);
}

File 3 of 4 : IMetaAggregatorSwapContract.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.17;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface IMetaAggregatorSwapContract {
    // Struct to hold parameters for swap functions
    struct SwapETHParams {
        address tokenIn; // Address of the input token (must be the native token for swapETH)
        IERC20 tokenOut; // ERC20 token to swap to
        address aggregator; // Address of the aggregator to use for the swap
        address sender; // Address of the sender initiating the swap
        address receiver; // Address to receive the tokenOut
        address feeRecipient; // Address to receive the fee
        uint256 amountIn; // Amount of tokenIn to swap
        uint256 minAmountOut; // Minimum amount of tokenOut expected
        uint256 feeBps; // Fee basis points sent from amountIn
        bytes swapData; //  data required for the swap call
        bool isDelegate; // Indicates if the swap is being executed by a delegate
    }

    struct SwapERC20Params {
        IERC20 tokenIn; // The ERC20 token being swapped from
        IERC20 tokenOut; // The ERC20 token being swapped to
        address aggregator; // The address of the aggregator to facilitate the swap
        address sender; // The address of the sender initiating the swap
        address receiver; // The address that will receive the tokenOut
        address feeRecipient; // The address that will receive the fee from the swap
        uint256 amountIn; // The amount of tokenIn to swap
        uint256 minAmountOut; // The minimum amount of tokenOut expected from the swap
        uint256 feeBps; // The fee in basis points (1/100th of a percent) taken from amountIn
        bytes swapData; //  data required for the swap
        bool isDelegate; // Indicates if the swap is being executed by a delegate
    }

    function swapERC20(SwapERC20Params calldata params) external;

    function swapETH(SwapETHParams calldata params) external payable;
}

File 4 of 4 : TransferHelper.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.0;

// Helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
    // Custom errors
    error ApprovalFailed(address token, address to, uint256 value);
    error TransferFailed(address token, address to, uint256 value);
    error TransferFromFailed(address token, address from, address to, uint256 value);
    error ETHTransferFailed(address to, uint256 value);

    /**
     * @dev Safely approves a token for spending.
     * @param token The address of the token contract.
     * @param to The address to approve.
     * @param value The amount to approve.
     */
    function safeApprove(
        address token,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes('approve(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
        if (!success || (data.length != 0 && !abi.decode(data, (bool)))) {
            revert ApprovalFailed(token, to, value);
        }
    }

    /**
     * @dev Safely transfers tokens.
     * @param token The address of the token contract.
     * @param to The address to transfer to.
     * @param value The amount to transfer.
     */
    function safeTransfer(
        address token,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes('transfer(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
        if (!success || (data.length != 0 && !abi.decode(data, (bool)))) {
            revert TransferFailed(token, to, value);
        }
    }

    /**
     * @dev Safely transfers tokens from one address to another.
     * @param token The address of the token contract.
     * @param from The address to transfer from.
     * @param to The address to transfer to.
     * @param value The amount to transfer.
     */
    function safeTransferFrom(
        address token,
        address from,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
        if (!success || (data.length != 0 && !abi.decode(data, (bool)))) {
            revert TransferFromFailed(token, from, to, value);
        }
    }
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_ensoSwapContract","type":"address"},{"internalType":"address","name":"_usdt","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AmountInMustBeGreaterThanZero","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"ApprovalFailed","type":"error"},{"inputs":[],"name":"CannotSwapETH","type":"error"},{"inputs":[],"name":"CannotSwapETHToETH","type":"error"},{"inputs":[],"name":"CannotSwapTokens","type":"error"},{"inputs":[],"name":"FeeTransferFailed","type":"error"},{"inputs":[],"name":"IncorrectEtherAmountSent","type":"error"},{"inputs":[],"name":"InsufficientETHOutAmount","type":"error"},{"inputs":[],"name":"InsufficientOutputBalance","type":"error"},{"inputs":[],"name":"InsufficientTokenOutAmount","type":"error"},{"inputs":[],"name":"InvalidENSOAddress","type":"error"},{"inputs":[],"name":"InvalidReceiver","type":"error"},{"inputs":[],"name":"InvalidUSDTAddress","type":"error"},{"inputs":[],"name":"MinAmountOutMustBeGreaterThanZero","type":"error"},{"inputs":[],"name":"SwapFailed","type":"error"},{"inputs":[],"name":"TokenInAndTokenOutCannotBeSame","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"TransferFailed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"tokenIn","type":"address"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"address","name":"tokenOut","type":"address"},{"indexed":false,"internalType":"address","name":"feeReceiver","type":"address"},{"indexed":false,"internalType":"address","name":"aggregator","type":"address"},{"indexed":true,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountOut","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isDelegate","type":"bool"}],"name":"TokenSwapped","type":"event"},{"inputs":[{"components":[{"internalType":"contract IERC20","name":"tokenIn","type":"address"},{"internalType":"contract IERC20","name":"tokenOut","type":"address"},{"internalType":"address","name":"aggregator","type":"address"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"feeRecipient","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"uint256","name":"feeBps","type":"uint256"},{"internalType":"bytes","name":"swapData","type":"bytes"},{"internalType":"bool","name":"isDelegate","type":"bool"}],"internalType":"struct IMetaAggregatorSwapContract.SwapERC20Params","name":"params","type":"tuple"}],"name":"swapERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"contract IERC20","name":"tokenOut","type":"address"},{"internalType":"address","name":"aggregator","type":"address"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"feeRecipient","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"uint256","name":"feeBps","type":"uint256"},{"internalType":"bytes","name":"swapData","type":"bytes"},{"internalType":"bool","name":"isDelegate","type":"bool"}],"internalType":"struct IMetaAggregatorSwapContract.SwapETHParams","name":"params","type":"tuple"}],"name":"swapETH","outputs":[],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}]

Deployed Bytecode

0x60806040526004361061002d5760003560e01c80638b20aa4914610039578063ff3e8af61461004e57600080fd5b3661003457005b600080fd5b61004c610047366004610c11565b61006e565b005b34801561005a57600080fd5b5061004c610069366004610c11565b6101e7565b610076610203565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6100986020830183610c73565b6001600160a01b0316146100bf57604051631e7afc4d60e21b815260040160405180910390fd5b6000806100d36100ce84610d7d565b610292565b909250905060c08301356100ea6020850185610c73565b6001600160a01b03166101036080860160608701610c73565b6001600160a01b03167fc9f46f6e3da5b231f7e649ca4cb1e66b8927b0efe47be9a1284a41492faf186061013d60a0880160808901610c73565b61014d6040890160208a01610c73565b61015d60c08a0160a08b01610c73565b61016d60608b0160408c01610c73565b898b60e001358a8d6101400160208101906101889190610e5e565b604080516001600160a01b03998a168152978916602089015295881695870195909552959092166060850152608084015260a083015260c082019290925290151560e08201526101000160405180910390a450506101e46104f5565b50565b6101ef610203565b6000806100d36101fe84610d7d565b61052c565b6001600160a01b037f0000000000000000000000007d6dbe08f610ca1ade4fea11e5d40d0fb9faecc71630036102905760026000540361028a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b60026000555b565b602081015160c082015160e0830151608084015160a085015161010086015186516000968796909590949093909290916102cf9087878787610851565b843410156102f05760405163181476e960e11b815260040160405180910390fd5b60006001600160a01b03831615158061030857508115155b156103a85761271061031a8388610e91565b6103249190610eae565b90506103308187610ed0565b95506000836001600160a01b03168260405160006040518083038185875af1925050503d806000811461037f576040519150601f19603f3d011682016040523d82523d6000602084013e610384565b606091505b50509050806103a657604051634033e4e360e01b815260040160405180910390fd5b505b6040516370a0823160e01b81523060048201526000906001600160a01b038916906370a0823190602401602060405180830381865afa1580156103ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104139190610ee3565b905061042f8b61012001518c61014001518d604001518a6108f3565b6040516370a0823160e01b815230600482015260009082906001600160a01b038b16906370a0823190602401602060405180830381865afa158015610478573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061049c9190610ee3565b6104a69190610ed0565b9050868110156104c9576040516321a1cf6160e01b815260040160405180910390fd5b6001600160a01b03861630146104e4576104e48987836109f0565b9b919a509098505050505050505050565b6001600160a01b037f0000000000000000000000007d6dbe08f610ca1ade4fea11e5d40d0fb9faecc7163003610290576001600055565b805160208201516040830151608084015160a085015160c086015160e08701516101008801516101208901516101408a01516000998a99909890979096909590949093909290916105808a8a87878b610851565b806105d5577f000000000000000000000000fde4c96c8593536e31f229ea8f37b2ada2699bb26001600160a01b03168a6001600160a01b0316036105ca576105ca8a896000610af4565b6105d58a8987610af4565b60006001600160a01b0387161515806105ed57508315155b15610622576127106105ff8588610e91565b6106099190610eae565b90506106158187610ed0565b95506106228b88836109f0565b600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b038c1601610710574761065785858d60006108f3565b6106618147610ed0565b91508682101561068457604051632c128a3960e21b815260040160405180910390fd5b6001600160a01b038a16301461070a5760008a6001600160a01b03168360405160006040518083038185875af1925050503d80600081146106e1576040519150601f19603f3d011682016040523d82523d6000602084013e6106e6565b606091505b50509050806107085760405163081ceff360e41b815260040160405180910390fd5b505b5061083e565b6040516370a0823160e01b81523060048201526000906001600160a01b038d16906370a0823190602401602060405180830381865afa158015610757573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061077b9190610ee3565b905061078a85858d60006108f3565b6040516370a0823160e01b815230600482015281906001600160a01b038e16906370a0823190602401602060405180830381865afa1580156107d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f49190610ee3565b6107fe9190610ed0565b91508682101561082157604051631be4c5c560e21b815260040160405180910390fd5b6001600160a01b038a16301461083c5761083c8c8b846109f0565b505b9e909d509b505050505050505050505050565b6001600160a01b03811661087857604051631e4ec46b60e01b815260040160405180910390fd5b82600003610899576040516349188f7b60e01b815260040160405180910390fd5b816000036108ba5760405163cf3dc46160e01b815260040160405180910390fd5b836001600160a01b0316856001600160a01b0316036108ec5760405163708beb6d60e11b815260040160405180910390fd5b5050505050565b6000808461095c57836001600160a01b031683876040516109149190610efc565b60006040518083038185875af1925050503d8060008114610951576040519150601f19603f3d011682016040523d82523d6000602084013e610956565b606091505b506109d6565b7f00000000000000000000000038147794ff247e5fc179edbae6c37fff88f68c526001600160a01b0316866040516109949190610efc565b600060405180830381855af49150503d80600081146109cf576040519150601f19603f3d011682016040523d82523d6000602084013e6109d4565b606091505b505b91509150816109e85780518082602001fd5b505050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1790529151600092839290871691610a4c9190610efc565b6000604051808303816000865af19150503d8060008114610a89576040519150601f19603f3d011682016040523d82523d6000602084013e610a8e565b606091505b5091509150811580610abc5750805115801590610abc575080806020019051810190610aba9190610f2b565b155b156108ec576040516317e3057d60e31b81526001600160a01b0380871660048301528516602482015260448101849052606401610281565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663095ea7b360e01b1790529151600092839290871691610b509190610efc565b6000604051808303816000865af19150503d8060008114610b8d576040519150601f19603f3d011682016040523d82523d6000602084013e610b92565b606091505b5091509150811580610bc05750805115801590610bc0575080806020019051810190610bbe9190610f2b565b155b156108ec57604051632d28f16360e21b81526001600160a01b0380871660048301528516602482015260448101849052606401610281565b60006101608284031215610c0b57600080fd5b50919050565b600060208284031215610c2357600080fd5b813567ffffffffffffffff811115610c3a57600080fd5b610c4684828501610bf8565b949350505050565b6001600160a01b03811681146101e457600080fd5b8035610c6e81610c4e565b919050565b600060208284031215610c8557600080fd5b8135610c9081610c4e565b9392505050565b634e487b7160e01b600052604160045260246000fd5b604051610160810167ffffffffffffffff81118282101715610cd157610cd1610c97565b60405290565b600082601f830112610ce857600080fd5b813567ffffffffffffffff80821115610d0357610d03610c97565b604051601f8301601f19908116603f01168101908282118183101715610d2b57610d2b610c97565b81604052838152866020858801011115610d4457600080fd5b836020870160208301376000602085830101528094505050505092915050565b80151581146101e457600080fd5b8035610c6e81610d64565b60006101608236031215610d9057600080fd5b610d98610cad565b610da183610c63565b8152610daf60208401610c63565b6020820152610dc060408401610c63565b6040820152610dd160608401610c63565b6060820152610de260808401610c63565b6080820152610df360a08401610c63565b60a082015260c083013560c082015260e083013560e08201526101008084013581830152506101208084013567ffffffffffffffff811115610e3457600080fd5b610e4036828701610cd7565b828401525050610140610e54818501610d72565b9082015292915050565b600060208284031215610e7057600080fd5b8135610c9081610d64565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610ea857610ea8610e7b565b92915050565b600082610ecb57634e487b7160e01b600052601260045260246000fd5b500490565b81810381811115610ea857610ea8610e7b565b600060208284031215610ef557600080fd5b5051919050565b6000825160005b81811015610f1d5760208186018101518583015201610f03565b506000920191825250919050565b600060208284031215610f3d57600080fd5b8151610c9081610d6456fea2646970667358221220fae227b04531720258676171fae36cd7065d453c5241631e0198b582176c866064736f6c63430008110033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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.