fix: scope issue when using when with a function call subject
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use aiken/dict
|
||||
use aiken/list
|
||||
use aiken/transaction.{Output, ScriptContext}
|
||||
use aiken/transaction.{Output, OutputReference, ScriptContext}
|
||||
use aiken/transaction/value.{PolicyId}
|
||||
|
||||
const my_policy_id: PolicyId = #"0000000000"
|
||||
@@ -16,3 +16,19 @@ pub fn spend(_datum: Data, _redeemer: Data, ctx: ScriptContext) -> Bool {
|
||||
ctx.transaction.outputs
|
||||
|> list.any(has_policy_id(_, my_policy_id))
|
||||
}
|
||||
|
||||
fn mint(
|
||||
output_reference: OutputReference,
|
||||
_redeemer: Void,
|
||||
ctx: ScriptContext,
|
||||
) -> Bool {
|
||||
when
|
||||
list.find(
|
||||
ctx.transaction.inputs,
|
||||
fn(input) { input.output_reference == output_reference },
|
||||
)
|
||||
is {
|
||||
Some(_) -> True
|
||||
None -> False
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user