Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Swap | 15733106 | 854 days ago | IN | 0 ETH | 0.00302778 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Source Code Verified (Exact Match)
Contract Name:
SwapRouter
Compiler Version
v0.8.16+commit.07a7930e
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.16; import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import { Multicall } from "src/base/Multicall.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { IUniswapV2Router02 as IUniswapV2Router } from "src/interfaces/external/IUniswapV2Router02.sol"; import { IUniswapV3Router } from "src/interfaces/external/IUniswapV3Router.sol"; /** * @title Sommelier Swap Router * @notice Provides a universal interface allowing Sommelier contracts to interact with multiple * different exchanges to perform swaps. * @dev Perform multiple swaps using Multicall. * @author crispymangoes, Brian Le */ contract SwapRouter is Multicall { using SafeERC20 for ERC20; /** * @param UNIV2 Uniswap V2 * @param UNIV3 Uniswap V3 */ enum Exchange { UNIV2, UNIV3 } /** * @notice Get the selector of the function to call in order to perform swap with a given exchange. */ mapping(Exchange => bytes4) public getExchangeSelector; // ========================================== CONSTRUCTOR ========================================== /** * @notice Uniswap V2 swap router contract. */ IUniswapV2Router public immutable uniswapV2Router; // 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D /** * @notice Uniswap V3 swap router contract. */ IUniswapV3Router public immutable uniswapV3Router; // 0xE592427A0AEce92De3Edee1F18E0157C05861564 /** * @param _uniswapV2Router address of the Uniswap V2 swap router contract * @param _uniswapV3Router address of the Uniswap V3 swap router contract */ constructor(IUniswapV2Router _uniswapV2Router, IUniswapV3Router _uniswapV3Router) { // Set up all exchanges. uniswapV2Router = _uniswapV2Router; uniswapV3Router = _uniswapV3Router; // Set up mapping between IDs and selectors. getExchangeSelector[Exchange.UNIV2] = SwapRouter(this).swapWithUniV2.selector; getExchangeSelector[Exchange.UNIV3] = SwapRouter(this).swapWithUniV3.selector; } // ======================================= SWAP OPERATIONS ======================================= /** * @notice Attempted to perform a swap that reverted without a message. */ error SwapRouter__SwapReverted(); /** * @notice Attempted to perform a swap with mismatched assetIn and swap data. * @param actual the address encoded into the swap data * @param expected the address passed in with assetIn */ error SwapRouter__AssetInMisMatch(address actual, address expected); /** * @notice Attempted to perform a swap with mismatched assetOut and swap data. * @param actual the address encoded into the swap data * @param expected the address passed in with assetIn */ error SwapRouter__AssetOutMisMatch(address actual, address expected); /** * @notice Perform a swap using a supported exchange. * @param exchange value dictating which exchange to use to make the swap * @param swapData encoded data used for the swap * @param receiver address to send the received assets to * @return amountOut amount of assets received from the swap */ function swap( Exchange exchange, bytes memory swapData, address receiver, ERC20 assetIn, ERC20 assetOut ) external returns (uint256 amountOut) { // Route swap call to appropriate function using selector. (bool success, bytes memory result) = address(this).delegatecall( abi.encodeWithSelector(getExchangeSelector[exchange], swapData, receiver, assetIn, assetOut) ); if (!success) { // If there is return data, the call reverted with a reason or a custom error so we // bubble up the error message. if (result.length > 0) { assembly { let returndata_size := mload(result) revert(add(32, result), returndata_size) } } else { revert SwapRouter__SwapReverted(); } } amountOut = abi.decode(result, (uint256)); } /** * @notice Perform a swap using Uniswap V2. * @param swapData bytes variable storing the following swap information: * address[] path: array of addresses dictating what swap path to follow * uint256 amount: amount of the first asset in the path to swap * uint256 amountOutMin: the minimum amount of the last asset in the path to receive * @param receiver address to send the received assets to * @return amountOut amount of assets received from the swap */ function swapWithUniV2( bytes memory swapData, address receiver, ERC20 assetIn, ERC20 assetOut ) public returns (uint256 amountOut) { (address[] memory path, uint256 amount, uint256 amountOutMin) = abi.decode( swapData, (address[], uint256, uint256) ); // Check that path matches assetIn and assetOut. if (assetIn != ERC20(path[0])) revert SwapRouter__AssetInMisMatch(path[0], address(assetIn)); if (assetOut != ERC20(path[path.length - 1])) revert SwapRouter__AssetOutMisMatch(path[path.length - 1], address(assetOut)); // Transfer assets to this contract to swap. assetIn.safeTransferFrom(msg.sender, address(this), amount); // Approve assets to be swapped through the router. assetIn.safeApprove(address(uniswapV2Router), amount); // Execute the swap. uint256[] memory amountsOut = uniswapV2Router.swapExactTokensForTokens( amount, amountOutMin, path, receiver, block.timestamp + 60 ); amountOut = amountsOut[amountsOut.length - 1]; } /** * @notice Perform a swap using Uniswap V3. * @param swapData bytes variable storing the following swap information * address[] path: array of addresses dictating what swap path to follow * uint24[] poolFees: array of pool fees dictating what swap pools to use * uint256 amount: amount of the first asset in the path to swap * uint256 amountOutMin: the minimum amount of the last asset in the path to receive * @param receiver address to send the received assets to * @return amountOut amount of assets received from the swap */ function swapWithUniV3( bytes memory swapData, address receiver, ERC20 assetIn, ERC20 assetOut ) public returns (uint256 amountOut) { (address[] memory path, uint24[] memory poolFees, uint256 amount, uint256 amountOutMin) = abi.decode( swapData, (address[], uint24[], uint256, uint256) ); // Check that path matches assetIn and assetOut. if (assetIn != ERC20(path[0])) revert SwapRouter__AssetInMisMatch(path[0], address(assetIn)); if (assetOut != ERC20(path[path.length - 1])) revert SwapRouter__AssetOutMisMatch(path[path.length - 1], address(assetOut)); // Transfer assets to this contract to swap. assetIn.safeTransferFrom(msg.sender, address(this), amount); // Approve assets to be swapped through the router. assetIn.safeApprove(address(uniswapV3Router), amount); // Encode swap parameters. bytes memory encodePackedPath = abi.encodePacked(address(assetIn)); for (uint256 i = 1; i < path.length; i++) encodePackedPath = abi.encodePacked(encodePackedPath, poolFees[i - 1], path[i]); // Execute the swap. amountOut = uniswapV3Router.exactInput( IUniswapV3Router.ExactInputParams({ path: encodePackedPath, recipient: receiver, deadline: block.timestamp + 60, amountIn: amount, amountOutMinimum: amountOutMin }) ); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; } _balances[to] += amount; emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.8.0; import { IMulticall } from "src/interfaces/IMulticall.sol"; /** * @title Multicall * @notice Enables calling multiple methods in a single call to the contract * From: https://github.com/Uniswap/v3-periphery/contracts/base/Multicall.sol */ abstract contract Multicall is IMulticall { /// @inheritdoc IMulticall function multicall(bytes[] calldata data) public payable override returns (bytes[] memory results) { results = new bytes[](data.length); for (uint256 i = 0; i < data.length; i++) { (bool success, bytes memory result) = address(this).delegatecall(data[i]); if (!success) { // Next 5 lines from https://ethereum.stackexchange.com/a/83577 // solhint-disable-next-line reason-string if (result.length < 68) revert(); assembly { result := add(result, 0x04) } revert(abi.decode(result, (string))); } results[i] = result; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity >=0.8.0; interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint256 amountADesired, uint256 amountBDesired, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns ( uint256 amountA, uint256 amountB, uint256 liquidity ); function addLiquidityETH( address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external payable returns ( uint256 amountToken, uint256 amountETH, uint256 liquidity ); function removeLiquidity( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns (uint256 amountA, uint256 amountB); function removeLiquidityETH( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external returns (uint256 amountToken, uint256 amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountA, uint256 amountB); function removeLiquidityETHWithPermit( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountToken, uint256 amountETH); function swapExactTokensForTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapTokensForExactTokens( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapExactETHForTokens( uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); function swapTokensForExactETH( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapExactTokensForETH( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapETHForExactTokens( uint256 amountOut, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); function quote( uint256 amountA, uint256 reserveA, uint256 reserveB ) external pure returns (uint256 amountB); function getAmountOut( uint256 amountIn, uint256 reserveIn, uint256 reserveOut ) external pure returns (uint256 amountOut); function getAmountIn( uint256 amountOut, uint256 reserveIn, uint256 reserveOut ) external pure returns (uint256 amountIn); function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts); function getAmountsIn(uint256 amountOut, address[] calldata path) external view returns (uint256[] memory amounts); } interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external returns (uint256 amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.8.0; /// @title Callback for IUniswapV3PoolActions#swap /// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface interface IUniswapV3SwapCallback { /// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#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 IUniswapV3PoolActions#swap call function uniswapV3SwapCallback( int256 amount0Delta, int256 amount1Delta, bytes calldata data ) external; } /// @title Router token swapping functionality /// @notice Functions for swapping tokens via Uniswap V3 interface IUniswapV3Router is IUniswapV3SwapCallback { struct ExactInputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 deadline; uint256 amountIn; uint256 amountOutMinimum; uint160 sqrtPriceLimitX96; } /// @notice Swaps `amountIn` of one token for as much as possible of another token /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata /// @return amountOut The amount of the received token function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut); struct ExactInputParams { bytes path; address recipient; uint256 deadline; uint256 amountIn; uint256 amountOutMinimum; } /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata /// @return amountOut The amount of the received token function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut); struct ExactOutputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 deadline; uint256 amountOut; uint256 amountInMaximum; uint160 sqrtPriceLimitX96; } /// @notice Swaps as little as possible of one token for `amountOut` of another token /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata /// @return amountIn The amount of the input token function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn); struct ExactOutputParams { bytes path; address recipient; uint256 deadline; uint256 amountOut; uint256 amountInMaximum; } /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed) /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata /// @return amountIn The amount of the input token function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn); }
// 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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.8.0; /// @title Multicall interface /// @notice Enables calling multiple methods in a single call to the contract // From: https://github.com/Uniswap/v3-periphery/contracts/interfaces/IMulticall.sol interface IMulticall { /// @notice Call multiple functions in the current contract and return the data from all of them if they all succeed /// @dev The `msg.value` should not be trusted for any method callable from multicall. /// @param data The encoded function data for each of the calls to make to this contract /// @return results The results from each of the calls passed in via data function multicall(bytes[] calldata data) external payable returns (bytes[] memory results); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
{ "remappings": [ "@chainlink/=lib/chainlink/", "@ds-test/=lib/forge-std/lib/ds-test/src/", "@ensdomains/=node_modules/@ensdomains/", "@forge-std/=lib/forge-std/src/", "@openzeppelin/=lib/openzeppelin-contracts/", "@solmate/=lib/solmate/src/", "@uniswap/v3-core/=lib/v3-core/", "@uniswap/v3-periphery/=lib/v3-periphery/", "chainlink/=lib/chainlink/", "ds-test/=lib/forge-std/lib/ds-test/src/", "eth-gas-reporter/=node_modules/eth-gas-reporter/", "forge-std/=lib/forge-std/src/", "hardhat/=node_modules/hardhat/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "solmate/=lib/solmate/src/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "bytecodeHash": "ipfs" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract IUniswapV2Router02","name":"_uniswapV2Router","type":"address"},{"internalType":"contract IUniswapV3Router","name":"_uniswapV3Router","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"actual","type":"address"},{"internalType":"address","name":"expected","type":"address"}],"name":"SwapRouter__AssetInMisMatch","type":"error"},{"inputs":[{"internalType":"address","name":"actual","type":"address"},{"internalType":"address","name":"expected","type":"address"}],"name":"SwapRouter__AssetOutMisMatch","type":"error"},{"inputs":[],"name":"SwapRouter__SwapReverted","type":"error"},{"inputs":[{"internalType":"enum SwapRouter.Exchange","name":"","type":"uint8"}],"name":"getExchangeSelector","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"enum SwapRouter.Exchange","name":"exchange","type":"uint8"},{"internalType":"bytes","name":"swapData","type":"bytes"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"contract ERC20","name":"assetIn","type":"address"},{"internalType":"contract ERC20","name":"assetOut","type":"address"}],"name":"swap","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"swapData","type":"bytes"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"contract ERC20","name":"assetIn","type":"address"},{"internalType":"contract ERC20","name":"assetOut","type":"address"}],"name":"swapWithUniV2","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"swapData","type":"bytes"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"contract ERC20","name":"assetIn","type":"address"},{"internalType":"contract ERC20","name":"assetOut","type":"address"}],"name":"swapWithUniV3","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"uniswapV2Router","outputs":[{"internalType":"contract IUniswapV2Router02","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"uniswapV3Router","outputs":[{"internalType":"contract IUniswapV3Router","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60c060405234801561001057600080fd5b50604051620017b3380380620017b3833981016040819052610031916100cf565b6001600160a01b039182166080521660a052600060208190527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5805463ffffffff19908116635a0c82791790915560019091527fada5013122d395ba3c54772283fb069b10426056ef8ca54750cb9bb552a59e7d8054909116639d453f8d179055610109565b6001600160a01b03811681146100cc57600080fd5b50565b600080604083850312156100e257600080fd5b82516100ed816100b7565b60208401519092506100fe816100b7565b809150509250929050565b60805160a05161166a620001496000396000818160d8015281816106c3015261079b0152600081816087015281816104620152610493015261166a6000f3fe6080604052600436106100705760003560e01c80635a0c82791161004e5780635a0c8279146101285780639d453f8d14610148578063a1fbdf3914610168578063ac9650d8146101b157600080fd5b80631694505e146100755780632c76d7a6146100c65780632dfe1690146100fa575b600080fd5b34801561008157600080fd5b506100a97f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156100d257600080fd5b506100a97f000000000000000000000000000000000000000000000000000000000000000081565b34801561010657600080fd5b5061011a610115366004610e9a565b6101d1565b6040519081526020016100bd565b34801561013457600080fd5b5061011a610143366004610f22565b6102ff565b34801561015457600080fd5b5061011a610163366004610f22565b610565565b34801561017457600080fd5b50610198610183366004610f97565b60006020819052908152604090205460e01b81565b6040516001600160e01b031990911681526020016100bd565b6101c46101bf366004610fb2565b610871565b6040516100bd9190611077565b600080803081808a60018111156101ea576101ea6110d9565b60018111156101fb576101fb6110d9565b815260200190815260200160002060009054906101000a900460e01b8888888860405160240161022e94939291906110ef565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b031990941693909317909252905161026c919061112b565b600060405180830381855af49150503d80600081146102a7576040519150601f19603f3d011682016040523d82523d6000602084013e6102ac565b606091505b5091509150816102df578051156102c65780518082602001fd5b6040516347167cef60e11b815260040160405180910390fd5b808060200190518101906102f39190611147565b98975050505050505050565b6000806000808780602001905181019061031991906111f3565b9250925092508260008151811061033257610332611243565b60200260200101516001600160a01b0316866001600160a01b0316146103a7578260008151811061036557610365611243565b60200260200101518660405163e539288160e01b815260040161039e9291906001600160a01b0392831681529116602082015260400190565b60405180910390fd5b82600184516103b6919061126f565b815181106103c6576103c6611243565b60200260200101516001600160a01b0316856001600160a01b03161461043e5782600184516103f5919061126f565b8151811061040557610405611243565b6020026020010151856040516347052b6760e01b815260040161039e9291906001600160a01b0392831681529116602082015260400190565b6104536001600160a01b0387163330856109c9565b6104876001600160a01b0387167f000000000000000000000000000000000000000000000000000000000000000084610a3a565b60006001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166338ed17398484878c6104c742603c611288565b6040518663ffffffff1660e01b81526004016104e795949392919061129b565b6000604051808303816000875af1158015610506573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261052e919081019061130c565b9050806001825161053f919061126f565b8151811061054f5761054f611243565b6020026020010151945050505050949350505050565b6000806000806000888060200190518101906105819190611392565b93509350935093508360008151811061059c5761059c611243565b60200260200101516001600160a01b0316876001600160a01b03161461060857836000815181106105cf576105cf611243565b60200260200101518760405163e539288160e01b815260040161039e9291906001600160a01b0392831681529116602082015260400190565b8360018551610617919061126f565b8151811061062757610627611243565b60200260200101516001600160a01b0316866001600160a01b03161461069f578360018551610656919061126f565b8151811061066657610666611243565b6020026020010151866040516347052b6760e01b815260040161039e9291906001600160a01b0392831681529116602082015260400190565b6106b46001600160a01b0388163330856109c9565b6106e86001600160a01b0388167f000000000000000000000000000000000000000000000000000000000000000084610a3a565b60408051606089901b6bffffffffffffffffffffffff1916602082015281516014818303018152603490910190915260015b855181101561079857818561073060018461126f565b8151811061074057610740611243565b602002602001015187838151811061075a5761075a611243565b60200260200101516040516020016107749392919061146d565b60405160208183030381529060405291508080610790906114b9565b91505061071a565b507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c04b8d596040518060a001604052808481526020018c6001600160a01b0316815260200142603c6107f59190611288565b8152602001868152602001858152506040518263ffffffff1660e01b815260040161082091906114d2565b6020604051808303816000875af115801561083f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108639190611147565b9a9950505050505050505050565b60608167ffffffffffffffff81111561088c5761088c610dbd565b6040519080825280602002602001820160405280156108bf57816020015b60608152602001906001900390816108aa5790505b50905060005b828110156109c257600080308686858181106108e3576108e3611243565b90506020028101906108f5919061152a565b604051610903929190611578565b600060405180830381855af49150503d806000811461093e576040519150601f19603f3d011682016040523d82523d6000602084013e610943565b606091505b50915091508161098f5760448151101561095c57600080fd5b600481019050808060200190518101906109769190611588565b60405162461bcd60e51b815260040161039e91906115ff565b808484815181106109a2576109a2611243565b6020026020010181905250505080806109ba906114b9565b9150506108c5565b5092915050565b6040516001600160a01b0380851660248301528316604482015260648101829052610a349085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610b54565b50505050565b801580610ab45750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015610a8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab29190611147565b155b610b1f5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b606482015260840161039e565b6040516001600160a01b038316602482015260448101829052610b4f90849063095ea7b360e01b906064016109fd565b505050565b6000610ba9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c269092919063ffffffff16565b805190915015610b4f5780806020019051810190610bc79190611612565b610b4f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161039e565b6060610c358484600085610c3f565b90505b9392505050565b606082471015610ca05760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161039e565b6001600160a01b0385163b610cf75760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161039e565b600080866001600160a01b03168587604051610d13919061112b565b60006040518083038185875af1925050503d8060008114610d50576040519150601f19603f3d011682016040523d82523d6000602084013e610d55565b606091505b5091509150610d65828286610d70565b979650505050505050565b60608315610d7f575081610c38565b825115610d8f5782518084602001fd5b8160405162461bcd60e51b815260040161039e91906115ff565b803560028110610db857600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610dfc57610dfc610dbd565b604052919050565b600067ffffffffffffffff821115610e1e57610e1e610dbd565b50601f01601f191660200190565b600082601f830112610e3d57600080fd5b8135610e50610e4b82610e04565b610dd3565b818152846020838601011115610e6557600080fd5b816020850160208301376000918101602001919091529392505050565b6001600160a01b0381168114610e9757600080fd5b50565b600080600080600060a08688031215610eb257600080fd5b610ebb86610da9565b9450602086013567ffffffffffffffff811115610ed757600080fd5b610ee388828901610e2c565b9450506040860135610ef481610e82565b92506060860135610f0481610e82565b91506080860135610f1481610e82565b809150509295509295909350565b60008060008060808587031215610f3857600080fd5b843567ffffffffffffffff811115610f4f57600080fd5b610f5b87828801610e2c565b9450506020850135610f6c81610e82565b92506040850135610f7c81610e82565b91506060850135610f8c81610e82565b939692955090935050565b600060208284031215610fa957600080fd5b610c3882610da9565b60008060208385031215610fc557600080fd5b823567ffffffffffffffff80821115610fdd57600080fd5b818501915085601f830112610ff157600080fd5b81358181111561100057600080fd5b8660208260051b850101111561101557600080fd5b60209290920196919550909350505050565b60005b8381101561104257818101518382015260200161102a565b50506000910152565b60008151808452611063816020860160208601611027565b601f01601f19169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156110cc57603f198886030184526110ba85835161104b565b9450928501929085019060010161109e565b5092979650505050505050565b634e487b7160e01b600052602160045260246000fd5b608081526000611102608083018761104b565b6001600160a01b0395861660208401529385166040830152509216606090920191909152919050565b6000825161113d818460208701611027565b9190910192915050565b60006020828403121561115957600080fd5b5051919050565b600067ffffffffffffffff82111561117a5761117a610dbd565b5060051b60200190565b600082601f83011261119557600080fd5b815160206111a5610e4b83611160565b82815260059290921b840181019181810190868411156111c457600080fd5b8286015b848110156111e85780516111db81610e82565b83529183019183016111c8565b509695505050505050565b60008060006060848603121561120857600080fd5b835167ffffffffffffffff81111561121f57600080fd5b61122b86828701611184565b93505060208401519150604084015190509250925092565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8181038181111561128257611282611259565b92915050565b8082018082111561128257611282611259565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156112eb5784516001600160a01b0316835293830193918301916001016112c6565b50506001600160a01b03969096166060850152505050608001529392505050565b6000602080838503121561131f57600080fd5b825167ffffffffffffffff81111561133657600080fd5b8301601f8101851361134757600080fd5b8051611355610e4b82611160565b81815260059190911b8201830190838101908783111561137457600080fd5b928401925b82841015610d6557835182529284019290840190611379565b600080600080608085870312156113a857600080fd5b845167ffffffffffffffff808211156113c057600080fd5b6113cc88838901611184565b95506020915081870151818111156113e357600080fd5b87019050601f810188136113f657600080fd5b8051611404610e4b82611160565b81815260059190911b8201830190838101908a83111561142357600080fd5b928401925b8284101561145357835162ffffff811681146114445760008081fd5b82529284019290840190611428565b60408a01516060909a0151989b909a509650505050505050565b6000845161147f818460208901611027565b60e89490941b6001600160e81b0319169190930190815260609190911b6bffffffffffffffffffffffff1916600382015260170192915050565b6000600182016114cb576114cb611259565b5060010190565b602081526000825160a060208401526114ee60c084018261104b565b905060018060a01b0360208501511660408401526040840151606084015260608401516080840152608084015160a08401528091505092915050565b6000808335601e1984360301811261154157600080fd5b83018035915067ffffffffffffffff82111561155c57600080fd5b60200191503681900382131561157157600080fd5b9250929050565b8183823760009101908152919050565b60006020828403121561159a57600080fd5b815167ffffffffffffffff8111156115b157600080fd5b8201601f810184136115c257600080fd5b80516115d0610e4b82610e04565b8181528560208385010111156115e557600080fd5b6115f6826020830160208601611027565b95945050505050565b602081526000610c38602083018461104b565b60006020828403121561162457600080fd5b81518015158114610c3857600080fdfea26469706673582212209e7642f256a80ef7ace143e23cdc3f41d767425c290d1ccb3ed54fd93a7e897864736f6c634300081000330000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564
Deployed Bytecode
0x6080604052600436106100705760003560e01c80635a0c82791161004e5780635a0c8279146101285780639d453f8d14610148578063a1fbdf3914610168578063ac9650d8146101b157600080fd5b80631694505e146100755780632c76d7a6146100c65780632dfe1690146100fa575b600080fd5b34801561008157600080fd5b506100a97f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d81565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156100d257600080fd5b506100a97f000000000000000000000000e592427a0aece92de3edee1f18e0157c0586156481565b34801561010657600080fd5b5061011a610115366004610e9a565b6101d1565b6040519081526020016100bd565b34801561013457600080fd5b5061011a610143366004610f22565b6102ff565b34801561015457600080fd5b5061011a610163366004610f22565b610565565b34801561017457600080fd5b50610198610183366004610f97565b60006020819052908152604090205460e01b81565b6040516001600160e01b031990911681526020016100bd565b6101c46101bf366004610fb2565b610871565b6040516100bd9190611077565b600080803081808a60018111156101ea576101ea6110d9565b60018111156101fb576101fb6110d9565b815260200190815260200160002060009054906101000a900460e01b8888888860405160240161022e94939291906110ef565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b031990941693909317909252905161026c919061112b565b600060405180830381855af49150503d80600081146102a7576040519150601f19603f3d011682016040523d82523d6000602084013e6102ac565b606091505b5091509150816102df578051156102c65780518082602001fd5b6040516347167cef60e11b815260040160405180910390fd5b808060200190518101906102f39190611147565b98975050505050505050565b6000806000808780602001905181019061031991906111f3565b9250925092508260008151811061033257610332611243565b60200260200101516001600160a01b0316866001600160a01b0316146103a7578260008151811061036557610365611243565b60200260200101518660405163e539288160e01b815260040161039e9291906001600160a01b0392831681529116602082015260400190565b60405180910390fd5b82600184516103b6919061126f565b815181106103c6576103c6611243565b60200260200101516001600160a01b0316856001600160a01b03161461043e5782600184516103f5919061126f565b8151811061040557610405611243565b6020026020010151856040516347052b6760e01b815260040161039e9291906001600160a01b0392831681529116602082015260400190565b6104536001600160a01b0387163330856109c9565b6104876001600160a01b0387167f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d84610a3a565b60006001600160a01b037f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d166338ed17398484878c6104c742603c611288565b6040518663ffffffff1660e01b81526004016104e795949392919061129b565b6000604051808303816000875af1158015610506573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261052e919081019061130c565b9050806001825161053f919061126f565b8151811061054f5761054f611243565b6020026020010151945050505050949350505050565b6000806000806000888060200190518101906105819190611392565b93509350935093508360008151811061059c5761059c611243565b60200260200101516001600160a01b0316876001600160a01b03161461060857836000815181106105cf576105cf611243565b60200260200101518760405163e539288160e01b815260040161039e9291906001600160a01b0392831681529116602082015260400190565b8360018551610617919061126f565b8151811061062757610627611243565b60200260200101516001600160a01b0316866001600160a01b03161461069f578360018551610656919061126f565b8151811061066657610666611243565b6020026020010151866040516347052b6760e01b815260040161039e9291906001600160a01b0392831681529116602082015260400190565b6106b46001600160a01b0388163330856109c9565b6106e86001600160a01b0388167f000000000000000000000000e592427a0aece92de3edee1f18e0157c0586156484610a3a565b60408051606089901b6bffffffffffffffffffffffff1916602082015281516014818303018152603490910190915260015b855181101561079857818561073060018461126f565b8151811061074057610740611243565b602002602001015187838151811061075a5761075a611243565b60200260200101516040516020016107749392919061146d565b60405160208183030381529060405291508080610790906114b9565b91505061071a565b507f000000000000000000000000e592427a0aece92de3edee1f18e0157c058615646001600160a01b031663c04b8d596040518060a001604052808481526020018c6001600160a01b0316815260200142603c6107f59190611288565b8152602001868152602001858152506040518263ffffffff1660e01b815260040161082091906114d2565b6020604051808303816000875af115801561083f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108639190611147565b9a9950505050505050505050565b60608167ffffffffffffffff81111561088c5761088c610dbd565b6040519080825280602002602001820160405280156108bf57816020015b60608152602001906001900390816108aa5790505b50905060005b828110156109c257600080308686858181106108e3576108e3611243565b90506020028101906108f5919061152a565b604051610903929190611578565b600060405180830381855af49150503d806000811461093e576040519150601f19603f3d011682016040523d82523d6000602084013e610943565b606091505b50915091508161098f5760448151101561095c57600080fd5b600481019050808060200190518101906109769190611588565b60405162461bcd60e51b815260040161039e91906115ff565b808484815181106109a2576109a2611243565b6020026020010181905250505080806109ba906114b9565b9150506108c5565b5092915050565b6040516001600160a01b0380851660248301528316604482015260648101829052610a349085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610b54565b50505050565b801580610ab45750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015610a8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab29190611147565b155b610b1f5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b606482015260840161039e565b6040516001600160a01b038316602482015260448101829052610b4f90849063095ea7b360e01b906064016109fd565b505050565b6000610ba9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c269092919063ffffffff16565b805190915015610b4f5780806020019051810190610bc79190611612565b610b4f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161039e565b6060610c358484600085610c3f565b90505b9392505050565b606082471015610ca05760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161039e565b6001600160a01b0385163b610cf75760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161039e565b600080866001600160a01b03168587604051610d13919061112b565b60006040518083038185875af1925050503d8060008114610d50576040519150601f19603f3d011682016040523d82523d6000602084013e610d55565b606091505b5091509150610d65828286610d70565b979650505050505050565b60608315610d7f575081610c38565b825115610d8f5782518084602001fd5b8160405162461bcd60e51b815260040161039e91906115ff565b803560028110610db857600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610dfc57610dfc610dbd565b604052919050565b600067ffffffffffffffff821115610e1e57610e1e610dbd565b50601f01601f191660200190565b600082601f830112610e3d57600080fd5b8135610e50610e4b82610e04565b610dd3565b818152846020838601011115610e6557600080fd5b816020850160208301376000918101602001919091529392505050565b6001600160a01b0381168114610e9757600080fd5b50565b600080600080600060a08688031215610eb257600080fd5b610ebb86610da9565b9450602086013567ffffffffffffffff811115610ed757600080fd5b610ee388828901610e2c565b9450506040860135610ef481610e82565b92506060860135610f0481610e82565b91506080860135610f1481610e82565b809150509295509295909350565b60008060008060808587031215610f3857600080fd5b843567ffffffffffffffff811115610f4f57600080fd5b610f5b87828801610e2c565b9450506020850135610f6c81610e82565b92506040850135610f7c81610e82565b91506060850135610f8c81610e82565b939692955090935050565b600060208284031215610fa957600080fd5b610c3882610da9565b60008060208385031215610fc557600080fd5b823567ffffffffffffffff80821115610fdd57600080fd5b818501915085601f830112610ff157600080fd5b81358181111561100057600080fd5b8660208260051b850101111561101557600080fd5b60209290920196919550909350505050565b60005b8381101561104257818101518382015260200161102a565b50506000910152565b60008151808452611063816020860160208601611027565b601f01601f19169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156110cc57603f198886030184526110ba85835161104b565b9450928501929085019060010161109e565b5092979650505050505050565b634e487b7160e01b600052602160045260246000fd5b608081526000611102608083018761104b565b6001600160a01b0395861660208401529385166040830152509216606090920191909152919050565b6000825161113d818460208701611027565b9190910192915050565b60006020828403121561115957600080fd5b5051919050565b600067ffffffffffffffff82111561117a5761117a610dbd565b5060051b60200190565b600082601f83011261119557600080fd5b815160206111a5610e4b83611160565b82815260059290921b840181019181810190868411156111c457600080fd5b8286015b848110156111e85780516111db81610e82565b83529183019183016111c8565b509695505050505050565b60008060006060848603121561120857600080fd5b835167ffffffffffffffff81111561121f57600080fd5b61122b86828701611184565b93505060208401519150604084015190509250925092565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8181038181111561128257611282611259565b92915050565b8082018082111561128257611282611259565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156112eb5784516001600160a01b0316835293830193918301916001016112c6565b50506001600160a01b03969096166060850152505050608001529392505050565b6000602080838503121561131f57600080fd5b825167ffffffffffffffff81111561133657600080fd5b8301601f8101851361134757600080fd5b8051611355610e4b82611160565b81815260059190911b8201830190838101908783111561137457600080fd5b928401925b82841015610d6557835182529284019290840190611379565b600080600080608085870312156113a857600080fd5b845167ffffffffffffffff808211156113c057600080fd5b6113cc88838901611184565b95506020915081870151818111156113e357600080fd5b87019050601f810188136113f657600080fd5b8051611404610e4b82611160565b81815260059190911b8201830190838101908a83111561142357600080fd5b928401925b8284101561145357835162ffffff811681146114445760008081fd5b82529284019290840190611428565b60408a01516060909a0151989b909a509650505050505050565b6000845161147f818460208901611027565b60e89490941b6001600160e81b0319169190930190815260609190911b6bffffffffffffffffffffffff1916600382015260170192915050565b6000600182016114cb576114cb611259565b5060010190565b602081526000825160a060208401526114ee60c084018261104b565b905060018060a01b0360208501511660408401526040840151606084015260608401516080840152608084015160a08401528091505092915050565b6000808335601e1984360301811261154157600080fd5b83018035915067ffffffffffffffff82111561155c57600080fd5b60200191503681900382131561157157600080fd5b9250929050565b8183823760009101908152919050565b60006020828403121561159a57600080fd5b815167ffffffffffffffff8111156115b157600080fd5b8201601f810184136115c257600080fd5b80516115d0610e4b82610e04565b8181528560208385010111156115e557600080fd5b6115f6826020830160208601611027565b95945050505050565b602081526000610c38602083018461104b565b60006020828403121561162457600080fd5b81518015158114610c3857600080fdfea26469706673582212209e7642f256a80ef7ace143e23cdc3f41d767425c290d1ccb3ed54fd93a7e897864736f6c63430008100033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564
-----Decoded View---------------
Arg [0] : _uniswapV2Router (address): 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
Arg [1] : _uniswapV3Router (address): 0xE592427A0AEce92De3Edee1F18E0157C05861564
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d
Arg [1] : 000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.