Another Shared Wallet Script
Writing the validator
data SharedWalletParam = SharedWalletParam {
wallet1 :: Plutus.PubKeyHash,
wallet2 :: Plutus.PubKeyHash
}PlutusTx.unstableMakeIsData ''SharedWalletParamPlutusTx.makeLift ''SharedWalletParamdata SharedWalletParamValidator
instance Scripts.ValidatorTypes SharedWalletParamValidator
-- default types for datum and redeemer are (){-# INLINEABLE mkValidator #-}
mkValidator :: SharedWalletParam -> () -> () -> Plutus.ScriptContext -> Bool
mkValidator swp () () ctx = checkSignature1 || checkSignature2
where
info :: Plutus.TxInfo
info = Plutus.scriptContextTxInfo ctx
signature1 :: PubKeyHash
signature1 = wallet1 swp
signature2 :: PubKeyHash
signature2 = wallet2 swp
checkSignature1 :: Bool
checkSignature1 = traceIfFalse "signature 1 missing" $ txSignedBy info signature1
checkSignature2 :: Bool
checkSignature2 = traceIfFalse "signature 2 missing" $ txSignedBy info signature2Testing the validator
Last updated