Skip to content

Commit

Permalink
chore: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jmoreira-valory committed Jul 26, 2024
1 parent e3cb6c0 commit e096a81
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 19 deletions.
18 changes: 10 additions & 8 deletions operate/services/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ def deploy_service_onchain( # pylint: disable=too-many-statements
def deploy_service_onchain_from_safe( # pylint: disable=too-many-statements,too-many-locals
self,
hash: str,
update: bool = False,
) -> None:
"""
Deploy as service on-chain
Expand Down Expand Up @@ -427,7 +428,6 @@ def deploy_service_onchain_from_safe( # pylint: disable=too-many-statements,too
f"address: {wallet.safe}; required olas: {required_olas}; your balance: {balance}"
)


on_chain_hash = self._get_on_chain_hash(service)
is_first_mint = self._get_on_chain_state(service) == OnChainState.NON_EXISTENT
is_update = (not is_first_mint) and (on_chain_hash is not None) and (on_chain_hash != service.hash)
Expand All @@ -436,15 +436,17 @@ def deploy_service_onchain_from_safe( # pylint: disable=too-many-statements,too
self.logger.info(f"{is_first_mint=}")
self.logger.info(f"{is_update=}")

if is_update:
self.terminate_service_on_chain_from_safe(hash=hash)
is_update = update # TODO fix
# if is_update:
# self.terminate_service_on_chain_from_safe(hash=hash)

if is_first_mint or (is_update and self._get_on_chain_state(service) == OnChainState.PRE_REGISTRATION):
if not is_update:
self.logger.info("Minting the on-chain service")
else:
self.logger.info("Updating the on-chain service")
# if is_first_mint or (is_update and self._get_on_chain_state(service) == OnChainState.PRE_REGISTRATION):
# if not is_update:
# self.logger.info("Minting the on-chain service")
# else:
# self.logger.info("Updating the on-chain service")

if is_first_mint:
receipt = (
sftxb.new_tx()
.add(
Expand Down
11 changes: 0 additions & 11 deletions operate/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,17 +166,6 @@ class LedgerConfig(LocalResource):
LedgerConfigs = t.List[LedgerConfig]


class ServiceState(enum.IntEnum):
"""Service state"""

NON_EXISTENT = 0
PRE_REGISTRATION = 1
ACTIVE_REGISTRATION = 2
FINISHED_REGISTRATION = 3
DEPLOYED = 4
TERMINATED_BONDED = 5


class DeploymentConfig(TypedDict):
"""Deployments template."""

Expand Down

0 comments on commit e096a81

Please sign in to comment.