ApeWorX / ape

The smart contract development tool for Pythonistas, Data Scientists, and Security Professionals
https://apeworx.io
Apache License 2.0
890 stars 131 forks source link

Unable to have contract attribute named 'balance' #627

Closed antazoey closed 2 years ago

antazoey commented 2 years ago

Environment information

$ ape --version
0.1.4.dev19+g66743a22.d20220401

$ ape plugins list
Installed Plugins:
  solidity     0.1.0
  etherscan    0.1.1.dev4+g0edd4eb.d20220329
  fantom       0.1.1
  alchemy      0.1.0
  ens          0.1.1.dev1+g9516d0b
  infura       0.1.1.dev1+g0665321
  starknet     0.1.dev16+g96cb099.d20220401
  vyper        0.1.0
  tokens       0.1.0
  hardhat      0.1.3.dev1+g27fc667
  cairo        0.1.dev6+g36e9667
  jules        0.1.dev29+gbef3bf6

What went wrong?

My Cairo contract has a storage var named balance() but I can't access it because that is also a member of AddressAPI.

How can it be fixed?

Have a way to call methods by string name, such as:

contract.methods["nonce"]()
evmBrahmin commented 2 years ago

I've run into a similar issue as the above. I am attempting to call the nonce() attribute of a gnosis-safe proxy contract. The safe contract stores the number of multi-sig transactions in a public variable called nonce which clashes with the nonce member of the AddressAPI

Agreed that the solution proposed by @unparalleled-js would be ideal for resolving this issue. Happy to take a crack at this.

antazoey commented 2 years ago

Happy to take a crack at this.

I will support you!