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.
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 TurnerJul 22, 2021 at 5:52
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:
validateCreate method ensures that an updated
Constraints.checkOwnOutputConstraint ctx (OutputConstraint (Factory $ lp : lps) $ unitValue usCoin)
and a new
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
1Oh 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/… Jul 22, 2021 at 6:07
1Yeah. The on-chain constraints are great and they compliment the off-chain constraints well. The more declarative the better :) Jul 22, 2021 at 6:40