naive: use lib/naive tx form

This commit is contained in:
drbeefsupreme 2021-05-19 15:48:27 -04:00
parent ab332118b9
commit 6f89b2ddd6
No known key found for this signature in database
GPG Key ID: B70D5683DE7F9EFC

View File

@ -4,42 +4,27 @@
+$ address address:ethereum
+$ nonce @ud
+$ proxy ?(%own %spawn %manage %vote %transfer)
+$ skp [=ship pk=@ =proxy]
::
+$ l2-tx
$% [%spawn child=ship =address]
[%transfer-point =address reset=?]
[%configure-keys suite=@ud encrypt=@ auth=@ breach=?]
[%escape parent=ship]
[%cancel-escape parent=ship]
[%adopt child=ship]
[%reject child=ship]
[%detach child=ship]
[%set-management-proxy =address]
[%set-spawn-proxy =address]
[%set-transfer-proxy =address]
==
--
::
|%
::
++ gen-tx
|= [=nonce =skp tx=l2-tx] ^- octs
|= [=nonce tx=tx:naive pk=@] ^- octs
=/ raw=octs
?- -.tx
%spawn (get-spawn:bits ship.skp proxy.skp +.tx)
%transfer-point (get-transfer:bits ship.skp proxy.skp +.tx)
%configure-keys (get-keys:bits ship.skp proxy.skp +.tx)
%escape (get-escape:bits %escape ship.skp proxy.skp +.tx)
%cancel-escape (get-escape:bits %cancel-escape ship.skp proxy.skp +.tx)
%adopt (get-escape:bits %adopt ship.skp proxy.skp +.tx)
%reject (get-escape:bits %reject ship.skp proxy.skp +.tx)
%detach (get-escape:bits %detach ship.skp proxy.skp +.tx)
%set-management-proxy (get-ship-address:bits %set-management-proxy ship.skp proxy.skp +.tx)
%set-spawn-proxy (get-ship-address:bits %set-spawn-proxy ship.skp proxy.skp +.tx)
%set-transfer-proxy (get-ship-address:bits %set-transfer-proxy ship.skp proxy.skp +.tx)
?- +<.tx
%spawn (get-spawn:bits -.tx +>.tx)
%transfer-point (get-transfer:bits -.tx +>.tx)
%configure-keys (get-keys:bits -.tx +>.tx)
%escape (get-escape:bits -.tx +.tx)
%cancel-escape (get-escape:bits -.tx +.tx)
%adopt (get-escape:bits -.tx +.tx)
%reject (get-escape:bits -.tx +.tx)
%detach (get-escape:bits -.tx +.tx)
%set-management-proxy (get-ship-address:bits -.tx +.tx)
%set-spawn-proxy (get-ship-address:bits -.tx +.tx)
%set-transfer-proxy (get-ship-address:bits -.tx +.tx)
==
%^ sign-tx pk.skp nonce raw
%^ sign-tx pk nonce raw
::
:: TODO: does this uniquely produce the pubkey?
++ verifier
@ -93,10 +78,10 @@
:: TODO: Shouldn't need to pass all these arguments along - they should already be in the subject somewhere
::
++ get-spawn
|= [=ship =proxy child=ship =address] ^- octs
|= [from=[=ship =proxy] child=ship =address] ^- octs
%: cad:naive 3
(from-proxy:bits proxy)
4^ship
(from-proxy:bits proxy.from)
4^ship.from
1^%1 :: %spawn
4^child
20^address
@ -104,20 +89,20 @@
==
::
++ get-transfer
|= [=ship =proxy =address reset=?] ^- octs
|= [from=[=ship =proxy] =address reset=?] ^- octs
%: cad:naive 3
(from-proxy:bits proxy)
4^ship
(from-proxy:bits proxy.from)
4^ship.from
1^(can 0 7^%0 1^reset ~) :: %transfer-point
20^address
~
==
::
++ get-keys
|= [=ship =proxy suite=@ud encrypt=@ auth=@ breach=?] ^- octs
|= [from=[=ship =proxy] suite=@ud encrypt=@ auth=@ breach=?] ^- octs
%: cad:naive 3
(from-proxy:bits proxy)
4^ship
(from-proxy:bits proxy.from)
4^ship.from
1^(can 0 7^%2 1^breach ~) :: %configure-keys
32^encrypt
32^auth
@ -126,7 +111,7 @@
==
::
++ get-escape
|= [action=@tas from=ship proxy=@tas other=ship] ^- octs
|= [from=[=ship =proxy] action=@tas other=ship] ^- octs
=/ op
?+ action !!
%escape %3
@ -136,15 +121,15 @@
%detach %7
==
%: cad:naive 3
(from-proxy proxy)
4^from
(from-proxy proxy.from)
4^ship.from
1^(can 0 7^op 1^0 ~)
4^other
~
==
::
++ get-ship-address
|= [action=@tas from=ship proxy=@tas =address] ^- octs
|= [from=[=ship =proxy] action=@tas =address] ^- octs
=/ op
?+ action !!
%set-management-proxy %8
@ -152,8 +137,8 @@
%set-transfer-proxy %10
==
%: cad:naive 3
(from-proxy proxy)
4^from
(from-proxy proxy.from)
4^ship.from
1^(can 0 7^op 1^0 ~)
20^address
~