@@ -30,28 +30,22 @@ const emissions = async (): Promise<LinearAdapterResult[]> => {
30
30
31
31
//get https://burn-stats.pancakeswap.com/data.json
32
32
const issuanceData = await fetch ( "https://burn-stats.pancakeswap.com/data.json" ) . then ( res => res . json ( ) ) ;
33
- const summed = issuanceData [ "mintTimeSeries" ] . reduce ( ( acc : any , item : any ) => {
34
- item . timestamp = Math . floor ( item . timestamp / 1000 ) ;
35
- acc [ item . timestamp ] = ( acc [ item . timestamp ] || 0 ) + item . mint ;
36
- return acc ;
37
- } , { } ) ;
33
+ const deflationTimeSeries = issuanceData . deflationTimeSeries ;
38
34
39
- const sortedEntries = Object . entries ( summed ) . sort ( ( [ a ] , [ b ] ) => parseInt ( a ) - parseInt ( b ) ) ;
40
-
41
- sortedEntries . forEach ( ( [ timestamp , mint ] : [ string , any ] , index : number ) => {
42
- const currentTimestamp = parseInt ( timestamp ) ;
43
- const nextTimestamp = index < sortedEntries . length - 1
44
- ? parseInt ( sortedEntries [ index + 1 ] [ 0 ] )
35
+ deflationTimeSeries . forEach ( ( entry : any , index : number ) => {
36
+ const currentTimestamp = Math . floor ( entry . timestamp / 1000 ) ; // Convert from milliseconds to seconds
37
+ const nextTimestamp = index < deflationTimeSeries . length - 1
38
+ ? Math . floor ( deflationTimeSeries [ index + 1 ] . timestamp / 1000 )
45
39
: currentTimestamp + periodToSeconds . week ;
46
40
47
41
result . push ( {
48
42
type : "linear" ,
49
43
start : currentTimestamp ,
50
44
end : nextTimestamp ,
51
- amount : mint ,
45
+ amount : entry . deflation ,
52
46
} ) ;
53
47
} ) ;
54
-
48
+
55
49
return result ;
56
50
}
57
51
@@ -68,7 +62,7 @@ const pancakeswap: Protocol = {
68
62
token : `bsc:0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82` ,
69
63
protocolIds : [ "parent#pancakeswap" ] ,
70
64
notes : [
71
- "This chart shows only emissions of CAKE token." ,
65
+ "This chart shows only emissions of CAKE token. (Including burns) " ,
72
66
"CAKE have maximum supply of 450 million tokens." ,
73
67
] ,
74
68
} ,
0 commit comments