Commit Graph

14 Commits

Author SHA1 Message Date
Matthias Seitz b5a2ee9a3d
fix: event decoding for events with zero or one parameters (#300)
* fix: support events with zero or one paramaters

* test: test against events with zero and one parameter
2021-05-28 10:44:42 +03:00
Matthias Seitz ac6d4d70a6
fix: off by one error during event decoding (#296) 2021-05-24 11:52:21 +03:00
Matthias Seitz 816c5fc071
feat(abigen): extend ethevent trait methods and decoding (#239)
* feat: extend EthEvent with decode_log method and support indexed proc
macro attributes

* test: check that ethevent proc macro attributes compile

* docs: document EthEvent proc macro attributes and add example

* refactor: change decode_log to take a reference

* refactor: use ethers as fully qualified path

* feat: add events enum generation

* feat: introduce EthLogDecode trait

* feat: generate EthLogDecode implementations

* refactor: use fully qualified syntax during abigen

* fix: switch to new Event builder

* fix: make test compile again

* test: update failing tests

* refactor: rename event function

* chore(clippy): make clippy happy

* fix: rename the event correctly

* fix: add missing indexed attribute

* Revert "fix: rename the event correctly"

This reverts commit 03eabc3ead.

* fix: make indexed names optional

* fix: dsproxy name

* fix: rename ethers top level module imports
2021-03-19 17:44:59 +02:00
Matthias Seitz 57010c1c60
feat(abigen): include ethevent proc macro in abigen code gen workflow (#232)
* fix: make EthEvent name method a trait method

* refactor: make expand methods members of Context

* fix: make AbiParser parsing non consumeable

* feat: add struct expanding

* feat: use derive(EthEvent) in abigen workflow

* test: check EthEvent in abigen macro

* test: make test compile again

* refactor: simplify and optimize abi parsing from single str

* test: add human readable abigen tests
2021-03-16 21:37:19 +02:00
Matthias Seitz 0c18f9b32c
fix: make EthEvent abi attribute work for tuple inputs (#229)
* fix: try to parse the provided abi as tuple

* test: validate ethevent abi attribute

* docs: document ethevent abi attribute
2021-03-16 10:12:32 +02:00
Matthias Seitz 7b10b76e20
feat: add EthEvent proc macro derive support (#227)
* refactor: extract error module and use error macros

* feat: add solidity struct parser

* refactor: add AbiParse and support struct parsing

* test: add more struct parsing tests

* feat: add EthAbiType proc macro derive for deriving Tokenizable trait

* test: add EthAbiType derive tests

* refactor: extract tokenizeable implementation in separate method

* chore(test): use EthAbiType derive instead implementing Detokenizeable

* feat: introduce EthEvent trait

* feat: add EthEvent proc macro derive support

* test: add proc macro derive tests

* chore: rustfmt

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
2021-03-15 13:59:52 +02:00
Georgios Konstantopoulos 29a3a16085
chore: upgrade to latest ethtypes (#137)
* chore: upgrade to latest ethtypes

* chore: fix doctests
2021-01-10 14:03:37 +02:00
Georgios Konstantopoulos 62b7ce4366
feat: Transaction Gas Price Escalator middleware (#81)
* fix(signers): make Signer send by blocking on Ledger calls

* fix(providers): use Arc in WS impl to allow cloning

* feat(middleware): add geometric gas price escalator

* test(middleware): ensure that we can still stack everything up

* fix(middleware): default to tokio/async-std

* chore: fix clippy

* docs(middleware): add docs and rename middlewares

* chore: fix doctests

* feat: add linear gas escalator

https://github.com/makerdao/pymaker/blob/master/tests/test_gas.py\#L107
https://github.com/makerdao/pymaker/blob/master/pymaker/gas.py\#L129

* feat: add constructors to gas escalators
2020-10-08 18:56:36 +03:00
Georgios Konstantopoulos aa37f74c4b
feat: generalize wallet/private key + yubihsm2 (#75)
* feat: generalize wallet/private key

* fix: adjust celo tests

* YubiHSM2 Support (#76)

* feat: support YubiHSM2
2020-10-02 11:41:16 +03:00
Georgios Konstantopoulos 2d51c523ba
feature: Middleware Architecture (#65)
* feat: convert Provider to Middleware trait

* feat: move gas oracle to middleware crate

* feat: move signer to middleware crate

* feat: add nonce manager middleware and test stacking

* refactor: convert generic middleware jsonrpc type to associated type

* feat: move ethers-contract to middleware arch

* test(provider): make tests pass

* test(middleware): move middleware tests from signer

* test: fix ethers examples

* fix(contract): make tests compile

* chore: fix clippy

* feat: deduplicate trait delegation

* refactor(signer): deduplicate tx signing logic across signers

* fix doctests

* fix: examples, celo tests and ci
2020-09-25 00:33:09 +03:00
Rohit Narurkar a9bb98b5a7
Implement Multicall functionality for batched calls (#43)
* Implement Multicall functionality for batched calls

* Documentation, some modifications as suggested in the review

* (Abigen) handle single input arg and set output irrespective of mutability

* implement send functionality and allow clearing calls

* Fix detokenization, dont require pre-processing anymore

* panic when more than supported number of calls are pushed

* add doc for panics in case of add_call

* (multicall) eth_balance support, update bindings

* refactor: move multicall to its own directory

* fix: add infura api key

* ci: ensure CI runs on PRs from forks

* test(multicall): re-use aggregate call

* contract: make multicall docs compile and remove redundant clones

* ci: add public etherscan API key so that forks don't get rate limited

* chore: adjust test contract naming

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
2020-07-03 19:52:09 +03:00
Georgios Konstantopoulos bb1ac9c666
Improve Ganache Flexibility (#37)
* feat(core): add more features to ganache

* test(provider): choose endpoint dynamically

* test(signer): choose endpoint and accounts dynamically

* test(contract): choose endpoint and accounts dynamically

* fix: dynamic port / accounts in examples

* core(chore): fix doctest
2020-06-22 16:42:34 +03:00
Georgios Konstantopoulos 1cfbc7b3c3
Replace contract client references with Arc (#35)
* feat(provider): allow specifying a default polling interval param

This parameter is going to be used for all subsequent client calls by default. It can still be overriden with the internal
`interval` calls

* feat(contract): replace reference to Client with Arc

* feat(abigen): adjusts codegen to use Arcs

* fix(ethers): adjust examples to new apis

* fix(provider): return TxHash instead of PendingTransaction on tx submission

Returning a PendingTransaction allowed us to have nice ethers.js-like syntax where you submit
a transaction and then can immediately await it. Unfortunately, now that we use Arcs and not lifetimes
this meant that we would need to bind the function call in a variable, and then await on it, which is pretty
bad UX.

To fix this, we revert back to returning a TxHash and introduce a convenience method on the provider and the
contract which takes a tx_hash and returns a PendingTransaction object. The syntax ends up being slightly
more verbose (although more explicit), but the issue is fixed.
2020-06-22 11:44:08 +03:00
Georgios Konstantopoulos d90b03da06
Add streamed logs to the provider (#9)
* feat(provider): implement Streamed logs

This utilizes eth_getFilterChanges. The stream struct must be instantiated with a factory that yields logs/hashes.
Consumers are expected to use the `FilterStream` trait in order to simplify their type definitions

* feat(provider): expose streaming methods

* test(provider): add new blocks/pending txs test

* feat(contract): allow events to be streamed

* test(contract): add integration test for streaming event logs

* perf(contract-factory): take abi and bytecode by value instead of reference

The abi, bytecode and the factory's deploy method now consume the structs instead of being passed by reference. While this means that
consumers might need to clone before using them, this gives us some more flexiblity around factories inside helper functions

* refactor(contract): use test helpers to reduce code dup

* chore: make clippy happy
2020-06-15 11:46:07 +03:00