Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions examples/last_will.inherit.wit
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"INHERIT_OR_NOT": {
"value": "Left(0x755201bb62b0a8b8d18fd12fc02951ea3998ba42bfc6664daaf8a0d2298cad43cdc21358c7c82f37654275dc2fea8c858adbe97bac92828b498a5a237004db6f)",
"type": "Either<Signature, Either<Signature, Signature>>"
"ACTION": {
"value": "1",
"type": "u8"
},
"INHERITOR_SIG": {
"value": "0x755201bb62b0a8b8d18fd12fc02951ea3998ba42bfc6664daaf8a0d2298cad43cdc21358c7c82f37654275dc2fea8c858adbe97bac92828b498a5a237004db6f",
"type": "Signature"
}
}
22 changes: 16 additions & 6 deletions examples/last_will.simf
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,22 @@ fn refresh_spend(hot_sig: Signature) {
recursive_covenant();
}

enum Action {
Inherit=1,
ColdSpend =2,
HotSpend =3,
}

fn main() {
match witness::INHERIT_OR_NOT {
Left(inheritor_sig: Signature) => inherit_spend(inheritor_sig),
Right(cold_or_hot: Either<Signature, Signature>) => match cold_or_hot {
Left(cold_sig: Signature) => cold_spend(cold_sig),
Right(hot_sig: Signature) => refresh_spend(hot_sig),
},
match witness::ACTION {
Action::Inherit => {
let inheritor_sig: Signature = witness::INHERITOR_SIG;
inherit_spend(inheritor_sig)} ,
Action::ColdSpend => {
let cold_sig: Signature = witness::COLD_SIG;
cold_spend(cold_sig) },
Action::HotSpend => {
let hot_sig: Signature = witness::HOT_SIG;
refresh_spend(hot_sig) },
}
}
Loading
Loading