Add new script context test scenario covering minting & values.
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
use aiken/list
|
||||
use aiken/option
|
||||
use aiken/transaction.{ScriptContext, Spend, TransactionId}
|
||||
use aiken/transaction.{NoDatum, ScriptContext, Spend, TransactionId}
|
||||
use aiken/transaction/credential.{VerificationKeyCredential}
|
||||
use aiken/transaction/value
|
||||
|
||||
fn spend(_datum: Void, _redeemer: Void, ctx: ScriptContext) {
|
||||
[
|
||||
assert_id(ctx.transaction),
|
||||
assert_purpose(ctx.purpose),
|
||||
assert_outputs(ctx.transaction),
|
||||
assert_fee(ctx.transaction),
|
||||
@@ -13,6 +14,12 @@ fn spend(_datum: Void, _redeemer: Void, ctx: ScriptContext) {
|
||||
|> list.and
|
||||
}
|
||||
|
||||
fn assert_id(transaction) {
|
||||
transaction.id != TransactionId(
|
||||
#"0000000000000000000000000000000000000000000000000000000000000000",
|
||||
)
|
||||
}
|
||||
|
||||
fn assert_purpose(purpose) {
|
||||
when purpose is {
|
||||
Spend(ref) ->
|
||||
@@ -36,6 +43,8 @@ fn assert_outputs(transaction) {
|
||||
#"11111111111111111111111111111111111111111111111111111111",
|
||||
),
|
||||
option.is_none(output.address.stake_credential),
|
||||
output.datum == NoDatum,
|
||||
output.reference_script == None,
|
||||
]
|
||||
|> list.and
|
||||
_ -> error("unexpected number of outputs")
|
||||
|
||||
Reference in New Issue
Block a user