mirror of
https://github.com/urbit/shrub.git
synced 2024-12-19 00:13:12 +03:00
roller: track ship ownership for address+proxy
This commit is contained in:
parent
3774abba73
commit
580007bba8
@ -268,8 +268,12 @@
|
||||
!> ^- (list ship)
|
||||
?~ addr=(slaw %ux wat)
|
||||
~
|
||||
%~ tap in
|
||||
(~(get ju own) u.addr)
|
||||
=/ proxies=(list proxy:naive)
|
||||
~[%own %spawn %manage %vote %transfer]
|
||||
%+ roll proxies
|
||||
|= [=proxy:naive ships=(list ship)]
|
||||
%+ weld ships
|
||||
~(tap in (~(get ju own) [proxy u.addr]))
|
||||
::
|
||||
++ config
|
||||
:+ ~ ~
|
||||
@ -336,9 +340,16 @@
|
||||
:- %points
|
||||
!> ^- (list [ship point:naive])
|
||||
?~ addr=(slaw %ux wat) ~
|
||||
%+ roll
|
||||
~(tap in (~(get ju own) u.addr))
|
||||
|= [=ship points=(list [ship point:naive])]
|
||||
:: %+ roll
|
||||
:: ~(tap in (~(get ju own) u.addr))
|
||||
=/ 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
|
||||
[ship (need (get:orm:naive points.pre ship))]
|
||||
::
|
||||
@ -506,7 +517,12 @@
|
||||
|- ^- (list card)
|
||||
?~ 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)
|
||||
^- card
|
||||
:+ %give %fact
|
||||
|
@ -50,27 +50,45 @@
|
||||
=/ new=point:naive
|
||||
(need (get points.nas ship))
|
||||
=* event +>.diff
|
||||
=; [to=(unit @ux) from=(unit @ux)]
|
||||
=? owners ?=(^ from)
|
||||
=; [to=(unit owner) from=(unit owner)]
|
||||
~? =(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)
|
||||
?: ?| =(~ to)
|
||||
&(?=(^ to) =(address.u.to 0x0))
|
||||
==
|
||||
[ups owners]
|
||||
?~ to [ups owners]
|
||||
~? =(ship ~marzod) ['add' u.to ship]
|
||||
:- (snoc ups [%point u.to ship new])
|
||||
(~(put ju owners) u.to ship)
|
||||
?+ -.event [~ ~]
|
||||
%owner
|
||||
[`+.event ?~(old ~ `address.owner.own.u.old)]
|
||||
::
|
||||
%spawn-proxy
|
||||
[`+.event ?~(old ~ `address.spawn-proxy.own.u.old)]
|
||||
:- `[%own +.event]
|
||||
?~ old ~
|
||||
`[%own address.owner.own.u.old]
|
||||
::
|
||||
%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
|
||||
[`+.event ?~(old ~ `address.voting-proxy.own.u.old)]
|
||||
:- `[%vote +.event]
|
||||
?~ old ~
|
||||
`[%vote address.voting-proxy.own.u.old]
|
||||
::
|
||||
%transfer-proxy
|
||||
[`+.event ?~(old ~ `address.transfer-proxy.own.u.old)]
|
||||
:- `[%transfer +.event]
|
||||
?~ old ~
|
||||
`[%transfer address.transfer-proxy.own.u.old]
|
||||
==
|
||||
::
|
||||
++ get-owner
|
||||
|
@ -3,7 +3,8 @@
|
||||
/+ naive, ethereum
|
||||
::
|
||||
|%
|
||||
+$ owners (jug address:naive ship)
|
||||
+$ owner [=proxy:naive =address:naive]
|
||||
+$ owners (jug owner ship)
|
||||
::
|
||||
+$ roller-config
|
||||
$: next-batch=time
|
||||
@ -43,7 +44,7 @@
|
||||
==
|
||||
::
|
||||
+$ update
|
||||
$% [%point =address:ethereum =ship =point:naive]
|
||||
$% [%point =owner =ship =point:naive]
|
||||
[%tx =address:ethereum =roller-tx]
|
||||
==
|
||||
::
|
||||
|
Loading…
Reference in New Issue
Block a user