Skip to content

Commit 89adfc9

Browse files
committed
feat: supplySideRevenue for losses and better wording
1 parent 8cb9d01 commit 89adfc9

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

fees/frankencoin/index.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,13 @@ type RevenueQuery = {
2323
const fetch = async (options: FetchOptions) => {
2424
const dailyFees = options.createBalances();
2525
const dailyRevenue = options.createBalances();
26+
const dailyProtocolRevenue = options.createBalances();
27+
const dailySupplySideRevenue = options.createBalances();
2628

2729
const PROFIT_LOSS_QUERY = gql`
2830
query {
2931
frankencoinProfitLosss(
3032
where: {
31-
chainId: 1,
3233
created_gt: "${options.startTimestamp}",
3334
created_lte: "${options.endTimestamp}",
3435
}
@@ -65,16 +66,18 @@ const fetch = async (options: FetchOptions) => {
6566
}, 0n);
6667

6768
// Fees are the total profits in ZCHF
68-
dailyFees.add(ZCHF_ADDRESS, accumLosses);
69+
dailyFees.add(ZCHF_ADDRESS, accumProfits);
70+
dailyRevenue.add(ZCHF_ADDRESS, accumProfits);
71+
dailyProtocolRevenue.add(ZCHF_ADDRESS, accumProfits);
6972

70-
// Revenue is profits minus losses in ZCHF
71-
const revenue = accumProfits - accumLosses;
72-
dailyRevenue.add(ZCHF_ADDRESS, revenue > 0n ? revenue : 0n);
73+
// Interest paid by the protocol
74+
dailySupplySideRevenue.add(ZCHF_ADDRESS, accumLosses);
7375

7476
return {
7577
dailyFees,
7678
dailyRevenue,
77-
dailyProtocolRevenue: dailyRevenue,
79+
dailyProtocolRevenue,
80+
dailySupplySideRevenue,
7881
};
7982
};
8083

@@ -86,11 +89,11 @@ const adapter: SimpleAdapter = {
8689
start: '2023-10-28',
8790
meta: {
8891
methodology: {
89-
Fees: 'Total profits generated by the Frankencoin protocol in ZCHF tokens',
90-
Revenue:
91-
'Net revenue calculated as profits minus losses in ZCHF tokens',
92-
ProtocolRevenue:
93-
'All net revenue is retained by the protocol in ZCHF tokens',
92+
Fees: 'Profits generated by the Frankencoin protocol (Frankencoin Pool Shares)',
93+
Revenue: 'Net revenue is retained by the protocol',
94+
ProtocolRevenue: 'Net revenue is retained by the protocol',
95+
SupplySideRevenue:
96+
'Losses absorbed by the protocol, such as interest paid to lenders, auction shortfalls, and similar costs',
9497
},
9598
},
9699
},

0 commit comments

Comments
 (0)