9

Contracts\Libraries like ERC20 and SafeMath have probably been deployed many times to Ethereum. How do I find their addresses so I can reuse their logic instead of coping them and deploying them by myself?

I see old posts from last year talking that no standard library was deployed yet... Is still this the case?

Deploying copied code just sounds so wastefull...

  • With ERC20, at least, individual tokens may implement the backend differently, so a library would not necessarily be usable. – Matthew Schmidt Aug 7 '17 at 13:46
4

Deploying duplicate code is wasteful, and what you want is completely reasonable.

At the moment, there is realistically no way to achieve this. You could compare the bytecode of all deployed contracts on the chain to discern if it is already deployed but this is probably more 'expensive' (at least from a time investment POV) than simply redeploying.

You should probably take a look at ethpm - a work in progress package manager for Ethereum libraries which hopes to resolve the issues that you outline.

  • 1
    It is odd that no one simply made a simple list on github of useful contract addresses. Or at least when one writes a library, deploys it, and publishes the code on github, one could also make a note of the deployed address so that others could link to it. – whomaniac Aug 7 '17 at 16:04
  • Trouble with this of course is that people lie about what’s in the library and if other people use it are not careful (very few people are) the library could simply steal your Ether. It wouldn’t happen all the time but it could happen. I wonder what kind of vetting goes on in ethpM. – Thomas Jay Rush Apr 27 '18 at 1:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.