@@ -219,6 +219,10 @@ export class DashboardAnalytics extends SharedAnalytics {
219219 return this . totalClaimedPoolFeesAt ( this . orm . em . fork ( ) , pool , user )
220220 }
221221
222+ async totalDepositedPoolFees ( ) : Promise < FAssetValueResult > {
223+ return this . totalDepositedPoolFeesAt ( this . orm . em . fork ( ) )
224+ }
225+
222226 ///////////////////////////////////////////////////////////////
223227 // timespans
224228
@@ -381,6 +385,28 @@ export class DashboardAnalytics extends SharedAnalytics {
381385 return this . convertOrmResultToFAssetValueResult ( enteredFees , 'fees' )
382386 }
383387
388+ protected async totalDepositedPoolFeesAt (
389+ em : EntityManager , timestamp ?: number
390+ ) : Promise < FAssetValueResult > {
391+ const mintPoolFees = await this . filterEnterOrExitQueryBy (
392+ em . createQueryBuilder ( Entities . MintingExecuted , 'me' )
393+ . select ( [ 'me.fasset' , raw ( 'sum(me.pool_fee_uba) as fees' ) ] )
394+ . groupBy ( 'me.fasset' ) ,
395+ 'me' , undefined , undefined , timestamp
396+ ) . execute ( ) as { fasset : number , fees : bigint } [ ]
397+ const redeemPoolFees = await this . filterEnterOrExitQueryBy (
398+ em . createQueryBuilder ( Entities . RedemptionPoolFeeMintedEvent , 'rpfme' )
399+ . select ( [ 'rpfme.fasset' , raw ( 'sum(rpfme.pool_fee_uba) as fees' ) ] )
400+ . groupBy ( 'rpfme.fasset' ) ,
401+ 'rpfme' , undefined , undefined , timestamp
402+ ) . execute ( ) as { fasset : number , fees : bigint } [ ]
403+ return this . transformFAssetValueResults (
404+ this . convertOrmResultToFAssetValueResult ( mintPoolFees , 'fees' ) ,
405+ this . convertOrmResultToFAssetValueResult ( redeemPoolFees , 'fees' ) ,
406+ add
407+ )
408+ }
409+
384410 protected async tokenSupplyAt (
385411 em : EntityManager , tokenId : number , timestamp : number , zeroAddressId : number
386412 ) : Promise < bigint > {
0 commit comments