Allow Datums and Redeemers for multiple validator scripts in a contract
MitchTurner opened this issue · 0 comments
Right now, my contracts are generic for just 1 type of datum and 1 type of redeemer. Granted, these can be enum
s, but, importantly, this still only allows 1 Validator per contract.
That's a bad constraint.
I want, at the very least, to provide a pattern to allow a contract writer to include multiple validator scripts in their contract. It might be as simple as doing nested datums and having one off-chain datum type that will hold the necessary on-chain datums, but we should make sure that this can be type checked before submission.
enum MyDatums {
ValidatorA(ValidatorADatum),
ValidatorB(ValidatorBDatum),
}
enum MyValidators {
ValidatorA(ValidatorACode),
ValidatorB(ValidatorBCode),
}
Something like this might work and just make the contract generic for MyDatums
and your implementation will enable the matching to happen. But this is far from a pit-of-success solution for consumers. Might be a good stop-gap, since it's a less common pattern probably.