-
Notifications
You must be signed in to change notification settings - Fork 212
Add mustPayWithDatumToPubKey (fix #146). #154
Conversation
@@ -85,7 +85,7 @@ checkTxConstraint ctx@ScriptContext{scriptContextTxInfo} = \case | |||
MustMintValue mps _ tn v -> | |||
traceIfFalse "L9" -- "Value minted not OK" | |||
$ Value.valueOf (txInfoMint scriptContextTxInfo) (Value.mpsSymbol mps) tn == v | |||
MustPayToPubKey pk vl -> | |||
MustPayToPubKey pk _ vl -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should do a datum check too, just like MustPayToOtherScript
? Probably you should make checkOutput
from there usable by both.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm, I guess so. I've just wrote a contract test to ensure that datum is presented in TxOut
and it seems to work. How do I test datumWitnesses
and checkOutput
behaviour?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You only check for the hash, the actual datum probably isn't available. You can check that with findDatum
.
checkOutput
behaviour is a bit harder to test since the constraint mechanism should make sure a transaction satisfies it. I guess you should at least make sure the OnChain code is called by some test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tried to test the datum's presence but something isn't working. Test passes with any validator results. I guess I'm doing something wrong. But I have fixed the comments.
4b53944
to
58d2ede
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Should fix #146.
Pre-submit checklist: