Commit Graph

158 Commits

Author SHA1 Message Date
Francesco Iannelli bd3a704200
Feat/add call deployer (#554)
* contract: add .call() method to Deployer

It is now possible to dry run a contract deployment.

* add .call() method of Deployer to unreleased

* add PR to changelog
2021-11-04 15:02:05 +02:00
David Tolnay 325b752144
Fix missing fmt argument in error message (#552)
* Clean up strange non-multiple-of-4 indentation in Source::with_root

* Fix missing fmt argument in error message

* Add changelog entry for PR 552
2021-11-03 10:03:42 +02:00
Matthias Seitz a07838eaf5
fix: preserve underscores in case of collisions (#548)
* fix: overloaded with same type arguments

* fix: numerate overloaded functions

* docs: add note

* chore: update changelog

* style: rename vars

* fix: draft underscore fix

* fix: underscore aliases
2021-11-01 01:06:31 +02:00
Georgios Konstantopoulos f0dea75219
feat: use ethers_solc::Solc instead of ethers_core::utils::Solc (#546)
* feat(ethers-solc): deserialize bytecode as bytes

* feat(ethers-solc): add method to fetch compact contract

* feat(ethers-solc): use Abi type instead of Vec<serde_json::Value>

* test(contract): use new Solc bindings

* test(middleware): use new Solc bindings

* chore: remove solc from ethers-core

* chore: remove concurrent setup code from ethers-core

* feat(ethers-solc): add ArtifactOutput::Nothing as a no-op artifact logger

* feat: add ethers-solc to top level crate

* examples: use new solc building pattern

* chore(solc): re-use opt str impl for error code decoding

* fix abigen example

* chore: fix doctests

* chore: remove setup feature

* fix: decode string to bytes correctly

* chore: clippy lints
2021-10-31 13:34:51 +02:00
Matthias Seitz 4123823383
feat: enumerate overloaded functions if they are nameless (#545)
* fix: overloaded with same type arguments

* fix: numerate overloaded functions

* docs: add note

* chore: update changelog

* style: rename vars
2021-10-31 13:24:02 +02:00
Matthias Seitz dcf20022c6
chore: add rustfmt.toml (#537)
* chore: add rustfmt.toml

* rustfmt

* chore: Update readme with fmt info

* ci: update ci

* chore: rustfmt

* rustfmt

* rustfmt

* ci: install libudev

* chore(clippy): make clippy happy

* chore(clippy): make clippy happy

* revert ci

* ci: install libudev
2021-10-29 14:29:35 +02:00
Matthias Seitz eede86df41
feat: add abi code trait impls (#531)
* feat: use const generics for array tokenize

* feat: add abi encode decode impls

* test: add some tests

* chore: move abi codec to core

* update changelog
2021-10-28 01:07:24 +03:00
Alexey Shekhirin cba1a85483
refactor(core, contract, etherscan): move Chain enum, use HashMap::from (#524)
* refactor(contract, etherscan): make use of HashMap::from

* feat(core): Chain enum

* rename unknown chain error

* reorg imports
2021-10-24 21:41:50 +03:00
Matthias Seitz 5779a3cdaf
feat: add ethabitype support for solidity style enums (#526)
* feat: tokenize solidity like enums

* test: add enum test

* rustfmt
2021-10-24 20:58:41 +03:00
Matthias Seitz b072b05515
fix: use debug fmt for nested arrays (#527) 2021-10-24 17:02:06 +03:00
Matthias Seitz dbd3929b74
test: add underscore test (#505)
* test: add underscore test

* test: ensure underscore fn names are correctly encoded against live contract

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
2021-10-22 14:25:46 +03:00
Sebastian Martinez 9db36e59fb
fix: eip712 signing with ledger hw (#518)
* fix: eip712 signing with ledger hw

This commit fixes the way a EIP712 derived struct is sent to the
Ledger HW to obtain the signature.

It also checks if the Ledger ETH app is at least 1.6.0 since this
is a requirement.

* fix: apply cargo fmt

* fix: revert ledger eip712 test

* refactor: remove unused code

* test: add ledger eip712 test

* fix: cargo fmt

* fix: move the logic to app.rs

* feat: make sign_typed_data take a reference

* chore: ensure abigen is enabled in ledger tests

we need this to compile ethers-contract as a standalone package

* test: ensure that the ledger sig verifies

* test: pass foo_bar by ref

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
2021-10-19 11:52:36 +03:00
Matthias Seitz fb4d9a9ef1
feat: function call enums EthCall macro and more (#517)
* fix: do not sort event variants

* style: use deref over clone

* style: refactor some stuff

* feat: add ethcall trait

* feat: include in abigen

* feat: add bare bones eth call derive

* feat: impl EthCall derive

* feat: support enums

* feat: use abigen enum derive

* fix: concrete abi and map errors

* test: first call test

* rustfmt

* chore: use correct trait name on error

* feat: derive display for call structs

* feat: add from conversion

* test: add convert test

* chore: docs and test

* chore: update changelog

* cargo fix

* feat: add unit type derive support and more test

* chore: patch ethabi

* chore: rm ethabi patch

* feat: add encode/decode trait impls

* style: use AsRef<[u8]>

* Update ethers-contract/ethers-contract-abigen/src/contract/methods.rs

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>

* style: reindent macro body

* test: add tuple event test

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
2021-10-18 13:28:38 +03:00
Matthias Seitz c3528b78db
fix: use syn::Index for tuple access (#515)
* fix: use syn::Index for tuple access

* rustfmt
2021-10-16 19:45:42 +03:00
Matthias Seitz bef7960a2b
feat: add display support for events (#513)
* chore: move proc macro implementation to separate modules

* feat: add display derive macro

* chore: reexport hex

* feat: add EthDisplay

* test: add display test

* fix: use ? op

* feat: derive EthDisplay in abigen

* feat: derive display for event enum

* chore: update changelog
2021-10-16 16:42:17 +03:00
Matthias Seitz 4608ddd9fa
chore: move proc macro implementation to separate modules (#510) 2021-10-16 11:19:42 +03:00
Matthias Seitz 44bb02f857
feat: substitute overloaded functions (#501)
* feat: substitute overloaded functions

* chore: update changelog
2021-10-13 12:53:43 +03:00
Matthias Seitz ea8551da4c
feat: add support for multiple contract definitions in abigen macro (#498)
* feat: support multiple contracts in abigen

* fix: use correct events decl

* fix: parsing and tests

* test: add test

* chore: update changelog
2021-10-11 17:18:09 +03:00
dependabot[bot] 6d9b300b86
chore(deps): bump thiserror from 1.0.29 to 1.0.30 (#500)
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.29 to 1.0.30.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.29...1.0.30)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-11 15:42:55 +03:00
Matthias Seitz 6216b2e4a2
chore: remove unused && cargo fix (#496)
* chore: rm allows

* chore: cargo fix
2021-10-10 09:31:34 +01:00
Georgios Konstantopoulos 0c94b58cd5
chore: simplify eip712 example (#492)
* chore(contract): gate eip712

* examples: simplify permit hash

* chore: fmt
2021-10-08 17:31:42 +01:00
Ryan d7ab229a4c
derive-eip712: initial implementation of eip712 derive macro (#481)
* derive-eip712: initial implementation of eip712 derive macro

This commit provides an initial implementation for a derive macro
to encode typed data according to EIP-712, https://eips.ethereum.org/EIPS/eip-712

Additionally, this commit introduces a new signer trait method:

    async fn sign_typed_data<T: Eip712 + Send + Sync>(
        &self,
        payload: &T,
    ) -> Result<Signature, Self::Error>;

And implements the new method for each of the signers (wallet, ledger,
aws).

Additionally, these changes include using `WalletError` for the Wallet
signer error type

At the moment, derive does not recurse the primary type to find nested
Eip712 structs. This is something that is noted in the source and
currently responds with an error regarding custom types.

A subsequent PR should be opened once this issue becomes needed. For the
moment, the current implementation should satisfy non-nested, basic struct types.

* rename to ethers-derive-eip712; move to ethers-core

* refactor of derive-eip712 macro; use ParamType and EthAbiToken

* macro updates; add byte array checker for paramtype; use literal constant for domain type hash

* replace std::convert::Infallible with WalletError as Wallet signer error type

* update workspace members and dev dependencies for examples folder

* add example for eip712 and test against contract

* remove extraneous backward slash in '\x19\x01' prefix; example tests pass

* update unreleased change log

* remove print statements

* use parse_macro_input macro; remove dead code; handle nest struct not implemented error

* move eip712 example to solidity-contract tests folder; update cargo workspace dependencies

* allow optional EIP712Domain parameter when encoding eip712 struct and signing typed data

* add documentation for eip712 feature

* Update ethers-signers/src/ledger/mod.rs

Co-authored-by: Sebastian Martinez <me@sebastinez.dev>

* add error enum for Eip712Error; use sign_payload for ledger signer

* add EIP712WithDomain type for providing a wrapper around custom setting of the domain

* make LedgerWallet sign_payload public

* use optional feature gated dependencies for eip712; add default method for encode_eip712

* add default domain_separator method, pre-compute separator hash

* move derive-eip712 deps to dev deps

* remove invalid sign payload parameter, add await on async method

* remove deprecated comment

* debugging 'bad key handle' error for ledger signer

try using 'sign_message'

* await sign digest for aws signer

* remove extra space, fix fmt warning

* fix test, fmt errors

* use gt 0.6.0 pragma compiler version

* enable ABIEncoderV2 for solidity test contract

* chore: make test constructor public

Co-authored-by: Sebastian Martinez <me@sebastinez.dev>
Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
2021-10-08 16:22:51 +01:00
georgewhewell 7d2e900cbb
fix: allow clippy::redundant_clone and clippy::type_complexity in abigen (#491) 2021-10-08 15:14:16 +01:00
Alexey Shekhirin 1f17788133
feat(contract, abigen): support artifact format in proc macro (#480)
* feat(contract, abigen): support artifact format in proc macro

* don't change source abi_str
2021-10-02 20:16:55 +03:00
Matthias Seitz 42bf98330b
feat: support human readable struct inputs (#482)
* feat: keep track of custom types in abi parser

* feat: use internal structs for abi parsers

* test: add human readable struct input test

* chore: update changelog

* fix conflicts

* fix: remove eprintln

* make clippy happy

* make clippy happy

* rustfmt

* make clippy happy
2021-10-02 17:34:01 +03:00
Alexey Shekhirin 4036f45f3d
feat(contract, abigen): support Hardhat ABI format (#478) 2021-09-30 11:27:24 +03:00
Georgios Konstantopoulos 8574e6a376
release: 0.5.3 (#471)
* release: version 0.5.3

* chore: update changelog
2021-09-27 13:20:10 +03:00
Georgios Konstantopoulos a6918aed2b
fix(ethabi): breaking changes and force enable serialize for eth-types (#448)
* fix(ethabi): breaking changes and force enable serialize for eth-types

* chore(ethereum-types) enable rlp
2021-09-13 20:43:54 +03:00
Georgios Konstantopoulos 77bc5aa30f
feat: expand solc capabilities / chore: update ethabi (#445)
* chore: use ethabi with bumped ethereum-types

* fix: do not use internal type in human readable abi

* fix: do not use internal type in abigen

* feat(solc): save the runtime bytecode

* feat: implement serde for CompiledContract

* feat: allow overriding solc binary path

* feat: expose providing raw file paths

* feat: do not set evm versions on old solc

* chore: use upstream ethabi
2021-09-13 15:35:50 +03:00
dependabot[bot] 6a938158b6
chore(deps): bump thiserror from 1.0.28 to 1.0.29 (#433)
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.28 to 1.0.29.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.28...1.0.29)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-06 11:33:01 +03:00
Matthias Seitz 32c75ab1f5
fix: cleanup lock file after exec cargo metadata (#431)
* fix: cleanup lock file after exec cargo metadata

* fix typos
2021-09-05 13:19:08 +03:00
TannrA 32ad5a6abd
Event aliasing for contract bindings (#425)
* contracts: enable event aliases for Abigen

* contract: unit tests for event aliases

* contract: cleanup expand_event function

* Address pr suggestions

* contracts: remove unnecessary clone

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>

* Make clippy happy

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
2021-09-03 18:57:40 +03:00
Matthias Seitz 8b5f4bfa81
fix: always treat abi type structs as tuples (#417)
* fix: always treat abi type structs as tuples

* fix: keep decoding for single field structs

* feat: unify event and struct encoding
2021-09-02 19:16:39 +03:00
dependabot[bot] 4128363f3c
chore(deps): bump thiserror from 1.0.26 to 1.0.28 (#419)
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.26 to 1.0.28.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.26...1.0.28)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-31 13:55:22 +03:00
dependabot[bot] 404e9c2416
chore(deps): bump futures-util from 0.3.16 to 0.3.17 (#423)
Bumps [futures-util](https://github.com/rust-lang/futures-rs) from 0.3.16 to 0.3.17.
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.16...0.3.17)

---
updated-dependencies:
- dependency-name: futures-util
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-31 08:48:24 +03:00
Georgios Konstantopoulos 9df4d21d3b
(cargo-release) version 0.5.1 (#414) 2021-08-29 02:53:10 +03:00
Georgios Konstantopoulos 38c7f5030f
chore: remove cyclical dependencies (#410)
* chore(core): remove ethers dep

* chore(providers): remove ethers dep

tests using higher-rank crates are temporarily disabled

* chore(middleware): remove ethers dep and move tests over from providers

* chore(signers): remove ethers dep

* fix(contracts): correctly determine ethers sub-crates & remove ethers

* fix: re-enable tests for all members

* fix: make contract compile without middleware dep

move over the test using middleware to ethers-middleware

* chore: cargo fmt

* chore(contract): add missing import

* WIP

* WIP

* fix(middleware): use rustls as dev dep

* chore: cargo fmt

* fix: use different key for nonce manager to avoid nonce conflicts

* chore: fix celo test ported over to middlewares

the test had the same private key with an existing middleware test,
causing potential nonce reuses

it now also uses a different storage contract, so we had to change
it to use u256 instead of string

* fix(middleware): enable contracts/celo feature

* chore: ignore non-eip2718 txs to rinkeby
2021-08-29 00:06:29 +03:00
Georgios Konstantopoulos 6cc20688d0
fix(abigen): generate correct imports depending on ethers crate usage (#413) 2021-08-28 21:53:01 +03:00
Matthias Seitz d35444cc49
feat: add wasm http provider support (#403)
* fix: use on wasm only

* feat: enable http provider in wasm

* add http example

* chore: add more verbosity to example

* fix: double webpack issue

* use mnemonic builder
2021-08-24 01:28:05 +03:00
Nick Hynes 26324343ec
fix: use once_cell with feature=std in abigen (#401) 2021-08-23 14:50:55 +03:00
Matthias Seitz ea566663d4
feat: wasm support (#390)
* feat: partial wasm32 support

* make compile for wasm32

* feat: att async-trait attr

* make compatible with wasm

* add type alias for archs

* rustfmt

* add wasm ci

* make compile with wasm-pack test

* make compile with wasm-pack test

* make compile with wasm-pack test

* make compile with wasm-pack test

* ci: disable wasmpack

* feat: use wasm timer delay

* feat: add wasm provider

* rustfmt

* misc refactor

* add wasm example

* make example a directory

* untrack error log

* move profile to root

* fix unused imports

* ci: enable wasm-pack test

* style: unify websocket implementations

* fix: typos

* fix: make policy compatible with wasm target

* chore: do not include ethers-wasm example as top level workspace member

* chore: modify wasm32 dependencies

* chore: make note about getrandom

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
2021-08-23 12:56:44 +03:00
Georgios Konstantopoulos 8891ed38b4
chore: pull ethers to top level directory (#398)
* chore: pull up ethers to top level directory

* chore: enable ws feature when running examples

* chore: fix paths

* chore: enable ipc feature when running examples
2021-08-21 15:34:21 +03:00
Rohit Narurkar ad779c867f
feat: fee estimation with custom/default fn (#369)
* feat: fee estimation with custom/default fn

* fix: clippy and percentage calc fix

* calculate priority fee only if base fee above threshold

* chore: some comments

* fix: use legacy tx for ganache

* test: test a few cases for fee estimation using utils
2021-08-19 17:01:40 +03:00
James Prestwich 42aeeedcce
bug: log streams properly end when internal stream closes (#387) 2021-08-19 10:01:49 +03:00
Georgios Konstantopoulos 6cb7cac675
Release: 0.4 (#382)
* fix(abigen): use `no_deps` to avoid touching a Cargo.lock

* fix: use once_cell default features

* release: publish versions

core/providers/signers: 0.4.6
contract: 0.4.7
middleware: 0.4.8
ethers: 0.4.0
2021-08-16 11:54:12 +03:00
Matthias Seitz ba5f650dec
feat: generate rust structs from solidity JSON ABI (#378)
* add raw abi model

* feat: simplify struct representation

* feat: add struct generation

* use structs as function input

* fix: failing test

* add example

* rustfmt
2021-08-16 10:29:44 +03:00
Georgios Konstantopoulos 453504cb78 chore: remove default feature on futures-util from all crates 2021-08-15 20:25:11 +03:00
Georgios Konstantopoulos 60ff4660df
feat: multiple addresses on Filter (#375)
* feat: support multiple addresses in filters

To support filtering of 1..n addresses we had to add the ValueOrArray
enum to the log types and refactor some ethers-contract code

Fixes: #240

Signed-off-by: Sebastian Martinez <sebastinez@me.com>

* chore: fmt

* fix: use legacy tx in unit test due to Ganache

Co-authored-by: Sebastian Martinez <sebastinez@me.com>
2021-08-12 19:19:24 +03:00
Matthias Seitz 109a6b85ee
fix: only wrap single struct param in a tuple (#368) 2021-08-11 03:21:30 +03:00
Georgios Konstantopoulos 25c2e0e199
feat(ethers-contract): typed txs (part 4) (#362)
* feat(contract): use eip-1559 txs by default

This may break any tests which use Ganache, since it only supports legacy transactions.
We should replace Ganache with hardhat where possible

* fix(providers): always try setting default_sender

* chore: make all test transactions legacy

* feat(multicall): allow submitting legacy txs

* chore: default to legacy txs via feature flag

This is useful for chains like Celo that do not support the Typed Envelope

* fix: use legacy txs in ds proxy deployment / tests

* chore: fix review comments
2021-08-09 03:50:38 +03:00