Skip to content

Commit f0cdb75

Browse files
committed
feat: add keep assets option
1 parent 28f1a64 commit f0cdb75

File tree

5 files changed

+255
-21
lines changed

5 files changed

+255
-21
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"pino-pretty": "^13.0.0"
2121
},
2222
"devDependencies": {
23-
"@aws-sdk/client-s3": "^3.846.0",
23+
"@aws-sdk/client-s3": "^3.848.0",
2424
"@biomejs/biome": "^2.1.2",
2525
"@commander-js/extra-typings": "^14.0.0",
2626
"@commitlint/cli": "^19.8.1",
@@ -29,7 +29,7 @@
2929
"@gearbox-protocol/cli-utils": "^5.38.4",
3030
"@gearbox-protocol/liquidator-v2-contracts": "^2.4.0",
3131
"@gearbox-protocol/next-contracts": "npm:@gearbox-protocol/liquidator-v2-contracts@2.5.0-next.3",
32-
"@gearbox-protocol/sdk": "8.7.0",
32+
"@gearbox-protocol/sdk": "8.9.0",
3333
"@gearbox-protocol/types": "^1.14.8",
3434
"@types/node": "^24.0.14",
3535
"@uniswap/sdk-core": "^7.7.2",

src/config/schema.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,14 @@ export const ConfigSchema = z.object({
388388
description: "Flag to enable less eager liquidations for LRT tokens",
389389
env: "RESTAKING_WORKAROUND",
390390
}),
391+
/**
392+
* List of assets to keep on account after liquidation
393+
*/
394+
keepAssets: optionalAddressArrayLike().register(zommandRegistry, {
395+
flags: "--keep-assets <assets...>",
396+
description: "List of assets to keep on account after liquidation",
397+
env: "KEEP_ASSETS",
398+
}),
391399
/**
392400
* Use this mechanism to swap underlying token to ETH after the liquidation (abandoned feature)
393401
*/

src/services/liquidate/SingularFullLiquidator.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@ export default class SingularFullLiquidator extends SingularLiquidator<FullLiqui
3333
public async preview(ca: CreditAccountData): Promise<FullLiquidationPreview> {
3434
try {
3535
const { tx, routerCloseResult, calls } =
36-
await this.creditAccountService.fullyLiquidate(
37-
ca,
38-
this.client.address,
39-
BigInt(this.config.slippage),
40-
);
36+
await this.creditAccountService.fullyLiquidate({
37+
account: ca,
38+
to: this.client.address,
39+
slippage: BigInt(this.config.slippage),
40+
keepAssets: this.config.keepAssets,
41+
});
4142
return { ...routerCloseResult, calls, rawTx: tx };
4243
} catch (e) {
4344
throw new Error("cant preview full liquidation", { cause: e });

src/services/liquidate/partial/v300/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ export const V300_PARTIAL_LIQUIDATOR_BOTS: Record<Curator, Address> = {
66
"Chaos Labs": "0x0f06c2bD612Ee7D52d4bC76Ce3BD7E95247AF2a9",
77
cp0x: ADDRESS_0X0,
88
Re7: ADDRESS_0X0,
9+
Invariant: ADDRESS_0X0,
910
};

0 commit comments

Comments
 (0)