Refresh gift_card and hello_world examples.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use aiken/transaction/value
|
||||
use cardano/assets
|
||||
|
||||
test test_quantity_of_1() {
|
||||
let x = value.from_asset(#"000000", #"000020e05363726970744f776e6572", -1)
|
||||
value.quantity_of(x, #"000000", #"000020e05363726970744f776e6572") < 0
|
||||
let x = assets.from_asset(#"000000", #"000020e05363726970744f776e6572", -1)
|
||||
assets.quantity_of(x, #"000000", #"000020e05363726970744f776e6572") < 0
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use aiken/bytearray.{from_string}
|
||||
use aiken/hash.{Hash, Sha2_256, sha2_256}
|
||||
use aiken/list
|
||||
use aiken/collection/list
|
||||
use aiken/crypto.{Hash, Sha2_256, sha2_256}
|
||||
use aiken/option.{choice, is_none}
|
||||
use aiken/primitive/bytearray.{from_string}
|
||||
|
||||
// Construction of the merkle tree shouldn't be done by hand, but via
|
||||
// 'from_list'.
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
use aiken/bytearray
|
||||
use aiken/dict.{Dict}
|
||||
use aiken/hash.{Blake2b_224, Hash}
|
||||
use aiken/transaction/credential.{Script}
|
||||
use aiken/collection/dict.{Dict}
|
||||
use aiken/crypto.{Blake2b_224, Hash, Script}
|
||||
use aiken/primitive/bytearray
|
||||
|
||||
pub type PolicyId =
|
||||
Hash<Blake2b_224, Script>
|
||||
@@ -13,9 +12,7 @@ pub opaque type Value {
|
||||
inner: Dict<PolicyId, Dict<AssetName, Int>>,
|
||||
}
|
||||
|
||||
pub fn zero() -> Value {
|
||||
Value { inner: dict.new() }
|
||||
}
|
||||
pub const zero: Value = Value { inner: dict.empty }
|
||||
|
||||
pub fn from_asset(
|
||||
policy_id: PolicyId,
|
||||
@@ -23,9 +20,9 @@ pub fn from_asset(
|
||||
quantity: Int,
|
||||
) -> Value {
|
||||
let asset =
|
||||
dict.new()
|
||||
dict.empty
|
||||
|> dict.insert(asset_name, quantity)
|
||||
dict.new()
|
||||
dict.empty
|
||||
|> dict.insert(policy_id, asset)
|
||||
|> Value
|
||||
}
|
||||
@@ -86,12 +83,12 @@ pub fn flatten_with(
|
||||
}
|
||||
|
||||
test flatten_with_1() {
|
||||
flatten_with(zero(), fn(p, a, q) { Some((p, a, q)) }) == []
|
||||
flatten_with(zero, fn(p, a, q) { Some((p, a, q)) }) == []
|
||||
}
|
||||
|
||||
test flatten_with_2() {
|
||||
let v =
|
||||
zero()
|
||||
zero
|
||||
|> add(from_asset("a", "1", 14))
|
||||
|> add(from_asset("b", "", 42))
|
||||
|> add(from_asset("a", "2", 42))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use aiken/bytearray.{from_string}
|
||||
use aiken/hash.{Hash, Sha2_256, sha2_256}
|
||||
use aiken/list
|
||||
use aiken/collection/list
|
||||
use aiken/crypto.{Hash, Sha2_256, sha2_256}
|
||||
use aiken/option.{choice, is_none}
|
||||
use aiken/primitive/bytearray.{from_string}
|
||||
|
||||
/// Variant of MerkleTree with only hash but without actual value
|
||||
pub type MerkleTree<a> {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use aiken/builtin.{snd_pair}
|
||||
use aiken/cbor
|
||||
use aiken/list
|
||||
use aiken/collection/list
|
||||
|
||||
test tuple_when() {
|
||||
let items =
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use aiken/collection/list
|
||||
use cardano/assets
|
||||
use cardano/address.{Address, VerificationKey}
|
||||
use cardano/assets
|
||||
use cardano/transaction.{Input, NoDatum, Output, OutputReference, Transaction}
|
||||
|
||||
pub const own_hash = #"01020304050607080910111213140102030405060708091011121314"
|
||||
@@ -46,7 +46,7 @@ test test_simple_oneshot() {
|
||||
let output =
|
||||
Output {
|
||||
address: beneficiary_address(),
|
||||
value: assets.zero(),
|
||||
value: assets.zero,
|
||||
datum: NoDatum,
|
||||
reference_script: None,
|
||||
}
|
||||
@@ -59,7 +59,7 @@ test test_simple_oneshot() {
|
||||
|
||||
let tx =
|
||||
Transaction {
|
||||
..transaction.placeholder(),
|
||||
..transaction.placeholder,
|
||||
mint: mint,
|
||||
extra_signatories: [other_hash],
|
||||
inputs: [input],
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use aiken/list.{count as my_count} as native_list
|
||||
use aiken/collection/list.{count as my_count} as native_list
|
||||
|
||||
test thing_1() {
|
||||
let x =
|
||||
|
||||
Reference in New Issue
Block a user