ethereum / populus

The Ethereum development framework with the most cute animal pictures
http://populus.readthedocs.org/
320 stars 321 forks source link

ContractFactory classes do not retain their names. #281

Open pipermerriam opened 7 years ago

pipermerriam commented 7 years ago

migrated from: https://github.com/pipermerriam/web3.py/issues/172

What was wrong?

Currently the contract object does not know its own name (the contract name in the source code).

 contract.__class__.__name__ 
'PopulusContract'

Cute Animal Picture

                              (__)
          (__)                [@@]          ?  (__)  ?              (__)
          (oo)              <=|^^|=>       ?   (oo)   ?         |\/|(oo)
   /-------VV       /--------- \/       /-------\/           /--| \--\/
  / |     ||       / |       ||        / |     ||           / |     ||
 *  ||----||      /  |       ||       *  ||----||          *  ||----||
    ^^    ^^      *  ||------||          ^^    ^^             ^^    ^^
                     ^^      ^^
  Cownt Dracula     Francownstein       Where Cow             Cow bird
      Cow                Cow
pipermerriam commented 7 years ago

Implementing this should be as easy as adding a contract_name keyword argument here

https://github.com/pipermerriam/populus/blob/master/populus/contracts/contract.py#L66-L70

palash25 commented 6 years ago

I could give this a try.

Does the contract_identifier argument contain the name of the contract?

owocki commented 6 years ago

@pipermerriam @carver any interest in having a gitcoin bounty hunter, @jhselvik work on this?

jhselvik commented 6 years ago

Seems easy enough. Just adding contract_name=contract_identifier or something like contract_data['name'] to the return line in the construct_contract_factory function. Maybe add a test to the test_get_contract_factory.py file.

Currently the contract_identifier argument is unused.