gnosis/safe/safe_create2_tx.py
def _calculate_gas(owners: List[str], safe_setup_data: bytes, payment_token: str) -> int:
        """
        Calculate gas manually, based on tests of previosly deployed safes
        :param owners: Safe owners
        :param safe_setup_data: Data for proxy setup
        :param payment_token: If payment token, we will need more gas to transfer and maybe storage if first time
        :return: total gas needed for deployment
        """
        base_gas = 205000  # Transaction base gas

        # If we already have the token, we don't have to pay for storage, so it will be just 5K instead of 20K.
        # The other 1K is for overhead of making the call
        if payment_token != NULL_ADDRESS:
            payment_token_gas = 55000
        else:
            payment_token_gas = 0

        data_gas = 68 * len(safe_setup_data)  # Data gas
        gas_per_owner = 20000  # Magic number calculated by testing and averaging owners
        return base_gas + data_gas + payment_token_gas + len(owners) * gas_per_owner
def _calculate_gas(owners: List[str], safe_setup_data: bytes, payment_token: str) -> int:
        """
        Calculate gas manually, based on tests of previosly deployed safes
        :param owners: Safe owners
        :param safe_setup_data: Data for proxy setup
        :param payment_token: If payment token, we will need more gas to transfer and maybe storage if first time
        :return: total gas needed for deployment
        """
        base_gas = 205000  # Transaction base gas

        # If we already have the token, we don't have to pay for storage, so it will be just 5K instead of 20K.
        # The other 1K is for overhead of making the call
        if payment_token != NULL_ADDRESS:
            payment_token_gas = 55000
        else:
            payment_token_gas = 0

        data_gas = 68 * len(safe_setup_data)  # Data gas
        gas_per_owner = 20000  # Magic number calculated by testing and averaging owners
        return base_gas + data_gas + payment_token_gas + len(owners) * gas_per_owner
Calculate gas manually, based on tests of previosly deployed safes
        :param owners: Safe owners
        :param safe_setup_data: Data for proxy setup
        :param payment_token: If payment token, we will need more gas to transfer and maybe storage if first time
        :return: total gas needed for deployment