def _estimate_gas(self, initializer: bytes, salt_nonce: int,<EOL>payment_token: str, payment_receiver: str) -> int:
<EOL>gas: int = self.proxy_factory_contract.functions.createProxyWithNonce(self.master_copy_address,<EOL>initializer, salt_nonce).estimateGas()<EOL>payment: int = <NUM_LIT:1><EOL>if payment_token == NULL_ADDRESS:<EOL><INDENT>gas += self.w3.eth.estimateGas({'<STR_LIT:to>': payment_receiver, '<STR_LIT:value>': payment})<EOL><DEDENT>else:<EOL><INDENT>gas += <NUM_LIT><EOL><DEDENT>return gas<EOL>
Gas estimation done using web3 and calling the node
Payment cannot be estimated, as no ether is in the address. So we add some gas later.
:param initializer: Data initializer to send to GnosisSafe setup method
:param salt_nonce: Nonce that will be used to generate the salt to calculate
the address of the new proxy contract.
:return: Total gas estimation