Skip to content

Commit a1affea

Browse files
KPHEMRAJg1nt0ki
andauthored
track treehouse fee + fix typo (#4219)
* track treehouse fee + fix typo * performance fee description * add tAvax * minor fix --------- Co-authored-by: g1nt0ki <[email protected]>
1 parent 430773a commit a1affea

File tree

5 files changed

+102
-16
lines changed

5 files changed

+102
-16
lines changed

fees/gauntlet.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,13 @@ const fetchSolana = async (_t: any, _a: any, options: FetchOptions) => {
147147
if (managerFeesData && managerFeesData.length > 0) {
148148
managerFeesData.forEach((fee: any) => {
149149
if (fee.total_amount && fee.token_mint_address) {
150-
dailyRevenue.add(fee.token_mint_address, fee.total_amount, METRIC.MANAGERMENT_FEES);
150+
dailyRevenue.add(fee.token_mint_address, fee.total_amount, METRIC.MANAGEMENT_FEES);
151151
}
152152
});
153153
}
154154

155155
// add revenue to fees
156-
const dailyFees = dailyRevenue.clone(1, METRIC.MANAGERMENT_FEES);
156+
const dailyFees = dailyRevenue.clone(1, METRIC.MANAGEMENT_FEES);
157157
const dailySupplySideRevenue = options.createBalances();
158158

159159
const grossReturns = await calculateGrossReturns(options);
@@ -194,15 +194,15 @@ const methodology = {
194194
const breakdownMethodology = {
195195
Fees: {
196196
[METRIC.ASSETS_YIELDS]: "Daily value generated for depositors from vault operations during the specified time period (includes both gains and losses)",
197-
[METRIC.MANAGERMENT_FEES]: "Management fees chagred by Gauntlet",
197+
[METRIC.MANAGEMENT_FEES]: "Management fees chagred by Gauntlet",
198198
},
199199
Revenue: {
200200
[METRIC.ASSETS_YIELDS]: "Daily performance fees claimed by the Gauntlet manager during the specified time period",
201-
[METRIC.MANAGERMENT_FEES]: "Management fees chagred by Gauntlet",
201+
[METRIC.MANAGEMENT_FEES]: "Management fees chagred by Gauntlet",
202202
},
203203
ProtocolRevenue: {
204204
[METRIC.ASSETS_YIELDS]: "Daily performance fees claimed by the Gauntlet manager during the specified time period",
205-
[METRIC.MANAGERMENT_FEES]: "Management fees chagred by Gauntlet",
205+
[METRIC.MANAGEMENT_FEES]: "Management fees chagred by Gauntlet",
206206
},
207207
SupplySideRevenue: {
208208
[METRIC.ASSETS_YIELDS]: "Amount of yields distributed to supply-side depositors.",

fees/openeden-usdo.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const configs: Record<string, OpenEdenConfig> = {
2020
}
2121

2222
// https://docs.openeden.com/tbill/fees#total-expense-ratio
23-
const MANAGERMENT_FEES_RATE = 0.003; // 0.3% per year
23+
const MANAGEMENT_FEES_RATE = 0.003; // 0.3% per year
2424

2525
const fetch = async (options: FetchOptions) => {
2626
const dailyMintRedeemFees = options.createBalances();
@@ -43,10 +43,10 @@ const fetch = async (options: FetchOptions) => {
4343
})
4444

4545
const currentPeriod = options.toTimestamp - options.fromTimestamp
46-
const managementFees = Number(totalSupply) * MANAGERMENT_FEES_RATE * currentPeriod / (365 * 24 * 3600)
46+
const managementFees = Number(totalSupply) * MANAGEMENT_FEES_RATE * currentPeriod / (365 * 24 * 3600)
4747

48-
dailyFees.add(configs[options.chain].USDO, managementFees, METRIC.MANAGERMENT_FEES)
49-
dailyRevenue.add(configs[options.chain].USDO, managementFees, METRIC.MANAGERMENT_FEES)
48+
dailyFees.add(configs[options.chain].USDO, managementFees, METRIC.MANAGEMENT_FEES)
49+
dailyRevenue.add(configs[options.chain].USDO, managementFees, METRIC.MANAGEMENT_FEES)
5050

5151
// -- yields distributed to USDO holders via rebasing
5252
const rateBefore = await options.fromApi.call({
@@ -86,18 +86,18 @@ const breakdownMethodology = {
8686
Fees: {
8787
[METRIC.ASSETS_YIELDS]: 'USDO backing assets yields from all investments.',
8888
[METRIC.MINT_REDEEM_FEES]: 'Fees from mint/redeem USDO.',
89-
[METRIC.MANAGERMENT_FEES]: '0.3% annual management fees.',
89+
[METRIC.MANAGEMENT_FEES]: '0.3% annual management fees.',
9090
},
9191
UserFees: {
9292
[METRIC.MINT_REDEEM_FEES]: 'Users pay fees when mint/redeem USDO.',
9393
},
9494
Revenue: {
9595
[METRIC.MINT_REDEEM_FEES]: 'Fees from mint/redeem USDO.',
96-
[METRIC.MANAGERMENT_FEES]: '0.3% annual management fees.',
96+
[METRIC.MANAGEMENT_FEES]: '0.3% annual management fees.',
9797
},
9898
ProtocolRevenue: {
9999
[METRIC.MINT_REDEEM_FEES]: 'Fees from mint/redeem USDO.',
100-
[METRIC.MANAGERMENT_FEES]: '0.3% annual management fees.',
100+
[METRIC.MANAGEMENT_FEES]: '0.3% annual management fees.',
101101
},
102102
SupplySideRevenue: {
103103
[METRIC.ASSETS_YIELDS]: 'USDO backing assets yields from all investments.',

fees/treehouse-protocol/index.ts

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
import { FetchOptions, SimpleAdapter } from "../../adapters/types";
2+
import { CHAIN } from "../../helpers/chains";
3+
import { METRIC } from "../../helpers/metrics";
4+
5+
const EVENT_ABI = {
6+
MARKED: "event Marked (uint8 type, uint256 amount, uint256 fees)",
7+
STANDARD_REDEMPTION: "event RedeemFinalized (address indexed user, uint256 assets, uint256 fee)",
8+
FASTLANE_REDEMPTION: "event Redeemed (address indexed user, uint256 shares, uint256 assets, uint256 fee)"
9+
};
10+
11+
const ADDRESSES: any = {
12+
[CHAIN.ETHEREUM]: {
13+
accounting: "0xb7Ce3cb5Bc5c00cd2f9B39d9b0580f5355535709",
14+
token: "0xD11c452fc99cF405034ee446803b6F6c1F6d5ED8", //tEth
15+
redemption: "0xcd63a29FAfF07130d3Af89bB4f40778938AaBB85",
16+
fastlaneRedemption: "0x829525417Cd78CBa0f99A8736426fC299506C0d6",
17+
stakedToken: "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0" // Lido wstEth
18+
},
19+
[CHAIN.AVAX]: {
20+
accounting: "0x6f5D00a263dE6d40B4b2342996D2682E34f8A454",
21+
token: "0x14a84f1a61ccd7d1be596a6cc11fe33a36bc1646", //tAvax
22+
redemption: "0x765f6dc8496ca7EF1e4a391bE10185229AACf04b",
23+
fastlaneRedemption: "0x3D00a639183B07e35EFEF044eE6cC14e8598A01c",
24+
stakedToken: "0x2b2c81e08f1af8835a78bb2a90ae924ace0ea4be" //benqi sAvax
25+
}
26+
};
27+
28+
async function fetch(_a: any, _b: any, { chain, createBalances, getLogs, }: FetchOptions) {
29+
const { accounting, token, redemption, fastlaneRedemption, stakedToken } = ADDRESSES[chain]
30+
const dailySupplySideRevenue = createBalances();
31+
const dailyProtocolRevenue = createBalances();
32+
33+
const markedLogs = await getLogs({ target: accounting, eventAbi: EVENT_ABI.MARKED, });
34+
const standardRedemptionLogs = await getLogs({ target: redemption, eventAbi: EVENT_ABI.STANDARD_REDEMPTION });
35+
const fastlaneRedemptionLogs = await getLogs({ target: fastlaneRedemption, eventAbi: EVENT_ABI.FASTLANE_REDEMPTION });
36+
37+
38+
markedLogs.forEach(log => {
39+
dailySupplySideRevenue.add(token, log.amount, METRIC.ASSETS_YIELDS);
40+
dailyProtocolRevenue.add(token, log.fees, METRIC.PERFORMANCE_FEES);
41+
});
42+
standardRedemptionLogs.forEach(log => dailyProtocolRevenue.add(token, log.fee, METRIC.MINT_REDEEM_FEES));
43+
fastlaneRedemptionLogs.forEach(log => dailyProtocolRevenue.add(stakedToken, log.fee, METRIC.MINT_REDEEM_FEES));
44+
45+
const dailyFees = dailySupplySideRevenue.clone();
46+
dailyFees.add(dailyProtocolRevenue);
47+
48+
return {
49+
dailyFees,
50+
dailyRevenue: dailyProtocolRevenue,
51+
dailyHoldersRevenue: 0,
52+
dailyProtocolRevenue,
53+
dailySupplySideRevenue
54+
};
55+
}
56+
57+
const methodology = {
58+
Fees: "Includes Market Effective Yield(MEY) earned by treehouse assets and redemption fee",
59+
Revenue: "Standard Redemption(7 days waiting(tEth), 17 days waiting(tAvax)) fee of 0.05%,Fastlane redemption fee of 2%(tEth), 4%(tAvax) and 20% performance fee on MEY",
60+
ProtocolRevenue: "All the revenue goes to protocol treasury",
61+
HoldersRevenue: "No fee sharing to holders yet",
62+
SupplySideRevenue: "MEY earned by treehouse asset holders post performance fee",
63+
};
64+
65+
const breakdownMethodology = {
66+
Revenue: {
67+
[METRIC.MINT_REDEEM_FEES]: 'Standard and fastlane redemption fees',
68+
[METRIC.PERFORMANCE_FEES]: '20% perfomance fees on MEY only when MEY is positive'
69+
},
70+
SupplySideRevenue: {
71+
[METRIC.ASSETS_YIELDS]: 'Market effective yields post performance fees',
72+
},
73+
};
74+
75+
const adapter: SimpleAdapter = {
76+
fetch,
77+
methodology,
78+
breakdownMethodology,
79+
adapter: {
80+
[CHAIN.ETHEREUM]: { start: '2024-09-10' },
81+
[CHAIN.AVAX]: { start: '2025-08-28' }
82+
}
83+
};
84+
85+
export default adapter;

fees/yearn-finance.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ const breakdownMethodology = {
1919
},
2020
Revenue: {
2121
[METRIC.ASSETS_YIELDS]: 'Performance fees to Yearn treasury',
22-
[METRIC.MANAGERMENT_FEES]: 'Management fees to Yearn treasury',
22+
[METRIC.MANAGEMENT_FEES]: 'Management fees to Yearn treasury',
2323
},
2424
ProtocolRevenue: {
2525
[METRIC.ASSETS_YIELDS]: 'Performance fees to Yearn treasury',
26-
[METRIC.MANAGERMENT_FEES]: 'Management fees to Yearn treasury',
26+
[METRIC.MANAGEMENT_FEES]: 'Management fees to Yearn treasury',
2727
},
2828
}
2929

@@ -209,7 +209,7 @@ async function fetch(options: FetchOptions): Promise<FetchResultV2> {
209209
dailyFees.add(vault.token, tf, METRIC.ASSETS_YIELDS)
210210
dailySupplySideRevenue.add(vault.token, tf - protocolFees, METRIC.ASSETS_YIELDS)
211211
dailyProtocolRevenue.add(vault.token, performanceFees, METRIC.ASSETS_YIELDS)
212-
dailyProtocolRevenue.add(vault.token, managementFees, METRIC.MANAGERMENT_FEES)
212+
dailyProtocolRevenue.add(vault.token, managementFees, METRIC.MANAGEMENT_FEES)
213213
}
214214

215215
return {

helpers/metrics.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ export enum METRIC {
1212
ASSETS_YIELDS = 'Assets Yields', // protocols take users deposited assets and invest to other (on-chain or off-chain) platforms to generate yields
1313
MINT_REDEEM_FEES = 'Mint/Redeem Fees', // protocols take fees by mint/redeem tokens
1414
DEPOSIT_WITHDRAW_FEES = 'Deposit/Withdraw Fees', // protocols take fees by deposit or withdraw tokens
15-
MANAGERMENT_FEES = 'Management Fees', // protocols take fees manage assets for users
15+
MANAGEMENT_FEES = 'Management Fees', // protocols take fees manage assets for users
1616
TRANSACTION_GAS_FEES = 'Transaction Gas Fees', // Blockchain transactions gas fees paid by users
1717
TRANSACTION_BASE_FEES = 'Transaction Base Fees', // Blockchain transactions base fees paid by users
1818
TRANSACTION_PRIORITY_FEES = 'Transaction Priority Fees', // Blockchain transactions priority fees paid by users
1919
TRADING_FEES = 'Trading Fees', // apps, bots, frontend, wallets charge users fees by using trading
2020
MARGIN_FEES = 'Margin Fees', // perpetual, derivatives margin fees
2121
OPEN_CLOSE_FEES = 'Open/Close Fees', // trading open/close fees
22+
PERFORMANCE_FEES = 'Performance Fees' // protocols take fee based on how the assets under their management are performing
2223
}

0 commit comments

Comments
 (0)