From 20d52979bc3ebfbed35d554b5a8ca35de7cecbf1 Mon Sep 17 00:00:00 2001 From: antazoey Date: Thu, 5 Feb 2026 20:09:24 -0600 Subject: [PATCH 1/7] fee acct --- tplus/client/clearingengine/assetregistry.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tplus/client/clearingengine/assetregistry.py b/tplus/client/clearingengine/assetregistry.py index 2c12d7b..f2dfacd 100644 --- a/tplus/client/clearingengine/assetregistry.py +++ b/tplus/client/clearingengine/assetregistry.py @@ -42,3 +42,9 @@ async def update_risk_parameters(self): Request that the clearing engine updates its registered risk parameters. """ await self._post("params/update") + + async def update_fee_account(self): + """ + Request that the clearing engine update its fee account. + """ + await self._post("fee-account/update") From 579fa4c10284148bd8b9c901d028a9491682d85e Mon Sep 17 00:00:00 2001 From: antazoey Date: Thu, 5 Feb 2026 20:22:24 -0600 Subject: [PATCH 2/7] ce: getter --- tplus/client/clearingengine/assetregistry.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tplus/client/clearingengine/assetregistry.py b/tplus/client/clearingengine/assetregistry.py index f2dfacd..cacffb8 100644 --- a/tplus/client/clearingengine/assetregistry.py +++ b/tplus/client/clearingengine/assetregistry.py @@ -48,3 +48,9 @@ async def update_fee_account(self): Request that the clearing engine update its fee account. """ await self._post("fee-account/update") + + async def get_fee_account(self): + """ + Request that the clearing engine update its fee account. + """ + await self._post("fee-account") From 818e885359290bcbf243dd812b614a511969966d Mon Sep 17 00:00:00 2001 From: antazoey Date: Fri, 6 Feb 2026 16:43:18 -0600 Subject: [PATCH 3/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 4/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 29db17e067631078cf559a14cc16614dfbb6004e Mon Sep 17 00:00:00 2001 From: antazoey Date: Fri, 13 Feb 2026 08:21:44 -0600 Subject: [PATCH 5/7] contract repr fix / deploy script aid (#121) --- tplus/client/clearingengine/assetregistry.py | 5 +++-- tplus/evm/constants.py | 2 +- tplus/evm/contracts.py | 21 ++++++++++++-------- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/tplus/client/clearingengine/assetregistry.py b/tplus/client/clearingengine/assetregistry.py index 3b12327..d99a9c5 100644 --- a/tplus/client/clearingengine/assetregistry.py +++ b/tplus/client/clearingengine/assetregistry.py @@ -49,8 +49,9 @@ 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") + account = await self._get("fee-account") + return f"{account}" 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" diff --git a/tplus/evm/contracts.py b/tplus/evm/contracts.py index d54fd33..4ce0f92 100644 --- a/tplus/evm/contracts.py +++ b/tplus/evm/contracts.py @@ -191,11 +191,12 @@ 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 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,9 +221,10 @@ 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[instance.address] = instance + self._deployments[f"{instance.chain_id}"] = instance return instance def __repr__(self) -> str: @@ -244,13 +246,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": @@ -269,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() @@ -315,7 +320,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,11 +337,11 @@ 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: - 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 From 74b608ec989d6852d0cd6219133fb4977d558009 Mon Sep 17 00:00:00 2001 From: antazoey Date: Fri, 13 Feb 2026 09:52:32 -0600 Subject: [PATCH 6/7] ret addr --- tplus/evm/contracts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tplus/evm/contracts.py b/tplus/evm/contracts.py index 4ce0f92..53b9e4e 100644 --- a/tplus/evm/contracts.py +++ b/tplus/evm/contracts.py @@ -342,7 +342,7 @@ def get_address(self, chain_id: ChainID | None = None) -> str: return TPLUS_DEPLOYMENTS[chain_id][self.name] except KeyError as err: if self.is_local_network and not self._attempted_deploy_dev: - self.deploy_dev_and_set_deployment() + return self.deploy_dev_and_set_deployment().address raise ContractNotExists(f"{self.name} not deployed on chain '{chain_id}'.") from err From 2fa141ad89630586395173a7d41338b4fd26180c Mon Sep 17 00:00:00 2001 From: antazoey Date: Fri, 13 Feb 2026 09:54:51 -0600 Subject: [PATCH 7/7] finally fix dev deploys --- tplus/evm/contracts.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tplus/evm/contracts.py b/tplus/evm/contracts.py index 79c3b3e..fb5e0ee 100644 --- a/tplus/evm/contracts.py +++ b/tplus/evm/contracts.py @@ -264,10 +264,6 @@ def name(self) -> str: def chain_id(self) -> ChainID: return self._chain_id or ChainID.evm(self.chain_manager.chain_id) - @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: @@ -519,7 +515,9 @@ def deploy_dev(cls, sender: AccountAPI | None = None, **kwargs) -> TPlusContract """ Deploy and set up a development vault. """ - credman = kwargs.get("credential_manager") or ZERO_ADDRESS + if not (credman := kwargs.get("credential_manager")): + credman = credential_manager.address + sender = sender or cls.account_manager.test_accounts[0] contract = cast(DepositVault, cls.deploy(sender, credman, sender=sender)) @@ -572,7 +570,10 @@ def deploy_dev(cls, **kwargs) -> "ReceiptAPI": owner = kwargs.get("sender") or get_dev_default_owner() operators = kwargs.get("operators", [owner.address]) threshold = kwargs.get("quorum_threshold") or len(operators) - registry_address = kwargs.get("registry") or ZERO_ADDRESS + + if not (registry_address := kwargs.get("registry")): + registry_address = registry.address + measurements = kwargs.get("measurements") or [] automata_verifier = kwargs.get("automata_verifier") or ZERO_ADDRESS