Skip to content

Commit af4f0e4

Browse files
committed
fix pcs
1 parent 71f0299 commit af4f0e4

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

protocols/pancakeswap.ts

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,28 +30,22 @@ const emissions = async (): Promise<LinearAdapterResult[]> => {
3030

3131
//get https://burn-stats.pancakeswap.com/data.json
3232
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;
3834

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)
4539
: currentTimestamp + periodToSeconds.week;
4640

4741
result.push({
4842
type: "linear",
4943
start: currentTimestamp,
5044
end: nextTimestamp,
51-
amount: mint,
45+
amount: entry.deflation,
5246
});
5347
});
54-
48+
5549
return result;
5650
}
5751

@@ -68,7 +62,7 @@ const pancakeswap: Protocol = {
6862
token: `bsc:0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82`,
6963
protocolIds: ["parent#pancakeswap"],
7064
notes: [
71-
"This chart shows only emissions of CAKE token.",
65+
"This chart shows only emissions of CAKE token. (Including burns)",
7266
"CAKE have maximum supply of 450 million tokens.",
7367
],
7468
},

0 commit comments

Comments
 (0)