@@ -31,14 +31,21 @@ public class LootboxService : ILootboxService, ILifecycleParticipant
3131 private Contract contract ;
3232 private Dictionary < string , RewardType > rewardTypeByTokenAddress ;
3333
34- public LootboxService ( LootboxServiceConfig config , IContractBuilder contractBuilder , IRpcProvider rpcProvider )
34+ public LootboxService (
35+ LootboxServiceConfig config ,
36+ IContractBuilder contractBuilder ,
37+ IRpcProvider rpcProvider )
3538 {
3639 this . rpcProvider = rpcProvider ;
3740 this . config = config ;
3841 this . contractBuilder = contractBuilder ;
3942 }
4043
41- public LootboxService ( LootboxServiceConfig config , IContractBuilder contractBuilder , IRpcProvider rpcProvider , ISigner signer )
44+ public LootboxService (
45+ LootboxServiceConfig config ,
46+ IContractBuilder contractBuilder ,
47+ IRpcProvider rpcProvider ,
48+ ISigner signer )
4249 : this ( config , contractBuilder , rpcProvider )
4350 {
4451 this . signer = signer ;
@@ -84,7 +91,8 @@ public async Task<List<uint>> GetLootboxTypes()
8491
8592 if ( bigIntTypes . Any ( v => v > int . MaxValue ) )
8693 {
87- throw new Web3Exception ( "Internal Error. Lootbox type is greater than int.MaxValue." ) ;
94+ throw new Web3Exception (
95+ "Internal Error. Lootbox type is greater than int.MaxValue." ) ;
8896 }
8997
9098 var types = bigIntTypes . Select ( bigInt => ( uint ) bigInt ) . ToList ( ) ;
@@ -101,12 +109,15 @@ public async Task<uint> BalanceOf(uint lootboxType)
101109
102110 public async Task < uint > BalanceOf ( string account , uint lootboxType )
103111 {
104- var response = await this . contract . Call ( "balanceOf" , new object [ ] { account , lootboxType } ) ;
112+ var response = await this . contract . Call (
113+ "balanceOf" ,
114+ new object [ ] { account , lootboxType } ) ;
105115 var bigIntBalance = ( BigInteger ) response [ 0 ] ;
106116
107117 if ( bigIntBalance > int . MaxValue )
108118 {
109- throw new Web3Exception ( "Internal Error. Balance is greater than int.MaxValue." ) ;
119+ throw new Web3Exception (
120+ "Internal Error. Balance is greater than int.MaxValue." ) ;
110121 }
111122
112123 var balance = ( uint ) bigIntBalance ;
@@ -141,18 +152,17 @@ public async Task<uint> OpeningLootboxType()
141152 var playerAddress = this . GetCurrentPlayerAddress ( ) ;
142153
143154 // This response is actually very different from all the others since it returns several components
144- var response =
145- ( List < ParameterOutput > ) ( await this . contract . Call (
146- "getOpenerRequestDetails" ,
147- new object [ ] { playerAddress } ) ) [ 0 ] ;
155+ var response = ( List < ParameterOutput > ) ( await this . contract . Call ( "getOpenerRequestDetails" , new object [ ] { playerAddress } ) ) [ 0 ] ;
148156 var address = ( string ) response [ 0 ] . Result ;
149157 var unitsToGet = ( BigInteger ) response [ 1 ] . Result ;
150158 var lootboxType = ( ( List < BigInteger > ) response [ 2 ] . Result ) [ 0 ] ;
151159 if ( ! string . IsNullOrEmpty ( address ) && unitsToGet == 0 )
152160 {
153161 // we can early return here, but, it's not necessary since unitstoget will be 0 regardless and this
154162 // call will fulfill every request that's been missing.
155- await this . contract . Send ( "recoverBoxes" , new object [ ] { playerAddress } ) ;
163+ await this . contract . Send (
164+ "recoverBoxes" ,
165+ new object [ ] { playerAddress } ) ;
156166 }
157167
158168 if ( unitsToGet > uint . MaxValue )
@@ -183,7 +193,9 @@ public async Task<bool> CanClaimRewards()
183193
184194 public async Task < bool > CanClaimRewards ( string account )
185195 {
186- var response = await this . contract . Call ( "canClaimRewards" , new object [ ] { account } ) ;
196+ var response = await this . contract . Call (
197+ "canClaimRewards" ,
198+ new object [ ] { account } ) ;
187199 var canClaimRewards = ( bool ) response [ 0 ] ;
188200
189201 return canClaimRewards ;
@@ -201,7 +213,9 @@ public async Task<LootboxRewards> ClaimRewards(string account)
201213 var ( _, receipt ) = await this . contract . SendWithReceipt ( "claimRewards" , new object [ ] { account } ) ;
202214 var logs = receipt . Logs . Select ( jToken => JsonConvert . DeserializeObject < FilterLog > ( jToken . ToString ( ) ) ) ;
203215 var eventAbi = EventExtensions . GetEventABI < RewardsClaimedEvent > ( ) ;
204- var eventLogs = logs . Select ( log => eventAbi . DecodeEvent < RewardsClaimedEvent > ( log ) ) . Where ( l => l != null ) ;
216+ var eventLogs = logs
217+ . Select ( log => eventAbi . DecodeEvent < RewardsClaimedEvent > ( log ) )
218+ . Where ( l => l != null ) ;
205219
206220 if ( ! eventLogs . Any ( ) )
207221 {
@@ -224,13 +238,15 @@ LootboxRewards ExtractRewards(IEnumerable<EventLog<RewardsClaimedEvent>> eventLo
224238 case RewardType . Erc20 :
225239 rewards . Erc20Rewards . Add ( new Erc20Reward
226240 {
227- ContractAddress = eventData . TokenAddress , AmountRaw = eventData . Amount ,
241+ ContractAddress = eventData . TokenAddress ,
242+ AmountRaw = eventData . Amount ,
228243 } ) ;
229244 break ;
230245 case RewardType . Erc721 :
231246 rewards . Erc721Rewards . Add ( new Erc721Reward
232247 {
233- ContractAddress = eventData . TokenAddress , TokenId = eventData . TokenId ,
248+ ContractAddress = eventData . TokenAddress ,
249+ TokenId = eventData . TokenId ,
234250 } ) ;
235251 break ;
236252 case RewardType . Erc1155 :
@@ -244,7 +260,8 @@ LootboxRewards ExtractRewards(IEnumerable<EventLog<RewardsClaimedEvent>> eventLo
244260 case RewardType . Erc1155Nft :
245261 rewards . Erc1155NftRewards . Add ( new Erc1155NftReward
246262 {
247- ContractAddress = eventData . TokenAddress , TokenId = eventData . TokenId ,
263+ ContractAddress = eventData . TokenAddress ,
264+ TokenId = eventData . TokenId ,
248265 } ) ;
249266 break ;
250267 case RewardType . Unset :
0 commit comments