mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-22 22:31:30 +03:00
casting
This commit is contained in:
parent
791cece901
commit
b065b60da1
@ -30,12 +30,14 @@
|
|||||||
::
|
::
|
||||||
++ init-bud
|
++ init-bud
|
||||||
|= =^state:naive
|
|= =^state:naive
|
||||||
(n state (owner-changed:l1 ~bud 0x123))
|
^- [effects:naive ^state:naive]
|
||||||
|
(n state (owner-changed:l1 ~bud (key ~bud)))
|
||||||
::
|
::
|
||||||
:: ~dopbud is for testing L1 ownership with L2 spawn proxy
|
:: ~dopbud is for testing L1 ownership with L2 spawn proxy
|
||||||
::
|
::
|
||||||
++ init-dopbud
|
++ init-dopbud
|
||||||
|= =^state:naive
|
|= =^state:naive
|
||||||
|
^- [effects:naive ^state:naive]
|
||||||
=^ f1 state (init-bud state)
|
=^ f1 state (init-bud state)
|
||||||
=^ f2 state (n state (owner-changed:l1 ~dopbud (key ~dopbud)))
|
=^ f2 state (n state (owner-changed:l1 ~dopbud (key ~dopbud)))
|
||||||
=^ f3 state (n state (changed-spawn-proxy:l1 ~dopbud deposit-address:naive))
|
=^ f3 state (n state (changed-spawn-proxy:l1 ~dopbud deposit-address:naive))
|
||||||
@ -45,13 +47,14 @@
|
|||||||
::
|
::
|
||||||
++ init-marbud
|
++ init-marbud
|
||||||
|= =^state:naive
|
|= =^state:naive
|
||||||
|
^- [effects:naive ^state:naive]
|
||||||
=^ f1 state (init-bud state)
|
=^ f1 state (init-bud state)
|
||||||
=^ f2 state (n state (owner-changed:l1 ~marbud (key ~marbud)))
|
=^ f2 state (n state (owner-changed:l1 ~marbud (key ~marbud)))
|
||||||
=^ f3 state (n state (owner-changed:l1 ~marbud deposit-address:naive))
|
=^ f3 state (n state (owner-changed:l1 ~marbud deposit-address:naive))
|
||||||
[:(welp f1 f2 f3) state]
|
[:(welp f1 f2 f3) state]
|
||||||
::
|
::
|
||||||
++ sign-tx
|
++ sign-tx
|
||||||
|= [pk=@ nonce=@ud tx=@]
|
|= [pk=@ nonce=@ud tx=@] ^- @
|
||||||
=+ (ecdsa-raw-sign:secp256k1:secp:crypto (dad:naive 5 nonce tx) pk)
|
=+ (ecdsa-raw-sign:secp256k1:secp:crypto (dad:naive 5 nonce tx) pk)
|
||||||
(cat 3 (can 3 1^v 32^r 32^s ~) tx)
|
(cat 3 (can 3 1^v 32^r 32^s ~) tx)
|
||||||
::
|
::
|
||||||
@ -123,13 +126,13 @@
|
|||||||
:: TODO: Allow requesting ship to differ from the ship the action is for
|
:: TODO: Allow requesting ship to differ from the ship the action is for
|
||||||
::
|
::
|
||||||
++ spawn
|
++ spawn
|
||||||
|= [nonce=@ud parent=ship proxy=@tas child=ship =address]
|
|= [nonce=@ud parent=ship proxy=@tas child=ship =address] ^- @
|
||||||
:: TODO: allow requesting ship and parent ship to differ
|
:: TODO: allow requesting ship and parent ship to differ
|
||||||
%^ sign-tx parent nonce
|
%^ sign-tx parent nonce
|
||||||
(take-ship-address:bits %spawn parent proxy child address)
|
(take-ship-address:bits %spawn parent proxy child address)
|
||||||
::
|
::
|
||||||
++ transfer-point
|
++ transfer-point
|
||||||
|= [nonce=@ud =ship =address proxy=@tas reset=?]
|
|= [nonce=@ud =ship =address proxy=@tas reset=?] ^- @
|
||||||
:: TODO: allow requesting ship and target ship to differ
|
:: TODO: allow requesting ship and target ship to differ
|
||||||
%^ sign-tx ship nonce
|
%^ sign-tx ship nonce
|
||||||
%: can 3
|
%: can 3
|
||||||
@ -142,7 +145,7 @@
|
|||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ configure-keys
|
++ configure-keys
|
||||||
|= [nonce=@ud =ship proxy=@tas breach=@ encrypt=@ auth=@ crypto-suite=@]
|
|= [nonce=@ud =ship proxy=@tas breach=@ encrypt=@ auth=@ crypto-suite=@] ^- @
|
||||||
%^ sign-tx ship nonce
|
%^ sign-tx ship nonce
|
||||||
%: can 3
|
%: can 3
|
||||||
(from-proxy:bits proxy)
|
(from-proxy:bits proxy)
|
||||||
@ -156,47 +159,47 @@
|
|||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ escape
|
++ escape
|
||||||
|= [nonce=@ud child=ship proxy=@tas parent=ship]
|
|= [nonce=@ud child=ship proxy=@tas parent=ship] ^- @
|
||||||
%^ sign-tx child nonce
|
%^ sign-tx child nonce
|
||||||
(take-escape:bits %escape child proxy parent)
|
(take-escape:bits %escape child proxy parent)
|
||||||
::
|
::
|
||||||
++ cancel-escape
|
++ cancel-escape
|
||||||
|= [nonce=@ud child=ship proxy=@tas parent=ship]
|
|= [nonce=@ud child=ship proxy=@tas parent=ship] ^- @
|
||||||
%^ sign-tx child nonce
|
%^ sign-tx child nonce
|
||||||
(take-escape:bits %cancel-escape child proxy parent)
|
(take-escape:bits %cancel-escape child proxy parent)
|
||||||
::
|
::
|
||||||
++ adopt
|
++ adopt
|
||||||
|= [nonce=@ud child=ship proxy=@tas parent=ship]
|
|= [nonce=@ud child=ship proxy=@tas parent=ship] ^- @
|
||||||
%^ sign-tx child nonce
|
%^ sign-tx child nonce
|
||||||
(take-escape:bits %adopt child proxy parent)
|
(take-escape:bits %adopt child proxy parent)
|
||||||
::
|
::
|
||||||
++ reject
|
++ reject
|
||||||
|= [nonce=@ud child=ship proxy=@tas parent=ship]
|
|= [nonce=@ud child=ship proxy=@tas parent=ship] ^- @
|
||||||
%^ sign-tx child nonce
|
%^ sign-tx child nonce
|
||||||
(take-escape:bits %reject child proxy parent)
|
(take-escape:bits %reject child proxy parent)
|
||||||
::
|
::
|
||||||
++ detach
|
++ detach
|
||||||
|= [nonce=@ud child=ship proxy=@tas parent=ship]
|
|= [nonce=@ud child=ship proxy=@tas parent=ship] ^- @
|
||||||
%^ sign-tx child nonce
|
%^ sign-tx child nonce
|
||||||
(take-escape:bits %detach child proxy parent)
|
(take-escape:bits %detach child proxy parent)
|
||||||
::
|
::
|
||||||
++ set-management-proxy
|
++ set-management-proxy
|
||||||
|= [nonce=@ud =ship proxy=@tas =address]
|
|= [nonce=@ud =ship proxy=@tas =address] ^- @
|
||||||
%^ sign-tx ship nonce
|
%^ sign-tx ship nonce
|
||||||
(take-ship-address:bits %set-management-proxy ship proxy ship address)
|
(take-ship-address:bits %set-management-proxy ship proxy ship address)
|
||||||
::
|
::
|
||||||
++ set-spawn-proxy
|
++ set-spawn-proxy
|
||||||
|= [nonce=@ud =ship proxy=@tas =address]
|
|= [nonce=@ud =ship proxy=@tas =address] ^- @
|
||||||
%^ sign-tx ship nonce
|
%^ sign-tx ship nonce
|
||||||
(take-ship-address:bits %set-spawn-proxy ship proxy ship address)
|
(take-ship-address:bits %set-spawn-proxy ship proxy ship address)
|
||||||
::
|
::
|
||||||
++ set-voting-proxy
|
++ set-voting-proxy
|
||||||
|= [nonce=@ud =ship proxy=@tas =address]
|
|= [nonce=@ud =ship proxy=@tas =address] ^- @
|
||||||
%^ sign-tx ship nonce
|
%^ sign-tx ship nonce
|
||||||
(take-ship-address:bits %set-voting-proxy ship proxy ship address)
|
(take-ship-address:bits %set-voting-proxy ship proxy ship address)
|
||||||
::
|
::
|
||||||
++ set-transfer-proxy
|
++ set-transfer-proxy
|
||||||
|= [nonce=@ud =ship proxy=@tas =address]
|
|= [nonce=@ud =ship proxy=@tas =address] ^- @
|
||||||
%^ sign-tx ship nonce
|
%^ sign-tx ship nonce
|
||||||
(take-ship-address:bits %set-transfer-proxy ship proxy ship address)
|
(take-ship-address:bits %set-transfer-proxy ship proxy ship address)
|
||||||
::
|
::
|
||||||
@ -207,7 +210,7 @@
|
|||||||
:: TODO: Shouldn't need to pass all these arguments along - they should already be in the subject somewhere
|
:: TODO: Shouldn't need to pass all these arguments along - they should already be in the subject somewhere
|
||||||
::
|
::
|
||||||
++ take-escape
|
++ take-escape
|
||||||
|= [action=@tas child=ship proxy=@tas parent=ship]
|
|= [action=@tas child=ship proxy=@tas parent=ship] ^- @
|
||||||
=/ op
|
=/ op
|
||||||
?+ action !!
|
?+ action !!
|
||||||
%escape %3
|
%escape %3
|
||||||
@ -226,7 +229,7 @@
|
|||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ take-ship-address
|
++ take-ship-address
|
||||||
|= [action=@tas from=ship proxy=@tas target=ship =address]
|
|= [action=@tas from=ship proxy=@tas target=ship =address] ^- @
|
||||||
=/ op
|
=/ op
|
||||||
?+ action !!
|
?+ action !!
|
||||||
%spawn %1
|
%spawn %1
|
||||||
@ -246,6 +249,7 @@
|
|||||||
::
|
::
|
||||||
++ from-proxy
|
++ from-proxy
|
||||||
|= prx=@tas
|
|= prx=@tas
|
||||||
|
^- [@ @]
|
||||||
=/ proxy
|
=/ proxy
|
||||||
?+ prx !!
|
?+ prx !!
|
||||||
%own %0
|
%own %0
|
||||||
@ -263,7 +267,7 @@
|
|||||||
--
|
--
|
||||||
::
|
::
|
||||||
|%
|
|%
|
||||||
++ test-log
|
++ test-log ^- tang
|
||||||
%+ expect-eq
|
%+ expect-eq
|
||||||
!>
|
!>
|
||||||
:- [%point ~bud %owner 0x123]~
|
:- [%point ~bud %owner 0x123]~
|
||||||
@ -275,7 +279,7 @@
|
|||||||
owner-changed:log-names:naive (@ux ~bud) 0x123 ~
|
owner-changed:log-names:naive (@ux ~bud) 0x123 ~
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ test-deposit
|
++ test-deposit ^- tang
|
||||||
%+ expect-eq
|
%+ expect-eq
|
||||||
!> %l2
|
!> %l2
|
||||||
::
|
::
|
||||||
@ -284,7 +288,7 @@
|
|||||||
=^ f state (init-marbud state)
|
=^ f state (init-marbud state)
|
||||||
dominion:(~(got by points.state) ~marbud)
|
dominion:(~(got by points.state) ~marbud)
|
||||||
::
|
::
|
||||||
++ test-batch
|
++ test-batch ^- tang
|
||||||
%+ expect-eq
|
%+ expect-eq
|
||||||
!> [0x234 2]
|
!> [0x234 2]
|
||||||
::
|
::
|
||||||
|
Loading…
Reference in New Issue
Block a user