diff --git a/hathor/nanocontracts/blueprint_env.py b/hathor/nanocontracts/blueprint_env.py index 052d23644..e960c57da 100644 --- a/hathor/nanocontracts/blueprint_env.py +++ b/hathor/nanocontracts/blueprint_env.py @@ -16,8 +16,6 @@ from typing import TYPE_CHECKING, Any, Optional, final -from typing_extensions import deprecated - from hathor.nanocontracts.storage import NCContractStorage from hathor.nanocontracts.types import Amount, BlueprintId, ContractId, NCAction, TokenUid @@ -65,24 +63,6 @@ def get_blueprint_id(self, contract_id: Optional[ContractId] = None) -> Blueprin contract_id = self.get_contract_id() return self.__runner.get_blueprint_id(contract_id) - @final - @deprecated('use explicit methods instead, `get_balance_before_current_call` or `get_current_balance`') - def get_balance( - self, - token_uid: Optional[TokenUid] = None, - *, - contract_id: Optional[ContractId] = None, - ) -> Amount: - """ - Return the balance for a given token before the current call, that is, - excluding any actions and changes in the current call. - This is equivalent to `get_balance_before_current_call`. - - For instance, if a contract has 50 HTR and the call is requesting to withdraw 3 HTR, - then this method will return 50 HTR. - """ - return self.get_balance_before_current_call(token_uid, contract_id=contract_id) - def get_balance_before_current_call( self, token_uid: Optional[TokenUid] = None, diff --git a/hathor/nanocontracts/runner/runner.py b/hathor/nanocontracts/runner/runner.py index 6ff8c7a96..42a641cb2 100644 --- a/hathor/nanocontracts/runner/runner.py +++ b/hathor/nanocontracts/runner/runner.py @@ -17,7 +17,7 @@ from collections import defaultdict from typing import Any, Callable, Concatenate, ParamSpec, TypeVar -from typing_extensions import assert_never, deprecated +from typing_extensions import assert_never from hathor.conf.settings import HATHOR_TOKEN_UID, HathorSettings from hathor.nanocontracts.balance_rules import BalanceRules @@ -667,15 +667,6 @@ def _unsafe_call_view_method( self._call_info.post_call(call_record) return ret - @deprecated('use explicit methods instead, `get_balance_before_current_call` or `get_current_balance`') - def get_balance(self, contract_id: ContractId | None, token_uid: TokenUid | None) -> Balance: - """ - Return the contract balance for a given token before the current call, that is, - excluding any actions and changes in the current call. - This is equivalent to `get_balance_before_current_call`. - """ - return self.get_balance_before_current_call(contract_id, token_uid) - def get_balance_before_current_call(self, contract_id: ContractId | None, token_uid: TokenUid | None) -> Balance: """ Return the contract balance for a given token before the current call, that is, diff --git a/tests/nanocontracts/test_execution_order.py b/tests/nanocontracts/test_execution_order.py index ce3f8627c..4d8d83c3d 100644 --- a/tests/nanocontracts/test_execution_order.py +++ b/tests/nanocontracts/test_execution_order.py @@ -34,8 +34,6 @@ def initialize(self, ctx: Context, token_uid: TokenUid) -> None: def assert_balance(self, token_uid: TokenUid, *, before: int, current: int) -> None: assert self.syscall.get_balance_before_current_call(token_uid) == before - # deprecated method, equivalent to get_balance_before_current_call - assert self.syscall.get_balance(token_uid) == before assert self.syscall.get_current_balance(token_uid) == current def assert_token_balance(self, *, before: int, current: int) -> None: diff --git a/tests/nanocontracts/test_syscalls_in_view.py b/tests/nanocontracts/test_syscalls_in_view.py index 8f73ec0fa..599645f91 100644 --- a/tests/nanocontracts/test_syscalls_in_view.py +++ b/tests/nanocontracts/test_syscalls_in_view.py @@ -45,10 +45,6 @@ def get_contract_id(self) -> None: def get_blueprint_id(self) -> None: self.syscall.get_blueprint_id() - @view - def get_balance(self) -> None: - self.syscall.get_balance() - @view def get_balance_before_current_call(self) -> None: self.syscall.get_balance_before_current_call()