{-# LANGUAGE DataKinds       #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies    #-}

module Plutus.Script.Utils.V1.Generators
    ( alwaysSucceedValidator
    , alwaysSucceedValidatorVersioned
    , alwaysSucceedValidatorHash
    , alwaysSucceedPolicy
    , alwaysSucceedPolicyVersioned
    , alwaysSucceedPolicyHash
    , someTokenValue
    ) where

import Plutus.Script.Utils.Scripts qualified as Ledger
import Plutus.V1.Ledger.Scripts qualified as Ledger
import Plutus.V1.Ledger.Value (TokenName, Value)
import Plutus.V1.Ledger.Value qualified as Value
import PlutusTx qualified

import Plutus.Script.Utils.V1.Scripts qualified as Scripts

alwaysSucceedValidator :: Ledger.Validator
alwaysSucceedValidator :: Validator
alwaysSucceedValidator =
    CompiledCode (BuiltinData -> BuiltinData -> BuiltinData -> ())
-> Validator
Ledger.mkValidatorScript $$(PlutusTx.compile [|| \_ _ _ -> () ||])

alwaysSucceedValidatorVersioned :: Ledger.Versioned Ledger.Validator
alwaysSucceedValidatorVersioned :: Versioned Validator
alwaysSucceedValidatorVersioned = Validator -> Language -> Versioned Validator
forall script. script -> Language -> Versioned script
Ledger.Versioned Validator
alwaysSucceedValidator Language
Ledger.PlutusV1

alwaysSucceedValidatorHash :: Ledger.ValidatorHash
alwaysSucceedValidatorHash :: ValidatorHash
alwaysSucceedValidatorHash = Validator -> ValidatorHash
Scripts.validatorHash Validator
alwaysSucceedValidator

alwaysSucceedPolicy :: Ledger.MintingPolicy
alwaysSucceedPolicy :: MintingPolicy
alwaysSucceedPolicy =
    CompiledCode (BuiltinData -> BuiltinData -> ()) -> MintingPolicy
Ledger.mkMintingPolicyScript $$(PlutusTx.compile [|| \_ _ -> () ||])

alwaysSucceedPolicyVersioned :: Ledger.Versioned Ledger.MintingPolicy
alwaysSucceedPolicyVersioned :: Versioned MintingPolicy
alwaysSucceedPolicyVersioned = MintingPolicy -> Language -> Versioned MintingPolicy
forall script. script -> Language -> Versioned script
Ledger.Versioned MintingPolicy
alwaysSucceedPolicy Language
Ledger.PlutusV1

alwaysSucceedPolicyHash :: Ledger.MintingPolicyHash
alwaysSucceedPolicyHash :: MintingPolicyHash
alwaysSucceedPolicyHash = MintingPolicy -> MintingPolicyHash
Scripts.mintingPolicyHash MintingPolicy
alwaysSucceedPolicy

someTokenValue :: TokenName -> Integer -> Value
someTokenValue :: TokenName -> Integer -> Value
someTokenValue = CurrencySymbol -> TokenName -> Integer -> Value
Value.singleton (MintingPolicy -> CurrencySymbol
Scripts.scriptCurrencySymbol MintingPolicy
alwaysSucceedPolicy)