Skip to content

Commit

Permalink
Merge branch 'feat/allow-multiple-services-middleware' into refactor/…
Browse files Browse the repository at this point in the history
…chain
  • Loading branch information
jmoreira-valory committed Nov 14, 2024
2 parents b8b67bf + eaa70e5 commit b2f5110
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 22 deletions.
45 changes: 23 additions & 22 deletions operate/services/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,28 +531,29 @@ def _deploy_service_onchain_from_safe( # pylint: disable=too-many-statements,to
)

# TODO A customized, arbitrary computation mechanism should be devised.
env_var_to_value = {
"ETHEREUM_LEDGER_RPC": PUBLIC_RPCS[Chain.ETHEREUM],
"GNOSIS_LEDGER_RPC": PUBLIC_RPCS[Chain.GNOSIS],
"BASE_LEDGER_RPC": PUBLIC_RPCS[Chain.BASE],
"OPTIMISM_LEDGER_RPC": PUBLIC_RPCS[Chain.OPTIMISTIC],
"STAKING_CONTRACT_ADDRESS": staking_params.get("staking_contract"),
"MECH_ACTIVITY_CHECKER_CONTRACT": staking_params.get("activity_checker"),
"MECH_CONTRACT_ADDRESS": staking_params.get("agent_mech"),
"MECH_REQUEST_PRICE": "10000000000000000",
"USE_MECH_MARKETPLACE": str(
"mech_marketplace"
in service.chain_configs[
service.home_chain
].chain_data.user_params.staking_program_id
),
"REQUESTER_STAKING_INSTANCE_ADDRESS": staking_params.get(
"staking_contract"
),
"PRIORITY_MECH_ADDRESS": staking_params.get("agent_mech"),
}

service.update_env_variables_values(env_var_to_value)
if chain == service.home_chain:
env_var_to_value = {
"ETHEREUM_LEDGER_RPC": PUBLIC_RPCS[Chain.ETHEREUM],
"GNOSIS_LEDGER_RPC": PUBLIC_RPCS[Chain.GNOSIS],
"BASE_LEDGER_RPC": PUBLIC_RPCS[Chain.BASE],
"OPTIMISM_LEDGER_RPC": PUBLIC_RPCS[Chain.OPTIMISTIC],
"STAKING_CONTRACT_ADDRESS": staking_params.get("staking_contract"),
"MECH_ACTIVITY_CHECKER_CONTRACT": staking_params.get("activity_checker"),
"MECH_CONTRACT_ADDRESS": staking_params.get("agent_mech"),
"MECH_REQUEST_PRICE": "10000000000000000",
"USE_MECH_MARKETPLACE": str(
"mech_marketplace"
in service.chain_configs[
service.home_chain
].chain_data.user_params.staking_program_id
),
"REQUESTER_STAKING_INSTANCE_ADDRESS": staking_params.get(
"staking_contract"
),
"PRIORITY_MECH_ADDRESS": staking_params.get("agent_mech"),
}

service.update_env_variables_values(env_var_to_value)

if user_params.use_staking:
self.logger.info("Checking staking compatibility")
Expand Down
1 change: 1 addition & 0 deletions operate/services/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,7 @@ def update(
self.name = service_template["name"]
self.hash = service_template["hash"]
self.description = service_template["description"]
self.env_variables = service_template["env_variables"]

# Only update hash_history if latest inserted hash is different
if self.hash_history[max(self.hash_history.keys())] != service_template["hash"]:
Expand Down

0 comments on commit b2f5110

Please sign in to comment.