Sepolia Testnet

Contract

0x810B4be53B72C912b475404dea93d29f3441cd34

Overview

ETH Balance

0 ETH

Token Holdings

Multichain Info

N/A
Transaction Hash
Method
Block
From
To

There are no matching entries

1 Internal Transaction and > 10 Token Transfers found.

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block
From
To
70560642024-11-11 15:01:0096 days ago1731337260  Contract Creation0 ETH
Loading...
Loading

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

Contract Name:
SwapperMock

Compiler Version
v0.8.23+commit.f704f362

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 4 : SwapperMock.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.23;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {ISwapper} from "../interfaces/external/ISwapper.sol";
import {IMasterOracle} from "../interfaces/external/IMasterOracle.sol";

contract SwapperMock is ISwapper {
    uint256 slippage;
    IMasterOracle masterOracle;

    constructor(IMasterOracle masterOracle_) {
        masterOracle = masterOracle_;
    }

    function swapExactInput(
        address tokenIn_,
        address tokenOut_,
        uint256 amountIn_,
        uint256 amountOutMin_,
        address receiver_
    ) external payable returns (uint256 _amountOut) {
        require(
            IERC20(tokenIn_).allowance(msg.sender, address(this)) >= amountIn_,
            "SwapperMock: Not enough tokenIn approved"
        );
        IERC20(tokenIn_).transferFrom(msg.sender, address(this), amountIn_);
        _amountOut = (masterOracle.quote(tokenIn_, tokenOut_, amountIn_) * (1e18 - slippage)) / 1e18;
        require(_amountOut >= amountOutMin_, "SwapperMock: Slippage too high");
        require(IERC20(tokenOut_).balanceOf(address(this)) >= _amountOut, "SwapperMock: Not enough tokenOut balance");
        IERC20(tokenOut_).transfer(receiver_, _amountOut);
    }

    function updateSlippage(uint256 slippage_) external {
        slippage = slippage_;
    }

    function getAmountInUsingOracle(
        address tokenIn_,
        address tokenOut_,
        uint256 amountOut_
    ) external override returns (uint256 _amountIn) {}

    function getAmountIn(
        address tokenIn_,
        address tokenOut_,
        uint256 amountOut_
    ) external override returns (uint256 _amountIn) {}

    function getAmountOutUsingOracle(
        address tokenIn_,
        address tokenOut_,
        uint256 amountIn_
    ) external override returns (uint256 _amountOut) {}

    function swapExactOutput(
        address tokenIn_,
        address tokenOut_,
        uint256 amountOut_,
        uint256 amountInMax_,
        address receiver_
    ) external override returns (uint256 _amountIn) {}
}

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

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-20 standard as defined in the ERC.
 */
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 value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the value of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` 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 value) external returns (bool);
}

File 3 of 4 : IMasterOracle.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.23;

interface IMasterOracle {
    function quoteTokenToUsd(address _asset, uint256 _amount) external view returns (uint256 _amountInUsd);

    function quoteUsdToToken(address _asset, uint256 _amountInUsd) external view returns (uint256 _amount);

    function quote(address _assetIn, address _assetOut, uint256 _amountIn) external view returns (uint256 _amountOut);

    function getPriceInUsd(address token_) external view returns (uint256 _princeInUsd);
}

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

pragma solidity 0.8.23;

interface ISwapper {
    function getAmountInUsingOracle(
        address tokenIn_,
        address tokenOut_,
        uint256 amountOut_
    ) external returns (uint256 _amountIn);

    function getAmountIn(address tokenIn_, address tokenOut_, uint256 amountOut_) external returns (uint256 _amountIn);

    function getAmountOutUsingOracle(
        address tokenIn_,
        address tokenOut_,
        uint256 amountIn_
    ) external returns (uint256 _amountOut);

    function swapExactInput(
        address tokenIn_,
        address tokenOut_,
        uint256 amountIn_,
        uint256 amountOutMin_,
        address receiver_
    ) external payable returns (uint256 _amountOut);

    function swapExactOutput(
        address tokenIn_,
        address tokenOut_,
        uint256 amountOut_,
        uint256 amountInMax_,
        address receiver_
    ) external returns (uint256 _amountIn);
}

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

Contract ABI

[{"inputs":[{"internalType":"contract IMasterOracle","name":"masterOracle_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"tokenIn_","type":"address"},{"internalType":"address","name":"tokenOut_","type":"address"},{"internalType":"uint256","name":"amountOut_","type":"uint256"}],"name":"getAmountIn","outputs":[{"internalType":"uint256","name":"_amountIn","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn_","type":"address"},{"internalType":"address","name":"tokenOut_","type":"address"},{"internalType":"uint256","name":"amountOut_","type":"uint256"}],"name":"getAmountInUsingOracle","outputs":[{"internalType":"uint256","name":"_amountIn","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn_","type":"address"},{"internalType":"address","name":"tokenOut_","type":"address"},{"internalType":"uint256","name":"amountIn_","type":"uint256"}],"name":"getAmountOutUsingOracle","outputs":[{"internalType":"uint256","name":"_amountOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn_","type":"address"},{"internalType":"address","name":"tokenOut_","type":"address"},{"internalType":"uint256","name":"amountIn_","type":"uint256"},{"internalType":"uint256","name":"amountOutMin_","type":"uint256"},{"internalType":"address","name":"receiver_","type":"address"}],"name":"swapExactInput","outputs":[{"internalType":"uint256","name":"_amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn_","type":"address"},{"internalType":"address","name":"tokenOut_","type":"address"},{"internalType":"uint256","name":"amountOut_","type":"uint256"},{"internalType":"uint256","name":"amountInMax_","type":"uint256"},{"internalType":"address","name":"receiver_","type":"address"}],"name":"swapExactOutput","outputs":[{"internalType":"uint256","name":"_amountIn","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"slippage_","type":"uint256"}],"name":"updateSlippage","outputs":[],"stateMutability":"nonpayable","type":"function"}]

Deployed Bytecode

0x6080604052600436106100555760003560e01c806315b0d4961461005a57806353b609b51461007c5780636ccb2b01146100b257806381cc619b146100c5578063a1afb7c51461007c578063e39f63a41461007c575b600080fd5b34801561006657600080fd5b5061007a610075366004610482565b600055565b005b34801561008857600080fd5b506100a06100973660046104b7565b60009392505050565b60405190815260200160405180910390f35b6100a06100c03660046104f3565b6100eb565b3480156100d157600080fd5b506100a06100e03660046104f3565b600095945050505050565b604051636eb1769f60e11b815233600482015230602482015260009084906001600160a01b0388169063dd62ed3e90604401602060405180830381865afa15801561013a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061015e919061054a565b10156101c25760405162461bcd60e51b815260206004820152602860248201527f537761707065724d6f636b3a204e6f7420656e6f75676820746f6b656e496e20604482015267185c1c1c9bdd995960c21b60648201526084015b60405180910390fd5b6040516323b872dd60e01b8152336004820152306024820152604481018590526001600160a01b038716906323b872dd906064016020604051808303816000875af1158015610215573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102399190610563565b50670de0b6b3a7640000600054670de0b6b3a764000061025991906105a2565b600154604051632d9198e160e21b81526001600160a01b038a811660048301528981166024830152604482018990529091169063b646638490606401602060405180830381865afa1580156102b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102d6919061054a565b6102e091906105bb565b6102ea91906105d2565b90508281101561033c5760405162461bcd60e51b815260206004820152601e60248201527f537761707065724d6f636b3a20536c69707061676520746f6f2068696768000060448201526064016101b9565b6040516370a0823160e01b815230600482015281906001600160a01b038716906370a0823190602401602060405180830381865afa158015610382573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103a6919061054a565b10156104055760405162461bcd60e51b815260206004820152602860248201527f537761707065724d6f636b3a204e6f7420656e6f75676820746f6b656e4f75746044820152672062616c616e636560c01b60648201526084016101b9565b60405163a9059cbb60e01b81526001600160a01b0383811660048301526024820183905286169063a9059cbb906044016020604051808303816000875af1158015610454573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104789190610563565b5095945050505050565b60006020828403121561049457600080fd5b5035919050565b80356001600160a01b03811681146104b257600080fd5b919050565b6000806000606084860312156104cc57600080fd5b6104d58461049b565b92506104e36020850161049b565b9150604084013590509250925092565b600080600080600060a0868803121561050b57600080fd5b6105148661049b565b94506105226020870161049b565b9350604086013592506060860135915061053e6080870161049b565b90509295509295909350565b60006020828403121561055c57600080fd5b5051919050565b60006020828403121561057557600080fd5b8151801515811461058557600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b818103818111156105b5576105b561058c565b92915050565b80820281158282048414176105b5576105b561058c565b6000826105ef57634e487b7160e01b600052601260045260246000fd5b50049056fea2646970667358221220301cf70cad42d64b39a1f9a88f20330acab08500f58758fcb10e238ea4a6466664736f6c63430008170033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ 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.