roller: track ship ownership for address+proxy

This commit is contained in:
yosoyubik 2021-08-23 16:32:26 +02:00
parent 3774abba73
commit 580007bba8
3 changed files with 52 additions and 17 deletions

View File

@ -268,8 +268,12 @@
!> ^- (list ship) !> ^- (list ship)
?~ addr=(slaw %ux wat) ?~ addr=(slaw %ux wat)
~ ~
%~ tap in =/ proxies=(list proxy:naive)
(~(get ju own) u.addr) ~[%own %spawn %manage %vote %transfer]
%+ roll proxies
|= [=proxy:naive ships=(list ship)]
%+ weld ships
~(tap in (~(get ju own) [proxy u.addr]))
:: ::
++ config ++ config
:+ ~ ~ :+ ~ ~
@ -336,9 +340,16 @@
:- %points :- %points
!> ^- (list [ship point:naive]) !> ^- (list [ship point:naive])
?~ addr=(slaw %ux wat) ~ ?~ addr=(slaw %ux wat) ~
%+ roll :: %+ roll
~(tap in (~(get ju own) u.addr)) :: ~(tap in (~(get ju own) u.addr))
|= [=ship points=(list [ship point:naive])] =/ proxies=(list proxy:naive)
~[%own %spawn %manage %vote %transfer]
%+ roll proxies
|= [=proxy:naive points=(list [ship point:naive])]
%+ weld points
::
%+ roll ~(tap in (~(get ju own) [proxy u.addr]))
|= [=ship points=_points]
%+ snoc points %+ snoc points
[ship (need (get:orm:naive points.pre ship))] [ship (need (get:orm:naive points.pre ship))]
:: ::
@ -506,7 +517,12 @@
|- ^- (list card) |- ^- (list card)
?~ updates ~ ?~ updates ~
=* up i.updates =* up i.updates
=/ address=@t (scot %ux address.up) =/ address=@t
%+ scot %ux
?- -.up
%tx address.up
%point address.owner.up
==
:_ $(updates t.updates) :_ $(updates t.updates)
^- card ^- card
:+ %give %fact :+ %give %fact

View File

@ -50,27 +50,45 @@
=/ new=point:naive =/ new=point:naive
(need (get points.nas ship)) (need (get points.nas ship))
=* event +>.diff =* event +>.diff
=; [to=(unit @ux) from=(unit @ux)] =; [to=(unit owner) from=(unit owner)]
=? owners ?=(^ from) ~? =(ship ~marzod)
[-.event to+to from+from]
=? owners &(?=(^ from) !=(address.u.from 0x0))
~? =(ship ~marzod) ['del' u.from ship new old]
(~(del ju owners) u.from ship) (~(del ju owners) u.from ship)
?: ?| =(~ to)
&(?=(^ to) =(address.u.to 0x0))
==
[ups owners]
?~ to [ups owners] ?~ to [ups owners]
~? =(ship ~marzod) ['add' u.to ship]
:- (snoc ups [%point u.to ship new]) :- (snoc ups [%point u.to ship new])
(~(put ju owners) u.to ship) (~(put ju owners) u.to ship)
?+ -.event [~ ~] ?+ -.event [~ ~]
%owner %owner
[`+.event ?~(old ~ `address.owner.own.u.old)] :- `[%own +.event]
:: ?~ old ~
%spawn-proxy `[%own address.owner.own.u.old]
[`+.event ?~(old ~ `address.spawn-proxy.own.u.old)]
:: ::
%management-proxy %management-proxy
[`+.event ?~(old ~ `address.management-proxy.own.u.old)] :- `[%manage +.event]
?~ old ~
`[%manage address.management-proxy.own.u.old]
::
%spawn-proxy
:- `[%spawn +.event]
?~ old ~
`[%spawn address.spawn-proxy.own.u.old]
:: ::
%voting-proxy %voting-proxy
[`+.event ?~(old ~ `address.voting-proxy.own.u.old)] :- `[%vote +.event]
?~ old ~
`[%vote address.voting-proxy.own.u.old]
:: ::
%transfer-proxy %transfer-proxy
[`+.event ?~(old ~ `address.transfer-proxy.own.u.old)] :- `[%transfer +.event]
?~ old ~
`[%transfer address.transfer-proxy.own.u.old]
== ==
:: ::
++ get-owner ++ get-owner

View File

@ -3,7 +3,8 @@
/+ naive, ethereum /+ naive, ethereum
:: ::
|% |%
+$ owners (jug address:naive ship) +$ owner [=proxy:naive =address:naive]
+$ owners (jug owner ship)
:: ::
+$ roller-config +$ roller-config
$: next-batch=time $: next-batch=time
@ -43,7 +44,7 @@
== ==
:: ::
+$ update +$ update
$% [%point =address:ethereum =ship =point:naive] $% [%point =owner =ship =point:naive]
[%tx =address:ethereum =roller-tx] [%tx =address:ethereum =roller-tx]
== ==
:: ::