Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contract.balance function name collision with contract #718

Open
fubuloubu opened this issue Aug 18, 2020 · 0 comments
Open

Contract.balance function name collision with contract #718

fubuloubu opened this issue Aug 18, 2020 · 0 comments

Comments

@fubuloubu
Copy link
Contributor

Environment information

  • brownie Version: 1.9.10
  • ganache-cli Version: n.f.c
  • solc Version: 0.6.2
  • Python Version: 3.8.5
  • OS: linux

What was wrong?

Traceback (most recent call last):
  File "/home/bryant/.pyenv/versions/3.8.4/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/home/bryant/.pyenv/versions/3.8.4/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/home/bryant/.pyenv/versions/3.8.4/envs/brownie/lib/python3.8/site-packages/brownie/network/contract.py", line 195, in _add_from_tx
    self.at(tx.contract_address, tx.sender, tx)
  File "/home/bryant/.pyenv/versions/3.8.4/envs/brownie/lib/python3.8/site-packages/brownie/network/contract.py", line 178, in at
    contract = ProjectContract(self._project, build, address, owner, tx)
  File "/home/bryant/.pyenv/versions/3.8.4/envs/brownie/lib/python3.8/site-packages/brownie/network/contract.py", line 772, in __init__
    _DeployedContractBase.__init__(self, address, owner, tx)
  File "/home/bryant/.pyenv/versions/3.8.4/envs/brownie/lib/python3.8/site-packages/brownie/network/contract.py", line 334, in __init__
    self._check_and_set(abi["name"], fn)
  File "/home/bryant/.pyenv/versions/3.8.4/envs/brownie/lib/python3.8/site-packages/brownie/network/contract.py", line 345, in _check_and_set
    raise AttributeError(f"Namespace collision: '{self._name}.{name}'")
AttributeError: Namespace collision: 'yVault.balance'

How can it be fixed?

This reaches deep into the API, so a proper fix has to come with #399

As a temporary hack, you could allow overwriting .balance when there's an ABI method of the same name. You are still able to query balances using RPC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants