Skip to content

Commit

Permalink
ted: add moon thread for setting up a new moon
Browse files Browse the repository at this point in the history
General setup cribbed from the |moon generator. This achieves the same,
but in a thread, and produces a [@p (unit @uw)] result instead of just
printing it into the slogs.
  • Loading branch information
Fang- committed Mar 7, 2024
1 parent 77a3e9b commit 40ee770
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions desk/ted/moon.hoon
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/- spider
/+ strandio
=, strand=strand:spider
^- thread:spider
|= arg=vase
=/ m (strand ,vase)
^- form:m
=+ !<(arg=?(~ [~ ?(mon=@p [mon=@p =pass])]) arg)
;< =bowl:spider bind:m get-bowl:strandio
=/ mon=ship
?^ arg
?@(+.arg mon.arg mon.arg)
(add our.bowl (lsh 5 (end 5 (shaz eny.bowl))))
=/ seg=ship (sein:title our.bowl now.bowl mon)
?. =(our.bowl seg)
%+ strand-fail:strand %not-our-moon
:_ ~
:- %leaf
"can't create keys for {(scow %p mon)}, which belongs to {(scow %p seg)}"
=/ [seed=(unit seed:jael) =pass]
~! arg
?: ?=([~ @ @] arg)
[~ pass.arg]
=/ cub (pit:nu:crub:crypto 512 (shaz (jam mon life=1 eny.bowl)))
:- `[mon 1 sec:ex:cub ~]
pub:ex:cub
;< ~ bind:m
%- send-raw-card:strandio
[%pass /ted/moon %arvo %j %moon mon *id:block:jael %keys [1 1 pass] %.n]
(pure:m !>([mon `(unit @uw)`(bind seed jam)]))

0 comments on commit 40ee770

Please sign in to comment.