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
10 changes: 5 additions & 5 deletions fees/gauntlet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,13 @@ const fetchSolana = async (_t: any, _a: any, options: FetchOptions) => {
if (managerFeesData && managerFeesData.length > 0) {
managerFeesData.forEach((fee: any) => {
if (fee.total_amount && fee.token_mint_address) {
dailyRevenue.add(fee.token_mint_address, fee.total_amount, METRIC.MANAGERMENT_FEES);
dailyRevenue.add(fee.token_mint_address, fee.total_amount, METRIC.MANAGEMENT_FEES);
}
});
}

// add revenue to fees
const dailyFees = dailyRevenue.clone(1, METRIC.MANAGERMENT_FEES);
const dailyFees = dailyRevenue.clone(1, METRIC.MANAGEMENT_FEES);
const dailySupplySideRevenue = options.createBalances();

const grossReturns = await calculateGrossReturns(options);
Expand Down Expand Up @@ -185,15 +185,15 @@ const methodology = {
const breakdownMethodology = {
Fees: {
[METRIC.ASSETS_YIELDS]: "Daily value generated for depositors from vault operations during the specified time period (includes both gains and losses)",
[METRIC.MANAGERMENT_FEES]: "Management fees chagred by Gauntlet",
[METRIC.MANAGEMENT_FEES]: "Management fees chagred by Gauntlet",
},
Revenue: {
[METRIC.ASSETS_YIELDS]: "Daily performance fees claimed by the Gauntlet manager during the specified time period",
[METRIC.MANAGERMENT_FEES]: "Management fees chagred by Gauntlet",
[METRIC.MANAGEMENT_FEES]: "Management fees chagred by Gauntlet",
},
ProtocolRevenue: {
[METRIC.ASSETS_YIELDS]: "Daily performance fees claimed by the Gauntlet manager during the specified time period",
[METRIC.MANAGERMENT_FEES]: "Management fees chagred by Gauntlet",
[METRIC.MANAGEMENT_FEES]: "Management fees chagred by Gauntlet",
},
SupplySideRevenue: {
[METRIC.ASSETS_YIELDS]: "Amount of yields distributed to supply-side depositors.",
Expand Down
14 changes: 7 additions & 7 deletions fees/openeden-usdo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const configs: Record<string, OpenEdenConfig> = {
}

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

const fetch = async (options: FetchOptions) => {
const dailyMintRedeemFees = options.createBalances();
Expand All @@ -43,10 +43,10 @@ const fetch = async (options: FetchOptions) => {
})

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

dailyFees.add(configs[options.chain].USDO, managementFees, METRIC.MANAGERMENT_FEES)
dailyRevenue.add(configs[options.chain].USDO, managementFees, METRIC.MANAGERMENT_FEES)
dailyFees.add(configs[options.chain].USDO, managementFees, METRIC.MANAGEMENT_FEES)
dailyRevenue.add(configs[options.chain].USDO, managementFees, METRIC.MANAGEMENT_FEES)

// -- yields distributed to USDO holders via rebasing
const rateBefore = await options.fromApi.call({
Expand Down Expand Up @@ -86,18 +86,18 @@ const breakdownMethodology = {
Fees: {
[METRIC.ASSETS_YIELDS]: 'USDO backing assets yields from all investments.',
[METRIC.MINT_REDEEM_FEES]: 'Fees from mint/redeem USDO.',
[METRIC.MANAGERMENT_FEES]: '0.3% annual management fees.',
[METRIC.MANAGEMENT_FEES]: '0.3% annual management fees.',
},
UserFees: {
[METRIC.MINT_REDEEM_FEES]: 'Users pay fees when mint/redeem USDO.',
},
Revenue: {
[METRIC.MINT_REDEEM_FEES]: 'Fees from mint/redeem USDO.',
[METRIC.MANAGERMENT_FEES]: '0.3% annual management fees.',
[METRIC.MANAGEMENT_FEES]: '0.3% annual management fees.',
},
ProtocolRevenue: {
[METRIC.MINT_REDEEM_FEES]: 'Fees from mint/redeem USDO.',
[METRIC.MANAGERMENT_FEES]: '0.3% annual management fees.',
[METRIC.MANAGEMENT_FEES]: '0.3% annual management fees.',
},
SupplySideRevenue: {
[METRIC.ASSETS_YIELDS]: 'USDO backing assets yields from all investments.',
Expand Down
85 changes: 85 additions & 0 deletions fees/treehouse-protocol/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import { FetchOptions, SimpleAdapter } from "../../adapters/types";
import { CHAIN } from "../../helpers/chains";
import { METRIC } from "../../helpers/metrics";

const EVENT_ABI = {
MARKED: "event Marked (uint8 type, uint256 amount, uint256 fees)",
STANDARD_REDEMPTION: "event RedeemFinalized (address indexed user, uint256 assets, uint256 fee)",
FASTLANE_REDEMPTION: "event Redeemed (address indexed user, uint256 shares, uint256 assets, uint256 fee)"
};

const ADDRESSES: any = {
[CHAIN.ETHEREUM]: {
accounting: "0xb7Ce3cb5Bc5c00cd2f9B39d9b0580f5355535709",
token: "0xD11c452fc99cF405034ee446803b6F6c1F6d5ED8", //tEth
redemption: "0xcd63a29FAfF07130d3Af89bB4f40778938AaBB85",
fastlaneRedemption: "0x829525417Cd78CBa0f99A8736426fC299506C0d6",
stakedToken: "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0" // Lido wstEth
},
[CHAIN.AVAX]: {
accounting: "0x6f5D00a263dE6d40B4b2342996D2682E34f8A454",
token: "0x14a84f1a61ccd7d1be596a6cc11fe33a36bc1646", //tAvax
redemption: "0x765f6dc8496ca7EF1e4a391bE10185229AACf04b",
fastlaneRedemption: "0x3D00a639183B07e35EFEF044eE6cC14e8598A01c",
stakedToken: "0x2b2c81e08f1af8835a78bb2a90ae924ace0ea4be" //benqi sAvax
}
};

async function fetch(_a: any, _b: any, { chain, createBalances, getLogs, }: FetchOptions) {
const { accounting, token, redemption, fastlaneRedemption, stakedToken } = ADDRESSES[chain]
const dailySupplySideRevenue = createBalances();
const dailyProtocolRevenue = createBalances();

const markedLogs = await getLogs({ target: accounting, eventAbi: EVENT_ABI.MARKED, });
const standardRedemptionLogs = await getLogs({ target: redemption, eventAbi: EVENT_ABI.STANDARD_REDEMPTION });
const fastlaneRedemptionLogs = await getLogs({ target: fastlaneRedemption, eventAbi: EVENT_ABI.FASTLANE_REDEMPTION });


markedLogs.forEach(log => {
dailySupplySideRevenue.add(token, log.amount, METRIC.ASSETS_YIELDS);
dailyProtocolRevenue.add(token, log.fees, METRIC.PERFORMANCE_FEES);
});
standardRedemptionLogs.forEach(log => dailyProtocolRevenue.add(token, log.fee, METRIC.MINT_REDEEM_FEES));
fastlaneRedemptionLogs.forEach(log => dailyProtocolRevenue.add(stakedToken, log.fee, METRIC.MINT_REDEEM_FEES));

const dailyFees = dailySupplySideRevenue.clone();
dailyFees.add(dailyProtocolRevenue);

return {
dailyFees,
dailyRevenue: dailyProtocolRevenue,
dailyHoldersRevenue: 0,
dailyProtocolRevenue,
dailySupplySideRevenue
};
}

const methodology = {
Fees: "Includes Market Effective Yield(MEY) earned by treehouse assets and redemption fee",
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",
ProtocolRevenue: "All the revenue goes to protocol treasury",
HoldersRevenue: "No fee sharing to holders yet",
SupplySideRevenue: "MEY earned by treehouse asset holders post performance fee",
};

const breakdownMethodology = {
Revenue: {
[METRIC.MINT_REDEEM_FEES]: 'Standard and fastlane redemption fees',
[METRIC.PERFORMANCE_FEES]: '20% perfomance fees on MEY only when MEY is positive'
},
SupplySideRevenue: {
[METRIC.ASSETS_YIELDS]: 'Market effective yields post performance fees',
},
};

const adapter: SimpleAdapter = {
fetch,
methodology,
breakdownMethodology,
adapter: {
[CHAIN.ETHEREUM]: { start: '2024-09-10' },
[CHAIN.AVAX]: { start: '2025-08-28' }
}
};

export default adapter;
6 changes: 3 additions & 3 deletions fees/yearn-finance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ const breakdownMethodology = {
},
Revenue: {
[METRIC.ASSETS_YIELDS]: 'Performance fees to Yearn treasury',
[METRIC.MANAGERMENT_FEES]: 'Management fees to Yearn treasury',
[METRIC.MANAGEMENT_FEES]: 'Management fees to Yearn treasury',
},
ProtocolRevenue: {
[METRIC.ASSETS_YIELDS]: 'Performance fees to Yearn treasury',
[METRIC.MANAGERMENT_FEES]: 'Management fees to Yearn treasury',
[METRIC.MANAGEMENT_FEES]: 'Management fees to Yearn treasury',
},
}

Expand Down Expand Up @@ -209,7 +209,7 @@ async function fetch(options: FetchOptions): Promise<FetchResultV2> {
dailyFees.add(vault.token, tf, METRIC.ASSETS_YIELDS)
dailySupplySideRevenue.add(vault.token, tf - protocolFees, METRIC.ASSETS_YIELDS)
dailyProtocolRevenue.add(vault.token, performanceFees, METRIC.ASSETS_YIELDS)
dailyProtocolRevenue.add(vault.token, managementFees, METRIC.MANAGERMENT_FEES)
dailyProtocolRevenue.add(vault.token, managementFees, METRIC.MANAGEMENT_FEES)
}

return {
Expand Down
3 changes: 2 additions & 1 deletion helpers/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ export enum METRIC {
ASSETS_YIELDS = 'Assets Yields', // protocols take users deposited assets and invest to other (on-chain or off-chain) platforms to generate yields
MINT_REDEEM_FEES = 'Mint/Redeem Fees', // protocols take fees by mint/redeem tokens
DEPOSIT_WITHDRAW_FEES = 'Deposit/Withdraw Fees', // protocols take fees by deposit or withdraw tokens
MANAGERMENT_FEES = 'Management Fees', // protocols take fees manage assets for users
MANAGEMENT_FEES = 'Management Fees', // protocols take fees manage assets for users
TRANSACTION_GAS_FEES = 'Transaction Gas Fees', // Blockchain transactions gas fees paid by users
TRANSACTION_BASE_FEES = 'Transaction Base Fees', // Blockchain transactions base fees paid by users
TRANSACTION_PRIORITY_FEES = 'Transaction Priority Fees', // Blockchain transactions priority fees paid by users
TRADING_FEES = 'Trading Fees', // apps, bots, frontend, wallets charge users fees by using trading
MARGIN_FEES = 'Margin Fees', // perpetual, derivatives margin fees
OPEN_CLOSE_FEES = 'Open/Close Fees', // trading open/close fees
PERFORMANCE_FEES = 'Performance Fees' // protocols take fee based on how the assets under their management are performing
}
Loading