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

Deployment of contracts #13

Open
0xsarvesh opened this issue May 9, 2019 · 3 comments
Open

Deployment of contracts #13

0xsarvesh opened this issue May 9, 2019 · 3 comments

Comments

@0xsarvesh
Copy link
Contributor

#12 Generates the interacts using typechain package. This interact doesn't have deploy method.

Generated interacts are extended from web3.eth.Contracts class which has deploy method. Theoretically, deploy should be available to the interact.

  1. This ticket is about finding if the deploy method can be used to deploy interacts by using web3 types and implementing it.

  2. If the deploy method can't be used, research how other projects are deploying contracts using type chain. Select and implement the best approach.

If nothing works, then write a simple utility to deploy contracts.

References:
https://www.npmjs.com/package/@types/web3
https://www.npmjs.com/package/web3-typescript-typings

@schemar schemar added this to the sprint 1 milestone May 27, 2019
@schemar schemar self-assigned this May 27, 2019
@schemar
Copy link
Contributor

schemar commented May 27, 2019

  1. It seems TypeChain provides type safety, nothing else. This means that TypeChain is not responsible for deploying a contract.
  2. The createAndValidate method seems to only exist in the legacy version (expected contract to be already deployed anyways)

The "normal" use case in Web3 is to use deployed contracts, not necessarily to deploy new ones. It is easy to access a deployed contract and have type safety with TypeChain.

I will now check how other projects use TypeChain. I assume I will have to write a (very thin) wrapper.

@schemar
Copy link
Contributor

schemar commented May 27, 2019

grafik
Wow, only one package depends on TypeChain on npmjs ...

@schemar
Copy link
Contributor

schemar commented May 28, 2019

So. I would say that we don't write a thin wrapper, but I am sure not everyone has the same opinion so we can discuss.

We provide all the type definitions that a user needs to properly interact with our contracts. if you want to use that to deploy contracts: fine, deploy the contracts the way you deploy contracts. If you want to use that to interact with deployed contracts: fine, interact with the on-chain contracts the way you would interact with on-chain contracts.

I am not sure a wrapper would be super beneficial. On the other hand, it always must be kept up-to-date and maintained. Plus potential conflicts with outdated Web3 versions in this repo (like now with mosaicjs and mosaic chains).

It's not that hard to deploy a contract using Web3.

const organization = new web3.eth.Contract(Organization.abi);
organization.deploy(
  Organization.bin,
  args...
);

What do you think?

@schemar schemar removed their assignment May 28, 2019
@deepesh-kn deepesh-kn removed this from the sprint 1 milestone May 29, 2019
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

3 participants