Skip to content

Commit cb5ccf1

Browse files
committed
update aerdorome
1 parent 8f0e940 commit cb5ccf1

File tree

1 file changed

+17
-101
lines changed

1 file changed

+17
-101
lines changed

protocols/aerodrome.ts

Lines changed: 17 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,24 @@
11
import { getEmissionsV2 } from "../adapters/aerodrome";
22
import { manualCliff, manualLinear } from "../adapters/manual";
33
import { latest, supply } from "../adapters/supply";
4-
import { LinearAdapterResult, Protocol } from "../types/adapters";
4+
import { CliffAdapterResult, LinearAdapterResult, Protocol } from "../types/adapters";
5+
import { queryDune } from "../utils/dune";
56
import { periodToSeconds } from "../utils/time";
67

78
const start = 1693267200;
89
const total = 5e8;
910
const chain = "base";
1011
const token = "0x940181a94a35a4569e4529a3cdfb74e38fd98631";
1112

12-
const emissions = (percentage: number): LinearAdapterResult[] => {
13-
const result: LinearAdapterResult[] = [];
14-
let rate = 0.0175;
15-
16-
let week = 0;
17-
let newTotal = total;
18-
let decay = -0.03;
19-
20-
while (true) {
21-
percentage;
22-
const amount = newTotal * rate;
23-
result.push({
24-
type: "linear",
25-
start: start + periodToSeconds.weeks(week),
26-
end: start + periodToSeconds.weeks(week + 1),
27-
amount: (amount * percentage) / 100,
28-
});
29-
newTotal *= 1 + rate;
30-
rate *= 1 - decay;
31-
week += 1;
32-
33-
if (week == 14) decay = 0.05;
34-
if (week == 30) decay = 0.0045;
35-
if (week == 67) break; // decay = 0.0225;
36-
if (week > 14 && amount < 9e6) break;
37-
}
38-
39-
return result;
13+
const emissionsDune = async (): Promise<CliffAdapterResult[]> => {
14+
const duneData = await queryDune("6160942", true);
15+
const filtered = duneData.map((row: any) => ({
16+
type: "cliff",
17+
start: Number(row.epoch),
18+
amount: Number(row.total_tokens_minted),
19+
isUnlock: false,
20+
}));
21+
return filtered;
4022
};
4123

4224
const aerodrome: Protocol = {
@@ -65,24 +47,22 @@ const aerodrome: Protocol = {
6547
start + periodToSeconds.years(2),
6648
total * 0.05,
6749
),
68-
"LP Emissions": emissions(95),
69-
"Team Emissions": emissions(5),
70-
"Rebase Emissions": () => getEmissionsV2("rebase"),
71-
"Gauge Emissions": () => getEmissionsV2("gauge"),
50+
"Emissions": emissionsDune,
7251
// },
7352
meta: {
7453
notes: [
7554
`After Epoch 67, emissions will be dependent on the AERO FED`,
7655
`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.`,
77-
`LP Emissions and Team emissions schedules have been estimated based on the chart given in the source data.`,
56+
`Emissions data is fetched from Dune Analytics (query 6160942) which provides epoch-based minting data.`,
7857
],
7958
token: `${chain}:${token}`,
8059
sources: [
8160
`https://aerodrome.finance/docs#tokenomics`,
8261
`https://github.com/aerodrome-finance/contracts/blob/main/contracts/Minter.sol#L170-L198`,
62+
`https://dune.com/queries/6160942`,
8363
],
8464
protocolIds: ["parent#aerodrome", "3450", "4524"],
85-
excludeFromAdjustedSupply: ["LP Emissions", "Team Emissions"],
65+
excludeFromAdjustedSupply: ["Emissions"],
8666
incompleteSections: [
8767
{
8868
lastRecord: (backfill: boolean) => latest("aerodrome", start, backfill),
@@ -92,72 +72,8 @@ const aerodrome: Protocol = {
9272
],
9373
},
9474
categories: {
95-
farming: ["Rebase Emissions", "Gauge Emissions"],
75+
farming: ["Emissions"],
9676
},
9777
};
9878

99-
export default aerodrome;
100-
101-
// let WEEKLY_DECAY = 9_900;
102-
// let WEEKLY_GROWTH = 10_300;
103-
// let MAX_BPS = 10_000;
104-
// let TAIL_START = 8_969_150 * 1e18;
105-
// let tailEmissionRate = 67;
106-
// let teamRate = 500;
107-
// let weekly = 10_000_000 * 1e18;
108-
// let epochCount = 0;
109-
// let totalSupply = 5e8 * 1e18;
110-
111-
// function main2() {
112-
// epochCount++;
113-
// let _emission;
114-
115-
// if (weekly < TAIL_START) {
116-
// _emission = (totalSupply * tailEmissionRate) / MAX_BPS;
117-
// } else {
118-
// _emission = weekly;
119-
// if (epochCount < 15) {
120-
// weekly = (weekly * WEEKLY_GROWTH) / MAX_BPS;
121-
// } else {
122-
// weekly = (weekly * WEEKLY_DECAY) / MAX_BPS;
123-
// }
124-
// }
125-
126-
// const _growth = calculateGrowth(_emission);
127-
128-
// const _rate = teamRate;
129-
// const _teamEmissions = (_rate * (_growth + weekly)) / (MAX_BPS - _rate);
130-
131-
// totalSupply = totalSupply += _teamEmissions;
132-
// return _teamEmissions;
133-
// }
134-
135-
// function calculateGrowth(_minted: number) {
136-
// let _veTotal = totalSupply * 0.4;
137-
// let _aeroTotal = totalSupply;
138-
139-
// return (
140-
// (((_minted * (_aeroTotal - _veTotal)) / _aeroTotal) *
141-
// (_aeroTotal - _veTotal)) /
142-
// _aeroTotal /
143-
// 2
144-
// );
145-
// }
146-
147-
// async function main() {
148-
// const emissions = [];
149-
// let start = 0;
150-
// let prevSupply = totalSupply;
151-
// for (let i = 0; i < 52; i++) {
152-
// main2();
153-
// emissions.push({
154-
// type: "linear",
155-
// start,
156-
// end: start + periodToSeconds.week,
157-
// amount: totalSupply - prevSupply,
158-
// });
159-
// prevSupply = totalSupply;
160-
// start += periodToSeconds.week;
161-
// }
162-
// return emissions;
163-
// }
79+
export default aerodrome;

0 commit comments

Comments
 (0)