Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to ethers.js #36

Closed
andrewgordstewart opened this issue Nov 4, 2018 · 1 comment
Closed

Switch to ethers.js #36

andrewgordstewart opened this issue Nov 4, 2018 · 1 comment

Comments

@andrewgordstewart
Copy link
Contributor

andrewgordstewart commented Nov 4, 2018

web3 contracts do not work with smart contract functions that return or accept structs.

They are also sometimes unpleasant to work with.

web3 [contracts] silently discards arguments it doesn't recognise the type of, but will complain if it gets the wrong number of arguments

  • or: web3 doesn't validate inputs, causing

3 different representations [of the same private key] create 3 valid, different signed transactions, all thanks to web3 not validating it's inputs

Consider switching to ethers.js, which supports contracts that use the ABIEncoderV2, and is (hopefully) nicer to work with.

Problems:

  • P1: Truffle contracts are a wrapper around web3, so we couldn't use truffle contracts to test ABIEncoderV2 smart contracts.
@andrewgordstewart
Copy link
Contributor Author

P1 Solutions

S1

If we continue to use truffle for testing, we would need to:

  1. take the truffle contract that truffle test deploys on our behalf
  2. fetch its address, abi, and deployed bytecode. hope that they're correct.
  3. create an ethers.js provider, using the web3 provider that truffle test creates for us
  4. instantiate an ethers.js contract using the abi, address and bytecode from step 2, connected to the ethers.js provider created in step 3

S2

We could alternatively switch to testing directly with mocha.

S3

We could use an alternative testing framework, such as waffle, which supports ethers.js contracts.

  • We'd need to make sure [insert framework] is mature enough to be worth switching to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant