mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-24 07:26:51 +03:00
naive: choose contracts from mainnet, ropsten or local
This commit is contained in:
parent
520225056a
commit
5b0e785cf7
@ -27,9 +27,17 @@
|
|||||||
[%watch url=@ta]
|
[%watch url=@ta]
|
||||||
==
|
==
|
||||||
+$ tagged-diff [=id:block diff:naive]
|
+$ tagged-diff [=id:block diff:naive]
|
||||||
|
::
|
||||||
|
+$ network ?(%mainnet %ropsten %local)
|
||||||
--
|
--
|
||||||
::
|
::
|
||||||
|%
|
|%
|
||||||
|
++ net
|
||||||
|
^- network
|
||||||
|
:: TODO: add poke action to allow switching?
|
||||||
|
:: eth snapshot could also be considered
|
||||||
|
::
|
||||||
|
%mainnet
|
||||||
:: TODO: maybe flop the endianness here so metamask signs it in normal
|
:: TODO: maybe flop the endianness here so metamask signs it in normal
|
||||||
:: order?
|
:: order?
|
||||||
::
|
::
|
||||||
@ -61,15 +69,23 @@
|
|||||||
(hex-to-num:ethereum data)
|
(hex-to-num:ethereum data)
|
||||||
::
|
::
|
||||||
++ run-logs
|
++ run-logs
|
||||||
|= [nas=^state:naive logs=(list event-log:rpc:ethereum)]
|
|= [nas=^state:naive logs=(list event-log:rpc:ethereum) =network]
|
||||||
^- [(list tagged-diff) ^state:naive]
|
^- [(list tagged-diff) ^state:naive]
|
||||||
|
=/ [contract=@ux chain-id=@]
|
||||||
|
=< [azimuth chain-id]
|
||||||
|
=, azimuth
|
||||||
|
?- network
|
||||||
|
%mainnet mainnet-contracts
|
||||||
|
%ropsten ropsten-contracts
|
||||||
|
%local local-contracts
|
||||||
|
==
|
||||||
?~ logs
|
?~ logs
|
||||||
`nas
|
`nas
|
||||||
?~ mined.i.logs
|
?~ mined.i.logs
|
||||||
$(logs t.logs)
|
$(logs t.logs)
|
||||||
=^ raw-effects nas
|
=^ raw-effects nas
|
||||||
=/ =^input:naive
|
=/ =^input:naive
|
||||||
?: =(azimuth:contracts:azimuth address.i.logs)
|
?: =(contract address.i.logs)
|
||||||
=/ data (data-to-hex data.i.logs)
|
=/ data (data-to-hex data.i.logs)
|
||||||
=/ =event-log:naive
|
=/ =event-log:naive
|
||||||
[address.i.logs data topics.i.logs]
|
[address.i.logs data topics.i.logs]
|
||||||
@ -79,7 +95,7 @@
|
|||||||
[%bat u.input.u.mined.i.logs]
|
[%bat u.input.u.mined.i.logs]
|
||||||
=/ res
|
=/ res
|
||||||
%- mule
|
%- mule
|
||||||
|.((%*(. naive lac |) verifier chain-id:contracts:azimuth nas input))
|
|.((%*(. naive lac |) verifier chain-id nas input))
|
||||||
?- -.res
|
?- -.res
|
||||||
%& p.res
|
%& p.res
|
||||||
%| ((slog 'naive-fail' p.res) `nas)
|
%| ((slog 'naive-fail' p.res) `nas)
|
||||||
@ -130,16 +146,36 @@
|
|||||||
%- some
|
%- some
|
||||||
^- card:agent:gall
|
^- card:agent:gall
|
||||||
[%give %fact ~[/aggregator] %naive-diffs !>(+.tag)]
|
[%give %fact ~[/aggregator] %naive-diffs !>(+.tag)]
|
||||||
|
::
|
||||||
|
++ get-contract
|
||||||
|
|= =network
|
||||||
|
^- [contract=@ux chain-id=@]
|
||||||
|
=< [azimuth chain-id]
|
||||||
|
=, azimuth
|
||||||
|
?- network
|
||||||
|
%mainnet mainnet-contracts
|
||||||
|
%ropsten ropsten-contracts
|
||||||
|
%local local-contracts
|
||||||
|
==
|
||||||
|
::
|
||||||
++ start
|
++ start
|
||||||
|= [state=app-state our=ship dap=term]
|
|= [state=app-state =network our=ship dap=term]
|
||||||
^- card:agent:gall
|
^- card:agent:gall
|
||||||
|
=/ [azimuth=@ux naive=@ux launch=@ud]
|
||||||
|
=< [azimuth naive launch]
|
||||||
|
=, azimuth
|
||||||
|
?- network
|
||||||
|
%mainnet mainnet-contracts
|
||||||
|
%ropsten ropsten-contracts
|
||||||
|
%local local-contracts
|
||||||
|
==
|
||||||
=/ args=vase !>
|
=/ args=vase !>
|
||||||
:+ %watch /[dap]
|
:+ %watch /[dap]
|
||||||
^- config:eth-watcher
|
^- config:eth-watcher
|
||||||
:* url.state =(%czar (clan:title our)) ~m5 ~h30
|
:* url.state =(%czar (clan:title our)) ~m5 ~h30
|
||||||
(max launch:contracts:azimuth last-snap)
|
(max launch last-snap)
|
||||||
~[azimuth:contracts:azimuth]
|
~[azimuth]
|
||||||
~[naive:contracts:azimuth]
|
~[naive]
|
||||||
(topics whos.state)
|
(topics whos.state)
|
||||||
==
|
==
|
||||||
[%pass /wa %agent [our %eth-watcher] %poke %eth-watcher-poke args]
|
[%pass /wa %agent [our %eth-watcher] %poke %eth-watcher-poke args]
|
||||||
@ -217,7 +253,7 @@
|
|||||||
?+ q.vase !!
|
?+ q.vase !!
|
||||||
%rerun
|
%rerun
|
||||||
~& [%rerunning (lent logs.state)]
|
~& [%rerunning (lent logs.state)]
|
||||||
=^ effects nas.state (run-logs *^state:naive logs.state)
|
=^ effects nas.state (run-logs *^state:naive logs.state net)
|
||||||
`this
|
`this
|
||||||
::
|
::
|
||||||
%resub
|
%resub
|
||||||
@ -240,7 +276,7 @@
|
|||||||
%listen [[%pass /lo %arvo %j %listen (silt whos.poke) source.poke]~ this]
|
%listen [[%pass /lo %arvo %j %listen (silt whos.poke) source.poke]~ this]
|
||||||
%watch
|
%watch
|
||||||
=. url.state url.poke
|
=. url.state url.poke
|
||||||
[[(start state [our dap]:bowl) ~] this]
|
[[(start state net [our dap]:bowl) ~] this]
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ on-watch
|
++ on-watch
|
||||||
@ -256,7 +292,7 @@
|
|||||||
~
|
~
|
||||||
(~(put in whos.state) u.who)
|
(~(put in whos.state) u.who)
|
||||||
:_ this :_ ~
|
:_ this :_ ~
|
||||||
(start state [our dap]:bowl)
|
(start state net [our dap]:bowl)
|
||||||
::
|
::
|
||||||
++ on-leave on-leave:def
|
++ on-leave on-leave:def
|
||||||
++ on-peek
|
++ on-peek
|
||||||
@ -295,13 +331,14 @@
|
|||||||
==
|
==
|
||||||
=? nas.state ?=(%history -.diff) *^state:naive
|
=? nas.state ?=(%history -.diff) *^state:naive
|
||||||
=^ effects nas.state
|
=^ effects nas.state
|
||||||
%+ run-logs
|
%^ run-logs
|
||||||
?- -.diff
|
?- -.diff
|
||||||
:: %history *^state:naive
|
:: %history *^state:naive
|
||||||
%history nas.state
|
%history nas.state
|
||||||
%logs nas.state
|
%logs nas.state
|
||||||
==
|
==
|
||||||
loglist.diff
|
loglist.diff
|
||||||
|
net
|
||||||
::
|
::
|
||||||
:_ this
|
:_ this
|
||||||
%+ weld
|
%+ weld
|
||||||
|
Loading…
Reference in New Issue
Block a user