Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions adapters/equilibria/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { getLogs, lookupBlock } from "@defillama/sdk/build/util";
import fetch from "node-fetch";
import abi from "./abi";
import { CliffAdapterResult } from "../../types/adapters";
import { RESOLUTION_SECONDS } from "../../utils/constants";

const boosterDeployed: number = 1685660400;
const factoryDeployed: number = 16032059;
Expand All @@ -23,13 +22,14 @@ const contracts: { [chain: string]: any } = {

let res: number;

export async function latest(key: string): Promise<number> {
export async function latest(key: string, backfill: boolean): Promise<number> {
if (!res)
return fetch(`https://api.llama.fi/emission/${key}`)
.then((r) => r.json())
.then((r) => {
try {
return JSON.parse(r.body).then((r: any) =>
backfill ||
r.metadata.incompleteSections == null ||
r.metadata.incompleteSections[0].lastRecord == null
? boosterDeployed
Expand Down Expand Up @@ -96,10 +96,11 @@ export async function incentives(
key: string,
chains: string[],
maxQty: number,
backfill: boolean = false,
) {
const results: CliffAdapterResult[] = [];
const timestampNow: number = unixTimestampNow();
const from = await latest(key);
const from = await latest(key, backfill);
let workingQty: number = 0;
let start: number = from;

Expand Down
6 changes: 4 additions & 2 deletions adapters/forta/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { balance, latest as late } from "../balance";
import contracts from "./contracts";

export const unallocated = () =>
export const unallocated = (backfill: boolean) =>
Promise.all(
Object.keys(contracts).map((k: any) =>
balance(
Expand All @@ -10,7 +10,9 @@ export const unallocated = () =>
k,
"forta",
contracts[k].timestamp,
backfill,
),
),
);
export const latest = () => late("forta", 1651356000);
export const latest = (backfill: boolean) =>
late("forta", 1651356000, backfill);
7 changes: 4 additions & 3 deletions adapters/rocketpool/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ function calculateEmissions(
return simulatedSupply - initialSupply;
}

export async function latest(reference: number): Promise<number> {
export async function latest(reference: number, backfill: boolean): Promise<number> {
if (backfill) return reference
let r;
try {
r = await fetch(`https://api.llama.fi/emission/rocket-pool`).then((r) =>
Expand All @@ -106,8 +107,8 @@ export async function latest(reference: number): Promise<number> {
return r.metadata.incompleteSections[0].lastRecord;
}

export async function emission(timestamp: number, type?: "node" | "trusted" | "protocol") {
let trackedTimestamp = await latest(timestamp);
export async function emission(timestamp: number, backfill: boolean = false, type?: "node" | "trusted" | "protocol") {
let trackedTimestamp = await latest(timestamp, backfill);
const chainData: ExtendedChainData = await findBlockHeightArray(trackedTimestamp, "ethereum");
await PromisePool.withConcurrency(10)
.for(Object.keys(chainData))
Expand Down
12 changes: 9 additions & 3 deletions adapters/supply/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import { PromisePool } from "@supercharge/promise-pool";

let res: number;

export async function latest(key: string, reference: number): Promise<number> {
export async function latest(
key: string,
reference: number,
backfill: boolean = false,
): Promise<number> {
if (!res) {
let r;
try {
Expand All @@ -18,7 +22,8 @@ export async function latest(key: string, reference: number): Promise<number> {
}
if (!r.body) return reference;
r = JSON.parse(r.body);
return r.metadata.incompleteSections == null ||
return backfill ||
r.metadata.incompleteSections == null ||
r.metadata.incompleteSections[0].lastRecord == null
? reference
: r.metadata.incompleteSections[0].lastRecord;
Expand All @@ -32,12 +37,13 @@ export async function supply(
timestampDeployed: number,
adapter: string,
excluded: number = 0,
backfill: boolean = false,
) {
let trackedTimestamp: number;
let decimals: number;

[trackedTimestamp, decimals] = await Promise.all([
latest(adapter, timestampDeployed),
latest(adapter, timestampDeployed, backfill),
call({
target,
abi: "erc20:decimals",
Expand Down
4 changes: 2 additions & 2 deletions protocols/aerodrome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const aerodrome: Protocol = {
// },
meta: {
notes: [
`After Epoch 67, emissions will be dependent on the AERO FED`,
`After Epoch 67, emissions will be dependent on the AERO FED`,
`Sections Airdrop for veAERO Lockers, Ecosystem Pools and Public Goods Funding, Team, Protocol Grants, and AERO Pools Votepower are distributed in veAERO. veAERO <> AERO conversion can be anywhere 0 - 1 depending on lock duration. At the time of analysis, around half AERO was locked, a year after genesis. We have used extrapolated this rate in our analysis.`,
`LP Emissions and Team emissions schedules have been estimated based on the chart given in the source data.`,
],
Expand All @@ -82,7 +82,7 @@ const aerodrome: Protocol = {
protocolIds: ["3450", "4524"],
incompleteSections: [
{
lastRecord: () => latest("aerodrome", start),
lastRecord: (backfill: boolean) => latest("aerodrome", start, backfill),
key: "Supply",
allocation: 2e9,
},
Expand Down
8 changes: 5 additions & 3 deletions protocols/apwine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ const apwine: Protocol = {
total * 0.08264,
),
Bootstrap: manualCliff(start, total * 0.07),
DAO: () =>
DAO: (backfill: boolean) =>
balance(
["0xDbbfc051D200438dd5847b093B22484B842de9E7"],
token,
chain,
"apwine",
1621684800,
backfill,
),
documented: {
replaces: ["DAO"],
Expand Down Expand Up @@ -60,7 +61,8 @@ const apwine: Protocol = {
protocolIds: ["1109"],
incompleteSections: [
{
lastRecord: () => latest("apwine", 1621684800),
lastRecord: (backfill: boolean) =>
latest("apwine", 1621684800, backfill),
key: "DAO",
allocation: total * 0.56,
},
Expand All @@ -72,7 +74,7 @@ const apwine: Protocol = {
airdrop: ["Airdrop"],
noncirculating: ["Ecosystem"],
privateSale: ["Seed & Pre-seed"],
insiders: ["Advisors","Team"],
insiders: ["Advisors", "Team"],
},
};
export default apwine;
8 changes: 5 additions & 3 deletions protocols/arbitrum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ const chain = "arbitrum";
const arbitrum: Protocol = {
Airdrop: manualCliff(start, qty * 0.1162),
Foundation: manualLinear("2023-04-17", "2027-04-17", 75e7),
"Arbitrum DAO Treasury": () =>
"Arbitrum DAO Treasury": (backfill: boolean) =>
balance(
["0xF3FC178157fb3c87548bAA86F9d24BA38E649B58"],
token,
chain,
"arbitrum",
1686132532, // no outflows at this time
backfill,
),
"Advisors Team OffchainLabs": [
manualCliff(end_team_investors_1year, qty_advisors * 0.25), // 25% cliff after 1 year
Expand Down Expand Up @@ -51,12 +52,13 @@ const arbitrum: Protocol = {
{
key: "Arbitrum DAO Treasury",
allocation: qty * 0.4278,
lastRecord: () => latest("arbitrum", 1686132532), // no outflows at this time
lastRecord: (backfill: boolean) =>
latest("arbitrum", 1686132532, backfill), // no outflows at this time
},
],
},
categories: {
noncirculating: ["Arbitrum DAO Treasury","Ecosystem Development Fund"],
noncirculating: ["Arbitrum DAO Treasury", "Ecosystem Development Fund"],
airdrop: ["Airdrop"],
privateSale: ["Investors"],
insiders: ["Advisors Team OffchainLabs"],
Expand Down
59 changes: 38 additions & 21 deletions protocols/balancer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,38 @@ const total = 100_000_000; // 100 million
const token = "0xba100000625a3754423978a60c9317c58a424e3D";
const chain = "ethereum";

const balanceSection = (address: string, deployed: number) =>
balance([address], token, chain, "balancer", deployed);
const balanceSection = (address: string, deployed: number, backfill: boolean) =>
balance([address], token, chain, "balancer", deployed, backfill);

const balancer: Protocol = {
"Liquidity Providers": () =>
balanceSection("0xBA12222222228d8Ba445958a75a0704d566BF2C8", 1618876800),
"Liquidity Providers": (backfill: boolean) =>
balanceSection(
"0xBA12222222228d8Ba445958a75a0704d566BF2C8",
1618876800,
backfill,
),
"Founders, Options, Advisors, Investors": manualCliff(
1696118400,
total * 0.225,
),
Ecosystem: ()=>balanceSection(
"0x10A19e7eE7d7F8a52822f6817de8ea18204F2e4f",
1618272000,
),
"Balancer Labs Fundraising Fund": ()=>balanceSection(
"0xB129F73f1AFd3A49C701241F374dB17AE63B20Eb",
1604192400,
),
"Balancer Labs Contributors Incentives Program": ()=>balanceSection(
"0xCDcEBF1f28678eb4A1478403BA7f34C94F7dDBc5",
1592870400,
),
Ecosystem: (backfill: boolean) =>
balanceSection(
"0x10A19e7eE7d7F8a52822f6817de8ea18204F2e4f",
1618272000,
backfill,
),
"Balancer Labs Fundraising Fund": (backfill: boolean) =>
balanceSection(
"0xB129F73f1AFd3A49C701241F374dB17AE63B20Eb",
1604192400,
backfill,
),
"Balancer Labs Contributors Incentives Program": (backfill: boolean) =>
balanceSection(
"0xCDcEBF1f28678eb4A1478403BA7f34C94F7dDBc5",
1592870400,
backfill,
),
meta: {
notes: [
"No information regarding the Founders, Options, Advisors, Investors unlock schedule is given in the source material, other than it had all been vested by Oct 23.",
Expand All @@ -41,29 +51,36 @@ const balancer: Protocol = {
{
key: "Liquidity Providers",
allocation: total * 0.65,
lastRecord: () => latest("balancer", 1618876800),
lastRecord: (backfill: boolean) =>
latest("balancer", 1618876800, backfill),
},
{
key: "Ecosystem",
allocation: total * 0.05,
lastRecord: () => latest("balancer", 1618272000),
lastRecord: (backfill: boolean) =>
latest("balancer", 1618272000, backfill),
},
{
key: "Balancer Labs Fundraising Fund",
allocation: total * 0.05,
lastRecord: () => latest("balancer", 1604192400),
lastRecord: (backfill: boolean) =>
latest("balancer", 1604192400, backfill),
},
{
key: "Balancer Labs Contributors Incentives Program",
allocation: total * 0.025,
lastRecord: () => latest("balancer", 1592870400),
lastRecord: (backfill: boolean) =>
latest("balancer", 1592870400, backfill),
},
],
},
categories: {
farming: ["Liquidity Providers"],
noncirculating: ["Ecosystem"],
privateSale: ["Balancer Labs Fundraising Fund","Balancer Labs Contributors Incentives Program"],
privateSale: [
"Balancer Labs Fundraising Fund",
"Balancer Labs Contributors Incentives Program",
],
insiders: ["Founders, Options, Advisors, Investors"],
},
};
Expand Down
5 changes: 3 additions & 2 deletions protocols/beam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ const start = 1634943600;

const beam: Protocol = {
"Merit Circle Treasury Funds": manualLinear(start, 1714052911, 27122501974),
Treasury: () =>
Treasury: (backfill: boolean) =>
balance(
["0x7e9e4c0876B2102F33A1d82117Cc73B7FddD0032"],
token,
chain,
"beam",
1697497200,
backfill,
),
"Contributors & Builders": manualLinear(
start,
Expand All @@ -41,7 +42,7 @@ const beam: Protocol = {
{
key: "Treasury",
allocation: total * 0.1846,
lastRecord: () => latest("beam", 1697497200),
lastRecord: (backfill: boolean) => latest("beam", 1697497200, backfill),
},
],
total,
Expand Down
10 changes: 6 additions & 4 deletions protocols/btrfly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@ const btrfly: Protocol = {
"V1 Supply": manualCliff(start, total * 0.224),
Seed: schedule(0.06),
"Founding Team": schedule(0.09),
"DAO Reserves": () =>
"DAO Reserves": (backfill: boolean) =>
balance(
["0xA52Fd396891E7A74b641a2Cb1A6999Fcf56B077e"],
token,
chain,
"btrfly",
1659974400,
backfill,
),
Olympus: [
manualLinear(start, start + periodToSeconds.year, 4875),
Expand Down Expand Up @@ -93,14 +94,15 @@ const btrfly: Protocol = {
{
key: "DAO Reserves",
allocation: total * 0.15,
lastRecord: () => latest("btrfly", 1659974400),
lastRecord: (backfill: boolean) =>
latest("btrfly", 1659974400, backfill),
},
],
total,
},
categories: {
farming: ["Olympus","V1 Supply"],
noncirculating: ["Pulse","DAO Reserves"],
farming: ["Olympus", "V1 Supply"],
noncirculating: ["Pulse", "DAO Reserves"],
privateSale: ["Seed"],
insiders: ["Founding Team"],
},
Expand Down
Loading
Loading