diff --git a/examples/acceptance_tests/012/lib/tests.ak b/examples/acceptance_tests/012/lib/tests.ak index 78e5360bf..77cd95eff 100644 --- a/examples/acceptance_tests/012/lib/tests.ak +++ b/examples/acceptance_tests/012/lib/tests.ak @@ -14,6 +14,7 @@ pub fn filter(xs: List, f: fn(a) -> Bool) -> List { } test filter_1() { - filter([1, - 2, 3, 4, 5, 6], fn(x) { builtin.mod_integer(x, 2) == 0 }) == [2, 4, 6] + filter([1, 2, 3, 4, 5, 6], fn(x) { builtin.mod_integer(x, 2) == 0 }) == [ + 2, 4, 6, + ] } diff --git a/examples/acceptance_tests/036/aiken.lock b/examples/acceptance_tests/036/aiken.lock index 2658f9e40..0b889661a 100644 --- a/examples/acceptance_tests/036/aiken.lock +++ b/examples/acceptance_tests/036/aiken.lock @@ -3,14 +3,14 @@ [[requirements]] name = "aiken-lang/stdlib" -version = "main" +version = "v2" source = "github" [[packages]] name = "aiken-lang/stdlib" -version = "main" +version = "v2" requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723158432, nanos_since_epoch = 10066000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] +"aiken-lang/stdlib@v2" = [{ secs_since_epoch = 1724777134, nanos_since_epoch = 232157000 }, "cdbbce58b61deb385e7ea787a2e0fc2dc8fe94db9999e0e6275bc9c70e5796be"] diff --git a/examples/acceptance_tests/036/aiken.toml b/examples/acceptance_tests/036/aiken.toml index 8147c1579..9ab33a029 100644 --- a/examples/acceptance_tests/036/aiken.toml +++ b/examples/acceptance_tests/036/aiken.toml @@ -3,5 +3,5 @@ version = "0.0.0" [[dependencies]] name = 'aiken-lang/stdlib' -version = 'main' +version = 'v2' source = 'github' diff --git a/examples/acceptance_tests/036/plutus.json b/examples/acceptance_tests/036/plutus.json index a91e2dccc..515258cdd 100644 --- a/examples/acceptance_tests/036/plutus.json +++ b/examples/acceptance_tests/036/plutus.json @@ -5,12 +5,12 @@ "plutusVersion": "v2", "compiler": { "name": "Aiken", - "version": "v1.0.31-alpha+6e4a16d" + "version": "v1.0.31-alpha+4003343" } }, "validators": [ { - "title": "spend.mint", + "title": "spend.bar.mint", "redeemer": { "title": "_redeemer", "schema": { @@ -21,15 +21,28 @@ { "title": "output_reference", "schema": { - "$ref": "#/definitions/aiken~1transaction~1OutputReference" + "$ref": "#/definitions/cardano~1transaction~1OutputReference" } } ], - "compiledCode": "589e0100003232323232323222322533300553330053370e900018031baa3232330010013758600460126ea8c008c024dd50019129998058008a6103d87a800013232533300a3375e600a60186ea80080244cdd2a40006601c00497ae0133004004001300f002300d0012300b00114a229405261365653330033370e900018021baa00115333006300537540022930b0b2b9a5573aaae7955cfaba05742ae881", - "hash": "0241f73ef186e53566d1b5a81eca50049b0d86833e6b88fe26b1e4bc" + "compiledCode": "58c90100003232323232323222533300332323232325332330093001300a375400426464a666016600660186ea8c8c8cc004004dd6180118079baa00922533301100114c0103d87a80001323253330103375e600a60246ea800803c4cdd2a40006602800497ae0133004004001301500230130012301100114a229414ccc028c008c02cdd50020a99980698061baa00414985858dd7180718059baa002370e90000b1806180680118058009805801180480098029baa00114984d9595cd2ab9d5573caae7d5d02ba157441", + "hash": "2edaecec5a072cd65b12395410ce6da7cafaffdf70506cbcb40b4df8" }, { - "title": "spend.spend", + "title": "spend.bar.else", + "parameters": [ + { + "title": "output_reference", + "schema": { + "$ref": "#/definitions/cardano~1transaction~1OutputReference" + } + } + ], + "compiledCode": "58c90100003232323232323222533300332323232325332330093001300a375400426464a666016600660186ea8c8c8cc004004dd6180118079baa00922533301100114c0103d87a80001323253330103375e600a60246ea800803c4cdd2a40006602800497ae0133004004001301500230130012301100114a229414ccc028c008c02cdd50020a99980698061baa00414985858dd7180718059baa002370e90000b1806180680118058009805801180480098029baa00114984d9595cd2ab9d5573caae7d5d02ba157441", + "hash": "2edaecec5a072cd65b12395410ce6da7cafaffdf70506cbcb40b4df8" + }, + { + "title": "spend.foo.spend", "datum": { "title": "_datum", "schema": { @@ -42,8 +55,13 @@ "$ref": "#/definitions/Data" } }, - "compiledCode": "58ef01000032323232323232222533300432330010013758601460166016600e6ea8c028c01cdd50011129998048008a501325333007333007533300a3253330083370e900118049baa00114bd6f7b63009bab300d300a375400264660020026eacc034c038c028dd518068019129998060008a60103d87a8000132323232533300d33722911050000000000000021533300d3371e91010500000000000000213374a9000198089ba60014bd700a6103d87a80001330060060033756601c0066eb8c030008c040008c0380045288a504a094452889980180180098060008a4c26cacae6955ceaab9e5573eae815d0aba21", - "hash": "f56561e01063b11146809755d9907147e79d3166aa5c65fba4040fd1" + "compiledCode": "5901230100003232323232323225333002323232323253330073370e900118041baa001132323232330010013758602060226022601a6ea8020894ccc03c0045280992999806999806a99980819299980719b8748008c03cdd50008a5eb7bdb1804dd5980998081baa001323300100137566026602860206ea8c04c00c894ccc048004530103d87a800013232323253330133372291105000000000000002153330133371e91010500000000000000213374a90001980b9ba60014bd700a6103d87a8000133006006003375660280066eb8c048008c058008c0500045288a504a0944528899801801800980900098071807801180680098049baa00116300b300c002300a001300a00230080013004375400229309b2b2b9a5573aaae7955cfaba05742ae881", + "hash": "cf024265a1ff4ab129cef178c64b8c4cab25d62129242e01e29bb3d1" + }, + { + "title": "spend.foo.else", + "compiledCode": "5901230100003232323232323225333002323232323253330073370e900118041baa001132323232330010013758602060226022601a6ea8020894ccc03c0045280992999806999806a99980819299980719b8748008c03cdd50008a5eb7bdb1804dd5980998081baa001323300100137566026602860206ea8c04c00c894ccc048004530103d87a800013232323253330133372291105000000000000002153330133371e91010500000000000000213374a90001980b9ba60014bd700a6103d87a8000133006006003375660280066eb8c048008c058008c0500045288a504a0944528899801801800980900098071807801180680098049baa00116300b300c002300a001300a00230080013004375400229309b2b2b9a5573aaae7955cfaba05742ae881", + "hash": "cf024265a1ff4ab129cef178c64b8c4cab25d62129242e01e29bb3d1" } ], "definitions": { @@ -68,7 +86,7 @@ } ] }, - "aiken/transaction/OutputReference": { + "cardano/transaction/OutputReference": { "title": "OutputReference", "description": "An `OutputReference` is a unique reference to an output on-chain. The `output_index`\n corresponds to the position in the output list of the transaction (identified by its id)\n that produced that output", "anyOf": [ @@ -79,7 +97,7 @@ "fields": [ { "title": "transaction_id", - "$ref": "#/definitions/aiken~1transaction~1TransactionId" + "$ref": "#/definitions/ByteArray" }, { "title": "output_index", @@ -88,23 +106,6 @@ ] } ] - }, - "aiken/transaction/TransactionId": { - "title": "TransactionId", - "description": "A unique transaction identifier, as the hash of a transaction body. Note that the transaction id\n isn't a direct hash of the `Transaction` as visible on-chain. Rather, they correspond to hash\n digests of transaction body as they are serialized on the network.", - "anyOf": [ - { - "title": "TransactionId", - "dataType": "constructor", - "index": 0, - "fields": [ - { - "title": "hash", - "$ref": "#/definitions/ByteArray" - } - ] - } - ] } } } \ No newline at end of file diff --git a/examples/acceptance_tests/036/validators/spend.ak b/examples/acceptance_tests/036/validators/spend.ak index 649459b53..d02a89a47 100644 --- a/examples/acceptance_tests/036/validators/spend.ak +++ b/examples/acceptance_tests/036/validators/spend.ak @@ -1,29 +1,33 @@ -use aiken/dict -use aiken/list -use aiken/transaction.{Output, OutputReference, ScriptContext} -use aiken/transaction/value.{PolicyId} +use aiken/collection/dict +use aiken/collection/list +use cardano/assets.{PolicyId} +use cardano/transaction.{Output, OutputReference, Transaction} const my_policy_id: PolicyId = #"0000000000" pub fn has_policy_id(self: Output, policy_id: PolicyId) -> Bool { self.value - |> value.tokens(policy_id) + |> assets.tokens(policy_id) |> dict.is_empty |> not } validator foo { - spend(_datum: Data, _redeemer: Data, o_ref: Data, tx: Transaction) -> Bool { - ctx.transaction.outputs + spend(_datum: Option, _redeemer: Data, _o_ref: Data, self: Transaction) { + self.outputs |> list.any(has_policy_id(_, my_policy_id)) } + + else(_) { + fail + } } validator bar(output_reference: OutputReference) { - mint(_redeemer: Void, _policy_id: Data, tx: Transaction) -> Bool { + mint(_redeemer: Void, _policy_id, self: Transaction) { when list.find( - ctx.transaction.inputs, + self.inputs, fn(input) { input.output_reference == output_reference }, ) is { @@ -31,4 +35,8 @@ validator bar(output_reference: OutputReference) { None -> False } } + + else(_) { + fail + } } diff --git a/examples/acceptance_tests/040/lib/tests.ak b/examples/acceptance_tests/040/lib/tests.ak index 1522eec04..c20670689 100644 --- a/examples/acceptance_tests/040/lib/tests.ak +++ b/examples/acceptance_tests/040/lib/tests.ak @@ -29,7 +29,7 @@ test expect_ford1() { ], ) expect Ford { owner, wheels, truck_bed_limit, .. }: Car = initial_car - owner == #"" && ( wheels == 4 && truck_bed_limit == 10000 ) + owner == #"" && wheels == 4 && truck_bed_limit == 10000 } test expect_ford2() { @@ -42,14 +42,14 @@ test expect_ford2() { car_doors: [], } expect Ford { owner, wheels, remote_connect, .. } = initial_car - owner == #"2222222222" && ( wheels == 6 && remote_connect == #"" ) + owner == #"2222222222" && wheels == 6 && remote_connect == #"" } test expect_list1() { let initial_car = [5, 6, 7] expect [a, b, c] = initial_car - a == 5 && ( b == 6 && c == 7 ) + a == 5 && b == 6 && c == 7 } test expect_list2() { diff --git a/examples/acceptance_tests/047/plutus.json b/examples/acceptance_tests/047/plutus.json index 9a9241cf5..9dfc4a4fd 100644 --- a/examples/acceptance_tests/047/plutus.json +++ b/examples/acceptance_tests/047/plutus.json @@ -5,12 +5,12 @@ "plutusVersion": "v2", "compiler": { "name": "Aiken", - "version": "v1.0.31-alpha+6e4a16d" + "version": "v1.0.31-alpha+4003343" } }, "validators": [ { - "title": "foo.spend", + "title": "foo.foo.spend", "datum": { "title": "_datum", "schema": { @@ -23,8 +23,13 @@ "$ref": "#/definitions/Void" } }, - "compiledCode": "585201000032323232232232253330064a229309b2b299980219b8748000c014dd50008a99980398031baa001149858594ccc008cdc3a400060066ea800454ccc014c010dd50008a4c2c2cae6955ceaab9e5573f", - "hash": "84a516ff1f146f698164b5e64ff813e4e22ba2fa35491f2dc3d70935" + "compiledCode": "587601000032323232323225333002323232323253330073370e900118041baa0011323232324a2a66601466e1d2000300b375400a2a66601a60186ea80145261616300d300e002300c001300937540022c6014601600460120026012004600e00260086ea8004526136565734aae7555cf2ab9f5742ae89", + "hash": "c613c8326fea00dff179b7108f248b60c155881bbce544d84fe573e1" + }, + { + "title": "foo.foo.else", + "compiledCode": "587601000032323232323225333002323232323253330073370e900118041baa0011323232324a2a66601466e1d2000300b375400a2a66601a60186ea80145261616300d300e002300c001300937540022c6014601600460120026012004600e00260086ea8004526136565734aae7555cf2ab9f5742ae89", + "hash": "c613c8326fea00dff179b7108f248b60c155881bbce544d84fe573e1" } ], "definitions": { diff --git a/examples/acceptance_tests/047/validators/foo.ak b/examples/acceptance_tests/047/validators/foo.ak index aa9f79d35..c8d490e71 100644 --- a/examples/acceptance_tests/047/validators/foo.ak +++ b/examples/acceptance_tests/047/validators/foo.ak @@ -1,7 +1,11 @@ validator foo { - spend(_datum: Void, _redeemer: Void, oref: Data, _tx: Void) -> Bool { + spend(_datum: Option, _redeemer: Void, oref: Data, _tx: Void) { True } + + else(_) { + fail + } } test foo() { diff --git a/examples/acceptance_tests/054/aiken.lock b/examples/acceptance_tests/054/aiken.lock index b7148ea2c..59f3e01b0 100644 --- a/examples/acceptance_tests/054/aiken.lock +++ b/examples/acceptance_tests/054/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724596650, nanos_since_epoch = 294733000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724776969, nanos_since_epoch = 835808000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] diff --git a/examples/acceptance_tests/055/aiken.lock b/examples/acceptance_tests/055/aiken.lock index f9af5e0e3..472e63d42 100644 --- a/examples/acceptance_tests/055/aiken.lock +++ b/examples/acceptance_tests/055/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724596651, nanos_since_epoch = 984539000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724776974, nanos_since_epoch = 866167000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] diff --git a/examples/acceptance_tests/061/aiken.lock b/examples/acceptance_tests/061/aiken.lock index 9e34f1aaa..3e15749be 100644 --- a/examples/acceptance_tests/061/aiken.lock +++ b/examples/acceptance_tests/061/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724596658, nanos_since_epoch = 893017000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724776995, nanos_since_epoch = 750600000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] diff --git a/examples/acceptance_tests/063/aiken.lock b/examples/acceptance_tests/063/aiken.lock index f2d9b2c42..2cec8363b 100644 --- a/examples/acceptance_tests/063/aiken.lock +++ b/examples/acceptance_tests/063/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724596651, nanos_since_epoch = 968695000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724776974, nanos_since_epoch = 455232000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] diff --git a/examples/acceptance_tests/067/aiken.lock b/examples/acceptance_tests/067/aiken.lock index 3450439df..37bf10bf9 100644 --- a/examples/acceptance_tests/067/aiken.lock +++ b/examples/acceptance_tests/067/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724596660, nanos_since_epoch = 748574000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724777001, nanos_since_epoch = 587403000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] diff --git a/examples/acceptance_tests/067/lib/tests.ak b/examples/acceptance_tests/067/lib/tests.ak index 5ed56bd3c..c4a66f5c3 100644 --- a/examples/acceptance_tests/067/lib/tests.ak +++ b/examples/acceptance_tests/067/lib/tests.ak @@ -322,7 +322,7 @@ test get_proof_4() { let h1: ByteArray = get_proof_item_value(p1) let h2: ByteArray = get_proof_item_value(p2) - size_match && ( h1 == hash_fn(cat) && h2 == right_node_hash ) + size_match && h1 == hash_fn(cat) && h2 == right_node_hash } fn do_from_list( diff --git a/examples/acceptance_tests/068/aiken.lock b/examples/acceptance_tests/068/aiken.lock index 27ea90234..3731aa410 100644 --- a/examples/acceptance_tests/068/aiken.lock +++ b/examples/acceptance_tests/068/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724596659, nanos_since_epoch = 760789000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724776997, nanos_since_epoch = 900786000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] diff --git a/examples/acceptance_tests/069/aiken.lock b/examples/acceptance_tests/069/aiken.lock index 2c1d46e21..d96303910 100644 --- a/examples/acceptance_tests/069/aiken.lock +++ b/examples/acceptance_tests/069/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724596660, nanos_since_epoch = 681097000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724777000, nanos_since_epoch = 47370000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] diff --git a/examples/acceptance_tests/070/aiken.lock b/examples/acceptance_tests/070/aiken.lock index 0d8de9c90..10526fde9 100644 --- a/examples/acceptance_tests/070/aiken.lock +++ b/examples/acceptance_tests/070/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724596647, nanos_since_epoch = 155791000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724776959, nanos_since_epoch = 949879000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] diff --git a/examples/acceptance_tests/071/aiken.lock b/examples/acceptance_tests/071/aiken.lock index 57177e6ba..2e59bd680 100644 --- a/examples/acceptance_tests/071/aiken.lock +++ b/examples/acceptance_tests/071/aiken.lock @@ -3,14 +3,14 @@ [[requirements]] name = "aiken-lang/stdlib" -version = "main" +version = "v2" source = "github" [[packages]] name = "aiken-lang/stdlib" -version = "main" +version = "v2" requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723158434, nanos_since_epoch = 487166000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] +"aiken-lang/stdlib@v2" = [{ secs_since_epoch = 1724776963, nanos_since_epoch = 265617000 }, "cdbbce58b61deb385e7ea787a2e0fc2dc8fe94db9999e0e6275bc9c70e5796be"] diff --git a/examples/acceptance_tests/071/plutus.json b/examples/acceptance_tests/071/plutus.json index 1405ea1c2..f2ad08e50 100644 --- a/examples/acceptance_tests/071/plutus.json +++ b/examples/acceptance_tests/071/plutus.json @@ -5,12 +5,12 @@ "plutusVersion": "v2", "compiler": { "name": "Aiken", - "version": "v1.0.31-alpha+6e4a16d" + "version": "v1.0.31-alpha+4003343" } }, "validators": [ { - "title": "spend.pool_contract", + "title": "spend.foo.spend", "datum": { "title": "datum", "schema": { @@ -23,8 +23,13 @@ "$ref": "#/definitions/spend~1PoolRedeemer" } }, - "compiledCode": "5904170100003232323232323232232325333004300230053754006264a6660100022c264a66666601a002264a6660140022c264a66666601e0022c2c2c26464a66601a0022c264a6666660240022c2c2c264a66601e6024006266601200e24a66601a6016601c6ea80044c94ccc044004584c94cccccc05800454ccc048c0540084c8c8c94ccc048c0400044c94ccc058004584c94cccccc06c0045858584c94ccc060c06c00c5401458dd68008b180c000980a1baa004153330123003001132533301600116132533333301b00115333017301a00215333014301230153754002264a6660300022c264a66666603a002264a6660340022c264a66666603e0022c2c2c264a666038603e006266602c0082a0122c2c6eb400458c070004c07000858585858c068004c058dd50008b0b0b0b0b0b180c000980a1baa004153330123370e9002000899299980b0008b099299999980d8008a99980b980d0010a99980a1809180a9baa001132533301800116132533333301d001132533301a00116132533333301f001161616132533301c301f0031333016004150091616375a0022c603800260380042c2c2c2c6034002602c6ea8004585858585858c060004c050dd50020b18091baa0031253330113232325333014301200114a226464646464a666032601400c26464a666036601860386ea80044c8c8c94ccc078c070c07cdd5000899192999810180f18109baa0011324a2604a60446ea800458cc01c03c00cc08cc080dd50008b198038068009804244101ff003020301d37540022940c00cc070dd5005180f180d9baa00713232533301b300c301c37540022646464a66603c6038603e6ea80044c8c94ccc080c078c084dd50008992513025302237540022c6600e01e006604660406ea800458cc01c034004c021220101ff003020301d37540022940c00cc070dd5005180f180d9baa00722330053758601260386ea8c024c070dd5001119baf300a301d37546008603a6ea80040088c074c07800488cc00cdd6180e980f180f180d1baa3007301a3754004466ebcc020c06cdd500080111191980080080191299980e0008a6103d87a800013232533301b300500213374a90001980f80125eb804cc010010004c080008c0780048cdd2a40006603266e95200233019375200297ae0330194c103d87a80004bd70180a1baa00130013014375400c4602e00229309b2b1b87480085858585858c04c004c03cdd50008b0b0b1bad00116300f001300f003375a0022c601800260180042c2c2c2c6014002600c6ea800c588894ccc018c010c01cdd5001899299980500080109929999998078008018018018018991929998068008028992999999809000803003003003099299980798090018a8040039bae001300f001300f003375c002601800260106ea800c004dc3a4000ae6955ceaab9e5573eae815d0aba25749", - "hash": "640debfa5063d2e3fd7f23e9777aaf3a0f575a99972ccda8748a49c0" + "compiledCode": "5903a2010000323232323232323225333002323232323253323300830013009375400426464646464a66601a6004601c6ea80204c94ccc044004584c94cccccc05800454ccc048c0540084c8c94ccc044c0180044c94ccc054004584c94cccccc0680045858584c94ccc05cc06800c5401458dd68008b180b80098099baa00315333011300a001132533301500116132533333301a00115333016301900215333013300830143754002264a66602e0022c264a666666038002264a6660320022c264a66666603c0022c2c2c264a666036603c00626660180082a0122c2c6eb400458c06c004c06c00858585858c064004c054dd50008b0b0b0b0b0b180b80098099baa003153330113370e9002000899299980a8008b099299999980d0008a99980b180c8010a9998099804180a1baa001132533301700116132533333301c001132533301900116132533333301e001161616132533301b301e003133300c004150091616375a0022c603600260360042c2c2c2c6032002602a6ea8004585858585858c05c004c04cdd50018b18089baa0021533300f30043010375400a264646464a666026601000229444c8c8c8c94ccc05cc0400144c8c8c94ccc068c03cc06cdd500089919299980e1808980e9baa0011324a26042603c6ea800458cc01406000cc07cc070dd50008b1980200b0009802a44101ff00301c3019375400c2646464a666034601e60366ea80044c8c94ccc070c044c074dd50008992513021301e37540022c6600a030006603e60386ea800458cc010058004c015220101ff00301c3019375400c44660086eb0c020c068dd5001119baf3009301b3754603c603e60366ea800400888cc00cdd6180e180e980e980c9baa00223375e601060346ea800400888c8cc00400400c894ccc06c004530103d87a800013232533301a300500213374a90001980f00125eb804cc010010004c07c008c0740048cdd2a40006603066e95200233018375200297ae0330184c103d87a80004bd7018099baa0013001301337540184602c002602860226ea8014585858585858c04c004c03cdd50040b1112999807980218081baa00313253330130010021325333333018001003003003003132325333016001005132533333301b0010060060060061325333018301b00315008007375c002603000260300066eb8004c054004c044dd50018009b8748000c03cc040008c038004c028dd50011b874800858c02cc030008c028004c028008c020004c010dd50008a4c26cacae6955ceaab9e5573eae815d0aba257481", + "hash": "10e8faa163e7c7699b978c2df5f2b1fadc9796e866d67b88799def6e" + }, + { + "title": "spend.foo.else", + "compiledCode": "5903a2010000323232323232323225333002323232323253323300830013009375400426464646464a66601a6004601c6ea80204c94ccc044004584c94cccccc05800454ccc048c0540084c8c94ccc044c0180044c94ccc054004584c94cccccc0680045858584c94ccc05cc06800c5401458dd68008b180b80098099baa00315333011300a001132533301500116132533333301a00115333016301900215333013300830143754002264a66602e0022c264a666666038002264a6660320022c264a66666603c0022c2c2c264a666036603c00626660180082a0122c2c6eb400458c06c004c06c00858585858c064004c054dd50008b0b0b0b0b0b180b80098099baa003153330113370e9002000899299980a8008b099299999980d0008a99980b180c8010a9998099804180a1baa001132533301700116132533333301c001132533301900116132533333301e001161616132533301b301e003133300c004150091616375a0022c603600260360042c2c2c2c6032002602a6ea8004585858585858c05c004c04cdd50018b18089baa0021533300f30043010375400a264646464a666026601000229444c8c8c8c94ccc05cc0400144c8c8c94ccc068c03cc06cdd500089919299980e1808980e9baa0011324a26042603c6ea800458cc01406000cc07cc070dd50008b1980200b0009802a44101ff00301c3019375400c2646464a666034601e60366ea80044c8c94ccc070c044c074dd50008992513021301e37540022c6600a030006603e60386ea800458cc010058004c015220101ff00301c3019375400c44660086eb0c020c068dd5001119baf3009301b3754603c603e60366ea800400888cc00cdd6180e180e980e980c9baa00223375e601060346ea800400888c8cc00400400c894ccc06c004530103d87a800013232533301a300500213374a90001980f00125eb804cc010010004c07c008c0740048cdd2a40006603066e95200233018375200297ae0330184c103d87a80004bd7018099baa0013001301337540184602c002602860226ea8014585858585858c04c004c03cdd50040b1112999807980218081baa00313253330130010021325333333018001003003003003132325333016001005132533333301b0010060060060061325333018301b00315008007375c002603000260300066eb8004c054004c044dd50018009b8748000c03cc040008c038004c028dd50011b874800858c02cc030008c028004c028008c020004c010dd50008a4c26cacae6955ceaab9e5573eae815d0aba257481", + "hash": "10e8faa163e7c7699b978c2df5f2b1fadc9796e866d67b88799def6e" } ], "definitions": { diff --git a/examples/acceptance_tests/071/validators/spend.ak b/examples/acceptance_tests/071/validators/spend.ak index aa9ce35c4..2d80e0831 100644 --- a/examples/acceptance_tests/071/validators/spend.ak +++ b/examples/acceptance_tests/071/validators/spend.ak @@ -1,16 +1,14 @@ +use aiken/collection/list +use aiken/hash.{Blake2b_224, Hash} use aiken/interval.{Finite} -use aiken/list use aiken/option use cardano/assets.{ AssetName, PolicyId, Value, add, flatten, from_asset, negate, quantity_of, } -use cardano/credential.{ - Address, Script, ScriptCredential, VerificationKey, VerificationKeyCredential, -} -use cardano/hash.{Blake2b_224, Hash} +use cardano/credential.{Address, Script, VerificationKey} use cardano/transaction.{ - Datum, InlineDatum, Input, Output, OutputReference, Transaction, - TransactionId, ValidityRange, + Datum, InlineDatum, Input, Output, OutputReference, Transaction, TransactionId, + ValidityRange, } // Datum/Redeemer pool @@ -20,7 +18,7 @@ pub type PoolDatum { lent_out: Int, } -type PoolRedeemer { +pub type PoolRedeemer { action: PoolRedeemerType, } @@ -50,17 +48,11 @@ pub fn get_output(transaction: Transaction, address: Address) -> Option } pub fn get_input(transaction: Transaction, address: Address) -> Option { - list.find( - transaction.inputs, - fn(input) { input.output.address == address }, - ) + list.find(transaction.inputs, fn(input) { input.output.address == address }) } pub fn scripthash_address(scripthash: ByteArray) { - Address { - payment_credential: ScriptCredential(scripthash), - stake_credential: None, - } + Address { payment_credential: Script(scripthash), stake_credential: None } } pub fn validate_pool_deposit( @@ -91,13 +83,33 @@ pub fn validate_pool_borrow( } validator foo { - spend(datum: PoolDatum, redeemer: PoolRedeemer, output_ref: OutputReference, transaction: Transaction) { + spend( + datum: Option, + redeemer: PoolRedeemer, + output_ref: OutputReference, + transaction: Transaction, + ) { + expect Some(datum) = datum when redeemer.action is { PoolWithdraw(_) -> True PoolDeposit(pool_deposit_redeemer) -> - validate_pool_deposit(transaction, output_ref, datum, pool_deposit_redeemer) + validate_pool_deposit( + transaction, + output_ref, + datum, + pool_deposit_redeemer, + ) PoolBorrow(pool_borrow_redeemer) -> - validate_pool_borrow(transaction, output_ref, datum, pool_borrow_redeemer) + validate_pool_borrow( + transaction, + output_ref, + datum, + pool_borrow_redeemer, + ) } } + + else(_) { + fail + } } diff --git a/examples/acceptance_tests/072/aiken.lock b/examples/acceptance_tests/072/aiken.lock index 066bafb74..b056341f8 100644 --- a/examples/acceptance_tests/072/aiken.lock +++ b/examples/acceptance_tests/072/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724596656, nanos_since_epoch = 683898000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724776989, nanos_since_epoch = 656788000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] diff --git a/examples/acceptance_tests/073/aiken.lock b/examples/acceptance_tests/073/aiken.lock index 56b8c59eb..ab783864b 100644 --- a/examples/acceptance_tests/073/aiken.lock +++ b/examples/acceptance_tests/073/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724596654, nanos_since_epoch = 513356000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724776984, nanos_since_epoch = 618944000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] diff --git a/examples/acceptance_tests/074/aiken.lock b/examples/acceptance_tests/074/aiken.lock index 1f850b5d4..be4a25790 100644 --- a/examples/acceptance_tests/074/aiken.lock +++ b/examples/acceptance_tests/074/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724596654, nanos_since_epoch = 519690000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724776985, nanos_since_epoch = 375340000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] diff --git a/examples/acceptance_tests/077/aiken.lock b/examples/acceptance_tests/077/aiken.lock index 0687e2d98..b2de77b0f 100644 --- a/examples/acceptance_tests/077/aiken.lock +++ b/examples/acceptance_tests/077/aiken.lock @@ -3,14 +3,14 @@ [[requirements]] name = "aiken-lang/stdlib" -version = "main" +version = "v2" source = "github" [[packages]] name = "aiken-lang/stdlib" -version = "main" +version = "v2" requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723158435, nanos_since_epoch = 59914000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] +"aiken-lang/stdlib@v2" = [{ secs_since_epoch = 1724776958, nanos_since_epoch = 450634000 }, "cdbbce58b61deb385e7ea787a2e0fc2dc8fe94db9999e0e6275bc9c70e5796be"] diff --git a/examples/acceptance_tests/077/plutus.json b/examples/acceptance_tests/077/plutus.json index 9e1b743c6..e3aeb65fc 100644 --- a/examples/acceptance_tests/077/plutus.json +++ b/examples/acceptance_tests/077/plutus.json @@ -5,12 +5,12 @@ "plutusVersion": "v2", "compiler": { "name": "Aiken", - "version": "v1.0.31-alpha+6e4a16d" + "version": "v1.0.31-alpha+4003343" } }, "validators": [ { - "title": "spend.gift_card", + "title": "spend.foo.mint", "redeemer": { "title": "rdmr", "schema": { @@ -27,15 +27,34 @@ { "title": "utxo_ref", "schema": { - "$ref": "#/definitions/aiken~1transaction~1OutputReference" + "$ref": "#/definitions/cardano~1transaction~1OutputReference" } } ], - "compiledCode": "5901ce010000323232323232322322232323232533300930040011533300c300b375400a2a0042c2a66601260060022a66601860166ea8014540085858c024dd50020929998041919192999805980318061baa00113232323253330123015002132325333011300c3012375401a2a666022646600200200c44a66602c00229404c94ccc050cdd7980c980b1baa301900201114a226600600600260320022a6660226016002266e3c00803c5280b0b1bad3012002375c60200022c602600264a66601c6010601e6ea800452f5bded8c026eacc04cc040dd500099191980080099198008009bab3015301630163016301600522533301400114bd6f7b630099191919299980a99b9148900002153330153371e91010000210031005133019337606ea4008dd3000998030030019bab3016003375c60280046030004602c00244a666026002298103d87a800013232323253330143372200e0042a66602866e3c01c0084cdd2a4000660306e980052f5c02980103d87a80001330060060033756602a0066eb8c04c008c05c008c054004dd7180918079baa00337586022002601a6ea800858c03cc040008c038004c028dd50008a4c26cac6e1d2002370e90001bae0015734aae7555cf2ab9f5740ae855d11", - "hash": "4ef9bf69c108d6abd0a5af057a519df56d7fb333de428563810495a0" + "compiledCode": "59018501000032323232323232232225333005323232323253323300b3001300c3754004264646464a66601e600a0022a66602460226ea801c540085854ccc03cc00c00454ccc048c044dd50038a8010b0b18079baa006132323232533301430170021323253330133009301437540162a666026646600200200c44a66603000229404c94ccc058cdd7980d980c1baa301b00201314a226600600600260360022a666026600e002266e3c0080445280b0b1bad3014002375c60240022c602a00264a666020600860226ea800452f5bded8c026eacc054c048dd500099198008009bab3015301630163016301600322533301400114c103d87a80001323232325333015337220140042a66602a66e3c0280084cdd2a4000660326e980052f5c02980103d87a80001330060060033756602c0066eb8c050008c060008c058004dd6180980098079baa007370e90011bae3010300d37540046e1d200016300e300f002300d001300d002300b0013007375400229309b2b1bae0015734aae7555cf2ab9f5740ae855d11", + "hash": "784b2caa5e99b3d37361e3c3d51e7fd39f616025037eee525b73c5da" }, { - "title": "spend2.backtrace", + "title": "spend.foo.else", + "parameters": [ + { + "title": "token_name", + "schema": { + "$ref": "#/definitions/ByteArray" + } + }, + { + "title": "utxo_ref", + "schema": { + "$ref": "#/definitions/cardano~1transaction~1OutputReference" + } + } + ], + "compiledCode": "59018501000032323232323232232225333005323232323253323300b3001300c3754004264646464a66601e600a0022a66602460226ea801c540085854ccc03cc00c00454ccc048c044dd50038a8010b0b18079baa006132323232533301430170021323253330133009301437540162a666026646600200200c44a66603000229404c94ccc058cdd7980d980c1baa301b00201314a226600600600260360022a666026600e002266e3c0080445280b0b1bad3014002375c60240022c602a00264a666020600860226ea800452f5bded8c026eacc054c048dd500099198008009bab3015301630163016301600322533301400114c103d87a80001323232325333015337220140042a66602a66e3c0280084cdd2a4000660326e980052f5c02980103d87a80001330060060033756602c0066eb8c050008c060008c058004dd6180980098079baa007370e90011bae3010300d37540046e1d200016300e300f002300d001300d002300b0013007375400229309b2b1bae0015734aae7555cf2ab9f5740ae855d11", + "hash": "784b2caa5e99b3d37361e3c3d51e7fd39f616025037eee525b73c5da" + }, + { + "title": "spend2.foo.spend", "datum": { "title": "_datum", "schema": { @@ -48,8 +67,13 @@ "$ref": "#/definitions/Void" } }, - "compiledCode": "58ac010000323232323232322323223225333007533300730053008375464660020026eb0c034c038c038c028dd5180698051baa00222533300c00114c0103d87a800013232533300b4a2266e9520003300f0024bd70099802002000980800118070008a511614984d9594ccc014c00cc018dd50008a99980418039baa001149858594ccc00cc004c010dd50010a99980318029baa00214985858dc3a4000ae6955ceaab9e5573eae815d0aba201", - "hash": "c58d31e63ad2d807c2188dfb1deafc433fe0f6a867e5cf8df68f068f" + "compiledCode": "58c70100003232323232323225333002323232323253330073370e900118041baa001132323232533300b3370e900018061baa32330010013758602260246024601c6ea8024894ccc0400045300103d87a800013232533300f4a2266e952000330130024bd70099802002000980a00118090008a5116533300a3370e900018059baa0051533300d300c375400a2930b0b18071807801180680098049baa00116300b300c002300a001300a00230080013004375400229309b2b2b9a5573aaae7955cfaba05742ae881", + "hash": "c4700bfdb383c890d2a4c4505d3fc6d4b51e1998c3f33dd83e12ba44" + }, + { + "title": "spend2.foo.else", + "compiledCode": "58c70100003232323232323225333002323232323253330073370e900118041baa001132323232533300b3370e900018061baa32330010013758602260246024601c6ea8024894ccc0400045300103d87a800013232533300f4a2266e952000330130024bd70099802002000980a00118090008a5116533300a3370e900018059baa0051533300d300c375400a2930b0b18071807801180680098049baa00116300b300c002300a001300a00230080013004375400229309b2b2b9a5573aaae7955cfaba05742ae881", + "hash": "c4700bfdb383c890d2a4c4505d3fc6d4b51e1998c3f33dd83e12ba44" } ], "definitions": { @@ -70,7 +94,7 @@ } ] }, - "aiken/transaction/OutputReference": { + "cardano/transaction/OutputReference": { "title": "OutputReference", "description": "An `OutputReference` is a unique reference to an output on-chain. The `output_index`\n corresponds to the position in the output list of the transaction (identified by its id)\n that produced that output", "anyOf": [ @@ -81,7 +105,7 @@ "fields": [ { "title": "transaction_id", - "$ref": "#/definitions/aiken~1transaction~1TransactionId" + "$ref": "#/definitions/ByteArray" }, { "title": "output_index", @@ -91,23 +115,6 @@ } ] }, - "aiken/transaction/TransactionId": { - "title": "TransactionId", - "description": "A unique transaction identifier, as the hash of a transaction body. Note that the transaction id\n isn't a direct hash of the `Transaction` as visible on-chain. Rather, they correspond to hash\n digests of transaction body as they are serialized on the network.", - "anyOf": [ - { - "title": "TransactionId", - "dataType": "constructor", - "index": 0, - "fields": [ - { - "title": "hash", - "$ref": "#/definitions/ByteArray" - } - ] - } - ] - }, "spend/Action": { "title": "Action", "anyOf": [ diff --git a/examples/acceptance_tests/077/validators/spend.ak b/examples/acceptance_tests/077/validators/spend.ak index b87bd8cab..c61924e1a 100644 --- a/examples/acceptance_tests/077/validators/spend.ak +++ b/examples/acceptance_tests/077/validators/spend.ak @@ -1,15 +1,15 @@ use aiken/collection/dict use aiken/collection/list.{find, foldr} +use cardano/assets.{PolicyId, add, zero} use cardano/transaction.{Input, OutputReference, Transaction} as tx -use cardano/transaction/assets.{add, zero} -type Action { +pub type Action { Mint Burn } 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) { let Transaction { inputs, mint, .. } = transaction expect [Pair(asset_name, amount)] = mint @@ -24,4 +24,8 @@ validator foo(token_name: ByteArray, utxo_ref: OutputReference) { Burn -> todo @"burn" } } + + else(_) { + fail + } } diff --git a/examples/acceptance_tests/077/validators/spend2.ak b/examples/acceptance_tests/077/validators/spend2.ak index 9dd85fe89..0e9028d35 100644 --- a/examples/acceptance_tests/077/validators/spend2.ak +++ b/examples/acceptance_tests/077/validators/spend2.ak @@ -3,15 +3,19 @@ use cardano/transaction.{Output, Transaction} validator foo { spend( - _datum: Void, + _datum: Option, _redeemer: Void, _ref: Data, transaction: Transaction, - ) -> Bool { + ) { expect Some(_) = list.find(transaction.outputs, fn(_) { True }) let _ = find_stuff(transaction) True } + + else(_) { + fail + } } fn find_stuff(transaction: Transaction) -> Output { diff --git a/examples/acceptance_tests/079/plutus.json b/examples/acceptance_tests/079/plutus.json index ffb53e6f1..15d13ffe6 100644 --- a/examples/acceptance_tests/079/plutus.json +++ b/examples/acceptance_tests/079/plutus.json @@ -5,12 +5,12 @@ "plutusVersion": "v2", "compiler": { "name": "Aiken", - "version": "v1.0.31-alpha+6e4a16d" + "version": "v1.0.31-alpha+4003343" } }, "validators": [ { - "title": "foo.spend", + "title": "foo.foo.spend", "datum": { "title": "datum", "schema": { @@ -20,42 +20,32 @@ "redeemer": { "title": "redeemer", "schema": { - "$ref": "#/definitions/RedeemerWrapper$Int" + "$ref": "#/definitions/Int" } }, - "compiledCode": "5850010000323232322253330033370e900018021baa001153330033370e6eb4009205414984d9584c8c894ccc018cdc399b800030024815052613656375a600e600c6ea8008dd68012b9a5573aaae795d09", - "hash": "dcac7ebcaf29721b4b48cc73775fa91939ad9015ea267b697e92b051" + "compiledCode": "589a01000032323232322533300232323232323253330083370e9001000899191919299980619b8748000c034dd5001099b87337006eb4c03cc038dd5001000a40a82c6eb4018c034c038008c030004c028dd50010a99980419b87480000044c8cdc39bad00448150dd7180598051baa00216300837540026012601400460100026010004600c00260086ea8004526136565734aae7555cf2ba15745", + "hash": "86f0253dd8dd836d6588f5794eb8f08edd4476df28b607553126846e" }, { - "title": "foo.mint", + "title": "foo.foo.mint", "redeemer": { "title": "redeemer", "schema": { "$ref": "#/definitions/Int" } }, - "compiledCode": "5850010000323232322253330033370e900018021baa001153330033370e6eb4009205414984d9584c8c894ccc018cdc399b800030024815052613656375a600e600c6ea8008dd68012b9a5573aaae795d09", - "hash": "dcac7ebcaf29721b4b48cc73775fa91939ad9015ea267b697e92b051" + "compiledCode": "589a01000032323232322533300232323232323253330083370e9001000899191919299980619b8748000c034dd5001099b87337006eb4c03cc038dd5001000a40a82c6eb4018c034c038008c030004c028dd50010a99980419b87480000044c8cdc39bad00448150dd7180598051baa00216300837540026012601400460100026010004600c00260086ea8004526136565734aae7555cf2ba15745", + "hash": "86f0253dd8dd836d6588f5794eb8f08edd4476df28b607553126846e" + }, + { + "title": "foo.foo.else", + "compiledCode": "589a01000032323232322533300232323232323253330083370e9001000899191919299980619b8748000c034dd5001099b87337006eb4c03cc038dd5001000a40a82c6eb4018c034c038008c030004c028dd50010a99980419b87480000044c8cdc39bad00448150dd7180598051baa00216300837540026012601400460100026010004600c00260086ea8004526136565734aae7555cf2ba15745", + "hash": "86f0253dd8dd836d6588f5794eb8f08edd4476df28b607553126846e" } ], "definitions": { "Int": { "dataType": "integer" - }, - "RedeemerWrapper$Int": { - "title": "Wrapped Redeemer", - "description": "A redeemer wrapped in an extra constructor to make multi-validator detection possible on-chain.", - "anyOf": [ - { - "dataType": "constructor", - "index": 1, - "fields": [ - { - "$ref": "#/definitions/Int" - } - ] - } - ] } } } \ No newline at end of file diff --git a/examples/acceptance_tests/079/validators/foo.ak b/examples/acceptance_tests/079/validators/foo.ak index 68a3b320b..9dcb19f00 100644 --- a/examples/acceptance_tests/079/validators/foo.ak +++ b/examples/acceptance_tests/079/validators/foo.ak @@ -1,9 +1,14 @@ validator foo { - spend(datum: Int, redeemer: Int, _ref: Data, _transaction: Data) { + spend(datum: Option, redeemer: Int, _ref: Data, _transaction: Data) { + expect Some(datum) = datum datum + redeemer == 42 } mint(redeemer: Int, _policy: ByteArray, _transaction: Data) { redeemer == 42 } + + else(_) { + fail + } } diff --git a/examples/acceptance_tests/082/aiken.lock b/examples/acceptance_tests/082/aiken.lock index 375c9257a..ccd0fa07a 100644 --- a/examples/acceptance_tests/082/aiken.lock +++ b/examples/acceptance_tests/082/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724596649, nanos_since_epoch = 139799000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724776965, nanos_since_epoch = 937696000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] diff --git a/examples/acceptance_tests/083/aiken.lock b/examples/acceptance_tests/083/aiken.lock index 133e4e651..0301487ce 100644 --- a/examples/acceptance_tests/083/aiken.lock +++ b/examples/acceptance_tests/083/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724596646, nanos_since_epoch = 924702000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724776958, nanos_since_epoch = 302886000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] diff --git a/examples/acceptance_tests/084/aiken.lock b/examples/acceptance_tests/084/aiken.lock index 455c4b77b..434074d32 100644 --- a/examples/acceptance_tests/084/aiken.lock +++ b/examples/acceptance_tests/084/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724596647, nanos_since_epoch = 226716000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724776958, nanos_since_epoch = 249560000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] diff --git a/examples/acceptance_tests/086/aiken.lock b/examples/acceptance_tests/086/aiken.lock index fb9b4ac97..104644752 100644 --- a/examples/acceptance_tests/086/aiken.lock +++ b/examples/acceptance_tests/086/aiken.lock @@ -3,14 +3,14 @@ [[requirements]] name = "aiken-lang/stdlib" -version = "main" +version = "v2" source = "github" [[packages]] name = "aiken-lang/stdlib" -version = "main" +version = "v2" requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723158437, nanos_since_epoch = 77334000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] +"aiken-lang/stdlib@v2" = [{ secs_since_epoch = 1724776991, nanos_since_epoch = 269398000 }, "cdbbce58b61deb385e7ea787a2e0fc2dc8fe94db9999e0e6275bc9c70e5796be"] diff --git a/examples/acceptance_tests/086/aiken.toml b/examples/acceptance_tests/086/aiken.toml index 914a1b5a0..8da7a4ab4 100644 --- a/examples/acceptance_tests/086/aiken.toml +++ b/examples/acceptance_tests/086/aiken.toml @@ -4,5 +4,5 @@ description = "" [[dependencies]] name = 'aiken-lang/stdlib' -version = 'main' +version = 'v2' source = 'github' diff --git a/examples/acceptance_tests/086/plutus.json b/examples/acceptance_tests/086/plutus.json index a5177998b..d25464297 100644 --- a/examples/acceptance_tests/086/plutus.json +++ b/examples/acceptance_tests/086/plutus.json @@ -5,12 +5,12 @@ "plutusVersion": "v2", "compiler": { "name": "Aiken", - "version": "v1.0.31-alpha+6e4a16d" + "version": "v1.0.31-alpha+4003343" } }, "validators": [ { - "title": "other.validate", + "title": "other.validate.spend", "datum": { "title": "raw_datum", "schema": { @@ -23,8 +23,13 @@ "$ref": "#/definitions/Data" } }, - "compiledCode": "5902b1010000323232323232322225333004323232533300730033008375400c264a6660160022c264a66666601e0022a666018601c00426464a666016600e002264a66601e0022c264a6666660260022a66602060240042a66601a6012601c6ea80044c94ccc044004584c94cccccc05400454ccc048c05000854ccc03cc02cc040dd500089929998098008b099299999980b800899299980a8008b099299999980c8008a99980b180c001099980680189919299980a9808800899299980c8008b099299999980e8008a99980d180e00109919299980c980a800899299980e8008b09929999998108008a99980f1810001099980a8008a8020b0b0b0b0b0b180f000980d9baa003153330193014001132533301d001161325333333021001161616132325333020001161325333333024001161616132325333023001161325333333027001161616132533302530270031500b16375a0022c604800260480066eb400458c084004c08400cdd68008b180f000980d9baa00316301937540042a0082c2c2c2c2c6034002602e6ea800c54ccc054c04000454ccc060c05cdd50018a8010b0b180a9baa0021500a16161616161630160013016002161616163014001301137540022c2c2c2c2c2c6024002601e6ea8004585858585858c040004c034dd50018a99980598030008a99980718069baa003150021616300b37540042a666012600a60146ea8c034c02cdd50040a5114a02c2c2c2c2c601800260126ea801858888c94ccc028c0180044c94ccc03800400c4c94cccccc0480040100100100104c94ccc040c04800c54018014dd7000980780098061baa0041533300a3005001132533300e00100313253333330120010040040040041325333010301200315006005375c002601e00260186ea8010008c028dd50019b8748008dc3a400029309b2b2b9a5573aaae7955cfaba15744ae91", - "hash": "22fcdd5defc5c63e55afed5ee2e88c9c695809f8b1e99342e045438d" + "compiledCode": "5902fd010000323232323232322533300232323232325332330083001300937540042646464a664660186002601a6ea80084c8c94ccc038c00cc03cdd500109929998090008b099299999980b0008a999809980a8010991929998091803800899299980b0008b099299999980d0008a99980b980c8010a99980a1804980a9baa001132533301800116132533333301c00115333019301b00215333016300b30173754002264a6660340022c264a66666603c002264a6660380022c264a6666660400022a66603a603e004266601a00626464a6660386022002264a6660400022c264a6666660480022a666042604600426464a666040602a002264a6660480022c264a6666660500022a66604a604e004266602a0022a0082c2c2c2c2c2c604a00260446ea800c54ccc080c0640044c94ccc090004584c94cccccc0a00045858584c8c94ccc09c004584c94cccccc0ac0045858584c8c94ccc0a8004584c94cccccc0b80045858584c94ccc0b0c0b800c5402c58dd68008b181580098158019bad0011630280013028003375a0022c604a00260446ea800c58c080dd50010a8020b0b0b0b0b1810800980f1baa0031533301c30150011533301f301e37540062a0042c2c60386ea800854028585858585858c074004c07400858585858c06c004c060dd50008b0b0b0b0b0b180c800980b1baa0011616161616163017001301437540062a66602460160022a66602a60286ea800c540085858c048dd50010a999808180298089baa30143012375400829445280b0b0b0b0b180980098081baa002162223253330113006001132533301500100313253333330190010040040040041325333017301900315006005375c002602c00260266ea801054ccc044c0280044c94ccc05400400c4c94cccccc0640040100100100104c94ccc05cc06400c54018014dd7000980b00098099baa004002301137540066020601c6ea8008dc3a40002c601c601e004601a00260146ea8008dc3a40042c6014601600460120026012004600e00260086ea8004526136565734aae7555cf2ab9f5742ae895d21", + "hash": "a63866b5537d618101fccdf892f6bb58f0f1092bc483bfedca3a813e" + }, + { + "title": "other.validate.else", + "compiledCode": "5902fd010000323232323232322533300232323232325332330083001300937540042646464a664660186002601a6ea80084c8c94ccc038c00cc03cdd500109929998090008b099299999980b0008a999809980a8010991929998091803800899299980b0008b099299999980d0008a99980b980c8010a99980a1804980a9baa001132533301800116132533333301c00115333019301b00215333016300b30173754002264a6660340022c264a66666603c002264a6660380022c264a6666660400022a66603a603e004266601a00626464a6660386022002264a6660400022c264a6666660480022a666042604600426464a666040602a002264a6660480022c264a6666660500022a66604a604e004266602a0022a0082c2c2c2c2c2c604a00260446ea800c54ccc080c0640044c94ccc090004584c94cccccc0a00045858584c8c94ccc09c004584c94cccccc0ac0045858584c8c94ccc0a8004584c94cccccc0b80045858584c94ccc0b0c0b800c5402c58dd68008b181580098158019bad0011630280013028003375a0022c604a00260446ea800c58c080dd50010a8020b0b0b0b0b1810800980f1baa0031533301c30150011533301f301e37540062a0042c2c60386ea800854028585858585858c074004c07400858585858c06c004c060dd50008b0b0b0b0b0b180c800980b1baa0011616161616163017001301437540062a66602460160022a66602a60286ea800c540085858c048dd50010a999808180298089baa30143012375400829445280b0b0b0b0b180980098081baa002162223253330113006001132533301500100313253333330190010040040040041325333017301900315006005375c002602c00260266ea801054ccc044c0280044c94ccc05400400c4c94cccccc0640040100100100104c94ccc05cc06400c54018014dd7000980b00098099baa004002301137540066020601c6ea8008dc3a40002c601c601e004601a00260146ea8008dc3a40042c6014601600460120026012004600e00260086ea8004526136565734aae7555cf2ab9f5742ae895d21", + "hash": "a63866b5537d618101fccdf892f6bb58f0f1092bc483bfedca3a813e" } ], "definitions": { diff --git a/examples/acceptance_tests/086/validators/other.ak b/examples/acceptance_tests/086/validators/other.ak index 2de19c650..c548df3f6 100644 --- a/examples/acceptance_tests/086/validators/other.ak +++ b/examples/acceptance_tests/086/validators/other.ak @@ -1,5 +1,5 @@ -use aiken/transaction.{Transaction} -use aiken/transaction/credential.{Address} +use cardano/credential.{Address} +use cardano/transaction.{Transaction} type TestData { addr: Address, @@ -10,12 +10,17 @@ type TestDatum { } validator validate { - spend(raw_datum: Option, _redeemer: Data, oref: Data, _tx: Transaction) -> Bool { - expect datum: TestDatum = raw_datum + spend(raw_datum: Option, _redeemer: Data, oref: Data, _tx: Transaction) { + expect Some(datum): Option = raw_datum + expect datum: TestDatum = datum let TestDatum { data } = datum when data is { Some(_) -> True None -> False } } + + else(_) { + fail + } } diff --git a/examples/acceptance_tests/087/aiken.lock b/examples/acceptance_tests/087/aiken.lock index 6efd55bd9..d8ea57320 100644 --- a/examples/acceptance_tests/087/aiken.lock +++ b/examples/acceptance_tests/087/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724596654, nanos_since_epoch = 519706000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724776982, nanos_since_epoch = 107153000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] diff --git a/examples/acceptance_tests/088/aiken.lock b/examples/acceptance_tests/088/aiken.lock index 87cf662cf..5e6cbb9b6 100644 --- a/examples/acceptance_tests/088/aiken.lock +++ b/examples/acceptance_tests/088/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724596656, nanos_since_epoch = 683917000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724776991, nanos_since_epoch = 282756000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] diff --git a/examples/acceptance_tests/089/aiken.lock b/examples/acceptance_tests/089/aiken.lock index f58439fc0..0483893d6 100644 --- a/examples/acceptance_tests/089/aiken.lock +++ b/examples/acceptance_tests/089/aiken.lock @@ -3,14 +3,14 @@ [[requirements]] name = "aiken-lang/stdlib" -version = "main" +version = "v2" source = "github" [[packages]] name = "aiken-lang/stdlib" -version = "main" +version = "v2" requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723158435, nanos_since_epoch = 937845000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] +"aiken-lang/stdlib@v2" = [{ secs_since_epoch = 1724776982, nanos_since_epoch = 146951000 }, "cdbbce58b61deb385e7ea787a2e0fc2dc8fe94db9999e0e6275bc9c70e5796be"] diff --git a/examples/acceptance_tests/089/aiken.toml b/examples/acceptance_tests/089/aiken.toml index ff0ea9093..137b61bae 100644 --- a/examples/acceptance_tests/089/aiken.toml +++ b/examples/acceptance_tests/089/aiken.toml @@ -4,5 +4,5 @@ description = "" [[dependencies]] name = 'aiken-lang/stdlib' -version = 'main' +version = 'v2' source = 'github' diff --git a/examples/acceptance_tests/089/lib/tests.ak b/examples/acceptance_tests/089/lib/tests.ak index 24e8c5a0e..ab39bad40 100644 --- a/examples/acceptance_tests/089/lib/tests.ak +++ b/examples/acceptance_tests/089/lib/tests.ak @@ -1,7 +1,6 @@ -use aiken/cbor -use aiken/transaction.{Datum, InlineDatum, NoDatum, Output} -use aiken/transaction/credential.{Address, VerificationKeyCredential} -use aiken/transaction/value.{from_lovelace} +use cardano/assets.{from_lovelace} +use cardano/credential.{Address, VerificationKey} +use cardano/transaction.{Datum, InlineDatum, NoDatum, Output} type SmallOracleState { Thing(Int) @@ -18,7 +17,7 @@ fn create_output( let x = Output { address: Address { - payment_credential: VerificationKeyCredential(payment_key), + payment_credential: VerificationKey(payment_key), stake_credential: None, }, value: from_lovelace(value), diff --git a/examples/acceptance_tests/089/plutus.json b/examples/acceptance_tests/089/plutus.json index ddbfddbbe..a28035048 100644 --- a/examples/acceptance_tests/089/plutus.json +++ b/examples/acceptance_tests/089/plutus.json @@ -5,12 +5,12 @@ "plutusVersion": "v2", "compiler": { "name": "Aiken", - "version": "v1.0.31-alpha+6e4a16d" + "version": "v1.0.31-alpha+4003343" } }, "validators": [ { - "title": "test2.simple_oneshot", + "title": "test2.simple_oneshot.mint", "redeemer": { "title": "_r", "schema": { @@ -21,12 +21,25 @@ { "title": "utxo_ref", "schema": { - "$ref": "#/definitions/aiken~1transaction~1OutputReference" + "$ref": "#/definitions/cardano~1transaction~1OutputReference" } } ], - "compiledCode": "58d8010000323232323232322232322533300632325333008300530093754601a601c00426464a666014600e60166ea8cc00400c8cdd7980198069baa00100a1533300a3007300b375466002006466ebcc00cc034dd50008050a5114a02c44646600200200644a6660200022980103d87a800013232533300f300500213374a90001980980125eb804cc010010004c050008c0480048c03800458dd6180618049baa300c0013008375400229309b2b2999802180098029baa00215333007300637540042930b0b1b87480015cd2ab9d5573caae7d5d02ba15745", - "hash": "0934dd37409ea743705a7340769acd8c84843fec54013e9f0ced9251" + "compiledCode": "58f00100003232323232323222533300332323232325332330093001300a375400426464646464a66601c600c601e6ea8cc00400c8cdd7980198089baa00100e1533300e3006300f375466002006466ebcc00cc044dd50008070a5114a02c44646600200200644a666028002298103d87a8000132325333013300500213374a90001980b80125eb804cc010010004c060008c0580048c048004dd6180818069baa007533300a3002300b37540082a66601a60186ea80105261616375c601c60166ea8008dc3a40002c6018601a004601600260160046012002600a6ea8004526136565734aae7555cf2ab9f5740ae855d101", + "hash": "6f67a4f89e77e01da00ed12f89b15baa823791e83757d5ac97843e91" + }, + { + "title": "test2.simple_oneshot.else", + "parameters": [ + { + "title": "utxo_ref", + "schema": { + "$ref": "#/definitions/cardano~1transaction~1OutputReference" + } + } + ], + "compiledCode": "58f00100003232323232323222533300332323232325332330093001300a375400426464646464a66601c600c601e6ea8cc00400c8cdd7980198089baa00100e1533300e3006300f375466002006466ebcc00cc044dd50008070a5114a02c44646600200200644a666028002298103d87a8000132325333013300500213374a90001980b80125eb804cc010010004c060008c0580048c048004dd6180818069baa007533300a3002300b37540082a66601a60186ea80105261616375c601c60166ea8008dc3a40002c6018601a004601600260160046012002600a6ea8004526136565734aae7555cf2ab9f5740ae855d101", + "hash": "6f67a4f89e77e01da00ed12f89b15baa823791e83757d5ac97843e91" } ], "definitions": { @@ -47,7 +60,7 @@ } ] }, - "aiken/transaction/OutputReference": { + "cardano/transaction/OutputReference": { "title": "OutputReference", "description": "An `OutputReference` is a unique reference to an output on-chain. The `output_index`\n corresponds to the position in the output list of the transaction (identified by its id)\n that produced that output", "anyOf": [ @@ -58,7 +71,7 @@ "fields": [ { "title": "transaction_id", - "$ref": "#/definitions/aiken~1transaction~1TransactionId" + "$ref": "#/definitions/ByteArray" }, { "title": "output_index", @@ -67,23 +80,6 @@ ] } ] - }, - "aiken/transaction/TransactionId": { - "title": "TransactionId", - "description": "A unique transaction identifier, as the hash of a transaction body. Note that the transaction id\n isn't a direct hash of the `Transaction` as visible on-chain. Rather, they correspond to hash\n digests of transaction body as they are serialized on the network.", - "anyOf": [ - { - "title": "TransactionId", - "dataType": "constructor", - "index": 0, - "fields": [ - { - "title": "hash", - "$ref": "#/definitions/ByteArray" - } - ] - } - ] } } } \ No newline at end of file diff --git a/examples/acceptance_tests/089/validators/test2.ak b/examples/acceptance_tests/089/validators/test2.ak index a87a9e519..4434ed2c4 100644 --- a/examples/acceptance_tests/089/validators/test2.ak +++ b/examples/acceptance_tests/089/validators/test2.ak @@ -1,10 +1,7 @@ -use aiken/list -use aiken/transaction.{ - Input, Mint, NoDatum, Output, OutputReference, ScriptContext, Transaction, - TransactionId, -} -use aiken/transaction/credential.{Address, VerificationKeyCredential} -use aiken/transaction/value +use aiken/collection/list +use cardano/assets +use cardano/credential.{Address, VerificationKey} +use cardano/transaction.{Input, NoDatum, Output, OutputReference, Transaction} pub const own_hash = #"01020304050607080910111213140102030405060708091011121314" @@ -20,17 +17,14 @@ pub fn beneficiary_address() { pub fn keyhash_address(keyhash: ByteArray) { Address { - payment_credential: VerificationKeyCredential(keyhash), + payment_credential: VerificationKey(keyhash), stake_credential: None, } } validator simple_oneshot(utxo_ref: OutputReference) { - mint(_r: Void, oref: Data, ctx: ScriptContext) -> Bool { - let ScriptContext { transaction, purpose } = ctx - let Transaction { inputs, .. } = transaction - - expect Mint(_policy_id) = purpose + mint(_r: Void, _policy_id: ByteArray, self: Transaction) { + let Transaction { inputs, .. } = self expect Some(_input) = list.find(inputs, fn(input) { input.output_reference == utxo_ref }) @@ -42,31 +36,34 @@ validator simple_oneshot(utxo_ref: OutputReference) { None -> False } } + + else(_) { + fail + } } test test_simple_oneshot() { let output = Output { address: beneficiary_address(), - value: value.zero(), + value: assets.zero(), datum: NoDatum, reference_script: None, } - let val = - value.from_asset(policy_id: own_hash, asset_name: "testtoken", quantity: 1) - let utxo = - OutputReference { transaction_id: TransactionId(""), output_index: 0 } + let mint = + assets.from_asset(policy_id: own_hash, asset_name: "testtoken", quantity: 1) + let utxo = OutputReference { transaction_id: "", output_index: 0 } let input = Input { output_reference: utxo, output } let tx = Transaction { ..transaction.placeholder(), - mint: value.to_minted_value(val), + mint: mint, extra_signatories: [other_hash], inputs: [input], } - let context = ScriptContext { purpose: Mint(own_hash), transaction: tx } - simple_oneshot(utxo, Void, context) == True + + simple_oneshot.mint(utxo, Void, own_hash, tx) == True } diff --git a/examples/acceptance_tests/090/plutus.json b/examples/acceptance_tests/090/plutus.json index 2408316ce..31c9f2e08 100644 --- a/examples/acceptance_tests/090/plutus.json +++ b/examples/acceptance_tests/090/plutus.json @@ -5,12 +5,12 @@ "plutusVersion": "v2", "compiler": { "name": "Aiken", - "version": "v1.0.31-alpha+6e4a16d" + "version": "v1.0.31-alpha+4003343" } }, "validators": [ { - "title": "foo.spend", + "title": "foo.foo.spend", "datum": { "title": "datum", "schema": { @@ -23,8 +23,13 @@ "$ref": "#/definitions/Data" } }, - "compiledCode": "583f010000322322253330053370e00690487777c9cfdde5c8f27bf4c1637fc55b5eeef7d8c4d9e0d4454967ff7d6e7ee6e242eb60c6318a4c26cac6eb40055cd1", - "hash": "6c5f960b7a078766778eef14cef347f3b5cd3c5fc4a7797f031aad70" + "compiledCode": "5884010000323232323225333002323232323253330073370e900118041baa001132323375e6018601a004980129d8799fc25822018c641ac1624dfb73d7e9e4852882cc4b1df75eb615fe302d3df21196ecf93dfb88ff00300b001300937540022c6012601400460100026010004600c00260086ea8004526136565734aae7555cf2ba15745", + "hash": "dfa7cee7ce4b00790987cebda791bad5ffd34e12c58adc567094edad" + }, + { + "title": "foo.foo.else", + "compiledCode": "5884010000323232323225333002323232323253330073370e900118041baa001132323375e6018601a004980129d8799fc25822018c641ac1624dfb73d7e9e4852882cc4b1df75eb615fe302d3df21196ecf93dfb88ff00300b001300937540022c6012601400460100026010004600c00260086ea8004526136565734aae7555cf2ba15745", + "hash": "dfa7cee7ce4b00790987cebda791bad5ffd34e12c58adc567094edad" } ], "definitions": { diff --git a/examples/acceptance_tests/090/validators/foo.ak b/examples/acceptance_tests/090/validators/foo.ak index aaf750c10..0f101202a 100644 --- a/examples/acceptance_tests/090/validators/foo.ak +++ b/examples/acceptance_tests/090/validators/foo.ak @@ -2,7 +2,11 @@ const foo = 45898945895546556456546223123184821312385384845153123213185685815615232323484552 validator foo { - spend(datum: Int, _redeemer: Data, o_ref: Data, _tx: Data) { - datum == foo + spend(datum: Option, _redeemer: Data, o_ref: Data, _tx: Data) { + datum == Some(foo) + } + + else(_) { + fail } } diff --git a/examples/acceptance_tests/096/aiken.lock b/examples/acceptance_tests/096/aiken.lock index 875510d74..299bf8509 100644 --- a/examples/acceptance_tests/096/aiken.lock +++ b/examples/acceptance_tests/096/aiken.lock @@ -3,14 +3,14 @@ [[requirements]] name = "aiken-lang/stdlib" -version = "main" +version = "v2" source = "github" [[packages]] name = "aiken-lang/stdlib" -version = "main" +version = "v2" requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723158436, nanos_since_epoch = 833716000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] +"aiken-lang/stdlib@v2" = [{ secs_since_epoch = 1724776968, nanos_since_epoch = 78547000 }, "cdbbce58b61deb385e7ea787a2e0fc2dc8fe94db9999e0e6275bc9c70e5796be"] diff --git a/examples/acceptance_tests/096/aiken.toml b/examples/acceptance_tests/096/aiken.toml index 05c1fb2ec..a6262e58d 100644 --- a/examples/acceptance_tests/096/aiken.toml +++ b/examples/acceptance_tests/096/aiken.toml @@ -10,5 +10,5 @@ platform = "github" [[dependencies]] name = "aiken-lang/stdlib" -version = "main" +version = "v2" source = "github" diff --git a/examples/acceptance_tests/096/plutus.json b/examples/acceptance_tests/096/plutus.json index b0c3be365..c216cf879 100644 --- a/examples/acceptance_tests/096/plutus.json +++ b/examples/acceptance_tests/096/plutus.json @@ -6,13 +6,13 @@ "plutusVersion": "v2", "compiler": { "name": "Aiken", - "version": "v1.0.31-alpha+6e4a16d" + "version": "v1.0.31-alpha+4003343" }, "license": "Apache-2.0" }, "validators": [ { - "title": "foo.is_fourty_two", + "title": "foo.is_fourty_two.spend", "datum": { "title": "dat", "schema": { @@ -25,8 +25,13 @@ "$ref": "#/definitions/Data" } }, - "compiledCode": "581c01000032222533300453330043375e00400629445280a4c26cacae69", - "hash": "8be8ae44ae022691acf356eae743ba402b8b7918f1e54092367ae0b7" + "compiledCode": "586d01000032323232323225333002323232323253330073370e900118041baa0011323253330093375e66e9520003300c0044bd70180698070010a5114a0601800260126ea800458c028c02c008c024004c024008c01c004c010dd50008a4c26cacae6955ceaab9e5740ae855d101", + "hash": "aa09f972cd22cf3bcbadb40dbe865d16dd4a50ff84022ef76a885d63" + }, + { + "title": "foo.is_fourty_two.else", + "compiledCode": "586d01000032323232323225333002323232323253330073370e900118041baa0011323253330093375e66e9520003300c0044bd70180698070010a5114a0601800260126ea800458c028c02c008c024004c024008c01c004c010dd50008a4c26cacae6955ceaab9e5740ae855d101", + "hash": "aa09f972cd22cf3bcbadb40dbe865d16dd4a50ff84022ef76a885d63" } ], "definitions": { diff --git a/examples/acceptance_tests/096/validators/foo.ak b/examples/acceptance_tests/096/validators/foo.ak index b5953bd83..57e46bd13 100644 --- a/examples/acceptance_tests/096/validators/foo.ak +++ b/examples/acceptance_tests/096/validators/foo.ak @@ -1,7 +1,11 @@ -use aiken/transaction.{ScriptContext} +use cardano/transaction.{Transaction} validator is_fourty_two { - spend(dat, rdm, oref, _ctx: Transaction) -> Bool { - rdm == dat && #"68656c6c6f20776f726c64" == #"68656c6c6f20776f726c64" + spend(dat, rdm, _oref, _ctx: Transaction) { + Some(rdm) == dat && #"68656c6c6f20776f726c64" == #"68656c6c6f20776f726c64" + } + + else(_) { + fail } } diff --git a/examples/acceptance_tests/099/aiken.lock b/examples/acceptance_tests/099/aiken.lock index 7b43a664a..72c4abc26 100644 --- a/examples/acceptance_tests/099/aiken.lock +++ b/examples/acceptance_tests/099/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724596652, nanos_since_epoch = 132897000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724776974, nanos_since_epoch = 482154000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] diff --git a/examples/acceptance_tests/101/aiken.lock b/examples/acceptance_tests/101/aiken.lock index 9d239801d..1915b8270 100644 --- a/examples/acceptance_tests/101/aiken.lock +++ b/examples/acceptance_tests/101/aiken.lock @@ -24,5 +24,5 @@ requirements = [] source = "github" [etags] -"aiken-lang/fuzz@main" = [{ secs_since_epoch = 1724596654, nanos_since_epoch = 381692000 }, "24d601fa19a2002318495bbb8562b9677563ca1b5c03126d6b093a65df076bef"] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724596653, nanos_since_epoch = 898649000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] +"aiken-lang/fuzz@main" = [{ secs_since_epoch = 1724776982, nanos_since_epoch = 317854000 }, "24d601fa19a2002318495bbb8562b9677563ca1b5c03126d6b093a65df076bef"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724776982, nanos_since_epoch = 83201000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] diff --git a/examples/acceptance_tests/102/aiken.lock b/examples/acceptance_tests/102/aiken.lock index 4137280fc..b0f59358c 100644 --- a/examples/acceptance_tests/102/aiken.lock +++ b/examples/acceptance_tests/102/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724596646, nanos_since_epoch = 86095000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724776954, nanos_since_epoch = 774618000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] diff --git a/examples/acceptance_tests/104/aiken.lock b/examples/acceptance_tests/104/aiken.lock index e92c9c189..9b0ad657b 100644 --- a/examples/acceptance_tests/104/aiken.lock +++ b/examples/acceptance_tests/104/aiken.lock @@ -24,5 +24,5 @@ requirements = [] source = "github" [etags] -"aiken-lang/fuzz@main" = [{ secs_since_epoch = 1724597285, nanos_since_epoch = 266243000 }, "24d601fa19a2002318495bbb8562b9677563ca1b5c03126d6b093a65df076bef"] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724597284, nanos_since_epoch = 808906000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] +"aiken-lang/fuzz@main" = [{ secs_since_epoch = 1724776955, nanos_since_epoch = 575782000 }, "24d601fa19a2002318495bbb8562b9677563ca1b5c03126d6b093a65df076bef"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724776954, nanos_since_epoch = 782601000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] diff --git a/examples/acceptance_tests/104/plutus.json b/examples/acceptance_tests/104/plutus.json index f0ded790a..021fd28fe 100644 --- a/examples/acceptance_tests/104/plutus.json +++ b/examples/acceptance_tests/104/plutus.json @@ -6,7 +6,7 @@ "plutusVersion": "v2", "compiler": { "name": "Aiken", - "version": "v1.0.31-alpha+0c9ea19" + "version": "v1.0.31-alpha+4003343" }, "license": "Apache-2.0" }, diff --git a/examples/acceptance_tests/104/validators/tests.ak b/examples/acceptance_tests/104/validators/tests.ak index 5f7569302..3f93d3804 100644 --- a/examples/acceptance_tests/104/validators/tests.ak +++ b/examples/acceptance_tests/104/validators/tests.ak @@ -21,6 +21,10 @@ validator foo_3(Foo { a0, .. }: Foo) { mint(_redeemer, _policy_, _tx) { a0 == 1 } + + else(_) { + fail + } } test example_1() { @@ -32,14 +36,15 @@ test example_2() { } test example_3() { - foo_3_mint(Foo { a0: 1, a1: False }, "", "", "") + foo_3.mint(Foo { a0: 1, a1: False }, "", "", "") } test example_4() { - let foo_4 = fn(Foo { a1, .. }) { a1 } + let foo_4 = + fn(Foo { a1, .. }) { a1 } foo_4(Foo { a0: 1, a1: True }) } test example_5((a, b) via fuzz.both(fuzz.int(), fuzz.int())) { - a + b == b + a + a + b == b + a } diff --git a/examples/gift_card/aiken.lock b/examples/gift_card/aiken.lock index 2f7651e95..312fac931 100644 --- a/examples/gift_card/aiken.lock +++ b/examples/gift_card/aiken.lock @@ -3,14 +3,14 @@ [[requirements]] name = "aiken-lang/stdlib" -version = "main" +version = "v2" source = "github" [[packages]] name = "aiken-lang/stdlib" -version = "main" +version = "v2" requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1714852860, nanos_since_epoch = 160588000 }, "5ee55dc5ccf269bb493f4cacb32096f0191a6adb2ef39d62a1f79b8c5a8fcc7f"] +"aiken-lang/stdlib@v2" = [{ secs_since_epoch = 1724778883, nanos_since_epoch = 61117000 }, "cdbbce58b61deb385e7ea787a2e0fc2dc8fe94db9999e0e6275bc9c70e5796be"] diff --git a/examples/gift_card/aiken.toml b/examples/gift_card/aiken.toml index 1d19f44be..1df9fde6d 100644 --- a/examples/gift_card/aiken.toml +++ b/examples/gift_card/aiken.toml @@ -10,5 +10,5 @@ platform = 'github' [[dependencies]] name = 'aiken-lang/stdlib' -version = 'main' +version = 'v2' source = 'github' diff --git a/examples/gift_card/validators/multi.ak b/examples/gift_card/validators/multi.ak index e88474284..41af34cd5 100644 --- a/examples/gift_card/validators/multi.ak +++ b/examples/gift_card/validators/multi.ak @@ -1,26 +1,26 @@ use aiken/builtin -use aiken/bytearray -use aiken/dict +use aiken/collection/dict +use aiken/collection/list use aiken/hash.{blake2b_256} -use aiken/list -use aiken/transaction.{ - InlineDatum, Input, Output, ScriptContext, Spend, Transaction, +use aiken/primitive/bytearray +use cardano/assets.{PolicyId} +use cardano/credential.{Address, PaymentCredential, Script} +use cardano/transaction.{ + InlineDatum, Input, Output, OutputReference, Transaction, } as tx -use aiken/transaction/credential.{Address, PaymentCredential, ScriptCredential} -use aiken/transaction/value -type Action { +pub type Action { Mint(Int) Burn } -type SpendTokenName = +pub type SpendTokenName = ByteArray validator redeem(creator: ByteArray) { spend( // Each spend input checks for a token name matching the datum being burned - datum: SpendTokenName, + datum: Option, _r: Data, own_ref: OutputReference, transaction: Transaction, @@ -35,23 +35,22 @@ validator redeem(creator: ByteArray) { .. } = own_input - expect ScriptCredential(own_validator_hash) = payment_credential + expect Script(own_validator_hash) = payment_credential + expect Some(datum) = datum ( mint - |> value.from_minted_value - |> value.quantity_of(own_validator_hash, datum) + |> assets.quantity_of(own_validator_hash, datum) ) == -1 } - mint(rdmr: Action, policy_id: PolicyId, transaction: Transaction) -> Bool { + mint(rdmr: Action, policy_id: PolicyId, transaction: Transaction) { let Transaction { inputs, mint, extra_signatories, outputs, .. } = transaction let minted_assets = mint - |> value.from_minted_value - |> value.tokens(policy_id) + |> assets.tokens(policy_id) |> dict.to_pairs() when rdmr is { @@ -75,7 +74,7 @@ validator redeem(creator: ByteArray) { minted_assets, outputs, expected_minted_token_names, - ScriptCredential(policy_id), + Script(policy_id), ) } Burn -> @@ -88,6 +87,10 @@ validator redeem(creator: ByteArray) { ) } } + + else(_) { + fail + } } fn insert(self: List, e: a, compare: fn(a, a) -> Ordering) -> List { diff --git a/examples/gift_card/validators/oneshot.ak b/examples/gift_card/validators/oneshot.ak index 784778cb6..2ce4001c9 100644 --- a/examples/gift_card/validators/oneshot.ak +++ b/examples/gift_card/validators/oneshot.ak @@ -1,21 +1,20 @@ -use aiken/dict -use aiken/list -use aiken/transaction.{OutputReference, ScriptContext, Transaction} as tx -use aiken/transaction/value +use aiken/collection/dict +use aiken/collection/list +use cardano/assets.{PolicyId} +use cardano/transaction.{OutputReference, Transaction} as tx -type Action { +pub type Action { Mint Burn } validator gift_card(token_name: ByteArray, utxo_ref: OutputReference) { - mint(rdmr: Action, policy_id: PolicyId, transaction: Transaction) -> Bool { + mint(rdmr: Action, policy_id: PolicyId, transaction: Transaction) { 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 { @@ -28,18 +27,25 @@ validator gift_card(token_name: ByteArray, utxo_ref: OutputReference) { Burn -> amount == -1 && asset_name == token_name } } + + else(_) { + fail + } } validator redeem(token_name: ByteArray, policy_id: ByteArray) { - spend(_d: Data, _r: Data, _o_ref: Data, transaction: Transaction) -> Bool { + spend(_d, _r, _o_ref: Data, transaction: Transaction) { let Transaction { mint, .. } = transaction expect [Pair(asset_name, amount)] = mint - |> value.from_minted_value - |> value.tokens(policy_id) + |> assets.tokens(policy_id) |> dict.to_pairs() amount == -1 && asset_name == token_name } + + else(_) { + fail + } }