olas-operate-middleware 0.11.0__tar.gz → 0.11.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/PKG-INFO +1 -1
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/ledger/profiles.py +2 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/quickstart/reset_configs.py +1 -1
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/quickstart/run_service.py +11 -4
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/quickstart/utils.py +8 -8
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/services/funding_manager.py +21 -1
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/services/service.py +25 -1
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/pyproject.toml +1 -1
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/LICENSE +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/README.md +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/__init__.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/account/__init__.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/account/user.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/bridge/bridge_manager.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/bridge/providers/lifi_provider.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/bridge/providers/native_bridge_provider.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/bridge/providers/provider.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/bridge/providers/relay_provider.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/cli.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/constants.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/README.md +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/__init__.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/__init__.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/dual_staking_token/__init__.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/dual_staking_token/build/DualStakingToken.json +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/dual_staking_token/contract.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/dual_staking_token/contract.yaml +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/foreign_omnibridge/__init__.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/foreign_omnibridge/build/ForeignOmnibridge.json +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/foreign_omnibridge/contract.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/foreign_omnibridge/contract.yaml +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/home_omnibridge/__init__.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/home_omnibridge/build/HomeOmnibridge.json +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/home_omnibridge/contract.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/home_omnibridge/contract.yaml +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/l1_standard_bridge/__init__.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/l1_standard_bridge/build/L1StandardBridge.json +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/l1_standard_bridge/contract.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/l1_standard_bridge/contract.yaml +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/l2_standard_bridge/__init__.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/l2_standard_bridge/build/L2StandardBridge.json +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/l2_standard_bridge/contract.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/l2_standard_bridge/contract.yaml +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/mech_activity/__init__.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/mech_activity/build/MechActivity.json +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/mech_activity/contract.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/mech_activity/contract.yaml +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/optimism_mintable_erc20/__init__.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/optimism_mintable_erc20/build/OptimismMintableERC20.json +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/optimism_mintable_erc20/contract.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/optimism_mintable_erc20/contract.yaml +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/recovery_module/__init__.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/recovery_module/build/RecoveryModule.json +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/recovery_module/contract.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/recovery_module/contract.yaml +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/requester_activity_checker/__init__.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/requester_activity_checker/build/RequesterActivityChecker.json +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/requester_activity_checker/contract.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/requester_activity_checker/contract.yaml +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/staking_token/__init__.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/staking_token/build/StakingToken.json +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/staking_token/contract.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/staking_token/contract.yaml +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/uniswap_v2_erc20/__init__.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/uniswap_v2_erc20/build/IUniswapV2ERC20.json +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/uniswap_v2_erc20/contract.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/uniswap_v2_erc20/contract.yaml +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/uniswap_v2_erc20/tests/__init__.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/uniswap_v2_erc20/tests/test_contract.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/keys.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/ledger/__init__.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/migration.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/operate_http/__init__.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/operate_http/exceptions.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/operate_types.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/pearl.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/quickstart/analyse_logs.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/quickstart/claim_staking_rewards.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/quickstart/reset_password.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/quickstart/reset_staking.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/quickstart/stop_service.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/quickstart/terminate_on_chain_service.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/resource.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/services/__init__.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/services/agent_runner.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/services/deployment_runner.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/services/health_checker.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/services/manage.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/services/protocol.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/services/utils/__init__.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/services/utils/mech.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/services/utils/tendermint.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/settings.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/utils/__init__.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/utils/gnosis.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/utils/single_instance.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/utils/ssl.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/wallet/__init__.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/wallet/master.py +0 -0
- {olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/wallet/wallet_recovery_manager.py +0 -0
{olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/ledger/profiles.py
RENAMED
|
@@ -100,6 +100,8 @@ STAKING: t.Dict[Chain, t.Dict[str, str]] = {
|
|
|
100
100
|
"quickstart_beta_mech_marketplace_expert_6": "0x22D6cd3d587D8391C3aAE83a783f26c67ab54A85",
|
|
101
101
|
"quickstart_beta_mech_marketplace_expert_7": "0xaaEcdf4d0CBd6Ca0622892Ac6044472f3912A5f3",
|
|
102
102
|
"quickstart_beta_mech_marketplace_expert_8": "0x168aED532a0CD8868c22Fc77937Af78b363652B1",
|
|
103
|
+
"quickstart_beta_mech_marketplace_expert_9": "0xdDa9cD214F12e7C2D58E871404A0A3B1177065C8",
|
|
104
|
+
"quickstart_beta_mech_marketplace_expert_10": "0x53a38655B4e659eF4C7F88A26fbF5c67932C7156",
|
|
103
105
|
"mech_marketplace": "0x998dEFafD094817EF329f6dc79c703f1CF18bC90",
|
|
104
106
|
"marketplace_supply_alpha": "0xCAbD0C941E54147D40644CF7DA7e36d70DF46f44",
|
|
105
107
|
"marketplace_demand_alpha_1": "0x9d6e7aB0B5B48aE5c146936147C639fEf4575231",
|
|
@@ -89,7 +89,7 @@ def reset_configs(operate: "OperateApp", config_path: str) -> None:
|
|
|
89
89
|
env_var=f"{chain_name.upper()}_LEDGER_RPC",
|
|
90
90
|
old_value=config.rpc[chain_name],
|
|
91
91
|
hidden=True,
|
|
92
|
-
validator=check_rpc,
|
|
92
|
+
validator=lambda x: check_rpc(chain_name, x), # noqa: B023
|
|
93
93
|
)
|
|
94
94
|
|
|
95
95
|
if config.user_provided_args is None:
|
{olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/quickstart/run_service.py
RENAMED
|
@@ -99,6 +99,8 @@ QS_STAKING_PROGRAMS: t.Dict[Chain, t.Dict[str, str]] = {
|
|
|
99
99
|
"quickstart_beta_mech_marketplace_expert_6": "trader",
|
|
100
100
|
"quickstart_beta_mech_marketplace_expert_7": "trader",
|
|
101
101
|
"quickstart_beta_mech_marketplace_expert_8": "trader",
|
|
102
|
+
"quickstart_beta_mech_marketplace_expert_9": "trader",
|
|
103
|
+
"quickstart_beta_mech_marketplace_expert_10": "trader",
|
|
102
104
|
"mech_marketplace": "mech",
|
|
103
105
|
"marketplace_supply_alpha": "mech",
|
|
104
106
|
},
|
|
@@ -196,7 +198,7 @@ def configure_local_config(
|
|
|
196
198
|
config.rpc = {}
|
|
197
199
|
|
|
198
200
|
for chain in template["configurations"]:
|
|
199
|
-
while not check_rpc(config.rpc.get(chain)):
|
|
201
|
+
while not check_rpc(chain, config.rpc.get(chain)):
|
|
200
202
|
config.rpc[chain] = ask_or_get_from_env(
|
|
201
203
|
f"Enter a {CHAIN_TO_METADATA[chain]['name']} RPC that supports eth_newFilter [hidden input]: ",
|
|
202
204
|
True,
|
|
@@ -493,7 +495,10 @@ def get_service(manager: ServiceManager, template: ServiceTemplate) -> Service:
|
|
|
493
495
|
service_template=template,
|
|
494
496
|
)
|
|
495
497
|
|
|
496
|
-
|
|
498
|
+
for env_var_name, env_var_data in template["env_variables"].items():
|
|
499
|
+
if env_var_name not in service.env_variables:
|
|
500
|
+
service.env_variables[env_var_name] = env_var_data
|
|
501
|
+
|
|
497
502
|
service.update_user_params_from_template(service_template=template)
|
|
498
503
|
service.store()
|
|
499
504
|
break
|
|
@@ -554,7 +559,7 @@ def _ask_funds_from_requirements(
|
|
|
554
559
|
"""Ask for funds from requirements."""
|
|
555
560
|
spinner = Halo(text="Calculating funds requirements...", spinner="dots")
|
|
556
561
|
spinner.start()
|
|
557
|
-
requirements = manager.
|
|
562
|
+
requirements = manager.funding_requirements(
|
|
558
563
|
service_config_id=service.service_config_id
|
|
559
564
|
)
|
|
560
565
|
spinner.stop()
|
|
@@ -633,6 +638,7 @@ def ensure_enough_funds(operate: "OperateApp", service: Service) -> None:
|
|
|
633
638
|
_maybe_create_master_eoa(operate)
|
|
634
639
|
wallet = operate.wallet_manager.load(ledger_type=LedgerType.ETHEREUM)
|
|
635
640
|
manager = operate.service_manager()
|
|
641
|
+
manager.funding_manager.is_for_quickstart = True
|
|
636
642
|
|
|
637
643
|
backup_owner = None
|
|
638
644
|
while not _ask_funds_from_requirements(manager, wallet, service):
|
|
@@ -690,7 +696,8 @@ def run_service(
|
|
|
690
696
|
)
|
|
691
697
|
|
|
692
698
|
print_section("Funding the service")
|
|
693
|
-
|
|
699
|
+
service = get_service(manager, template)
|
|
700
|
+
manager.funding_manager.topup_service_initial(service=service)
|
|
694
701
|
|
|
695
702
|
print_section("Deploying the service")
|
|
696
703
|
manager.deploy_service_locally(
|
{olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/quickstart/utils.py
RENAMED
|
@@ -208,12 +208,12 @@ def ask_or_get_from_env(
|
|
|
208
208
|
return ""
|
|
209
209
|
|
|
210
210
|
|
|
211
|
-
def check_rpc(rpc_url: Optional[str] = None) -> bool:
|
|
211
|
+
def check_rpc(chain: str, rpc_url: Optional[str] = None) -> bool:
|
|
212
212
|
"""Check RPC."""
|
|
213
213
|
if rpc_url is None:
|
|
214
214
|
return False
|
|
215
215
|
|
|
216
|
-
spinner = Halo(text="Checking RPC...", spinner="dots")
|
|
216
|
+
spinner = Halo(text=f"[{chain}] Checking RPC...", spinner="dots")
|
|
217
217
|
spinner.start()
|
|
218
218
|
|
|
219
219
|
rpc_data = {
|
|
@@ -230,7 +230,7 @@ def check_rpc(rpc_url: Optional[str] = None) -> bool:
|
|
|
230
230
|
response.raise_for_status()
|
|
231
231
|
rpc_response = response.json()
|
|
232
232
|
except (requests.exceptions.RequestException, ValueError, TypeError) as e:
|
|
233
|
-
spinner.fail(f"Error: Failed to send RPC request: {e}")
|
|
233
|
+
spinner.fail(f"Error: Failed to send {chain} RPC request: {e}")
|
|
234
234
|
return False
|
|
235
235
|
|
|
236
236
|
rpc_error_message = (
|
|
@@ -246,24 +246,24 @@ def check_rpc(rpc_url: Optional[str] = None) -> bool:
|
|
|
246
246
|
print(" Received response:")
|
|
247
247
|
print(" ", rpc_response)
|
|
248
248
|
print("")
|
|
249
|
-
spinner.fail("Terminating script.")
|
|
249
|
+
spinner.fail(f"[{chain}] Terminating script.")
|
|
250
250
|
elif rpc_error_message == "out of requests":
|
|
251
251
|
print("Error: The provided rpc is out of requests.")
|
|
252
|
-
spinner.fail("Terminating script.")
|
|
252
|
+
spinner.fail(f"[{chain}] Terminating script.")
|
|
253
253
|
elif (
|
|
254
254
|
rpc_error_message == "the method eth_newfilter does not exist/is not available"
|
|
255
255
|
):
|
|
256
256
|
print("Error: The provided RPC does not support 'eth_newFilter'.")
|
|
257
|
-
spinner.fail("Terminating script.")
|
|
257
|
+
spinner.fail(f"[{chain}] Terminating script.")
|
|
258
258
|
elif "invalid" in rpc_error_message or "params" in rpc_error_message:
|
|
259
|
-
spinner.succeed("RPC checks passed.")
|
|
259
|
+
spinner.succeed(f"[{chain}] RPC checks passed.")
|
|
260
260
|
return True
|
|
261
261
|
else:
|
|
262
262
|
print("Error: Unknown rpc error.")
|
|
263
263
|
print(" Received response:")
|
|
264
264
|
print(" ", rpc_response)
|
|
265
265
|
print("")
|
|
266
|
-
spinner.fail("Terminating script.")
|
|
266
|
+
spinner.fail(f"[{chain}] Terminating script.")
|
|
267
267
|
|
|
268
268
|
return False
|
|
269
269
|
|
|
@@ -90,6 +90,7 @@ class FundingManager:
|
|
|
90
90
|
self._lock = threading.Lock()
|
|
91
91
|
self._funding_in_progress: t.Dict[str, bool] = {}
|
|
92
92
|
self._funding_requests_cooldown_until: t.Dict[str, float] = {}
|
|
93
|
+
self.is_for_quickstart = False
|
|
93
94
|
|
|
94
95
|
def drain_agents_eoas(
|
|
95
96
|
self, service: Service, withdrawal_address: str, chain: Chain
|
|
@@ -650,7 +651,11 @@ class FundingManager:
|
|
|
650
651
|
# We assume that if the service safe is created in any chain,
|
|
651
652
|
# we have requested the funding already.
|
|
652
653
|
service_initial_topup = service.get_initial_funding_amounts()
|
|
653
|
-
if
|
|
654
|
+
if self.is_for_quickstart:
|
|
655
|
+
service_initial_shortfalls = self.compute_service_initial_shortfalls(
|
|
656
|
+
service
|
|
657
|
+
)
|
|
658
|
+
elif not all(
|
|
654
659
|
SERVICE_SAFE_PLACEHOLDER in addresses
|
|
655
660
|
for addresses in service_initial_topup.values()
|
|
656
661
|
):
|
|
@@ -795,6 +800,21 @@ class FundingManager:
|
|
|
795
800
|
"""Fund service initially"""
|
|
796
801
|
self.fund_chain_amounts(service.get_initial_funding_amounts())
|
|
797
802
|
|
|
803
|
+
def compute_service_initial_shortfalls(self, service: Service) -> ChainAmounts:
|
|
804
|
+
"""Compute service initial shortfalls"""
|
|
805
|
+
initial_funding_amounts = service.get_initial_funding_amounts()
|
|
806
|
+
service_balances = service.get_balances()
|
|
807
|
+
return self._compute_shortfalls(
|
|
808
|
+
balances=service_balances,
|
|
809
|
+
thresholds=initial_funding_amounts,
|
|
810
|
+
topups=initial_funding_amounts,
|
|
811
|
+
)
|
|
812
|
+
|
|
813
|
+
def topup_service_initial(self, service: Service) -> None:
|
|
814
|
+
"""Fund service enough to reach initial funding amounts"""
|
|
815
|
+
service_initial_shortfalls = self.compute_service_initial_shortfalls(service)
|
|
816
|
+
self.fund_chain_amounts(service_initial_shortfalls)
|
|
817
|
+
|
|
798
818
|
def fund_chain_amounts(self, amounts: ChainAmounts) -> None:
|
|
799
819
|
"""Fund chain amounts"""
|
|
800
820
|
required = self._aggregate_as_master_safe_amounts(amounts)
|
{olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/services/service.py
RENAMED
|
@@ -76,7 +76,7 @@ from operate.constants import (
|
|
|
76
76
|
ZERO_ADDRESS,
|
|
77
77
|
)
|
|
78
78
|
from operate.keys import KeysManager
|
|
79
|
-
from operate.ledger import get_default_rpc
|
|
79
|
+
from operate.ledger import get_default_ledger_api, get_default_rpc
|
|
80
80
|
from operate.operate_http.exceptions import NotAllowed
|
|
81
81
|
from operate.operate_types import (
|
|
82
82
|
Chain,
|
|
@@ -97,6 +97,7 @@ from operate.operate_types import (
|
|
|
97
97
|
from operate.resource import LocalResource
|
|
98
98
|
from operate.services.deployment_runner import run_host_deployment, stop_host_deployment
|
|
99
99
|
from operate.services.utils import tendermint
|
|
100
|
+
from operate.utils.gnosis import get_asset_balance
|
|
100
101
|
from operate.utils.ssl import create_ssl_certificate
|
|
101
102
|
|
|
102
103
|
|
|
@@ -1148,6 +1149,29 @@ class Service(LocalResource):
|
|
|
1148
1149
|
|
|
1149
1150
|
return amounts
|
|
1150
1151
|
|
|
1152
|
+
def get_balances(self) -> ChainAmounts:
|
|
1153
|
+
"""Get balances of the agent addresses and service safe."""
|
|
1154
|
+
initial_funding_amounts = self.get_initial_funding_amounts()
|
|
1155
|
+
return ChainAmounts(
|
|
1156
|
+
{
|
|
1157
|
+
chain_str: {
|
|
1158
|
+
address: {
|
|
1159
|
+
asset: get_asset_balance(
|
|
1160
|
+
ledger_api=get_default_ledger_api(
|
|
1161
|
+
Chain.from_string(chain_str)
|
|
1162
|
+
),
|
|
1163
|
+
asset_address=asset,
|
|
1164
|
+
address=address,
|
|
1165
|
+
raise_on_invalid_address=False,
|
|
1166
|
+
)
|
|
1167
|
+
for asset in tokens
|
|
1168
|
+
}
|
|
1169
|
+
for address, tokens in addresses.items()
|
|
1170
|
+
}
|
|
1171
|
+
for chain_str, addresses in initial_funding_amounts.items()
|
|
1172
|
+
}
|
|
1173
|
+
)
|
|
1174
|
+
|
|
1151
1175
|
def get_funding_requests(self) -> ChainAmounts:
|
|
1152
1176
|
"""Get funding amounts requested by the agent."""
|
|
1153
1177
|
agent_response = {}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/account/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/bridge/bridge_manager.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/data/contracts/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/ledger/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/operate_http/__init__.py
RENAMED
|
File without changes
|
{olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/operate_http/exceptions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/quickstart/analyse_logs.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/quickstart/stop_service.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/services/__init__.py
RENAMED
|
File without changes
|
{olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/services/agent_runner.py
RENAMED
|
File without changes
|
|
File without changes
|
{olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/services/health_checker.py
RENAMED
|
File without changes
|
{olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/services/manage.py
RENAMED
|
File without changes
|
{olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/services/protocol.py
RENAMED
|
File without changes
|
{olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/services/utils/__init__.py
RENAMED
|
File without changes
|
{olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/services/utils/mech.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/utils/single_instance.py
RENAMED
|
File without changes
|
|
File without changes
|
{olas_operate_middleware-0.11.0 → olas_operate_middleware-0.11.2}/operate/wallet/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|