diff --git a/sw_utils/protocol_config.py b/sw_utils/protocol_config.py index 6205abf..cab2acb 100644 --- a/sw_utils/protocol_config.py +++ b/sw_utils/protocol_config.py @@ -1,3 +1,4 @@ +from web3 import Web3 from web3.types import Wei from sw_utils.typings import Oracle, ProtocolConfig @@ -31,6 +32,9 @@ def build_protocol_config( raise ValueError('Invalid exit signature threshold') vault_exiting_validators_limit_bps = config_data.get('vault_exiting_validators_limit_bps') or 0 + os_token_vaults = [ + Web3.to_checksum_address(v) for v in config_data.get('os_token_vaults') or [] + ] return ProtocolConfig( oracles=oracles, @@ -48,4 +52,5 @@ def build_protocol_config( signature_validity_period=config_data['signature_validity_period'], until_force_exit_epochs=config_data['until_force_exit_epochs'], vault_exiting_validators_limit_bps=vault_exiting_validators_limit_bps, + os_token_vaults=os_token_vaults, ) diff --git a/sw_utils/tests/factories.py b/sw_utils/tests/factories.py index a2d7693..774573e 100644 --- a/sw_utils/tests/factories.py +++ b/sw_utils/tests/factories.py @@ -48,7 +48,7 @@ def wei_amount(self, start: int = 10, stop: int = 1000) -> Wei: faker.add_provider(Web3Provider) -# pylint: disable=too-many-arguments +# pylint: disable=too-many-arguments, too-many-positional-arguments, too-many-locals def get_mocked_protocol_config( oracles: list[Oracle] | None = None, oracles_count: int = 1, @@ -64,6 +64,8 @@ def get_mocked_protocol_config( inactive_validator_balance: Wei = Web3.to_wei(31.75, 'ether'), validator_min_active_epochs: int = 2250, # 10 days vault_fee_max_bps: int = 1500, # 15% + vault_exiting_validators_limit_bps: int = 0, + os_token_vaults: list[str] | None = None, ) -> ProtocolConfig: return ProtocolConfig( oracles=oracles @@ -89,4 +91,6 @@ def get_mocked_protocol_config( until_force_exit_epochs=until_force_exit_epochs, rewards_threshold=rewards_threshold, validators_threshold=validators_threshold, + vault_exiting_validators_limit_bps=vault_exiting_validators_limit_bps, + os_token_vaults=os_token_vaults or [], ) diff --git a/sw_utils/typings.py b/sw_utils/typings.py index 7f5ed64..5b30a0a 100644 --- a/sw_utils/typings.py +++ b/sw_utils/typings.py @@ -65,9 +65,12 @@ class ProtocolConfig: exit_signature_recover_threshold: int - # max exiting validators bps for genesis vault - # zero value means limit is not set - vault_exiting_validators_limit_bps: int = 0 + # Max exiting validators bps for genesis vault. + # Zero value means limit is not set. + vault_exiting_validators_limit_bps: int + + # List of vaults used to determine osToken reward rate + os_token_vaults: list[ChecksumAddress] # Keeper settings validators_threshold: int = 0