Skip to content

Commit c88ecd5

Browse files
committed
add tests for singleAssetCalldata functions
1 parent 0b475d5 commit c88ecd5

File tree

2 files changed

+58
-2
lines changed

2 files changed

+58
-2
lines changed

contracts/protocol/integration/amm/ArrakisUniswapV3AmmAdapter.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ contract ArrakisUniswapV3AmmAdapter is IAmmAdapter {
127127
override
128128
returns (address /*target*/, uint256 /*value*/, bytes memory /*data*/)
129129
{
130-
revert("Uniswap V3 single asset addition is not supported");
130+
revert("Arrakis single asset addition is not supported");
131131
}
132132

133133
/**
@@ -188,7 +188,7 @@ contract ArrakisUniswapV3AmmAdapter is IAmmAdapter {
188188
override
189189
returns (address /*target*/, uint256 /*value*/, bytes memory /*data*/)
190190
{
191-
revert("Uniswap V3 single asset removal is not supported");
191+
revert("Arrakis single asset removal is not supported");
192192
}
193193

194194
/**

test/protocol/integration/amm/ArrakisUniswapV3AmmAdapter.spec.ts

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import "module-alias/register";
2+
import { BigNumber } from "ethers";
3+
import { ether } from "@utils/index";
24
import { Account } from "@utils/test/types";
35
import { Address } from "@utils/types";
46
import { AmmModule, ArrakisUniswapV3AmmAdapter } from "@utils/contracts";
@@ -184,4 +186,58 @@ describe("ArrakisUniswapV3AmmAdapter", () => {
184186

185187
});
186188

189+
describe("getProvideLiquiditySingleAssetCalldata", async () => {
190+
let subjectAmmPool: Address;
191+
let subjectComponent: Address;
192+
let subjectMaxTokenIn: BigNumber;
193+
let subjectMinLiquidity: BigNumber;
194+
195+
before(async () => {
196+
subjectAmmPool = arrakisV1Setup.wethDaiPool.address;
197+
subjectComponent = setup.weth.address;
198+
subjectMaxTokenIn = ether(1);
199+
subjectMinLiquidity = ether(1);
200+
});
201+
202+
async function subject(): Promise<any> {
203+
return await arrakisUniswapV3AmmAdapter.getProvideLiquiditySingleAssetCalldata(
204+
owner.address,
205+
subjectAmmPool,
206+
subjectComponent,
207+
subjectMaxTokenIn,
208+
subjectMinLiquidity);
209+
}
210+
211+
it("should revert", async () => {
212+
await expect(subject()).to.be.revertedWith("Arrakis single asset addition is not supported");
213+
});
214+
});
215+
216+
describe("getRemoveLiquiditySingleAssetCalldata", async () => {
217+
let subjectAmmPool: Address;
218+
let subjectComponent: Address;
219+
let subjectMinTokenOut: BigNumber;
220+
let subjectLiquidity: BigNumber;
221+
222+
before(async () => {
223+
subjectAmmPool = uniswapV3Setup.wethDaiPool.address;
224+
subjectComponent = setup.weth.address;
225+
subjectMinTokenOut = ether(1);
226+
subjectLiquidity = ether(1);
227+
});
228+
229+
async function subject(): Promise<any> {
230+
return await arrakisUniswapV3AmmAdapter.getRemoveLiquiditySingleAssetCalldata(
231+
owner.address,
232+
subjectAmmPool,
233+
subjectComponent,
234+
subjectMinTokenOut,
235+
subjectLiquidity);
236+
}
237+
238+
it("should revert", async () => {
239+
await expect(subject()).to.be.revertedWith("Arrakis single asset removal is not supported");
240+
});
241+
});
242+
187243
});

0 commit comments

Comments
 (0)