1
1
import ADDRESSES from '../helpers/coreAssets.json'
2
2
import { Adapter , FetchOptions , FetchResultV2 } from "../adapters/types" ;
3
3
import { CHAIN } from "../helpers/chains" ;
4
+ import { getEulerVaultFee } from "../helpers/curators/index" ;
4
5
5
6
/**
6
7
*
7
8
* Usual takes RWA stablecoins from users and issue USD0 stablecoins
8
9
* Users can stake USD0, receive USD0++ and earn USUAL tokens
9
- * Users can stake USUAL, receive USUALx and earn USIAL tokens
10
+ * Users can stake USUAL, receive USUALx and earn USUAL tokens
10
11
*
11
- * There are fours places where Usual takes fees:
12
+ * There are four places where Usual takes fees:
12
13
* 1. Usual earns fees from locked RWA assets
13
14
* 2. When users redeem USD0 stablecoins, Usual takes an amount of redemption fees in USD0 tokens
14
15
* 3. When users early unstake USD0++ at floor price
15
16
* 4. When users early unstake USD0++, users must commit an amount of USUAL tokens
16
17
* these USUAL tokens then are burnt and distributed to USUALx stakers
18
+ * 5. Usual deployed Euler vaults for borrowing and takes borrow interest
17
19
*
18
20
* So:
19
- * We count 1, 2, 3 as protocol revenue
21
+ * We count 1, 2, 3, 5 as protocol revenue
20
22
* We count 4 as holder revenue
21
23
*
22
24
* There is no source of revenue for supply side users - USD0 minters.
@@ -25,21 +27,24 @@ import { CHAIN } from "../helpers/chains";
25
27
*/
26
28
27
29
const methodology = {
28
- Fees : 'Total USD0 redemption fees and USD0++ early unstake fees.' ,
30
+ Fees : 'Yields from underlying assets,usual stability loan interests, total USD0 redemption fees and USD0++ early unstake fees.' ,
31
+ Revenue : 'Total fees collected by protocol, distributed to USUAL token stakers, buyback and burn.' ,
29
32
ProtocolRevenue : 'Total fees are distributed to protocol treasury.' ,
30
- HoldersRevenue : 'Total fees are distributed to token holders. ' ,
33
+ HoldersRevenue : 'Total fees are distributed to token holders, token burns ' ,
31
34
}
32
35
33
36
const DaoCollateral = '0xde6e1F680C4816446C8D515989E2358636A38b04'
34
37
const Treasury = '0xdd82875f0840AAD58a455A70B88eEd9F59ceC7c7'
35
38
const USD0 = ADDRESSES . ethereum . USD0
36
39
const USUAL = '0xc4441c2be5d8fa8126822b9929ca0b81ea0de38e'
37
40
const USD0PP = '0x35d8949372d46b7a3d5a56006ae77b215fc69bc0'
41
+ const USUALX = '0x06B964d96f5dCF7Eae9d7C559B09EDCe244d4B8E'
38
42
39
43
const USYC = '0x136471a34f6ef19fe571effc1ca711fdb8e49f2b'
40
44
const USYCOracle = '0x4c48bcb2160F8e0aDbf9D4F3B034f1e36d1f8b3e'
41
45
const wM = '0x437cc33344a0B27A429f795ff6B469C72698B291'
42
46
const USUAL_wM = '0x4Cbc25559DbBD1272EC5B64c7b5F48a2405e6470'
47
+ const EULER_VAULTS = [ '0xd001f0a15D272542687b2677BA627f48A4333b5d' ]
43
48
44
49
const ContractAbis = {
45
50
// USYC
@@ -63,13 +68,14 @@ async function fetch(options: FetchOptions): Promise<FetchResultV2> {
63
68
const dailyFees = options . createBalances ( )
64
69
const dailyProtocolRevenue = options . createBalances ( )
65
70
const dailyHoldersRevenue = options . createBalances ( )
71
+ const dailyRevenue = options . createBalances ( )
66
72
67
73
const redeemEvents : Array < any > = await options . getLogs ( {
68
74
target : DaoCollateral ,
69
75
eventAbi : ContractAbis . RedeemEvent ,
70
76
} )
71
77
const feeSweptEvents : Array < any > = await options . getLogs ( {
72
- target : USD0PP ,
78
+ targets : [ USD0PP , USUALX ] ,
73
79
eventAbi : ContractAbis . FeeSweptEvent ,
74
80
} )
75
81
const usd0ppUnlockedFloorPriceEvents : Array < any > = await options . getLogs ( {
@@ -85,8 +91,9 @@ async function fetch(options: FetchOptions): Promise<FetchResultV2> {
85
91
dailyFees . add ( USUAL , Number ( event . amount ) )
86
92
87
93
// https://docs.usual.money/usual-products/usd0-liquid-staking-token/usd0++-early-redemption-mechanism#how-does-it-work
88
- const forHolders = Number ( event . amount ) * 0.67
89
- dailyHoldersRevenue . add ( USUAL , forHolders )
94
+ //67% of the fees are distributed to USUALx,Usual* stakers
95
+ //33% of the fees are burnt
96
+ dailyHoldersRevenue . add ( USUAL , Number ( event . amount ) )
90
97
}
91
98
for ( const event of usd0ppUnlockedFloorPriceEvents ) {
92
99
const feeAmount = Number ( event . usd0ppAmount ) - Number ( event . usd0Amount )
@@ -133,9 +140,14 @@ async function fetch(options: FetchOptions): Promise<FetchResultV2> {
133
140
134
141
dailyFees . addUSDValue ( totalRwaYield )
135
142
dailyProtocolRevenue . addUSDValue ( totalRwaYield )
143
+ await getEulerVaultFee ( options , { dailyFees, dailyRevenue } , EULER_VAULTS )
144
+
145
+ dailyRevenue . add ( dailyProtocolRevenue )
146
+ dailyRevenue . add ( dailyHoldersRevenue )
136
147
137
148
return {
138
149
dailyFees,
150
+ dailyRevenue,
139
151
dailyProtocolRevenue,
140
152
dailyHoldersRevenue,
141
153
}
0 commit comments