Skip to content

Commit

Permalink
stella
Browse files Browse the repository at this point in the history
  • Loading branch information
waynebruce0x committed Oct 2, 2023
1 parent c7d4ce7 commit e75d229
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 14 deletions.
50 changes: 50 additions & 0 deletions protocols/stella.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { Protocol } from "../types/adapters";
import { manualCliff, manualStep } from "../adapters/manual";
import { periodToSeconds } from "../utils/time";

const qty = 1e9;
const start = 1604016000;

const stella: Protocol = {
"Binance Launchpad": manualCliff(start, qty * 0.1),
"Binance Launchpool": manualCliff(start, qty * 0.05),
"Private Sale": manualStep(
start,
periodToSeconds.month * 3,
4,
(qty * 0.1333) / 4,
),
"Liquidity Mining": manualStep(
start,
periodToSeconds.month * 3,
4,
qty * 0.05,
),
"Team & Advisors": manualStep(
start + periodToSeconds.year,
periodToSeconds.month * 3,
10,
qty * 0.015,
),
Ecosystem: manualStep(
start,
periodToSeconds.month * 3,
24,
(qty * 0.3667) / 24,
),
meta: {
sources: [
"https://docs.stellaxyz.io/stella-doc/tokenomics/token-distribution",
],
token: "ethereum:0xa1faa113cbE53436Df28FF0aEe54275c13B40975",
protocolIds: ["3148"],
},
categories: {
insiders: ["Private Sale", "Team & Insiders"],
publicSale: ["Binance Launchpad", "Binance Launchpool"],
farming: ["Liquidity Mining"],
noncirculating: ["Ecosystem"],
},
};

export default stella;
23 changes: 9 additions & 14 deletions utils/convertToChartData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,26 +385,23 @@ function discreet(raw: RawResult, config: ChartConfig): ChartData {
return { timestamps, unlocked, apiData, isContinuous: false };
}

export async function mapToServerData(
testData: ChartSection[],
token: string
) {
export async function mapToServerData(testData: ChartSection[], token: string) {
const allTimestamps = [
...new Set(
testData
.map((s: ChartSection) => {
return s.data.timestamps;
})
.flat()
.flat(),
),
];
const prices: Record<string, number> = {};

await PromisePool.withConcurrency(20)
.for(allTimestamps)
.process(async (ts: string) => {
.process(async (ts: any) => {
const res = await fetch(
`https://coins.llama.fi/prices/historical/${ts}/${token}`
`https://coins.llama.fi/prices/historical/${ts}/${token}`,
)
.then((r: any) => r.json())
.catch(() => null);
Expand All @@ -414,13 +411,11 @@ export async function mapToServerData(
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],
price: prices[timestamp] ?? 0,
})
);
const data = s.data.timestamps.map((timestamp: number, i: number) => ({
timestamp,
unlocked: s.data.unlocked[i],
price: prices[timestamp] ?? 0,
}));

return { label, data };
});
Expand Down

0 comments on commit e75d229

Please sign in to comment.