Skip to content

Commit fcdd9fb

Browse files
committed
2 parents 28abe5c + df3d6fd commit fcdd9fb

34 files changed

+333
-223
lines changed

adapters/equilibria/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { getLogs, lookupBlock } from "@defillama/sdk/build/util";
44
import fetch from "node-fetch";
55
import abi from "./abi";
66
import { CliffAdapterResult } from "../../types/adapters";
7-
import { RESOLUTION_SECONDS } from "../../utils/constants";
87

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

2423
let res: number;
2524

26-
export async function latest(key: string): Promise<number> {
25+
export async function latest(key: string, backfill: boolean): Promise<number> {
2726
if (!res)
2827
return fetch(`https://api.llama.fi/emission/${key}`)
2928
.then((r) => r.json())
3029
.then((r) => {
3130
try {
3231
return JSON.parse(r.body).then((r: any) =>
32+
backfill ||
3333
r.metadata.incompleteSections == null ||
3434
r.metadata.incompleteSections[0].lastRecord == null
3535
? boosterDeployed
@@ -96,10 +96,11 @@ export async function incentives(
9696
key: string,
9797
chains: string[],
9898
maxQty: number,
99+
backfill: boolean = false,
99100
) {
100101
const results: CliffAdapterResult[] = [];
101102
const timestampNow: number = unixTimestampNow();
102-
const from = await latest(key);
103+
const from = await latest(key, backfill);
103104
let workingQty: number = 0;
104105
let start: number = from;
105106

adapters/forta/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { balance, latest as late } from "../balance";
22
import contracts from "./contracts";
33

4-
export const unallocated = () =>
4+
export const unallocated = (backfill: boolean) =>
55
Promise.all(
66
Object.keys(contracts).map((k: any) =>
77
balance(
@@ -10,7 +10,9 @@ export const unallocated = () =>
1010
k,
1111
"forta",
1212
contracts[k].timestamp,
13+
backfill,
1314
),
1415
),
1516
);
16-
export const latest = () => late("forta", 1651356000);
17+
export const latest = (backfill: boolean) =>
18+
late("forta", 1651356000, backfill);

adapters/rocketpool/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ function calculateEmissions(
8787
return simulatedSupply - initialSupply;
8888
}
8989

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

109-
export async function emission(timestamp: number, type?: "node" | "trusted" | "protocol") {
110-
let trackedTimestamp = await latest(timestamp);
110+
export async function emission(timestamp: number, backfill: boolean = false, type?: "node" | "trusted" | "protocol") {
111+
let trackedTimestamp = await latest(timestamp, backfill);
111112
const chainData: ExtendedChainData = await findBlockHeightArray(trackedTimestamp, "ethereum");
112113
await PromisePool.withConcurrency(10)
113114
.for(Object.keys(chainData))

adapters/supply/index.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ import { PromisePool } from "@supercharge/promise-pool";
66

77
let res: number;
88

9-
export async function latest(key: string, reference: number): Promise<number> {
9+
export async function latest(
10+
key: string,
11+
reference: number,
12+
backfill: boolean = false,
13+
): Promise<number> {
1014
if (!res) {
1115
let r;
1216
try {
@@ -18,7 +22,8 @@ export async function latest(key: string, reference: number): Promise<number> {
1822
}
1923
if (!r.body) return reference;
2024
r = JSON.parse(r.body);
21-
return r.metadata.incompleteSections == null ||
25+
return backfill ||
26+
r.metadata.incompleteSections == null ||
2227
r.metadata.incompleteSections[0].lastRecord == null
2328
? reference
2429
: r.metadata.incompleteSections[0].lastRecord;
@@ -32,12 +37,13 @@ export async function supply(
3237
timestampDeployed: number,
3338
adapter: string,
3439
excluded: number = 0,
40+
backfill: boolean = false,
3541
) {
3642
let trackedTimestamp: number;
3743
let decimals: number;
3844

3945
[trackedTimestamp, decimals] = await Promise.all([
40-
latest(adapter, timestampDeployed),
46+
latest(adapter, timestampDeployed, backfill),
4147
call({
4248
target,
4349
abi: "erc20:decimals",

protocols/aerodrome.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const aerodrome: Protocol = {
7070
// },
7171
meta: {
7272
notes: [
73-
`After Epoch 67, emissions will be dependent on the AERO FED`,
73+
`After Epoch 67, emissions will be dependent on the AERO FED`,
7474
`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.`,
7575
`LP Emissions and Team emissions schedules have been estimated based on the chart given in the source data.`,
7676
],
@@ -82,7 +82,7 @@ const aerodrome: Protocol = {
8282
protocolIds: ["3450", "4524"],
8383
incompleteSections: [
8484
{
85-
lastRecord: () => latest("aerodrome", start),
85+
lastRecord: (backfill: boolean) => latest("aerodrome", start, backfill),
8686
key: "Supply",
8787
allocation: 2e9,
8888
},

protocols/apwine.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@ const apwine: Protocol = {
2121
total * 0.08264,
2222
),
2323
Bootstrap: manualCliff(start, total * 0.07),
24-
DAO: () =>
24+
DAO: (backfill: boolean) =>
2525
balance(
2626
["0xDbbfc051D200438dd5847b093B22484B842de9E7"],
2727
token,
2828
chain,
2929
"apwine",
3030
1621684800,
31+
backfill,
3132
),
3233
documented: {
3334
replaces: ["DAO"],
@@ -60,7 +61,8 @@ const apwine: Protocol = {
6061
protocolIds: ["1109"],
6162
incompleteSections: [
6263
{
63-
lastRecord: () => latest("apwine", 1621684800),
64+
lastRecord: (backfill: boolean) =>
65+
latest("apwine", 1621684800, backfill),
6466
key: "DAO",
6567
allocation: total * 0.56,
6668
},
@@ -72,7 +74,7 @@ const apwine: Protocol = {
7274
airdrop: ["Airdrop"],
7375
noncirculating: ["Ecosystem"],
7476
privateSale: ["Seed & Pre-seed"],
75-
insiders: ["Advisors","Team"],
77+
insiders: ["Advisors", "Team"],
7678
},
7779
};
7880
export default apwine;

protocols/arbitrum.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ const chain = "arbitrum";
1414
const arbitrum: Protocol = {
1515
Airdrop: manualCliff(start, qty * 0.1162),
1616
Foundation: manualLinear("2023-04-17", "2027-04-17", 75e7),
17-
"Arbitrum DAO Treasury": () =>
17+
"Arbitrum DAO Treasury": (backfill: boolean) =>
1818
balance(
1919
["0xF3FC178157fb3c87548bAA86F9d24BA38E649B58"],
2020
token,
2121
chain,
2222
"arbitrum",
2323
1686132532, // no outflows at this time
24+
backfill,
2425
),
2526
"Advisors Team OffchainLabs": [
2627
manualCliff(end_team_investors_1year, qty_advisors * 0.25), // 25% cliff after 1 year
@@ -51,12 +52,13 @@ const arbitrum: Protocol = {
5152
{
5253
key: "Arbitrum DAO Treasury",
5354
allocation: qty * 0.4278,
54-
lastRecord: () => latest("arbitrum", 1686132532), // no outflows at this time
55+
lastRecord: (backfill: boolean) =>
56+
latest("arbitrum", 1686132532, backfill), // no outflows at this time
5557
},
5658
],
5759
},
5860
categories: {
59-
noncirculating: ["Arbitrum DAO Treasury","Ecosystem Development Fund"],
61+
noncirculating: ["Arbitrum DAO Treasury", "Ecosystem Development Fund"],
6062
airdrop: ["Airdrop"],
6163
privateSale: ["Investors"],
6264
insiders: ["Advisors Team OffchainLabs"],

protocols/balancer.ts

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,38 @@ const total = 100_000_000; // 100 million
66
const token = "0xba100000625a3754423978a60c9317c58a424e3D";
77
const chain = "ethereum";
88

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

1212
const balancer: Protocol = {
13-
"Liquidity Providers": () =>
14-
balanceSection("0xBA12222222228d8Ba445958a75a0704d566BF2C8", 1618876800),
13+
"Liquidity Providers": (backfill: boolean) =>
14+
balanceSection(
15+
"0xBA12222222228d8Ba445958a75a0704d566BF2C8",
16+
1618876800,
17+
backfill,
18+
),
1519
"Founders, Options, Advisors, Investors": manualCliff(
1620
1696118400,
1721
total * 0.225,
1822
),
19-
Ecosystem: ()=>balanceSection(
20-
"0x10A19e7eE7d7F8a52822f6817de8ea18204F2e4f",
21-
1618272000,
22-
),
23-
"Balancer Labs Fundraising Fund": ()=>balanceSection(
24-
"0xB129F73f1AFd3A49C701241F374dB17AE63B20Eb",
25-
1604192400,
26-
),
27-
"Balancer Labs Contributors Incentives Program": ()=>balanceSection(
28-
"0xCDcEBF1f28678eb4A1478403BA7f34C94F7dDBc5",
29-
1592870400,
30-
),
23+
Ecosystem: (backfill: boolean) =>
24+
balanceSection(
25+
"0x10A19e7eE7d7F8a52822f6817de8ea18204F2e4f",
26+
1618272000,
27+
backfill,
28+
),
29+
"Balancer Labs Fundraising Fund": (backfill: boolean) =>
30+
balanceSection(
31+
"0xB129F73f1AFd3A49C701241F374dB17AE63B20Eb",
32+
1604192400,
33+
backfill,
34+
),
35+
"Balancer Labs Contributors Incentives Program": (backfill: boolean) =>
36+
balanceSection(
37+
"0xCDcEBF1f28678eb4A1478403BA7f34C94F7dDBc5",
38+
1592870400,
39+
backfill,
40+
),
3141
meta: {
3242
notes: [
3343
"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.",
@@ -41,29 +51,36 @@ const balancer: Protocol = {
4151
{
4252
key: "Liquidity Providers",
4353
allocation: total * 0.65,
44-
lastRecord: () => latest("balancer", 1618876800),
54+
lastRecord: (backfill: boolean) =>
55+
latest("balancer", 1618876800, backfill),
4556
},
4657
{
4758
key: "Ecosystem",
4859
allocation: total * 0.05,
49-
lastRecord: () => latest("balancer", 1618272000),
60+
lastRecord: (backfill: boolean) =>
61+
latest("balancer", 1618272000, backfill),
5062
},
5163
{
5264
key: "Balancer Labs Fundraising Fund",
5365
allocation: total * 0.05,
54-
lastRecord: () => latest("balancer", 1604192400),
66+
lastRecord: (backfill: boolean) =>
67+
latest("balancer", 1604192400, backfill),
5568
},
5669
{
5770
key: "Balancer Labs Contributors Incentives Program",
5871
allocation: total * 0.025,
59-
lastRecord: () => latest("balancer", 1592870400),
72+
lastRecord: (backfill: boolean) =>
73+
latest("balancer", 1592870400, backfill),
6074
},
6175
],
6276
},
6377
categories: {
6478
farming: ["Liquidity Providers"],
6579
noncirculating: ["Ecosystem"],
66-
privateSale: ["Balancer Labs Fundraising Fund","Balancer Labs Contributors Incentives Program"],
80+
privateSale: [
81+
"Balancer Labs Fundraising Fund",
82+
"Balancer Labs Contributors Incentives Program",
83+
],
6784
insiders: ["Founders, Options, Advisors, Investors"],
6885
},
6986
};

protocols/beam.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ const start = 1634943600;
1010

1111
const beam: Protocol = {
1212
"Merit Circle Treasury Funds": manualLinear(start, 1714052911, 27122501974),
13-
Treasury: () =>
13+
Treasury: (backfill: boolean) =>
1414
balance(
1515
["0x7e9e4c0876B2102F33A1d82117Cc73B7FddD0032"],
1616
token,
1717
chain,
1818
"beam",
1919
1697497200,
20+
backfill,
2021
),
2122
"Contributors & Builders": manualLinear(
2223
start,
@@ -41,7 +42,7 @@ const beam: Protocol = {
4142
{
4243
key: "Treasury",
4344
allocation: total * 0.1846,
44-
lastRecord: () => latest("beam", 1697497200),
45+
lastRecord: (backfill: boolean) => latest("beam", 1697497200, backfill),
4546
},
4647
],
4748
total,

protocols/btrfly.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,14 @@ const btrfly: Protocol = {
2828
"V1 Supply": manualCliff(start, total * 0.224),
2929
Seed: schedule(0.06),
3030
"Founding Team": schedule(0.09),
31-
"DAO Reserves": () =>
31+
"DAO Reserves": (backfill: boolean) =>
3232
balance(
3333
["0xA52Fd396891E7A74b641a2Cb1A6999Fcf56B077e"],
3434
token,
3535
chain,
3636
"btrfly",
3737
1659974400,
38+
backfill,
3839
),
3940
Olympus: [
4041
manualLinear(start, start + periodToSeconds.year, 4875),
@@ -93,14 +94,15 @@ const btrfly: Protocol = {
9394
{
9495
key: "DAO Reserves",
9596
allocation: total * 0.15,
96-
lastRecord: () => latest("btrfly", 1659974400),
97+
lastRecord: (backfill: boolean) =>
98+
latest("btrfly", 1659974400, backfill),
9799
},
98100
],
99101
total,
100102
},
101103
categories: {
102-
farming: ["Olympus","V1 Supply"],
103-
noncirculating: ["Pulse","DAO Reserves"],
104+
farming: ["Olympus", "V1 Supply"],
105+
noncirculating: ["Pulse", "DAO Reserves"],
104106
privateSale: ["Seed"],
105107
insiders: ["Founding Team"],
106108
},

0 commit comments

Comments
 (0)