diff --git a/src/common/contracts.py b/src/common/contracts.py index 11b8afcc..9cd0b86d 100644 --- a/src/common/contracts.py +++ b/src/common/contracts.py @@ -285,10 +285,10 @@ class MulticallContract(ContractWrapper): async def aggregate( self, - data: list[tuple[ChecksumAddress, bool, HexStr]], + data: list[tuple[ChecksumAddress, HexStr]], block_number: BlockNumber | None = None, - ) -> list: - return await self.contract.functions.aggregate3(data).call(block_identifier=block_number) + ) -> tuple[BlockNumber, list]: + return await self.contract.functions.aggregate(data).call(block_identifier=block_number) @functools.cache diff --git a/src/common/execution.py b/src/common/execution.py index 1e712e42..96c56af4 100644 --- a/src/common/execution.py +++ b/src/common/execution.py @@ -82,15 +82,15 @@ async def update_oracles_cache() -> None: rewards_threshold_call = keeper_contract.encode_abi(fn_name='rewardsMinOracles', args=[]) validators_threshold_call = keeper_contract.encode_abi(fn_name='validatorsMinOracles', args=[]) - multicall_response = await multicall_contract.aggregate( + _, multicall_response = await multicall_contract.aggregate( [ - (keeper_contract.address, False, rewards_threshold_call), - (keeper_contract.address, False, validators_threshold_call), + (keeper_contract.address, rewards_threshold_call), + (keeper_contract.address, validators_threshold_call), ], block_number=to_block, ) - rewards_threshold = Web3.to_int(multicall_response[0][1]) - validators_threshold = Web3.to_int(multicall_response[1][1]) + rewards_threshold = Web3.to_int(multicall_response[0]) + validators_threshold = Web3.to_int(multicall_response[1]) app_state.oracles_cache = OraclesCache( config=config, diff --git a/src/validators/execution.py b/src/validators/execution.py index 1d0dc809..47d65c28 100644 --- a/src/validators/execution.py +++ b/src/validators/execution.py @@ -7,7 +7,11 @@ from web3 import Web3 from web3.types import EventData, Wei -from src.common.contracts import validators_registry_contract, vault_contract +from src.common.contracts import ( + multicall_contract, + validators_registry_contract, + vault_contract, +) from src.common.metrics import metrics from src.common.typings import HarvestParams from src.common.vault import Vault @@ -108,7 +112,8 @@ async def get_withdrawable_assets(harvest_params: HarvestParams | None) -> Wei: calls = await get_update_state_calls(harvest_params) withdrawable_assets_call = vault_contract.encode_abi(fn_name='withdrawableAssets', args=[]) calls.append((vault_contract.address, withdrawable_assets_call)) - multicall = await vault_contract.functions.multicall(calls).call() + + _, multicall = await multicall_contract.aggregate(calls) after_update_assets = Web3.to_int(multicall[-1]) before_update_validators = before_update_assets // DEPOSIT_AMOUNT