@@ -21,16 +21,14 @@ class RocketEntityUtilities {
21
21
* Extracts the ID that is commonly used to identify an entity based on the given event.
22
22
*/
23
23
public extractIdForEntity ( event : ethereum . Event ) : string {
24
- return ! ! event && ! ! event . transaction && ! ! event . logIndex
25
- ? event . transaction . hash . toHex ( ) + '-' + event . logIndex . toString ( )
26
- : null
24
+ return event . transaction . hash . toHex ( ) + '-' + event . logIndex . toString ( ) ;
27
25
}
28
26
29
27
/**
30
28
* Attempts to create a new Staker.
31
29
*/
32
30
public extractStakerId ( address : Address ) : string {
33
- return ! ! address ? address . toHexString ( ) : null
31
+ return address . toHexString ( ) ;
34
32
}
35
33
36
34
/**
@@ -62,15 +60,13 @@ class RocketEntityUtilities {
62
60
blockNumber : BigInt ,
63
61
blockTimeStamp : BigInt ,
64
62
) : TransactionStakers {
65
- let transactionStakers = new TransactionStakers ( )
66
-
67
63
/*
68
64
* Load or attempt to create the (new) staker from whom the rETH is being transferred.
69
65
*/
70
66
let fromId = this . extractStakerId ( from )
71
- transactionStakers . fromStaker = < Staker > Staker . load ( fromId )
72
- if ( transactionStakers . fromStaker === null ) {
73
- transactionStakers . fromStaker = < Staker > (
67
+ let fromStaker : Staker | null = < Staker | null > Staker . load ( fromId ) ;
68
+ if ( fromStaker === null ) {
69
+ fromStaker = < Staker > (
74
70
rocketPoolEntityFactory . createStaker (
75
71
fromId ,
76
72
blockNumber ,
@@ -83,14 +79,14 @@ class RocketEntityUtilities {
83
79
* Load or attempt to create the (new) staker to whom the rETH is being transferred.
84
80
*/
85
81
let toId = this . extractStakerId ( to )
86
- transactionStakers . toStaker = < Staker > Staker . load ( toId )
87
- if ( transactionStakers . toStaker === null ) {
88
- transactionStakers . toStaker = < Staker > (
82
+ let toStaker : Staker | null = < Staker | null > Staker . load ( toId ) ;
83
+ if ( toStaker === null ) {
84
+ toStaker = < Staker > (
89
85
rocketPoolEntityFactory . createStaker ( toId , blockNumber , blockTimeStamp )
90
86
)
91
87
}
92
88
93
- return transactionStakers
89
+ return new TransactionStakers ( < Staker > fromStaker , < Staker > toStaker ) ;
94
90
}
95
91
96
92
/**
@@ -188,11 +184,21 @@ class RocketEntityUtilities {
188
184
export class TransactionStakers {
189
185
fromStaker : Staker
190
186
toStaker : Staker
187
+
188
+ constructor ( from : Staker , to : Staker ) {
189
+ this . fromStaker = from ;
190
+ this . toStaker = to ;
191
+ }
191
192
}
192
193
193
194
export class NetworkStakerRewardCheckpointSummary {
194
195
totalStakerETHRewardsSincePreviousCheckpoint : BigInt
195
196
totalStakerETHRewardsUpToThisCheckpoint : BigInt
197
+
198
+ constructor ( totalStakerETHRewardsSincePreviousCheckpoint : BigInt , totalStakerETHRewardsUpToThisCheckpoint : BigInt ) {
199
+ this . totalStakerETHRewardsSincePreviousCheckpoint = totalStakerETHRewardsSincePreviousCheckpoint ;
200
+ this . totalStakerETHRewardsUpToThisCheckpoint = totalStakerETHRewardsUpToThisCheckpoint ;
201
+ }
196
202
}
197
203
198
204
export let rocketEntityUtilities = new RocketEntityUtilities ( )
0 commit comments