diff --git a/examples/hello_world/aiken.lock b/examples/hello_world/aiken.lock index 0f958098..166359d7 100644 --- a/examples/hello_world/aiken.lock +++ b/examples/hello_world/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 = 1723580005, nanos_since_epoch = 641136000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"] +"aiken-lang/stdlib@v2" = [{ secs_since_epoch = 1724595875, nanos_since_epoch = 142190000 }, "cdbbce58b61deb385e7ea787a2e0fc2dc8fe94db9999e0e6275bc9c70e5796be"] diff --git a/examples/hello_world/aiken.toml b/examples/hello_world/aiken.toml index 3b523f22..db7cce2f 100644 --- a/examples/hello_world/aiken.toml +++ b/examples/hello_world/aiken.toml @@ -1,9 +1,10 @@ name = "aiken-lang/hello_world" version = "1.0.0" +plutusVersion = "v3" licences = ["Apache-2.0"] description = "Aiken contracts for project 'aiken-lang/hello_world'" [[dependencies]] name = "aiken-lang/stdlib" -version = "main" +version = "v2" source = "github" diff --git a/examples/hello_world/plutus.json b/examples/hello_world/plutus.json index a0fab843..835219be 100644 --- a/examples/hello_world/plutus.json +++ b/examples/hello_world/plutus.json @@ -6,12 +6,12 @@ "plutusVersion": "v2", "compiler": { "name": "Aiken", - "version": "v1.0.19-alpha+d56d518" + "version": "v1.0.31-alpha+0c9ea19" } }, "validators": [ { - "title": "hello_world.spend", + "title": "hello_world.hello_world.spend", "datum": { "title": "datum", "schema": { @@ -24,8 +24,13 @@ "$ref": "#/definitions/hello_world~1Redeemer" } }, - "compiledCode": "58f2010000323232323232323222232325333008323232533300b002100114a06644646600200200644a66602200229404c8c94ccc040cdc78010028a511330040040013014002375c60240026eb0c038c03cc03cc03cc03cc03cc03cc03cc03cc020c008c020014dd71801180400399b8f375c6002600e00a91010d48656c6c6f2c20576f726c6421002300d00114984d958c94ccc020cdc3a400000226464a66601a601e0042930b1bae300d00130060041630060033253330073370e900000089919299980618070010a4c2c6eb8c030004c01401058c01400c8c014dd5000918019baa0015734aae7555cf2ab9f5742ae881", - "hash": "6fb13cf9efdbe986e784d1983b21d3fb90231c1745925f536a820fb4" + "compiledCode": "59011d0100003232323232323225333002323232323253330073370e900118041baa0011323232533300a3370e900018059baa005132533300e0011613253333330120011616161613253330103012003132533300e3370e900018079baa005132533300f002100114a06644646600200200644a66602a00229404c94ccc04ccdc79bae301700200414a2266006006002602e0026eb0c048c04cc04cc04cc04cc04cc04cc04cc04cc040dd50059bae301230103754602460206ea801458cdc79bae3011300f375401091010d48656c6c6f2c20576f726c64210016375c002601e00260186ea801458c034c038008c030004c024dd50008b1805180580118048009804801180380098021baa00114984d9595cd2ab9d5573caae7d5d0aba25749", + "hash": "a03ed5b0e902c0ab66948c9529cdc8e637b5f0cccce60d2e94904581" + }, + { + "title": "hello_world.hello_world.else", + "compiledCode": "59011d0100003232323232323225333002323232323253330073370e900118041baa0011323232533300a3370e900018059baa005132533300e0011613253333330120011616161613253330103012003132533300e3370e900018079baa005132533300f002100114a06644646600200200644a66602a00229404c94ccc04ccdc79bae301700200414a2266006006002602e0026eb0c048c04cc04cc04cc04cc04cc04cc04cc04cc040dd50059bae301230103754602460206ea801458cdc79bae3011300f375401091010d48656c6c6f2c20576f726c64210016375c002601e00260186ea801458c034c038008c030004c024dd50008b1805180580118048009804801180380098021baa00114984d9595cd2ab9d5573caae7d5d0aba25749", + "hash": "a03ed5b0e902c0ab66948c9529cdc8e637b5f0cccce60d2e94904581" } ], "definitions": { diff --git a/examples/hello_world/validators/hello_world.ak b/examples/hello_world/validators/hello_world.ak index ef3006c9..19ccf4ff 100644 --- a/examples/hello_world/validators/hello_world.ak +++ b/examples/hello_world/validators/hello_world.ak @@ -1,10 +1,9 @@ -use aiken/hash.{Blake2b_224, Hash} -use aiken/list -use aiken/transaction.{ScriptContext} -use aiken/transaction/credential.{VerificationKey} +use aiken/collection/list +use cardano/credential.{VerificationKeyHash} +use cardano/transaction.{OutputReference, Transaction} pub type Datum { - owner: Hash, + owner: VerificationKeyHash, } pub type Redeemer { @@ -12,16 +11,22 @@ pub type Redeemer { } validator hello_world { - spend(datum: Datum, redeemer: Redeemer, context: ScriptContext) -> Bool { + spend( + datum: Option, + redeemer: Redeemer, + _: OutputReference, + transaction: Transaction, + ) -> Bool { let must_say_hello = redeemer.msg == "Hello, World!" - let must_be_signed = - list.has(context.transaction.extra_signatories, datum.owner) + expect Some(Datum { owner }) = datum + + let must_be_signed = list.has(transaction.extra_signatories, owner) must_say_hello && must_be_signed } - else(_ctx) { + else(_) { fail } }