diff --git a/examples/acceptance_tests/script_context/v3/ctx/mint/tx.template b/examples/acceptance_tests/script_context/v3/ctx/mint/tx.template index 1e54fcc7..20679b05 100644 --- a/examples/acceptance_tests/script_context/v3/ctx/mint/tx.template +++ b/examples/acceptance_tests/script_context/v3/ctx/mint/tx.template @@ -11,15 +11,15 @@ , { 0: h'000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' , 1: [ 1000000 - , { h'{{ mint.mint_1.hash }}': { h'74756e61': 100000000000000 } - , h'{{ mint.mint_2.hash }}': { h'61696b656e': 42 } + , { h'{{ mint.test_1_mint.hash }}': { h'74756e61': 100000000000000 } + , h'{{ mint.test_2_mint.hash }}': { h'61696b656e': 42 } } ] } , { 0: h'100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' , 1: [ 1000000 - , { h'{{ mint.mint_2.hash }}': { h'63617264616e6f': 1 } + , { h'{{ mint.test_2_mint.hash }}': { h'63617264616e6f': 1 } } ] , 3: 24(h'82034463666F6F') @@ -29,10 +29,10 @@ , 2: 42 , 9: - { h'{{ mint.mint_1.hash }}': + { h'{{ mint.test_1_mint.hash }}': { h'74756e61': 100000000000000 } - , h'{{ mint.mint_2.hash }}': + , h'{{ mint.test_2_mint.hash }}': { h'63617264616e6f': 1 , h'61696b656e': -14 } @@ -65,8 +65,8 @@ ] , 7: - [ h'{{ mint.mint_1.cbor }}' - , h'{{ mint.mint_2.cbor }}' + [ h'{{ mint.test_1_mint.cbor }}' + , h'{{ mint.test_2_mint.cbor }}' ] }, diff --git a/examples/acceptance_tests/script_context/v3/validators/mint.ak b/examples/acceptance_tests/script_context/v3/validators/mint.ak index 51b1d80f..91ef43c7 100644 --- a/examples/acceptance_tests/script_context/v3/validators/mint.ak +++ b/examples/acceptance_tests/script_context/v3/validators/mint.ak @@ -4,7 +4,7 @@ use cardano/assets.{PolicyId, Value} use cardano/credential use cardano/transaction.{ DatumHash, Input, Mint, Minting, NoDatum, Output, OutputReference, - ScriptContext, ScriptInfo, ScriptPurpose, + ScriptContext, ScriptInfo, ScriptPurpose, Transaction } const null28 = #"00000000000000000000000000000000000000000000000000000000" @@ -15,16 +15,24 @@ const null32 = const void_hash = #"923918e403bf43c34b4ef6b48eb2ee04babed17320d8d1b9ff9ad086e86f44ec" -validator { - fn mint_1(_tmp2: Data, ctx: ScriptContext) { - let our_policy_id = assert_script_info(ctx.info) - let other_policy_id = assert_redeemers(ctx.transaction.redeemers) - assert_outputs(ctx.transaction.outputs, our_policy_id, other_policy_id) - assert_mint(ctx.transaction.mint, our_policy_id, other_policy_id) - assert_reference_inputs(ctx.transaction.reference_inputs) - assert_datums(ctx.transaction.datums) +validator test_1 { + mint(_rdmr: Data, our_policy_id: PolicyId, transaction: Transaction) { + let other_policy_id = assert_redeemers(transaction.redeemers) + + assert_outputs(transaction.outputs, our_policy_id, other_policy_id) + + assert_mint(transaction.mint, our_policy_id, other_policy_id) + + assert_reference_inputs(transaction.reference_inputs) + + assert_datums(transaction.datums) + True } + + else(_ctx) { + fail + } } fn assert_reference_inputs(inputs: List) -> Void { @@ -46,10 +54,6 @@ fn assert_reference_inputs(inputs: List) -> Void { Void } -fn assert_script_info(info: ScriptInfo) -> PolicyId { - expect Minting(policy_id) = info - policy_id -} fn assert_redeemers(redeemers: Pairs) -> PolicyId { expect [Pair(Mint(other_policy_id), data), _] = redeemers @@ -120,8 +124,8 @@ fn assert_mint(mint: Value, our_policy_id: PolicyId, other_policy_id: PolicyId) Void } -validator { - fn mint_2(_tmp2: Void, _ctx: ScriptContext) { +validator test_2 { + mint(_tmp2: Void, _policy_id: PolicyId, _ctx: ScriptContext) { trace @"_____mint_2_____" True }