gnosis/eth/ethereum_client.py
def batch_call_same_function(
        self,
        contract_function: ContractFunction,
        contract_addresses: Sequence[ChecksumAddress],
        from_address: Optional[ChecksumAddress] = None,
        raise_exception: bool = True,
        force_batch_call: bool = False,
        block_identifier: Optional[BlockIdentifier] = "latest",
    ) -> List[Optional[Any]]:
        """
        Call the same function in multiple contracts. Way more optimal than using `batch_call` generating multiple
        ``ContractFunction`` objects.

        :param contract_function:
        :param contract_addresses:
        :param from_address: Only available when ``Multicall`` is not used
        :param raise_exception: If ``True``, raise ``BatchCallException`` if one of the calls fails
        :param force_batch_call: If ``True``, ignore multicall and always use batch calls to get the
            result (less optimal). If ``False``, more optimal way will be tried.
        :param block_identifier:
        :return:
        :raises: BatchCallException
        """
        if self.multicall and not force_batch_call:  # Multicall is more optimal
            return [
                result.return_data_decoded
                for result in self.multicall.try_aggregate_same_function(
                    contract_function,
                    contract_addresses,
                    require_success=raise_exception,
                    block_identifier=block_identifier,
                )
            ]
        else:
            return self.batch_call_manager.batch_call_same_function(
                contract_function,
                contract_addresses,
                from_address=from_address,
                raise_exception=raise_exception,
                block_identifier=block_identifier,
            )

        Call the same function in multiple contracts. Way more optimal than using `batch_call` generating multiple
        ``ContractFunction`` objects.

        :param contract_function:
        :param contract_addresses:
        :param from_address: Only available when ``Multicall`` is not used
        :param raise_exception: If ``True``, raise ``BatchCallException`` if one of the calls fails
        :param force_batch_call: If ``True``, ignore multicall and always use batch calls to get the
            result (less optimal). If ``False``, more optimal way will be tried.
        :param block_identifier:
        :return:
        :raises: BatchCallException
        
Call the same function in multiple contracts.
Call the same function in multiple contracts .
def batch_call_same_function(
        self,
        contract_function: ContractFunction,
        contract_addresses: Sequence[ChecksumAddress],
        from_address: Optional[ChecksumAddress] = None,
        raise_exception: bool = True,
        force_batch_call: bool = False,
        block_identifier: Optional[BlockIdentifier] = "latest",
    ) -> List[Optional[Any]]:
        if self.multicall and not force_batch_call:  
            return [
                result.return_data_decoded
                for result in self.multicall.try_aggregate_same_function(
                    contract_function,
                    contract_addresses,
                    require_success=raise_exception,
                    block_identifier=block_identifier,
                )
            ]
        else:
            return self.batch_call_manager.batch_call_same_function(
                contract_function,
                contract_addresses,
                from_address=from_address,
                raise_exception=raise_exception,
                block_identifier=block_identifier,
            )
def batch_call_same_function ( self , contract_function : ContractFunction , contract_addresses : Sequence [ ChecksumAddress ] , from_address : Optional [ ChecksumAddress ] = None , raise_exception : bool = True , force_batch_call : bool = False , block_identifier : Optional [ BlockIdentifier ] = "latest" , ) -> List [ Optional [ Any ] ] : if self . multicall and not force_batch_call : return [ result . return_data_decoded for result in self . multicall . try_aggregate_same_function ( contract_function , contract_addresses , require_success = raise_exception , block_identifier = block_identifier , ) ] else : return self . batch_call_manager . batch_call_same_function ( contract_function , contract_addresses , from_address = from_address , raise_exception = raise_exception , block_identifier = block_identifier , )
Call the same function in multiple contracts.
Call the same function in multiple contracts .
"""
        Call the same function in multiple contracts. Way more optimal than using `batch_call` generating multiple
        ``ContractFunction`` objects.

        :param contract_function:
        :param contract_addresses:
        :param from_address: Only available when ``Multicall`` is not used
        :param raise_exception: If ``True``, raise ``BatchCallException`` if one of the calls fails
        :param force_batch_call: If ``True``, ignore multicall and always use batch calls to get the
            result (less optimal). If ``False``, more optimal way will be tried.
        :param block_identifier:
        :return:
        :raises: BatchCallException
        """ # Multicall is more optimal
None
None
self
contract_function
ContractFunction
None
contract_addresses
Sequence[ChecksumAddress]
None
from_address
Optional[ChecksumAddress]
Only available when ``Multicall`` is not used
Only available when ` ` Multicall ` ` is not used
raise_exception
bool
If ``True``, raise ``BatchCallException`` if one of the calls fails
If ` ` True ` ` raise ` ` BatchCallException ` ` if one of the calls fails
force_batch_call
bool
If ``True``, ignore multicall and always use batch calls to get the
result (less optimal). If ``False``, more optimal way will be tried.
If ` ` True ` ` ignore multicall and always use batch calls to get the result ( less optimal ) . If ` ` False ` ` more optimal way will be tried .
block_identifier
Optional[BlockIdentifier]
None