Documentation
¶
Overview ¶
Package plutusv4script builds PlutusV4 scripts that inspect the ScriptContext, shared by the era validation tests and the ledger tests that drive the same scripts through block application, replay and the mempool.
Index ¶
- Constants
- func ContextScript(t testing.TB, cond func(ctx Term) Term) lcommon.PlutusV4Script
- func MapOrderScript(t testing.TB, fieldIndex int) lcommon.PlutusV4Script
- func MaybeScript(t testing.TB, sel func(ctx Term) Term, tag int64) lcommon.PlutusV4Script
- func ScriptCredential(s lcommon.Script) lcommon.Credential
- type Term
Constants ¶
const ( DirectDepositsField = 8 BalanceIntervalsField = 9 RequiredGuardsField = 12 )
TxInfo field positions of the Dijkstra account maps.
Variables ¶
This section is empty.
Functions ¶
func ContextScript ¶
ContextScript builds a PlutusV4 script that succeeds only when cond, evaluated against the ScriptContext, is true.
func MapOrderScript ¶
func MapOrderScript( t testing.TB, fieldIndex int, ) lcommon.PlutusV4Script
MapOrderScript succeeds only when the TxInfo map at fieldIndex lists a script credential (Constr 1) first and a key credential (Constr 0) second. The reference orders script entries before key entries, which is the reverse of the credential type numbers.
func MaybeScript ¶
MaybeScript succeeds when the Maybe selected by sel has the given constructor tag: 0 is Just, 1 is Nothing. It compares the tag rather than the whole value, because Just carries a field and so never equals a bare Constr 0.
func ScriptCredential ¶
func ScriptCredential(s lcommon.Script) lcommon.Credential
ScriptCredential is the credential naming the script.
Types ¶
type Term ¶
Term is a script term over de Bruijn indices.
func Apply ¶
func Apply(fn builtin.DefaultFunction, args ...Term) Term
Apply applies a builtin to its arguments, forcing it as often as its polymorphism requires.
func ConstrFields ¶
ConstrFields returns the field list of a Constr. Only sum types, such as ScriptInfo and credentials, are still constructors in V4.
func GuardingTopTxInfo ¶
GuardingTopTxInfo selects the TopTxInfo of a GuardingScript purpose.
func ListFields ¶ added in v0.83.1
ListFields returns the fields of a single-constructor V4 type, which the context encodes as a Data list: ScriptContext, TxInfo and the other product types.
func TxInfoSubTxIx ¶
TxInfoSubTxIx selects txInfoSubTxIx from the ScriptContext. The V4 selectors follow plutus-ledger-api 1.70.0.0, PlutusLedgerApi.V4.Contexts: ScriptContext and TxInfo use makeIsDataSchemaAsList; ScriptInfo retains indexed constructors.