Skip to content

Commit 898df33

Browse files
committed
fix: remove all traces of swap service
1 parent 99e0ba1 commit 898df33

File tree

16 files changed

+852
-1787
lines changed

16 files changed

+852
-1787
lines changed

biome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.3.12/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/2.3.14/schema.json",
33
"extends": ["@gearbox-protocol/biome-config"],
44
"vcs": {
55
"enabled": true,

package.json

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,35 +21,33 @@
2121
"pino-pretty": "^13.1.3"
2222
},
2323
"devDependencies": {
24-
"@aws-sdk/client-s3": "^3.975.0",
25-
"@biomejs/biome": "^2.3.12",
24+
"@aws-sdk/client-s3": "^3.984.0",
25+
"@biomejs/biome": "^2.3.14",
2626
"@commander-js/extra-typings": "^14.0.0",
27-
"@commitlint/cli": "^20.3.1",
28-
"@commitlint/config-conventional": "^20.3.1",
29-
"@gearbox-protocol/biome-config": "^1.0.18",
30-
"@gearbox-protocol/cli-utils": "^5.69.1",
27+
"@commitlint/cli": "^20.4.1",
28+
"@commitlint/config-conventional": "^20.4.1",
29+
"@gearbox-protocol/biome-config": "^1.0.20",
30+
"@gearbox-protocol/cli-utils": "^5.69.3",
3131
"@gearbox-protocol/liquidator-contracts": "^1.36.0-experimental.67",
3232
"@gearbox-protocol/liquidator-v2-contracts": "^2.4.0",
33-
"@gearbox-protocol/sdk": "12.5.3",
33+
"@gearbox-protocol/sdk": "12.6.6",
3434
"@gearbox-protocol/types": "^1.14.8",
35-
"@types/node": "^25.0.10",
36-
"@uniswap/sdk-core": "^7.10.1",
37-
"@uniswap/v3-sdk": "^3.27.0",
35+
"@types/node": "^25.2.1",
3836
"@vlad-yakovlev/telegram-md": "^2.1.0",
3937
"abitype": "^1.2.3",
40-
"axios": "^1.13.2",
38+
"axios": "^1.13.4",
4139
"axios-retry": "^4.5.0",
4240
"date-fns": "^4.1.0",
4341
"di-at-home": "^0.0.7",
44-
"esbuild": "^0.27.2",
42+
"esbuild": "^0.27.3",
4543
"husky": "^9.1.7",
4644
"lint-staged": "^16.2.7",
4745
"nanoid": "^5.1.6",
4846
"node-pty": "^1.1.0",
4947
"pino": "^10.3.0",
5048
"tsx": "4.21.0",
5149
"typescript": "^5.9.3",
52-
"viem": "^2.44.4",
50+
"viem": "^2.45.1",
5351
"vitest": "^4.0.18",
5452
"zod": "^4.3.6"
5553
},

src/Liquidator.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import type DeleverageService from "./services/DeleverageService.js";
99
import type HealthCheckerService from "./services/HealthCheckerService.js";
1010
import type { IOptimisticOutputWriter } from "./services/output/index.js";
1111
import type { Scanner } from "./services/Scanner.js";
12-
import type { ISwapper } from "./services/swap/index.js";
1312

1413
export default class Liquidator {
1514
@Logger("App")
@@ -36,16 +35,12 @@ export default class Liquidator {
3635
@DI.Inject(DI.Output)
3736
outputWriter!: IOptimisticOutputWriter;
3837

39-
@DI.Inject(DI.Swapper)
40-
swapper!: ISwapper;
41-
4238
#staleBlockInterval?: NodeJS.Timeout;
4339

4440
public async launch(): Promise<void> {
4541
await this.client.launch();
4642

4743
this.healthChecker.launch();
48-
await this.swapper.launch(this.config.network);
4944
await this.scanner.launch();
5045

5146
if (this.config.optimistic) {

src/config/common.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -322,27 +322,6 @@ export const CommonSchema = z.object({
322322
description: "List of assets to keep on account after liquidation",
323323
env: "KEEP_ASSETS",
324324
}),
325-
/**
326-
* Use this mechanism to swap underlying token to ETH after the liquidation (abandoned feature)
327-
*/
328-
swapToEth: z.enum(["1inch", "uniswap"]).optional().register(zommandRegistry, {
329-
flags: "--swap-to-eth <mode>",
330-
description:
331-
"Use this mechanism to swap underlying token to ETH after the liquidation (abandoned feature)",
332-
env: "SWAP_TO_ETH",
333-
}),
334-
/**
335-
* 1inch api key for swapper
336-
*/
337-
oneInchApiKey: z
338-
.string()
339-
.transform(CensoredString.transform)
340-
.optional()
341-
.register(zommandRegistry, {
342-
flags: "--one-inch-api-key <key>",
343-
description: "1inch API key for swapper",
344-
env: "ONE_INCH_API_KEY",
345-
}),
346325

347326
/**
348327
* Directory to save json with optimistic liquidation results

src/di.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const Injectables = {
1212
OptimisticResults: "OptimisticResults",
1313
Output: "Output",
1414
Scanner: "Scanner",
15-
Swapper: "Swapper",
1615
Transport: "Transport",
1716
Deleverage: "Deleverage",
1817
} as const;
@@ -33,7 +32,6 @@ export const DI = Object.assign(
3332
Output: [];
3433
Redstone: [];
3534
Scanner: [];
36-
Swapper: [];
3735
Transport: [];
3836
Deleverage: [];
3937
}>(),

src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import "./services/DeleverageService.js";
66
import "./services/liquidate/index.js";
77
import "./services/output/index.js";
88
import "./services/notifier/index.js";
9-
import "./services/swap/index.js";
109

1110
import { setTimeout } from "node:timers/promises";
1211

src/services/liquidate/AbstractLiquidator.ts

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import { Logger } from "../../log/index.js";
1515
import type Client from "../Client.js";
1616
import { ServiceStartedNotification } from "../notifier/index.js";
1717
import type { IOptimisticOutputWriter } from "../output/index.js";
18-
import type { ISwapper } from "../swap/index.js";
1918
import AccountHelper from "./AccountHelper.js";
2019
import type { OptimisticResults } from "./OptimisiticResults.js";
2120

@@ -42,9 +41,6 @@ export default abstract class AbstractLiquidator<
4241
@DI.Inject(DI.Output)
4342
outputWriter!: IOptimisticOutputWriter;
4443

45-
@DI.Inject(DI.Swapper)
46-
swapper!: ISwapper;
47-
4844
@DI.Inject(DI.OptimisticResults)
4945
optimistic!: OptimisticResults;
5046

@@ -86,19 +82,15 @@ export default abstract class AbstractLiquidator<
8682
protected async getExecutorBalance(
8783
underlyingToken: Address,
8884
): Promise<ExecutorBalance> {
89-
// TODO: is this needed?
90-
const isWeth = this.sdk.tokensMeta.symbol(underlyingToken) === "WETH";
9185
const eth = await this.client.pub.getBalance({
9286
address: this.client.address,
9387
});
94-
const underlying = isWeth
95-
? eth
96-
: await this.client.pub.readContract({
97-
address: underlyingToken,
98-
abi: erc20Abi,
99-
functionName: "balanceOf",
100-
args: [this.client.address],
101-
});
88+
const underlying = await this.client.pub.readContract({
89+
address: underlyingToken,
90+
abi: erc20Abi,
91+
functionName: "balanceOf",
92+
args: [this.client.address],
93+
});
10294
return { eth, underlying };
10395
}
10496

src/services/liquidate/SingularLiquidator.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,10 +337,6 @@ export default class SingularLiquidator
337337
);
338338
}
339339
result.state = ca;
340-
// await this.swapper.swap(
341-
// acc.underlying,
342-
// balanceBefore.underlying + result.liquidatorPremium,
343-
// );
344340
result.balancesAfter = await this.getExecutorBalance(acc.underlying);
345341
} catch (e) {
346342
logger.error(e, "strategy failed");

src/services/swap/base.ts

Lines changed: 0 additions & 62 deletions
This file was deleted.

src/services/swap/factory.ts

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)