mirror of
https://github.com/urbit/shrub.git
synced 2024-12-19 00:13:12 +03:00
naive: send signature and raw tx for every tx in the roll
this assumes that the naive contract has a "fallback" function: https://docs.soliditylang.org/en/v0.5.3/contracts.html#fallback-function
This commit is contained in:
parent
98bef023cf
commit
520225056a
@ -76,12 +76,7 @@
|
|||||||
[%log event-log]
|
[%log event-log]
|
||||||
?~ input.u.mined.i.logs
|
?~ input.u.mined.i.logs
|
||||||
[%bat *@]
|
[%bat *@]
|
||||||
=/ len (met 3 u.input.u.mined.i.logs)
|
[%bat u.input.u.mined.i.logs]
|
||||||
=/ fun
|
|
||||||
(rsh [3 (sub len 4)] u.input.u.mined.i.logs)
|
|
||||||
?. =(0x2688.7f26 fun)
|
|
||||||
[%bat *@]
|
|
||||||
[%bat (end [3 (sub len 4)] u.input.u.mined.i.logs)]
|
|
||||||
=/ res
|
=/ res
|
||||||
%- mule
|
%- mule
|
||||||
|.((%*(. naive lac |) verifier chain-id:contracts:azimuth nas input))
|
|.((%*(. naive lac |) verifier chain-id:contracts:azimuth nas input))
|
||||||
|
@ -37,22 +37,10 @@
|
|||||||
~& [%insufficient-aggregator-balance address]
|
~& [%insufficient-aggregator-balance address]
|
||||||
not-sent
|
not-sent
|
||||||
::
|
::
|
||||||
=/ tx-data=@ux
|
::NOTE this fails the thread if sending fails, which in the app gives us
|
||||||
%+ can:naive 3
|
:: the "retry with same gas price" behavior we want
|
||||||
:_ [batch-function ~]
|
;< =response:rpc bind:m
|
||||||
=; =cord
|
%+ send-batch endpoint
|
||||||
=/ parsed=(unit (pair @ud @ux))
|
|
||||||
(de:base16:mimes:html cord)
|
|
||||||
?~(parsed !! u.parsed)
|
|
||||||
%- crip
|
|
||||||
%- encode-args:abi:ethereum
|
|
||||||
:_ ~
|
|
||||||
:- %bytes
|
|
||||||
%+ cad:naive 3
|
|
||||||
%+ roll txs
|
|
||||||
|= [=raw-tx:naive out=(list octs)]
|
|
||||||
[raw.raw-tx 65^sig.raw-tx out]
|
|
||||||
=/ tx=@ux
|
|
||||||
=; tx=transaction:rpc:ethereum
|
=; tx=transaction:rpc:ethereum
|
||||||
(sign-transaction:key:ethereum tx pk)
|
(sign-transaction:key:ethereum tx pk)
|
||||||
:* nonce
|
:* nonce
|
||||||
@ -60,17 +48,19 @@
|
|||||||
gas-limit
|
gas-limit
|
||||||
contract
|
contract
|
||||||
0
|
0
|
||||||
tx-data
|
::
|
||||||
|
%+ can:naive 3
|
||||||
|
%+ roll txs
|
||||||
|
|= [=raw-tx:naive out=(list octs)]
|
||||||
|
:_ [raw.raw-tx out]
|
||||||
|
(met 3 sig.raw-tx)^sig.raw-tx
|
||||||
|
::
|
||||||
chain-id
|
chain-id
|
||||||
==
|
==
|
||||||
::
|
|
||||||
::NOTE this fails the thread if sending fails, which in the app gives us
|
|
||||||
:: the "retry with same gas price" behavior we want
|
|
||||||
;< =response:rpc bind:m (send-batch endpoint tx)
|
|
||||||
%- pure:m
|
%- pure:m
|
||||||
!> ^- (each @ud @t)
|
!> ^- (each @ud @t)
|
||||||
?+ -.response %.n^'unexpected rpc response'
|
?+ -.response %.n^'unexpected rpc response'
|
||||||
%error %.n^message.res
|
%error %.n^message.response
|
||||||
:: TODO:
|
:: TODO:
|
||||||
:: check that tx-hash in +.response is non-zero?
|
:: check that tx-hash in +.response is non-zero?
|
||||||
:: log tx-hash to getTransactionReceipt(tx-hash)?
|
:: log tx-hash to getTransactionReceipt(tx-hash)?
|
||||||
|
Loading…
Reference in New Issue
Block a user