Skip to content

Commit

Permalink
fix: comments added to OptimisticResult
Browse files Browse the repository at this point in the history
  • Loading branch information
0xMikko.eth committed Sep 28, 2022
1 parent be1defc commit af27256
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"typecheck:ci": "tsc --noEmit"
},
"dependencies": {
"@gearbox-protocol/sdk": "^1.7.12",
"@gearbox-protocol/sdk": "^1.8.11",
"@types/commander": "^2.12.2",
"@types/express": "^4.17.14",
"amqp-ts": "^1.8.0",
Expand Down
16 changes: 15 additions & 1 deletion src/core/optimistic.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
import { MultiCall } from "@gearbox-protocol/sdk";

export interface OptimisticResult {
// Credit Manager address
creditManager: string;

// Borrower address
borrower: string;

// Gas used for liquidation from tx recepit
gasUsed: number;

// Multicalls used as parameter in liquidateCreditAccount function
calls: Array<MultiCall>;

// Estimated amount which was computed in pathfinder
pathAmount: string;
remainingFunds: string;

// How much tokens liquidator got on its account for the liquidation
// liquidatorPremium = underlyingBalanceAfterLiquidation - underlyingBalanceBeforeLiquidation
liquidatorPremium: string;

// True if errors accrued
isError: boolean;
}
4 changes: 2 additions & 2 deletions src/services/liquidatorService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export class LiquidatorService {
calls: [],
isError: false,
pathAmount: "0",
remainingFunds: "0",
liquidatorPremium: "0",
};

try {
Expand Down Expand Up @@ -209,7 +209,7 @@ export class LiquidatorService {
const receipt = await tx.wait(1);

const balanceAfter = await getExecutorBalance();
optimisticResult.remainingFunds = balanceAfter
optimisticResult.liquidatorPremium = balanceAfter
.sub(balanceBefore)
.toString();

Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -594,10 +594,10 @@
resolved "https://registry.yarnpkg.com/@gearbox-protocol/prettier-config/-/prettier-config-1.5.0.tgz#4df8e9fd2305fee6ab8c1417a02e31343836932a"
integrity sha512-FUoprSsBdZyBjgxXCKL6mTkbeUJytaLzPJqIOoQpDmBRTX0seCc2o5I9PI9tySoRIlNnd/XXnKCXq1xHDEGbxw==

"@gearbox-protocol/sdk@^1.7.12":
version "1.7.12"
resolved "https://registry.yarnpkg.com/@gearbox-protocol/sdk/-/sdk-1.7.12.tgz#ae12ce9087efb4635670835db82e6cb57e2a76d4"
integrity sha512-XlJNCtB3XojuZXqgShYefjT5FV5MAVrrfZOVuBTKpiEsUpjQu1QVsiwJln2atR0Ex6rd1TbFW41AL1iSs7jMuw==
"@gearbox-protocol/sdk@^1.8.11":
version "1.8.11"
resolved "https://registry.yarnpkg.com/@gearbox-protocol/sdk/-/sdk-1.8.11.tgz#0ba8f1c0c75d485f8dece7c5932292b9b55e9161"
integrity sha512-sdZmOUQTR67K+wYVtTYUdhuQAM4FLthivMSeHbgLxaERoWR9vePCCKI75hzF9T3QCeMJnq4+6OqNCsphguaeDA==
dependencies:
"@types/deep-eql" "^4.0.0"
decimal.js-light "^2.5.1"
Expand Down

0 comments on commit af27256

Please sign in to comment.