feat: switch mint to new def
This commit is contained in:
parent
953ee6b5d1
commit
3fac7002d4
|
@ -11,15 +11,15 @@
|
||||||
, { 0: h'000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
|
, { 0: h'000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
|
||||||
, 1:
|
, 1:
|
||||||
[ 1000000
|
[ 1000000
|
||||||
, { h'{{ mint.mint_1.hash }}': { h'74756e61': 100000000000000 }
|
, { h'{{ mint.test_1_mint.hash }}': { h'74756e61': 100000000000000 }
|
||||||
, h'{{ mint.mint_2.hash }}': { h'61696b656e': 42 }
|
, h'{{ mint.test_2_mint.hash }}': { h'61696b656e': 42 }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
, { 0: h'100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
|
, { 0: h'100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
|
||||||
, 1:
|
, 1:
|
||||||
[ 1000000
|
[ 1000000
|
||||||
, { h'{{ mint.mint_2.hash }}': { h'63617264616e6f': 1 }
|
, { h'{{ mint.test_2_mint.hash }}': { h'63617264616e6f': 1 }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
, 3: 24(h'82034463666F6F')
|
, 3: 24(h'82034463666F6F')
|
||||||
|
@ -29,10 +29,10 @@
|
||||||
, 2: 42
|
, 2: 42
|
||||||
|
|
||||||
, 9:
|
, 9:
|
||||||
{ h'{{ mint.mint_1.hash }}':
|
{ h'{{ mint.test_1_mint.hash }}':
|
||||||
{ h'74756e61': 100000000000000
|
{ h'74756e61': 100000000000000
|
||||||
}
|
}
|
||||||
, h'{{ mint.mint_2.hash }}':
|
, h'{{ mint.test_2_mint.hash }}':
|
||||||
{ h'63617264616e6f': 1
|
{ h'63617264616e6f': 1
|
||||||
, h'61696b656e': -14
|
, h'61696b656e': -14
|
||||||
}
|
}
|
||||||
|
@ -65,8 +65,8 @@
|
||||||
]
|
]
|
||||||
|
|
||||||
, 7:
|
, 7:
|
||||||
[ h'{{ mint.mint_1.cbor }}'
|
[ h'{{ mint.test_1_mint.cbor }}'
|
||||||
, h'{{ mint.mint_2.cbor }}'
|
, h'{{ mint.test_2_mint.cbor }}'
|
||||||
]
|
]
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
|
@ -4,7 +4,7 @@ use cardano/assets.{PolicyId, Value}
|
||||||
use cardano/credential
|
use cardano/credential
|
||||||
use cardano/transaction.{
|
use cardano/transaction.{
|
||||||
DatumHash, Input, Mint, Minting, NoDatum, Output, OutputReference,
|
DatumHash, Input, Mint, Minting, NoDatum, Output, OutputReference,
|
||||||
ScriptContext, ScriptInfo, ScriptPurpose,
|
ScriptContext, ScriptInfo, ScriptPurpose, Transaction
|
||||||
}
|
}
|
||||||
|
|
||||||
const null28 = #"00000000000000000000000000000000000000000000000000000000"
|
const null28 = #"00000000000000000000000000000000000000000000000000000000"
|
||||||
|
@ -15,16 +15,24 @@ const null32 =
|
||||||
const void_hash =
|
const void_hash =
|
||||||
#"923918e403bf43c34b4ef6b48eb2ee04babed17320d8d1b9ff9ad086e86f44ec"
|
#"923918e403bf43c34b4ef6b48eb2ee04babed17320d8d1b9ff9ad086e86f44ec"
|
||||||
|
|
||||||
validator {
|
validator test_1 {
|
||||||
fn mint_1(_tmp2: Data, ctx: ScriptContext) {
|
mint(_rdmr: Data, our_policy_id: PolicyId, transaction: Transaction) {
|
||||||
let our_policy_id = assert_script_info(ctx.info)
|
let other_policy_id = assert_redeemers(transaction.redeemers)
|
||||||
let other_policy_id = assert_redeemers(ctx.transaction.redeemers)
|
|
||||||
assert_outputs(ctx.transaction.outputs, our_policy_id, other_policy_id)
|
assert_outputs(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_mint(transaction.mint, our_policy_id, other_policy_id)
|
||||||
assert_datums(ctx.transaction.datums)
|
|
||||||
|
assert_reference_inputs(transaction.reference_inputs)
|
||||||
|
|
||||||
|
assert_datums(transaction.datums)
|
||||||
|
|
||||||
True
|
True
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else(_ctx) {
|
||||||
|
fail
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn assert_reference_inputs(inputs: List<Input>) -> Void {
|
fn assert_reference_inputs(inputs: List<Input>) -> Void {
|
||||||
|
@ -46,10 +54,6 @@ fn assert_reference_inputs(inputs: List<Input>) -> Void {
|
||||||
Void
|
Void
|
||||||
}
|
}
|
||||||
|
|
||||||
fn assert_script_info(info: ScriptInfo) -> PolicyId {
|
|
||||||
expect Minting(policy_id) = info
|
|
||||||
policy_id
|
|
||||||
}
|
|
||||||
|
|
||||||
fn assert_redeemers(redeemers: Pairs<ScriptPurpose, Data>) -> PolicyId {
|
fn assert_redeemers(redeemers: Pairs<ScriptPurpose, Data>) -> PolicyId {
|
||||||
expect [Pair(Mint(other_policy_id), data), _] = redeemers
|
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
|
Void
|
||||||
}
|
}
|
||||||
|
|
||||||
validator {
|
validator test_2 {
|
||||||
fn mint_2(_tmp2: Void, _ctx: ScriptContext) {
|
mint(_tmp2: Void, _policy_id: PolicyId, _ctx: ScriptContext) {
|
||||||
trace @"_____mint_2_____"
|
trace @"_____mint_2_____"
|
||||||
True
|
True
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue