chore(adapters): Address PR review
keep mock data as empty bytes
This commit is contained in:
@@ -60,7 +60,7 @@ contract IntegralSwapAdapter is ISwapAdapter {
|
||||
address buyToken,
|
||||
OrderSide side,
|
||||
uint256 specifiedAmount,
|
||||
bytes32 data
|
||||
bytes32
|
||||
) external override returns (Trade memory trade) {
|
||||
if (specifiedAmount == 0) {
|
||||
return trade;
|
||||
|
||||
@@ -10,7 +10,7 @@ import "src/libraries/FractionMath.sol";
|
||||
contract AdapterTest is Test, ISwapAdapterTypes {
|
||||
using FractionMath for Fraction;
|
||||
|
||||
bytes32 mockData = bytes32(abi.encodePacked(false));
|
||||
bytes32 mockData;
|
||||
uint256 constant pricePrecision = 10e24;
|
||||
string[] public stringPctgs = ["0%", "0.1%", "50%", "100%"];
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ contract AngleAdapterTest is Test, ISwapAdapterTypes {
|
||||
ITransmuter(0x00253582b2a3FE112feEC532221d9708c64cEFAb);
|
||||
|
||||
uint256 constant TEST_ITERATIONS = 100;
|
||||
bytes32 mockData = bytes32(abi.encodePacked(false));
|
||||
bytes32 mockData;
|
||||
|
||||
function setUp() public {
|
||||
uint256 forkBlock = 18921770;
|
||||
@@ -179,19 +179,20 @@ contract AngleAdapterTest is Test, ISwapAdapterTypes {
|
||||
|
||||
function testGetCapabilitiesAngle(bytes32 pair, address t0, address t1)
|
||||
public
|
||||
view
|
||||
{
|
||||
Capability[] memory res = adapter.getCapabilities(pair, t0, t1);
|
||||
|
||||
assertEq(res.length, 2);
|
||||
}
|
||||
|
||||
function testGetTokensAngle() public {
|
||||
function testGetTokensAngle() public view {
|
||||
address[] memory tokens = adapter.getTokens(bytes32(0));
|
||||
|
||||
assertGe(tokens.length, 2);
|
||||
}
|
||||
|
||||
function testGetLimitsAngle() public {
|
||||
function testGetLimitsAngle() public view {
|
||||
bytes32 pair = bytes32(0);
|
||||
uint256[] memory limits =
|
||||
adapter.getLimits(pair, address(agEUR), address(EURC));
|
||||
|
||||
@@ -12,6 +12,7 @@ import {FractionMath} from "src/libraries/FractionMath.sol";
|
||||
contract BalancerV2SwapAdapterTest is AdapterTest {
|
||||
using FractionMath for Fraction;
|
||||
|
||||
bytes32 mockBoolData = bytes32(abi.encode(false));
|
||||
IVault constant balancerV2Vault =
|
||||
IVault(payable(0xBA12222222228d8Ba445958a75a0704d566BF2C8));
|
||||
BalancerV2SwapAdapter adapter;
|
||||
@@ -111,7 +112,12 @@ contract BalancerV2SwapAdapterTest is AdapterTest {
|
||||
uint256 weth_balance = IERC20(WETH).balanceOf(address(this));
|
||||
|
||||
Trade memory trade = adapter.swap(
|
||||
B_80BAL_20WETH_POOL_ID, BAL, WETH, side, specifiedAmount, mockData
|
||||
B_80BAL_20WETH_POOL_ID,
|
||||
BAL,
|
||||
WETH,
|
||||
side,
|
||||
specifiedAmount,
|
||||
mockBoolData
|
||||
);
|
||||
|
||||
if (trade.calculatedAmount > 0) {
|
||||
@@ -154,7 +160,7 @@ contract BalancerV2SwapAdapterTest is AdapterTest {
|
||||
WETH,
|
||||
OrderSide.Sell,
|
||||
amounts[i],
|
||||
mockData
|
||||
mockBoolData
|
||||
);
|
||||
|
||||
vm.revertTo(beforeSwap);
|
||||
@@ -190,7 +196,7 @@ contract BalancerV2SwapAdapterTest is AdapterTest {
|
||||
WETH,
|
||||
OrderSide.Buy,
|
||||
amounts[i],
|
||||
mockData
|
||||
mockBoolData
|
||||
);
|
||||
|
||||
vm.revertTo(beforeSwap);
|
||||
@@ -214,6 +220,7 @@ contract BalancerV2SwapAdapterTest is AdapterTest {
|
||||
|
||||
function testGetCapabilitiesFuzz(bytes32 pool, address t0, address t1)
|
||||
public
|
||||
view
|
||||
{
|
||||
Capability[] memory res = adapter.getCapabilities(pool, t0, t1);
|
||||
|
||||
@@ -224,7 +231,7 @@ contract BalancerV2SwapAdapterTest is AdapterTest {
|
||||
assertEq(uint256(res[3]), uint256(Capability.HardLimits));
|
||||
}
|
||||
|
||||
function testGetTokens() public {
|
||||
function testGetTokens() public view {
|
||||
address[] memory tokens = adapter.getTokens(B_80BAL_20WETH_POOL_ID);
|
||||
|
||||
assertEq(tokens[0], BAL);
|
||||
|
||||
@@ -15,7 +15,7 @@ contract EtherfiAdapterTest is Test, ISwapAdapterTypes {
|
||||
IeEth eEth;
|
||||
|
||||
uint256 constant TEST_ITERATIONS = 100;
|
||||
bytes32 mockData = bytes32(abi.encodePacked(false));
|
||||
bytes32 mockData;
|
||||
|
||||
function setUp() public {
|
||||
uint256 forkBlock = 19218495;
|
||||
@@ -404,6 +404,7 @@ contract EtherfiAdapterTest is Test, ISwapAdapterTypes {
|
||||
|
||||
function testGetCapabilitiesEtherfi(bytes32 pair, address t0, address t1)
|
||||
public
|
||||
view
|
||||
{
|
||||
Capability[] memory res =
|
||||
adapter.getCapabilities(pair, address(t0), address(t1));
|
||||
@@ -411,14 +412,14 @@ contract EtherfiAdapterTest is Test, ISwapAdapterTypes {
|
||||
assertEq(res.length, 3);
|
||||
}
|
||||
|
||||
function testGetTokensEtherfi() public {
|
||||
function testGetTokensEtherfi() public view {
|
||||
bytes32 pair = bytes32(0);
|
||||
address[] memory tokens = adapter.getTokens(pair);
|
||||
|
||||
assertEq(tokens.length, 3);
|
||||
}
|
||||
|
||||
function testGetLimitsEtherfi() public {
|
||||
function testGetLimitsEtherfi() public view {
|
||||
bytes32 pair = bytes32(0);
|
||||
uint256[] memory limits =
|
||||
adapter.getLimits(pair, address(eEth), address(weEth));
|
||||
|
||||
@@ -16,7 +16,7 @@ contract IntegralSwapAdapterTest is Test, ISwapAdapterTypes {
|
||||
address constant USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;
|
||||
address constant USDC_WETH_PAIR = 0x2fe16Dd18bba26e457B7dD2080d5674312b026a2;
|
||||
address constant relayerAddress = 0xd17b3c9784510E33cD5B87b490E79253BcD81e2E;
|
||||
bytes32 mockData = bytes32(abi.encodePacked(false));
|
||||
bytes32 mockData;
|
||||
|
||||
uint256 constant TEST_ITERATIONS = 100;
|
||||
|
||||
@@ -31,7 +31,10 @@ contract IntegralSwapAdapterTest is Test, ISwapAdapterTypes {
|
||||
vm.label(address(USDC_WETH_PAIR), "USDC_WETH_PAIR");
|
||||
}
|
||||
|
||||
function testPriceFuzzIntegral(uint256 amount0, uint256 amount1) public {
|
||||
function testPriceFuzzIntegral(uint256 amount0, uint256 amount1)
|
||||
public
|
||||
view
|
||||
{
|
||||
bytes32 pair = bytes32(bytes20(USDC_WETH_PAIR));
|
||||
uint256[] memory limits = adapter.getLimits(pair, USDC, WETH);
|
||||
vm.assume(amount0 < limits[0]);
|
||||
@@ -159,14 +162,14 @@ contract IntegralSwapAdapterTest is Test, ISwapAdapterTypes {
|
||||
assertEq(res.length, 4);
|
||||
}
|
||||
|
||||
function testGetTokensIntegral() public {
|
||||
function testGetTokensIntegral() public view {
|
||||
bytes32 pair = bytes32(bytes20(USDC_WETH_PAIR));
|
||||
address[] memory tokens = adapter.getTokens(pair);
|
||||
|
||||
assertEq(tokens.length, 2);
|
||||
}
|
||||
|
||||
function testGetLimitsIntegral() public {
|
||||
function testGetLimitsIntegral() public view {
|
||||
bytes32 pair = bytes32(bytes20(USDC_WETH_PAIR));
|
||||
uint256[] memory limits = adapter.getLimits(pair, USDC, WETH);
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ contract UniswapV2PairFunctionTest is AdapterTest {
|
||||
vm.label(USDC_WETH_PAIR, "USDC_WETH_PAIR");
|
||||
}
|
||||
|
||||
function testPriceFuzz(uint256 amount0, uint256 amount1) public {
|
||||
function testPriceFuzz(uint256 amount0, uint256 amount1) public view {
|
||||
bytes32 pair = bytes32(bytes20(USDC_WETH_PAIR));
|
||||
uint256[] memory limits = adapter.getLimits(pair, USDC, WETH);
|
||||
vm.assume(amount0 < limits[0]);
|
||||
@@ -47,7 +47,7 @@ contract UniswapV2PairFunctionTest is AdapterTest {
|
||||
}
|
||||
}
|
||||
|
||||
function testPriceDecreasing() public {
|
||||
function testPriceDecreasing() public view {
|
||||
bytes32 pair = bytes32(bytes20(USDC_WETH_PAIR));
|
||||
uint256[] memory amounts = new uint256[](TEST_ITERATIONS);
|
||||
|
||||
@@ -149,13 +149,16 @@ contract UniswapV2PairFunctionTest is AdapterTest {
|
||||
executeIncreasingSwaps(OrderSide.Buy);
|
||||
}
|
||||
|
||||
function testGetCapabilities(bytes32 pair, address t0, address t1) public {
|
||||
function testGetCapabilities(bytes32 pair, address t0, address t1)
|
||||
public
|
||||
view
|
||||
{
|
||||
Capability[] memory res = adapter.getCapabilities(pair, t0, t1);
|
||||
|
||||
assertEq(res.length, 4);
|
||||
}
|
||||
|
||||
function testGetLimits() public {
|
||||
function testGetLimits() public view {
|
||||
bytes32 pair = bytes32(bytes20(USDC_WETH_PAIR));
|
||||
uint256[] memory limits = adapter.getLimits(pair, USDC, WETH);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user