Source Code
Overview
ETH Balance
0 ETH
Token Holdings
More Info
ContractCreator
Multichain Info
N/A
Latest 25 from a total of 15,700 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Swap To Price | 24817098 | 1 min ago | IN | 0 ETH | 0.00000014 | ||||
Swap To Price | 24815876 | 42 mins ago | IN | 0 ETH | 0.00000014 | ||||
Swap To Price | 24815734 | 47 mins ago | IN | 0 ETH | 0.00000014 | ||||
Swap To Price | 24815683 | 49 mins ago | IN | 0 ETH | 0.00000014 | ||||
Swap To Price | 24815636 | 50 mins ago | IN | 0 ETH | 0.00000014 | ||||
Swap To Price | 24815007 | 1 hr ago | IN | 0 ETH | 0.00000014 | ||||
Swap To Price | 24814817 | 1 hr ago | IN | 0 ETH | 0.00000014 | ||||
Swap To Price | 24814303 | 1 hr ago | IN | 0 ETH | 0.00000014 | ||||
Swap To Price | 24814208 | 1 hr ago | IN | 0 ETH | 0.00000014 | ||||
Swap To Price | 24813932 | 1 hr ago | IN | 0 ETH | 0.00000014 | ||||
Swap To Price | 24813467 | 2 hrs ago | IN | 0 ETH | 0.00000014 | ||||
Swap To Price | 24812189 | 2 hrs ago | IN | 0 ETH | 0.00000014 | ||||
Swap To Price | 24812004 | 2 hrs ago | IN | 0 ETH | 0.00000014 | ||||
Swap To Price | 24811999 | 2 hrs ago | IN | 0 ETH | 0.00000014 | ||||
Swap To Price | 24811950 | 2 hrs ago | IN | 0 ETH | 0.00000014 | ||||
Swap To Price | 24811198 | 3 hrs ago | IN | 0 ETH | 0.00000014 | ||||
Swap To Price | 24811193 | 3 hrs ago | IN | 0 ETH | 0.00000014 | ||||
Swap To Price | 24811144 | 3 hrs ago | IN | 0 ETH | 0.00000014 | ||||
Swap To Price | 24810676 | 3 hrs ago | IN | 0 ETH | 0.00000014 | ||||
Swap To Price | 24810302 | 3 hrs ago | IN | 0 ETH | 0.00000014 | ||||
Swap To Price | 24810211 | 3 hrs ago | IN | 0 ETH | 0.00000014 | ||||
Swap To Price | 24810118 | 3 hrs ago | IN | 0 ETH | 0.00000014 | ||||
Swap To Price | 24809924 | 4 hrs ago | IN | 0 ETH | 0.00000014 | ||||
Swap To Price | 24809879 | 4 hrs ago | IN | 0 ETH | 0.00000014 | ||||
Swap To Price | 24809829 | 4 hrs ago | IN | 0 ETH | 0.00000014 |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
SwapToPrice
Compiler Version
v0.8.25+commit.b61c2a91
Optimization Enabled:
Yes with 800 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.17; import { ICLPool } from "./interfaces/external/ICLPool.sol"; import { ICLSwapCallback } from "./interfaces/external/ICLSwapCallback.sol"; import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract SwapToPrice is ICLSwapCallback, Ownable { ICLPool internal cachedPool; constructor() Ownable(msg.sender) { } function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata) external { address pool = address(cachedPool); require(msg.sender == pool, "Wrong pool"); if (amount0Delta > 0) { IERC20 token = IERC20(cachedPool.token0()); token.transfer(pool, uint256(amount0Delta)); } else { IERC20 token = IERC20(cachedPool.token1()); token.transfer(pool, uint256(amount1Delta)); } delete cachedPool; } function swapToPrice(ICLPool pool, bool zeroForOne, uint160 sqrtPriceLimitX96) external { require(msg.sender == owner(), "Not owner"); cachedPool = pool; pool.swap(msg.sender, zeroForOne, type(int256).max, sqrtPriceLimitX96, ""); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {Context} from "../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. * * The initial owner is set to the address provided by the deployer. 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; /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ constructor(address initialOwner) { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling 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 { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @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 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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @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; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title The interface for a Uniswap V3 Pool /// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform /// to the ERC20 specification /// @dev The pool interface is broken up into many smaller pieces interface ICLPool { /// @notice The first of the two tokens of the pool, sorted by address /// @return The token contract address function token0() external view returns (address); /// @notice The second of the two tokens of the pool, sorted by address /// @return The token contract address function token1() external view returns (address); /// @notice Swap token0 for token1, or token1 for token0 /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback /// @param recipient The address to receive the output of the swap /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0 /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative) /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this /// value after the swap. If one for zero, the price cannot be greater than this value after the swap /// @param data Any data to be passed through to the callback /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive function swap( address recipient, bool zeroForOne, int256 amountSpecified, uint160 sqrtPriceLimitX96, bytes calldata data ) external returns (int256 amount0, int256 amount1); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Callback for ICLPoolActions#swap /// @notice Any contract that calls ICLPoolActions#swap must implement this interface interface ICLSwapCallback { /// @notice Called to `msg.sender` after executing a swap via ICLPool#swap. /// @dev In the implementation you must pay the pool tokens owed for the swap. /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory. /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped. /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token0 to the pool. /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token1 to the pool. /// @param data Any data passed through by the caller via the ICLPoolActions#swap call function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external; }
{ "viaIR": true, "optimizer": { "enabled": true, "runs": 800 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ICLPool","name":"pool","type":"address"},{"internalType":"bool","name":"zeroForOne","type":"bool"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"}],"name":"swapToPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"uniswapV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60808060405234607857331560625760008054336001600160a01b03198216811783556040519290916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a36105fd908161007e8239f35b631e4fbdf760e01b815260006004820152602490fd5b600080fdfe60406080815260048036101561001457600080fd5b600091823560e01c8063715018a6146104ce5780637c5de716146103875780638da5cb5b1461035d578063f2fde38b146102d25763fa461e331461005757600080fd5b346102ce5760603660031901126102ce57813560443567ffffffffffffffff8082116102ca57366023830112156102ca57818501359081116102ca57369101602401116102c6576001600160a01b03806001541680330361028357858313156101ba57858260015416928551968794630dfe168160e01b8652858260209a8b935afa9485156101b057918391610122989795938a97610181575b5087519889968795869363a9059cbb60e01b85528401602090939291936001600160a01b0360408201951681520152565b0393165af1908115610178575061014a575b50505b6001600160a01b03196001541660015580f35b8161016992903d10610171575b6101618183610527565b810190610583565b503880610134565b503d610157565b513d85823e3d90fd5b6101a2919550873d89116101a9575b61019a8183610527565b81019061055f565b93386100f1565b503d610190565b87513d85823e3d90fd5b835163d21220a760e01b8152602095935091869086848681865afa938415610279579161022396959391889593829461025a575b50865163a9059cbb60e01b81526001600160a01b03909316948301948552602435602086015291968794859391849160400190565b0393165af1908115610178575061023c575b5050610137565b8161025292903d10610171576101618183610527565b503880610235565b610272919450863d88116101a95761019a8183610527565b92386101ee565b86513d84823e3d90fd5b835162461bcd60e51b8152602081870152600a60248201527f57726f6e6720706f6f6c000000000000000000000000000000000000000000006044820152606490fd5b8380fd5b8580fd5b8280fd5b50346102ce5760203660031901126102ce578135916001600160a01b03918284168094036103595761030261059b565b83156103435750508254826001600160a01b03198216178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b51631e4fbdf760e01b8152908101849052602490fd5b8480fd5b8382346103835781600319360112610383576001600160a01b0360209254169051908152f35b5080fd5b5090346102ce5760603660031901126102ce5780356001600160a01b039182821680920361035957602435918215158093036102ca57604435938085168095036104ca57865416330361048757849291868260c4936001600160a01b0319600154161760015585519687958694630251596160e31b8652339086015260248501527f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6044850152606484015260a060848401528160a48401525af1801561047b57610450578280f35b813d8311610474575b6104638183610527565b810103126104715738808280f35b80fd5b503d610459565b505051903d90823e3d90fd5b845162461bcd60e51b8152602081840152600960248201527f4e6f74206f776e657200000000000000000000000000000000000000000000006044820152606490fd5b8680fd5b83346104715780600319360112610471576104e761059b565b806001600160a01b0381546001600160a01b031981168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b90601f8019910116810190811067ffffffffffffffff82111761054957604052565b634e487b7160e01b600052604160045260246000fd5b9081602091031261057e57516001600160a01b038116810361057e5790565b600080fd5b9081602091031261057e5751801515810361057e5790565b6001600160a01b036000541633036105af57565b60405163118cdaa760e01b8152336004820152602490fdfea26469706673582212200b88a41794e6d160de018bd6119c57edbd8709b5ed4d76707ca9bd13ab535a3964736f6c63430008190033
Deployed Bytecode
0x60406080815260048036101561001457600080fd5b600091823560e01c8063715018a6146104ce5780637c5de716146103875780638da5cb5b1461035d578063f2fde38b146102d25763fa461e331461005757600080fd5b346102ce5760603660031901126102ce57813560443567ffffffffffffffff8082116102ca57366023830112156102ca57818501359081116102ca57369101602401116102c6576001600160a01b03806001541680330361028357858313156101ba57858260015416928551968794630dfe168160e01b8652858260209a8b935afa9485156101b057918391610122989795938a97610181575b5087519889968795869363a9059cbb60e01b85528401602090939291936001600160a01b0360408201951681520152565b0393165af1908115610178575061014a575b50505b6001600160a01b03196001541660015580f35b8161016992903d10610171575b6101618183610527565b810190610583565b503880610134565b503d610157565b513d85823e3d90fd5b6101a2919550873d89116101a9575b61019a8183610527565b81019061055f565b93386100f1565b503d610190565b87513d85823e3d90fd5b835163d21220a760e01b8152602095935091869086848681865afa938415610279579161022396959391889593829461025a575b50865163a9059cbb60e01b81526001600160a01b03909316948301948552602435602086015291968794859391849160400190565b0393165af1908115610178575061023c575b5050610137565b8161025292903d10610171576101618183610527565b503880610235565b610272919450863d88116101a95761019a8183610527565b92386101ee565b86513d84823e3d90fd5b835162461bcd60e51b8152602081870152600a60248201527f57726f6e6720706f6f6c000000000000000000000000000000000000000000006044820152606490fd5b8380fd5b8580fd5b8280fd5b50346102ce5760203660031901126102ce578135916001600160a01b03918284168094036103595761030261059b565b83156103435750508254826001600160a01b03198216178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b51631e4fbdf760e01b8152908101849052602490fd5b8480fd5b8382346103835781600319360112610383576001600160a01b0360209254169051908152f35b5080fd5b5090346102ce5760603660031901126102ce5780356001600160a01b039182821680920361035957602435918215158093036102ca57604435938085168095036104ca57865416330361048757849291868260c4936001600160a01b0319600154161760015585519687958694630251596160e31b8652339086015260248501527f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6044850152606484015260a060848401528160a48401525af1801561047b57610450578280f35b813d8311610474575b6104638183610527565b810103126104715738808280f35b80fd5b503d610459565b505051903d90823e3d90fd5b845162461bcd60e51b8152602081840152600960248201527f4e6f74206f776e657200000000000000000000000000000000000000000000006044820152606490fd5b8680fd5b83346104715780600319360112610471576104e761059b565b806001600160a01b0381546001600160a01b031981168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b90601f8019910116810190811067ffffffffffffffff82111761054957604052565b634e487b7160e01b600052604160045260246000fd5b9081602091031261057e57516001600160a01b038116810361057e5790565b600080fd5b9081602091031261057e5751801515810361057e5790565b6001600160a01b036000541633036105af57565b60405163118cdaa760e01b8152336004820152602490fdfea26469706673582212200b88a41794e6d160de018bd6119c57edbd8709b5ed4d76707ca9bd13ab535a3964736f6c63430008190033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ 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.