OpenZeppelin / openzeppelin-sdk

OpenZeppelin SDK repository for CLI and upgrades.js. No longer actively developed.
MIT License
431 stars 201 forks source link

Add already deployed contracts to a CLI project #1264

Open gitpusha opened 4 years ago

gitpusha commented 4 years ago

It would be sweet to have a oz CLI command that would let you fetch already deployed contract instances that were not deployed by you via oz create.

This command could be something like oz fetch which then let's you select the contract interface from the build directory and then pass the <deployed instance address>.

This way I could use the oz CLI to interact with any deployed instances, not just the ones I myself deployed from my project.

The fetched contracts could then be listed under

= Your Contracts = > My Contract

= Fetched Contracts = > Some Contract at address

when you hit oz send-tx.

Maybe some advanced stuff would be to have some standard contract interfaces like ERC20 baked into the SDK so that I have the option to oz fetch ERC20s at address without the need for me to include and oz compile an IERC20 first, to have it available from build/.

nventuro commented 4 years ago

This would be extremely useful, making interacting with arbitrary contracts way easier.

We shouldn't need more than the contract's ABI to pull this off. And if the source is verified on Etherscan, we could even pull it from there!

itinance commented 4 years ago

We should extend this with the possibility to pass a custom address for the contract as an argument, together with the appropriate ABI in build-folder in order to make CLI tools work with contract instances, that was created via Factory create method like in this example.

abcoathup commented 4 years ago

This would also allow interacting with minimal proxies created from the ProxyFactory. See post in the Community Forum: https://forum.openzeppelin.com/t/confusion-with-minimal-proxy-deployment-contract-missing/2329/3?u=abcoathup

kushkamisha commented 3 years ago

@abcoathup I could try to resolve this issue. Is it still relevant?

abcoathup commented 3 years ago

Hi @kushkamisha,

Thanks for offering to contribute. ๐Ÿ™

The community can now deploy and test upgradeable contracts using OpenZeppelin Upgrades Plugins (https://docs.openzeppelin.com/upgrades-plugins/1.x/) and then interact with deployed contracts using Buidler or Truffle console, so I am not sure if there is still a direct need for this, so I don't think it would be worth doing at this stage.

kushkamisha commented 3 years ago

Hi @kushkamisha,

Thanks for offering to contribute. ๐Ÿ™

The community can now deploy and test upgradeable contracts using OpenZeppelin Upgrades Plugins (https://docs.openzeppelin.com/upgrades-plugins/1.x/) and then interact with deployed contracts using Buidler or Truffle console, so I am not sure if there is still a direct need for this, so I don't think it would be worth doing at this stage.

Okay, then I'll focus on something else๐Ÿ˜‰