chore: acceptance tests v3 syntax
This commit is contained in:
parent
b57f840cad
commit
ff25fbd970
|
@ -12,15 +12,15 @@ pub fn has_policy_id(self: Output, policy_id: PolicyId) -> Bool {
|
||||||
|> not
|
|> not
|
||||||
}
|
}
|
||||||
|
|
||||||
validator {
|
validator foo {
|
||||||
fn spend(_datum: Data, _redeemer: Data, ctx: ScriptContext) -> Bool {
|
spend(_datum: Data, _redeemer: Data, o_ref: Data, tx: Transaction) -> Bool {
|
||||||
ctx.transaction.outputs
|
ctx.transaction.outputs
|
||||||
|> list.any(has_policy_id(_, my_policy_id))
|
|> list.any(has_policy_id(_, my_policy_id))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
validator(output_reference: OutputReference) {
|
validator bar(output_reference: OutputReference) {
|
||||||
fn mint(_redeemer: Void, ctx: ScriptContext) -> Bool {
|
mint(_redeemer: Void, _policy_id: Data, tx: Transaction) -> Bool {
|
||||||
when
|
when
|
||||||
list.find(
|
list.find(
|
||||||
ctx.transaction.inputs,
|
ctx.transaction.inputs,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
validator {
|
validator foo {
|
||||||
fn spend(_datum: Void, _redeemer: Void, _ctx: Void) -> Bool {
|
spend(_datum: Void, _redeemer: Void, oref: Data, _tx: Void) -> Bool {
|
||||||
True
|
True
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ pub fn validate_pool_borrow(
|
||||||
True
|
True
|
||||||
}
|
}
|
||||||
|
|
||||||
validator {
|
validator foo {
|
||||||
spend(datum: PoolDatum, redeemer: PoolRedeemer, output_ref: OutputReference, transaction: Transaction) {
|
spend(datum: PoolDatum, redeemer: PoolRedeemer, output_ref: OutputReference, transaction: Transaction) {
|
||||||
when redeemer.action is {
|
when redeemer.action is {
|
||||||
PoolWithdraw(_) -> True
|
PoolWithdraw(_) -> True
|
||||||
|
|
|
@ -8,7 +8,7 @@ type Action {
|
||||||
Burn
|
Burn
|
||||||
}
|
}
|
||||||
|
|
||||||
validator(token_name: ByteArray, utxo_ref: OutputReference) {
|
validator foo(token_name: ByteArray, utxo_ref: OutputReference) {
|
||||||
mint(rdmr: Action, policy_id: PolicyId, transaction: Transaction) -> Bool {
|
mint(rdmr: Action, policy_id: PolicyId, transaction: Transaction) -> Bool {
|
||||||
let Transaction { inputs, mint, .. } = transaction
|
let Transaction { inputs, mint, .. } = transaction
|
||||||
expect [Pair(asset_name, amount)] =
|
expect [Pair(asset_name, amount)] =
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use aiken/collection/list
|
use aiken/collection/list
|
||||||
use cardano/transaction.{Output, Transaction}
|
use cardano/transaction.{Output, Transaction}
|
||||||
|
|
||||||
validator {
|
validator foo {
|
||||||
spend(
|
spend(
|
||||||
_datum: Void,
|
_datum: Void,
|
||||||
_redeemer: Void,
|
_redeemer: Void,
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
validator {
|
validator foo {
|
||||||
fn spend(datum: Int, redeemer: Int, _ref: Data, _transaction: Data) {
|
spend(datum: Int, redeemer: Int, _ref: Data, _transaction: Data) {
|
||||||
datum + redeemer == 42
|
datum + redeemer == 42
|
||||||
}
|
}
|
||||||
|
|
||||||
fn mint(redeemer: Int, _policy: ByteArray, _transaction: Data) {
|
mint(redeemer: Int, _policy: ByteArray, _transaction: Data) {
|
||||||
redeemer == 42
|
redeemer == 42
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use aiken/transaction.{ScriptContext}
|
use aiken/transaction.{Transaction}
|
||||||
use aiken/transaction/credential.{Address}
|
use aiken/transaction/credential.{Address}
|
||||||
|
|
||||||
type TestData {
|
type TestData {
|
||||||
|
@ -9,8 +9,8 @@ type TestDatum {
|
||||||
data: Option<TestData>,
|
data: Option<TestData>,
|
||||||
}
|
}
|
||||||
|
|
||||||
validator {
|
validator validate {
|
||||||
fn validate(raw_datum: Data, _redeemer: Data, _context: ScriptContext) -> Bool {
|
spend(raw_datum: Option<Data>, _redeemer: Data, oref: Data, _tx: Transaction) -> Bool {
|
||||||
expect datum: TestDatum = raw_datum
|
expect datum: TestDatum = raw_datum
|
||||||
let TestDatum { data } = datum
|
let TestDatum { data } = datum
|
||||||
when data is {
|
when data is {
|
||||||
|
|
|
@ -25,8 +25,8 @@ pub fn keyhash_address(keyhash: ByteArray) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
validator(utxo_ref: OutputReference) {
|
validator simple_oneshot(utxo_ref: OutputReference) {
|
||||||
fn simple_oneshot(_r: Void, ctx: ScriptContext) -> Bool {
|
mint(_r: Void, oref: Data, ctx: ScriptContext) -> Bool {
|
||||||
let ScriptContext { transaction, purpose } = ctx
|
let ScriptContext { transaction, purpose } = ctx
|
||||||
let Transaction { inputs, .. } = transaction
|
let Transaction { inputs, .. } = transaction
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
const foo =
|
const foo =
|
||||||
45898945895546556456546223123184821312385384845153123213185685815615232323484552
|
45898945895546556456546223123184821312385384845153123213185685815615232323484552
|
||||||
|
|
||||||
validator {
|
validator foo {
|
||||||
fn spend(datum: Int, _redeemer: Data, _context: Data) {
|
spend(datum: Int, _redeemer: Data, o_ref: Data, _tx: Data) {
|
||||||
datum == foo
|
datum == foo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use aiken/transaction.{ScriptContext}
|
use aiken/transaction.{ScriptContext}
|
||||||
|
|
||||||
validator {
|
validator is_fourty_two {
|
||||||
fn is_fourty_two(dat, rdm, _ctx: ScriptContext) -> Bool {
|
spend(dat, rdm, oref, _ctx: Transaction) -> Bool {
|
||||||
rdm == dat && #"68656c6c6f20776f726c64" == #"68656c6c6f20776f726c64"
|
rdm == dat && #"68656c6c6f20776f726c64" == #"68656c6c6f20776f726c64"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue