Skip to content
This repository has been archived by the owner on Jan 24, 2022. It is now read-only.

A method to read Contract JSON from DB and deploy #1562

Open
code-ishwar opened this issue Jul 7, 2020 · 3 comments
Open

A method to read Contract JSON from DB and deploy #1562

code-ishwar opened this issue Jul 7, 2020 · 3 comments
Labels
kind:enhancement Enhancement to an existing feature

Comments

@code-ishwar
Copy link

code-ishwar commented Jul 7, 2020

Hi,

We are using OZ for deploying contracts in workflows. Can you add a feature to read raw text and create deployment?
Here is the sample code:
static createFromText(rawText: string): Contract; //Add this to Contracts.d.ts

//Add this to Contracts Class in Contracts.js


static createFromText(rawText){
      const schema = JSON.parse(rawText);

      if(schema == undefined)
          throw new Error(`Valid schema needed for contract ${schema.contractName}.`);
      if (schema.bytecode === '')
          throw new Error(`A bytecode must be provided for contract ${schema.contractName}.`);
      if (!Bytecode_1.hasUnlinkedVariables(schema.bytecode)) {
          schema.linkedBytecode = schema.bytecode;
          schema.linkedDeployedBytecode = schema.deployedBytecode;
      }
      return Contract_1.createContract(schema);
    }


@abcoathup
Copy link
Contributor

Hi @thesolyd ! Thanks for the suggestion, it is really appreciated.

Can you provide more information on your use case?

Once we have more information, the project owner will then review your suggestion as soon as they can.

Please wait until we have discussed this idea before writing any code or submitting a Pull Request, so we can go through the design beforehand. We don’t want you to waste your time!

@cyberiums
Copy link

Hi @abcoathup

The code is already developed and deployed by us in our production servers. We just wanted to make this as a contribution to the community.
Here is the use case: We process 1000s of smart contracts which are read for DB. There are no suitable methods available in OZ contract loaders for reading ABI from DB. Therefore we built the rawtext overloading. It seems that OZ is developed around precipse that all contracts will be read from disk. That's not enterprise thinking.
BTW we LOVE OZ and are very very grateful to the community and core developers. Hope we meet and guzzle champagnes soon enough to celebrate this awesome platform.

@abcoathup
Copy link
Contributor

Hi @cyberiums,

If you can hold off submitting a Pull Request, so the project owner can review your suggestion. We don’t want you to waste your time!

Thanks for the OpenZeppelin love!! I look forward to when we can all travel again and enjoy restaurants and bars.

@abcoathup abcoathup added the kind:enhancement Enhancement to an existing feature label Aug 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind:enhancement Enhancement to an existing feature
Projects
None yet
Development

No branches or pull requests

2 participants