Skip to content

Commit f16823d

Browse files
committed
fix: update deleverage scanner
1 parent 199050e commit f16823d

File tree

3 files changed

+65
-55
lines changed

3 files changed

+65
-55
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@
2626
"@commitlint/cli": "^19.8.1",
2727
"@commitlint/config-conventional": "^19.8.1",
2828
"@gearbox-protocol/biome-config": "^1.0.0",
29-
"@gearbox-protocol/cli-utils": "^5.39.1",
29+
"@gearbox-protocol/cli-utils": "^5.39.3",
3030
"@gearbox-protocol/liquidator-v2-contracts": "^2.4.0",
3131
"@gearbox-protocol/next-contracts": "npm:@gearbox-protocol/liquidator-v2-contracts@2.5.0-next.4",
32-
"@gearbox-protocol/sdk": "8.10.1",
32+
"@gearbox-protocol/sdk": "8.12.0",
3333
"@gearbox-protocol/types": "^1.14.8",
3434
"@types/node": "^24.1.0",
3535
"@uniswap/sdk-core": "^7.7.2",
3636
"@uniswap/v3-sdk": "^3.25.2",
3737
"@vlad-yakovlev/telegram-md": "^2.1.0",
3838
"abitype": "^1.0.8",
39-
"axios": "^1.10.0",
39+
"axios": "^1.11.0",
4040
"axios-retry": "^4.5.0",
4141
"date-fns": "^4.1.0",
4242
"di-at-home": "^0.0.7",

src/services/Scanner.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,11 @@ export class Scanner {
170170
}
171171

172172
if (this.config.liquidationMode === "deleverage") {
173-
const before = accounts.length;
174173
accounts = await this.#filterDeleverageAccounts(
175174
accounts,
176175
this.config.partialLiquidationBot,
177176
blockNumber,
178177
);
179-
this.log.debug(
180-
`filtered out ${before - accounts.length} non-deleveragable accounts`,
181-
);
182178
}
183179

184180
const time = Math.round((Date.now() - start) / 1000);
@@ -277,11 +273,18 @@ export class Scanner {
277273
partialLiquidationBot: Address,
278274
blockNumber?: bigint,
279275
): Promise<CreditAccountData[]> {
276+
const botList = this.caService.sdk.botListContract?.address;
277+
if (!botList) {
278+
this.log.warn(
279+
"bot list contract not found, skipping deleverage accounts filtering",
280+
);
281+
return accounts;
282+
}
280283
const res = await this.client.pub.multicall({
281284
contracts: accounts.map(
282285
ca =>
283286
({
284-
address: ca.creditAccount,
287+
address: botList,
285288
abi: iBotListV310Abi,
286289
functionName: "getBotStatus",
287290
args: [partialLiquidationBot, ca.creditAccount],
@@ -291,13 +294,20 @@ export class Scanner {
291294
blockNumber,
292295
});
293296
const result: CreditAccountData[] = [];
297+
let errored = 0;
294298
for (let i = 0; i < accounts.length; i++) {
295299
const ca = accounts[i];
296300
const r = res[i];
297301
if (r.status === "success" && !r.result[1]) {
298302
result.push(ca);
303+
} else if (r.status === "failure") {
304+
errored++;
299305
}
300306
}
307+
this.log.debug(
308+
{ errored, before: accounts.length, after: result.length, botList },
309+
"filtered accounts for deleverage",
310+
);
301311
return result;
302312
}
303313

yarn.lock

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1728,9 +1728,9 @@ __metadata:
17281728
languageName: node
17291729
linkType: hard
17301730

1731-
"@gearbox-protocol/cli-utils@npm:^5.39.1":
1732-
version: 5.39.1
1733-
resolution: "@gearbox-protocol/cli-utils@npm:5.39.1"
1731+
"@gearbox-protocol/cli-utils@npm:^5.39.3":
1732+
version: 5.39.3
1733+
resolution: "@gearbox-protocol/cli-utils@npm:5.39.3"
17341734
dependencies:
17351735
"@aws-sdk/client-secrets-manager": "npm:^3.848.0"
17361736
"@aws-sdk/client-ssm": "npm:^3.849.0"
@@ -1739,7 +1739,7 @@ __metadata:
17391739
lodash-es: "npm:^4.17.21"
17401740
yaml: "npm:^2.8.0"
17411741
zod: "npm:^4.0.5"
1742-
checksum: 10c0/7e6e50ac3243efd14bdbe1b091a004b563e85186b821c7bfc612357e55ed5a6869b08baf1fbbc4ee64e31a43d339ec207888cee4ee3c1998da975f0832def74e
1742+
checksum: 10c0/343e78c4e0dcb0ffee986ab983a119f6618169cef1191ca85bf02cdf6fda41e235975c66f0782ae62e0bf22f39a7a20c49501d40ab33656b0e4ad75a1439843f
17431743
languageName: node
17441744
linkType: hard
17451745

@@ -1760,17 +1760,17 @@ __metadata:
17601760
"@commitlint/cli": "npm:^19.8.1"
17611761
"@commitlint/config-conventional": "npm:^19.8.1"
17621762
"@gearbox-protocol/biome-config": "npm:^1.0.0"
1763-
"@gearbox-protocol/cli-utils": "npm:^5.39.1"
1763+
"@gearbox-protocol/cli-utils": "npm:^5.39.3"
17641764
"@gearbox-protocol/liquidator-v2-contracts": "npm:^2.4.0"
17651765
"@gearbox-protocol/next-contracts": "npm:@gearbox-protocol/liquidator-v2-contracts@2.5.0-next.4"
1766-
"@gearbox-protocol/sdk": "npm:8.10.1"
1766+
"@gearbox-protocol/sdk": "npm:8.12.0"
17671767
"@gearbox-protocol/types": "npm:^1.14.8"
17681768
"@types/node": "npm:^24.1.0"
17691769
"@uniswap/sdk-core": "npm:^7.7.2"
17701770
"@uniswap/v3-sdk": "npm:^3.25.2"
17711771
"@vlad-yakovlev/telegram-md": "npm:^2.1.0"
17721772
abitype: "npm:^1.0.8"
1773-
axios: "npm:^1.10.0"
1773+
axios: "npm:^1.11.0"
17741774
axios-retry: "npm:^4.5.0"
17751775
date-fns: "npm:^4.1.0"
17761776
di-at-home: "npm:^0.0.7"
@@ -1796,9 +1796,9 @@ __metadata:
17961796
languageName: node
17971797
linkType: hard
17981798

1799-
"@gearbox-protocol/sdk@npm:8.10.1":
1800-
version: 8.10.1
1801-
resolution: "@gearbox-protocol/sdk@npm:8.10.1"
1799+
"@gearbox-protocol/sdk@npm:8.12.0":
1800+
version: 8.12.0
1801+
resolution: "@gearbox-protocol/sdk@npm:8.12.0"
18021802
dependencies:
18031803
"@redstone-finance/evm-connector": "npm:^0.7.5"
18041804
"@redstone-finance/protocol": "npm:^0.7.5"
@@ -1812,7 +1812,7 @@ __metadata:
18121812
zod: "npm:^4.0.5"
18131813
peerDependencies:
18141814
axios: ^1.0.0
1815-
checksum: 10c0/35b7ae58ecc52c3999a38a9fc41a5a55e0ccd0c6b351531f9d44e1baa0a2707a2b98552b2b272ecfe9315e2542f72c991420a4fe91a7235c7e187d612391387c
1815+
checksum: 10c0/99d077327765b04dcea85cf405b8ecdbb67a74df6d8a49cc204d12e3324c4f8d7adb74f9a0c6fcec358311c9efbfb47c58a0223eee0517a57e9f9d5ca831a11e
18161816
languageName: node
18171817
linkType: hard
18181818

@@ -2234,9 +2234,9 @@ __metadata:
22342234
languageName: node
22352235
linkType: hard
22362236

2237-
"@smithy/core@npm:^3.7.0, @smithy/core@npm:^3.7.1":
2238-
version: 3.7.1
2239-
resolution: "@smithy/core@npm:3.7.1"
2237+
"@smithy/core@npm:^3.7.0, @smithy/core@npm:^3.7.2":
2238+
version: 3.7.2
2239+
resolution: "@smithy/core@npm:3.7.2"
22402240
dependencies:
22412241
"@smithy/middleware-serde": "npm:^4.0.8"
22422242
"@smithy/protocol-http": "npm:^5.1.2"
@@ -2247,7 +2247,7 @@ __metadata:
22472247
"@smithy/util-stream": "npm:^4.2.3"
22482248
"@smithy/util-utf8": "npm:^4.0.0"
22492249
tslib: "npm:^2.6.2"
2250-
checksum: 10c0/3828f48b776a50ee58896fd8fdcd2ae28e2142114118b5ee78892c6e40f74c63f7dbb39199a324f9858d87ca3362e72563e47ddd81c38895da070c9503325405
2250+
checksum: 10c0/469e15f0438a6b24485610f088570729045fbe8888586e4d060fed41a5fb6e180c28124b85f2aa6119fa82cdd09cc4ea05df0674a01ac279c70162a9a9a847fe
22512251
languageName: node
22522252
linkType: hard
22532253

@@ -2417,36 +2417,36 @@ __metadata:
24172417
languageName: node
24182418
linkType: hard
24192419

2420-
"@smithy/middleware-endpoint@npm:^4.1.15, @smithy/middleware-endpoint@npm:^4.1.16":
2421-
version: 4.1.16
2422-
resolution: "@smithy/middleware-endpoint@npm:4.1.16"
2420+
"@smithy/middleware-endpoint@npm:^4.1.15, @smithy/middleware-endpoint@npm:^4.1.17":
2421+
version: 4.1.17
2422+
resolution: "@smithy/middleware-endpoint@npm:4.1.17"
24232423
dependencies:
2424-
"@smithy/core": "npm:^3.7.1"
2424+
"@smithy/core": "npm:^3.7.2"
24252425
"@smithy/middleware-serde": "npm:^4.0.8"
24262426
"@smithy/node-config-provider": "npm:^4.1.3"
24272427
"@smithy/shared-ini-file-loader": "npm:^4.0.4"
24282428
"@smithy/types": "npm:^4.3.1"
24292429
"@smithy/url-parser": "npm:^4.0.4"
24302430
"@smithy/util-middleware": "npm:^4.0.4"
24312431
tslib: "npm:^2.6.2"
2432-
checksum: 10c0/9f19d65ec1ed88e6a7a214821087286304199bbc613b157cca9dd7eab12f3ab6554fb38b9681759c75285210b21b4cc1527add1eafd46f9f5bfb8ca5679eebeb
2432+
checksum: 10c0/08e0e3542a9be373c5cbb18e54c756e8d0750138fb2f3d011e00094905175af2ecf8004d2ee2de1382b0fa5734b0393ba76e533c71929390338bcd86d9d33f72
24332433
languageName: node
24342434
linkType: hard
24352435

24362436
"@smithy/middleware-retry@npm:^4.1.16":
2437-
version: 4.1.17
2438-
resolution: "@smithy/middleware-retry@npm:4.1.17"
2437+
version: 4.1.18
2438+
resolution: "@smithy/middleware-retry@npm:4.1.18"
24392439
dependencies:
24402440
"@smithy/node-config-provider": "npm:^4.1.3"
24412441
"@smithy/protocol-http": "npm:^5.1.2"
24422442
"@smithy/service-error-classification": "npm:^4.0.6"
2443-
"@smithy/smithy-client": "npm:^4.4.8"
2443+
"@smithy/smithy-client": "npm:^4.4.9"
24442444
"@smithy/types": "npm:^4.3.1"
24452445
"@smithy/util-middleware": "npm:^4.0.4"
24462446
"@smithy/util-retry": "npm:^4.0.6"
24472447
tslib: "npm:^2.6.2"
24482448
uuid: "npm:^9.0.1"
2449-
checksum: 10c0/d8b8ce6180a1b9bef099c95a0f8bfcd232f12fc662a65f7ac2d65839009678af33665284c29b8abdb92de47f20f40ec95307a5f1d74623a3374158d800598b43
2449+
checksum: 10c0/9bff3b3d329c7af0f33231b05bf442e6de6a1ddb67a55dcef2e5f5ef4dc2174afd5e8fd741d605dd096354eca3a8bb74d35c87fcd517cfc7349a5ccfdc3a559f
24502450
languageName: node
24512451
linkType: hard
24522452

@@ -2572,18 +2572,18 @@ __metadata:
25722572
languageName: node
25732573
linkType: hard
25742574

2575-
"@smithy/smithy-client@npm:^4.4.7, @smithy/smithy-client@npm:^4.4.8":
2576-
version: 4.4.8
2577-
resolution: "@smithy/smithy-client@npm:4.4.8"
2575+
"@smithy/smithy-client@npm:^4.4.7, @smithy/smithy-client@npm:^4.4.9":
2576+
version: 4.4.9
2577+
resolution: "@smithy/smithy-client@npm:4.4.9"
25782578
dependencies:
2579-
"@smithy/core": "npm:^3.7.1"
2580-
"@smithy/middleware-endpoint": "npm:^4.1.16"
2579+
"@smithy/core": "npm:^3.7.2"
2580+
"@smithy/middleware-endpoint": "npm:^4.1.17"
25812581
"@smithy/middleware-stack": "npm:^4.0.4"
25822582
"@smithy/protocol-http": "npm:^5.1.2"
25832583
"@smithy/types": "npm:^4.3.1"
25842584
"@smithy/util-stream": "npm:^4.2.3"
25852585
tslib: "npm:^2.6.2"
2586-
checksum: 10c0/2e7a0138dcf8afed63e998254f75d90fdb8da34f96cd09f84c7736eb5118f2b539b1ccb1dce697fdd7df7653d9c34b663731b22bfd1e0cb5dbdd8f797a01dfd9
2586+
checksum: 10c0/0285f1f4aad72c55e73a628ec1796dab18da4609e249c62745aeda390cae2df27ded827a660299cb48944c470dee4097e7abb064076f297c59067b16a65cdc1e
25872587
languageName: node
25882588
linkType: hard
25892589

@@ -2666,30 +2666,30 @@ __metadata:
26662666
linkType: hard
26672667

26682668
"@smithy/util-defaults-mode-browser@npm:^4.0.23":
2669-
version: 4.0.24
2670-
resolution: "@smithy/util-defaults-mode-browser@npm:4.0.24"
2669+
version: 4.0.25
2670+
resolution: "@smithy/util-defaults-mode-browser@npm:4.0.25"
26712671
dependencies:
26722672
"@smithy/property-provider": "npm:^4.0.4"
2673-
"@smithy/smithy-client": "npm:^4.4.8"
2673+
"@smithy/smithy-client": "npm:^4.4.9"
26742674
"@smithy/types": "npm:^4.3.1"
26752675
bowser: "npm:^2.11.0"
26762676
tslib: "npm:^2.6.2"
2677-
checksum: 10c0/f0738ae262dd79c17cfa060a26cfd84de6b51d7a238f3d48bc960f2e9888e68af719b825243c99ec65828edda52883bd70361cedd7224f290981d71963edbc07
2677+
checksum: 10c0/48e82c04e2aae6926347a26d75260dab85cb7e94a7a32c37518ee9d60f75dcdb132aa412bac08caf9a8782ada4ec337ffb0376fdacfd83644013e7bb5f0bacae
26782678
languageName: node
26792679
linkType: hard
26802680

26812681
"@smithy/util-defaults-mode-node@npm:^4.0.23":
2682-
version: 4.0.24
2683-
resolution: "@smithy/util-defaults-mode-node@npm:4.0.24"
2682+
version: 4.0.25
2683+
resolution: "@smithy/util-defaults-mode-node@npm:4.0.25"
26842684
dependencies:
26852685
"@smithy/config-resolver": "npm:^4.1.4"
26862686
"@smithy/credential-provider-imds": "npm:^4.0.6"
26872687
"@smithy/node-config-provider": "npm:^4.1.3"
26882688
"@smithy/property-provider": "npm:^4.0.4"
2689-
"@smithy/smithy-client": "npm:^4.4.8"
2689+
"@smithy/smithy-client": "npm:^4.4.9"
26902690
"@smithy/types": "npm:^4.3.1"
26912691
tslib: "npm:^2.6.2"
2692-
checksum: 10c0/4ca648d7d660bf62c096d2a4b7639e0178898def45aa5e9d0b5ddd4cd6f49478155465145a44c1634e8e3149b7e6f79a19f91f93e584d765118504bac81225c0
2692+
checksum: 10c0/ce8bdecc2a69094f327ca0f8b6345eaf6616e7abdb3a43b69613cdb6a0053370cd505e701f98f8a4930ae514c846b94d453bc3cf87603299025c57047a496ddd
26932693
languageName: node
26942694
linkType: hard
26952695

@@ -3205,14 +3205,14 @@ __metadata:
32053205
languageName: node
32063206
linkType: hard
32073207

3208-
"axios@npm:^1.10.0, axios@npm:^1.7.7":
3209-
version: 1.10.0
3210-
resolution: "axios@npm:1.10.0"
3208+
"axios@npm:^1.11.0, axios@npm:^1.7.7":
3209+
version: 1.11.0
3210+
resolution: "axios@npm:1.11.0"
32113211
dependencies:
32123212
follow-redirects: "npm:^1.15.6"
3213-
form-data: "npm:^4.0.0"
3213+
form-data: "npm:^4.0.4"
32143214
proxy-from-env: "npm:^1.1.0"
3215-
checksum: 10c0/2239cb269cc789eac22f5d1aabd58e1a83f8f364c92c2caa97b6f5cbb4ab2903d2e557d9dc670b5813e9bcdebfb149e783fb8ab3e45098635cd2f559b06bd5d8
3215+
checksum: 10c0/5de273d33d43058610e4d252f0963cc4f10714da0bfe872e8ef2cbc23c2c999acc300fd357b6bce0fc84a2ca9bd45740fa6bb28199ce2c1266c8b1a393f2b36e
32163216
languageName: node
32173217
linkType: hard
32183218

@@ -4100,7 +4100,7 @@ __metadata:
41004100
languageName: node
41014101
linkType: hard
41024102

4103-
"form-data@npm:^4.0.0":
4103+
"form-data@npm:^4.0.4":
41044104
version: 4.0.4
41054105
resolution: "form-data@npm:4.0.4"
41064106
dependencies:
@@ -4553,11 +4553,11 @@ __metadata:
45534553
linkType: hard
45544554

45554555
"jiti@npm:^2.4.1":
4556-
version: 2.4.2
4557-
resolution: "jiti@npm:2.4.2"
4556+
version: 2.5.0
4557+
resolution: "jiti@npm:2.5.0"
45584558
bin:
45594559
jiti: lib/jiti-cli.mjs
4560-
checksum: 10c0/4ceac133a08c8faff7eac84aabb917e85e8257f5ad659e843004ce76e981c457c390a220881748ac67ba1b940b9b729b30fb85cbaf6e7989f04b6002c94da331
4560+
checksum: 10c0/62fa20669dbe038bf20f65bb2aa4a2c78d3c1a9c12e669cc93b7c2e61b8d85fa7363a4c927fceda35bc07e85195421abc7f878dd67a9bf1368cfe55da702f54a
45614561
languageName: node
45624562
linkType: hard
45634563

0 commit comments

Comments
 (0)