diff --git a/protocols/ens.ts b/protocols/ens.ts new file mode 100644 index 0000000..0dce856 --- /dev/null +++ b/protocols/ens.ts @@ -0,0 +1,41 @@ +import { manualCliff, manualLinear, manualStep } from "../adapters/manual"; +import { Protocol } from "../types/adapters"; +import { periodToSeconds } from "../utils/time"; + +const start = 1636329600; // 8 November 2021 00:00:00 +const qty = 100000000; //100m + +const ens: Protocol = { + "Airdrop": manualCliff(start, qty * 0.25), + "Core Contributors": manualLinear( + start, start + 4 * periodToSeconds.year, + 0.1954 * qty, + ), + "Other contributors": manualLinear( + start, start + 4 * periodToSeconds.year, + 0.0546 * qty, + ), + "DAO Community Treasury": [ + manualCliff(start, 5000000), // 5m tokens release at start + manualStep( + start, + periodToSeconds.month, + 48, + (45000000) / 48, + ), // monthly steps for the next 48 months + ], + meta: { + notes: [ + `Tokens for core contributors and launch advisors will have a four year lock-up and vesting schedule.`, + ], + token: "ethereum:0xc18360217d8f7ab5e7c516566761ea12ce7f9d72", + sources: ["https://ens.mirror.xyz/-eaqMv7XPikvXhvjbjzzPNLS4wzcQ8vdOgi9eNXeUuY"], + protocolIds: ["2519"], + }, + categories: { + insiders: ["Other contributors", "Core Contributors", "DAO Community Treasury"], + publicSale: [], + airdrop: ["Airdrop"] + }, +}; +export default ens; \ No newline at end of file diff --git a/utils/convertToChartData.ts b/utils/convertToChartData.ts index e6c2a93..69fe67a 100644 --- a/utils/convertToChartData.ts +++ b/utils/convertToChartData.ts @@ -8,6 +8,7 @@ import { IncompleteSection, ApiChartData, } from "../types/adapters"; +import { PromisePool } from "@supercharge/promise-pool"; import fetch from "node-fetch"; import { RESOLUTION_SECONDS, @@ -384,14 +385,42 @@ function discreet(raw: RawResult, config: ChartConfig): ChartData { return { timestamps, unlocked, apiData, isContinuous: false }; } -export function mapToServerData(testData: ChartSection[]) { +export async function mapToServerData( + testData: ChartSection[], + token: string +) { + const allTimestamps = [ + ...new Set( + testData + .map((s: ChartSection) => { + return s.data.timestamps; + }) + .flat() + ), + ]; + const prices: Record = {}; + + await PromisePool.withConcurrency(20) + .for(allTimestamps) + .process(async (ts: string) => { + const res = await fetch( + `https://coins.llama.fi/prices/historical/${ts}/${token}` + ) + .then((r: any) => r.json()) + .catch(() => null); + const price = res ? res?.coins[token]?.price : 0; + prices[ts] = price; + }); const serverData: any[] = testData.map((s: ChartSection) => { const label = s.section; - const data = s.data.timestamps.map((timestamp: number, i: number) => ({ - timestamp, - unlocked: s.data.unlocked[i], - })); + const data = s.data.timestamps.map( + (timestamp: number, i: number) => ({ + timestamp, + unlocked: s.data.unlocked[i], + price: prices[timestamp] ?? 0, + }) + ); return { label, data }; }); diff --git a/wipProtocols/celestia.ts b/wipProtocols/celestia.ts new file mode 100644 index 0000000..bf708e6 --- /dev/null +++ b/wipProtocols/celestia.ts @@ -0,0 +1,65 @@ +import { manualCliff, manualLinear, manualStep } from "../adapters/manual"; +import { Protocol } from "../types/adapters"; +import { periodToSeconds } from "../utils/time"; + +const start = 1697500800; // 17 oct?! +const qty = 1000000000; //1b +const qtyEcosystem = 268000000 +const qtyCORE = 176000000 +const qtySEED = 159000000 +const qtyAB = 197000000 + +const celestia: Protocol = { + "Public Allocation": manualCliff(start, qty * 0.2), + "R&D & Ecosystem": [ + manualCliff(start, qtyEcosystem * 0.25), // 25% + manualStep( + start + periodToSeconds.year, + periodToSeconds.day, + 1095, + (qtyEcosystem * 0.75) / 1095, + ), // + ], + "Initial Core Contributors": [ + manualCliff(start + periodToSeconds.year, qtyCORE * 0.33), // 33% + manualStep( + start + periodToSeconds.year, + periodToSeconds.day, + 1095, + (qtyCORE * 0.67) / 1095, + ), // + ], + "Early Backers Seed": [ + manualCliff(start + periodToSeconds.year, qtySEED * 0.33), // 33% + manualStep( + start + periodToSeconds.year, + periodToSeconds.day, + 365, + (qtySEED * 0.67) / 365, + ), // + ], + "Early Backers Series A&B": [ + manualCliff(start + periodToSeconds.year, qtyAB * 0.33), // 25% + manualStep( + start + periodToSeconds.year, + periodToSeconds.day, + 365, + (qtyAB * 0.67) / 365, + ), // monthly steps for the next 3 years + ], + meta: { + notes: [ + `Celestia’s 1 billion TIA supply at genesis will be subject to several different unlock schedules. All tokens, locked or unlocked, may be staked, but staking rewards are unlocked upon receipt.`, + ], + token: "ethereum:-", + sources: ["https://docs.celestia.org/learn/staking-governance-supply/"], + protocolIds: ["3562"], //add correct id + }, + categories: { + insiders: ["Initial Core Contributors", "Early Backers Seed", "Early Backers Series A&B"], + publicSale: [], + airdrop: ["Public Allocation"], + farming: ["R&D & Ecosystem"] + }, +}; +export default celestia; \ No newline at end of file