populus icon indicating copy to clipboard operation
populus copied to clipboard

ContractFactory classes do not retain their names.

Open pipermerriam opened this issue 7 years ago • 4 comments

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 avatar Apr 04 '17 20:04 pipermerriam

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

pipermerriam avatar Apr 04 '17 20:04 pipermerriam

I could give this a try.

Does the contract_identifier argument contain the name of the contract?

palash25 avatar Apr 15 '18 20:04 palash25

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

owocki avatar Jul 23 '18 22:07 owocki

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.

jhselvik avatar Jul 23 '18 22:07 jhselvik