Skip to content

Commit 65551b3

Browse files
authored
Merge pull request #103 from ReynardoEW/track_protocols
Track LTC, DOGE, TRUMP
2 parents 1d44bc4 + afd11f8 commit 65551b3

File tree

3 files changed

+212
-0
lines changed

3 files changed

+212
-0
lines changed

protocols/doge.ts

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
import { manualLinear } from "../adapters/manual";
2+
import { LinearAdapterResult, Protocol } from "../types/adapters";
3+
4+
// Block 145000 occurred at UTC: 17.03.2014, 22:17:59
5+
const block145000Timestamp = new Date("2014-03-17T22:17:59Z").getTime() / 1000;
6+
const blockTime = 60;
7+
8+
function getTimestampForBlock(blockNumber: number): number {
9+
const blockDiff = blockNumber - 145000;
10+
return block145000Timestamp + (blockDiff * blockTime);
11+
}
12+
13+
interface BlockScheduleEntry {
14+
startBlock: number;
15+
endBlock: number;
16+
maxReward?: number;
17+
reward?: number;
18+
}
19+
20+
const blockSchedule: BlockScheduleEntry[] = [
21+
{ startBlock: 1, endBlock: 99999, maxReward: 1000000 },
22+
{ startBlock: 100000, endBlock: 144999, maxReward: 500000 },
23+
{ startBlock: 145000, endBlock: 199999, reward: 250000 },
24+
{ startBlock: 200000, endBlock: 299999, reward: 125000 },
25+
{ startBlock: 300000, endBlock: 399999, reward: 62500 },
26+
{ startBlock: 400000, endBlock: 499999, reward: 31250 },
27+
{ startBlock: 500000, endBlock: 599999, reward: 15625 },
28+
{ startBlock: 600000, endBlock: 12500000, reward: 10000 }
29+
];
30+
31+
function rewards(): LinearAdapterResult[] {
32+
const sections: LinearAdapterResult[] = [];
33+
34+
for (let i = 0; i < blockSchedule.length; i++) {
35+
const schedule = blockSchedule[i];
36+
const startTimestamp = getTimestampForBlock(schedule.startBlock);
37+
const endTimestamp = getTimestampForBlock(schedule.endBlock);
38+
39+
const blockCount = schedule.endBlock - schedule.startBlock + 1;
40+
let reward: number;
41+
if (schedule.reward !== undefined) {
42+
reward = schedule.reward;
43+
} else if (schedule.maxReward !== undefined) {
44+
reward = schedule.maxReward / 2;
45+
} else {
46+
throw new Error(`Missing reward info for block range ${schedule.startBlock}-${schedule.endBlock}`);
47+
}
48+
const totalEmission = blockCount * reward;
49+
50+
sections.push(manualLinear(
51+
startTimestamp,
52+
endTimestamp,
53+
totalEmission
54+
));
55+
}
56+
57+
return sections;
58+
}
59+
60+
const doge: Protocol = {
61+
"Mining rewards": rewards(),
62+
meta: {
63+
sources: [
64+
"https://github.com/dogecoin/dogecoin/blob/master/doc/FAQ.md",
65+
"https://github.com/dogecoin/dogecoin/blob/master/src/chainparams.cpp",
66+
],
67+
token: "coingecko:dogecoin",
68+
protocolIds: ["6016"],
69+
notes: [
70+
"Block rewards were initially random between 0-1,000,000 DOGE for blocks 1-99,999",
71+
"Block rewards were random between 0-500,000 DOGE for blocks 100,000-144,999",
72+
"Fixed block rewards were implemented from block 145,000 onwards",
73+
"Projected until block 12.5M"
74+
],
75+
},
76+
categories: {
77+
farming: ["Mining rewards"],
78+
},
79+
};
80+
81+
export default doge;

protocols/litecoin.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { manualLinear } from "../adapters/manual";
2+
import { LinearAdapterResult, Protocol } from "../types/adapters";
3+
4+
const initialReward: number = 50;
5+
const halveningDates: string[] = [
6+
"2011/10/07", // Genesis Block
7+
"2015/08/25", // 840k
8+
"2019/08/05", // 1,680k
9+
"2023/08/02", // 2,520k
10+
"2027/07/27", // 3,360k projected
11+
];
12+
13+
function rewards(): LinearAdapterResult[] {
14+
const sections: LinearAdapterResult[] = [];
15+
let reward: number = initialReward;
16+
17+
for (let i = 0; i < halveningDates.length - 1; i++) {
18+
const qty = reward * 840000; // LTC uses 840k blocks per halving period
19+
sections.push(manualLinear(halveningDates[i], halveningDates[i + 1], qty));
20+
reward /= 2;
21+
}
22+
23+
return sections;
24+
}
25+
26+
const litecoin: Protocol = {
27+
"Mining rewards": rewards(),
28+
meta: {
29+
sources: [
30+
"https://litecoin.org",
31+
"https://www.litecoinhalving.com/",
32+
],
33+
token: "coingecko:litecoin",
34+
protocolIds: ["4499"],
35+
notes: [
36+
`Future halvenings have at a specified block height, therefore the dates shown are an estimate only.`,
37+
],
38+
},
39+
categories: {
40+
farming: ["Mining rewards"],
41+
},
42+
};
43+
44+
export default litecoin;

protocols/trump.ts

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
import { Protocol } from "../types/adapters";
2+
import { manualCliff, manualStep } from "../adapters/manual";
3+
import { periodToSeconds } from "../utils/time";
4+
5+
const start = 1705536000; // January 18, 2025
6+
7+
const trump: Protocol = {
8+
"Public Distribution": [
9+
manualCliff(start, 100_000_000), // 100% at TGE
10+
],
11+
"Liquidity": [
12+
manualCliff(start, 100_000_000), // 100% at TGE
13+
],
14+
"Creators & CIC Digital 1": [
15+
manualCliff(start + periodToSeconds.month * 3, 36_000_000), // 10% unlock after 3 months
16+
manualStep(
17+
start + periodToSeconds.month * 3,
18+
periodToSeconds.day,
19+
730,
20+
324_000_000 / 730 // Remaining 90% over 24 months daily
21+
),
22+
],
23+
"Creators & CIC Digital 2": [
24+
manualCliff(start + periodToSeconds.month * 6, 45_000_000), // 25% unlock after 6 months
25+
manualStep(
26+
start + periodToSeconds.month * 6,
27+
periodToSeconds.day,
28+
730,
29+
135_000_000 / 730 // Remaining 75% over 24 months daily
30+
),
31+
],
32+
"Creators & CIC Digital 3": [
33+
manualCliff(start + periodToSeconds.month * 12, 45_000_000), // 25% unlock after 12 months
34+
manualStep(
35+
start + periodToSeconds.month * 12,
36+
periodToSeconds.day,
37+
730,
38+
135_000_000 / 730 // Remaining 75% over 24 months daily
39+
),
40+
],
41+
"Creators & CIC Digital 4": [
42+
manualCliff(start + periodToSeconds.month * 3, 4_000_000), // 10% unlock after 3 months
43+
manualStep(
44+
start + periodToSeconds.month * 3,
45+
periodToSeconds.day,
46+
730,
47+
36_000_000 / 730 // Remaining 90% over 24 months daily
48+
),
49+
],
50+
"Creators & CIC Digital 5": [
51+
manualCliff(start + periodToSeconds.month * 6, 5_000_000), // 25% unlock after 6 months
52+
manualStep(
53+
start + periodToSeconds.month * 6,
54+
periodToSeconds.day,
55+
730,
56+
15_000_000 / 730 // Remaining 75% over 24 months daily
57+
),
58+
],
59+
"Creators & CIC Digital 6": [
60+
manualCliff(start + periodToSeconds.month * 12, 5_000_000), // 25% unlock after 12 months
61+
manualStep(
62+
start + periodToSeconds.month * 12,
63+
periodToSeconds.day,
64+
730,
65+
15_000_000 / 730 // Remaining 75% over 24 months daily
66+
),
67+
],
68+
meta: {
69+
sources: ["https://gettrumpmemes.com/"],
70+
token: "coingecko:official-trump",
71+
protocolIds: ["6017"]
72+
},
73+
categories: {
74+
insiders: [
75+
"Creators & CIC Digital 1",
76+
"Creators & CIC Digital 2",
77+
"Creators & CIC Digital 3",
78+
"Creators & CIC Digital 4",
79+
"Creators & CIC Digital 5",
80+
"Creators & CIC Digital 6"
81+
],
82+
noncirculating: ["Liquidity"],
83+
publicSale: ["Public Distribution"],
84+
},
85+
};
86+
87+
export default trump;

0 commit comments

Comments
 (0)