Skip to content
This repository was archived by the owner on Dec 2, 2024. It is now read-only.

plutus-contract: Modifying addOutputs in emulator #474

Merged
merged 1 commit into from
May 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plutus-contract/src/Wallet/Emulator/Wallet.hs
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ splitOffAdaOnlyValue vl = if Value.isAdaOnlyValue vl || ada < Ledger.minAdaTxOut
ada = Ada.fromValue vl - Ledger.minAdaTxOut

addOutput :: PaymentPubKey -> Maybe StakePubKey -> Value -> Tx -> Tx
addOutput pk sk vl tx = tx & over Tx.outputs (pkos ++) where
addOutput pk sk vl tx = tx & over Tx.outputs (++ pkos) where
pkos = (\v -> Tx.pubKeyTxOut v pk sk) <$> splitOffAdaOnlyValue vl

addCollateral
Expand Down
10 changes: 5 additions & 5 deletions plutus-contract/test/Spec/Contract.hs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ tests =
tx <- submitTx payment
let txOuts = fmap fst $ Ledger.getCardanoTxOutRefs tx
-- tell the tx out' datum hash that was specified by 'mustPayWithDatumToPubKey'
tell [txOutDatumHash (txOuts !! 1)]
tell [txOutDatumHash (head txOuts)]

datum = Datum $ PlutusTx.toBuiltinData (23 :: Integer)
isExpectedDatumHash [Just hash] = hash == datumHash datum
Expand All @@ -245,7 +245,7 @@ tests =
datum2 = Datum $ PlutusTx.toBuiltinData (42 :: Integer)

in run "mustPayWithDatumToPubKey doesn't throw 'InOutTypeMismatch' error"
( assertNoFailedTransactions ) $ do
assertNoFailedTransactions $ do
_ <- activateContract w1 c1 tag
void (Trace.waitNSlots 2)
_ <- activateContract w2 c2 tag
Expand All @@ -257,9 +257,9 @@ tests =
let payment = Constraints.mustPayToPubKey w2PubKeyHash
(Ada.adaValueOf 10)
tx <- submitTx payment
-- There should be 2 utxos. We suppose the first belongs to the
-- wallet calling the contract and the second one to W2.
let utxo = head $ fmap snd $ Ledger.getCardanoTxOutRefs tx
-- There should be 2 utxos. We suppose the first belongs to W2
-- and the second one belongs to the wallet calling the contract.
let utxo = (fmap snd $ Ledger.getCardanoTxOutRefs tx) !! 1
-- We wait for W1's utxo to change status. It should be of
-- status confirmed unspent.
s <- awaitTxOutStatusChange utxo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,45 +10,45 @@ Slot 00001: W[10]: InsertionSuccess: New tip is Tip(Slot 1, BlockId 3c376d383360
Slot 00001: W[9]: InsertionSuccess: New tip is Tip(Slot 1, BlockId 3c376d383360ddc44271308f02ddb2a12f1cef21beb994afca459a5b1adeb877, BlockNumber 0). UTxO state was added to the end.
Slot 00001: W[3]: InsertionSuccess: New tip is Tip(Slot 1, BlockId 3c376d383360ddc44271308f02ddb2a12f1cef21beb994afca459a5b1adeb877, BlockNumber 0). UTxO state was added to the end.
Slot 00001: W[5]: InsertionSuccess: New tip is Tip(Slot 1, BlockId 3c376d383360ddc44271308f02ddb2a12f1cef21beb994afca459a5b1adeb877, BlockNumber 0). UTxO state was added to the end.
Slot 00001: W[1]: TxSubmit: 0f1bdcf1dada1558382086c8021192180466cdfb7d9ba3bb76f767f60e1a6df6
Slot 00001: TxnValidate 0f1bdcf1dada1558382086c8021192180466cdfb7d9ba3bb76f767f60e1a6df6
Slot 00001: W[1]: TxSubmit: c1697bf2fa7491d19fadf904626e74dff29fa194ad8a717e71d2bddbe3b67f6c
Slot 00001: TxnValidate c1697bf2fa7491d19fadf904626e74dff29fa194ad8a717e71d2bddbe3b67f6c
Slot 00001: SlotAdd Slot 2
Slot 00002: W[7]: InsertionSuccess: New tip is Tip(Slot 2, BlockId 213cde67f32888aa20478ee9813aaa8b6aa4fae467e8e1c00321079d31013ac0, BlockNumber 1). UTxO state was added to the end.
Slot 00002: W[8]: InsertionSuccess: New tip is Tip(Slot 2, BlockId 213cde67f32888aa20478ee9813aaa8b6aa4fae467e8e1c00321079d31013ac0, BlockNumber 1). UTxO state was added to the end.
Slot 00002: W[6]: InsertionSuccess: New tip is Tip(Slot 2, BlockId 213cde67f32888aa20478ee9813aaa8b6aa4fae467e8e1c00321079d31013ac0, BlockNumber 1). UTxO state was added to the end.
Slot 00002: W[4]: InsertionSuccess: New tip is Tip(Slot 2, BlockId 213cde67f32888aa20478ee9813aaa8b6aa4fae467e8e1c00321079d31013ac0, BlockNumber 1). UTxO state was added to the end.
Slot 00002: W[2]: InsertionSuccess: New tip is Tip(Slot 2, BlockId 213cde67f32888aa20478ee9813aaa8b6aa4fae467e8e1c00321079d31013ac0, BlockNumber 1). UTxO state was added to the end.
Slot 00002: W[1]: InsertionSuccess: New tip is Tip(Slot 2, BlockId 213cde67f32888aa20478ee9813aaa8b6aa4fae467e8e1c00321079d31013ac0, BlockNumber 1). UTxO state was added to the end.
Slot 00002: W[10]: InsertionSuccess: New tip is Tip(Slot 2, BlockId 213cde67f32888aa20478ee9813aaa8b6aa4fae467e8e1c00321079d31013ac0, BlockNumber 1). UTxO state was added to the end.
Slot 00002: W[9]: InsertionSuccess: New tip is Tip(Slot 2, BlockId 213cde67f32888aa20478ee9813aaa8b6aa4fae467e8e1c00321079d31013ac0, BlockNumber 1). UTxO state was added to the end.
Slot 00002: W[3]: InsertionSuccess: New tip is Tip(Slot 2, BlockId 213cde67f32888aa20478ee9813aaa8b6aa4fae467e8e1c00321079d31013ac0, BlockNumber 1). UTxO state was added to the end.
Slot 00002: W[5]: InsertionSuccess: New tip is Tip(Slot 2, BlockId 213cde67f32888aa20478ee9813aaa8b6aa4fae467e8e1c00321079d31013ac0, BlockNumber 1). UTxO state was added to the end.
Slot 00002: W[2]: TxSubmit: 88ebcd095b71ce9c5639ecd1fe54ef2b2ae2472f1191d65f412e2a6ba38eabb2
Slot 00002: TxnValidate 88ebcd095b71ce9c5639ecd1fe54ef2b2ae2472f1191d65f412e2a6ba38eabb2
Slot 00002: W[7]: InsertionSuccess: New tip is Tip(Slot 2, BlockId d70c937bb2b3975e90aaf548f2fa611a86cc5adbb06f81b985cf4b746e34e442, BlockNumber 1). UTxO state was added to the end.
Slot 00002: W[8]: InsertionSuccess: New tip is Tip(Slot 2, BlockId d70c937bb2b3975e90aaf548f2fa611a86cc5adbb06f81b985cf4b746e34e442, BlockNumber 1). UTxO state was added to the end.
Slot 00002: W[6]: InsertionSuccess: New tip is Tip(Slot 2, BlockId d70c937bb2b3975e90aaf548f2fa611a86cc5adbb06f81b985cf4b746e34e442, BlockNumber 1). UTxO state was added to the end.
Slot 00002: W[4]: InsertionSuccess: New tip is Tip(Slot 2, BlockId d70c937bb2b3975e90aaf548f2fa611a86cc5adbb06f81b985cf4b746e34e442, BlockNumber 1). UTxO state was added to the end.
Slot 00002: W[2]: InsertionSuccess: New tip is Tip(Slot 2, BlockId d70c937bb2b3975e90aaf548f2fa611a86cc5adbb06f81b985cf4b746e34e442, BlockNumber 1). UTxO state was added to the end.
Slot 00002: W[1]: InsertionSuccess: New tip is Tip(Slot 2, BlockId d70c937bb2b3975e90aaf548f2fa611a86cc5adbb06f81b985cf4b746e34e442, BlockNumber 1). UTxO state was added to the end.
Slot 00002: W[10]: InsertionSuccess: New tip is Tip(Slot 2, BlockId d70c937bb2b3975e90aaf548f2fa611a86cc5adbb06f81b985cf4b746e34e442, BlockNumber 1). UTxO state was added to the end.
Slot 00002: W[9]: InsertionSuccess: New tip is Tip(Slot 2, BlockId d70c937bb2b3975e90aaf548f2fa611a86cc5adbb06f81b985cf4b746e34e442, BlockNumber 1). UTxO state was added to the end.
Slot 00002: W[3]: InsertionSuccess: New tip is Tip(Slot 2, BlockId d70c937bb2b3975e90aaf548f2fa611a86cc5adbb06f81b985cf4b746e34e442, BlockNumber 1). UTxO state was added to the end.
Slot 00002: W[5]: InsertionSuccess: New tip is Tip(Slot 2, BlockId d70c937bb2b3975e90aaf548f2fa611a86cc5adbb06f81b985cf4b746e34e442, BlockNumber 1). UTxO state was added to the end.
Slot 00002: W[2]: TxSubmit: ec23776d76a95b6a3e6e619a552a87c7d145b56cb37112559f71c8aad8d04337
Slot 00002: TxnValidate ec23776d76a95b6a3e6e619a552a87c7d145b56cb37112559f71c8aad8d04337
Slot 00002: SlotAdd Slot 3
Slot 00003: W[7]: InsertionSuccess: New tip is Tip(Slot 3, BlockId 3dfe7716fc00b0134238900765487a88ace544e354ff2a77b28d2a0b5ec8e351, BlockNumber 2). UTxO state was added to the end.
Slot 00003: W[8]: InsertionSuccess: New tip is Tip(Slot 3, BlockId 3dfe7716fc00b0134238900765487a88ace544e354ff2a77b28d2a0b5ec8e351, BlockNumber 2). UTxO state was added to the end.
Slot 00003: W[6]: InsertionSuccess: New tip is Tip(Slot 3, BlockId 3dfe7716fc00b0134238900765487a88ace544e354ff2a77b28d2a0b5ec8e351, BlockNumber 2). UTxO state was added to the end.
Slot 00003: W[4]: InsertionSuccess: New tip is Tip(Slot 3, BlockId 3dfe7716fc00b0134238900765487a88ace544e354ff2a77b28d2a0b5ec8e351, BlockNumber 2). UTxO state was added to the end.
Slot 00003: W[2]: InsertionSuccess: New tip is Tip(Slot 3, BlockId 3dfe7716fc00b0134238900765487a88ace544e354ff2a77b28d2a0b5ec8e351, BlockNumber 2). UTxO state was added to the end.
Slot 00003: W[1]: InsertionSuccess: New tip is Tip(Slot 3, BlockId 3dfe7716fc00b0134238900765487a88ace544e354ff2a77b28d2a0b5ec8e351, BlockNumber 2). UTxO state was added to the end.
Slot 00003: W[10]: InsertionSuccess: New tip is Tip(Slot 3, BlockId 3dfe7716fc00b0134238900765487a88ace544e354ff2a77b28d2a0b5ec8e351, BlockNumber 2). UTxO state was added to the end.
Slot 00003: W[9]: InsertionSuccess: New tip is Tip(Slot 3, BlockId 3dfe7716fc00b0134238900765487a88ace544e354ff2a77b28d2a0b5ec8e351, BlockNumber 2). UTxO state was added to the end.
Slot 00003: W[3]: InsertionSuccess: New tip is Tip(Slot 3, BlockId 3dfe7716fc00b0134238900765487a88ace544e354ff2a77b28d2a0b5ec8e351, BlockNumber 2). UTxO state was added to the end.
Slot 00003: W[5]: InsertionSuccess: New tip is Tip(Slot 3, BlockId 3dfe7716fc00b0134238900765487a88ace544e354ff2a77b28d2a0b5ec8e351, BlockNumber 2). UTxO state was added to the end.
Slot 00003: W[3]: TxSubmit: 2453166a562aa57ea76d8509dea8817d30288c0f730fe30ac6cc26b026532442
Slot 00003: TxnValidate 2453166a562aa57ea76d8509dea8817d30288c0f730fe30ac6cc26b026532442
Slot 00003: W[7]: InsertionSuccess: New tip is Tip(Slot 3, BlockId beb5429f8b7ac003d1064247d8b9af07f0ed474b43177dae113060e03778c4a7, BlockNumber 2). UTxO state was added to the end.
Slot 00003: W[8]: InsertionSuccess: New tip is Tip(Slot 3, BlockId beb5429f8b7ac003d1064247d8b9af07f0ed474b43177dae113060e03778c4a7, BlockNumber 2). UTxO state was added to the end.
Slot 00003: W[6]: InsertionSuccess: New tip is Tip(Slot 3, BlockId beb5429f8b7ac003d1064247d8b9af07f0ed474b43177dae113060e03778c4a7, BlockNumber 2). UTxO state was added to the end.
Slot 00003: W[4]: InsertionSuccess: New tip is Tip(Slot 3, BlockId beb5429f8b7ac003d1064247d8b9af07f0ed474b43177dae113060e03778c4a7, BlockNumber 2). UTxO state was added to the end.
Slot 00003: W[2]: InsertionSuccess: New tip is Tip(Slot 3, BlockId beb5429f8b7ac003d1064247d8b9af07f0ed474b43177dae113060e03778c4a7, BlockNumber 2). UTxO state was added to the end.
Slot 00003: W[1]: InsertionSuccess: New tip is Tip(Slot 3, BlockId beb5429f8b7ac003d1064247d8b9af07f0ed474b43177dae113060e03778c4a7, BlockNumber 2). UTxO state was added to the end.
Slot 00003: W[10]: InsertionSuccess: New tip is Tip(Slot 3, BlockId beb5429f8b7ac003d1064247d8b9af07f0ed474b43177dae113060e03778c4a7, BlockNumber 2). UTxO state was added to the end.
Slot 00003: W[9]: InsertionSuccess: New tip is Tip(Slot 3, BlockId beb5429f8b7ac003d1064247d8b9af07f0ed474b43177dae113060e03778c4a7, BlockNumber 2). UTxO state was added to the end.
Slot 00003: W[3]: InsertionSuccess: New tip is Tip(Slot 3, BlockId beb5429f8b7ac003d1064247d8b9af07f0ed474b43177dae113060e03778c4a7, BlockNumber 2). UTxO state was added to the end.
Slot 00003: W[5]: InsertionSuccess: New tip is Tip(Slot 3, BlockId beb5429f8b7ac003d1064247d8b9af07f0ed474b43177dae113060e03778c4a7, BlockNumber 2). UTxO state was added to the end.
Slot 00003: W[3]: TxSubmit: 1b09f013eaf11d5d6229e7f7940c14506732e6a6d10348585f089fd21235c2af
Slot 00003: TxnValidate 1b09f013eaf11d5d6229e7f7940c14506732e6a6d10348585f089fd21235c2af
Slot 00003: SlotAdd Slot 4
Slot 00004: W[7]: InsertionSuccess: New tip is Tip(Slot 4, BlockId 2b12819680693bfe9b6bc0b3e478ef3dbe519b7259d632d95ac03fdba83dc035, BlockNumber 3). UTxO state was added to the end.
Slot 00004: W[8]: InsertionSuccess: New tip is Tip(Slot 4, BlockId 2b12819680693bfe9b6bc0b3e478ef3dbe519b7259d632d95ac03fdba83dc035, BlockNumber 3). UTxO state was added to the end.
Slot 00004: W[6]: InsertionSuccess: New tip is Tip(Slot 4, BlockId 2b12819680693bfe9b6bc0b3e478ef3dbe519b7259d632d95ac03fdba83dc035, BlockNumber 3). UTxO state was added to the end.
Slot 00004: W[4]: InsertionSuccess: New tip is Tip(Slot 4, BlockId 2b12819680693bfe9b6bc0b3e478ef3dbe519b7259d632d95ac03fdba83dc035, BlockNumber 3). UTxO state was added to the end.
Slot 00004: W[2]: InsertionSuccess: New tip is Tip(Slot 4, BlockId 2b12819680693bfe9b6bc0b3e478ef3dbe519b7259d632d95ac03fdba83dc035, BlockNumber 3). UTxO state was added to the end.
Slot 00004: W[1]: InsertionSuccess: New tip is Tip(Slot 4, BlockId 2b12819680693bfe9b6bc0b3e478ef3dbe519b7259d632d95ac03fdba83dc035, BlockNumber 3). UTxO state was added to the end.
Slot 00004: W[10]: InsertionSuccess: New tip is Tip(Slot 4, BlockId 2b12819680693bfe9b6bc0b3e478ef3dbe519b7259d632d95ac03fdba83dc035, BlockNumber 3). UTxO state was added to the end.
Slot 00004: W[9]: InsertionSuccess: New tip is Tip(Slot 4, BlockId 2b12819680693bfe9b6bc0b3e478ef3dbe519b7259d632d95ac03fdba83dc035, BlockNumber 3). UTxO state was added to the end.
Slot 00004: W[3]: InsertionSuccess: New tip is Tip(Slot 4, BlockId 2b12819680693bfe9b6bc0b3e478ef3dbe519b7259d632d95ac03fdba83dc035, BlockNumber 3). UTxO state was added to the end.
Slot 00004: W[5]: InsertionSuccess: New tip is Tip(Slot 4, BlockId 2b12819680693bfe9b6bc0b3e478ef3dbe519b7259d632d95ac03fdba83dc035, BlockNumber 3). UTxO state was added to the end.
Slot 00004: W[7]: InsertionSuccess: New tip is Tip(Slot 4, BlockId b463f803c477114a81a4cfcdc97fb5edd9048ac49dc5477c4ccfd71d11a28f24, BlockNumber 3). UTxO state was added to the end.
Slot 00004: W[8]: InsertionSuccess: New tip is Tip(Slot 4, BlockId b463f803c477114a81a4cfcdc97fb5edd9048ac49dc5477c4ccfd71d11a28f24, BlockNumber 3). UTxO state was added to the end.
Slot 00004: W[6]: InsertionSuccess: New tip is Tip(Slot 4, BlockId b463f803c477114a81a4cfcdc97fb5edd9048ac49dc5477c4ccfd71d11a28f24, BlockNumber 3). UTxO state was added to the end.
Slot 00004: W[4]: InsertionSuccess: New tip is Tip(Slot 4, BlockId b463f803c477114a81a4cfcdc97fb5edd9048ac49dc5477c4ccfd71d11a28f24, BlockNumber 3). UTxO state was added to the end.
Slot 00004: W[2]: InsertionSuccess: New tip is Tip(Slot 4, BlockId b463f803c477114a81a4cfcdc97fb5edd9048ac49dc5477c4ccfd71d11a28f24, BlockNumber 3). UTxO state was added to the end.
Slot 00004: W[1]: InsertionSuccess: New tip is Tip(Slot 4, BlockId b463f803c477114a81a4cfcdc97fb5edd9048ac49dc5477c4ccfd71d11a28f24, BlockNumber 3). UTxO state was added to the end.
Slot 00004: W[10]: InsertionSuccess: New tip is Tip(Slot 4, BlockId b463f803c477114a81a4cfcdc97fb5edd9048ac49dc5477c4ccfd71d11a28f24, BlockNumber 3). UTxO state was added to the end.
Slot 00004: W[9]: InsertionSuccess: New tip is Tip(Slot 4, BlockId b463f803c477114a81a4cfcdc97fb5edd9048ac49dc5477c4ccfd71d11a28f24, BlockNumber 3). UTxO state was added to the end.
Slot 00004: W[3]: InsertionSuccess: New tip is Tip(Slot 4, BlockId b463f803c477114a81a4cfcdc97fb5edd9048ac49dc5477c4ccfd71d11a28f24, BlockNumber 3). UTxO state was added to the end.
Slot 00004: W[5]: InsertionSuccess: New tip is Tip(Slot 4, BlockId b463f803c477114a81a4cfcdc97fb5edd9048ac49dc5477c4ccfd71d11a28f24, BlockNumber 3). UTxO state was added to the end.
Slot 00004: SlotAdd Slot 5
Slot 00005: W[7]: InsertionSuccess: New tip is Tip(Slot 5, BlockId 76be8b528d0075f7aae98d6fa57a6d3c83ae480a8469e668d7b0af968995ac71, BlockNumber 4). UTxO state was added to the end.
Slot 00005: W[8]: InsertionSuccess: New tip is Tip(Slot 5, BlockId 76be8b528d0075f7aae98d6fa57a6d3c83ae480a8469e668d7b0af968995ac71, BlockNumber 4). UTxO state was added to the end.
Expand Down
Loading