olas-operate-middleware 0.14.4__py3-none-any.whl → 0.14.5__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.
Potentially problematic release.
This version of olas-operate-middleware might be problematic. Click here for more details.
- {olas_operate_middleware-0.14.4.dist-info → olas_operate_middleware-0.14.5.dist-info}/METADATA +1 -1
- {olas_operate_middleware-0.14.4.dist-info → olas_operate_middleware-0.14.5.dist-info}/RECORD +13 -13
- operate/bridge/providers/provider.py +24 -7
- operate/cli.py +1 -1
- operate/constants.py +2 -1
- operate/ledger/profiles.py +7 -0
- operate/services/manage.py +11 -0
- operate/services/protocol.py +23 -3
- operate/services/service.py +7 -6
- operate/wallet/master.py +6 -2
- {olas_operate_middleware-0.14.4.dist-info → olas_operate_middleware-0.14.5.dist-info}/WHEEL +0 -0
- {olas_operate_middleware-0.14.4.dist-info → olas_operate_middleware-0.14.5.dist-info}/entry_points.txt +0 -0
- {olas_operate_middleware-0.14.4.dist-info → olas_operate_middleware-0.14.5.dist-info}/licenses/LICENSE +0 -0
{olas_operate_middleware-0.14.4.dist-info → olas_operate_middleware-0.14.5.dist-info}/RECORD
RENAMED
|
@@ -4,10 +4,10 @@ operate/account/user.py,sha256=y7DqqDpqgHjbVmnfL_cN0Me_JWl3Dh6GSVt2-9FdRVw,3044
|
|
|
4
4
|
operate/bridge/bridge_manager.py,sha256=X3TQDevI5WRsn9PRbGUbaNaZujJWKutYpPZeH2QG9qM,17460
|
|
5
5
|
operate/bridge/providers/lifi_provider.py,sha256=UzAeEnX9FGpnCYYml5lcICeEZeHHqNRCHkGZ-npgteo,14208
|
|
6
6
|
operate/bridge/providers/native_bridge_provider.py,sha256=vAx0MtVPIAxIdQ5OKSUDhnGurYVkC8tKVJRFK9NkIdk,25088
|
|
7
|
-
operate/bridge/providers/provider.py,sha256=
|
|
7
|
+
operate/bridge/providers/provider.py,sha256=1sXenBtHvIwLPMK6eykUctTWrGCdG6_Gp6FK6jAFgug,18044
|
|
8
8
|
operate/bridge/providers/relay_provider.py,sha256=QU9H9mCAUgQx-qMKXkCGfFNimi1WGoxmKO30F2K9erw,17628
|
|
9
|
-
operate/cli.py,sha256=
|
|
10
|
-
operate/constants.py,sha256=
|
|
9
|
+
operate/cli.py,sha256=kwdRk0WzDpoUWegSJfvKYkjaRPavVW6jrIqs7wwI6Dc,72205
|
|
10
|
+
operate/constants.py,sha256=5o_LHGs201VyPPQFsghJkQLirphAxPttC1wUA_DsZDM,4061
|
|
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
|
|
@@ -55,7 +55,7 @@ operate/data/contracts/uniswap_v2_erc20/tests/__init__.py,sha256=3Arw8dsCsJz6hVO
|
|
|
55
55
|
operate/data/contracts/uniswap_v2_erc20/tests/test_contract.py,sha256=z4GfybA_oZUA6-sl61qaJ78rXdbcW_rk4APzgMzQD38,13456
|
|
56
56
|
operate/keys.py,sha256=qfT3-ZS1R2jG_t7BdqUdgrAYqHnj6dNrtK5c0-_AODU,6179
|
|
57
57
|
operate/ledger/__init__.py,sha256=c41SqGLSpLBvG_q1cPyDh1aunByopsIIC5Mfk1vdmQE,6207
|
|
58
|
-
operate/ledger/profiles.py,sha256=
|
|
58
|
+
operate/ledger/profiles.py,sha256=euY3SJjhI6t0DwUT1BfJskzALoGtCRsqYY-WBL25xsw,16039
|
|
59
59
|
operate/migration.py,sha256=hdZlhhdkoPPzkOD0CFyNYAp-eqUrVu_PJnw8_PoxpWk,21015
|
|
60
60
|
operate/operate_http/__init__.py,sha256=MTS1tMZ5qnA_WzaoeLxlK9IJToMGIpkNr7_vyBeAqZ8,4680
|
|
61
61
|
operate/operate_http/exceptions.py,sha256=4UFzrn-GyDD71RhkaOyFPBynL6TrrtP3eywaaU3o4fc,1339
|
|
@@ -77,9 +77,9 @@ operate/services/agent_runner.py,sha256=JGjyrzA5hX4Nuh79h81-dl2hdt74ZkC63t7UsGXY
|
|
|
77
77
|
operate/services/deployment_runner.py,sha256=7A94QpZu100BwIk1Q9Cr0SVK5Sj7nTWx2GRCwr0gvaM,30772
|
|
78
78
|
operate/services/funding_manager.py,sha256=pURhGwo2-3c7_EiQE_BuECLQsD7t_86KgL27bzliHkc,41680
|
|
79
79
|
operate/services/health_checker.py,sha256=dARikrgzU1jEuK4NUqlZ7N0DQq4Ah1ZiRKHmrlh8v-A,11472
|
|
80
|
-
operate/services/manage.py,sha256=
|
|
81
|
-
operate/services/protocol.py,sha256=
|
|
82
|
-
operate/services/service.py,sha256=
|
|
80
|
+
operate/services/manage.py,sha256=Akl--NwLrJkEd-4w9_NHysKLLd0sgd6U_3oIPLTAB3I,113806
|
|
81
|
+
operate/services/protocol.py,sha256=PoFrEXujFvwFm56Hh68TIMmZf1O6HEEVrNQbMJ1ryYs,72398
|
|
82
|
+
operate/services/service.py,sha256=VOBwOhZmFUxL-7kVk4Wd2IzNK2OTiBhX9Tock15twdw,50507
|
|
83
83
|
operate/services/utils/__init__.py,sha256=TvioaZ1mfTRUSCtrQoLNAp4WMVXyqEJqFJM4PxSQCRU,24
|
|
84
84
|
operate/services/utils/mech.py,sha256=98gNw8pMNvv_O34V1blr7JUwenqxFeeyFuXLuSYv10w,3864
|
|
85
85
|
operate/services/utils/tendermint.py,sha256=M4zjF97SOJomhmj97bWKIphnia30lbDie65fs_vy_q8,25686
|
|
@@ -89,10 +89,10 @@ operate/utils/gnosis.py,sha256=1PrEnwkVF9lEFsFJlQXk5yXFsARGnIMPhJCrN-pRrxs,18128
|
|
|
89
89
|
operate/utils/single_instance.py,sha256=1qVibsLoK2m45ip38kRC6IMghaza_kD14D0wAbevcYk,9090
|
|
90
90
|
operate/utils/ssl.py,sha256=O5DrDoZD4T4qQuHP8GLwWUVxQ-1qXeefGp6uDJiF2lM,4308
|
|
91
91
|
operate/wallet/__init__.py,sha256=NGiozD3XhvkBi7_FaOWQ8x1thZPK4uGpokJaeDY_o2w,813
|
|
92
|
-
operate/wallet/master.py,sha256=
|
|
92
|
+
operate/wallet/master.py,sha256=fBzZiGQ1-cBVIjbZPGXH_MCxqDsD0h0gXrphAEY8D5g,33896
|
|
93
93
|
operate/wallet/wallet_recovery_manager.py,sha256=kZIKBCIVb-ufntUoCE0IqAJ-Q2YUIl7955UYY6sp8Os,19856
|
|
94
|
-
olas_operate_middleware-0.14.
|
|
95
|
-
olas_operate_middleware-0.14.
|
|
96
|
-
olas_operate_middleware-0.14.
|
|
97
|
-
olas_operate_middleware-0.14.
|
|
98
|
-
olas_operate_middleware-0.14.
|
|
94
|
+
olas_operate_middleware-0.14.5.dist-info/METADATA,sha256=b4B3Z1wJLd3ERu7-X9MtVzwhhq5JwKhHoS3CHTof8wk,1492
|
|
95
|
+
olas_operate_middleware-0.14.5.dist-info/WHEEL,sha256=3ny-bZhpXrU6vSQ1UPG34FoxZBp3lVcvK0LkgUz6VLk,88
|
|
96
|
+
olas_operate_middleware-0.14.5.dist-info/entry_points.txt,sha256=dM1g2I7ODApKQFcgl5J4NGA7pfBTo6qsUTXM-j2OLlw,44
|
|
97
|
+
olas_operate_middleware-0.14.5.dist-info/licenses/LICENSE,sha256=mdBDB-mWKV5Cz4ejBzBiKqan6Z8zVLAh9xwM64O2FW4,11339
|
|
98
|
+
olas_operate_middleware-0.14.5.dist-info/RECORD,,
|
|
@@ -61,7 +61,9 @@ MESSAGE_EXECUTION_FAILED_SETTLEMENT = (
|
|
|
61
61
|
)
|
|
62
62
|
MESSAGE_REQUIREMENTS_QUOTE_FAILED = "Cannot compute requirements for failed quote."
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
# ERC-20 function selectors (first 4 bytes of the Keccak-256 hash of the function signature)
|
|
65
|
+
ERC20_APPROVE_SELECTOR = "0x095ea7b3"
|
|
66
|
+
ERC20_TRANSFER_SELECTOR = "0xa9059cbb"
|
|
65
67
|
|
|
66
68
|
|
|
67
69
|
@dataclass
|
|
@@ -287,14 +289,29 @@ class Provider(ABC):
|
|
|
287
289
|
f"[PROVIDER] {from_ledger_api.api.eth.get_block('latest').baseFeePerGas=}"
|
|
288
290
|
)
|
|
289
291
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
292
|
+
# TODO Move the requirements logic to be implemented by each provider.
|
|
293
|
+
#
|
|
294
|
+
# The following code parses the required ERC20 token amount. The typical case is that the bridge
|
|
295
|
+
# transactions fall into one of these cases:
|
|
296
|
+
# a. ERC20.approve + Bridge.deposit (bridge-specific tx), or
|
|
297
|
+
# b. ERC20.transfer
|
|
298
|
+
#
|
|
299
|
+
# Thus, the logic below assumes that there is only either an ERC20.approve OR ERC20.transfer (but not both).
|
|
300
|
+
# However, since the set of transactions is bridge-dependent, this might not always be the case, and
|
|
301
|
+
# is suggested that the requirements() logic be implemented per-provider.
|
|
302
|
+
if tx.get("to", "").lower() == from_token.lower():
|
|
303
|
+
data = tx.get("data", "").lower()
|
|
293
304
|
try:
|
|
294
|
-
|
|
295
|
-
|
|
305
|
+
if data.startswith(ERC20_APPROVE_SELECTOR):
|
|
306
|
+
amount_hex = data[-64:]
|
|
307
|
+
amount = BigInt(amount_hex, 16)
|
|
308
|
+
total_token += amount
|
|
309
|
+
elif data.startswith(ERC20_TRANSFER_SELECTOR):
|
|
310
|
+
amount_hex = data[10 + 64 : 10 + 64 + 64]
|
|
311
|
+
amount = BigInt(amount_hex, 16)
|
|
312
|
+
total_token += amount
|
|
296
313
|
except Exception as e:
|
|
297
|
-
raise RuntimeError("Malformed ERC20
|
|
314
|
+
raise RuntimeError("Malformed ERC20 transaction.") from e
|
|
298
315
|
|
|
299
316
|
self.logger.info(
|
|
300
317
|
f"[PROVIDER] Total gas fees for request {provider_request.id}: {total_gas_fees} native units."
|
operate/cli.py
CHANGED
|
@@ -824,7 +824,7 @@ def create_app( # pylint: disable=too-many-locals, unused-argument, too-many-st
|
|
|
824
824
|
|
|
825
825
|
if transfer_excess_assets:
|
|
826
826
|
asset_addresses = {ZERO_ADDRESS} | {
|
|
827
|
-
token[chain] for token in ERC20_TOKENS.values()
|
|
827
|
+
token[chain] for token in ERC20_TOKENS.values() if chain in token
|
|
828
828
|
}
|
|
829
829
|
balances = get_assets_balances(
|
|
830
830
|
ledger_api=ledger_api,
|
operate/constants.py
CHANGED
|
@@ -81,9 +81,10 @@ MECH_AGENT_FACTORY_JSON_URL = "https://raw.githubusercontent.com/valory-xyz/auto
|
|
|
81
81
|
MECH_MARKETPLACE_JSON_URL = "https://raw.githubusercontent.com/valory-xyz/mech-quickstart/refs/heads/main/contracts/MechMarketplace.json"
|
|
82
82
|
NO_STAKING_PROGRAM_ID = "no_staking"
|
|
83
83
|
|
|
84
|
-
|
|
85
84
|
DEPLOYMENT_START_TRIES_NUM = 3
|
|
86
85
|
IPFS_CHECK_URL = "https://gateway.autonolas.tech/ipfs/bafybeigcllaxn4ycjjvika3zd6eicksuriez2wtg67gx7pamhcazl3tv54/echo/README.md"
|
|
87
86
|
MSG_NEW_PASSWORD_MISSING = "'new_password' is required." # nosec
|
|
88
87
|
MSG_INVALID_PASSWORD = "Password is not valid." # nosec
|
|
89
88
|
MSG_INVALID_MNEMONIC = "Seed phrase is not valid." # nosec
|
|
89
|
+
|
|
90
|
+
POLY_SAFE_SERVICE_NAMES = frozenset(("polymarket_trader",))
|
operate/ledger/profiles.py
CHANGED
|
@@ -189,6 +189,12 @@ USDC: t.Dict[Chain, str] = {
|
|
|
189
189
|
Chain.POLYGON: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
+
USDC_E: t.Dict[Chain, str] = {
|
|
193
|
+
Chain.GNOSIS: "0x2a22f9c3b484c3629090FeED35F17Ff8F88f76F0",
|
|
194
|
+
Chain.OPTIMISM: "0x7F5c764cBc14f9669B88837ca1490cCa17c31607",
|
|
195
|
+
Chain.POLYGON: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
|
|
196
|
+
}
|
|
197
|
+
|
|
192
198
|
WRAPPED_NATIVE_ASSET = {
|
|
193
199
|
Chain.ARBITRUM_ONE: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
|
|
194
200
|
Chain.BASE: "0x4200000000000000000000000000000000000006",
|
|
@@ -203,6 +209,7 @@ WRAPPED_NATIVE_ASSET = {
|
|
|
203
209
|
ERC20_TOKENS = {
|
|
204
210
|
"OLAS": OLAS,
|
|
205
211
|
"USDC": USDC,
|
|
212
|
+
"USDC.e": USDC_E,
|
|
206
213
|
"WRAPPED_NATIVE": WRAPPED_NATIVE_ASSET,
|
|
207
214
|
}
|
|
208
215
|
|
operate/services/manage.py
CHANGED
|
@@ -30,6 +30,7 @@ from http import HTTPStatus
|
|
|
30
30
|
from pathlib import Path
|
|
31
31
|
|
|
32
32
|
import requests
|
|
33
|
+
from aea.configurations.data_types import PublicId
|
|
33
34
|
from aea.helpers.base import IPFSHash
|
|
34
35
|
from aea_ledger_ethereum import LedgerApi
|
|
35
36
|
from autonomy.chain.base import registry_contracts
|
|
@@ -45,6 +46,7 @@ from operate.constants import (
|
|
|
45
46
|
IPFS_ADDRESS,
|
|
46
47
|
MIN_AGENT_BOND,
|
|
47
48
|
MIN_SECURITY_DEPOSIT,
|
|
49
|
+
POLY_SAFE_SERVICE_NAMES,
|
|
48
50
|
ZERO_ADDRESS,
|
|
49
51
|
)
|
|
50
52
|
from operate.data import DATA_DIR
|
|
@@ -1114,6 +1116,7 @@ class ServiceManager:
|
|
|
1114
1116
|
is_recovery_module_enabled = True
|
|
1115
1117
|
else:
|
|
1116
1118
|
reuse_multisig = True
|
|
1119
|
+
is_initial_funding = False
|
|
1117
1120
|
is_recovery_module_enabled = (
|
|
1118
1121
|
registry_contracts.gnosis_safe.is_module_enabled(
|
|
1119
1122
|
ledger_api=sftxb.ledger_api,
|
|
@@ -1125,11 +1128,19 @@ class ServiceManager:
|
|
|
1125
1128
|
self.logger.info(f"{reuse_multisig=}")
|
|
1126
1129
|
self.logger.info(f"{is_recovery_module_enabled=}")
|
|
1127
1130
|
|
|
1131
|
+
service_public_id = PublicId.from_str(service.service_public_id())
|
|
1132
|
+
use_poly_safe = service_public_id.name in POLY_SAFE_SERVICE_NAMES
|
|
1133
|
+
|
|
1134
|
+
self.logger.info(f"{use_poly_safe=}")
|
|
1128
1135
|
messages = sftxb.get_deploy_data_from_safe(
|
|
1129
1136
|
service_id=chain_data.token,
|
|
1130
1137
|
reuse_multisig=reuse_multisig,
|
|
1131
1138
|
master_safe=safe,
|
|
1132
1139
|
use_recovery_module=is_recovery_module_enabled,
|
|
1140
|
+
use_poly_safe=use_poly_safe,
|
|
1141
|
+
agent_eoa_crypto=self.keys_manager.get_crypto_instance(
|
|
1142
|
+
service.agent_addresses[0]
|
|
1143
|
+
),
|
|
1133
1144
|
)
|
|
1134
1145
|
tx = sftxb.new_tx()
|
|
1135
1146
|
for message in messages:
|
operate/services/protocol.py
CHANGED
|
@@ -41,6 +41,7 @@ from autonomy.chain.constants import (
|
|
|
41
41
|
GNOSIS_SAFE_PROXY_FACTORY_CONTRACT,
|
|
42
42
|
GNOSIS_SAFE_SAME_ADDRESS_MULTISIG_CONTRACT,
|
|
43
43
|
MULTISEND_CONTRACT,
|
|
44
|
+
POLY_SAFE_CREATOR_WITH_RECOVERY_MODULE_CONTRACT,
|
|
44
45
|
RECOVERY_MODULE_CONTRACT,
|
|
45
46
|
SAFE_MULTISIG_WITH_RECOVERY_MODULE_CONTRACT,
|
|
46
47
|
)
|
|
@@ -49,6 +50,7 @@ from autonomy.chain.service import (
|
|
|
49
50
|
get_agent_instances,
|
|
50
51
|
get_deployment_payload,
|
|
51
52
|
get_deployment_with_recovery_payload,
|
|
53
|
+
get_poly_safe_deployment_payload,
|
|
52
54
|
get_service_info,
|
|
53
55
|
get_token_deposit_amount,
|
|
54
56
|
)
|
|
@@ -1408,12 +1410,14 @@ class EthSafeTxBuilder(_ChainUtil):
|
|
|
1408
1410
|
"value": cost_of_bond,
|
|
1409
1411
|
}
|
|
1410
1412
|
|
|
1411
|
-
def get_deploy_data_from_safe(
|
|
1413
|
+
def get_deploy_data_from_safe( # pylint: disable=too-many-arguments
|
|
1412
1414
|
self,
|
|
1413
1415
|
service_id: int,
|
|
1414
1416
|
master_safe: str,
|
|
1415
1417
|
reuse_multisig: bool = False,
|
|
1416
1418
|
use_recovery_module: bool = True,
|
|
1419
|
+
use_poly_safe: bool = False,
|
|
1420
|
+
agent_eoa_crypto: t.Optional[Crypto] = None,
|
|
1417
1421
|
) -> t.List[t.Dict[str, t.Any]]:
|
|
1418
1422
|
"""Get the deploy data instructions for a safe"""
|
|
1419
1423
|
approve_hash_message = None
|
|
@@ -1452,12 +1456,28 @@ class EthSafeTxBuilder(_ChainUtil):
|
|
|
1452
1456
|
RECOVERY_MODULE_CONTRACT.name
|
|
1453
1457
|
).contracts[self.chain_type]
|
|
1454
1458
|
else: # Deploy a new multisig
|
|
1455
|
-
if not use_recovery_module:
|
|
1459
|
+
if not use_recovery_module and not use_poly_safe:
|
|
1456
1460
|
deployment_payload = get_deployment_payload()
|
|
1457
1461
|
gnosis_safe_multisig = ContractConfigs.get(
|
|
1458
1462
|
GNOSIS_SAFE_PROXY_FACTORY_CONTRACT.name
|
|
1459
1463
|
).contracts[self.chain_type]
|
|
1460
|
-
|
|
1464
|
+
elif use_recovery_module and use_poly_safe:
|
|
1465
|
+
if not agent_eoa_crypto:
|
|
1466
|
+
raise ValueError("Crypto object must be provided for Poly Safe.")
|
|
1467
|
+
|
|
1468
|
+
deployment_payload = get_poly_safe_deployment_payload(
|
|
1469
|
+
ledger_api=self.ledger_api,
|
|
1470
|
+
chain_type=self.chain_type,
|
|
1471
|
+
crypto=agent_eoa_crypto,
|
|
1472
|
+
)
|
|
1473
|
+
gnosis_safe_multisig = ContractConfigs.get(
|
|
1474
|
+
POLY_SAFE_CREATOR_WITH_RECOVERY_MODULE_CONTRACT.name
|
|
1475
|
+
).contracts[self.chain_type]
|
|
1476
|
+
elif not use_recovery_module and use_poly_safe:
|
|
1477
|
+
raise ValueError(
|
|
1478
|
+
"Poly Safe deployment without recovery module is not supported."
|
|
1479
|
+
)
|
|
1480
|
+
else: # Normal case: use_recovery_module and not use_poly_safe
|
|
1461
1481
|
deployment_payload = get_deployment_with_recovery_payload()
|
|
1462
1482
|
gnosis_safe_multisig = ContractConfigs.get(
|
|
1463
1483
|
SAFE_MULTISIG_WITH_RECOVERY_MODULE_CONTRACT.name
|
operate/services/service.py
CHANGED
|
@@ -1047,22 +1047,23 @@ class Service(LocalResource):
|
|
|
1047
1047
|
AchievementsNotifications, AchievementsNotifications.load(self.path)
|
|
1048
1048
|
)
|
|
1049
1049
|
|
|
1050
|
-
|
|
1050
|
+
agent_performance_json_path = (
|
|
1051
1051
|
Path(
|
|
1052
1052
|
self.env_variables.get(
|
|
1053
1053
|
AGENT_PERSISTENT_STORAGE_ENV_VAR, {"value": "."}
|
|
1054
1054
|
).get("value", ".")
|
|
1055
1055
|
)
|
|
1056
|
-
/ "
|
|
1056
|
+
/ "agent_performance.json"
|
|
1057
1057
|
)
|
|
1058
1058
|
|
|
1059
1059
|
agent_achievements: t.Dict[str, t.Any] = {}
|
|
1060
|
-
if
|
|
1060
|
+
if agent_performance_json_path.exists():
|
|
1061
1061
|
try:
|
|
1062
|
-
with open(
|
|
1063
|
-
|
|
1062
|
+
with open(agent_performance_json_path, "r", encoding="utf-8") as f:
|
|
1063
|
+
data = json.load(f)
|
|
1064
|
+
agent_achievements = data.get("achievements", {}).get("items", {})
|
|
1064
1065
|
except (json.JSONDecodeError, OSError) as e:
|
|
1065
|
-
|
|
1066
|
+
logger.warning(f"Cannot read file 'agent_performance.json': {e}")
|
|
1066
1067
|
|
|
1067
1068
|
save_changes = False
|
|
1068
1069
|
for achievement_id in agent_achievements:
|
operate/wallet/master.py
CHANGED
|
@@ -547,7 +547,9 @@ class EthereumMasterWallet(MasterWallet):
|
|
|
547
547
|
rpc: t.Optional[str] = None,
|
|
548
548
|
) -> None:
|
|
549
549
|
"""Drain all erc20/native assets to the given account."""
|
|
550
|
-
assets = [token[chain] for token in ERC20_TOKENS.values()] + [
|
|
550
|
+
assets = [token[chain] for token in ERC20_TOKENS.values() if chain in token] + [
|
|
551
|
+
ZERO_ADDRESS
|
|
552
|
+
]
|
|
551
553
|
for asset in assets:
|
|
552
554
|
balance = self.get_balance(chain=chain, asset=asset, from_safe=from_safe)
|
|
553
555
|
if balance <= 0:
|
|
@@ -783,7 +785,9 @@ class EthereumMasterWallet(MasterWallet):
|
|
|
783
785
|
|
|
784
786
|
balances[chain_str] = {self.address: {}, safe: {}}
|
|
785
787
|
|
|
786
|
-
assets = [
|
|
788
|
+
assets = [
|
|
789
|
+
token[chain] for token in ERC20_TOKENS.values() if chain in token
|
|
790
|
+
] + [ZERO_ADDRESS]
|
|
787
791
|
for asset in assets:
|
|
788
792
|
balances[chain_str][self.address][asset] = str(
|
|
789
793
|
self.get_balance(chain=chain, asset=asset, from_safe=False)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|