populus icon indicating copy to clipboard operation
populus copied to clipboard

Testing: Create contract as user other than web3.eth.coinbase

Open frods opened this issue 6 years ago • 2 comments

  • Populus Version: 2.2.0
  • OS: osx

What was wrong?

When writing tests to validate my code I want to create a contract instance with an account other than web3.eth.coinbase. How do I specify the creating account?

I currently create contracts with chain.provider.get_or_deploy_contract

Alternatively, where can I find complete documentation for what chain provides? So I can figure it out on my own. I've been searching but haven't found a good resource.

Cute Animal Picture

image

frods avatar Mar 04 '18 17:03 frods

where can I find complete documentation for what chain provides?

This is not a documentation, but you can look at the code chain base class or provider.py

See if that helps.

mandarvaze avatar Apr 26 '18 13:04 mandarvaze

You may want to play around with deploy_args or deploy_kwargs. See the code here

I've used deploy_args here. It is just a list of arguments passed to the contract constructor.

How do I specify the creating account?

For reference, Can you share the code to do this via truffle (I assume you are able to do it there, and want an ability to do the same via populus)

mandarvaze avatar Apr 26 '18 13:04 mandarvaze