Skip to content

Commit 90921a6

Browse files
committed
fix: more logging during liquidation
1 parent 6ad5886 commit 90921a6

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/sdk/accounts/CreditAccountsService.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ import {
2727
type CreditAccountDataSlice,
2828
type RouterCloseResult,
2929
} from "../router";
30-
import type { MultiCall, RawTx } from "../types";
30+
import type { ILogger, MultiCall, RawTx } from "../types";
31+
import { childLogger } from "../utils";
3132
import { simulateMulticall } from "../utils/viem";
3233

3334
type CompressorAbi = typeof iCreditAccountCompressorAbi;
@@ -156,13 +157,15 @@ export interface PermitResult {
156157
export class CreditAccountsService extends SDKConstruct {
157158
#compressor: Address;
158159
#batchSize?: number;
160+
#logger?: ILogger;
159161

160162
constructor(sdk: GearboxSDK, options?: CreditAccountServiceOptions) {
161163
super(sdk);
162164
this.#compressor = sdk.addressProvider.getLatestVersion(
163165
AP_CREDIT_ACCOUNT_COMPRESSOR,
164166
);
165167
this.#batchSize = options?.batchSize;
168+
this.#logger = childLogger("CreditAccountsService", sdk.logger);
166169
}
167170

168171
/**
@@ -805,6 +808,10 @@ export class CreditAccountsService extends SDKConstruct {
805808
const tokens = Array.from(tokensByPool.get(pool) ?? []);
806809
priceFeeds.push(...oracle.priceFeedsForTokens(tokens));
807810
}
811+
this.#logger?.debug(
812+
{ account: creditAccount?.creditAccount, manager: cm.name },
813+
`generating price feed updates for ${priceFeeds.length} price feeds`,
814+
);
808815
return this.sdk.priceFeeds.generatePriceFeedsUpdateTxs(
809816
priceFeeds,
810817
creditAccount ? { account: creditAccount.creditAccount } : undefined,
@@ -822,11 +829,16 @@ export class CreditAccountsService extends SDKConstruct {
822829
desiredQuotas: Array<Asset> | undefined,
823830
): Promise<Array<OnDemandPriceUpdate>> {
824831
const market = this.sdk.marketRegister.findByCreditManager(creditManager);
832+
const cm = this.sdk.marketRegister.findCreditManager(creditManager);
825833
const update = await this.getUpdateForAccount(
826834
creditManager,
827835
creditAccount,
828836
desiredQuotas,
829837
);
838+
this.#logger?.debug(
839+
{ account: creditAccount?.creditAccount, manager: cm.name },
840+
`getting on demand price updates from ${update.txs.length} txs`,
841+
);
830842
return market.priceOracle.onDemandPriceUpdates(update);
831843
}
832844

src/sdk/market/PriceOracleBaseContract.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ export class PriceOracleBaseContract<abi extends Abi | readonly unknown[]>
146146
// it would be much nicer to have intermediate format and get RawTx/OnDemandPriceUpdate/ViemMulticall from it (as it's done in liquidator)
147147
const result: OnDemandPriceUpdate[] = [];
148148
if (!updates) {
149+
this.logger?.debug("empty updates list");
149150
return result;
150151
}
151152
const { txs } = updates;

0 commit comments

Comments
 (0)