Start adjusting acceptance tests to the new Plutus V3 syntax.
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
use aiken/dict
|
||||
use aiken/list.{find, foldr}
|
||||
use aiken/transaction.{Input,
|
||||
OutputReference, ScriptContext, Spend, Transaction} as tx
|
||||
use aiken/transaction/value.{add, zero}
|
||||
use aiken/collection/dict
|
||||
use aiken/collection/list.{find, foldr}
|
||||
use cardano/transaction.{Input, OutputReference, Transaction} as tx
|
||||
use cardano/transaction/assets.{add, zero}
|
||||
|
||||
type Action {
|
||||
Mint
|
||||
@@ -10,14 +9,11 @@ type Action {
|
||||
}
|
||||
|
||||
validator(token_name: ByteArray, utxo_ref: OutputReference) {
|
||||
fn gift_card(rdmr: Action, ctx: ScriptContext) -> Bool {
|
||||
let ScriptContext { transaction, purpose } = ctx
|
||||
expect tx.Mint(policy_id) = purpose
|
||||
mint(rdmr: Action, policy_id: PolicyId, transaction: Transaction) -> Bool {
|
||||
let Transaction { inputs, mint, .. } = transaction
|
||||
expect [Pair(asset_name, amount)] =
|
||||
mint
|
||||
|> value.from_minted_value
|
||||
|> value.tokens(policy_id)
|
||||
|> assets.tokens(policy_id)
|
||||
|> dict.to_pairs()
|
||||
when rdmr is {
|
||||
Mint -> {
|
||||
|
||||
@@ -1,15 +1,20 @@
|
||||
use aiken/list
|
||||
use aiken/transaction.{Output, ScriptContext}
|
||||
use aiken/collection/list
|
||||
use cardano/transaction.{Output, Transaction}
|
||||
|
||||
validator {
|
||||
fn backtrace(_datum: Void, _redeemer: Void, context: ScriptContext) -> Bool {
|
||||
expect Some(_) = list.find(context.transaction.outputs, fn(_) { True })
|
||||
let _ = find_stuff(context)
|
||||
spend(
|
||||
_datum: Void,
|
||||
_redeemer: Void,
|
||||
_ref: Data,
|
||||
transaction: Transaction,
|
||||
) -> Bool {
|
||||
expect Some(_) = list.find(transaction.outputs, fn(_) { True })
|
||||
let _ = find_stuff(transaction)
|
||||
True
|
||||
}
|
||||
}
|
||||
|
||||
fn find_stuff(context: ScriptContext) -> Output {
|
||||
expect Some(stuff) = list.find(context.transaction.outputs, fn(_) { True })
|
||||
fn find_stuff(transaction: Transaction) -> Output {
|
||||
expect Some(stuff) = list.find(transaction.outputs, fn(_) { True })
|
||||
stuff
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user