1
- import { PsmGovernance , PsmMetrics , PsmMetricsDaily } from " ../../types" ;
2
- import { dateToDayKey } from " ../utils" ;
1
+ import { PsmGovernance , PsmMetrics , PsmMetricsDaily } from ' ../../types' ;
2
+ import { dateToDayKey } from ' ../utils' ;
3
3
4
4
export const psmEventKit = ( block : any , data : any , module : string , path : string ) => {
5
5
async function savePsmMetrics ( payload : any ) : Promise < Promise < any > [ ] > {
@@ -8,13 +8,13 @@ export const psmEventKit = (block: any, data: any, module: string, path: string)
8
8
path ,
9
9
BigInt ( data . blockHeight ) ,
10
10
block . block . header . time as any ,
11
- path . split ( "." ) [ 3 ] ,
12
- path . split ( "." ) [ 3 ] ,
11
+ path . split ( '.' ) [ 3 ] ,
12
+ path . split ( '.' ) [ 3 ] ,
13
13
BigInt ( payload . anchorPoolBalance . __value ) ,
14
14
BigInt ( payload . feePoolBalance . __value ) ,
15
15
BigInt ( payload . mintedPoolBalance . __value ) ,
16
16
BigInt ( payload . totalAnchorProvided . __value ) ,
17
- BigInt ( payload . totalMintedProvided . __value )
17
+ BigInt ( payload . totalMintedProvided . __value ) ,
18
18
) . save ( ) ;
19
19
20
20
return [ psmMetric , psmMetricDaily ] ;
@@ -25,7 +25,7 @@ export const psmEventKit = (block: any, data: any, module: string, path: string)
25
25
26
26
let state = await getPsmMetricDaily ( dateKey ) ;
27
27
28
- state . denom = path . split ( "." ) [ 3 ] ;
28
+ state . denom = path . split ( '.' ) [ 3 ] ;
29
29
30
30
state . anchorPoolBalanceLast = BigInt ( payload . anchorPoolBalance . __value ) ;
31
31
state . feePoolBalanceLast = BigInt ( payload . feePoolBalance . __value ) ;
@@ -39,10 +39,16 @@ export const psmEventKit = (block: any, data: any, module: string, path: string)
39
39
}
40
40
41
41
async function getPsmMetricDaily ( dateKey : number ) : Promise < PsmMetricsDaily > {
42
- const id = path + ":" + dateKey . toString ( ) ;
42
+ const id = path + ':' + dateKey . toString ( ) ;
43
43
let state = await PsmMetricsDaily . get ( id ) ;
44
44
if ( ! state ) {
45
- state = new PsmMetricsDaily ( id , path , dateKey , BigInt ( data . blockHeight ) , new Date ( block . block . header . time as any ) ) ;
45
+ state = new PsmMetricsDaily (
46
+ id ,
47
+ path ,
48
+ dateKey ,
49
+ BigInt ( data . blockHeight ) ,
50
+ new Date ( block . block . header . time as any ) ,
51
+ ) ;
46
52
}
47
53
return state ;
48
54
}
@@ -52,13 +58,13 @@ export const psmEventKit = (block: any, data: any, module: string, path: string)
52
58
path ,
53
59
BigInt ( data . blockHeight ) ,
54
60
block . block . header . time as any ,
55
- path . split ( "." ) [ 3 ] ,
56
- path . split ( "." ) [ 3 ] ,
61
+ path . split ( '.' ) [ 3 ] ,
62
+ path . split ( '.' ) [ 3 ] ,
57
63
BigInt ( payload . current . MintLimit . value . __value ) ,
58
64
BigInt ( payload . current . GiveMintedFee ?. value ?. denominator ?. __value ?? 0 ) ,
59
65
BigInt ( payload . current . GiveMintedFee ?. value ?. numerator ?. __value ?? 0 ) ,
60
66
BigInt ( payload . current . WantMintedFee ?. value ?. denominator ?. __value ?? 0 ) ,
61
- BigInt ( payload . current . WantMintedFee ?. value ?. numerator ?. __value ?? 0 )
67
+ BigInt ( payload . current . WantMintedFee ?. value ?. numerator ?. __value ?? 0 ) ,
62
68
) . save ( ) ;
63
69
return [ psmGovernance ] ;
64
70
}
0 commit comments