File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
cardano-db-sync/src/Cardano/DbSync Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ import Cardano.DbSync.Error
25
25
import Cardano.DbSync.Ledger.Event
26
26
import Cardano.DbSync.Types
27
27
import Cardano.DbSync.Util
28
+ import qualified Cardano.Ledger.Address as Ledger
28
29
import Cardano.Prelude
29
30
import Cardano.Slotting.Slot (EpochNo (.. ))
30
31
import Control.Monad.Extra (whenJust )
@@ -105,9 +106,8 @@ insertNewEpochLedgerEvents syncEnv currentEpochNo@(EpochNo curEpoch) =
105
106
forM_ en $ \ gar -> whenJust (garMTreasury gar) $ \ treasuryMap -> do
106
107
gaId <- resolveGovActionProposal (garGovActionId gar)
107
108
lift $ void $ DB. updateGovActionEnacted gaId (unEpochNo currentEpochNo)
108
- forM_ (Map. toList treasuryMap) $ \ (_ra, _c) ->
109
- -- TODO: Add reward
110
- pure ()
109
+ let rewards = Map. mapKeys Ledger. raCredential $ Map. map (Set. singleton . mkTreasuryReward) treasuryMap
110
+ insertRewardRests ntw (subFromCurrentEpoch 1 ) currentEpochNo cache (Map. toList rewards)
111
111
LedgerMirDist rwd -> do
112
112
unless (Map. null rwd) $ do
113
113
let rewards = Map. toList rwd
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ module Cardano.DbSync.Ledger.Event (
15
15
LedgerEvent (.. ),
16
16
GovActionRefunded (.. ),
17
17
convertAuxLedgerEvent ,
18
+ mkTreasuryReward ,
18
19
convertPoolRewards ,
19
20
ledgerEventName ,
20
21
splitDeposits ,
@@ -324,6 +325,13 @@ convertMirRewards resPay trePay =
324
325
, Generic. irAmount = coin
325
326
}
326
327
328
+ mkTreasuryReward :: Coin -> Generic. RewardRest
329
+ mkTreasuryReward c =
330
+ Generic. RewardRest
331
+ { Generic. irSource = RwdTreasury
332
+ , Generic. irAmount = c
333
+ }
334
+
327
335
convertPoolRewards ::
328
336
Map StakeCred (Set (Ledger. Reward StandardCrypto )) ->
329
337
Generic. Rewards
You can’t perform that action at this time.
0 commit comments