{-# LANGUAGE ImportQualifiedPost #-}
{-# LANGUAGE OverloadedLists #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}

{-# HLINT ignore "Use camelCase" #-}
{-# HLINT ignore "Evaluate" #-}

module Test.Cardano.Ledger.Conway.CDDL (
  module Test.Cardano.Ledger.Babbage.CDDL,
  module Test.Cardano.Ledger.Conway.CDDL,
) where

import Codec.CBOR.Cuddle.Huddle
import Data.Function (($))
import Data.Word (Word64)
import GHC.Num (Integer)
import Test.Cardano.Ledger.Babbage.CDDL hiding (
  auxiliary_data,
  babbage_transaction_output,
  block,
  certificate,
  certificates,
  cost_models,
  dns_name,
  ex_unit_prices,
  header,
  header_body,
  invalid_before,
  invalid_hereafter,
  language,
  major_protocol_version,
  metadata,
  mint,
  multi_host_name,
  native_script,
  next_major_protocol_version,
  nonempty_set,
  operational_cert,
  plutus_v1_script,
  plutus_v2_script,
  pool_metadata,
  pool_params,
  pool_registration,
  pool_retirement,
  protocol_param_update,
  protocol_version,
  redeemer_tag,
  redeemers,
  relay,
  required_signers,
  script,
  script_all,
  script_any,
  script_data_hash,
  script_pubkey,
  script_ref,
  set,
  shelley_transaction_output,
  single_host_name,
  transaction,
  transaction_body,
  transaction_input,
  transaction_metadatum_label,
  transaction_output,
  transaction_witness_set,
  url,
  value,
  withdrawals,
 )
import Text.Heredoc

conwayCDDL :: Huddle
conwayCDDL :: Huddle
conwayCDDL =
  [Rule] -> Huddle
collectFrom
    [ Rule
block
    , Rule
transaction
    , Rule
kes_signature
    , Rule
language
    , Rule
potential_languages
    , Rule
signkeyKES
    ]

block :: Rule
block :: Rule
block =
  forall a. Text -> Named a -> Named a
comment
    [str|Valid blocks must also satisfy the following two constraints:
        |1. the length of transaction_bodies and transaction_witness_sets
        |   must be the same
        |2. every transaction_index must be strictly smaller than the
        |   length of transaction_bodies
        |]
    forall a b. (a -> b) -> a -> b
$ Text
"block"
      forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr
        [ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
header
        , Key
"transaction_bodies" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> ArrayChoice -> ArrayChoice
arr [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
transaction_body]
        , Key
"transaction_witness_sets"
            forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> ArrayChoice -> ArrayChoice
arr [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
transaction_witness_set]
        , Key
"auxiliary_data_set"
            forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> MapChoice -> MapChoice
mp [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall r. IsType0 r => r -> Key
asKey Rule
transaction_index forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
auxiliary_data]
        , Key
"invalid_transactions" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> ArrayChoice -> ArrayChoice
arr [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
transaction_index]
        ]

transaction :: Rule
transaction :: Rule
transaction =
  Text
"transaction"
    forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr
      [ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
transaction_body
      , forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
transaction_witness_set
      , forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Value Bool
VBool
      , forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Rule
auxiliary_data forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil)
      ]

header :: Rule
header :: Rule
header =
  Text
"header"
    forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr
      [ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
header_body
      , Key
"body_signature" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
kes_signature
      ]

header_body :: Rule
header_body :: Rule
header_body =
  Text
"header_body"
    forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr
      [ Key
"block_number" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
block_no
      , Key
"slot" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
slot_no
      , Key
"prev_hash" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> (Rule
hash32 forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil)
      , Key
"issuer_vkey" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
vkey
      , Key
"vrf_vkey" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
vrf_vkey
      , Key
"vrf_result" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
vrf_cert
      , Key
"block_body_size" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> (Value Int
VUInt forall a s. (IsSizeable a, IsSize s) => Value a -> s -> Constrained
`sized` (Word64
4 :: Word64))
      , Key
"block_body_hash" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
hash32
      , forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
operational_cert
      , forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
protocol_version
      ]

operational_cert :: Rule
operational_cert :: Rule
operational_cert =
  Text
"operational_cert"
    forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr
      [ Key
"hot_vkey" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
kes_vkey
      , Key
"sequence_number" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> (Value Int
VUInt forall a s. (IsSizeable a, IsSize s) => Value a -> s -> Constrained
`sized` (Word64
8 :: Word64))
      , Key
"kes_period" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Value Int
VUInt
      , Key
"sigma" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
signature
      ]

protocol_version :: Rule
protocol_version :: Rule
protocol_version = Text
"protocol_version" forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
major_protocol_version, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Value Int
VUInt]

-- TODO Replace with the following once
-- https://github.com/input-output-hk/cuddle/issues/29 is addressed in cuddle.
--
-- next_major_protocol_version :: Rule
-- next_major_protocol_version = "next_major_protocol_version" =:= (10 :: Integer)
next_major_protocol_version :: Integer
next_major_protocol_version :: Integer
next_major_protocol_version = Integer
10

major_protocol_version :: Rule
major_protocol_version :: Rule
major_protocol_version = Text
"major_protocol_version" forall a. IsType0 a => Text -> a -> Rule
=:= (Integer
1 :: Integer) Integer -> Integer -> Ranged
... Integer
next_major_protocol_version

transaction_body :: Rule
transaction_body :: Rule
transaction_body =
  Text
"transaction_body"
    forall a. IsType0 a => Text -> a -> Rule
=:= MapChoice -> MapChoice
mp
      [ Word64 -> Key
idx Word64
0 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall t0. IsType0 t0 => t0 -> GRuleCall
set Rule
transaction_input
      , Word64 -> Key
idx Word64
1 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> ArrayChoice -> ArrayChoice
arr [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
transaction_output]
      , Word64 -> Key
idx Word64
2 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
coin
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
3 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
slot_no)
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
4 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
certificates)
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
5 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
withdrawals)
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
7 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
auxiliary_data_hash)
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
8 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
slot_no) -- Validity interval start
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
9 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
mint)
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
11 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
script_data_hash)
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
13 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall t0. IsType0 t0 => t0 -> GRuleCall
nonempty_set Rule
transaction_input)
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
14 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
required_signers)
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
15 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
network_id)
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
16 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
transaction_output)
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
17 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
coin)
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
18 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall t0. IsType0 t0 => t0 -> GRuleCall
nonempty_set Rule
transaction_input)
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
19 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
voting_procedures)
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
20 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
proposal_procedures)
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
21 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
coin)
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
22 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
positive_coin)
      ]

voting_procedures :: Rule
voting_procedures :: Rule
voting_procedures =
  Text
"voting_procedures"
    forall a. IsType0 a => Text -> a -> Rule
=:= MapChoice -> MapChoice
mp [Word64
1 forall a. CanQuantify a => Word64 -> a -> a
<+ forall r. IsType0 r => r -> Key
asKey Rule
voter forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> MapChoice -> MapChoice
mp [Word64
1 forall a. CanQuantify a => Word64 -> a -> a
<+ forall r. IsType0 r => r -> Key
asKey Rule
gov_action_id forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
voting_procedure]]

voting_procedure :: Rule
voting_procedure :: Rule
voting_procedure = Text
"voting_procedure" forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
vote, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Rule
anchor forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil)]

proposal_procedure :: Rule
proposal_procedure :: Rule
proposal_procedure =
  Text
"proposal_procedure"
    forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr
      [ Key
"deposit" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
coin
      , forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
reward_account
      , forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
gov_action
      , forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
anchor
      ]

proposal_procedures :: Rule
proposal_procedures :: Rule
proposal_procedures = Text
"proposal_procedures" forall a. IsType0 a => Text -> a -> Rule
=:= forall t0. IsType0 t0 => t0 -> GRuleCall
nonempty_set Rule
proposal_procedure

certificates :: Rule
certificates :: Rule
certificates = Text
"certificates" forall a. IsType0 a => Text -> a -> Rule
=:= forall t0. IsType0 t0 => t0 -> GRuleCall
nonempty_set Rule
certificate

gov_action :: Rule
gov_action :: Rule
gov_action =
  Text
"gov_action"
    forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
parameter_change_action]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
hard_fork_initiation_action]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
treasury_withdrawals_action]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
no_confidence]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
update_committee]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
new_constitution]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
info_action]

policy_hash :: Rule
policy_hash :: Rule
policy_hash = Text
"policy_hash" forall a. IsType0 a => Text -> a -> Rule
=:= Rule
script_hash

parameter_change_action :: Named Group
parameter_change_action :: Named Group
parameter_change_action =
  Text
"parameter_change_action"
    Text -> Group -> Named Group
=:~ Group -> Group
grp
      [ Choice Type2
0
      , Rule
gov_action_id forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil
      , forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
protocol_param_update
      , Rule
policy_hash forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil
      ]

hard_fork_initiation_action :: Named Group
hard_fork_initiation_action :: Named Group
hard_fork_initiation_action =
  Text
"hard_fork_initiation_action"
    Text -> Group -> Named Group
=:~ Group -> Group
grp [Choice Type2
1, Rule
gov_action_id forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
protocol_version]

treasury_withdrawals_action :: Named Group
treasury_withdrawals_action :: Named Group
treasury_withdrawals_action =
  Text
"treasury_withdrawals_action"
    Text -> Group -> Named Group
=:~ Group -> Group
grp [Choice Type2
2, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (MapChoice -> MapChoice
mp [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall r. IsType0 r => r -> Key
asKey Rule
reward_account forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
coin]), Rule
policy_hash forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil]

no_confidence :: Named Group
no_confidence :: Named Group
no_confidence = Text
"no_confidence" Text -> Group -> Named Group
=:~ Group -> Group
grp [Choice Type2
3, Rule
gov_action_id forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil]

update_committee :: Named Group
update_committee :: Named Group
update_committee =
  Text
"update_committee"
    Text -> Group -> Named Group
=:~ Group -> Group
grp
      [ Choice Type2
4
      , Rule
gov_action_id forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil
      , forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (forall t0. IsType0 t0 => t0 -> GRuleCall
set Rule
committee_cold_credential)
      , forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (MapChoice -> MapChoice
mp [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall r. IsType0 r => r -> Key
asKey Rule
committee_cold_credential forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
epoch_no])
      , forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
unit_interval
      ]

new_constitution :: Named Group
new_constitution :: Named Group
new_constitution =
  Text
"new_constitution"
    Text -> Group -> Named Group
=:~ Group -> Group
grp [Choice Type2
5, Rule
gov_action_id forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
constitution]

constitution :: Rule
constitution :: Rule
constitution =
  Text
"constitution"
    forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr
      [ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
anchor
      , forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Rule
script_hash forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil)
      ]

info_action :: Rule
info_action :: Rule
info_action = Text
"info_action" forall a. IsType0 a => Text -> a -> Rule
=:= Integer -> Literal
int Integer
6

voter :: Rule
voter :: Rule
voter =
  forall a. Text -> Named a -> Named a
comment
    [str|0: constitutional committee hot keyhash
        |1: constitutional committee hot script_hash
        |2: drep keyhash
        |3: drep script_hash
        |4: stakingpool keyhash
        |]
    forall a b. (a -> b) -> a -> b
$ Text
"voter"
      forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr [ArrayEntry
0, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
addr_keyhash]
      forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [ArrayEntry
1, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
script_hash]
      forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [ArrayEntry
2, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
addr_keyhash]
      forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [ArrayEntry
3, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
script_hash]
      forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [ArrayEntry
4, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
addr_keyhash]

anchor :: Rule
anchor :: Rule
anchor =
  Text
"anchor"
    forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr
      [ Key
"anchor_url" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
url
      , Key
"anchor_data_hash" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
hash32
      ]

vote :: Rule
vote :: Rule
vote = Text
"vote" forall a. IsType0 a => Text -> a -> Rule
=:= Integer
0 Integer -> Integer -> Ranged
... Integer
2

gov_action_id :: Rule
gov_action_id :: Rule
gov_action_id =
  Text
"gov_action_id"
    forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr
      [ Key
"transaction_id" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
hash32
      , Key
"gov_action_index" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> (Value Int
VUInt forall a s. (IsSizeable a, IsSize s) => Value a -> s -> Constrained
`sized` (Word64
2 :: Word64))
      ]

required_signers :: Rule
required_signers :: Rule
required_signers = Text
"required_signers" forall a. IsType0 a => Text -> a -> Rule
=:= forall t0. IsType0 t0 => t0 -> GRuleCall
nonempty_set Rule
addr_keyhash

transaction_input :: Rule
transaction_input :: Rule
transaction_input =
  Text
"transaction_input"
    forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr
      [ Key
"transaction_id" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
hash32
      , Key
"index" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> (Value Int
VUInt forall a s. (IsSizeable a, IsSize s) => Value a -> s -> Constrained
`sized` (Word64
2 :: Word64))
      ]

transaction_output :: Rule
transaction_output :: Rule
transaction_output =
  forall a. Text -> Named a -> Named a
comment
    [str|Both of the Alonzo and Babbage style TxOut formats are equally valid
        |and can be used interchangeably
        |]
    forall a b. (a -> b) -> a -> b
$ Text
"transaction_output"
      forall a. IsType0 a => Text -> a -> Rule
=:= Rule
shelley_transaction_output
      forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Rule
babbage_transaction_output

shelley_transaction_output :: Rule
shelley_transaction_output :: Rule
shelley_transaction_output =
  forall a. Text -> Named a -> Named a
comment
    [str|hash32: datum_hash
        |]
    forall a b. (a -> b) -> a -> b
$ Text
"shelley_transaction_output"
      forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
address, Key
"amount" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
value, forall a. CanQuantify a => a -> a
opt forall a b. (a -> b) -> a -> b
$ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
hash32]

babbage_transaction_output :: Rule
babbage_transaction_output :: Rule
babbage_transaction_output =
  Text
"babbage_transaction_output"
    forall a. IsType0 a => Text -> a -> Rule
=:= MapChoice -> MapChoice
mp
      [ Word64 -> Key
idx Word64
0 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
address
      , Word64 -> Key
idx Word64
1 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
value
      , forall a. CanQuantify a => a -> a
opt forall a b. (a -> b) -> a -> b
$ Word64 -> Key
idx Word64
2 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
datum_option
      , forall a. CanQuantify a => a -> a
opt forall a b. (a -> b) -> a -> b
$ Word64 -> Key
idx Word64
3 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
script_ref
      ]

script_data_hash :: Rule
script_data_hash :: Rule
script_data_hash =
  forall a. Text -> Named a -> Named a
comment
    [str|This is a hash of data which may affect evaluation of a script.
        |This data consists of:
        |  - The redeemers from the transaction_witness_set (the value of field 5).
        |  - The datums from the transaction_witness_set (the value of field 4).
        |  - The value in the cost_models map corresponding to the script's language
        |    (in field 18 of protocol_param_update.)
        |(In the future it may contain additional protocol parameters.)
        |
        |Since this data does not exist in contiguous form inside a transaction, it needs
        |to be independently constructed by each recipient.
        |
        |The bytestring which is hashed is the concatenation of three things:
        |  redeemers || datums || language views
        |The redeemers are exactly the data present in the transaction witness set.
        |Similarly for the datums, if present. If no datums are provided, the middle
        |field is omitted (i.e. it is the empty/null bytestring).
        |
        |language views CDDL:
        |{ * language => script_integrity_data }
        |
        |This must be encoded canonically, using the same scheme as in
        |RFC7049 section 3.9:
        | - Maps, strings, and bytestrings must use a definite-length encoding
        | - Integers must be as small as possible.
        | - The expressions for map length, string length, and bytestring length
        |   must be as short as possible.
        | - The keys in the map must be sorted as follows:
        |    -  If two keys have different lengths, the shorter one sorts earlier.
        |    -  If two keys have the same length, the one with the lower value
        |       in (byte-wise) lexical order sorts earlier.
        |
        |For PlutusV1 (language id 0), the language view is the following:
        |  - the value of cost_models map at key 0 (in other words, the script_integrity_data)
        |    is encoded as an indefinite length list and the result is encoded as a bytestring.
        |    (our apologies)
        |    For example, the script_integrity_data corresponding to the all zero costmodel for V1
        |    would be encoded as (in hex):
        |    58a89f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ff
        |  - the language ID tag is also encoded twice. first as a uint then as
        |    a bytestring. (our apologies)
        |    Concretely, this means that the language version for V1 is encoded as
        |    4100 in hex.
        |For PlutusV2 (language id 1), the language view is the following:
        |  - the value of cost_models map at key 1 is encoded as an definite length list.
        |    For example, the script_integrity_data corresponding to the all zero costmodel for V2
        |    would be encoded as (in hex):
        |    98af0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
        |  - the language ID tag is encoded as expected.
        |    Concretely, this means that the language version for V2 is encoded as
        |    01 in hex.
        |For PlutusV3 (language id 2), the language view is the following:
        |  - the value of cost_models map at key 2 is encoded as a definite length list.
        |
        |Note that each Plutus language represented inside a transaction must have
        |a cost model in the cost_models protocol parameter in order to execute,
        |regardless of what the script integrity data is.
        |
        |Finally, note that in the case that a transaction includes datums but does not
        |include the redeemers field, the script data format becomes (in hex):
        |[ A0 | datums | A0 ]
        |corresponding to a CBOR empty map and an empty map for language view.
        |This empty redeeemer case has changed from the previous eras, since default
        |representation for redeemers has been changed to a map. Also whenever redeemers are
        |supplied either as a map or as an array they must contain at least one element,
        |therefore there is no way to override this behavior by providing a custom
        |representation for empty redeemers.
        |]
    forall a b. (a -> b) -> a -> b
$ Text
"script_data_hash" forall a. IsType0 a => Text -> a -> Rule
=:= Rule
hash32

certificate :: Rule
certificate :: Rule
certificate =
  Text
"certificate"
    forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
stake_registration]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
stake_deregistration]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
stake_delegation]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
pool_registration]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
pool_retirement]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
reg_cert]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
unreg_cert]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
vote_deleg_cert]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
stake_vote_deleg_cert]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
stake_reg_deleg_cert]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
vote_reg_deleg_cert]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
stake_vote_reg_deleg_cert]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
auth_committee_hot_cert]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
resign_committee_cold_cert]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
reg_drep_cert]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
unreg_drep_cert]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
update_drep_cert]

-- POOL
pool_registration :: Named Group
pool_registration :: Named Group
pool_registration = Text
"pool_registration" Text -> Group -> Named Group
=:~ Group -> Group
grp [Choice Type2
3, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
pool_params]

pool_retirement :: Named Group
pool_retirement :: Named Group
pool_retirement = Text
"pool_retirement" Text -> Group -> Named Group
=:~ Group -> Group
grp [Choice Type2
4, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
pool_keyhash, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
epoch_no]

-- numbers 5 and 6 used to be the Genesis and MIR certificates respectively,
-- which were deprecated in Conway

-- DELEG
reg_cert :: Named Group
reg_cert :: Named Group
reg_cert = Text
"reg_cert" Text -> Group -> Named Group
=:~ Group -> Group
grp [Choice Type2
7, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
stake_credential, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
coin]

unreg_cert :: Named Group
unreg_cert :: Named Group
unreg_cert = Text
"unreg_cert" Text -> Group -> Named Group
=:~ Group -> Group
grp [Choice Type2
8, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
stake_credential, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
coin]

vote_deleg_cert :: Named Group
vote_deleg_cert :: Named Group
vote_deleg_cert = Text
"vote_deleg_cert" Text -> Group -> Named Group
=:~ Group -> Group
grp [Choice Type2
9, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
stake_credential, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
drep]

stake_vote_deleg_cert :: Named Group
stake_vote_deleg_cert :: Named Group
stake_vote_deleg_cert =
  Text
"stake_vote_deleg_cert"
    Text -> Group -> Named Group
=:~ Group -> Group
grp [Choice Type2
10, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
stake_credential, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
pool_keyhash, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
drep]

stake_reg_deleg_cert :: Named Group
stake_reg_deleg_cert :: Named Group
stake_reg_deleg_cert =
  Text
"stake_reg_deleg_cert"
    Text -> Group -> Named Group
=:~ Group -> Group
grp [Choice Type2
11, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
stake_credential, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
pool_keyhash, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
coin]

vote_reg_deleg_cert :: Named Group
vote_reg_deleg_cert :: Named Group
vote_reg_deleg_cert =
  Text
"vote_reg_deleg_cert"
    Text -> Group -> Named Group
=:~ Group -> Group
grp [Choice Type2
12, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
stake_credential, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
drep, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
coin]

stake_vote_reg_deleg_cert :: Named Group
stake_vote_reg_deleg_cert :: Named Group
stake_vote_reg_deleg_cert =
  Text
"stake_vote_reg_deleg_cert"
    Text -> Group -> Named Group
=:~ Group -> Group
grp [Choice Type2
13, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
stake_credential, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
pool_keyhash, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
drep, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
coin]

-- GOVCERT
auth_committee_hot_cert :: Named Group
auth_committee_hot_cert :: Named Group
auth_committee_hot_cert =
  Text
"auth_committee_hot_cert"
    Text -> Group -> Named Group
=:~ Group -> Group
grp [Choice Type2
14, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
committee_cold_credential, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
committee_hot_credential]

resign_committee_cold_cert :: Named Group
resign_committee_cold_cert :: Named Group
resign_committee_cold_cert =
  Text
"resign_committee_cold_cert"
    Text -> Group -> Named Group
=:~ Group -> Group
grp [Choice Type2
15, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
committee_cold_credential, Rule
anchor forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil]

reg_drep_cert :: Named Group
reg_drep_cert :: Named Group
reg_drep_cert = Text
"reg_drep_cert" Text -> Group -> Named Group
=:~ Group -> Group
grp [Choice Type2
16, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
drep_credential, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
coin, Rule
anchor forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil]

unreg_drep_cert :: Named Group
unreg_drep_cert :: Named Group
unreg_drep_cert = Text
"unreg_drep_cert" Text -> Group -> Named Group
=:~ Group -> Group
grp [Choice Type2
17, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
drep_credential, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
coin]

update_drep_cert :: Named Group
update_drep_cert :: Named Group
update_drep_cert = Text
"update_drep_cert" Text -> Group -> Named Group
=:~ Group -> Group
grp [Choice Type2
18, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
drep_credential, Rule
anchor forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil]

drep :: Rule
drep :: Rule
drep =
  Text
"drep"
    forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr [ArrayEntry
0, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
addr_keyhash]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [ArrayEntry
1, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
script_hash]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [ArrayEntry
2] -- always abstain
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [ArrayEntry
3] -- always no confidence

drep_credential :: Rule
drep_credential :: Rule
drep_credential = Text
"drep_credential" forall a. IsType0 a => Text -> a -> Rule
=:= Rule
credential

committee_cold_credential :: Rule
committee_cold_credential :: Rule
committee_cold_credential = Text
"committee_cold_credential" forall a. IsType0 a => Text -> a -> Rule
=:= Rule
credential

committee_hot_credential :: Rule
committee_hot_credential :: Rule
committee_hot_credential = Text
"committee_hot_credential" forall a. IsType0 a => Text -> a -> Rule
=:= Rule
credential

pool_params :: Named Group
pool_params :: Named Group
pool_params =
  forall a. Text -> Named a -> Named a
comment
    [str|        pool_keyhash: operator
        |                coin: pledge
        |                coin: cost
        |       unit_interval: margin
        |   set<addr_keyhash>: pool_owners
        |]
    forall a b. (a -> b) -> a -> b
$ Text
"pool_params"
      Text -> Group -> Named Group
=:~ Group -> Group
grp
        [ Key
"operator" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
pool_keyhash
        , Key
"vrf_keyhash" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
vrf_keyhash
        , Key
"pledge" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
coin
        , Key
"cost" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
coin
        , Key
"margin" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
unit_interval
        , Key
"reward_account" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
reward_account
        , Key
"pool_owners" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall t0. IsType0 t0 => t0 -> GRuleCall
set Rule
addr_keyhash
        , Key
"relays" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> ArrayChoice -> ArrayChoice
arr [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
relay]
        , Key
"pool_metadata" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> (Rule
pool_metadata forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil)
        ]

dns_name :: Rule
dns_name :: Rule
dns_name = Text
"dns_name" forall a. IsType0 a => Text -> a -> Rule
=:= Value Text
VText forall a s. (IsSizeable a, IsSize s) => Value a -> s -> Constrained
`sized` (Word64
0 :: Word64, Word64
128 :: Word64)

single_host_name :: Named Group
single_host_name :: Named Group
single_host_name =
  forall a. Text -> Named a -> Named a
comment
    [str|dns_name: An A or AAAA DNS record
        |]
    forall a b. (a -> b) -> a -> b
$ Text
"single_host_name" Text -> Group -> Named Group
=:~ Group -> Group
grp [Choice Type2
1, Rule
port forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
dns_name]

multi_host_name :: Named Group
multi_host_name :: Named Group
multi_host_name =
  forall a. Text -> Named a -> Named a
comment
    [str|dns_name: An SRV DNS record
        |]
    forall a b. (a -> b) -> a -> b
$ Text
"multi_host_name"
      Text -> Group -> Named Group
=:~ Group -> Group
grp [Choice Type2
2, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
dns_name]

relay :: Rule
relay :: Rule
relay =
  Text
"relay"
    forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
single_host_addr]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
single_host_name]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
multi_host_name]

url :: Rule
url :: Rule
url = Text
"url" forall a. IsType0 a => Text -> a -> Rule
=:= Value Text
VText forall a s. (IsSizeable a, IsSize s) => Value a -> s -> Constrained
`sized` (Word64
0 :: Word64, Word64
128 :: Word64)

pool_metadata :: Rule
pool_metadata :: Rule
pool_metadata = Text
"pool_metadata" forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
url, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
metadata_hash]

withdrawals :: Rule
withdrawals :: Rule
withdrawals = Text
"withdrawals" forall a. IsType0 a => Text -> a -> Rule
=:= MapChoice -> MapChoice
mp [Word64
1 forall a. CanQuantify a => Word64 -> a -> a
<+ forall r. IsType0 r => r -> Key
asKey Rule
reward_account forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
coin]

protocol_param_update :: Rule
protocol_param_update :: Rule
protocol_param_update =
  forall a. Text -> Named a -> Named a
comment
    [str| 0: minfee A
        | 1: minfee B
        | 2: max block body size
        | 3: max transaction size
        | 4: max block header size
        | 5: key deposit
        | 6: pool deposit
        | 7: maximum epoch
        | 8: n_opt: desired number of stake pools
        | 9: pool pledge influence
        |10: expansion rate
        |11: treasury growth rate
        |16: min pool cost
        |17: ada per utxo byte
        |18: cost models for script languages
        |19: execution costs
        |20: max tx ex units
        |21: max block ex units
        |22: max value size
        |23: collateral percentage
        |24: max collateral inputs
        |25: pool voting thresholds
        |26: drep voting thresholds
        |27: min committee size
        |28: committee term limit
        |29: governance action validity period
        |30: governance action deposit
        |31: drep deposit
        |32: drep inactivity period
        |33: minfee refscriptcoinsperbyte
        |]
    forall a b. (a -> b) -> a -> b
$ Text
"protocol_param_update"
      forall a. IsType0 a => Text -> a -> Rule
=:= MapChoice -> MapChoice
mp
        [ forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
0 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
coin)
        , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
1 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
coin)
        , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
2 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> (Value Int
VUInt forall a s. (IsSizeable a, IsSize s) => Value a -> s -> Constrained
`sized` (Word64
4 :: Word64)))
        , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
3 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> (Value Int
VUInt forall a s. (IsSizeable a, IsSize s) => Value a -> s -> Constrained
`sized` (Word64
4 :: Word64)))
        , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
4 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> (Value Int
VUInt forall a s. (IsSizeable a, IsSize s) => Value a -> s -> Constrained
`sized` (Word64
2 :: Word64)))
        , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
5 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
coin)
        , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
6 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
coin)
        , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
7 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
epoch_interval)
        , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
8 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> (Value Int
VUInt forall a s. (IsSizeable a, IsSize s) => Value a -> s -> Constrained
`sized` (Word64
2 :: Word64)))
        , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
9 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
nonnegative_interval)
        , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
10 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
unit_interval)
        , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
11 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
unit_interval)
        , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
16 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
coin)
        , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
17 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
coin)
        , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
18 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
cost_models)
        , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
19 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
ex_unit_prices)
        , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
20 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
ex_units)
        , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
21 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
ex_units)
        , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
22 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> (Value Int
VUInt forall a s. (IsSizeable a, IsSize s) => Value a -> s -> Constrained
`sized` (Word64
4 :: Word64)))
        , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
23 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> (Value Int
VUInt forall a s. (IsSizeable a, IsSize s) => Value a -> s -> Constrained
`sized` (Word64
2 :: Word64)))
        , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
24 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> (Value Int
VUInt forall a s. (IsSizeable a, IsSize s) => Value a -> s -> Constrained
`sized` (Word64
2 :: Word64)))
        , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
25 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
pool_voting_thresholds)
        , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
26 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
drep_voting_thresholds)
        , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
27 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> (Value Int
VUInt forall a s. (IsSizeable a, IsSize s) => Value a -> s -> Constrained
`sized` (Word64
2 :: Word64)))
        , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
28 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
epoch_interval)
        , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
29 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
epoch_interval)
        , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
30 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
coin)
        , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
31 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
coin)
        , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
32 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
epoch_interval)
        , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
33 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
nonnegative_interval)
        ]

pool_voting_thresholds :: Rule
pool_voting_thresholds :: Rule
pool_voting_thresholds =
  Text
"pool_voting_thresholds"
    forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr
      [ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
unit_interval -- motion no confidence
      , forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
unit_interval -- committee normal
      , forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
unit_interval -- committee no confidence
      , forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
unit_interval -- hard fork initiation
      , forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
unit_interval -- security relevant parameter voting threshold
      ]

drep_voting_thresholds :: Rule
drep_voting_thresholds :: Rule
drep_voting_thresholds =
  Text
"drep_voting_thresholds"
    forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr
      [ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
unit_interval -- motion no confidence
      , forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
unit_interval -- committee normal
      , forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
unit_interval -- committee no confidence
      , forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
unit_interval -- update constitution
      , forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
unit_interval -- hard fork initiation
      , forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
unit_interval -- PP network group
      , forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
unit_interval -- PP economic group
      , forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
unit_interval -- PP technical group
      , forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
unit_interval -- PP governance group
      , forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
unit_interval -- treasury withdrawal
      ]

transaction_witness_set :: Rule
transaction_witness_set :: Rule
transaction_witness_set =
  Text
"transaction_witness_set"
    forall a. IsType0 a => Text -> a -> Rule
=:= MapChoice -> MapChoice
mp
      [ forall a. CanQuantify a => a -> a
opt forall a b. (a -> b) -> a -> b
$ Word64 -> Key
idx Word64
0 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall t0. IsType0 t0 => t0 -> GRuleCall
nonempty_set Rule
vkeywitness
      , forall a. CanQuantify a => a -> a
opt forall a b. (a -> b) -> a -> b
$ Word64 -> Key
idx Word64
1 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall t0. IsType0 t0 => t0 -> GRuleCall
nonempty_set Rule
native_script
      , forall a. CanQuantify a => a -> a
opt forall a b. (a -> b) -> a -> b
$ Word64 -> Key
idx Word64
2 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall t0. IsType0 t0 => t0 -> GRuleCall
nonempty_set Rule
bootstrap_witness
      , forall a. CanQuantify a => a -> a
opt forall a b. (a -> b) -> a -> b
$ Word64 -> Key
idx Word64
3 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall t0. IsType0 t0 => t0 -> GRuleCall
nonempty_set Rule
plutus_v1_script
      , forall a. CanQuantify a => a -> a
opt forall a b. (a -> b) -> a -> b
$ Word64 -> Key
idx Word64
4 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall t0. IsType0 t0 => t0 -> GRuleCall
nonempty_set Rule
plutus_data
      , forall a. CanQuantify a => a -> a
opt forall a b. (a -> b) -> a -> b
$ Word64 -> Key
idx Word64
5 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
redeemers
      , forall a. CanQuantify a => a -> a
opt forall a b. (a -> b) -> a -> b
$ Word64 -> Key
idx Word64
6 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall t0. IsType0 t0 => t0 -> GRuleCall
nonempty_set Rule
plutus_v2_script
      , forall a. CanQuantify a => a -> a
opt forall a b. (a -> b) -> a -> b
$ Word64 -> Key
idx Word64
7 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall t0. IsType0 t0 => t0 -> GRuleCall
nonempty_set Rule
plutus_v3_script
      ]

plutus_v1_script :: Rule
plutus_v1_script :: Rule
plutus_v1_script =
  forall a. Text -> Named a -> Named a
comment
    [str|The real type of plutus_v1_script, plutus_v2_script and
        |plutus_v3_script is bytes. However, because we enforce
        |uniqueness when many scripts are supplied, we need to hack
        |around for tests in order to avoid generating duplicates, since
        |the cddl tool we use for roundtrip testing doesn't generate
        |distinct collections.
        |]
    forall a b. (a -> b) -> a -> b
$ Text
"plutus_v1_script" forall a. IsType0 a => Text -> a -> Rule
=:= forall s. IsSizeable s => Value s -> Rule
distinct Value ByteString
VBytes

plutus_v2_script :: Rule
plutus_v2_script :: Rule
plutus_v2_script = Text
"plutus_v2_script" forall a. IsType0 a => Text -> a -> Rule
=:= forall s. IsSizeable s => Value s -> Rule
distinct Value ByteString
VBytes

plutus_v3_script :: Rule
plutus_v3_script :: Rule
plutus_v3_script = Text
"plutus_v3_script" forall a. IsType0 a => Text -> a -> Rule
=:= forall s. IsSizeable s => Value s -> Rule
distinct Value ByteString
VBytes

redeemers :: Rule
redeemers :: Rule
redeemers =
  forall a. Text -> Named a -> Named a
comment
    [str|Flat Array support is included for backwards compatibility and
        |will be removed in the next era. It is recommended for tools to
        |adopt using a Map instead of Array going forward.
        |]
    forall a b. (a -> b) -> a -> b
$ Text
"redeemers"
      forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> Seal Array
sarr
        [ Word64
1
            forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a
              ( ArrayChoice -> ArrayChoice
arr
                  [ Key
"tag" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
redeemer_tag
                  , Key
"index" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> (Value Int
VUInt forall a s. (IsSizeable a, IsSize s) => Value a -> s -> Constrained
`sized` (Word64
4 :: Word64))
                  , Key
"data" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
plutus_data
                  , Key
"ex_units" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
ex_units
                  ]
              )
        ]
      forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ MapChoice -> Seal Map
smp
        [ Word64
1
            forall a. CanQuantify a => Word64 -> a -> a
<+ forall r. IsType0 r => r -> Key
asKey
              ( ArrayChoice -> ArrayChoice
arr
                  [ Key
"tag" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
redeemer_tag
                  , Key
"index" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> (Value Int
VUInt forall a s. (IsSizeable a, IsSize s) => Value a -> s -> Constrained
`sized` (Word64
4 :: Word64))
                  ]
              )
            forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> ArrayChoice -> ArrayChoice
arr [Key
"data" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
plutus_data, Key
"ex_units" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
ex_units]
        ]

redeemer_tag :: Rule
redeemer_tag :: Rule
redeemer_tag =
  forall a. Text -> Named a -> Named a
comment
    [str|0: spend
        |1: mint
        |2: cert
        |3: reward
        |4: voting
        |5: proposing
        |]
    forall a b. (a -> b) -> a -> b
$ Text
"redeemer_tag"
      forall a. IsType0 a => Text -> a -> Rule
=:= Integer -> Literal
int Integer
0
      forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Integer -> Literal
int Integer
1
      forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Integer -> Literal
int Integer
2
      forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Integer -> Literal
int Integer
3
      forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Integer -> Literal
int Integer
4
      forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Integer -> Literal
int Integer
5

ex_unit_prices :: Rule
ex_unit_prices :: Rule
ex_unit_prices =
  Text
"ex_unit_prices"
    forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr
      [ Key
"mem_price" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
nonnegative_interval
      , Key
"step_price" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
nonnegative_interval
      ]

language :: Rule
language :: Rule
language =
  Text
"language"
    forall a. IsType0 a => Text -> a -> Rule
=:= Integer -> Literal
int Integer
0 -- Plutus v1
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Integer -> Literal
int Integer
1 -- Plutus v2
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Integer -> Literal
int Integer
2 -- Plutus v3

potential_languages :: Rule
potential_languages :: Rule
potential_languages = Text
"potential_languages" forall a. IsType0 a => Text -> a -> Rule
=:= Integer
0 Integer -> Integer -> Ranged
... Integer
255

cost_models :: Rule
cost_models :: Rule
cost_models =
  forall a. Text -> Named a -> Named a
comment
    [str|The format for cost_models is flexible enough to allow adding
        |Plutus built-ins and language versions in the future.
        |
        |Plutus v1: only 166 integers are used, but more are accepted (and ignored)
        |Plutus v2: only 175 integers are used, but more are accepted (and ignored)
        |Plutus v3: only 223 integers are used, but more are accepted (and ignored)
        |
        |Any 8-bit unsigned number can be used as a key.
        |]
    forall a b. (a -> b) -> a -> b
$ Text
"cost_models"
      forall a. IsType0 a => Text -> a -> Rule
=:= MapChoice -> MapChoice
mp
        [ forall a. CanQuantify a => a -> a
opt forall a b. (a -> b) -> a -> b
$ Word64 -> Key
idx Word64
0 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> ArrayChoice -> ArrayChoice
arr [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
int64]
        , forall a. CanQuantify a => a -> a
opt forall a b. (a -> b) -> a -> b
$ Word64 -> Key
idx Word64
1 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> ArrayChoice -> ArrayChoice
arr [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
int64]
        , forall a. CanQuantify a => a -> a
opt forall a b. (a -> b) -> a -> b
$ Word64 -> Key
idx Word64
2 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> ArrayChoice -> ArrayChoice
arr [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
int64]
        , Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall r. IsType0 r => r -> Key
asKey (Integer
3 Integer -> Integer -> Ranged
... Integer
255) forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> ArrayChoice -> ArrayChoice
arr [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
int64]
        ]

transaction_metadatum_label :: Rule
transaction_metadatum_label :: Rule
transaction_metadatum_label = Text
"transaction_metadatum_label" forall a. IsType0 a => Text -> a -> Rule
=:= (Value Int
VUInt forall a s. (IsSizeable a, IsSize s) => Value a -> s -> Constrained
`sized` (Word64
8 :: Word64))

metadata :: Rule
metadata :: Rule
metadata =
  Text
"metadata"
    forall a. IsType0 a => Text -> a -> Rule
=:= MapChoice -> MapChoice
mp
      [ Word64
0
          forall a. CanQuantify a => Word64 -> a -> a
<+ forall r. IsType0 r => r -> Key
asKey Rule
transaction_metadatum_label
          forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
transaction_metadatum
      ]

auxiliary_data :: Rule
auxiliary_data :: Rule
auxiliary_data =
  forall a. Text -> Named a -> Named a
comment
    [str|              metadata: shelley
        |  transaction_metadata: shelley-ma
        |#6.259(0 ==> metadata): alonzo onwards
        |]
    forall a b. (a -> b) -> a -> b
$ Text
"auxiliary_data"
      forall a. IsType0 a => Text -> a -> Rule
=:= Rule
metadata
      forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> Seal Array
sarr
        [ Key
"transaction_metadata" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
metadata
        , Key
"auxiliary_scripts" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> ArrayChoice -> ArrayChoice
arr [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
native_script]
        ]
      forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ forall a. Word64 -> a -> Tagged a
tag
        Word64
259
        ( MapChoice -> MapChoice
mp
            [ forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
0 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
metadata)
            , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
1 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> ArrayChoice -> ArrayChoice
arr [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
native_script])
            , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
2 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> ArrayChoice -> ArrayChoice
arr [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
plutus_v1_script])
            , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
3 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> ArrayChoice -> ArrayChoice
arr [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
plutus_v2_script])
            , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
4 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> ArrayChoice -> ArrayChoice
arr [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
plutus_v3_script])
            ]
        )

native_script :: Rule
native_script :: Rule
native_script =
  Text
"native_script"
    forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
script_pubkey]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
script_all]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
script_any]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
script_n_of_k]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
invalid_before]
    -- Timelock validity intervals are half-open intervals [a, b).
    -- This field specifies the left (included) endpoint a.
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
invalid_hereafter]

-- Timelock validity intervals are half-open intervals [a, b).
-- This field specifies the right (excluded) endpoint b.

script_pubkey :: Named Group
script_pubkey :: Named Group
script_pubkey = Text
"script_pubkey" Text -> Group -> Named Group
=:~ Group -> Group
grp [Choice Type2
0, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
addr_keyhash]

script_all :: Named Group
script_all :: Named Group
script_all = Text
"script_all" Text -> Group -> Named Group
=:~ Group -> Group
grp [Choice Type2
1, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (ArrayChoice -> ArrayChoice
arr [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
native_script])]

script_any :: Named Group
script_any :: Named Group
script_any = Text
"script_any" Text -> Group -> Named Group
=:~ Group -> Group
grp [Choice Type2
2, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (ArrayChoice -> ArrayChoice
arr [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
native_script])]

script_ref :: Rule
script_ref :: Rule
script_ref = Text
"script_ref" forall a. IsType0 a => Text -> a -> Rule
=:= forall a. Word64 -> a -> Tagged a
tag Word64
24 (Value ByteString
VBytes Value ByteString -> Rule -> Constrained
`cbor` Rule
script)

script_n_of_k :: Named Group
script_n_of_k :: Named Group
script_n_of_k =
  Text
"script_n_of_k"
    Text -> Group -> Named Group
=:~ Group -> Group
grp [Choice Type2
3, Key
"n" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
int64, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (ArrayChoice -> ArrayChoice
arr [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
native_script])]

invalid_before :: Named Group
invalid_before :: Named Group
invalid_before = Text
"invalid_before" Text -> Group -> Named Group
=:~ Group -> Group
grp [Choice Type2
4, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
slot_no]

invalid_hereafter :: Named Group
invalid_hereafter :: Named Group
invalid_hereafter = Text
"invalid_hereafter" Text -> Group -> Named Group
=:~ Group -> Group
grp [Choice Type2
5, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
slot_no]

multiasset :: IsType0 a => a -> GRuleCall
multiasset :: forall t0. IsType0 t0 => t0 -> GRuleCall
multiasset = forall t0. IsType0 t0 => (GRef -> Rule) -> t0 -> GRuleCall
binding forall a b. (a -> b) -> a -> b
$ \GRef
x ->
  Text
"multiasset"
    forall a. IsType0 a => Text -> a -> Rule
=:= MapChoice -> MapChoice
mp [Word64
1 forall a. CanQuantify a => Word64 -> a -> a
<+ forall r. IsType0 r => r -> Key
asKey Rule
policy_id forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> MapChoice -> MapChoice
mp [Word64
1 forall a. CanQuantify a => Word64 -> a -> a
<+ forall r. IsType0 r => r -> Key
asKey Rule
asset_name forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> GRef
x]]

value :: Rule
value :: Rule
value = Text
"value" forall a. IsType0 a => Text -> a -> Rule
=:= Rule
coin forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> Seal Array
sarr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
coin, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (forall t0. IsType0 t0 => t0 -> GRuleCall
multiasset Rule
positive_coin)]

mint :: Rule
mint :: Rule
mint = Text
"mint" forall a. IsType0 a => Text -> a -> Rule
=:= forall t0. IsType0 t0 => t0 -> GRuleCall
multiasset Rule
nonZeroInt64

epoch_no :: Rule
epoch_no :: Rule
epoch_no = Text
"epoch_no" forall a. IsType0 a => Text -> a -> Rule
=:= Value Int
VUInt forall a s. (IsSizeable a, IsSize s) => Value a -> s -> Constrained
`sized` (Word64
8 :: Word64)

epoch_interval :: Rule
epoch_interval :: Rule
epoch_interval = Text
"epoch_interval" forall a. IsType0 a => Text -> a -> Rule
=:= Value Int
VUInt forall a s. (IsSizeable a, IsSize s) => Value a -> s -> Constrained
`sized` (Word64
4 :: Word64)

slot_no :: Rule
slot_no :: Rule
slot_no = Text
"slot_no" forall a. IsType0 a => Text -> a -> Rule
=:= Value Int
VUInt forall a s. (IsSizeable a, IsSize s) => Value a -> s -> Constrained
`sized` (Word64
8 :: Word64)

block_no :: Rule
block_no :: Rule
block_no = Text
"block_no" forall a. IsType0 a => Text -> a -> Rule
=:= Value Int
VUInt forall a s. (IsSizeable a, IsSize s) => Value a -> s -> Constrained
`sized` (Word64
8 :: Word64)

script :: Rule
script :: Rule
script =
  Text
"script"
    forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr [ArrayEntry
0, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
native_script]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [ArrayEntry
1, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
plutus_v1_script]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [ArrayEntry
2, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
plutus_v2_script]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [ArrayEntry
3, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
plutus_v3_script]

-- | Conway era introduces an optional 258 tag for sets, which will
-- become mandatory in the second era after Conway. We recommend all the
-- tooling to account for this future breaking change sooner rather than
-- later, in order to provide a smooth transition for their users.
set :: IsType0 t0 => t0 -> GRuleCall
set :: forall t0. IsType0 t0 => t0 -> GRuleCall
set = forall t0. IsType0 t0 => (GRef -> Rule) -> t0 -> GRuleCall
binding forall a b. (a -> b) -> a -> b
$ \GRef
x -> Text
"set" forall a. IsType0 a => Text -> a -> Rule
=:= forall a. Word64 -> a -> Tagged a
tag Word64
258 (ArrayChoice -> ArrayChoice
arr [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a GRef
x]) forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> Seal Array
sarr [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a GRef
x]

-- | Conway era introduces an optional 258 tag for sets, which will
-- become mandatory in the second era after Conway. We recommend all the
-- tooling to account for this future breaking change sooner rather than
-- later, in order to provide a smooth transition for their users.
nonempty_set :: IsType0 t0 => t0 -> GRuleCall
nonempty_set :: forall t0. IsType0 t0 => t0 -> GRuleCall
nonempty_set = forall t0. IsType0 t0 => (GRef -> Rule) -> t0 -> GRuleCall
binding forall a b. (a -> b) -> a -> b
$ \GRef
x ->
  Text
"nonempty_set"
    forall a. IsType0 a => Text -> a -> Rule
=:= forall a. Word64 -> a -> Tagged a
tag Word64
258 (ArrayChoice -> ArrayChoice
arr [Word64
1 forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a GRef
x])
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> Seal Array
sarr [Word64
1 forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a GRef
x]