13
13
from src .providers .execution .base_interface import ContractInterface
14
14
from src .utils .abi import named_tuple_to_dataclass
15
15
from src .utils .cache import global_lru_cache as lru_cache
16
- from src .utils .types import hex_str_to_bytes
17
16
18
17
logger = logging .getLogger (__name__ )
19
18
20
19
21
- class VaultsLazyOracleContract (ContractInterface ):
20
+ class LazyOracleContract (ContractInterface ):
22
21
abi_path = './assets/LazyOracle.json'
23
22
24
23
@lru_cache (maxsize = 1 )
@@ -28,28 +27,24 @@ def get_vaults_count(self, block_identifier: BlockIdentifier = 'latest') -> int:
28
27
"""
29
28
response = self .functions .vaultsCount .call (block_identifier = block_identifier )
30
29
31
- logger .info (
32
- {
33
- 'msg' : 'Call `vaultsCount().' ,
34
- 'value' : response ,
35
- 'block_identifier' : repr (block_identifier ),
36
- 'to' : self .address ,
37
- }
38
- )
30
+ logger .info ({
31
+ 'msg' : 'Call `vaultsCount().' ,
32
+ 'value' : response ,
33
+ 'block_identifier' : repr (block_identifier ),
34
+ 'to' : self .address ,
35
+ })
39
36
40
37
return response
41
38
42
39
def get_latest_report_data (self , block_identifier : BlockIdentifier = 'latest' ) -> OnChainIpfsVaultReportData :
43
40
response = self .functions .latestReportData .call (block_identifier = block_identifier )
44
41
45
- logger .info (
46
- {
47
- 'msg' : 'Call `latestReportData()`.' ,
48
- 'value' : response ,
49
- 'block_identifier' : repr (block_identifier ),
50
- 'to' : self .address ,
51
- }
52
- )
42
+ logger .info ({
43
+ 'msg' : 'Call `latestReportData()`.' ,
44
+ 'value' : response ,
45
+ 'block_identifier' : repr (block_identifier ),
46
+ 'to' : self .address ,
47
+ })
53
48
54
49
response = named_tuple_to_dataclass (response , OnChainIpfsVaultReportData )
55
50
return response
@@ -62,33 +57,29 @@ def get_vaults(self, offset: int, limit: int, block_identifier: BlockIdentifier
62
57
63
58
out : list [VaultInfo ] = []
64
59
for vault in response :
65
- out .append (
66
- VaultInfo (
67
- vault = vault .vault ,
68
- aggregated_balance = vault .aggregateBalance ,
69
- in_out_delta = vault .inOutDelta ,
70
- withdrawal_credentials = Web3 .to_hex (vault .withdrawalCredentials ),
71
- liability_shares = vault .liabilityShares ,
72
- max_liability_shares = vault .maxLiabilityShares ,
73
- mintable_st_eth = vault .mintableStETH ,
74
- share_limit = vault .shareLimit ,
75
- reserve_ratio_bp = vault .reserveRatioBP ,
76
- forced_rebalance_threshold_bp = vault .forcedRebalanceThresholdBP ,
77
- infra_fee_bp = vault .infraFeeBP ,
78
- liquidity_fee_bp = vault .liquidityFeeBP ,
79
- reservation_fee_bp = vault .reservationFeeBP ,
80
- pending_disconnect = vault .pendingDisconnect ,
81
- )
82
- )
83
-
84
- logger .info (
85
- {
86
- 'msg' : f'Call `batchVaultsInfo({ offset } , { limit } ).' ,
87
- 'value' : response ,
88
- 'block_identifier' : repr (block_identifier ),
89
- 'to' : self .address ,
90
- }
91
- )
60
+ out .append (VaultInfo (
61
+ vault = vault .vault ,
62
+ aggregated_balance = vault .aggregateBalance ,
63
+ in_out_delta = vault .inOutDelta ,
64
+ withdrawal_credentials = Web3 .to_hex (vault .withdrawalCredentials ),
65
+ liability_shares = vault .liabilityShares ,
66
+ max_liability_shares = vault .maxLiabilityShares ,
67
+ mintable_st_eth = vault .mintableStETH ,
68
+ share_limit = vault .shareLimit ,
69
+ reserve_ratio_bp = vault .reserveRatioBP ,
70
+ forced_rebalance_threshold_bp = vault .forcedRebalanceThresholdBP ,
71
+ infra_fee_bp = vault .infraFeeBP ,
72
+ liquidity_fee_bp = vault .liquidityFeeBP ,
73
+ reservation_fee_bp = vault .reservationFeeBP ,
74
+ pending_disconnect = vault .pendingDisconnect ,
75
+ ))
76
+
77
+ logger .info ({
78
+ 'msg' : f'Call `batchVaultsInfo({ offset } , { limit } ).' ,
79
+ 'value' : response ,
80
+ 'block_identifier' : repr (block_identifier ),
81
+ 'to' : self .address ,
82
+ })
92
83
93
84
return out
94
85
@@ -126,14 +117,12 @@ def get_validator_stages(
126
117
batch = list (map (HexBytes , pubkeys [i : i + batch_size ]))
127
118
response = self .functions .batchValidatorStages (batch ).call (block_identifier = block_identifier )
128
119
129
- logger .debug (
130
- {
131
- 'msg' : 'Call `batchValidatorStages()`.' ,
132
- 'count' : len (batch ),
133
- 'block_identifier' : repr (block_identifier ),
134
- 'to' : self .address ,
135
- }
136
- )
120
+ logger .debug ({
121
+ 'msg' : 'Call `batchValidatorStages()`.' ,
122
+ 'count' : len (batch ),
123
+ 'block_identifier' : repr (block_identifier ),
124
+ 'to' : self .address ,
125
+ })
137
126
138
127
# Assume response is a list of ints corresponding to ValidatorStage enum values
139
128
for pubkey , stage in zip (batch , response ):
0 commit comments