Skip to content

Commit 6a7bb40

Browse files
committed
style: formatted spec file with prettier eslint
1 parent 5e51ada commit 6a7bb40

File tree

1 file changed

+53
-37
lines changed

1 file changed

+53
-37
lines changed

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

Lines changed: 53 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ import { BigNumber } from "ethers";
33
import { ether } from "@utils/index";
44
import { Account } from "@utils/test/types";
55
import { Address } from "@utils/types";
6-
import {
7-
ZERO,
8-
} from "@utils/constants";
6+
import { ZERO } from "@utils/constants";
97
import { ArrakisUniswapV3AmmAdapter } from "@utils/contracts";
108
import DeployHelper from "@utils/deploys";
119
import {
@@ -14,7 +12,7 @@ import {
1412
getSystemFixture,
1513
getUniswapV3Fixture,
1614
getArrakisV1Fixture,
17-
getWaffleExpect
15+
getWaffleExpect,
1816
} from "@utils/test/index";
1917

2018
import { SystemFixture, UniswapV3Fixture, ArrakisV1Fixture } from "@utils/fixtures";
@@ -30,30 +28,29 @@ describe("ArrakisUniswapV3AmmAdapter", () => {
3028
let arrakisUniswapV3AmmAdapter: ArrakisUniswapV3AmmAdapter;
3129

3230
before(async () => {
33-
[
34-
owner,
35-
] = await getAccounts();
31+
[owner] = await getAccounts();
3632

3733
deployer = new DeployHelper(owner.wallet);
3834
setup = getSystemFixture(owner.address);
3935
await setup.initialize();
4036

4137
uniswapV3Setup = getUniswapV3Fixture(owner.address);
42-
await uniswapV3Setup.initialize(
38+
await uniswapV3Setup.initialize(owner, setup.weth, 2500, setup.wbtc, 35000, setup.dai);
39+
40+
arrakisV1Setup = getArrakisV1Fixture(owner.address);
41+
await arrakisV1Setup.initialize(
4342
owner,
43+
uniswapV3Setup,
4444
setup.weth,
4545
2500,
4646
setup.wbtc,
4747
35000,
48-
setup.dai
48+
setup.dai,
4949
);
5050

51-
arrakisV1Setup = getArrakisV1Fixture(owner.address);
52-
await arrakisV1Setup.initialize(owner, uniswapV3Setup, setup.weth, 2500, setup.wbtc, 35000, setup.dai);
53-
5451
arrakisUniswapV3AmmAdapter = await deployer.adapters.deployArrakisUniswapV3AmmAdapter(
5552
arrakisV1Setup.router.address,
56-
uniswapV3Setup.factory.address
53+
uniswapV3Setup.factory.address,
5754
);
5855
});
5956

@@ -63,7 +60,7 @@ describe("ArrakisUniswapV3AmmAdapter", () => {
6360
async function subject(): Promise<ArrakisUniswapV3AmmAdapter> {
6461
return await deployer.adapters.deployArrakisUniswapV3AmmAdapter(
6562
arrakisV1Setup.router.address,
66-
uniswapV3Setup.factory.address
63+
uniswapV3Setup.factory.address,
6764
);
6865
}
6966

@@ -160,7 +157,6 @@ describe("ArrakisUniswapV3AmmAdapter", () => {
160157
expect(status).to.be.false;
161158
});
162159
});
163-
164160
});
165161

166162
describe("getProvideLiquiditySingleAssetCalldata", async () => {
@@ -182,7 +178,8 @@ describe("ArrakisUniswapV3AmmAdapter", () => {
182178
subjectAmmPool,
183179
subjectComponent,
184180
subjectMaxTokenIn,
185-
subjectMinLiquidity);
181+
subjectMinLiquidity,
182+
);
186183
}
187184

188185
it("should revert", async () => {
@@ -209,7 +206,8 @@ describe("ArrakisUniswapV3AmmAdapter", () => {
209206
subjectAmmPool,
210207
subjectComponent,
211208
subjectMinTokenOut,
212-
subjectLiquidity);
209+
subjectLiquidity,
210+
);
213211
}
214212

215213
it("should revert", async () => {
@@ -231,9 +229,12 @@ describe("ArrakisUniswapV3AmmAdapter", () => {
231229
setup.weth.address,
232230
setup.dai.address,
233231
subjectMaxTokensIn[0],
234-
subjectMaxTokensIn[1]
232+
subjectMaxTokensIn[1],
233+
);
234+
const mintAmount = await arrakisV1Setup.wethDaiPool.getMintAmounts(
235+
orderedMaxTokensIn[0],
236+
orderedMaxTokensIn[1],
235237
);
236-
const mintAmount = await arrakisV1Setup.wethDaiPool.getMintAmounts(orderedMaxTokensIn[0], orderedMaxTokensIn[1]);
237238
subjectMinLiquidity = mintAmount[2];
238239
});
239240

@@ -243,7 +244,8 @@ describe("ArrakisUniswapV3AmmAdapter", () => {
243244
subjectAmmPool,
244245
subjectComponents,
245246
subjectMaxTokensIn,
246-
subjectMinLiquidity);
247+
subjectMinLiquidity,
248+
);
247249
}
248250

249251
it("should return the correct provide liquidity calldata", async () => {
@@ -254,9 +256,12 @@ describe("ArrakisUniswapV3AmmAdapter", () => {
254256
setup.weth.address,
255257
setup.dai.address,
256258
subjectMaxTokensIn[0],
257-
subjectMaxTokensIn[1]
259+
subjectMaxTokensIn[1],
260+
);
261+
const mintAmount = await arrakisV1Setup.wethDaiPool.getMintAmounts(
262+
orderedMaxTokensIn[0],
263+
orderedMaxTokensIn[1],
258264
);
259-
const mintAmount = await arrakisV1Setup.wethDaiPool.getMintAmounts(orderedMaxTokensIn[0], orderedMaxTokensIn[1]);
260265
const amountAMin = mintAmount[0];
261266
const amountBMin = mintAmount[1];
262267

@@ -266,9 +271,11 @@ describe("ArrakisUniswapV3AmmAdapter", () => {
266271
orderedMaxTokensIn[1],
267272
amountAMin,
268273
amountBMin,
269-
owner.address
274+
owner.address,
270275
]);
271-
expect(JSON.stringify(calldata)).to.eq(JSON.stringify([arrakisV1Setup.router.address, ZERO, expectedCallData]));
276+
expect(JSON.stringify(calldata)).to.eq(
277+
JSON.stringify([arrakisV1Setup.router.address, ZERO, expectedCallData]),
278+
);
272279
});
273280

274281
describe("when the either of the _maxTokensIn is zero", async () => {
@@ -287,7 +294,9 @@ describe("ArrakisUniswapV3AmmAdapter", () => {
287294
});
288295

289296
it("should revert", async () => {
290-
await expect(subject()).to.be.revertedWith("_minLiquidity is too high for input token limit");
297+
await expect(subject()).to.be.revertedWith(
298+
"_minLiquidity is too high for input token limit",
299+
);
291300
});
292301
});
293302
});
@@ -311,7 +320,8 @@ describe("ArrakisUniswapV3AmmAdapter", () => {
311320
subjectAmmPool,
312321
subjectComponents,
313322
subjectMinTokensOut,
314-
subjectLiquidity);
323+
subjectLiquidity,
324+
);
315325
}
316326

317327
it("should return the correct remove liquidity calldata", async () => {
@@ -320,27 +330,33 @@ describe("ArrakisUniswapV3AmmAdapter", () => {
320330
setup.weth.address,
321331
setup.dai.address,
322332
subjectMinTokensOut[0],
323-
subjectMinTokensOut[1]
333+
subjectMinTokensOut[1],
334+
);
335+
const expectedCallData = arrakisV1Setup.router.interface.encodeFunctionData(
336+
"removeLiquidity",
337+
[
338+
subjectAmmPool,
339+
subjectLiquidity,
340+
orderedMinTokensOut[0],
341+
orderedMinTokensOut[1],
342+
owner.address,
343+
],
344+
);
345+
expect(JSON.stringify(calldata)).to.eq(
346+
JSON.stringify([arrakisV1Setup.router.address, ZERO, expectedCallData]),
324347
);
325-
const expectedCallData = arrakisV1Setup.router.interface.encodeFunctionData("removeLiquidity", [
326-
subjectAmmPool,
327-
subjectLiquidity,
328-
orderedMinTokensOut[0],
329-
orderedMinTokensOut[1],
330-
owner.address
331-
]);
332-
expect(JSON.stringify(calldata)).to.eq(JSON.stringify([arrakisV1Setup.router.address, ZERO, expectedCallData]));
333348
});
334349

335350
describe("when the _liquidity is more than available", async () => {
336351
beforeEach(async () => {
337-
subjectLiquidity = (await arrakisV1Setup.wethDaiPool.balanceOf(owner.address)).add(ether(1));
352+
subjectLiquidity = (await arrakisV1Setup.wethDaiPool.balanceOf(owner.address)).add(
353+
ether(1),
354+
);
338355
});
339356

340357
it("should revert", async () => {
341358
await expect(subject()).to.be.revertedWith("_liquidity must be <= to current balance");
342359
});
343360
});
344361
});
345-
346362
});

0 commit comments

Comments
 (0)