chore: Rename Uniswapv2SwapExecutor to UniswapV2Executor
--- don't change below this line --- ENG-4033 Took 4 minutes
This commit is contained in:
@@ -3,11 +3,11 @@ pragma solidity ^0.8.28;
|
|||||||
|
|
||||||
import "@uniswap-v2/contracts/interfaces/IUniswapV2Pair.sol";
|
import "@uniswap-v2/contracts/interfaces/IUniswapV2Pair.sol";
|
||||||
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
||||||
import {ISwapExecutor} from "../interfaces/ISwapExecutor.sol";
|
import {IExecutor} from "../interfaces/IExecutor.sol";
|
||||||
|
|
||||||
error UniswapV2Executor__InvalidDataLength();
|
error UniswapV2Executor__InvalidDataLength();
|
||||||
|
|
||||||
contract UniswapV2SwapExecutor is ISwapExecutor {
|
contract UniswapV2Executor is IExecutor {
|
||||||
using SafeERC20 for IERC20;
|
using SafeERC20 for IERC20;
|
||||||
|
|
||||||
function swap(uint256 givenAmount, bytes calldata data)
|
function swap(uint256 givenAmount, bytes calldata data)
|
||||||
@@ -5,7 +5,7 @@ import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|||||||
|
|
||||||
pragma abicoder v2;
|
pragma abicoder v2;
|
||||||
|
|
||||||
interface ISwapExecutor {
|
interface IExecutor {
|
||||||
/**
|
/**
|
||||||
* @notice Performs a swap on a liquidity pool.
|
* @notice Performs a swap on a liquidity pool.
|
||||||
* @dev This method can either take the amount of the input token or the amount
|
* @dev This method can either take the amount of the input token or the amount
|
||||||
@@ -31,7 +31,7 @@ interface ISwapExecutor {
|
|||||||
returns (uint256 calculatedAmount);
|
returns (uint256 calculatedAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ISwapExecutorErrors {
|
interface IExecutorErrors {
|
||||||
error InvalidParameterLength(uint256);
|
error InvalidParameterLength(uint256);
|
||||||
error UnknownCurveType(uint8);
|
error UnknownCurveType(uint8);
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
// SPDX-License-Identifier: UNLICENSED
|
// SPDX-License-Identifier: UNLICENSED
|
||||||
pragma solidity ^0.8.28;
|
pragma solidity ^0.8.28;
|
||||||
|
|
||||||
import "@src/executors/Uniswapv2SwapExecutor.sol";
|
import "@src/executors/UniswapV2Executor.sol";
|
||||||
import {Test} from "../../lib/forge-std/src/Test.sol";
|
import {Test} from "../../lib/forge-std/src/Test.sol";
|
||||||
import {Constants} from "../Constants.sol";
|
import {Constants} from "../Constants.sol";
|
||||||
|
|
||||||
contract UniswapV2SwapExecutorExposed is UniswapV2SwapExecutor {
|
contract UniswapV2ExecutorExposed is UniswapV2Executor {
|
||||||
function decodeParams(bytes calldata data)
|
function decodeParams(bytes calldata data)
|
||||||
external
|
external
|
||||||
pure
|
pure
|
||||||
@@ -28,14 +28,10 @@ contract UniswapV2SwapExecutorExposed is UniswapV2SwapExecutor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
contract UniswapV2SwapExecutorTest is
|
contract UniswapV2ExecutorTest is UniswapV2ExecutorExposed, Test, Constants {
|
||||||
UniswapV2SwapExecutorExposed,
|
|
||||||
Test,
|
|
||||||
Constants
|
|
||||||
{
|
|
||||||
using SafeERC20 for IERC20;
|
using SafeERC20 for IERC20;
|
||||||
|
|
||||||
UniswapV2SwapExecutorExposed uniswapV2Exposed;
|
UniswapV2ExecutorExposed uniswapV2Exposed;
|
||||||
IERC20 WETH = IERC20(WETH_ADDR);
|
IERC20 WETH = IERC20(WETH_ADDR);
|
||||||
IERC20 DAI = IERC20(DAI_ADDR);
|
IERC20 DAI = IERC20(DAI_ADDR);
|
||||||
address WETH_DAI_POOL = 0xA478c2975Ab1Ea89e8196811F51A7B7Ade33eB11;
|
address WETH_DAI_POOL = 0xA478c2975Ab1Ea89e8196811F51A7B7Ade33eB11;
|
||||||
@@ -43,7 +39,7 @@ contract UniswapV2SwapExecutorTest is
|
|||||||
function setUp() public {
|
function setUp() public {
|
||||||
uint256 forkBlock = 17323404;
|
uint256 forkBlock = 17323404;
|
||||||
vm.createSelectFork(vm.rpcUrl("mainnet"), forkBlock);
|
vm.createSelectFork(vm.rpcUrl("mainnet"), forkBlock);
|
||||||
uniswapV2Exposed = new UniswapV2SwapExecutorExposed();
|
uniswapV2Exposed = new UniswapV2ExecutorExposed();
|
||||||
}
|
}
|
||||||
|
|
||||||
function testDecodeParams() public view {
|
function testDecodeParams() public view {
|
||||||
Reference in New Issue
Block a user