@@ -23,12 +23,13 @@ type RevenueQuery = {
23
23
const fetch = async ( options : FetchOptions ) => {
24
24
const dailyFees = options . createBalances ( ) ;
25
25
const dailyRevenue = options . createBalances ( ) ;
26
+ const dailyProtocolRevenue = options . createBalances ( ) ;
27
+ const dailySupplySideRevenue = options . createBalances ( ) ;
26
28
27
29
const PROFIT_LOSS_QUERY = gql `
28
30
query {
29
31
frankencoinProfitLosss(
30
32
where: {
31
- chainId: 1,
32
33
created_gt: "${ options . startTimestamp } ",
33
34
created_lte: "${ options . endTimestamp } ",
34
35
}
@@ -65,16 +66,18 @@ const fetch = async (options: FetchOptions) => {
65
66
} , 0n ) ;
66
67
67
68
// 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 ) ;
69
72
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 ) ;
73
75
74
76
return {
75
77
dailyFees,
76
78
dailyRevenue,
77
- dailyProtocolRevenue : dailyRevenue ,
79
+ dailyProtocolRevenue,
80
+ dailySupplySideRevenue,
78
81
} ;
79
82
} ;
80
83
@@ -86,11 +89,11 @@ const adapter: SimpleAdapter = {
86
89
start : '2023-10-28' ,
87
90
meta : {
88
91
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 ' ,
94
97
} ,
95
98
} ,
96
99
} ,
0 commit comments