@@ -31,24 +31,7 @@ import qualified Cardano.Ledger.Babbage.TxInfo as Babbage
31
31
import Cardano.Ledger.BaseTypes (Inject (.. ), ProtVer (.. ), strictMaybe )
32
32
import Cardano.Ledger.Coin (Coin (.. ))
33
33
import Cardano.Ledger.Conway.Scripts (ConwayPlutusPurpose (.. ))
34
- import Cardano.Ledger.Conway.TxInfo (
35
- ConwayContextError (.. ),
36
- ConwayEraPlutusTxInfo (.. ),
37
- guardConwayFeaturesForPlutusV1V2 ,
38
- scriptPurposeToScriptInfo ,
39
- toPlutusV3Args ,
40
- transMintValue ,
41
- transProposal ,
42
- transTxBodyId ,
43
- transTxBodyWithdrawals ,
44
- transTxCert ,
45
- transTxCertV1V2 ,
46
- transTxInInfoV1 ,
47
- transTxInInfoV3 ,
48
- transTxOutV1 ,
49
- transValidityInterval ,
50
- transVotingProcedures ,
51
- )
34
+ import Cardano.Ledger.Conway.TxInfo (ConwayContextError (.. ), ConwayEraPlutusTxInfo (.. ))
52
35
import qualified Cardano.Ledger.Conway.TxInfo as Conway
53
36
import Cardano.Ledger.Dijkstra.Core
54
37
import Cardano.Ledger.Dijkstra.Era (DijkstraEra )
@@ -152,19 +135,19 @@ transPlutusPurposeV3 pv = \case
152
135
Left $ inject $ PlutusPurposeNotSupported @ era . hoistPlutusPurpose @ era toAsItem $ inject purpose
153
136
154
137
instance EraPlutusTxInfo 'PlutusV1 DijkstraEra where
155
- toPlutusTxCert _ _ = transTxCertV1V2
138
+ toPlutusTxCert _ _ = Conway. transTxCertV1V2
156
139
157
140
toPlutusScriptPurpose proxy pv =
158
141
transPlutusPurposeV1V2 proxy pv . hoistPlutusPurpose toAsItem
159
142
160
143
toPlutusTxInfo proxy LedgerTxInfo {ltiProtVer, ltiEpochInfo, ltiSystemStart, ltiUTxO, ltiTx} = do
161
- guardConwayFeaturesForPlutusV1V2 ltiTx
162
- timeRange <- transValidityInterval ltiTx ltiEpochInfo ltiSystemStart (txBody ^. vldtTxBodyL)
163
- inputs <- mapM (transTxInInfoV1 ltiUTxO) (Set. toList (txBody ^. inputsTxBodyL))
164
- mapM_ (transTxInInfoV1 ltiUTxO) (Set. toList (txBody ^. referenceInputsTxBodyL))
144
+ Conway. guardConwayFeaturesForPlutusV1V2 ltiTx
145
+ timeRange <- Conway. transValidityInterval ltiTx ltiEpochInfo ltiSystemStart (txBody ^. vldtTxBodyL)
146
+ inputs <- mapM (Conway. transTxInInfoV1 ltiUTxO) (Set. toList (txBody ^. inputsTxBodyL))
147
+ mapM_ (Conway. transTxInInfoV1 ltiUTxO) (Set. toList (txBody ^. referenceInputsTxBodyL))
165
148
outputs <-
166
149
zipWithM
167
- (transTxOutV1 . TxOutFromOutput )
150
+ (Conway. transTxOutV1 . TxOutFromOutput )
168
151
[minBound .. ]
169
152
(F. toList (txBody ^. outputsTxBodyL))
170
153
txCerts <- Alonzo. transTxBodyCerts proxy ltiProtVer txBody
@@ -187,14 +170,14 @@ instance EraPlutusTxInfo 'PlutusV1 DijkstraEra where
187
170
toPlutusArgs = Alonzo. toPlutusV1Args
188
171
189
172
instance EraPlutusTxInfo 'PlutusV2 DijkstraEra where
190
- toPlutusTxCert _ _ = transTxCertV1V2
173
+ toPlutusTxCert _ _ = Conway. transTxCertV1V2
191
174
192
175
toPlutusScriptPurpose proxy pv = transPlutusPurposeV1V2 proxy pv . hoistPlutusPurpose toAsItem
193
176
194
177
toPlutusTxInfo proxy LedgerTxInfo {ltiProtVer, ltiEpochInfo, ltiSystemStart, ltiUTxO, ltiTx} = do
195
- guardConwayFeaturesForPlutusV1V2 ltiTx
178
+ Conway. guardConwayFeaturesForPlutusV1V2 ltiTx
196
179
timeRange <-
197
- transValidityInterval ltiTx ltiEpochInfo ltiSystemStart (txBody ^. vldtTxBodyL)
180
+ Conway. transValidityInterval ltiTx ltiEpochInfo ltiSystemStart (txBody ^. vldtTxBodyL)
198
181
inputs <- mapM (Babbage. transTxInInfoV2 ltiUTxO) (Set. toList (txBody ^. inputsTxBodyL))
199
182
refInputs <- mapM (Babbage. transTxInInfoV2 ltiUTxO) (Set. toList (txBody ^. referenceInputsTxBodyL))
200
183
outputs <-
@@ -225,18 +208,18 @@ instance EraPlutusTxInfo 'PlutusV2 DijkstraEra where
225
208
toPlutusArgs = Babbage. toPlutusV2Args
226
209
227
210
instance EraPlutusTxInfo 'PlutusV3 DijkstraEra where
228
- toPlutusTxCert _ pv = pure . transTxCert pv
211
+ toPlutusTxCert _ pv = pure . Conway. transTxCert pv
229
212
230
213
toPlutusScriptPurpose _ = transPlutusPurposeV3
231
214
232
215
toPlutusTxInfo proxy LedgerTxInfo {ltiProtVer, ltiEpochInfo, ltiSystemStart, ltiUTxO, ltiTx} = do
233
216
timeRange <-
234
- transValidityInterval ltiTx ltiEpochInfo ltiSystemStart (txBody ^. vldtTxBodyL)
217
+ Conway. transValidityInterval ltiTx ltiEpochInfo ltiSystemStart (txBody ^. vldtTxBodyL)
235
218
let
236
219
txInputs = txBody ^. inputsTxBodyL
237
220
refInputs = txBody ^. referenceInputsTxBodyL
238
- inputsInfo <- mapM (transTxInInfoV3 ltiUTxO) (Set. toList txInputs)
239
- refInputsInfo <- mapM (transTxInInfoV3 ltiUTxO) (Set. toList refInputs)
221
+ inputsInfo <- mapM (Conway. transTxInInfoV3 ltiUTxO) (Set. toList txInputs)
222
+ refInputsInfo <- mapM (Conway. transTxInInfoV3 ltiUTxO) (Set. toList refInputs)
240
223
let
241
224
commonInputs = txInputs `Set.intersection` refInputs
242
225
case toList commonInputs of
@@ -255,17 +238,17 @@ instance EraPlutusTxInfo 'PlutusV3 DijkstraEra where
255
238
, PV3. txInfoOutputs = outputs
256
239
, PV3. txInfoReferenceInputs = refInputsInfo
257
240
, PV3. txInfoFee = transCoinToLovelace (txBody ^. feeTxBodyL)
258
- , PV3. txInfoMint = transMintValue (txBody ^. mintTxBodyL)
241
+ , PV3. txInfoMint = Conway. transMintValue (txBody ^. mintTxBodyL)
259
242
, PV3. txInfoTxCerts = txCerts
260
- , PV3. txInfoWdrl = transTxBodyWithdrawals txBody
243
+ , PV3. txInfoWdrl = Conway. transTxBodyWithdrawals txBody
261
244
, PV3. txInfoValidRange = timeRange
262
245
, PV3. txInfoSignatories = Alonzo. transTxBodyReqSignerHashes txBody
263
246
, PV3. txInfoRedeemers = plutusRedeemers
264
247
, PV3. txInfoData = PV3. unsafeFromList $ Alonzo. transTxWitsDatums (ltiTx ^. witsTxL)
265
- , PV3. txInfoId = transTxBodyId txBody
266
- , PV3. txInfoVotes = transVotingProcedures (txBody ^. votingProceduresTxBodyL)
248
+ , PV3. txInfoId = Conway. transTxBodyId txBody
249
+ , PV3. txInfoVotes = Conway. transVotingProcedures (txBody ^. votingProceduresTxBodyL)
267
250
, PV3. txInfoProposalProcedures =
268
- map (transProposal proxy) $ toList (txBody ^. proposalProceduresTxBodyL)
251
+ map (Conway. transProposal proxy) $ toList (txBody ^. proposalProceduresTxBodyL)
269
252
, PV3. txInfoCurrentTreasuryAmount =
270
253
strictMaybe Nothing (Just . transCoinToLovelace) $ txBody ^. currentTreasuryValueTxBodyL
271
254
, PV3. txInfoTreasuryDonation =
@@ -276,7 +259,7 @@ instance EraPlutusTxInfo 'PlutusV3 DijkstraEra where
276
259
where
277
260
txBody = ltiTx ^. bodyTxL
278
261
279
- toPlutusArgs = toPlutusV3Args
262
+ toPlutusArgs = Conway. toPlutusV3Args
280
263
281
264
instance ConwayEraPlutusTxInfo 'PlutusV3 DijkstraEra where
282
265
toPlutusChangedParameters _ x = PV3. ChangedParameters (PV3. dataToBuiltinData (toPlutusData x))
@@ -285,18 +268,18 @@ instance ConwayEraPlutusTxInfo 'PlutusV4 DijkstraEra where
285
268
toPlutusChangedParameters _ x = PV3. ChangedParameters (PV3. dataToBuiltinData (toPlutusData x))
286
269
287
270
instance EraPlutusTxInfo 'PlutusV4 DijkstraEra where
288
- toPlutusTxCert _ pv = pure . transTxCert pv
271
+ toPlutusTxCert _ pv = pure . Conway. transTxCert pv
289
272
290
273
toPlutusScriptPurpose _ = error " stub: PlutusV4 not yet implemented"
291
274
292
275
toPlutusTxInfo proxy LedgerTxInfo {ltiProtVer, ltiEpochInfo, ltiSystemStart, ltiUTxO, ltiTx} = do
293
276
timeRange <-
294
- transValidityInterval ltiTx ltiEpochInfo ltiSystemStart (txBody ^. vldtTxBodyL)
277
+ Conway. transValidityInterval ltiTx ltiEpochInfo ltiSystemStart (txBody ^. vldtTxBodyL)
295
278
let
296
279
txInputs = txBody ^. inputsTxBodyL
297
280
refInputs = txBody ^. referenceInputsTxBodyL
298
- inputsInfo <- mapM (transTxInInfoV3 ltiUTxO) (Set. toList txInputs)
299
- refInputsInfo <- mapM (transTxInInfoV3 ltiUTxO) (Set. toList refInputs)
281
+ inputsInfo <- mapM (Conway. transTxInInfoV3 ltiUTxO) (Set. toList txInputs)
282
+ refInputsInfo <- mapM (Conway. transTxInInfoV3 ltiUTxO) (Set. toList refInputs)
300
283
let
301
284
commonInputs = txInputs `Set.intersection` refInputs
302
285
case toList commonInputs of
@@ -315,17 +298,17 @@ instance EraPlutusTxInfo 'PlutusV4 DijkstraEra where
315
298
, PV3. txInfoOutputs = outputs
316
299
, PV3. txInfoReferenceInputs = refInputsInfo
317
300
, PV3. txInfoFee = transCoinToLovelace (txBody ^. feeTxBodyL)
318
- , PV3. txInfoMint = transMintValue (txBody ^. mintTxBodyL)
301
+ , PV3. txInfoMint = Conway. transMintValue (txBody ^. mintTxBodyL)
319
302
, PV3. txInfoTxCerts = txCerts
320
- , PV3. txInfoWdrl = transTxBodyWithdrawals txBody
303
+ , PV3. txInfoWdrl = Conway. transTxBodyWithdrawals txBody
321
304
, PV3. txInfoValidRange = timeRange
322
305
, PV3. txInfoSignatories = Alonzo. transTxBodyReqSignerHashes txBody
323
306
, PV3. txInfoRedeemers = plutusRedeemers
324
307
, PV3. txInfoData = PV3. unsafeFromList $ Alonzo. transTxWitsDatums (ltiTx ^. witsTxL)
325
- , PV3. txInfoId = transTxBodyId txBody
326
- , PV3. txInfoVotes = transVotingProcedures (txBody ^. votingProceduresTxBodyL)
308
+ , PV3. txInfoId = Conway. transTxBodyId txBody
309
+ , PV3. txInfoVotes = Conway. transVotingProcedures (txBody ^. votingProceduresTxBodyL)
327
310
, PV3. txInfoProposalProcedures =
328
- map (transProposal proxy) $ toList (txBody ^. proposalProceduresTxBodyL)
311
+ map (Conway. transProposal proxy) $ toList (txBody ^. proposalProceduresTxBodyL)
329
312
, PV3. txInfoCurrentTreasuryAmount =
330
313
strictMaybe Nothing (Just . transCoinToLovelace) $ txBody ^. currentTreasuryValueTxBodyL
331
314
, PV3. txInfoTreasuryDonation =
@@ -350,9 +333,7 @@ toPlutusV4Args ::
350
333
toPlutusV4Args proxy pv txInfo plutusPurpose maybeSpendingData redeemerData = do
351
334
scriptPurpose <- toPlutusScriptPurpose proxy pv plutusPurpose
352
335
let scriptInfo =
353
- scriptPurposeToScriptInfo
354
- scriptPurpose
355
- (transDatum <$> maybeSpendingData)
336
+ Conway. scriptPurposeToScriptInfo scriptPurpose (transDatum <$> maybeSpendingData)
356
337
pure $
357
338
PlutusV4Args $
358
339
PV3. ScriptContext
0 commit comments