4
4
5
5
module Cardano.Db.Schema.Core.StakeDeligation where
6
6
7
- import Contravariant.Extras (contrazip5 , contrazip2 , contrazip4 )
7
+ import Contravariant.Extras (contrazip5 , contrazip2 , contrazip4 , contrazip6 )
8
8
import Data.ByteString.Char8 (ByteString )
9
9
import Data.Functor.Contravariant
10
10
import Data.Text (Text )
@@ -48,8 +48,8 @@ instance DbInfo StakeAddress where
48
48
49
49
type instance Key StakeAddress = StakeAddressId
50
50
51
- entityNameStakeAddressDecoder :: D. Row (Entity StakeAddress )
52
- entityNameStakeAddressDecoder =
51
+ entityStakeAddressDecoder :: D. Row (Entity StakeAddress )
52
+ entityStakeAddressDecoder =
53
53
Entity
54
54
<$> idDecoder StakeAddressId
55
55
<*> stakeAddressDecoder
@@ -61,8 +61,8 @@ stakeAddressDecoder =
61
61
<*> D. column (D. nonNullable D. text) -- stakeAddressView
62
62
<*> D. column (D. nullable D. bytea) -- stakeAddressScriptHash
63
63
64
- entityNameStakeAddressEncoder :: E. Params (Entity StakeAddress )
65
- entityNameStakeAddressEncoder =
64
+ entityStakeAddressEncoder :: E. Params (Entity StakeAddress )
65
+ entityStakeAddressEncoder =
66
66
mconcat
67
67
[ entityKey >$< idEncoder getStakeAddressId
68
68
, entityVal >$< stakeAddressEncoder
@@ -93,8 +93,8 @@ instance DbInfo StakeRegistration
93
93
94
94
type instance Key StakeRegistration = StakeRegistrationId
95
95
96
- entityNameStakeRegistrationDecoder :: D. Row (Entity StakeRegistration )
97
- entityNameStakeRegistrationDecoder =
96
+ entityStakeRegistrationDecoder :: D. Row (Entity StakeRegistration )
97
+ entityStakeRegistrationDecoder =
98
98
Entity
99
99
<$> idDecoder StakeRegistrationId
100
100
<*> stakeRegistrationDecoder
@@ -108,8 +108,8 @@ stakeRegistrationDecoder =
108
108
<*> maybeDbLovelaceDecoder -- stakeRegistrationDeposit
109
109
<*> idDecoder TxId -- stakeRegistrationTxId
110
110
111
- entityNameStakeRegistrationEncoder :: E. Params (Entity StakeRegistration )
112
- entityNameStakeRegistrationEncoder =
111
+ entityStakeRegistrationEncoder :: E. Params (Entity StakeRegistration )
112
+ entityStakeRegistrationEncoder =
113
113
mconcat
114
114
[ entityKey >$< idEncoder getStakeRegistrationId
115
115
, entityVal >$< stakeRegistrationEncoder
@@ -143,8 +143,8 @@ instance DbInfo StakeDeregistration
143
143
144
144
type instance Key StakeDeregistration = StakeDeregistrationId
145
145
146
- entityNameStakeDeregistrationDecoder :: D. Row (Entity StakeDeregistration )
147
- entityNameStakeDeregistrationDecoder =
146
+ entityStakeDeregistrationDecoder :: D. Row (Entity StakeDeregistration )
147
+ entityStakeDeregistrationDecoder =
148
148
Entity
149
149
<$> idDecoder StakeDeregistrationId
150
150
<*> stakeDeregistrationDecoder
@@ -158,8 +158,8 @@ stakeDeregistrationDecoder =
158
158
<*> idDecoder TxId -- stakeDeregistrationTxId
159
159
<*> maybeIdDecoder RedeemerId -- stakeDeregistrationRedeemerId
160
160
161
- entityNameStakeDeregistrationEncoder :: E. Params (Entity StakeDeregistration )
162
- entityNameStakeDeregistrationEncoder =
161
+ entityStakeDeregistrationEncoder :: E. Params (Entity StakeDeregistration )
162
+ entityStakeDeregistrationEncoder =
163
163
mconcat
164
164
[ entityKey >$< idEncoder getStakeDeregistrationId
165
165
, entityVal >$< stakeDeregistrationEncoder
@@ -195,8 +195,8 @@ instance DbInfo Delegation
195
195
196
196
type instance Key Delegation = DelegationId
197
197
198
- entityNameDelegationDecoder :: D. Row (Entity Delegation )
199
- entityNameDelegationDecoder =
198
+ entityDelegationDecoder :: D. Row (Entity Delegation )
199
+ entityDelegationDecoder =
200
200
Entity
201
201
<$> idDecoder DelegationId
202
202
<*> delegationDecoder
@@ -212,8 +212,8 @@ delegationDecoder =
212
212
<*> D. column (D. nonNullable $ fromIntegral <$> D. int8) -- delegationSlotNo
213
213
<*> maybeIdDecoder RedeemerId -- delegationRedeemerId
214
214
215
- entityNameDelegationEncoder :: E. Params (Entity Delegation )
216
- entityNameDelegationEncoder =
215
+ entityDelegationEncoder :: E. Params (Entity Delegation )
216
+ entityDelegationEncoder =
217
217
mconcat
218
218
[ entityKey >$< idEncoder getDelegationId
219
219
, entityVal >$< delegationEncoder
@@ -253,8 +253,8 @@ instance DbInfo Reward
253
253
254
254
type instance Key Reward = RewardId
255
255
256
- entityNameRewardDecoder :: D. Row (Entity Reward )
257
- entityNameRewardDecoder =
256
+ entityRewardDecoder :: D. Row (Entity Reward )
257
+ entityRewardDecoder =
258
258
Entity
259
259
<$> idDecoder RewardId
260
260
<*> rewardDecoder
@@ -269,8 +269,8 @@ rewardDecoder =
269
269
<*> D. column (D. nonNullable $ fromIntegral <$> D. int8) -- rewardSpendableEpoch
270
270
<*> idDecoder PoolHashId -- rewardPoolId
271
271
272
- entityNameRewardEncoder :: E. Params (Entity Reward )
273
- entityNameRewardEncoder =
272
+ entityRewardEncoder :: E. Params (Entity Reward )
273
+ entityRewardEncoder =
274
274
mconcat
275
275
[ entityKey >$< idEncoder getRewardId
276
276
, entityVal >$< rewardEncoder
@@ -287,6 +287,16 @@ rewardEncoder =
287
287
, rewardPoolId >$< idEncoder getPoolHashId
288
288
]
289
289
290
+ rewardBulkEncoder :: E. Params ([StakeAddressId ], [RewardSource ], [DbLovelace ], [Word64 ], [Word64 ], [PoolHashId ])
291
+ rewardBulkEncoder =
292
+ contrazip6
293
+ (manyEncoder $ idBulkEncoder getStakeAddressId)
294
+ (manyEncoder $ E. nonNullable rewardSourceEncoder)
295
+ (manyEncoder $ E. nonNullable $ fromIntegral . unDbLovelace >$< E. int8)
296
+ (manyEncoder $ E. nonNullable $ fromIntegral >$< E. int8)
297
+ (manyEncoder $ E. nonNullable $ fromIntegral >$< E. int8)
298
+ (manyEncoder $ idBulkEncoder getPoolHashId)
299
+
290
300
-----------------------------------------------------------------------------------------------------------------------------------
291
301
{-|
292
302
Table Name: reward_rest
@@ -304,8 +314,8 @@ instance DbInfo RewardRest
304
314
305
315
type instance Key RewardRest = RewardRestId
306
316
307
- entityNameRewardRestDecoder :: D. Row (Entity RewardRest )
308
- entityNameRewardRestDecoder =
317
+ entityRewardRestDecoder :: D. Row (Entity RewardRest )
318
+ entityRewardRestDecoder =
309
319
Entity
310
320
<$> idDecoder RewardRestId
311
321
<*> rewardRestDecoder
@@ -318,8 +328,8 @@ rewardRestDecoder =
318
328
<*> D. column (D. nonNullable $ fromIntegral <$> D. int8) -- rewardRestEarnedEpoch
319
329
<*> D. column (D. nonNullable $ fromIntegral <$> D. int8) -- rewardRestSpendableEpoch
320
330
321
- entityNameRewardRestEncoder :: E. Params (Entity RewardRest )
322
- entityNameRewardRestEncoder =
331
+ entityRewardRestEncoder :: E. Params (Entity RewardRest )
332
+ entityRewardRestEncoder =
323
333
mconcat
324
334
[ entityKey >$< idEncoder getRewardRestId
325
335
, entityVal >$< rewardRestEncoder
@@ -363,8 +373,8 @@ instance DbInfo EpochStake
363
373
364
374
type instance Key EpochStake = EpochStakeId
365
375
366
- entityNameEpochStakeDecoder :: D. Row (Entity EpochStake )
367
- entityNameEpochStakeDecoder =
376
+ entityEpochStakeDecoder :: D. Row (Entity EpochStake )
377
+ entityEpochStakeDecoder =
368
378
Entity
369
379
<$> idDecoder EpochStakeId
370
380
<*> epochStakeDecoder
@@ -377,8 +387,8 @@ epochStakeDecoder =
377
387
<*> dbLovelaceDecoder -- epochStakeAmount
378
388
<*> D. column (D. nonNullable $ fromIntegral <$> D. int8) -- epochStakeEpochNo
379
389
380
- entityNameEpochStakeEncoder :: E. Params (Entity EpochStake )
381
- entityNameEpochStakeEncoder =
390
+ entityEpochStakeEncoder :: E. Params (Entity EpochStake )
391
+ entityEpochStakeEncoder =
382
392
mconcat
383
393
[ entityKey >$< idEncoder getEpochStakeId
384
394
, entityVal >$< epochStakeEncoder
@@ -417,8 +427,8 @@ instance DbInfo EpochStakeProgress where
417
427
418
428
type instance Key EpochStakeProgress = EpochStakeProgressId
419
429
420
- entityNameEpochStakeProgressDecoder :: D. Row (Entity EpochStakeProgress )
421
- entityNameEpochStakeProgressDecoder =
430
+ entityEpochStakeProgressDecoder :: D. Row (Entity EpochStakeProgress )
431
+ entityEpochStakeProgressDecoder =
422
432
Entity
423
433
<$> idDecoder EpochStakeProgressId
424
434
<*> epochStakeProgressDecoder
@@ -429,8 +439,8 @@ epochStakeProgressDecoder =
429
439
<$> D. column (D. nonNullable $ fromIntegral <$> D. int8) -- epochStakeProgressEpochNo
430
440
<*> D. column (D. nonNullable D. bool) -- epochStakeProgressCompleted
431
441
432
- entityNameEpochStakeProgressEncoder :: E. Params (Entity EpochStakeProgress )
433
- entityNameEpochStakeProgressEncoder =
442
+ entityEpochStakeProgressEncoder :: E. Params (Entity EpochStakeProgress )
443
+ entityEpochStakeProgressEncoder =
434
444
mconcat
435
445
[ entityKey >$< idEncoder getEpochStakeProgressId
436
446
, entityVal >$< epochStakeProgressEncoder
0 commit comments