hello world for starters

This commit is contained in:
Mateusz Czeladka
2023-01-06 13:20:07 +01:00
parent 470e331b26
commit 1142c6ca6d
16 changed files with 169 additions and 80 deletions

View File

@@ -0,0 +1,22 @@
use aiken/hash.{Blake2b_224, Hash}
use aiken/list
use aiken/string
use aiken/transaction.{ScriptContext}
use aiken/transaction/credential.{VerificationKey}
pub type Datum {
owner: Hash<Blake2b_224, VerificationKey>,
}
pub type Redeemer {
msg: ByteArray,
}
pub fn spend(datum: Datum, redeemer: Redeemer, context: ScriptContext) -> Bool {
let must_say_hello = string.from_bytearray(redeemer.msg) == "Hello, World!"
let must_be_signed =
list.has(context.transaction.extra_signatories, datum.owner)
must_say_hello && must_be_signed
}