@@ -14,6 +14,11 @@ struct LpVotes:
14
14
lp: address
15
15
weight: uint256
16
16
17
+ struct ManagedVenft :
18
+ id: uint256
19
+ amount: uint256
20
+ earned: uint256
21
+
17
22
struct Relay :
18
23
venft_id: uint256
19
24
decimals: uint8
@@ -30,7 +35,7 @@ struct Relay:
30
35
relay: address
31
36
inactive: bool
32
37
name: String[100 ]
33
- account_venft_ids : DynArray[uint256 , MAX_RESULTS]
38
+ account_venfts : DynArray[ManagedVenft , MAX_RESULTS]
34
39
35
40
36
41
interface IERC20 :
@@ -53,6 +58,11 @@ interface IVotingEscrow:
53
58
def locked (_venft_id: uint256 ) -> (uint128 , uint256 , bool ): view
54
59
def ownerToNFTokenIdList (_account: address , _index: uint256 ) -> uint256 : view
55
60
def voted (_venft_id: uint256 ) -> bool : view
61
+ def managedToLocked (_managed_venft_id: uint256 ) -> address : view
62
+ def weights (_venft_id: uint256 , _managed_venft_id: uint256 ) -> uint256 : view
63
+
64
+ interface IReward :
65
+ def earned (_token: address , _venft_id: uint256 ) -> uint256 : view
56
66
57
67
interface IRelayRegistry :
58
68
def getAll () -> DynArray[address , MAX_RELAYS]: view
@@ -134,7 +144,7 @@ def _byAddress(_relay: address, _account: address) -> Relay:
134
144
relay: IRelay = IRelay (_relay)
135
145
managed_id: uint256 = relay.mTokenId ()
136
146
137
- account_venft_ids : DynArray[uint256 , MAX_RESULTS] = empty (DynArray[uint256 , MAX_RESULTS])
147
+ account_venfts : DynArray[ManagedVenft , MAX_RESULTS] = empty (DynArray[ManagedVenft , MAX_RESULTS])
138
148
139
149
for venft_index in range (MAX_RESULTS):
140
150
account_venft_id: uint256 = self .ve.ownerToNFTokenIdList (_account, venft_index)
@@ -144,7 +154,15 @@ def _byAddress(_relay: address, _account: address) -> Relay:
144
154
145
155
account_venft_manager_id: uint256 = self .ve.idToManaged (account_venft_id)
146
156
if account_venft_manager_id == managed_id:
147
- account_venft_ids.append (account_venft_id)
157
+ locked_reward: IReward = IReward (self .ve.managedToLocked (account_venft_manager_id))
158
+ venft_weight: uint256 = self .ve.weights (account_venft_id, account_venft_manager_id)
159
+ earned: uint256 = locked_reward.earned (self .token, account_venft_id)
160
+
161
+ account_venfts.append (ManagedVenft ({
162
+ id: account_venft_id,
163
+ amount: venft_weight,
164
+ earned: earned
165
+ }))
148
166
149
167
votes: DynArray[LpVotes, MAX_PAIRS] = []
150
168
amount: uint128 = self .ve.locked (managed_id)[0 ]
@@ -207,5 +225,5 @@ def _byAddress(_relay: address, _account: address) -> Relay:
207
225
relay: _relay,
208
226
inactive: inactive,
209
227
name: relay.name (),
210
- account_venft_ids: account_venft_ids
228
+ account_venfts: account_venfts
211
229
})
0 commit comments