feat: on fmt if label and name are the same only print one
This commit is contained in:
parent
4c4e454ea3
commit
7867793bcd
|
@ -1585,7 +1585,11 @@ impl<'a> Documentable<'a> for &'a ArgName {
|
|||
ArgName::Named { name, .. } | ArgName::Discard { name, .. } => name.to_doc(),
|
||||
ArgName::LabeledDiscard { label, name, .. }
|
||||
| ArgName::NamedLabeled { label, name, .. } => {
|
||||
docvec![label, " ", name]
|
||||
if label == name {
|
||||
name.to_doc()
|
||||
} else {
|
||||
docvec![label, " ", name]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,21 +3,22 @@ use aiken/string
|
|||
use aiken/hash.{Blake2b_224, Hash}
|
||||
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 =
|
||||
context.transaction.extra_signatories
|
||||
|> list.any(fn(vk) { vk == datum.owner })
|
||||
|
||||
|
||||
must_say_hello && must_be_signed
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue