@@ -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" ;
3132import { simulateMulticall } from "../utils/viem" ;
3233
3334type CompressorAbi = typeof iCreditAccountCompressorAbi ;
@@ -156,13 +157,15 @@ export interface PermitResult {
156157export 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
0 commit comments