-
Notifications
You must be signed in to change notification settings - Fork 155
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
subclassing safe doesn't work #972
Labels
bug
Something isn't working
Comments
Could you provide some info? We subclass safe-eth-py/gnosis/safe/safe.py Line 981 in 576d510
|
i think it has something to do with how In [1]: from gnosis.eth import EthereumClient
In [2]: from gnosis.safe.safe import SafeV130, Safe
In [3]: client = EthereumClient()
In [4]: addr = '0xFEB4acf3df3cDEA7399794D0869ef76A6EfAff52'
In [5]: class MySafe(Safe):
...: pass
...:
In [6]: class MySafeV130(SafeV130):
...: pass
...:
In [7]: Safe(addr, client)
Out[7]: <gnosis.safe.safe.SafeV130 at 0x107a9b790>
In [8]: SafeV130(addr, client)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[8], line 1
----> 1 SafeV130(addr, client)
File ~/yearn/brownie-safe/.venv/lib/python3.10/site-packages/gnosis/safe/safe.py:95, in Safe.__new__(cls, address, ethereum_client, *args, **kwargs)
93 assert fast_is_checksum_address(address), "%s is not a valid address" % address
94 if cls is not Safe:
---> 95 return super().__new__(cls, address, ethereum_client, *args, **kwargs)
97 versions: Dict[str, Safe] = {
98 "0.0.1": SafeV001,
99 "1.0.0": SafeV100,
(...)
103 "1.4.1": SafeV141,
104 }
105 default_version = SafeV141
TypeError: object.__new__() takes exactly one argument (the type to instantiate)
In [9]: MySafe(addr, client)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[9], line 1
----> 1 MySafe(addr, client)
File ~/yearn/brownie-safe/.venv/lib/python3.10/site-packages/gnosis/safe/safe.py:95, in Safe.__new__(cls, address, ethereum_client, *args, **kwargs)
93 assert fast_is_checksum_address(address), "%s is not a valid address" % address
94 if cls is not Safe:
---> 95 return super().__new__(cls, address, ethereum_client, *args, **kwargs)
97 versions: Dict[str, Safe] = {
98 "0.0.1": SafeV001,
99 "1.0.0": SafeV100,
(...)
103 "1.4.1": SafeV141,
104 }
105 default_version = SafeV141
TypeError: object.__new__() takes exactly one argument (the type to instantiate)
In [10]: MySafeV130(addr, client)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[10], line 1
----> 1 MySafeV130(addr, client)
File ~/yearn/brownie-safe/.venv/lib/python3.10/site-packages/gnosis/safe/safe.py:95, in Safe.__new__(cls, address, ethereum_client, *args, **kwargs)
93 assert fast_is_checksum_address(address), "%s is not a valid address" % address
94 if cls is not Safe:
---> 95 return super().__new__(cls, address, ethereum_client, *args, **kwargs)
97 versions: Dict[str, Safe] = {
98 "0.0.1": SafeV001,
99 "1.0.0": SafeV100,
(...)
103 "1.4.1": SafeV141,
104 }
105 default_version = SafeV141
TypeError: object.__new__() takes exactly one argument (the type to instantiate) |
@banteg we have just released a new version with this bug fixed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
safe-eth-py/gnosis/safe/safe.py
Line 95 in 576d510
The text was updated successfully, but these errors were encountered: