{-# LANGUAGE TemplateHaskell #-} {-# OPTIONS_GHC -fplugin PlutusTx.Plugin #-} {-# OPTIONS_GHC -fplugin-opt PlutusTx.Plugin:defer-errors #-} {-# OPTIONS_GHC -fplugin-opt PlutusTx.Plugin:target-version=1.1.0 #-} module Hydra.Contract.Dummy where import Hydra.Cardano.Api (PlutusScriptVersion (PlutusScriptV3)) import Hydra.Plutus.Extras (ValidatorType, scriptValidatorHash, wrapValidator) import Hydra.Prelude import PlutusLedgerApi.V3 (BuiltinData, ScriptContext, ScriptHash, SerialisedScript, serialiseCompiledCode, toOpaque) import PlutusTx (CompiledCode, compile) dummyValidator :: BuiltinData -> BuiltinData -> ScriptContext -> Bool dummyValidator :: BuiltinData -> BuiltinData -> ScriptContext -> Bool dummyValidator BuiltinData _ BuiltinData _ ScriptContext _ = Bool True compiledDummyValidator :: CompiledCode ValidatorType compiledDummyValidator :: CompiledCode ValidatorType compiledDummyValidator = $$(PlutusTx.compile [||fakeWrap dummyValidator||]) where wrap :: (BuiltinData -> BuiltinData -> ScriptContext -> Bool) -> ValidatorType wrap = forall datum redeemer. (UnsafeFromData datum, UnsafeFromData redeemer) => (datum -> redeemer -> ScriptContext -> Bool) -> ValidatorType wrapValidator @BuiltinData @BuiltinData fakeWrap :: (datum -> redeemer -> ScriptContext -> Bool) -> ValidatorType fakeWrap :: forall datum redeemer. (datum -> redeemer -> ScriptContext -> Bool) -> ValidatorType fakeWrap datum -> redeemer -> ScriptContext -> Bool _ BuiltinData _ = () -> BuiltinUnit forall a arep. HasToOpaque a arep => a -> arep toOpaque () dummyValidatorScript :: SerialisedScript dummyValidatorScript :: SerialisedScript dummyValidatorScript = CompiledCode ValidatorType -> SerialisedScript forall a. CompiledCode a -> SerialisedScript serialiseCompiledCode CompiledCode ValidatorType compiledDummyValidator dummyValidatorHash :: ScriptHash dummyValidatorHash :: ScriptHash dummyValidatorHash = PlutusScriptVersion PlutusScriptV3 -> SerialisedScript -> ScriptHash forall lang. PlutusScriptVersion lang -> SerialisedScript -> ScriptHash scriptValidatorHash PlutusScriptVersion PlutusScriptV3 PlutusScriptV3 SerialisedScript dummyValidatorScript