Re-format and re-run all acceptance tests.

This commit is contained in:
KtorZ
2024-01-20 10:43:17 +01:00
parent 9ee2d58ba3
commit b50e4ab63a
77 changed files with 449 additions and 830 deletions

View File

@@ -13,4 +13,4 @@ requirements = []
source = "github"
[etags]
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705181044, nanos_since_epoch = 445717000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"]
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705743640, nanos_since_epoch = 940487000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"]

View File

@@ -5,7 +5,7 @@
"plutusVersion": "v2",
"compiler": {
"name": "Aiken",
"version": "v1.0.21-alpha+0161cf6"
"version": "v1.0.21-alpha+bf96c3a"
}
},
"validators": [

View File

@@ -1,38 +1,31 @@
use aiken/list.{find, foldr}
use aiken/transaction.{Input, ScriptContext, Spend, OutputReference, Transaction} as tx
use aiken/transaction/value.{add, zero}
use aiken/dict
use aiken/list.{find, foldr}
use aiken/transaction.{Input,
OutputReference, ScriptContext, Spend, Transaction} as tx
use aiken/transaction/value.{add, zero}
type Action {
Mint
Burn
}
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
let Transaction { inputs, mint, .. } =
transaction
expect [(asset_name, amount)] = mint
let ScriptContext { transaction, purpose } = ctx
expect tx.Mint(policy_id) = purpose
let Transaction { inputs, mint, .. } = transaction
expect [(asset_name, amount)] =
mint
|> value.from_minted_value
|> value.tokens(policy_id)
|> dict.to_list()
when rdmr is {
Mint -> {
expect True =
expect
list.any(inputs, fn(input) { input.output_reference == utxo_ref })
amount == 1 && asset_name == token_name
}
Burn ->
todo @"burn"
Burn -> todo @"burn"
}
}
}