iwa 0.0.18__py3-none-any.whl → 0.0.19__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.
- iwa/plugins/olas/constants.py +41 -39
- iwa/plugins/olas/contracts/abis/mech_marketplace_v1.json +828 -0
- iwa/plugins/olas/contracts/mech_marketplace_v1.py +68 -0
- iwa/plugins/olas/scripts/test_full_mech_flow.py +1 -1
- iwa/plugins/olas/service_manager/mech.py +242 -42
- iwa/tools/reset_tenderly.py +2 -2
- {iwa-0.0.18.dist-info → iwa-0.0.19.dist-info}/METADATA +1 -1
- {iwa-0.0.18.dist-info → iwa-0.0.19.dist-info}/RECORD +12 -10
- {iwa-0.0.18.dist-info → iwa-0.0.19.dist-info}/WHEEL +0 -0
- {iwa-0.0.18.dist-info → iwa-0.0.19.dist-info}/entry_points.txt +0 -0
- {iwa-0.0.18.dist-info → iwa-0.0.19.dist-info}/licenses/LICENSE +0 -0
- {iwa-0.0.18.dist-info → iwa-0.0.19.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"""Mech Marketplace V1 contract interaction (VERSION 1.0.0).
|
|
2
|
+
|
|
3
|
+
This contract version is used by older staking programs like Expert 17 MM.
|
|
4
|
+
It has a different request signature than v2, requiring staking instance
|
|
5
|
+
and service ID parameters for both the mech and the requester.
|
|
6
|
+
|
|
7
|
+
Key differences from v2:
|
|
8
|
+
- request() takes staking instance + service ID for both mech and requester
|
|
9
|
+
- No payment types or balance trackers
|
|
10
|
+
- No checkMech or mapPaymentTypeBalanceTrackers functions
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from dataclasses import dataclass
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
from typing import Dict, Optional
|
|
16
|
+
|
|
17
|
+
from iwa.core.contracts.contract import ContractInstance
|
|
18
|
+
from iwa.core.types import EthereumAddress
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@dataclass
|
|
22
|
+
class V1RequestParams:
|
|
23
|
+
"""Parameters for v1 marketplace request."""
|
|
24
|
+
|
|
25
|
+
data: bytes
|
|
26
|
+
priority_mech: str
|
|
27
|
+
priority_mech_staking_instance: str
|
|
28
|
+
priority_mech_service_id: int
|
|
29
|
+
requester_staking_instance: str
|
|
30
|
+
requester_service_id: int
|
|
31
|
+
response_timeout: int = 300
|
|
32
|
+
value: int = 10_000_000_000_000_000 # 0.01 xDAI
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class MechMarketplaceV1Contract(ContractInstance):
|
|
36
|
+
"""Class to interact with the Mech Marketplace v1 contract (VERSION 1.0.0).
|
|
37
|
+
|
|
38
|
+
This is the older marketplace used by staking contracts like Expert 17 MM.
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
name = "mech_marketplace_v1"
|
|
42
|
+
abi_path = Path(__file__).parent / "abis" / "mech_marketplace_v1.json"
|
|
43
|
+
|
|
44
|
+
def prepare_request_tx(
|
|
45
|
+
self,
|
|
46
|
+
from_address: EthereumAddress,
|
|
47
|
+
params: V1RequestParams,
|
|
48
|
+
) -> Optional[Dict]:
|
|
49
|
+
"""Prepare a v1 marketplace request transaction.
|
|
50
|
+
|
|
51
|
+
v1 ABI: request(bytes data, address priorityMech,
|
|
52
|
+
address priorityMechStakingInstance, uint256 priorityMechServiceId,
|
|
53
|
+
address requesterStakingInstance, uint256 requesterServiceId,
|
|
54
|
+
uint256 responseTimeout)
|
|
55
|
+
"""
|
|
56
|
+
return self.prepare_transaction(
|
|
57
|
+
method_name="request",
|
|
58
|
+
method_kwargs={
|
|
59
|
+
"data": params.data,
|
|
60
|
+
"priorityMech": params.priority_mech,
|
|
61
|
+
"priorityMechStakingInstance": params.priority_mech_staking_instance,
|
|
62
|
+
"priorityMechServiceId": params.priority_mech_service_id,
|
|
63
|
+
"requesterStakingInstance": params.requester_staking_instance,
|
|
64
|
+
"requesterServiceId": params.requester_service_id,
|
|
65
|
+
"responseTimeout": params.response_timeout,
|
|
66
|
+
},
|
|
67
|
+
tx_params={"from": from_address, "value": params.value},
|
|
68
|
+
)
|
|
@@ -173,7 +173,7 @@ def main(): # noqa: C901
|
|
|
173
173
|
# Get contract addresses
|
|
174
174
|
protocol_contracts = OLAS_CONTRACTS.get("gnosis", {})
|
|
175
175
|
legacy_mech_address = protocol_contracts.get("OLAS_MECH")
|
|
176
|
-
marketplace_address = protocol_contracts.get("
|
|
176
|
+
marketplace_address = protocol_contracts.get("OLAS_MECH_MARKETPLACE_V2")
|
|
177
177
|
|
|
178
178
|
# Step 3: Send Legacy Mech Request
|
|
179
179
|
print_step("Step 3: Send Legacy Mech Request", "3️⃣")
|
|
@@ -1,28 +1,57 @@
|
|
|
1
1
|
"""Mech manager mixin.
|
|
2
2
|
|
|
3
|
-
This module handles sending mech requests for OLAS services. There are
|
|
4
|
-
distinct flows for mech requests, and the correct one
|
|
5
|
-
the service's staking contract:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
3
|
+
This module handles sending mech requests for OLAS services. There are THREE
|
|
4
|
+
distinct flows for mech requests, and the correct one is automatically selected
|
|
5
|
+
based on the service's staking contract configuration:
|
|
6
|
+
|
|
7
|
+
Flow Selection Logic:
|
|
8
|
+
1. `get_marketplace_config()` checks if staking contract's activity checker
|
|
9
|
+
has a non-zero `mechMarketplace` address
|
|
10
|
+
2. If yes → marketplace request (v1 or v2 depending on address)
|
|
11
|
+
3. If no → legacy mech request
|
|
12
|
+
|
|
13
|
+
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
14
|
+
│ FLOW 1: Legacy Mech (use_marketplace=False) │
|
|
15
|
+
├─────────────────────────────────────────────────────────────────────────────┤
|
|
16
|
+
│ Contract: Legacy Mech (0x77af31De...) │
|
|
17
|
+
│ Used by: NON-MM staking contracts (e.g., "Expert X (Yk OLAS)") │
|
|
18
|
+
│ Counting: agentMech.getRequestsCount(multisig) │
|
|
19
|
+
│ Method: _send_legacy_mech_request() │
|
|
20
|
+
└─────────────────────────────────────────────────────────────────────────────┘
|
|
21
|
+
|
|
22
|
+
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
23
|
+
│ FLOW 2: Marketplace v2 (use_marketplace=True, marketplace=0x735F...) │
|
|
24
|
+
├─────────────────────────────────────────────────────────────────────────────┤
|
|
25
|
+
│ Contract: MechMarketplace v2 (0x735FAAb1c...) │
|
|
26
|
+
│ Used by: Newer MM staking contracts │
|
|
27
|
+
│ Counting: mechMarketplace.mapRequestCounts(multisig) │
|
|
28
|
+
│ Method: _send_marketplace_mech_request() → MechMarketplaceContract │
|
|
29
|
+
│ Signature: request(bytes,uint256,bytes32,address,uint256,bytes) │
|
|
30
|
+
│ Note: Uses payment types (PAYMENT_TYPE_NATIVE) │
|
|
31
|
+
└─────────────────────────────────────────────────────────────────────────────┘
|
|
32
|
+
|
|
33
|
+
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
34
|
+
│ FLOW 3: Marketplace v1 (use_marketplace=True, marketplace=0x4554...) │
|
|
35
|
+
├─────────────────────────────────────────────────────────────────────────────┤
|
|
36
|
+
│ Contract: MechMarketplace v1 (0x4554fE75...) [VERSION 1.0.0] │
|
|
37
|
+
│ Used by: Older MM contracts (e.g., "Expert 17 MM", trader_ant) │
|
|
38
|
+
│ Counting: mechMarketplace.mapRequestCounts(multisig) │
|
|
39
|
+
│ Method: _send_v1_marketplace_request() → MechMarketplaceV1Contract │
|
|
40
|
+
│ Signature: request(bytes,address,address,uint256,address,uint256,uint256) │
|
|
41
|
+
│ Note: Requires staking instance + service ID for mech AND requester │
|
|
42
|
+
│ No payment types - simpler but different parameter set │
|
|
43
|
+
└─────────────────────────────────────────────────────────────────────────────┘
|
|
44
|
+
|
|
45
|
+
Important:
|
|
46
|
+
If a service is staked in an MM contract but sends requests to the wrong
|
|
47
|
+
marketplace (or uses legacy flow), those requests will NOT be counted by
|
|
48
|
+
the activity checker, and the service will not receive staking rewards.
|
|
49
|
+
|
|
50
|
+
The dispatch logic:
|
|
51
|
+
1. _send_marketplace_mech_request() checks if marketplace ∈ V1_MARKETPLACES
|
|
52
|
+
2. If v1 → dispatches to _send_v1_marketplace_request()
|
|
53
|
+
3. If v2 → continues with MechMarketplaceContract (v2 ABI)
|
|
54
|
+
|
|
26
55
|
"""
|
|
27
56
|
|
|
28
57
|
from typing import Optional
|
|
@@ -37,6 +66,31 @@ from iwa.plugins.olas.constants import (
|
|
|
37
66
|
)
|
|
38
67
|
from iwa.plugins.olas.contracts.mech import MechContract
|
|
39
68
|
from iwa.plugins.olas.contracts.mech_marketplace import MechMarketplaceContract
|
|
69
|
+
from iwa.plugins.olas.contracts.mech_marketplace_v1 import (
|
|
70
|
+
MechMarketplaceV1Contract,
|
|
71
|
+
V1RequestParams,
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
# Maps marketplace address to (priority_mech_address, priority_mech_service_id, mech_staking_instance)
|
|
75
|
+
# Source: olas-operate-middleware profiles.py and manage.py
|
|
76
|
+
# The 3rd element (staking instance) is only needed for v1 marketplaces
|
|
77
|
+
DEFAULT_PRIORITY_MECH = {
|
|
78
|
+
"0x4554fE75c1f5576c1d7F765B2A036c199Adae329": (
|
|
79
|
+
"0x552cEA7Bc33CbBEb9f1D90c1D11D2C6daefFd053",
|
|
80
|
+
975,
|
|
81
|
+
"0x998dEFafD094817EF329f6dc79c703f1CF18bC90", # Mech staking instance for v1
|
|
82
|
+
),
|
|
83
|
+
"0x735FAAb1c4Ec41128c367AFb5c3baC73509f70bB": (
|
|
84
|
+
"0xC05e7412439bD7e91730a6880E18d5D5873F632C",
|
|
85
|
+
2182,
|
|
86
|
+
None, # v2 doesn't need staking instance
|
|
87
|
+
),
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
# Marketplace v1 addresses (use different request signature)
|
|
91
|
+
V1_MARKETPLACES = {
|
|
92
|
+
"0x4554fE75c1f5576c1d7F765B2A036c199Adae329", # VERSION 1.0.0
|
|
93
|
+
}
|
|
40
94
|
|
|
41
95
|
|
|
42
96
|
class MechManagerMixin:
|
|
@@ -72,17 +126,26 @@ class MechManagerMixin:
|
|
|
72
126
|
checker = staking.activity_checker
|
|
73
127
|
|
|
74
128
|
if checker.mech_marketplace and checker.mech_marketplace != ZERO_ADDRESS:
|
|
75
|
-
#
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
129
|
+
# Get priority mech from mapping based on marketplace address
|
|
130
|
+
marketplace_addr = Web3.to_checksum_address(checker.mech_marketplace)
|
|
131
|
+
priority_mech_info = DEFAULT_PRIORITY_MECH.get(marketplace_addr)
|
|
132
|
+
|
|
133
|
+
if priority_mech_info:
|
|
134
|
+
priority_mech = priority_mech_info[0] # First element is mech address
|
|
135
|
+
else:
|
|
136
|
+
# Fallback to constants if marketplace not in mapping
|
|
137
|
+
protocol_contracts = OLAS_CONTRACTS.get(self.chain_name, {})
|
|
138
|
+
priority_mech = protocol_contracts.get("OLAS_MECH_MARKETPLACE_PRIORITY")
|
|
139
|
+
logger.warning(
|
|
140
|
+
f"[MECH] Marketplace {marketplace_addr} not in DEFAULT_PRIORITY_MECH, "
|
|
141
|
+
f"using fallback priority_mech: {priority_mech}"
|
|
142
|
+
)
|
|
80
143
|
|
|
81
144
|
logger.info(
|
|
82
145
|
f"[MECH] Service {self.service.service_id} requires marketplace requests "
|
|
83
|
-
f"(marketplace={
|
|
146
|
+
f"(marketplace={marketplace_addr}, priority_mech={priority_mech})"
|
|
84
147
|
)
|
|
85
|
-
return (True,
|
|
148
|
+
return (True, marketplace_addr, priority_mech)
|
|
86
149
|
|
|
87
150
|
return (False, None, None)
|
|
88
151
|
|
|
@@ -134,6 +197,7 @@ class MechManagerMixin:
|
|
|
134
197
|
return None
|
|
135
198
|
|
|
136
199
|
# Auto-detect marketplace requirement if not explicitly specified
|
|
200
|
+
detected_marketplace = None
|
|
137
201
|
if use_marketplace is None:
|
|
138
202
|
use_marketplace, detected_marketplace, detected_priority_mech = (
|
|
139
203
|
self.get_marketplace_config()
|
|
@@ -143,10 +207,12 @@ class MechManagerMixin:
|
|
|
143
207
|
mech_address = mech_address or detected_marketplace
|
|
144
208
|
|
|
145
209
|
if use_marketplace:
|
|
210
|
+
# Use detected marketplace if available, otherwise _send_marketplace_mech_request
|
|
211
|
+
# will fall back to constant
|
|
146
212
|
return self._send_marketplace_mech_request(
|
|
147
213
|
data=data,
|
|
148
214
|
value=value,
|
|
149
|
-
marketplace_address=
|
|
215
|
+
marketplace_address=detected_marketplace,
|
|
150
216
|
priority_mech=priority_mech,
|
|
151
217
|
max_delivery_rate=max_delivery_rate,
|
|
152
218
|
payment_type=payment_type,
|
|
@@ -206,7 +272,12 @@ class MechManagerMixin:
|
|
|
206
272
|
)
|
|
207
273
|
|
|
208
274
|
def _validate_priority_mech(self, marketplace, priority_mech: str) -> bool:
|
|
209
|
-
"""Validate priority mech is registered on marketplace.
|
|
275
|
+
"""Validate priority mech is registered on marketplace.
|
|
276
|
+
|
|
277
|
+
Note: OLD marketplace v1 (0x4554...) doesn't have checkMech function.
|
|
278
|
+
In that case, we skip validation and proceed - v1 doesn't require
|
|
279
|
+
mech registration.
|
|
280
|
+
"""
|
|
210
281
|
try:
|
|
211
282
|
mech_multisig = marketplace.call("checkMech", priority_mech)
|
|
212
283
|
if mech_multisig == ZERO_ADDRESS:
|
|
@@ -214,8 +285,19 @@ class MechManagerMixin:
|
|
|
214
285
|
return False
|
|
215
286
|
logger.debug(f"Priority mech {priority_mech} -> multisig {mech_multisig}")
|
|
216
287
|
except Exception as e:
|
|
217
|
-
|
|
218
|
-
|
|
288
|
+
# Check if this is a revert (v1 doesn't have checkMech) vs a network error
|
|
289
|
+
error_str = str(e).lower()
|
|
290
|
+
if "reverted" in error_str or "execution reverted" in error_str:
|
|
291
|
+
# v1 marketplaces don't have checkMech - skip validation
|
|
292
|
+
logger.warning(
|
|
293
|
+
f"Could not validate priority mech (marketplace may be v1): {e}. "
|
|
294
|
+
"Proceeding without validation."
|
|
295
|
+
)
|
|
296
|
+
return True
|
|
297
|
+
else:
|
|
298
|
+
# Real error (network, timeout, etc.) - fail validation
|
|
299
|
+
logger.error(f"Failed to validate priority mech (network error?): {e}")
|
|
300
|
+
return False
|
|
219
301
|
|
|
220
302
|
# Log mech factory info (optional validation)
|
|
221
303
|
try:
|
|
@@ -234,7 +316,11 @@ class MechManagerMixin:
|
|
|
234
316
|
def _validate_marketplace_params(
|
|
235
317
|
self, marketplace, response_timeout: int, payment_type: bytes
|
|
236
318
|
) -> bool:
|
|
237
|
-
"""Validate marketplace parameters.
|
|
319
|
+
"""Validate marketplace parameters.
|
|
320
|
+
|
|
321
|
+
Note: v1 marketplaces may not have all validation functions.
|
|
322
|
+
We proceed with warnings when validation functions are unavailable.
|
|
323
|
+
"""
|
|
238
324
|
# Validate response_timeout bounds
|
|
239
325
|
try:
|
|
240
326
|
min_timeout = marketplace.call("minResponseTimeout")
|
|
@@ -250,15 +336,31 @@ class MechManagerMixin:
|
|
|
250
336
|
except Exception as e:
|
|
251
337
|
logger.warning(f"Could not validate response_timeout bounds: {e}")
|
|
252
338
|
|
|
253
|
-
# Validate payment type has balance tracker
|
|
339
|
+
# Validate payment type has balance tracker (v2 only)
|
|
254
340
|
try:
|
|
255
341
|
balance_tracker = marketplace.call("mapPaymentTypeBalanceTrackers", payment_type)
|
|
256
342
|
if balance_tracker == ZERO_ADDRESS:
|
|
257
|
-
|
|
343
|
+
# This is a validation failure for v2 - return False
|
|
344
|
+
logger.error(
|
|
345
|
+
f"No balance tracker for payment type 0x{payment_type.hex()}. "
|
|
346
|
+
"This is required for v2 marketplace requests."
|
|
347
|
+
)
|
|
258
348
|
return False
|
|
259
|
-
|
|
349
|
+
else:
|
|
350
|
+
logger.debug(f"Payment type balance tracker: {balance_tracker}")
|
|
260
351
|
except Exception as e:
|
|
261
|
-
|
|
352
|
+
# Check if this is a revert (v1 doesn't have this function) vs a network error
|
|
353
|
+
error_str = str(e).lower()
|
|
354
|
+
if "reverted" in error_str or "execution reverted" in error_str:
|
|
355
|
+
# v1 marketplaces don't have mapPaymentTypeBalanceTrackers - skip
|
|
356
|
+
logger.warning(
|
|
357
|
+
f"Could not validate payment type (marketplace may be v1): {e}. "
|
|
358
|
+
"Proceeding without validation."
|
|
359
|
+
)
|
|
360
|
+
else:
|
|
361
|
+
# Real error - fail validation
|
|
362
|
+
logger.error(f"Failed to validate payment type (network error?): {e}")
|
|
363
|
+
return False
|
|
262
364
|
|
|
263
365
|
return True
|
|
264
366
|
|
|
@@ -269,7 +371,7 @@ class MechManagerMixin:
|
|
|
269
371
|
chain_name = self.chain_name if self.service else getattr(self, "chain_name", "gnosis")
|
|
270
372
|
protocol_contracts = OLAS_CONTRACTS.get(chain_name, {})
|
|
271
373
|
|
|
272
|
-
resolved_mp = marketplace_addr or protocol_contracts.get("
|
|
374
|
+
resolved_mp = marketplace_addr or protocol_contracts.get("OLAS_MECH_MARKETPLACE_V2")
|
|
273
375
|
if not resolved_mp:
|
|
274
376
|
raise ValueError(f"Mech Marketplace address not found for chain {chain_name}")
|
|
275
377
|
|
|
@@ -294,14 +396,30 @@ class MechManagerMixin:
|
|
|
294
396
|
self,
|
|
295
397
|
data: bytes,
|
|
296
398
|
value: Optional[int] = None,
|
|
297
|
-
marketplace_address: Optional[str] = None,
|
|
298
399
|
priority_mech: Optional[str] = None,
|
|
400
|
+
marketplace_address: Optional[str] = None,
|
|
299
401
|
max_delivery_rate: Optional[int] = None,
|
|
300
402
|
payment_type: Optional[bytes] = None,
|
|
301
403
|
payment_data: bytes = b"",
|
|
302
404
|
response_timeout: int = 300,
|
|
303
405
|
) -> Optional[str]:
|
|
304
|
-
"""Send a marketplace mech request with validation.
|
|
406
|
+
"""Send a marketplace mech request with validation.
|
|
407
|
+
|
|
408
|
+
Args:
|
|
409
|
+
data: Request data payload (bytes).
|
|
410
|
+
value: Native currency value to send with request (wei).
|
|
411
|
+
priority_mech: Priority mech address for request processing.
|
|
412
|
+
marketplace_address: The marketplace contract address from activity checker.
|
|
413
|
+
If None, falls back to OLAS_MECH_MARKETPLACE_V2 constant.
|
|
414
|
+
max_delivery_rate: Maximum delivery rate for the mech.
|
|
415
|
+
payment_type: Payment type bytes32 (defaults to PAYMENT_TYPE_NATIVE).
|
|
416
|
+
payment_data: Additional payment data.
|
|
417
|
+
response_timeout: Timeout for response in seconds.
|
|
418
|
+
|
|
419
|
+
Returns:
|
|
420
|
+
Transaction hash if successful, None otherwise.
|
|
421
|
+
|
|
422
|
+
"""
|
|
305
423
|
if not self.service:
|
|
306
424
|
logger.error("No active service")
|
|
307
425
|
return None
|
|
@@ -314,6 +432,17 @@ class MechManagerMixin:
|
|
|
314
432
|
logger.error(e)
|
|
315
433
|
return None
|
|
316
434
|
|
|
435
|
+
# Dispatch to v1 handler if marketplace is v1
|
|
436
|
+
if marketplace_address in V1_MARKETPLACES:
|
|
437
|
+
return self._send_v1_marketplace_request(
|
|
438
|
+
data=data,
|
|
439
|
+
marketplace_address=marketplace_address,
|
|
440
|
+
priority_mech=priority_mech,
|
|
441
|
+
response_timeout=response_timeout,
|
|
442
|
+
value=value,
|
|
443
|
+
)
|
|
444
|
+
|
|
445
|
+
# v2 flow
|
|
317
446
|
marketplace = MechMarketplaceContract(marketplace_address, chain_name=self.chain_name)
|
|
318
447
|
|
|
319
448
|
if not self._validate_priority_mech(marketplace, priority_mech):
|
|
@@ -350,6 +479,77 @@ class MechManagerMixin:
|
|
|
350
479
|
expected_event="MarketplaceRequest",
|
|
351
480
|
)
|
|
352
481
|
|
|
482
|
+
def _send_v1_marketplace_request(
|
|
483
|
+
self,
|
|
484
|
+
data: bytes,
|
|
485
|
+
marketplace_address: str,
|
|
486
|
+
priority_mech: str,
|
|
487
|
+
response_timeout: int = 300,
|
|
488
|
+
value: Optional[int] = None,
|
|
489
|
+
) -> Optional[str]:
|
|
490
|
+
"""Send a v1 marketplace mech request.
|
|
491
|
+
|
|
492
|
+
v1 marketplace (VERSION 1.0.0) requires staking instance and service ID
|
|
493
|
+
for both the mech and the requester, unlike v2 which uses payment types.
|
|
494
|
+
"""
|
|
495
|
+
if not self.service:
|
|
496
|
+
logger.error("No active service")
|
|
497
|
+
return None
|
|
498
|
+
|
|
499
|
+
# Get mech info from DEFAULT_PRIORITY_MECH (now a 3-tuple)
|
|
500
|
+
mech_info = DEFAULT_PRIORITY_MECH.get(marketplace_address)
|
|
501
|
+
if not mech_info or len(mech_info) < 3:
|
|
502
|
+
logger.error(f"No priority mech info for v1 marketplace {marketplace_address}")
|
|
503
|
+
return None
|
|
504
|
+
|
|
505
|
+
priority_mech_address, priority_mech_service_id, priority_mech_staking = mech_info
|
|
506
|
+
|
|
507
|
+
if not priority_mech_staking:
|
|
508
|
+
logger.error(f"No mech staking instance for v1 marketplace {marketplace_address}")
|
|
509
|
+
return None
|
|
510
|
+
|
|
511
|
+
# Get requester staking info from current service
|
|
512
|
+
requester_staking_instance = self.service.staking_contract_address
|
|
513
|
+
requester_service_id = self.service.service_id
|
|
514
|
+
|
|
515
|
+
if not requester_staking_instance:
|
|
516
|
+
logger.error("No staking contract for current service (required for v1)")
|
|
517
|
+
return None
|
|
518
|
+
|
|
519
|
+
# Build v1 request params
|
|
520
|
+
params = V1RequestParams(
|
|
521
|
+
data=data,
|
|
522
|
+
priority_mech=priority_mech_address,
|
|
523
|
+
priority_mech_staking_instance=priority_mech_staking,
|
|
524
|
+
priority_mech_service_id=priority_mech_service_id,
|
|
525
|
+
requester_staking_instance=requester_staking_instance,
|
|
526
|
+
requester_service_id=requester_service_id,
|
|
527
|
+
response_timeout=response_timeout,
|
|
528
|
+
value=value or 10_000_000_000_000_000, # 0.01 xDAI default
|
|
529
|
+
)
|
|
530
|
+
|
|
531
|
+
logger.info(
|
|
532
|
+
f"[MECH-V1] Sending v1 marketplace request to {marketplace_address} "
|
|
533
|
+
f"(mech={priority_mech_address}, mech_svc={priority_mech_service_id})"
|
|
534
|
+
)
|
|
535
|
+
|
|
536
|
+
marketplace = MechMarketplaceV1Contract(marketplace_address, chain_name=self.chain_name)
|
|
537
|
+
tx_data = marketplace.prepare_request_tx(
|
|
538
|
+
from_address=self.service.multisig_address,
|
|
539
|
+
params=params,
|
|
540
|
+
)
|
|
541
|
+
|
|
542
|
+
if not tx_data:
|
|
543
|
+
logger.error("Failed to prepare v1 marketplace request transaction")
|
|
544
|
+
return None
|
|
545
|
+
|
|
546
|
+
return self._execute_mech_tx(
|
|
547
|
+
tx_data=tx_data,
|
|
548
|
+
to_address=str(marketplace_address),
|
|
549
|
+
contract_instance=marketplace,
|
|
550
|
+
expected_event="MarketplaceRequest",
|
|
551
|
+
)
|
|
552
|
+
|
|
353
553
|
def _execute_mech_tx(
|
|
354
554
|
self,
|
|
355
555
|
tx_data: dict,
|
iwa/tools/reset_tenderly.py
CHANGED
|
@@ -343,8 +343,8 @@ if __name__ == "__main__": # pragma: no cover
|
|
|
343
343
|
"-p",
|
|
344
344
|
type=int,
|
|
345
345
|
default=1,
|
|
346
|
-
choices=[1, 2, 3],
|
|
347
|
-
help="Tenderly profile to use (1
|
|
346
|
+
choices=[1, 2, 3, 4],
|
|
347
|
+
help="Tenderly profile to use (1-4)",
|
|
348
348
|
)
|
|
349
349
|
args = parser.parse_args()
|
|
350
350
|
|
|
@@ -56,7 +56,7 @@ iwa/plugins/gnosis/cow/types.py,sha256=-9VRiFhAkmN1iIJ95Pg7zLFSeXtkkW00sl13usxi3
|
|
|
56
56
|
iwa/plugins/gnosis/tests/test_cow.py,sha256=iVy5ockMIcPZWsX4WGXU91DhBsYEZ5NOxtFzAQ2sK3o,8440
|
|
57
57
|
iwa/plugins/gnosis/tests/test_safe.py,sha256=pw1zrYvAiVtmPIU5k7BtOQpDNAQTSTrLIaeljCjSahc,3216
|
|
58
58
|
iwa/plugins/olas/__init__.py,sha256=_NhBczzM61fhGYwGhnWfEeL8Jywyy_730GASe2BxzeQ,106
|
|
59
|
-
iwa/plugins/olas/constants.py,sha256=
|
|
59
|
+
iwa/plugins/olas/constants.py,sha256=iTFoO2QW3KbhL5k5sKsJxxyDytl9wVIb_9hAih55KrE,7728
|
|
60
60
|
iwa/plugins/olas/importer.py,sha256=f8KlZ9dGcNbpg8uoTYbO9sDvbluZoslhpWFLqPjPnLA,26717
|
|
61
61
|
iwa/plugins/olas/mech_reference.py,sha256=CaSCpQnQL4F7wOG6Ox6Zdoy-uNEQ78YBwVLILQZKL8Q,5782
|
|
62
62
|
iwa/plugins/olas/models.py,sha256=xC5hYakX53pBT6zZteM9cyiC7t6XRLLpobjQmDYueOo,3520
|
|
@@ -65,24 +65,26 @@ iwa/plugins/olas/contracts/activity_checker.py,sha256=PTLvsFdi3PdsFMxRVcXfwlQMRy
|
|
|
65
65
|
iwa/plugins/olas/contracts/base.py,sha256=y73aQbDq6l4zUpz_eQAg4MsLkTAEqjjupXlcvxjfgCI,240
|
|
66
66
|
iwa/plugins/olas/contracts/mech.py,sha256=dXYtyORc-oiu9ga5PtTquOFkoakb6BLGKvlUsteygIg,2767
|
|
67
67
|
iwa/plugins/olas/contracts/mech_marketplace.py,sha256=hMADl5MQGvT2wLRKu4vHGe4RrAZVq8Y2M_EvXWWz528,1554
|
|
68
|
+
iwa/plugins/olas/contracts/mech_marketplace_v1.py,sha256=ooF5uw1wxwYsoriGUGGxXxmaD8DtWZtK4TJBCUNTGtI,2501
|
|
68
69
|
iwa/plugins/olas/contracts/service.py,sha256=BDQKeCTCnBNrwKD1a8rrlLytpKG3CAdjr-s0ec-dsFY,8243
|
|
69
70
|
iwa/plugins/olas/contracts/staking.py,sha256=vt2UZ6G0edg1EbPrzFK5AIse531bQTu4PLydQ6rgrAA,14494
|
|
70
71
|
iwa/plugins/olas/contracts/abis/activity_checker.json,sha256=HT0IMbyTLMO71ITBKwoS950rHe772suPP4b8eDAodJ0,2230
|
|
71
72
|
iwa/plugins/olas/contracts/abis/mech.json,sha256=bMMCXInjE_2PTPnc_sIyS_H8pod5Sm_e-xTbKgZppKc,16369
|
|
72
73
|
iwa/plugins/olas/contracts/abis/mech_marketplace.json,sha256=KPnF-H_UATb3wdb_7o6ky_hSp5xwgvckD-QqylsWJLg,32468
|
|
74
|
+
iwa/plugins/olas/contracts/abis/mech_marketplace_v1.json,sha256=sB9RhPcEI7xYLWKrebAP-s3v6hdeAH9V3njPNZqSM-M,20678
|
|
73
75
|
iwa/plugins/olas/contracts/abis/mech_new.json,sha256=j6HkhTpVQEA4la13Kp1Q_pwlt2x5Ywh7GCEjz4q2_ws,20995
|
|
74
76
|
iwa/plugins/olas/contracts/abis/service_manager.json,sha256=jsByfx_NPNqHJBbauGEg2S41D0ZYUHa24TzpJQuk604,29735
|
|
75
77
|
iwa/plugins/olas/contracts/abis/service_registry.json,sha256=phtK1FHUZRtUHP0HeISyO2jlrlzGiETON_Ljd_kLYn4,43864
|
|
76
78
|
iwa/plugins/olas/contracts/abis/service_registry_token_utility.json,sha256=GR02mv9b8yckGubh_Huca_jbczw30AG-34ocZELNLPI,57624
|
|
77
79
|
iwa/plugins/olas/contracts/abis/staking.json,sha256=_W3NBuygSU-tsqdWTD7P0PmCVz7ZUCqIoJkW60ChjLw,31139
|
|
78
80
|
iwa/plugins/olas/contracts/abis/staking_token.json,sha256=cuUOmi1s4Z6VSIX0an_IxK6qkPeoyPt3NUdvlX8GlPI,81288
|
|
79
|
-
iwa/plugins/olas/scripts/test_full_mech_flow.py,sha256=
|
|
81
|
+
iwa/plugins/olas/scripts/test_full_mech_flow.py,sha256=Fqoq5bn7Z_3YyRrnuqNAZy9cwQDLiXP6Vf3EIeWPo2I,9024
|
|
80
82
|
iwa/plugins/olas/scripts/test_simple_lifecycle.py,sha256=8T50tOZx3afeECSfCNAb0rAHNtYOsBaeXlMwKXElCk8,2099
|
|
81
83
|
iwa/plugins/olas/service_manager/__init__.py,sha256=GXiThMEY3nPgHUl1i-DLrF4h96z9jPxxI8Jepo2E1PM,1926
|
|
82
84
|
iwa/plugins/olas/service_manager/base.py,sha256=CCTH7RiYtgyFwRszrMLxNf1rNM_6leWHuJJmse4m2wI,4854
|
|
83
85
|
iwa/plugins/olas/service_manager/drain.py,sha256=IS7YYKuQdkULcNdxfHVzjcq95pXKdpajolzLL78u4jc,12430
|
|
84
86
|
iwa/plugins/olas/service_manager/lifecycle.py,sha256=DIB6yrP0VPICu6558uQJuFp2sgrA66iVNTzZVUUowGw,47159
|
|
85
|
-
iwa/plugins/olas/service_manager/mech.py,sha256=
|
|
87
|
+
iwa/plugins/olas/service_manager/mech.py,sha256=WJtf90y9JrFAo6QHosFn0bfM_2q9VjMBmXhYzwDsUpU,27620
|
|
86
88
|
iwa/plugins/olas/service_manager/staking.py,sha256=Z9GzlPfY7qSSjc9xPhWvb9qywxu_7OB3Gc1eBli07pY,28058
|
|
87
89
|
iwa/plugins/olas/tests/conftest.py,sha256=4vM7EI00SrTGyeP0hNzsGSQHEj2-iznVgzlNh2_OGfo,739
|
|
88
90
|
iwa/plugins/olas/tests/test_importer.py,sha256=i9LKov7kNRECB3hmRnhKBwcfx3uxtjWe4BB77bOOpeo,4282
|
|
@@ -113,7 +115,7 @@ iwa/tools/check_profile.py,sha256=0LAv9wx4wMM610mX88-6tIoDi2I5LDzh0W9nkprt42s,21
|
|
|
113
115
|
iwa/tools/list_contracts.py,sha256=2w-LYB2RVS-eGil2kLiBIEm3tYYhYzT4lAuGO6VtLJU,4861
|
|
114
116
|
iwa/tools/release.py,sha256=-Z9GG6Y-K6KG32K0VUf_MruiUdJxG6W7ToOMzhyCH7Y,3963
|
|
115
117
|
iwa/tools/reset_env.py,sha256=FKN0wuh9Xq00c94B2kEFehHPKcWldxYqgU45yJwg5Cg,3140
|
|
116
|
-
iwa/tools/reset_tenderly.py,sha256=
|
|
118
|
+
iwa/tools/reset_tenderly.py,sha256=usKfOLrQvdCzEncueg-Sz3spqX80vHPQmbh2tIygo8o,11295
|
|
117
119
|
iwa/tools/restore_backup.py,sha256=_LJbmKv9SlekLUQFdjI3aHCvAc6uePobJe3bQEFyatk,2455
|
|
118
120
|
iwa/tools/wallet_check.py,sha256=IQLgb8oCt4oG6FMEAqzUxM57DLv_UE24dFUSVxtBo_Y,4774
|
|
119
121
|
iwa/tui/__init__.py,sha256=XYIZNQNy-fZC1NHHM0sd9qUO0vE1slml-cm0CpQ4NLY,27
|
|
@@ -150,7 +152,7 @@ iwa/web/tests/test_web_endpoints.py,sha256=C264MH-CTyDW4GLUrTXBgLJKUk4-89pFAScBd
|
|
|
150
152
|
iwa/web/tests/test_web_olas.py,sha256=0CVSsrncOeJ3x0ECV7mVLQV_CXZRrOqGiVjgLIi6hZ8,16308
|
|
151
153
|
iwa/web/tests/test_web_swap.py,sha256=7A4gBJFL01kIXPtW1E1J17SCsVc_0DmUn-R8kKrnnVA,2974
|
|
152
154
|
iwa/web/tests/test_web_swap_coverage.py,sha256=zGNrzlhZ_vWDCvWmLcoUwFgqxnrp_ACbo49AtWBS_Kw,5584
|
|
153
|
-
iwa-0.0.
|
|
155
|
+
iwa-0.0.19.dist-info/licenses/LICENSE,sha256=eIubm_IlBHPYRQlLNZKbBNKhJUUP3JH0A2miZUhAVfI,1078
|
|
154
156
|
tests/legacy_cow.py,sha256=oOkZvIxL70ReEoD9oHQbOD5GpjIr6AGNHcOCgfPlerU,8389
|
|
155
157
|
tests/legacy_safe.py,sha256=AssM2g13E74dNGODu_H0Q0y412lgqsrYnEzI97nm_Ts,2972
|
|
156
158
|
tests/legacy_transaction_retry_logic.py,sha256=D9RqZ7DBu61Xr2djBAodU2p9UE939LL-DnQXswX5iQk,1497
|
|
@@ -202,8 +204,8 @@ tests/test_utils.py,sha256=vkP49rYNI8BRzLpWR3WnKdDr8upeZjZcs7Rx0pjbQMo,1292
|
|
|
202
204
|
tests/test_workers.py,sha256=MInwdkFY5LdmFB3o1odIaSD7AQZb3263hNafO1De5PE,2793
|
|
203
205
|
tools/create_and_stake_service.py,sha256=1xwy_bJQI1j9yIQ968Oc9Db_F6mk1659LuuZntTASDE,3742
|
|
204
206
|
tools/verify_drain.py,sha256=PkMjblyOOAuQge88FwfEzRtCYeEtJxXhPBmtQYCoQ-8,6743
|
|
205
|
-
iwa-0.0.
|
|
206
|
-
iwa-0.0.
|
|
207
|
-
iwa-0.0.
|
|
208
|
-
iwa-0.0.
|
|
209
|
-
iwa-0.0.
|
|
207
|
+
iwa-0.0.19.dist-info/METADATA,sha256=ueADSL3j41OZTVAxdOovoGm6S4pPn9g2M4g2l7yVRgM,7295
|
|
208
|
+
iwa-0.0.19.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
209
|
+
iwa-0.0.19.dist-info/entry_points.txt,sha256=nwB6kscrfA7M00pYmL2j-sBH6eF6h2ga9IK1BZxdiyQ,241
|
|
210
|
+
iwa-0.0.19.dist-info/top_level.txt,sha256=kedS9cRUbm4JE2wYeabIXilhHjN8KCw0IGbqqqsw0Bs,16
|
|
211
|
+
iwa-0.0.19.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|