From 818e885359290bcbf243dd812b614a511969966d Mon Sep 17 00:00:00 2001 From: antazoey Date: Fri, 6 Feb 2026 16:43:18 -0600 Subject: [PATCH 1/7] Fix: get --- tplus/client/clearingengine/assetregistry.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tplus/client/clearingengine/assetregistry.py b/tplus/client/clearingengine/assetregistry.py index cacffb8..3b12327 100644 --- a/tplus/client/clearingengine/assetregistry.py +++ b/tplus/client/clearingengine/assetregistry.py @@ -51,6 +51,6 @@ async def update_fee_account(self): async def get_fee_account(self): """ - Request that the clearing engine update its fee account. + Get the fee account. """ - await self._post("fee-account") + await self._get("fee-account") From aa7b4ee1f28657e8ca427b0761917eab18a5b4a9 Mon Sep 17 00:00:00 2001 From: antazoey Date: Fri, 6 Feb 2026 16:56:23 -0600 Subject: [PATCH 2/7] fix: deploy issue --- tplus/evm/contracts.py | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/tplus/evm/contracts.py b/tplus/evm/contracts.py index edd63db..d54fd33 100644 --- a/tplus/evm/contracts.py +++ b/tplus/evm/contracts.py @@ -219,6 +219,12 @@ def deploy_dev(cls): owner = get_dev_default_owner() return cls.deploy(owner, sender=owner) + def deploy_dev_and_set_deployment(self) -> "TPlusContract": + instance = self.deploy_dev() + self._address = instance.address + self._deployments[instance.address] = instance + return instance + def __repr__(self) -> str: return f"<{self.name}>" @@ -227,7 +233,11 @@ def __getattr__(self, attr_name: str): # First, try a regular attribute on the class return self.__getattribute__(attr_name) except AttributeError: - # Resort to something defined on the contract. + if attr_name.startswith("_"): + # Ignore internals, causes integration issues. + raise + + # Try something defined on the contract. return getattr(self.contract, attr_name) @property @@ -259,15 +269,16 @@ def contract(self) -> "ContractInstance": try: return self.get_contract() except ContractNotExists: - if self.chain_manager.provider.network.is_local: + if self.is_local_network: # If simulating, deploy it now. - instance = self.deploy_dev() - self._address = instance.address - self._deployments[self.chain_manager.chain_id] = instance - return instance + return self.deploy_dev_and_set_deployment() raise # This error. + @property + def is_local_network(self) -> bool: + return self.chain_manager.provider.network.is_local + @property def default_deployer(self) -> AccountAPI: if deployer := self._default_deployer: @@ -324,8 +335,11 @@ def get_address(self, chain_id: ChainID | None = None) -> str: chain_id = chain_id or self._chain_id or ChainID.evm(self.chain_manager.chain_id) try: return TPLUS_DEPLOYMENTS[chain_id][self.name] - except KeyError: - raise ContractNotExists(f"{self.name} not deployed on chain '{chain_id}'.") + except KeyError as err: + if self.is_local_network: + self.deploy_dev_and_set_deployment() + + raise ContractNotExists(f"{self.name} not deployed on chain '{chain_id}'.") from err class Registry(TPlusContract): From a5a237db55a2e2c753a7db7b6e8a1bb7d4e7fc1b Mon Sep 17 00:00:00 2001 From: antazoey Date: Fri, 6 Feb 2026 18:21:27 -0600 Subject: [PATCH 3/7] fix: const --- tplus/evm/constants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tplus/evm/constants.py b/tplus/evm/constants.py index fac5bb7..2f908ed 100644 --- a/tplus/evm/constants.py +++ b/tplus/evm/constants.py @@ -1,2 +1,2 @@ -REGISTRY_ADDRESS = "0xBBd0020ae0DAB578515d0c72EdFf37Bf30D31BE5" +REGISTRY_ADDRESS = "0x9700c54DFB6C8a77bA151556a41dC035B60e4B91" LATEST_ARB_DEPOSIT_VAULT = "0x7a9eAA74eF31ed3eca5447252b443651Ad250916" From 84131b8b34ee5493da913eb01f1197f3a7a71abf Mon Sep 17 00:00:00 2001 From: antazoey Date: Fri, 6 Feb 2026 19:29:54 -0600 Subject: [PATCH 4/7] fix: missing return --- tplus/client/clearingengine/assetregistry.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tplus/client/clearingengine/assetregistry.py b/tplus/client/clearingengine/assetregistry.py index 3b12327..6e5fae2 100644 --- a/tplus/client/clearingengine/assetregistry.py +++ b/tplus/client/clearingengine/assetregistry.py @@ -49,8 +49,8 @@ async def update_fee_account(self): """ await self._post("fee-account/update") - async def get_fee_account(self): + async def get_fee_account(self) -> str: """ Get the fee account. """ - await self._get("fee-account") + return await self._get("fee-account") From a23ede6b2315636fb86b7bfaf2bf299a5da9fd2f Mon Sep 17 00:00:00 2001 From: antazoey Date: Mon, 9 Feb 2026 09:14:00 -0600 Subject: [PATCH 5/7] fix mycry --- tplus/client/clearingengine/assetregistry.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tplus/client/clearingengine/assetregistry.py b/tplus/client/clearingengine/assetregistry.py index 6e5fae2..d99a9c5 100644 --- a/tplus/client/clearingengine/assetregistry.py +++ b/tplus/client/clearingengine/assetregistry.py @@ -53,4 +53,5 @@ async def get_fee_account(self) -> str: """ Get the fee account. """ - return await self._get("fee-account") + account = await self._get("fee-account") + return f"{account}" From 3b36378e906f88958cda1c6d8d3d740d7888666d Mon Sep 17 00:00:00 2001 From: antazoey Date: Thu, 12 Feb 2026 17:50:49 -0600 Subject: [PATCH 6/7] fix: deployments key --- tplus/evm/contracts.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tplus/evm/contracts.py b/tplus/evm/contracts.py index d54fd33..d3be1c5 100644 --- a/tplus/evm/contracts.py +++ b/tplus/evm/contracts.py @@ -191,7 +191,7 @@ def __init__( address: str | None = None, tplus_contracts_version: str | None = None, ) -> None: - self._deployments: dict[int, ContractInstance] = {} + self._deployments: dict[str, ContractInstance] = {} self._default_deployer = default_deployer self._chain_id = chain_id self._address = address @@ -222,7 +222,7 @@ def deploy_dev(cls): def deploy_dev_and_set_deployment(self) -> "TPlusContract": instance = self.deploy_dev() self._address = instance.address - self._deployments[instance.address] = instance + self._deployments[f"{instance.chain_id}"] = instance return instance def __repr__(self) -> str: @@ -244,13 +244,16 @@ def __getattr__(self, attr_name: str): def name(self) -> str: return self.__class__.NAME + @cached_property + def chain_id(self) -> ChainID: + return self._chain_id or ChainID.evm(self.chain_manager.chain_id) + @property def address(self) -> str: if address := self._address: return address - chain_id = self._chain_id or ChainID.evm(self.chain_manager.chain_id) - return self.get_address(chain_id=chain_id) + return self.get_address(chain_id=self.chain_id) @property def tplus_contracts_project(self) -> "Project": @@ -315,7 +318,7 @@ def get_contract(self, chain_id: ChainID | None = None) -> "ContractInstance": Returns: ContractInstance """ - chain_id = chain_id or self._chain_id or ChainID.evm(self.chain_manager.chain_id) + chain_id = chain_id or self.chain_id if chain_id in self._deployments: # Get previously cached instance. return self._deployments[chain_id] @@ -332,7 +335,7 @@ def get_address(self, chain_id: ChainID | None = None) -> str: if self._address and self._chain_id and chain_id == self._chain_id: return self._address - chain_id = chain_id or self._chain_id or ChainID.evm(self.chain_manager.chain_id) + chain_id = chain_id or self.chain_id try: return TPLUS_DEPLOYMENTS[chain_id][self.name] except KeyError as err: From c91cc351797cf173750df13043955b471c8b66a8 Mon Sep 17 00:00:00 2001 From: antazoey Date: Thu, 12 Feb 2026 17:55:45 -0600 Subject: [PATCH 7/7] fix: guard deploy dev --- tplus/evm/contracts.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tplus/evm/contracts.py b/tplus/evm/contracts.py index d3be1c5..4ce0f92 100644 --- a/tplus/evm/contracts.py +++ b/tplus/evm/contracts.py @@ -196,6 +196,7 @@ def __init__( self._chain_id = chain_id self._address = address self._tplus_contracts_version = tplus_contracts_version + self._attempted_deploy_dev = False if address is not None and chain_id is not None: self._deployments[f"{chain_id}"] = self._contract_container.at(address) @@ -220,6 +221,7 @@ def deploy_dev(cls): return cls.deploy(owner, sender=owner) def deploy_dev_and_set_deployment(self) -> "TPlusContract": + self._attempted_deploy_dev = True instance = self.deploy_dev() self._address = instance.address self._deployments[f"{instance.chain_id}"] = instance @@ -272,7 +274,7 @@ def contract(self) -> "ContractInstance": try: return self.get_contract() except ContractNotExists: - if self.is_local_network: + if self.is_local_network and not self._attempted_deploy_dev: # If simulating, deploy it now. return self.deploy_dev_and_set_deployment() @@ -339,7 +341,7 @@ def get_address(self, chain_id: ChainID | None = None) -> str: try: return TPLUS_DEPLOYMENTS[chain_id][self.name] except KeyError as err: - if self.is_local_network: + if self.is_local_network and not self._attempted_deploy_dev: self.deploy_dev_and_set_deployment() raise ContractNotExists(f"{self.name} not deployed on chain '{chain_id}'.") from err