2

is it possible for a Validator to ensure that the redeemer pays some Value along with a certain Datum attached to it? Looking at the possible transaction methods on the ScriptContext, checks are only done on the Value and not the Datum. I see the DatumHash types but am not sure what it is used for.enter image description here

1
  • Hope my answer was helpful. I'm not sure if you're overloading the term "Redeemer" (the redeemer data type vs the sender of that tx). I think I got what you were going for though. LMK if I can clarify. – Mitchell Turner Jul 22 at 5:52
2

The validator can ensure that a datum or multiple datums are included in the output.

Take the Uniswap clone in the plutus-use-cases for example:

The validateCreate method ensures that an updated Factory datum

Constraints.checkOwnOutputConstraint ctx (OutputConstraint (Factory $ lp : lps) $ unitValue usCoin)

and a new Pool datum

Constraints.checkOwnOutputConstraint ctx (OutputConstraint (Pool lp liquidity) $ valueOf lpCoinA outA <> valueOf lpCoinB outB <> unitValue c)

are included in the outputs.

Both of these are attached to some Value.

2
  • 1
    Oh gosh I didn't know there was a whole library on On-Chain Constraints. Thank you! As for the term Redeemer, I believe the language used has been not-strict enough. So to my understanding, the person initiating the transaction is called the Redeemer, and he/she will supply a RedeemerType to the Validator to spend the underlying eUTXO. Link to the On-Chain constraints library: [github.com/input-output-hk/plutus/blob/… – Shannon Goh Jul 22 at 6:07
  • 1
    Yeah. The on-chain constraints are great and they compliment the off-chain constraints well. The more declarative the better :) – Mitchell Turner Jul 22 at 6:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.