48
48
from operate .data .contracts .service_staking_token .contract import (
49
49
ServiceStakingTokenContract ,
50
50
)
51
- from operate .ledger .profiles import CONTRACTS
51
+ from operate .types import ContractAddresses
52
+
52
53
53
54
ZERO_ETH = 0
54
55
@@ -80,7 +81,7 @@ class MultiSendOperation(Enum):
80
81
DELEGATE_CALL = 1
81
82
82
83
83
- def hash_payload_to_hex (
84
+ def hash_payload_to_hex ( # pylint: disable=too-many-arguments,too-many-locals
84
85
safe_tx_hash : str ,
85
86
ether_value : int ,
86
87
safe_tx_gas : int ,
@@ -245,7 +246,9 @@ def stake(
245
246
# since it has the same interface as ERC721 we might want to create
246
247
# a ERC721 contract package
247
248
248
- def _build_approval_tx (* args , ** kargs ) -> t .Dict :
249
+ def _build_approval_tx ( # pylint: disable=unused-argument
250
+ * args : t .Any , ** kargs : t .Any
251
+ ) -> t .Dict :
249
252
return registry_contracts .erc20 .get_approve_tx (
250
253
ledger_api = self .ledger_api ,
251
254
contract_address = service_registry ,
@@ -254,15 +257,17 @@ def _build_approval_tx(*args, **kargs) -> t.Dict:
254
257
amount = service_id ,
255
258
)
256
259
257
- setattr (tx_settler , "build" , _build_approval_tx )
260
+ setattr (tx_settler , "build" , _build_approval_tx ) # noqa: B010
258
261
tx_settler .transact (
259
262
method = lambda : {},
260
263
contract = "" ,
261
264
kwargs = {},
262
265
dry_run = False ,
263
266
)
264
267
265
- def _build_staking_tx (* args , ** kargs ) -> t .Dict :
268
+ def _build_staking_tx ( # pylint: disable=unused-argument
269
+ * args : t .Any , ** kargs : t .Any
270
+ ) -> t .Dict :
266
271
return self .ledger_api .build_transaction (
267
272
contract_instance = self .staking_ctr .get_instance (
268
273
ledger_api = self .ledger_api ,
@@ -276,7 +281,7 @@ def _build_staking_tx(*args, **kargs) -> t.Dict:
276
281
raise_on_try = True ,
277
282
)
278
283
279
- setattr (tx_settler , "build" , _build_staking_tx )
284
+ setattr (tx_settler , "build" , _build_staking_tx ) # noqa: B010
280
285
tx_settler .transact (
281
286
method = lambda : {},
282
287
contract = "" ,
@@ -328,7 +333,9 @@ def unstake(self, service_id: int, staking_contract: str) -> None:
328
333
sleep = self .sleep ,
329
334
)
330
335
331
- def _build_unstaking_tx (* args , ** kargs ) -> t .Dict :
336
+ def _build_unstaking_tx ( # pylint: disable=unused-argument
337
+ * args : t .Any , ** kargs : t .Any
338
+ ) -> t .Dict :
332
339
return self .ledger_api .build_transaction (
333
340
contract_instance = self .staking_ctr .get_instance (
334
341
ledger_api = self .ledger_api ,
@@ -342,7 +349,7 @@ def _build_unstaking_tx(*args, **kargs) -> t.Dict:
342
349
raise_on_try = True ,
343
350
)
344
351
345
- setattr (tx_settler , "build" , _build_unstaking_tx )
352
+ setattr (tx_settler , "build" , _build_unstaking_tx ) # noqa: B010
346
353
tx_settler .transact (
347
354
method = lambda : {},
348
355
contract = "" ,
@@ -354,7 +361,7 @@ def _build_unstaking_tx(*args, **kargs) -> t.Dict:
354
361
class OnChainManager :
355
362
"""On chain service management."""
356
363
357
- def __init__ (self , rpc : str , key : Path , contracts : t . Dict ) -> None :
364
+ def __init__ (self , rpc : str , key : Path , contracts : ContractAddresses ) -> None :
358
365
"""On chain manager."""
359
366
self .rpc = rpc
360
367
self .key = key
@@ -427,7 +434,7 @@ def info(self, token_id: int) -> t.Dict:
427
434
instances = instances ,
428
435
)
429
436
430
- def mint (
437
+ def mint ( # pylint: disable=too-many-arguments,too-many-locals
431
438
self ,
432
439
package_path : Path ,
433
440
agent_id : int ,
@@ -437,8 +444,8 @@ def mint(
437
444
nft : Optional [Union [Path , IPFSHash ]],
438
445
update_token : t .Optional [int ] = None ,
439
446
token : t .Optional [str ] = None ,
440
- ):
441
- "Mint service."
447
+ ) -> t . Dict :
448
+ """ Mint service."" "
442
449
# TODO: Support for update
443
450
self ._patch ()
444
451
manager = MintManager (
@@ -538,7 +545,7 @@ def deploy(
538
545
reuse_multisig = reuse_multisig ,
539
546
)
540
547
541
- def swap (
548
+ def swap ( # pylint: disable=too-many-arguments,too-many-locals
542
549
self ,
543
550
service_id : int ,
544
551
multisig : str ,
@@ -554,7 +561,7 @@ def swap(
554
561
)
555
562
with tempfile .TemporaryDirectory () as temp_dir :
556
563
key_file = Path (temp_dir , "key.txt" )
557
- key_file .write_text (owner_key )
564
+ key_file .write_text (owner_key , encoding = "utf-8" )
558
565
owner_crypto = EthereumCrypto (private_key_path = str (key_file ))
559
566
owner_cryptos : list [EthereumCrypto ] = [owner_crypto ]
560
567
owners = [
0 commit comments