olas-operate-middleware 0.10.20__py3-none-any.whl → 0.11.0__py3-none-any.whl
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.10.20.dist-info → olas_operate_middleware-0.11.0.dist-info}/METADATA +3 -1
- {olas_operate_middleware-0.10.20.dist-info → olas_operate_middleware-0.11.0.dist-info}/RECORD +25 -22
- operate/bridge/bridge_manager.py +10 -12
- operate/bridge/providers/native_bridge_provider.py +1 -1
- operate/bridge/providers/provider.py +21 -34
- operate/cli.py +438 -108
- operate/constants.py +20 -0
- operate/ledger/__init__.py +55 -5
- operate/ledger/profiles.py +79 -11
- operate/operate_types.py +205 -2
- operate/quickstart/run_service.py +1 -1
- operate/services/agent_runner.py +5 -3
- operate/services/deployment_runner.py +3 -0
- operate/services/funding_manager.py +904 -0
- operate/services/manage.py +165 -306
- operate/services/protocol.py +392 -140
- operate/services/service.py +81 -5
- operate/settings.py +70 -0
- operate/utils/gnosis.py +79 -24
- operate/utils/single_instance.py +226 -0
- operate/wallet/master.py +214 -177
- operate/wallet/wallet_recovery_manager.py +5 -5
- {olas_operate_middleware-0.10.20.dist-info → olas_operate_middleware-0.11.0.dist-info}/WHEEL +0 -0
- {olas_operate_middleware-0.10.20.dist-info → olas_operate_middleware-0.11.0.dist-info}/entry_points.txt +0 -0
- {olas_operate_middleware-0.10.20.dist-info → olas_operate_middleware-0.11.0.dist-info}/licenses/LICENSE +0 -0
{olas_operate_middleware-0.10.20.dist-info → olas_operate_middleware-0.11.0.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: olas-operate-middleware
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.11.0
|
|
4
4
|
Summary:
|
|
5
5
|
License-File: LICENSE
|
|
6
6
|
Author: David Vilela
|
|
@@ -30,6 +30,7 @@ Requires-Dist: halo (==0.0.31)
|
|
|
30
30
|
Requires-Dist: hexbytes (==0.3.1)
|
|
31
31
|
Requires-Dist: ipfshttpclient (==0.8.0a2)
|
|
32
32
|
Requires-Dist: jsonschema (==4.3.3)
|
|
33
|
+
Requires-Dist: multiaddr (==0.0.9)
|
|
33
34
|
Requires-Dist: multidict (==6.0.5)
|
|
34
35
|
Requires-Dist: open-aea-cli-ipfs (==1.65.0)
|
|
35
36
|
Requires-Dist: open-aea-ledger-cosmos (==1.65.0)
|
|
@@ -38,6 +39,7 @@ Requires-Dist: open-aea-ledger-ethereum-flashbots (==1.65.0)
|
|
|
38
39
|
Requires-Dist: open-autonomy (>=0.20.2,<0.21.0)
|
|
39
40
|
Requires-Dist: psutil (>=5.9.8,<6.0.0)
|
|
40
41
|
Requires-Dist: pyinstaller (>=6.8.0,<7.0.0)
|
|
42
|
+
Requires-Dist: requests-mock (>=1.12.1,<2.0.0)
|
|
41
43
|
Requires-Dist: requests-toolbelt (==1.0.0)
|
|
42
44
|
Requires-Dist: starlette (==0.37.2)
|
|
43
45
|
Requires-Dist: twikit (==2.2.0)
|
{olas_operate_middleware-0.10.20.dist-info → olas_operate_middleware-0.11.0.dist-info}/RECORD
RENAMED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
operate/__init__.py,sha256=PY5BUTF5cmNI-7UwAj2jJlPl6KJ44LoY5e16p7IrE3g,1335
|
|
2
2
|
operate/account/__init__.py,sha256=suJ_vBMO7hLCvLYe3MVDtLXTNDd6P03og7bvUN7fZsE,804
|
|
3
3
|
operate/account/user.py,sha256=y7DqqDpqgHjbVmnfL_cN0Me_JWl3Dh6GSVt2-9FdRVw,3044
|
|
4
|
-
operate/bridge/bridge_manager.py,sha256=
|
|
4
|
+
operate/bridge/bridge_manager.py,sha256=gQuZ0uf70o_YqG5EmZN3A0-inQGAvnIZlUDgtmorgUI,17045
|
|
5
5
|
operate/bridge/providers/lifi_provider.py,sha256=UzAeEnX9FGpnCYYml5lcICeEZeHHqNRCHkGZ-npgteo,14208
|
|
6
|
-
operate/bridge/providers/native_bridge_provider.py,sha256=
|
|
7
|
-
operate/bridge/providers/provider.py,sha256=
|
|
6
|
+
operate/bridge/providers/native_bridge_provider.py,sha256=eo_X_mtsRRGFCI9CncZ1DpjLjYlgNqLDCeJ9jvvZ09c,24711
|
|
7
|
+
operate/bridge/providers/provider.py,sha256=KXp5CITCQ-fSOv2iFMOt8Wer1QGhBvJG0HN5Tnh5Qns,17287
|
|
8
8
|
operate/bridge/providers/relay_provider.py,sha256=4D2U8jrugh2DJZeSoxLCTVSZe8xMEwdCimqFDtfwWwc,17422
|
|
9
|
-
operate/cli.py,sha256=
|
|
10
|
-
operate/constants.py,sha256=
|
|
9
|
+
operate/cli.py,sha256=FQdLAbUkXl1Aqgd70rGSLJlsdSfYTm7KDJDAWgVIV1w,67547
|
|
10
|
+
operate/constants.py,sha256=FxQL9MmGHD-nNr7UBPb6ItltWtrCLB2fnT6fb4XNlKg,3849
|
|
11
11
|
operate/data/README.md,sha256=jGPyZTvg2LCGdllvmYxmFMkkkiXb6YWatbqIkcX3kv4,879
|
|
12
12
|
operate/data/__init__.py,sha256=ttC51Yqk9c4ehpIgs1Qbe7aJvzkrbbdZ1ClaCxJYByE,864
|
|
13
13
|
operate/data/contracts/__init__.py,sha256=_th54_WvL0ibGy-b6St0Ne9DX-fyjsh-tNOKDn-cWrg,809
|
|
@@ -58,41 +58,44 @@ operate/data/contracts/uniswap_v2_erc20/contract.yaml,sha256=XUdz-XtKtmZgLfItbO8
|
|
|
58
58
|
operate/data/contracts/uniswap_v2_erc20/tests/__init__.py,sha256=3Arw8dsCsJz6hVOl0t9UjFASHXbV9yp3hw6x4HqgXpU,847
|
|
59
59
|
operate/data/contracts/uniswap_v2_erc20/tests/test_contract.py,sha256=FzZbw9OTcr_yvjOXpk9YcO-K40eyDARyybcfSHDg2Ps,13392
|
|
60
60
|
operate/keys.py,sha256=IyXbKQkcH33021VaOfQC_ub0lHD6uCJaGtwGvjOMRs8,5650
|
|
61
|
-
operate/ledger/__init__.py,sha256=
|
|
62
|
-
operate/ledger/profiles.py,sha256=
|
|
61
|
+
operate/ledger/__init__.py,sha256=P5rPmLtlZ9qk7jLvzLqg5TxL4mj-bJedRfT3Ie-CRzE,6688
|
|
62
|
+
operate/ledger/profiles.py,sha256=GOh_VIet8Woa30Ps1RQkBT6YO8dzdBq6mLCw3kfQwKY,14073
|
|
63
63
|
operate/migration.py,sha256=TJhztfHUVhZ2buKHx10vXeVo1rRAORdbqGE8fLHL15I,17305
|
|
64
64
|
operate/operate_http/__init__.py,sha256=dxCIVSUos23M4R-PFZZG6k5QrOlEiK0SxhCYSFNxh7U,4711
|
|
65
65
|
operate/operate_http/exceptions.py,sha256=4UFzrn-GyDD71RhkaOyFPBynL6TrrtP3eywaaU3o4fc,1339
|
|
66
|
-
operate/operate_types.py,sha256=
|
|
66
|
+
operate/operate_types.py,sha256=hGzYW47MPxOQuvDQAD_TqyIHxNReTeDYQI_uKrfJ1Jc,15570
|
|
67
67
|
operate/pearl.py,sha256=yrTpSXLu_ML3qT-uNxq3kScOyo31JyxBujiSMfMUbcg,1690
|
|
68
68
|
operate/quickstart/analyse_logs.py,sha256=K11AWWevkddUIUzTe75J3fYVS6aLfi6kT_dAI9OjrX8,4195
|
|
69
69
|
operate/quickstart/claim_staking_rewards.py,sha256=K7X1Yq0mxe3qWmFLb1Xu9-Jghhml95lS_LpM_BXii0o,3533
|
|
70
70
|
operate/quickstart/reset_configs.py,sha256=ipPpbYyB9gQ4KOKS-xBrRi8fT5LvwctSkQi-8XiUMig,3341
|
|
71
71
|
operate/quickstart/reset_password.py,sha256=78riP7zyFM2JMa1H8Dh6pg-PtLJLQS7PFzx9SECPACQ,2571
|
|
72
72
|
operate/quickstart/reset_staking.py,sha256=SB5LZq9EctG4SYn2M6oPZ7R7ARHSFLRGzAqfKkpRcy0,5111
|
|
73
|
-
operate/quickstart/run_service.py,sha256=
|
|
73
|
+
operate/quickstart/run_service.py,sha256=loGVKQuHevWcX2nCkgO1oatSH88cWgH4BiZnmpOdAn8,27266
|
|
74
74
|
operate/quickstart/stop_service.py,sha256=CNcCucI4sqfZG0wTxxh-k14xGcbOh50UGyXqTZVQJP0,2048
|
|
75
75
|
operate/quickstart/terminate_on_chain_service.py,sha256=5ENU8_mkj06i80lKUX-v1QbLU0YzKeOZDUL1e_jzySE,2914
|
|
76
76
|
operate/quickstart/utils.py,sha256=rmd9e7whQIsYpRKqWBEQxMA_SHrivBg6DppFY5ECtQQ,9135
|
|
77
77
|
operate/resource.py,sha256=E59oIVqf6B6nN4LTmf_o2iCgLFAogTLPjm_cK6kMVxg,6305
|
|
78
78
|
operate/services/__init__.py,sha256=isrThS-Ccu5Sc15JZgkN4uTAVaSg-NwUUSDeTyJEqLk,855
|
|
79
|
-
operate/services/agent_runner.py,sha256=
|
|
80
|
-
operate/services/deployment_runner.py,sha256=
|
|
79
|
+
operate/services/agent_runner.py,sha256=IIN77vD_2lq_hCkai-3dJQ3Ae64GUOQncvv0wxb3qUE,7629
|
|
80
|
+
operate/services/deployment_runner.py,sha256=iT3gVZvz94kvd7vwtqJgPv74OJliz5XrgjJ_SNFiuEk,27191
|
|
81
|
+
operate/services/funding_manager.py,sha256=BbrqTpAprDNgjTS2tEfWXlmLfveU6ASwGw_7qJtadZw,37493
|
|
81
82
|
operate/services/health_checker.py,sha256=r_lMlRZu-UNfqaM-Zo5_cWjsigdqYTAty4h-ISpM7RE,9859
|
|
82
|
-
operate/services/manage.py,sha256=
|
|
83
|
-
operate/services/protocol.py,sha256=
|
|
84
|
-
operate/services/service.py,sha256=
|
|
83
|
+
operate/services/manage.py,sha256=PyjrcH46bMtSalbpl25roGZlwg7ZEuGkw8gEbahUzj8,112710
|
|
84
|
+
operate/services/protocol.py,sha256=KJK4jpwWbVqXaCNZNo84Sqxo32SFaxUQ_O8Jwq7im4g,71871
|
|
85
|
+
operate/services/service.py,sha256=S0xFMKUCk6Ib13HIU2xSjwtjo95fzfk-PftEP2oT1Ww,42733
|
|
85
86
|
operate/services/utils/__init__.py,sha256=TvioaZ1mfTRUSCtrQoLNAp4WMVXyqEJqFJM4PxSQCRU,24
|
|
86
87
|
operate/services/utils/mech.py,sha256=W2x4dqodivNKXjWU-Brp40QhoUHsIMyNAO7-caMoR0Q,3821
|
|
87
88
|
operate/services/utils/tendermint.py,sha256=3h9nDb2Z89T0RwUr_AaVjqtymQmsu3u6DAVCfL_k1U0,25591
|
|
89
|
+
operate/settings.py,sha256=0J2E69-Oplo-Ijy-7rzYHc2Q9Xvct-EUMiEdmKKaYOQ,2353
|
|
88
90
|
operate/utils/__init__.py,sha256=rGxT0uLZYixofOrTY_MSnTlpfC4FDAxuNDyA4N-GDkM,3576
|
|
89
|
-
operate/utils/gnosis.py,sha256=
|
|
91
|
+
operate/utils/gnosis.py,sha256=iyaFw3ZMlNnd1lDulhXfcYxQunPL4Zfhnk1fy20ga7g,19843
|
|
92
|
+
operate/utils/single_instance.py,sha256=pmtumg0fFDWWcGzXFXQdLXSW54Zq9qBKgJTEPF6pVW8,9092
|
|
90
93
|
operate/utils/ssl.py,sha256=O5DrDoZD4T4qQuHP8GLwWUVxQ-1qXeefGp6uDJiF2lM,4308
|
|
91
94
|
operate/wallet/__init__.py,sha256=NGiozD3XhvkBi7_FaOWQ8x1thZPK4uGpokJaeDY_o2w,813
|
|
92
|
-
operate/wallet/master.py,sha256=
|
|
93
|
-
operate/wallet/wallet_recovery_manager.py,sha256=
|
|
94
|
-
olas_operate_middleware-0.
|
|
95
|
-
olas_operate_middleware-0.
|
|
96
|
-
olas_operate_middleware-0.
|
|
97
|
-
olas_operate_middleware-0.
|
|
98
|
-
olas_operate_middleware-0.
|
|
95
|
+
operate/wallet/master.py,sha256=gcax6M8_KT2IkL0kGZP4lF4f2updoP5r6ix5e72ZrL4,33674
|
|
96
|
+
operate/wallet/wallet_recovery_manager.py,sha256=ZOLq0B9irux_og8pLBzaxlRA1r6RqJfZA4j4RX0kzoU,7775
|
|
97
|
+
olas_operate_middleware-0.11.0.dist-info/METADATA,sha256=aTW-ySUHCFjiOW4lcIWlaoMZTcc29Nac7AJ-4pOwAHE,2139
|
|
98
|
+
olas_operate_middleware-0.11.0.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
99
|
+
olas_operate_middleware-0.11.0.dist-info/entry_points.txt,sha256=dM1g2I7ODApKQFcgl5J4NGA7pfBTo6qsUTXM-j2OLlw,44
|
|
100
|
+
olas_operate_middleware-0.11.0.dist-info/licenses/LICENSE,sha256=mdBDB-mWKV5Cz4ejBzBiKqan6Z8zVLAh9xwM64O2FW4,11339
|
|
101
|
+
olas_operate_middleware-0.11.0.dist-info/RECORD,,
|
operate/bridge/bridge_manager.py
CHANGED
|
@@ -42,10 +42,9 @@ from operate.bridge.providers.provider import Provider, ProviderRequest
|
|
|
42
42
|
from operate.bridge.providers.relay_provider import RelayProvider
|
|
43
43
|
from operate.constants import ZERO_ADDRESS
|
|
44
44
|
from operate.ledger.profiles import USDC
|
|
45
|
-
from operate.operate_types import Chain
|
|
45
|
+
from operate.operate_types import Chain, ChainAmounts
|
|
46
46
|
from operate.resource import LocalResource
|
|
47
47
|
from operate.services.manage import get_assets_balances
|
|
48
|
-
from operate.utils import merge_sum_dicts, subtract_dicts
|
|
49
48
|
from operate.wallet.master import MasterWalletManager
|
|
50
49
|
|
|
51
50
|
|
|
@@ -187,13 +186,13 @@ class BridgeManager:
|
|
|
187
186
|
path: Path,
|
|
188
187
|
wallet_manager: MasterWalletManager,
|
|
189
188
|
logger: logging.Logger,
|
|
190
|
-
|
|
189
|
+
bundle_validity_period: int = DEFAULT_BUNDLE_VALIDITY_PERIOD,
|
|
191
190
|
) -> None:
|
|
192
191
|
"""Initialize bridge manager."""
|
|
193
192
|
self.path = path
|
|
194
193
|
self.wallet_manager = wallet_manager
|
|
195
194
|
self.logger = logger
|
|
196
|
-
self.
|
|
195
|
+
self.bundle_validity_period = bundle_validity_period
|
|
197
196
|
self.path.mkdir(exist_ok=True)
|
|
198
197
|
(self.path / EXECUTED_BUNDLES_PATH).mkdir(exist_ok=True)
|
|
199
198
|
self.data: BridgeManagerData = cast(
|
|
@@ -251,7 +250,7 @@ class BridgeManager:
|
|
|
251
250
|
self.logger.info("[BRIDGE MANAGER] Force bundle update.")
|
|
252
251
|
self.quote_bundle(bundle)
|
|
253
252
|
self._store_data()
|
|
254
|
-
elif now > bundle.timestamp + self.
|
|
253
|
+
elif now > bundle.timestamp + self.bundle_validity_period:
|
|
255
254
|
self.logger.info("[BRIDGE MANAGER] Bundle expired.")
|
|
256
255
|
self.quote_bundle(bundle)
|
|
257
256
|
self._store_data()
|
|
@@ -335,7 +334,7 @@ class BridgeManager:
|
|
|
335
334
|
|
|
336
335
|
bundle = self._get_updated_bundle(requests_params, force_update)
|
|
337
336
|
|
|
338
|
-
balances =
|
|
337
|
+
balances = ChainAmounts()
|
|
339
338
|
for chain in bundle.get_from_chains():
|
|
340
339
|
ledger_api = self.wallet_manager.load(chain.ledger_type).ledger_api(chain)
|
|
341
340
|
balances[chain.value] = get_assets_balances(
|
|
@@ -346,9 +345,8 @@ class BridgeManager:
|
|
|
346
345
|
|
|
347
346
|
bridge_total_requirements = self.bridge_total_requirements(bundle)
|
|
348
347
|
|
|
349
|
-
bridge_refill_requirements =
|
|
350
|
-
|
|
351
|
-
subtract_dicts(bridge_total_requirements, balances),
|
|
348
|
+
bridge_refill_requirements = ChainAmounts.shortfalls(
|
|
349
|
+
bridge_total_requirements, balances
|
|
352
350
|
)
|
|
353
351
|
|
|
354
352
|
is_refill_required = any(
|
|
@@ -364,7 +362,7 @@ class BridgeManager:
|
|
|
364
362
|
"balances": balances,
|
|
365
363
|
"bridge_refill_requirements": bridge_refill_requirements,
|
|
366
364
|
"bridge_total_requirements": bridge_total_requirements,
|
|
367
|
-
"expiration_timestamp": bundle.timestamp + self.
|
|
365
|
+
"expiration_timestamp": bundle.timestamp + self.bundle_validity_period,
|
|
368
366
|
"is_refill_required": is_refill_required,
|
|
369
367
|
}
|
|
370
368
|
)
|
|
@@ -441,14 +439,14 @@ class BridgeManager:
|
|
|
441
439
|
"bridge_request_status": provider_request_status,
|
|
442
440
|
}
|
|
443
441
|
|
|
444
|
-
def bridge_total_requirements(self, bundle: ProviderRequestBundle) ->
|
|
442
|
+
def bridge_total_requirements(self, bundle: ProviderRequestBundle) -> ChainAmounts:
|
|
445
443
|
"""Sum bridge requirements."""
|
|
446
444
|
requirements = []
|
|
447
445
|
for provider_request in bundle.provider_requests:
|
|
448
446
|
provider = self._providers[provider_request.provider_id]
|
|
449
447
|
requirements.append(provider.requirements(provider_request))
|
|
450
448
|
|
|
451
|
-
return
|
|
449
|
+
return ChainAmounts.add(*requirements)
|
|
452
450
|
|
|
453
451
|
def quote_bundle(self, bundle: ProviderRequestBundle) -> None:
|
|
454
452
|
"""Update the bundle with the quotes."""
|
|
@@ -97,7 +97,7 @@ class BridgeContractAdaptor(ABC):
|
|
|
97
97
|
if from_token == ZERO_ADDRESS and to_token == ZERO_ADDRESS:
|
|
98
98
|
return True
|
|
99
99
|
|
|
100
|
-
for token_map in ERC20_TOKENS:
|
|
100
|
+
for token_map in ERC20_TOKENS.values():
|
|
101
101
|
if (
|
|
102
102
|
Chain(from_chain) in token_map
|
|
103
103
|
and Chain(to_chain) in token_map
|
|
@@ -32,7 +32,6 @@ from dataclasses import dataclass
|
|
|
32
32
|
from aea.crypto.base import LedgerApi
|
|
33
33
|
from autonomy.chain.tx import TxSettler
|
|
34
34
|
from web3 import Web3
|
|
35
|
-
from web3.middleware import geth_poa_middleware
|
|
36
35
|
|
|
37
36
|
from operate.constants import (
|
|
38
37
|
ON_CHAIN_INTERACT_RETRIES,
|
|
@@ -40,8 +39,8 @@ from operate.constants import (
|
|
|
40
39
|
ON_CHAIN_INTERACT_TIMEOUT,
|
|
41
40
|
ZERO_ADDRESS,
|
|
42
41
|
)
|
|
43
|
-
from operate.ledger import update_tx_with_gas_pricing
|
|
44
|
-
from operate.operate_types import Chain
|
|
42
|
+
from operate.ledger import get_default_ledger_api, update_tx_with_gas_pricing
|
|
43
|
+
from operate.operate_types import Chain, ChainAmounts
|
|
45
44
|
from operate.resource import LocalResource
|
|
46
45
|
from operate.wallet.master import MasterWalletManager
|
|
47
46
|
|
|
@@ -218,28 +217,12 @@ class Provider(ABC):
|
|
|
218
217
|
def _from_ledger_api(self, provider_request: ProviderRequest) -> LedgerApi:
|
|
219
218
|
"""Get the from ledger api."""
|
|
220
219
|
from_chain = provider_request.params["from"]["chain"]
|
|
221
|
-
|
|
222
|
-
wallet = self.wallet_manager.load(chain.ledger_type)
|
|
223
|
-
ledger_api = wallet.ledger_api(chain)
|
|
224
|
-
|
|
225
|
-
# TODO: Backport to open aea/autonomy
|
|
226
|
-
if chain == Chain.OPTIMISM:
|
|
227
|
-
ledger_api.api.middleware_onion.inject(geth_poa_middleware, layer=0)
|
|
228
|
-
|
|
229
|
-
return ledger_api
|
|
220
|
+
return get_default_ledger_api(Chain(from_chain))
|
|
230
221
|
|
|
231
222
|
def _to_ledger_api(self, provider_request: ProviderRequest) -> LedgerApi:
|
|
232
223
|
"""Get the from ledger api."""
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
wallet = self.wallet_manager.load(chain.ledger_type)
|
|
236
|
-
ledger_api = wallet.ledger_api(chain)
|
|
237
|
-
|
|
238
|
-
# TODO: Backport to open aea/autonomy
|
|
239
|
-
if chain == Chain.OPTIMISM:
|
|
240
|
-
ledger_api.api.middleware_onion.inject(geth_poa_middleware, layer=0)
|
|
241
|
-
|
|
242
|
-
return ledger_api
|
|
224
|
+
to_chain = provider_request.params["to"]["chain"]
|
|
225
|
+
return get_default_ledger_api(Chain(to_chain))
|
|
243
226
|
|
|
244
227
|
@abstractmethod
|
|
245
228
|
def quote(self, provider_request: ProviderRequest) -> None:
|
|
@@ -253,7 +236,7 @@ class Provider(ABC):
|
|
|
253
236
|
"""Get the sorted list of transactions to execute the quote."""
|
|
254
237
|
raise NotImplementedError()
|
|
255
238
|
|
|
256
|
-
def requirements(self, provider_request: ProviderRequest) ->
|
|
239
|
+
def requirements(self, provider_request: ProviderRequest) -> ChainAmounts:
|
|
257
240
|
"""Gets the requirements to execute the quote, with updated gas estimation."""
|
|
258
241
|
self.logger.info(f"[PROVIDER] Requirements for request {provider_request.id}.")
|
|
259
242
|
|
|
@@ -267,14 +250,16 @@ class Provider(ABC):
|
|
|
267
250
|
txs = self._get_txs(provider_request)
|
|
268
251
|
|
|
269
252
|
if not txs:
|
|
270
|
-
return
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
253
|
+
return ChainAmounts(
|
|
254
|
+
{
|
|
255
|
+
from_chain: {
|
|
256
|
+
from_address: {
|
|
257
|
+
ZERO_ADDRESS: 0,
|
|
258
|
+
from_token: 0,
|
|
259
|
+
}
|
|
275
260
|
}
|
|
276
261
|
}
|
|
277
|
-
|
|
262
|
+
)
|
|
278
263
|
|
|
279
264
|
total_native = 0
|
|
280
265
|
total_gas_fees = 0
|
|
@@ -312,13 +297,15 @@ class Provider(ABC):
|
|
|
312
297
|
f"[PROVIDER] Total gas fees for request {provider_request.id}: {total_gas_fees} native units."
|
|
313
298
|
)
|
|
314
299
|
|
|
315
|
-
result =
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
300
|
+
result = ChainAmounts(
|
|
301
|
+
{
|
|
302
|
+
from_chain: {
|
|
303
|
+
from_address: {
|
|
304
|
+
ZERO_ADDRESS: total_native,
|
|
305
|
+
}
|
|
319
306
|
}
|
|
320
307
|
}
|
|
321
|
-
|
|
308
|
+
)
|
|
322
309
|
|
|
323
310
|
if from_token != ZERO_ADDRESS:
|
|
324
311
|
result[from_chain][from_address][from_token] = total_token
|