prediction-market-agent-tooling 0.64.11.dev657__py3-none-any.whl → 0.64.12.dev659__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.
- prediction_market_agent_tooling/markets/omen/omen_contracts.py +8 -0
- prediction_market_agent_tooling/tools/contract.py +54 -14
- {prediction_market_agent_tooling-0.64.11.dev657.dist-info → prediction_market_agent_tooling-0.64.12.dev659.dist-info}/METADATA +1 -1
- {prediction_market_agent_tooling-0.64.11.dev657.dist-info → prediction_market_agent_tooling-0.64.12.dev659.dist-info}/RECORD +7 -7
- {prediction_market_agent_tooling-0.64.11.dev657.dist-info → prediction_market_agent_tooling-0.64.12.dev659.dist-info}/LICENSE +0 -0
- {prediction_market_agent_tooling-0.64.11.dev657.dist-info → prediction_market_agent_tooling-0.64.12.dev659.dist-info}/WHEEL +0 -0
- {prediction_market_agent_tooling-0.64.11.dev657.dist-info → prediction_market_agent_tooling-0.64.12.dev659.dist-info}/entry_points.txt +0 -0
@@ -431,6 +431,12 @@ class OmenFixedProductMarketMakerContract(ContractOnGnosisChain):
|
|
431
431
|
)
|
432
432
|
|
433
433
|
|
434
|
+
class MetriSuperGroup(ContractERC20OnGnosisChain):
|
435
|
+
address: ChecksumAddress = Web3.to_checksum_address(
|
436
|
+
"0x7147A7405fCFe5CFa30c6d5363f9f357a317d082"
|
437
|
+
)
|
438
|
+
|
439
|
+
|
434
440
|
class GNOContract(ContractERC20OnGnosisChain):
|
435
441
|
address: ChecksumAddress = Web3.to_checksum_address(
|
436
442
|
"0x9c58bacc331c9aa871afd802db6379a98e80cedb"
|
@@ -923,10 +929,12 @@ class CollateralTokenChoice(str, Enum):
|
|
923
929
|
wxdai = "wxdai"
|
924
930
|
sdai = "sdai"
|
925
931
|
gno = "gno"
|
932
|
+
metri_super_user = "metri_super_user"
|
926
933
|
|
927
934
|
|
928
935
|
COLLATERAL_TOKEN_CHOICE_TO_ADDRESS = {
|
929
936
|
CollateralTokenChoice.wxdai: WrappedxDaiContract().address,
|
930
937
|
CollateralTokenChoice.sdai: sDaiContract().address,
|
931
938
|
CollateralTokenChoice.gno: GNOContract().address,
|
939
|
+
CollateralTokenChoice.metri_super_user: MetriSuperGroup().address,
|
932
940
|
}
|
@@ -4,6 +4,8 @@ import time
|
|
4
4
|
import typing as t
|
5
5
|
from contextlib import contextmanager
|
6
6
|
|
7
|
+
import eth_abi
|
8
|
+
from eth_abi.exceptions import DecodingError
|
7
9
|
from pydantic import BaseModel, field_validator
|
8
10
|
from web3 import Web3
|
9
11
|
from web3.constants import CHECKSUM_ADDRESSS_ZERO
|
@@ -20,6 +22,7 @@ from prediction_market_agent_tooling.gtypes import (
|
|
20
22
|
TxReceipt,
|
21
23
|
Wei,
|
22
24
|
)
|
25
|
+
from prediction_market_agent_tooling.loggers import logger
|
23
26
|
from prediction_market_agent_tooling.tools.utils import DatetimeUTC
|
24
27
|
from prediction_market_agent_tooling.tools.web3_utils import (
|
25
28
|
call_function_on_contract,
|
@@ -591,27 +594,64 @@ def contract_implements_function(
|
|
591
594
|
look_for_proxy_contract: bool = True,
|
592
595
|
) -> bool:
|
593
596
|
function_signature = f"{function_name}({','.join(function_arg_types or [])})"
|
594
|
-
|
597
|
+
function_selector = web3.keccak(text=function_signature)[0:4].hex()[2:]
|
598
|
+
# 1. Check directly in bytecode
|
599
|
+
bytecode = web3.eth.get_code(contract_address).hex()
|
600
|
+
if function_selector in bytecode:
|
601
|
+
return True
|
595
602
|
contract_code = web3.eth.get_code(contract_address).hex()
|
596
|
-
implements =
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
603
|
+
implements = function_selector in contract_code
|
604
|
+
|
605
|
+
# If not found directly and we should check proxies
|
606
|
+
if not implements and look_for_proxy_contract:
|
607
|
+
# Case 1: Check if it's a standard proxy (has implementation() function)
|
608
|
+
if contract_implements_function(
|
601
609
|
contract_address, "implementation", web3, look_for_proxy_contract=False
|
602
|
-
)
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
610
|
+
):
|
611
|
+
# Get the implementation address and check the function there
|
612
|
+
implementation_address = ContractProxyOnGnosisChain(
|
613
|
+
address=contract_address
|
614
|
+
).implementation()
|
615
|
+
implements = contract_implements_function(
|
616
|
+
implementation_address,
|
617
|
+
function_name=function_name,
|
618
|
+
web3=web3,
|
619
|
+
function_arg_types=function_arg_types,
|
620
|
+
look_for_proxy_contract=False,
|
621
|
+
)
|
622
|
+
else:
|
623
|
+
# Case 2: Check if it's a minimal proxy contract
|
624
|
+
implements = minimal_proxy_implements_function(
|
625
|
+
contract_address=contract_address,
|
626
|
+
function_name=function_name,
|
627
|
+
web3=web3,
|
628
|
+
function_arg_types=function_arg_types,
|
629
|
+
)
|
630
|
+
|
631
|
+
return implements
|
632
|
+
|
633
|
+
|
634
|
+
def minimal_proxy_implements_function(
|
635
|
+
contract_address: ChecksumAddress,
|
636
|
+
function_name: str,
|
637
|
+
web3: Web3,
|
638
|
+
function_arg_types: list[str] | None = None,
|
639
|
+
) -> bool:
|
640
|
+
try:
|
641
|
+
# Read storage slot 0 which should contain the implementation address in minimal proxies
|
642
|
+
raw_slot_0 = web3.eth.get_storage_at(contract_address, 0)
|
643
|
+
singleton_address = eth_abi.decode(["address"], raw_slot_0)[0]
|
644
|
+
# Recurse into singleton
|
645
|
+
return contract_implements_function(
|
646
|
+
Web3.to_checksum_address(singleton_address),
|
609
647
|
function_name=function_name,
|
610
648
|
web3=web3,
|
611
649
|
function_arg_types=function_arg_types,
|
612
650
|
look_for_proxy_contract=False,
|
613
651
|
)
|
614
|
-
|
652
|
+
except DecodingError:
|
653
|
+
logger.info(f"Error decoding contract address for singleton")
|
654
|
+
return False
|
615
655
|
|
616
656
|
|
617
657
|
def init_collateral_token_contract(
|
@@ -57,7 +57,7 @@ prediction_market_agent_tooling/markets/omen/cow_contracts.py,sha256=sl1L4cK5nAJ
|
|
57
57
|
prediction_market_agent_tooling/markets/omen/data_models.py,sha256=4YEOpU-ypq8IBxlEr_qgrKKWwE7wKG6VE_Dq-UKVdOE,30513
|
58
58
|
prediction_market_agent_tooling/markets/omen/omen.py,sha256=NKeTT2gU6uZ9a4gGpa9Dxy6msFQp_41Ug85hIdCmQy4,51733
|
59
59
|
prediction_market_agent_tooling/markets/omen/omen_constants.py,sha256=D9oflYKafLQiHYtB5sScMHqmXyzM8JP8J0yATmc4SQQ,233
|
60
|
-
prediction_market_agent_tooling/markets/omen/omen_contracts.py,sha256=
|
60
|
+
prediction_market_agent_tooling/markets/omen/omen_contracts.py,sha256=c6Z-hZzOybnmU-xRgzKElZmy_238Mf2mQ6dSUaYP_tY,29834
|
61
61
|
prediction_market_agent_tooling/markets/omen/omen_resolving.py,sha256=Cyi9Ci-Z-K8WCZWVLs9oSuJC6qRobi_CpqDCno_5F-0,10238
|
62
62
|
prediction_market_agent_tooling/markets/omen/omen_subgraph_handler.py,sha256=j-x_0Cm8IO-qynIXutu0iSPwrRDxdeCPYf5UHm6MJbs,39446
|
63
63
|
prediction_market_agent_tooling/markets/polymarket/api.py,sha256=UZ4_TG8ceb9Y-qgsOKs8Qiv8zDt957QkT8IX2c83yqo,4800
|
@@ -90,7 +90,7 @@ prediction_market_agent_tooling/tools/betting_strategies/utils.py,sha256=68zFWUj
|
|
90
90
|
prediction_market_agent_tooling/tools/caches/db_cache.py,sha256=rZIGhgijquwwPtp_qncSAPR1SDF2XxIVZL1ir0fgzWw,12127
|
91
91
|
prediction_market_agent_tooling/tools/caches/inmemory_cache.py,sha256=ZW5iI5rmjqeAebu5T7ftRnlkxiL02IC-MxCfDB80x7w,1506
|
92
92
|
prediction_market_agent_tooling/tools/caches/serializers.py,sha256=vFDx4fsPxclXp2q0sv27j4al_M_Tj9aR2JJP-xNHQXA,2151
|
93
|
-
prediction_market_agent_tooling/tools/contract.py,sha256=
|
93
|
+
prediction_market_agent_tooling/tools/contract.py,sha256=pdr9ZYmj4QVUfgVKdvOU6ucYdBpJGdha_FMR_LgtcEs,22912
|
94
94
|
prediction_market_agent_tooling/tools/costs.py,sha256=EaAJ7v9laD4VEV3d8B44M4u3_oEO_H16jRVCdoZ93Uw,954
|
95
95
|
prediction_market_agent_tooling/tools/cow/cow_order.py,sha256=nZafUa5d23mFnEL2arm3jLdqdA9zl-z_fN39ceovwg4,9079
|
96
96
|
prediction_market_agent_tooling/tools/custom_exceptions.py,sha256=Fh8z1fbwONvP4-j7AmV_PuEcoqb6-QXa9PJ9m7guMcM,93
|
@@ -125,8 +125,8 @@ prediction_market_agent_tooling/tools/tokens/usd.py,sha256=yuW8iPPtcpP4eLH2nORMD
|
|
125
125
|
prediction_market_agent_tooling/tools/transaction_cache.py,sha256=K5YKNL2_tR10Iw2TD9fuP-CTGpBbZtNdgbd0B_R7pjg,1814
|
126
126
|
prediction_market_agent_tooling/tools/utils.py,sha256=AC2a68jwASMWuQi-w8twl8b_M52YwrEJ81abmuEaqMY,6661
|
127
127
|
prediction_market_agent_tooling/tools/web3_utils.py,sha256=zRq-eeBGWt8uUGN9G_WfjmJ0eVvO8aWE9S0Pz_Y6AOA,12342
|
128
|
-
prediction_market_agent_tooling-0.64.
|
129
|
-
prediction_market_agent_tooling-0.64.
|
130
|
-
prediction_market_agent_tooling-0.64.
|
131
|
-
prediction_market_agent_tooling-0.64.
|
132
|
-
prediction_market_agent_tooling-0.64.
|
128
|
+
prediction_market_agent_tooling-0.64.12.dev659.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
|
129
|
+
prediction_market_agent_tooling-0.64.12.dev659.dist-info/METADATA,sha256=h5X6hcjazmTczUeSjQ1AhZV9ti-Ygp_OWmMkENcSLXY,8749
|
130
|
+
prediction_market_agent_tooling-0.64.12.dev659.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
131
|
+
prediction_market_agent_tooling-0.64.12.dev659.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
|
132
|
+
prediction_market_agent_tooling-0.64.12.dev659.dist-info/RECORD,,
|
File without changes
|
File without changes
|