@@ -367,7 +367,7 @@ insertTx syncEnv isMember blkId epochNo slotNo applyResult blockIndex tx grouped
367
367
Generic. txMint tx
368
368
369
369
when (ioPlutusExtra iopts) $
370
- mapM_ (insertScript tracer txId) $
370
+ mapM_ (lift . insertScript tracer txId) $
371
371
Generic. txScripts tx
372
372
373
373
when (ioPlutusExtra iopts) $
@@ -402,7 +402,7 @@ prepareTxOut tracer cache iopts (txId, txHash) (Generic.TxOut index addr addrRaw
402
402
mScriptId <-
403
403
whenFalseEmpty (ioPlutusExtra iopts) Nothing $
404
404
whenMaybe mScript $
405
- insertScript tracer txId
405
+ lift . insertScript tracer txId
406
406
let ! txOut =
407
407
DB. TxOut
408
408
{ DB. txOutTxId = txId
@@ -441,7 +441,7 @@ insertCollateralTxOut tracer cache iopts (txId, _txHash) (Generic.TxOut index ad
441
441
mScriptId <-
442
442
whenFalseEmpty (ioPlutusExtra iopts) Nothing $
443
443
whenMaybe mScript $
444
- insertScript tracer txId
444
+ lift . insertScript tracer txId
445
445
_ <-
446
446
lift
447
447
. DB. insertCollateralTxOut
@@ -1390,16 +1390,15 @@ insertScript ::
1390
1390
Trace IO Text ->
1391
1391
DB. TxId ->
1392
1392
Generic. TxScript ->
1393
- ExceptT SyncNodeError ( ReaderT SqlBackend m ) DB. ScriptId
1393
+ ReaderT SqlBackend m DB. ScriptId
1394
1394
insertScript tracer txId script = do
1395
- mScriptId <- lift $ DB. queryScript $ Generic. txScriptHash script
1395
+ mScriptId <- DB. queryScript $ Generic. txScriptHash script
1396
1396
case mScriptId of
1397
1397
Just scriptId -> pure scriptId
1398
1398
Nothing -> do
1399
1399
json <- scriptConvert script
1400
- lift
1401
- . DB. insertScript
1402
- $ DB. Script
1400
+ DB. insertScript $
1401
+ DB. Script
1403
1402
{ DB. scriptTxId = txId
1404
1403
, DB. scriptHash = Generic. txScriptHash script
1405
1404
, DB. scriptType = Generic. txScriptType script
@@ -1479,7 +1478,7 @@ insertGovActionProposal cache blkId txId govExpiresAt (index, pp) = do
1479
1478
prevGovActionDBId <- case mprevGovAction of
1480
1479
Nothing -> pure Nothing
1481
1480
Just prevGovActionId -> Just <$> resolveGovActionProposal prevGovActionId
1482
- govActionProposal <-
1481
+ govActionProposalId <-
1483
1482
lift $
1484
1483
DB. insertGovActionProposal $
1485
1484
DB. GovActionProposal
@@ -1499,15 +1498,17 @@ insertGovActionProposal cache blkId txId govExpiresAt (index, pp) = do
1499
1498
, DB. govActionProposalExpiredEpoch = Nothing
1500
1499
}
1501
1500
case pProcGovAction pp of
1502
- TreasuryWithdrawals mp -> lift $ mapM_ (insertTreasuryWithdrawal govActionProposal) (Map. toList mp)
1503
- UpdateCommittee _ removed added q -> lift $ insertNewCommittee govActionProposal removed added q
1501
+ TreasuryWithdrawals mp -> lift $ mapM_ (insertTreasuryWithdrawal govActionProposalId) (Map. toList mp)
1502
+ UpdateCommittee _ removed added q -> lift $ insertNewCommittee govActionProposalId removed added q
1503
+ NewConstitution _ constitution -> lift $ insertConstitution txId govActionProposalId constitution
1504
1504
_ -> pure ()
1505
1505
where
1506
1506
mprevGovAction :: Maybe (GovActionId StandardCrypto ) = case pProcGovAction pp of
1507
1507
ParameterChange prv _ -> unPrevGovActionId <$> strictMaybeToMaybe prv
1508
1508
HardForkInitiation prv _ -> unPrevGovActionId <$> strictMaybeToMaybe prv
1509
1509
NoConfidence prv -> unPrevGovActionId <$> strictMaybeToMaybe prv
1510
1510
UpdateCommittee prv _ _ _ -> unPrevGovActionId <$> strictMaybeToMaybe prv
1511
+ NewConstitution prv _ -> unPrevGovActionId <$> strictMaybeToMaybe prv
1511
1512
_ -> Nothing
1512
1513
1513
1514
insertTreasuryWithdrawal gaId (rwdAcc, coin) = do
@@ -1541,6 +1542,16 @@ insertAnchor txId anchor =
1541
1542
, DB. votingAnchorDataHash = Generic. safeHashToByteString $ anchorDataHash anchor
1542
1543
}
1543
1544
1545
+ insertConstitution :: (MonadIO m , MonadBaseControl IO m ) => DB. TxId -> DB. GovActionProposalId -> Constitution StandardConway -> ReaderT SqlBackend m ()
1546
+ insertConstitution txId gapId constitution = do
1547
+ votingAnchorId <- insertAnchor txId $ constitutionAnchor constitution
1548
+ void . DB. insertConstitution $
1549
+ DB. Constitution
1550
+ { DB. constitutionGovActionProposalId = gapId
1551
+ , DB. constitutionVotingAnchorId = votingAnchorId
1552
+ , DB. constitutionScriptHash = Generic. unScriptHash <$> strictMaybeToMaybe (constitutionScript constitution)
1553
+ }
1554
+
1544
1555
insertVotingProcedures ::
1545
1556
(MonadIO m , MonadBaseControl IO m ) =>
1546
1557
Trace IO Text ->
0 commit comments