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
@@ -1,23 +0,0 @@
1
- name: service_staking_token
2
- author: valory
3
- version: 0.1.0
4
- type: contract
5
- description: Service staking token contract
6
- license: Apache-2.0
7
- aea_version: '>=1.0.0, <2.0.0'
8
- fingerprint:
9
- __init__.py: bafybeid3wfzglolebuo6jrrsopswzu4lk77bm76mvw3euizlsjtnt3wmgu
10
- build/ServiceStakingToken.json: bafybeifptgh2dpse3l7lscjdvy24t7svqnflj3n2txehu7zerdeaszldsi
11
- contract.py: bafybeiff62bquzeisbd6iptqdjetrhlkt2ut5d7j6md2kqinrqgmbveceu
12
- fingerprint_ignore_patterns: []
13
- contracts: []
14
- class_name: ServiceStakingTokenContract
15
- contract_interface_paths:
16
- ethereum: build/ServiceStakingToken.json
17
- dependencies:
18
- open-aea-ledger-ethereum:
19
- version: ==1.42.0
20
- open-aea-test-autonomy:
21
- version: ==0.13.6
22
- web3:
23
- version: <7,>=6.0.0
@@ -1,48 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- # ------------------------------------------------------------------------------
3
- #
4
- # Copyright 2023 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
- """Ethereum ledger helpers."""
21
-
22
- import typing as t
23
-
24
- from aea_ledger_ethereum import EthereumApi, EthereumCrypto
25
-
26
- from operate.ledger.base import LedgerHelper
27
- from operate.types import LedgerType
28
-
29
-
30
- class Ethereum(LedgerHelper):
31
- """Ethereum ledger helper."""
32
-
33
- api: EthereumApi
34
-
35
- def __init__(self, rpc: str) -> None:
36
- """Initialize object."""
37
- super().__init__(rpc)
38
- self.api = EthereumApi(address=self.rpc)
39
-
40
- def create_key(self) -> t.Dict:
41
- """Create key."""
42
- account = EthereumCrypto()
43
- return {
44
- "address": account.address,
45
- "private_key": account.private_key,
46
- "encrypted": False,
47
- "ledger": LedgerType.ETHEREUM,
48
- }
operate/types.py DELETED
@@ -1,260 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- # ------------------------------------------------------------------------------
3
- #
4
- # Copyright 2023 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
- """Types module."""
21
-
22
- import enum
23
- import typing as t
24
- from dataclasses import dataclass
25
-
26
- from typing_extensions import TypedDict
27
-
28
- from operate.resource import LocalResource
29
-
30
-
31
- _ACTIONS = {
32
- "status": 0,
33
- "build": 1,
34
- "deploy": 2,
35
- "stop": 3,
36
- }
37
-
38
-
39
- _CHAIN_NAME_TO_ENUM = {
40
- "ethereum": 0,
41
- "goerli": 1,
42
- "gnosis": 2,
43
- "solana": 3,
44
- }
45
-
46
- _CHAIN_ID_TO_CHAIN_NAME = {
47
- 1: "ethereum",
48
- 5: "goerli",
49
- 100: "gnosis",
50
- 1399811149: "solana",
51
- }
52
-
53
- _CHAIN_NAME_TO_ID = {val: key for key, val in _CHAIN_ID_TO_CHAIN_NAME.items()}
54
-
55
- _LEDGER_TYPE_TO_ENUM = {
56
- "ethereum": 0,
57
- "solana": 1,
58
- }
59
-
60
-
61
- class LedgerType(enum.IntEnum):
62
- """Ledger type enum."""
63
-
64
- ETHEREUM = 0
65
- SOLANA = 1
66
-
67
- @classmethod
68
- def from_string(cls, chain: str) -> "LedgerType":
69
- """Load from string."""
70
- return cls(_LEDGER_TYPE_TO_ENUM[chain.lower()])
71
-
72
- @property
73
- def config_file(self) -> str:
74
- """Config filename."""
75
- return f"{self.name.lower()}.json"
76
-
77
- @property
78
- def key_file(self) -> str:
79
- """Key filename."""
80
- return f"{self.name.lower()}.txt"
81
-
82
-
83
- class ChainType(enum.IntEnum):
84
- """Chain type enum."""
85
-
86
- ETHEREUM = 0
87
- GOERLI = 1
88
- GNOSIS = 2
89
- SOLANA = 3
90
-
91
- @property
92
- def id(self) -> int:
93
- """Returns chain id."""
94
- return _CHAIN_NAME_TO_ID[self.name.lower()]
95
-
96
- @classmethod
97
- def from_string(cls, chain: str) -> "ChainType":
98
- """Load from string."""
99
- return cls(_CHAIN_NAME_TO_ENUM[chain.lower()])
100
-
101
- @classmethod
102
- def from_id(cls, cid: int) -> "ChainType":
103
- """Load from chain ID."""
104
- return cls(_CHAIN_NAME_TO_ENUM[_CHAIN_ID_TO_CHAIN_NAME[cid]])
105
-
106
-
107
- class Action(enum.IntEnum):
108
- """Action payload."""
109
-
110
- STATUS = 0
111
- BUILD = 1
112
- DEPLOY = 2
113
- STOP = 3
114
-
115
- @classmethod
116
- def from_string(cls, action: str) -> "Action":
117
- """Load from string."""
118
- return cls(_ACTIONS[action])
119
-
120
-
121
- class DeploymentStatus(enum.IntEnum):
122
- """Status payload."""
123
-
124
- CREATED = 0
125
- BUILT = 1
126
- DEPLOYING = 2
127
- DEPLOYED = 3
128
- STOPPING = 4
129
- STOPPED = 5
130
- DELETED = 6
131
-
132
-
133
- class OnChainState(enum.IntEnum):
134
- """On-chain state."""
135
-
136
- NOTMINTED = 0
137
- MINTED = 1
138
- ACTIVATED = 2
139
- REGISTERED = 3
140
- DEPLOYED = 4
141
- TERMINATED = 5
142
- UNBONDED = 6
143
-
144
-
145
- class ContractAddresses(TypedDict):
146
- """Contracts templates."""
147
-
148
- service_manager: str
149
- service_registry: str
150
- service_registry_token_utility: str
151
- gnosis_safe_proxy_factory: str
152
- gnosis_safe_same_address_multisig: str
153
- multisend: str
154
-
155
-
156
- @dataclass
157
- class LedgerConfig(LocalResource):
158
- """Ledger config."""
159
-
160
- rpc: str
161
- type: LedgerType
162
- chain: ChainType
163
-
164
-
165
- LedgerConfigs = t.List[LedgerConfig]
166
-
167
-
168
- class ServiceState(enum.IntEnum):
169
- """Service state"""
170
-
171
- NON_EXISTENT = 0
172
- PRE_REGISTRATION = 1
173
- ACTIVE_REGISTRATION = 2
174
- FINISHED_REGISTRATION = 3
175
- DEPLOYED = 4
176
- TERMINATED_BONDED = 5
177
-
178
-
179
- class DeploymentConfig(TypedDict):
180
- """Deployments template."""
181
-
182
- volumes: t.Dict[str, str]
183
-
184
-
185
- class FundRequirementsTemplate(TypedDict):
186
- """Fund requirement template."""
187
-
188
- agent: int
189
- safe: int
190
-
191
-
192
- class ConfigurationTemplate(TypedDict):
193
- """Configuration template."""
194
-
195
- nft: str
196
- rpc: str
197
- agent_id: int
198
- threshold: int
199
- use_staking: bool
200
- cost_of_bond: int
201
- olas_cost_of_bond: int
202
- olas_required_to_stake: int
203
- fund_requirements: FundRequirementsTemplate
204
-
205
-
206
- class ServiceTemplate(TypedDict):
207
- """Service template."""
208
-
209
- name: str
210
- hash: str
211
- image: str
212
- description: str
213
- configuration: ConfigurationTemplate
214
-
215
-
216
- @dataclass
217
- class DeployedNodes(LocalResource):
218
- """Deployed nodes type."""
219
-
220
- agent: t.List[str]
221
- tendermint: t.List[str]
222
-
223
-
224
- @dataclass
225
- class OnChainFundRequirements(LocalResource):
226
- """On-chain fund requirements."""
227
-
228
- agent: float
229
- safe: float
230
-
231
-
232
- @dataclass
233
- class OnChainUserParams(LocalResource):
234
- """On-chain user params."""
235
-
236
- nft: str
237
- agent_id: int
238
- threshold: int
239
- use_staking: bool
240
- cost_of_bond: int
241
- olas_cost_of_bond: int
242
- olas_required_to_stake: int
243
- fund_requirements: OnChainFundRequirements
244
-
245
- @classmethod
246
- def from_json(cls, obj: t.Dict) -> "OnChainUserParams":
247
- """Load a service"""
248
- return super().from_json(obj) # type: ignore
249
-
250
-
251
- @dataclass
252
- class OnChainData(LocalResource):
253
- """On-chain data"""
254
-
255
- instances: t.List[str] # Agent instances registered as safe owners
256
- token: int
257
- multisig: str
258
- staked: bool
259
- on_chain_state: OnChainState
260
- user_params: OnChainUserParams