olas-operate-middleware 0.1.0rc59__py3-none-any.whl → 0.13.2__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.
Files changed (98) hide show
  1. olas_operate_middleware-0.13.2.dist-info/METADATA +75 -0
  2. olas_operate_middleware-0.13.2.dist-info/RECORD +101 -0
  3. {olas_operate_middleware-0.1.0rc59.dist-info → olas_operate_middleware-0.13.2.dist-info}/WHEEL +1 -1
  4. operate/__init__.py +17 -0
  5. operate/account/user.py +35 -9
  6. operate/bridge/bridge_manager.py +470 -0
  7. operate/bridge/providers/lifi_provider.py +377 -0
  8. operate/bridge/providers/native_bridge_provider.py +677 -0
  9. operate/bridge/providers/provider.py +469 -0
  10. operate/bridge/providers/relay_provider.py +457 -0
  11. operate/cli.py +1565 -417
  12. operate/constants.py +60 -12
  13. operate/data/README.md +19 -0
  14. operate/data/contracts/{service_staking_token → dual_staking_token}/__init__.py +2 -2
  15. operate/data/contracts/dual_staking_token/build/DualStakingToken.json +443 -0
  16. operate/data/contracts/dual_staking_token/contract.py +132 -0
  17. operate/data/contracts/dual_staking_token/contract.yaml +23 -0
  18. operate/{ledger/base.py → data/contracts/foreign_omnibridge/__init__.py} +2 -19
  19. operate/data/contracts/foreign_omnibridge/build/ForeignOmnibridge.json +1372 -0
  20. operate/data/contracts/foreign_omnibridge/contract.py +130 -0
  21. operate/data/contracts/foreign_omnibridge/contract.yaml +23 -0
  22. operate/{ledger/solana.py → data/contracts/home_omnibridge/__init__.py} +2 -20
  23. operate/data/contracts/home_omnibridge/build/HomeOmnibridge.json +1421 -0
  24. operate/data/contracts/home_omnibridge/contract.py +80 -0
  25. operate/data/contracts/home_omnibridge/contract.yaml +23 -0
  26. operate/data/contracts/l1_standard_bridge/__init__.py +20 -0
  27. operate/data/contracts/l1_standard_bridge/build/L1StandardBridge.json +831 -0
  28. operate/data/contracts/l1_standard_bridge/contract.py +158 -0
  29. operate/data/contracts/l1_standard_bridge/contract.yaml +23 -0
  30. operate/data/contracts/l2_standard_bridge/__init__.py +20 -0
  31. operate/data/contracts/l2_standard_bridge/build/L2StandardBridge.json +626 -0
  32. operate/data/contracts/l2_standard_bridge/contract.py +130 -0
  33. operate/data/contracts/l2_standard_bridge/contract.yaml +23 -0
  34. operate/data/contracts/mech_activity/__init__.py +20 -0
  35. operate/data/contracts/mech_activity/build/MechActivity.json +111 -0
  36. operate/data/contracts/mech_activity/contract.py +44 -0
  37. operate/data/contracts/mech_activity/contract.yaml +23 -0
  38. operate/data/contracts/optimism_mintable_erc20/__init__.py +20 -0
  39. operate/data/contracts/optimism_mintable_erc20/build/OptimismMintableERC20.json +491 -0
  40. operate/data/contracts/optimism_mintable_erc20/contract.py +45 -0
  41. operate/data/contracts/optimism_mintable_erc20/contract.yaml +23 -0
  42. operate/data/contracts/recovery_module/__init__.py +20 -0
  43. operate/data/contracts/recovery_module/build/RecoveryModule.json +811 -0
  44. operate/data/contracts/recovery_module/contract.py +61 -0
  45. operate/data/contracts/recovery_module/contract.yaml +23 -0
  46. operate/data/contracts/requester_activity_checker/__init__.py +20 -0
  47. operate/data/contracts/requester_activity_checker/build/RequesterActivityChecker.json +111 -0
  48. operate/data/contracts/requester_activity_checker/contract.py +33 -0
  49. operate/data/contracts/requester_activity_checker/contract.yaml +23 -0
  50. operate/data/contracts/staking_token/__init__.py +20 -0
  51. operate/data/contracts/staking_token/build/StakingToken.json +1336 -0
  52. operate/data/contracts/{service_staking_token → staking_token}/contract.py +27 -13
  53. operate/data/contracts/staking_token/contract.yaml +23 -0
  54. operate/data/contracts/uniswap_v2_erc20/contract.yaml +3 -1
  55. operate/data/contracts/uniswap_v2_erc20/tests/__init__.py +20 -0
  56. operate/data/contracts/uniswap_v2_erc20/tests/test_contract.py +363 -0
  57. operate/keys.py +118 -33
  58. operate/ledger/__init__.py +159 -56
  59. operate/ledger/profiles.py +321 -18
  60. operate/migration.py +555 -0
  61. operate/{http → operate_http}/__init__.py +3 -2
  62. operate/{http → operate_http}/exceptions.py +6 -4
  63. operate/operate_types.py +544 -0
  64. operate/pearl.py +13 -1
  65. operate/quickstart/analyse_logs.py +118 -0
  66. operate/quickstart/claim_staking_rewards.py +104 -0
  67. operate/quickstart/reset_configs.py +106 -0
  68. operate/quickstart/reset_password.py +70 -0
  69. operate/quickstart/reset_staking.py +145 -0
  70. operate/quickstart/run_service.py +726 -0
  71. operate/quickstart/stop_service.py +72 -0
  72. operate/quickstart/terminate_on_chain_service.py +83 -0
  73. operate/quickstart/utils.py +298 -0
  74. operate/resource.py +62 -3
  75. operate/services/agent_runner.py +202 -0
  76. operate/services/deployment_runner.py +868 -0
  77. operate/services/funding_manager.py +929 -0
  78. operate/services/health_checker.py +280 -0
  79. operate/services/manage.py +2356 -620
  80. operate/services/protocol.py +1246 -340
  81. operate/services/service.py +756 -391
  82. operate/services/utils/mech.py +103 -0
  83. operate/services/utils/tendermint.py +86 -12
  84. operate/settings.py +70 -0
  85. operate/utils/__init__.py +135 -0
  86. operate/utils/gnosis.py +407 -80
  87. operate/utils/single_instance.py +226 -0
  88. operate/utils/ssl.py +133 -0
  89. operate/wallet/master.py +708 -123
  90. operate/wallet/wallet_recovery_manager.py +507 -0
  91. olas_operate_middleware-0.1.0rc59.dist-info/METADATA +0 -304
  92. olas_operate_middleware-0.1.0rc59.dist-info/RECORD +0 -41
  93. operate/data/contracts/service_staking_token/build/ServiceStakingToken.json +0 -1273
  94. operate/data/contracts/service_staking_token/contract.yaml +0 -23
  95. operate/ledger/ethereum.py +0 -48
  96. operate/types.py +0 -260
  97. {olas_operate_middleware-0.1.0rc59.dist-info → olas_operate_middleware-0.13.2.dist-info}/entry_points.txt +0 -0
  98. {olas_operate_middleware-0.1.0rc59.dist-info → olas_operate_middleware-0.13.2.dist-info/licenses}/LICENSE +0 -0
@@ -0,0 +1,132 @@
1
+ # -*- coding: utf-8 -*-
2
+ # ------------------------------------------------------------------------------
3
+ #
4
+ # Copyright 2025 Valory AG
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ # ------------------------------------------------------------------------------
19
+
20
+ """This module contains the class to connect to the `DualStakingToken` contract."""
21
+
22
+ from aea.common import JSONLike
23
+ from aea.configurations.base import PublicId
24
+ from aea.contracts.base import Contract
25
+ from aea.crypto.base import LedgerApi
26
+
27
+
28
+ class DualStakingTokenContract(Contract):
29
+ """The Staking Token contract."""
30
+
31
+ contract_id = PublicId.from_str("valory/dual_staking_token:0.1.0")
32
+
33
+ @classmethod
34
+ def build_stake_tx(
35
+ cls,
36
+ ledger_api: LedgerApi,
37
+ contract_address: str,
38
+ service_id: int,
39
+ ) -> JSONLike:
40
+ """Build stake tx."""
41
+ contract_instance = cls.get_instance(ledger_api, contract_address)
42
+ data = contract_instance.encodeABI("stake", args=[service_id])
43
+ return dict(data=bytes.fromhex(data[2:]))
44
+
45
+ @classmethod
46
+ def build_checkpoint_tx(
47
+ cls,
48
+ ledger_api: LedgerApi,
49
+ contract_address: str,
50
+ ) -> JSONLike:
51
+ """Build checkpoint tx."""
52
+ contract_instance = cls.get_instance(ledger_api, contract_address)
53
+ data = contract_instance.encodeABI("checkpoint")
54
+ return dict(data=bytes.fromhex(data[2:]))
55
+
56
+ @classmethod
57
+ def build_unstake_tx(
58
+ cls,
59
+ ledger_api: LedgerApi,
60
+ contract_address: str,
61
+ service_id: int,
62
+ ) -> JSONLike:
63
+ """Build unstake tx."""
64
+ contract_instance = cls.get_instance(ledger_api, contract_address)
65
+ data = contract_instance.encodeABI("unstake", args=[service_id])
66
+ return dict(data=bytes.fromhex(data[2:]))
67
+
68
+ @classmethod
69
+ def num_services(
70
+ cls,
71
+ ledger_api: LedgerApi,
72
+ contract_address: str,
73
+ ) -> JSONLike:
74
+ """Retrieve the number of services."""
75
+ contract = cls.get_instance(ledger_api, contract_address)
76
+ num_services = contract.functions.numServices().call()
77
+ return dict(data=num_services)
78
+
79
+ @classmethod
80
+ def second_token(
81
+ cls,
82
+ ledger_api: LedgerApi,
83
+ contract_address: str,
84
+ ) -> JSONLike:
85
+ """Retrieve the second token."""
86
+ contract = cls.get_instance(ledger_api, contract_address)
87
+ second_token = contract.functions.secondToken().call()
88
+ return dict(data=second_token)
89
+
90
+ @classmethod
91
+ def second_token_amount(
92
+ cls,
93
+ ledger_api: LedgerApi,
94
+ contract_address: str,
95
+ ) -> JSONLike:
96
+ """Retrieve the second token amount."""
97
+ contract = cls.get_instance(ledger_api, contract_address)
98
+ second_token_amount = contract.functions.secondTokenAmount().call()
99
+ return dict(data=second_token_amount)
100
+
101
+ @classmethod
102
+ def reward_ratio(
103
+ cls,
104
+ ledger_api: LedgerApi,
105
+ contract_address: str,
106
+ ) -> JSONLike:
107
+ """Retrieve the reward ratio."""
108
+ contract = cls.get_instance(ledger_api, contract_address)
109
+ reward_ratio = contract.functions.rewardRatio().call()
110
+ return dict(data=reward_ratio)
111
+
112
+ @classmethod
113
+ def stake_ratio(
114
+ cls,
115
+ ledger_api: LedgerApi,
116
+ contract_address: str,
117
+ ) -> JSONLike:
118
+ """Retrieve the stake ratio."""
119
+ contract = cls.get_instance(ledger_api, contract_address)
120
+ stake_ratio = contract.functions.stakeRatio().call()
121
+ return dict(data=stake_ratio)
122
+
123
+ @classmethod
124
+ def staking_instance(
125
+ cls,
126
+ ledger_api: LedgerApi,
127
+ contract_address: str,
128
+ ) -> JSONLike:
129
+ """Retrieve the staking instance."""
130
+ contract = cls.get_instance(ledger_api, contract_address)
131
+ staking_instance = contract.functions.stakingInstance().call()
132
+ return dict(data=staking_instance)
@@ -0,0 +1,23 @@
1
+ name: dual_staking_token
2
+ author: valory
3
+ version: 0.1.0
4
+ type: contract
5
+ description: Dual staking token contract
6
+ license: Apache-2.0
7
+ aea_version: '>=1.0.0, <2.0.0'
8
+ fingerprint:
9
+ __init__.py: bafybeickx6ot3syhywbaewl3mmnowa75dd5rogqy7pmmc5ctk4yd74pvoa
10
+ build/DualStakingToken.json: bafybeibvh3lcvo242jqtyrfrbezgziedlymjlr7bmttvezhgjjxlgklcxa
11
+ contract.py: bafybeiftspqmbq23cjifektsgwtxfcf7uaeywwdbsdvp67a7yi3wqc3pnm
12
+ fingerprint_ignore_patterns: []
13
+ contracts: []
14
+ class_name: DualStakingTokenContract
15
+ contract_interface_paths:
16
+ ethereum: build/DualStakingToken.json
17
+ dependencies:
18
+ open-aea-ledger-ethereum:
19
+ version: <2,>=1.53.0
20
+ open-aea-test-autonomy:
21
+ version: <1,>=0.14.14.post1
22
+ web3:
23
+ version: <7,>=6.0.0
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # ------------------------------------------------------------------------------
3
3
  #
4
- # Copyright 2023 Valory AG
4
+ # Copyright 2024 Valory AG
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -17,21 +17,4 @@
17
17
  #
18
18
  # ------------------------------------------------------------------------------
19
19
 
20
- """Base class."""
21
-
22
- import typing as t
23
- from abc import ABC, abstractmethod
24
-
25
-
26
- class LedgerHelper(ABC): # pylint: disable=too-few-public-methods
27
- """Base ledger helper."""
28
-
29
- api: t.Any
30
-
31
- def __init__(self, rpc: str) -> None:
32
- """Initialize object."""
33
- self.rpc = rpc
34
-
35
- @abstractmethod
36
- def create_key(self) -> t.Any:
37
- """Create key."""
20
+ """This module contains the support resources for the `ForeignOmnibridge` contract."""