prediction-market-agent-tooling 0.69.12__py3-none-any.whl → 0.69.13__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of prediction-market-agent-tooling might be problematic. Click here for more details.
- prediction_market_agent_tooling/tools/contract.py +32 -1
- {prediction_market_agent_tooling-0.69.12.dist-info → prediction_market_agent_tooling-0.69.13.dist-info}/METADATA +1 -1
- {prediction_market_agent_tooling-0.69.12.dist-info → prediction_market_agent_tooling-0.69.13.dist-info}/RECORD +6 -6
- {prediction_market_agent_tooling-0.69.12.dist-info → prediction_market_agent_tooling-0.69.13.dist-info}/WHEEL +0 -0
- {prediction_market_agent_tooling-0.69.12.dist-info → prediction_market_agent_tooling-0.69.13.dist-info}/entry_points.txt +0 -0
- {prediction_market_agent_tooling-0.69.12.dist-info → prediction_market_agent_tooling-0.69.13.dist-info}/licenses/LICENSE +0 -0
|
@@ -5,11 +5,13 @@ import typing as t
|
|
|
5
5
|
from contextlib import contextmanager
|
|
6
6
|
|
|
7
7
|
import eth_abi
|
|
8
|
+
import tenacity
|
|
8
9
|
from eth_abi.exceptions import DecodingError
|
|
9
10
|
from pydantic import BaseModel, field_validator
|
|
10
11
|
from web3 import Web3
|
|
11
12
|
from web3.constants import CHECKSUM_ADDRESSS_ZERO, HASH_ZERO
|
|
12
13
|
from web3.contract.contract import Contract as Web3Contract
|
|
14
|
+
from web3.exceptions import ContractCustomError, ContractLogicError
|
|
13
15
|
|
|
14
16
|
from prediction_market_agent_tooling.chains import POLYGON_CHAIN_ID
|
|
15
17
|
from prediction_market_agent_tooling.config import APIKeys, RPCConfig
|
|
@@ -941,6 +943,7 @@ def uni_implementation_address(
|
|
|
941
943
|
minimal_proxy_address(contract_address, web3),
|
|
942
944
|
seer_minimal_proxy_address(contract_address, web3),
|
|
943
945
|
eip_1967_proxy_address(contract_address, web3),
|
|
946
|
+
zeppelinos_unstructured_storage_proxy_address(contract_address, web3),
|
|
944
947
|
]
|
|
945
948
|
return [addr for addr in addresses if addr is not None]
|
|
946
949
|
|
|
@@ -952,7 +955,20 @@ def implementation_proxy_address(
|
|
|
952
955
|
contract_address, "implementation", web3, look_for_proxy_contract=False
|
|
953
956
|
):
|
|
954
957
|
return None
|
|
955
|
-
|
|
958
|
+
try:
|
|
959
|
+
return ContractProxyOnGnosisChain(address=contract_address).implementation(web3)
|
|
960
|
+
except (ContractCustomError, ContractLogicError, tenacity.RetryError) as e:
|
|
961
|
+
if isinstance(e, tenacity.RetryError) and not isinstance(
|
|
962
|
+
e.last_attempt.exception(), (ContractCustomError, ContractLogicError)
|
|
963
|
+
):
|
|
964
|
+
raise
|
|
965
|
+
|
|
966
|
+
# For example https://gnosisscan.io/address/0x3221a28ed2b2e955da64d1d299956f277562c95c#code,
|
|
967
|
+
# it has the implementation method, but it's only for admins.
|
|
968
|
+
logger.warning(
|
|
969
|
+
f"Failed to get implementation for {contract_address=} even though it has the method: {e}"
|
|
970
|
+
)
|
|
971
|
+
return None
|
|
956
972
|
|
|
957
973
|
|
|
958
974
|
def minimal_proxy_address(
|
|
@@ -996,6 +1012,21 @@ def eip_1967_proxy_address(
|
|
|
996
1012
|
return None
|
|
997
1013
|
|
|
998
1014
|
|
|
1015
|
+
def zeppelinos_unstructured_storage_proxy_address(
|
|
1016
|
+
contract_address: ChecksumAddress, web3: Web3
|
|
1017
|
+
) -> ChecksumAddress | None:
|
|
1018
|
+
try:
|
|
1019
|
+
slot = HexBytes(
|
|
1020
|
+
Web3.keccak(text="org.zeppelinos.proxy.implementation")
|
|
1021
|
+
).as_int()
|
|
1022
|
+
raw_slot = web3.eth.get_storage_at(contract_address, slot)
|
|
1023
|
+
address = eth_abi.decode(["address"], raw_slot)[0]
|
|
1024
|
+
return Web3.to_checksum_address(address)
|
|
1025
|
+
except DecodingError:
|
|
1026
|
+
logger.info("Error decoding contract address for zeppelinos proxy")
|
|
1027
|
+
return None
|
|
1028
|
+
|
|
1029
|
+
|
|
999
1030
|
def init_collateral_token_contract(
|
|
1000
1031
|
address: ChecksumAddress, web3: Web3 | None
|
|
1001
1032
|
) -> ContractERC20BaseClass:
|
|
@@ -92,7 +92,7 @@ prediction_market_agent_tooling/tools/betting_strategies/utils.py,sha256=MpS3FOM
|
|
|
92
92
|
prediction_market_agent_tooling/tools/caches/db_cache.py,sha256=V6o6UdesjkKzSJMhqkUtD76cJGPaNhuwA4OL2chIYSI,13801
|
|
93
93
|
prediction_market_agent_tooling/tools/caches/inmemory_cache.py,sha256=ZW5iI5rmjqeAebu5T7ftRnlkxiL02IC-MxCfDB80x7w,1506
|
|
94
94
|
prediction_market_agent_tooling/tools/caches/serializers.py,sha256=fwyIHUsL7u9NY7ZihTcUdqsvl2psatcbTfgWHTSez3U,2427
|
|
95
|
-
prediction_market_agent_tooling/tools/contract.py,sha256=
|
|
95
|
+
prediction_market_agent_tooling/tools/contract.py,sha256=gA-XAg7Q3Umh_fWdiKR3PywjpS8F36--il14ODXFA-M,35773
|
|
96
96
|
prediction_market_agent_tooling/tools/contract_utils.py,sha256=9X9raICUZkPDShilt02aYzS_ILZ62u0vG5081uWLdqk,2152
|
|
97
97
|
prediction_market_agent_tooling/tools/costs.py,sha256=EaAJ7v9laD4VEV3d8B44M4u3_oEO_H16jRVCdoZ93Uw,954
|
|
98
98
|
prediction_market_agent_tooling/tools/cow/cow_order.py,sha256=DN_8cPrr4jWVpXdS4D0j1QB19nB8fxDoSheo2BFMc8M,14523
|
|
@@ -137,8 +137,8 @@ prediction_market_agent_tooling/tools/tokens/usd.py,sha256=DPO-4HBTy1-TZHKL_9CnH
|
|
|
137
137
|
prediction_market_agent_tooling/tools/transaction_cache.py,sha256=K5YKNL2_tR10Iw2TD9fuP-CTGpBbZtNdgbd0B_R7pjg,1814
|
|
138
138
|
prediction_market_agent_tooling/tools/utils.py,sha256=ruq6P5TFs8CBHxeBLj1Plpx7kuNFPpDgMsJGQgDiRNs,8785
|
|
139
139
|
prediction_market_agent_tooling/tools/web3_utils.py,sha256=CDbaidlLeQ4VHzSg150L7QNfHfGveljSePGuDVFEYqc,13963
|
|
140
|
-
prediction_market_agent_tooling-0.69.
|
|
141
|
-
prediction_market_agent_tooling-0.69.
|
|
142
|
-
prediction_market_agent_tooling-0.69.
|
|
143
|
-
prediction_market_agent_tooling-0.69.
|
|
144
|
-
prediction_market_agent_tooling-0.69.
|
|
140
|
+
prediction_market_agent_tooling-0.69.13.dist-info/METADATA,sha256=1pYYhpW36Eoga_5GmZ4qz3UKTJbLwD9U0Cs3Flswo-M,8891
|
|
141
|
+
prediction_market_agent_tooling-0.69.13.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
142
|
+
prediction_market_agent_tooling-0.69.13.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
|
|
143
|
+
prediction_market_agent_tooling-0.69.13.dist-info/licenses/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
|
|
144
|
+
prediction_market_agent_tooling-0.69.13.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|