Skip to content

Commit

Permalink
fix oracle utxo to only mint 1
Browse files Browse the repository at this point in the history
  • Loading branch information
twwu123 committed Dec 13, 2024
1 parent 8040b49 commit 4695347
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions validators/oracle_nft.ak
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,21 @@ use aiken/collection/list
use aiken_virtual_dex/types.{MintPolarity, RBurn, RMint}
use cardano/assets.{PolicyId}
use cardano/transaction.{Input, OutputReference, Transaction}
use vodka_mints.{check_policy_only_burn}
use vodka_mints.{check_policy_only_burn, only_minted_token}

validator oracle_nft(utxo_ref: OutputReference) {
mint(redeemer: MintPolarity, policy_id: PolicyId, tx: Transaction) {
when redeemer is {
RMint -> {
let Transaction { inputs, .. } = tx
let Transaction { inputs, mint, .. } = tx
let hash_equal =
fn(input: Input) {
let hash = input.output_reference
utxo_ref == hash
}
let target_input_exist = list.find(inputs, hash_equal)
when target_input_exist is {
Some(_) -> True
None -> False
}
let target_input_exist = list.any(inputs, hash_equal)
let check_only_minted_token = only_minted_token(mint, policy_id, #"", 1)
target_input_exist && check_only_minted_token
}
RBurn -> check_policy_only_burn(tx.mint, policy_id)
}
Expand Down

0 comments on commit 4695347

Please sign in to comment.