olas-operate-middleware 0.8.2__py3-none-any.whl → 0.10.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.8.2.dist-info → olas_operate_middleware-0.10.0.dist-info}/METADATA +2 -2
- {olas_operate_middleware-0.8.2.dist-info → olas_operate_middleware-0.10.0.dist-info}/RECORD +34 -34
- operate/bridge/bridge_manager.py +5 -6
- operate/bridge/providers/native_bridge_provider.py +1 -1
- operate/bridge/providers/provider.py +4 -5
- operate/bridge/providers/relay_provider.py +1 -1
- operate/cli.py +128 -48
- operate/constants.py +9 -9
- operate/keys.py +26 -14
- operate/ledger/__init__.py +4 -4
- operate/ledger/profiles.py +9 -11
- operate/migration.py +326 -0
- operate/operate_types.py +9 -27
- operate/quickstart/analyse_logs.py +3 -6
- operate/quickstart/claim_staking_rewards.py +1 -4
- operate/quickstart/reset_configs.py +0 -3
- operate/quickstart/reset_password.py +0 -3
- operate/quickstart/reset_staking.py +3 -5
- operate/quickstart/run_service.py +5 -7
- operate/quickstart/stop_service.py +3 -4
- operate/quickstart/terminate_on_chain_service.py +1 -4
- operate/quickstart/utils.py +4 -7
- operate/resource.py +37 -5
- operate/services/deployment_runner.py +170 -38
- operate/services/health_checker.py +5 -8
- operate/services/manage.py +103 -164
- operate/services/protocol.py +5 -5
- operate/services/service.py +42 -242
- operate/utils/__init__.py +44 -0
- operate/utils/gnosis.py +25 -17
- operate/wallet/master.py +20 -24
- {olas_operate_middleware-0.8.2.dist-info → olas_operate_middleware-0.10.0.dist-info}/LICENSE +0 -0
- {olas_operate_middleware-0.8.2.dist-info → olas_operate_middleware-0.10.0.dist-info}/WHEEL +0 -0
- {olas_operate_middleware-0.8.2.dist-info → olas_operate_middleware-0.10.0.dist-info}/entry_points.txt +0 -0
operate/wallet/master.py
CHANGED
|
@@ -29,7 +29,6 @@ from pathlib import Path
|
|
|
29
29
|
|
|
30
30
|
from aea.crypto.base import Crypto, LedgerApi
|
|
31
31
|
from aea.crypto.registries import make_ledger_api
|
|
32
|
-
from aea.helpers.logging import setup_logger
|
|
33
32
|
from aea_ledger_ethereum import DEFAULT_GAS_PRICE_STRATEGIES, EIP1559, GWEI, to_wei
|
|
34
33
|
from aea_ledger_ethereum.ethereum import EthereumApi, EthereumCrypto
|
|
35
34
|
from autonomy.chain.base import registry_contracts
|
|
@@ -48,7 +47,7 @@ from operate.ledger.profiles import ERC20_TOKENS, OLAS, USDC
|
|
|
48
47
|
from operate.operate_types import Chain, LedgerType
|
|
49
48
|
from operate.resource import LocalResource
|
|
50
49
|
from operate.utils import create_backup
|
|
51
|
-
from operate.utils.gnosis import
|
|
50
|
+
from operate.utils.gnosis import add_owner
|
|
52
51
|
from operate.utils.gnosis import create_safe as create_gnosis_safe
|
|
53
52
|
from operate.utils.gnosis import (
|
|
54
53
|
drain_eoa,
|
|
@@ -110,7 +109,7 @@ class MasterWallet(LocalResource):
|
|
|
110
109
|
) -> LedgerApi:
|
|
111
110
|
"""Get ledger api object."""
|
|
112
111
|
gas_price_strategies = deepcopy(DEFAULT_GAS_PRICE_STRATEGIES)
|
|
113
|
-
if chain in (Chain.BASE, Chain.MODE, Chain.
|
|
112
|
+
if chain in (Chain.BASE, Chain.MODE, Chain.OPTIMISM):
|
|
114
113
|
gas_price_strategies[EIP1559]["fallback_estimate"]["maxFeePerGas"] = to_wei(
|
|
115
114
|
5, GWEI
|
|
116
115
|
)
|
|
@@ -516,6 +515,9 @@ class EthereumMasterWallet(MasterWallet):
|
|
|
516
515
|
asset_address=asset,
|
|
517
516
|
address=self.safes[chain] if from_safe else self.crypto.address,
|
|
518
517
|
)
|
|
518
|
+
if balance <= 0:
|
|
519
|
+
continue
|
|
520
|
+
|
|
519
521
|
self.transfer_asset(
|
|
520
522
|
to=withdrawal_address,
|
|
521
523
|
amount=balance,
|
|
@@ -717,7 +719,7 @@ class EthereumMasterWallet(MasterWallet):
|
|
|
717
719
|
owners.remove(self.address)
|
|
718
720
|
|
|
719
721
|
balances: t.Dict[str, int] = {}
|
|
720
|
-
balances[
|
|
722
|
+
balances[ZERO_ADDRESS] = ledger_api.get_balance(safe) or 0
|
|
721
723
|
for token in tokens:
|
|
722
724
|
balance = (
|
|
723
725
|
registry_contracts.erc20.get_instance(
|
|
@@ -781,7 +783,7 @@ class EthereumMasterWallet(MasterWallet):
|
|
|
781
783
|
"goerli",
|
|
782
784
|
"gnosis",
|
|
783
785
|
"solana",
|
|
784
|
-
"
|
|
786
|
+
"optimism",
|
|
785
787
|
"base",
|
|
786
788
|
"mode",
|
|
787
789
|
]
|
|
@@ -808,6 +810,17 @@ class EthereumMasterWallet(MasterWallet):
|
|
|
808
810
|
safes[chain] = address
|
|
809
811
|
data["safes"] = safes
|
|
810
812
|
|
|
813
|
+
if "optimistic" in data.get("safes", {}):
|
|
814
|
+
data["safes"]["optimism"] = data["safes"].pop("optimistic")
|
|
815
|
+
migrated = True
|
|
816
|
+
|
|
817
|
+
if "optimistic" in data.get("safe_chains"):
|
|
818
|
+
data["safe_chains"] = [
|
|
819
|
+
"optimism" if chain == "optimistic" else chain
|
|
820
|
+
for chain in data["safe_chains"]
|
|
821
|
+
]
|
|
822
|
+
migrated = True
|
|
823
|
+
|
|
811
824
|
with open(wallet_path, "w", encoding="utf-8") as file:
|
|
812
825
|
json.dump(data, file, indent=2)
|
|
813
826
|
|
|
@@ -825,13 +838,13 @@ class MasterWalletManager:
|
|
|
825
838
|
def __init__(
|
|
826
839
|
self,
|
|
827
840
|
path: Path,
|
|
841
|
+
logger: logging.Logger,
|
|
828
842
|
password: t.Optional[str] = None,
|
|
829
|
-
logger: t.Optional[logging.Logger] = None,
|
|
830
843
|
) -> None:
|
|
831
844
|
"""Initialize master wallet manager."""
|
|
832
845
|
self.path = path
|
|
846
|
+
self.logger = logger
|
|
833
847
|
self._password = password
|
|
834
|
-
self.logger = logger or setup_logger(name="operate.master_wallet_manager")
|
|
835
848
|
|
|
836
849
|
@property
|
|
837
850
|
def json(self) -> t.List[t.Dict]:
|
|
@@ -927,20 +940,3 @@ class MasterWalletManager:
|
|
|
927
940
|
if not self.exists(ledger_type=ledger_type):
|
|
928
941
|
continue
|
|
929
942
|
yield LEDGER_TYPE_TO_WALLET_CLASS[ledger_type].load(path=self.path)
|
|
930
|
-
|
|
931
|
-
def migrate_wallet_configs(self) -> None:
|
|
932
|
-
"""Migrate old wallet config formats to new ones, if applies."""
|
|
933
|
-
|
|
934
|
-
print(self.path)
|
|
935
|
-
|
|
936
|
-
for ledger_type in LedgerType:
|
|
937
|
-
if not self.exists(ledger_type=ledger_type):
|
|
938
|
-
continue
|
|
939
|
-
|
|
940
|
-
wallet_class = LEDGER_TYPE_TO_WALLET_CLASS.get(ledger_type)
|
|
941
|
-
if wallet_class is None:
|
|
942
|
-
continue
|
|
943
|
-
|
|
944
|
-
migrated = wallet_class.migrate_format(path=self.path)
|
|
945
|
-
if migrated:
|
|
946
|
-
self.logger.info(f"Wallet {wallet_class} has been migrated.")
|
{olas_operate_middleware-0.8.2.dist-info → olas_operate_middleware-0.10.0.dist-info}/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|