Source Code
Latest 25 from a total of 50 transactions
| Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Swap | 47128072 | 19 days ago | IN | 0 MON | 0.51379603 | ||||
| Swap | 46954417 | 20 days ago | IN | 0 MON | 0.35125281 | ||||
| Swap | 42441858 | 41 days ago | IN | 0 MON | 0.15589537 | ||||
| Swap | 42386595 | 41 days ago | IN | 0 MON | 0.13419364 | ||||
| Swap | 42175659 | 42 days ago | IN | 0 MON | 0.26008969 | ||||
| Swap | 41573702 | 45 days ago | IN | 0 MON | 0.36607157 | ||||
| Swap | 41573142 | 45 days ago | IN | 0 MON | 0.37853937 | ||||
| Swap | 41572744 | 45 days ago | IN | 70 MON | 0.13022896 | ||||
| Swap | 41552485 | 45 days ago | IN | 100 MON | 0.14983432 | ||||
| Swap | 41549050 | 45 days ago | IN | 0 MON | 0.32039597 | ||||
| Swap | 41548731 | 45 days ago | IN | 0 MON | 0.15340473 | ||||
| Swap | 41548663 | 45 days ago | IN | 20 MON | 0.17572129 | ||||
| Swap | 41540230 | 45 days ago | IN | 0 MON | 0.165638 | ||||
| Swap | 41540207 | 45 days ago | IN | 0 MON | 0.28981596 | ||||
| Swap | 41533877 | 45 days ago | IN | 0 MON | 0.12770012 | ||||
| Swap | 41533864 | 45 days ago | IN | 0 MON | 0.26908303 | ||||
| Swap | 41533560 | 45 days ago | IN | 0 MON | 0.15848709 | ||||
| Swap | 41533317 | 45 days ago | IN | 0 MON | 0.28857931 | ||||
| Swap | 41532439 | 45 days ago | IN | 0 MON | 0.45023075 | ||||
| Swap | 41532130 | 45 days ago | IN | 0 MON | 0.12698714 | ||||
| Swap | 41155489 | 47 days ago | IN | 100 MON | 0.21525998 | ||||
| Swap | 41154240 | 47 days ago | IN | 0 MON | 0.33046235 | ||||
| Swap | 41132693 | 47 days ago | IN | 0 MON | 0.11124344 | ||||
| Swap | 41132549 | 47 days ago | IN | 0 MON | 0.44552855 | ||||
| Swap | 41093156 | 47 days ago | IN | 0 MON | 0.15216166 |
Latest 25 internal transactions (View All)
Advanced mode:
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 47128072 | 19 days ago | 7.33241473 MON | ||||
| 47128072 | 19 days ago | 7.33241473 MON | ||||
| 46954417 | 20 days ago | 10.35554936 MON | ||||
| 46954417 | 20 days ago | 10.35554936 MON | ||||
| 42386595 | 41 days ago | 29.05431666 MON | ||||
| 42386595 | 41 days ago | 29.05431666 MON | ||||
| 41573702 | 45 days ago | 38.75129795 MON | ||||
| 41573702 | 45 days ago | 38.75129795 MON | ||||
| 41573142 | 45 days ago | 38.57180658 MON | ||||
| 41573142 | 45 days ago | 38.57180658 MON | ||||
| 41572744 | 45 days ago | 70 MON | ||||
| 41552485 | 45 days ago | 100 MON | ||||
| 41549050 | 45 days ago | 19.94349126 MON | ||||
| 41549050 | 45 days ago | 19.94349126 MON | ||||
| 41548663 | 45 days ago | 20 MON | ||||
| 41540207 | 45 days ago | 14.33844914 MON | ||||
| 41540207 | 45 days ago | 14.33844914 MON | ||||
| 41533877 | 45 days ago | 3.80079089 MON | ||||
| 41533877 | 45 days ago | 3.80079089 MON | ||||
| 41533560 | 45 days ago | 3.2327241 MON | ||||
| 41533560 | 45 days ago | 3.2327241 MON | ||||
| 41532439 | 45 days ago | 38.06872942 MON | ||||
| 41532439 | 45 days ago | 38.06872942 MON | ||||
| 41155489 | 47 days ago | 100 MON | ||||
| 41154240 | 47 days ago | 36.66477847 MON |
Loading...
Loading
Contract Name:
AnonSwap
Compiler Version
v0.8.26+commit.8a97fa7a
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;
import { TransferHelper } from "./libraries/TransferHelper.sol";
contract AnonSwap {
using TransferHelper for address;
struct SwapPath {
address to; // The target contract address for executing the swap.
bytes callData; // The data for invoking the swap function.
}
struct SwapData {
address tokenIn; // The input token. Use address(0) or any native token address for ETH.
address tokenOut; // The output token. Use address(0) or any native token address for ETH.
uint256 amountIn; // The amount of the input token to swap.
uint256 minAmountOut; // The expected amount of the output token after the swap.
SwapPath swapPath; // to. calldata from aggregator to execute.
}
event Swap(
address sender,
address tokenIn,
address tokenOut,
uint256 amountIn,
uint256 amountOut
);
function swap(SwapData calldata _swapData, bool isNativeOut) external payable {
bool isNativeIn = msg.value > 0;
if (isNativeIn) {
require(msg.value == _swapData.amountIn, "Invalid amountIn");
} else {
_swapData.tokenIn.safeTransferFrom(msg.sender, address(this), _swapData.amountIn);
_swapData.tokenIn.safeApprove(_swapData.swapPath.to, _swapData.amountIn);
}
(bool check, ) = address(_swapData.swapPath.to).staticcall(
abi.encodeWithSignature("decimals()")
);
require(!check, "wrong target");
(bool success, ) = _swapData.swapPath.to.call{ value: isNativeIn ? msg.value : 0 }(
_swapData.swapPath.callData
);
require(success, "Call failed");
if (!isNativeIn) _swapData.tokenIn.safeApprove(_swapData.swapPath.to, 0);
uint amountOut = isNativeOut ? address(this).balance : _swapData.tokenOut.getBalance();
require(amountOut >= _swapData.minAmountOut, "Fail minAmountOut");
if (isNativeOut) {
(bool ok, ) = msg.sender.call{ value: amountOut }("");
require(ok, "send native failed");
} else {
_swapData.tokenOut.safeTransfer(msg.sender, amountOut);
}
emit Swap(msg.sender, _swapData.tokenIn, _swapData.tokenOut, _swapData.amountIn, amountOut);
}
receive() external payable {}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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);
}// SPDX-License-Identifier: GPL-2.0-or-later
// https://github.com/Uniswap/v3-periphery/blob/main/contracts/libraries/TransferHelper.sol
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
library TransferHelper {
/// @notice Transfers tokens from the targeted address to the given destination
/// @notice Errors with 'STF' if transfer fails
/// @param token The contract address of the token to be transferred
/// @param from The originating address from which the tokens will be transferred
/// @param to The destination address of the transfer
/// @param value The amount to be transferred
function safeTransferFrom(address token, address from, address to, uint256 value) internal {
(bool success, bytes memory data) = token.call(
abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value)
);
require(success && (data.length == 0 || abi.decode(data, (bool))), "BP-STF");
}
/// @notice Transfers tokens from msg.sender to a recipient
/// @dev Errors with ST if transfer fails
/// @param token The contract address of the token which will be transferred
/// @param to The recipient of the transfer
/// @param value The value of the transfer
function safeTransfer(address token, address to, uint256 value) internal {
(bool success, bytes memory data) = token.call(
abi.encodeWithSelector(IERC20.transfer.selector, to, value)
);
require(success && (data.length == 0 || abi.decode(data, (bool))), "BP-ST");
}
function getBalance(address token) internal view returns (uint256 balance) {
bytes memory callData = abi.encodeWithSelector(IERC20.balanceOf.selector, address(this));
(bool success, bytes memory data) = token.staticcall(callData);
require(success && data.length >= 32);
balance = abi.decode(data, (uint256));
}
function getBalanceOf(address token, address target) internal view returns (uint256 balance) {
bytes memory callData = abi.encodeWithSelector(IERC20.balanceOf.selector, target);
(bool success, bytes memory data) = token.staticcall(callData);
require(success && data.length >= 32);
balance = abi.decode(data, (uint256));
}
function safeApprove(address token, address spender, uint256 amount) internal {
(bool success, bytes memory data) = token.call(
abi.encodeWithSelector(IERC20.approve.selector, spender, amount)
);
require(success && (data.length == 0 || abi.decode(data, (bool))), "BP-SA");
}
}{
"viaIR": false,
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"bytecodeHash": "none",
"useLiteralContent": true
},
"evmVersion": "paris",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"tokenIn","type":"address"},{"indexed":false,"internalType":"address","name":"tokenOut","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountOut","type":"uint256"}],"name":"Swap","type":"event"},{"inputs":[{"components":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct AnonSwap.SwapPath","name":"swapPath","type":"tuple"}],"internalType":"struct AnonSwap.SwapData","name":"_swapData","type":"tuple"},{"internalType":"bool","name":"isNativeOut","type":"bool"}],"name":"swap","outputs":[],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
6080604052348015600f57600080fd5b50610a128061001f6000396000f3fe6080604052600436106100225760003560e01c8063f5a19ce61461002e57600080fd5b3661002957005b600080fd5b61004161003c36600461089b565b610043565b005b341580159061009c57826040013534146100975760405162461bcd60e51b815260206004820152601060248201526f24b73b30b634b21030b6b7bab73a24b760811b60448201526064015b60405180910390fd5b610104565b6100c4333060408601356100b360208801886108f2565b6001600160a01b03169291906104ab565b6101046100d46080850185610922565b6100e29060208101906108f2565b60408501356100f460208701876108f2565b6001600160a01b031691906105b8565b60006101136080850185610922565b6101219060208101906108f2565b60408051600481526024810182526020810180516001600160e01b031663313ce56760e01b17905290516001600160a01b0392909216916101629190610942565b600060405180830381855afa9150503d806000811461019d576040519150601f19603f3d011682016040523d82523d6000602084013e6101a2565b606091505b5050905080156101e35760405162461bcd60e51b815260206004820152600c60248201526b1ddc9bdb99c81d185c99d95d60a21b604482015260640161008e565b60006101f26080860186610922565b6102009060208101906108f2565b6001600160a01b031683610215576000610217565b345b6102246080880188610922565b610232906020810190610971565b6040516102409291906109bf565b60006040518083038185875af1925050503d806000811461027d576040519150601f19603f3d011682016040523d82523d6000602084013e610282565b606091505b50509050806102c15760405162461bcd60e51b815260206004820152600b60248201526a10d85b1b0819985a5b195960aa1b604482015260640161008e565b826102f3576102f36102d66080870187610922565b6102e49060208101906108f2565b60006100f460208901896108f2565b6000846103205761031b61030d60408801602089016108f2565b6001600160a01b03166106bb565b610322565b475b9050856060013581101561036c5760405162461bcd60e51b815260206004820152601160248201527011985a5b081b5a5b905b5bdd5b9d13dd5d607a1b604482015260640161008e565b841561040557604051600090339083908381818185875af1925050503d80600081146103b4576040519150601f19603f3d011682016040523d82523d6000602084013e6103b9565b606091505b50509050806103ff5760405162461bcd60e51b81526020600482015260126024820152711cd95b99081b985d1a5d994819985a5b195960721b604482015260640161008e565b5061042a565b61042a338261041a60408a0160208b016108f2565b6001600160a01b0316919061078e565b7fcd3829a3813dc3cdd188fd3d01dcf3268c16be2fdd2dd21d0665418816e460623361045960208901896108f2565b61046960408a0160208b016108f2565b604080516001600160a01b03948516815292841660208401529216818301529088013560608201526080810183905260a00160405180910390a1505050505050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b179052915160009283929088169161050f9190610942565b6000604051808303816000865af19150503d806000811461054c576040519150601f19603f3d011682016040523d82523d6000602084013e610551565b606091505b509150915081801561057b57508051158061057b57508080602001905181019061057b91906109cf565b6105b05760405162461bcd60e51b8152602060048201526006602482015265212816a9aa2360d11b604482015260640161008e565b505050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663095ea7b360e01b17905291516000928392908716916106149190610942565b6000604051808303816000865af19150503d8060008114610651576040519150601f19603f3d011682016040523d82523d6000602084013e610656565b606091505b509150915081801561068057508051158061068057508080602001905181019061068091906109cf565b6106b45760405162461bcd60e51b815260206004820152600560248201526442502d534160d81b604482015260640161008e565b5050505050565b604080513060248083019190915282518083039091018152604490910182526020810180516001600160e01b03166370a0823160e01b179052905160009190829081906001600160a01b03861690610714908590610942565b600060405180830381855afa9150503d806000811461074f576040519150601f19603f3d011682016040523d82523d6000602084013e610754565b606091505b509150915081801561076857506020815110155b61077157600080fd5b8080602001905181019061078591906109ec565b95945050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916107ea9190610942565b6000604051808303816000865af19150503d8060008114610827576040519150601f19603f3d011682016040523d82523d6000602084013e61082c565b606091505b509150915081801561085657508051158061085657508080602001905181019061085691906109cf565b6106b45760405162461bcd60e51b815260206004820152600560248201526410940b54d560da1b604482015260640161008e565b801515811461089857600080fd5b50565b600080604083850312156108ae57600080fd5b823567ffffffffffffffff8111156108c557600080fd5b830160a081860312156108d757600080fd5b915060208301356108e78161088a565b809150509250929050565b60006020828403121561090457600080fd5b81356001600160a01b038116811461091b57600080fd5b9392505050565b60008235603e1983360301811261093857600080fd5b9190910192915050565b6000825160005b818110156109635760208186018101518583015201610949565b506000920191825250919050565b6000808335601e1984360301811261098857600080fd5b83018035915067ffffffffffffffff8211156109a357600080fd5b6020019150368190038213156109b857600080fd5b9250929050565b8183823760009101908152919050565b6000602082840312156109e157600080fd5b815161091b8161088a565b6000602082840312156109fe57600080fd5b505191905056fea164736f6c634300081a000a
Deployed Bytecode
0x6080604052600436106100225760003560e01c8063f5a19ce61461002e57600080fd5b3661002957005b600080fd5b61004161003c36600461089b565b610043565b005b341580159061009c57826040013534146100975760405162461bcd60e51b815260206004820152601060248201526f24b73b30b634b21030b6b7bab73a24b760811b60448201526064015b60405180910390fd5b610104565b6100c4333060408601356100b360208801886108f2565b6001600160a01b03169291906104ab565b6101046100d46080850185610922565b6100e29060208101906108f2565b60408501356100f460208701876108f2565b6001600160a01b031691906105b8565b60006101136080850185610922565b6101219060208101906108f2565b60408051600481526024810182526020810180516001600160e01b031663313ce56760e01b17905290516001600160a01b0392909216916101629190610942565b600060405180830381855afa9150503d806000811461019d576040519150601f19603f3d011682016040523d82523d6000602084013e6101a2565b606091505b5050905080156101e35760405162461bcd60e51b815260206004820152600c60248201526b1ddc9bdb99c81d185c99d95d60a21b604482015260640161008e565b60006101f26080860186610922565b6102009060208101906108f2565b6001600160a01b031683610215576000610217565b345b6102246080880188610922565b610232906020810190610971565b6040516102409291906109bf565b60006040518083038185875af1925050503d806000811461027d576040519150601f19603f3d011682016040523d82523d6000602084013e610282565b606091505b50509050806102c15760405162461bcd60e51b815260206004820152600b60248201526a10d85b1b0819985a5b195960aa1b604482015260640161008e565b826102f3576102f36102d66080870187610922565b6102e49060208101906108f2565b60006100f460208901896108f2565b6000846103205761031b61030d60408801602089016108f2565b6001600160a01b03166106bb565b610322565b475b9050856060013581101561036c5760405162461bcd60e51b815260206004820152601160248201527011985a5b081b5a5b905b5bdd5b9d13dd5d607a1b604482015260640161008e565b841561040557604051600090339083908381818185875af1925050503d80600081146103b4576040519150601f19603f3d011682016040523d82523d6000602084013e6103b9565b606091505b50509050806103ff5760405162461bcd60e51b81526020600482015260126024820152711cd95b99081b985d1a5d994819985a5b195960721b604482015260640161008e565b5061042a565b61042a338261041a60408a0160208b016108f2565b6001600160a01b0316919061078e565b7fcd3829a3813dc3cdd188fd3d01dcf3268c16be2fdd2dd21d0665418816e460623361045960208901896108f2565b61046960408a0160208b016108f2565b604080516001600160a01b03948516815292841660208401529216818301529088013560608201526080810183905260a00160405180910390a1505050505050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b179052915160009283929088169161050f9190610942565b6000604051808303816000865af19150503d806000811461054c576040519150601f19603f3d011682016040523d82523d6000602084013e610551565b606091505b509150915081801561057b57508051158061057b57508080602001905181019061057b91906109cf565b6105b05760405162461bcd60e51b8152602060048201526006602482015265212816a9aa2360d11b604482015260640161008e565b505050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663095ea7b360e01b17905291516000928392908716916106149190610942565b6000604051808303816000865af19150503d8060008114610651576040519150601f19603f3d011682016040523d82523d6000602084013e610656565b606091505b509150915081801561068057508051158061068057508080602001905181019061068091906109cf565b6106b45760405162461bcd60e51b815260206004820152600560248201526442502d534160d81b604482015260640161008e565b5050505050565b604080513060248083019190915282518083039091018152604490910182526020810180516001600160e01b03166370a0823160e01b179052905160009190829081906001600160a01b03861690610714908590610942565b600060405180830381855afa9150503d806000811461074f576040519150601f19603f3d011682016040523d82523d6000602084013e610754565b606091505b509150915081801561076857506020815110155b61077157600080fd5b8080602001905181019061078591906109ec565b95945050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916107ea9190610942565b6000604051808303816000865af19150503d8060008114610827576040519150601f19603f3d011682016040523d82523d6000602084013e61082c565b606091505b509150915081801561085657508051158061085657508080602001905181019061085691906109cf565b6106b45760405162461bcd60e51b815260206004820152600560248201526410940b54d560da1b604482015260640161008e565b801515811461089857600080fd5b50565b600080604083850312156108ae57600080fd5b823567ffffffffffffffff8111156108c557600080fd5b830160a081860312156108d757600080fd5b915060208301356108e78161088a565b809150509250929050565b60006020828403121561090457600080fd5b81356001600160a01b038116811461091b57600080fd5b9392505050565b60008235603e1983360301811261093857600080fd5b9190910192915050565b6000825160005b818110156109635760208186018101518583015201610949565b506000920191825250919050565b6000808335601e1984360301811261098857600080fd5b83018035915067ffffffffffffffff8211156109a357600080fd5b6020019150368190038213156109b857600080fd5b9250929050565b8183823760009101908152919050565b6000602082840312156109e157600080fd5b815161091b8161088a565b6000602082840312156109fe57600080fd5b505191905056fea164736f6c634300081a000a
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in MON
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.