gnosis/safe/safe_service.py
def deploy_master_contract(self, deployer_account=None, deployer_private_key=None) -> str:
        """
        Deploy master contract. Takes deployer_account (if unlocked in the node) or the deployer private key
        :param deployer_account: Unlocked ethereum account
        :param deployer_private_key: Private key of an ethereum account
        :return: deployed contract address
        """
        assert deployer_account or deployer_private_key
        deployer_address = deployer_account or self.ethereum_client.private_key_to_address(deployer_private_key)

        safe_contract = self.get_contract()
        tx = safe_contract.constructor().buildTransaction({'from': deployer_address})
        tx_hash = self.ethereum_client.send_unsigned_transaction(tx, private_key=deployer_private_key,
                                                                  public_key=deployer_account)

        tx_receipt = self.ethereum_client.get_transaction_receipt(tx_hash, timeout=60)
        assert tx_receipt.status

        contract_address = tx_receipt.contractAddress

        # Init master copy
        master_safe = self.get_contract(contract_address)
        tx = master_safe.functions.setup(
            # We use 2 owners that nobody controls for the master copy
            ["0x0000000000000000000000000000000000000002", "0x0000000000000000000000000000000000000003"],
            2,             # Threshold. Maximum security
            NULL_ADDRESS,  # Address for optional DELEGATE CALL
            b'',           # Data for optional DELEGATE CALL
            NULL_ADDRESS,  # Payment token
            0,             # Payment
            NULL_ADDRESS   # Refund receiver
        ).buildTransaction({'from': deployer_address})

        tx_hash = self.ethereum_client.send_unsigned_transaction(tx, private_key=deployer_private_key,
                                                                  public_key=deployer_account)

        tx_receipt = self.ethereum_client.get_transaction_receipt(tx_hash, timeout=60)
        assert tx_receipt.status

        logger.info("Deployed and initialized Safe Master Contract=%s by %s", contract_address, deployer_address)
        return contract_address
def deploy_master_contract(self, deployer_account=None, deployer_private_key=None) -> str:
        """
        Deploy master contract. Takes deployer_account (if unlocked in the node) or the deployer private key
        :param deployer_account: Unlocked ethereum account
        :param deployer_private_key: Private key of an ethereum account
        :return: deployed contract address
        """
        assert deployer_account or deployer_private_key
        deployer_address = deployer_account or self.ethereum_client.private_key_to_address(deployer_private_key)

        safe_contract = self.get_contract()
        tx = safe_contract.constructor().buildTransaction({'from': deployer_address})
        tx_hash = self.ethereum_client.send_unsigned_transaction(tx, private_key=deployer_private_key,
                                                                  public_key=deployer_account)

        tx_receipt = self.ethereum_client.get_transaction_receipt(tx_hash, timeout=60)
        assert tx_receipt.status

        contract_address = tx_receipt.contractAddress

        # Init master copy
        master_safe = self.get_contract(contract_address)
        tx = master_safe.functions.setup(
            # We use 2 owners that nobody controls for the master copy
            ["0x0000000000000000000000000000000000000002", "0x0000000000000000000000000000000000000003"],
            2,             # Threshold. Maximum security
            NULL_ADDRESS,  # Address for optional DELEGATE CALL
            b'',           # Data for optional DELEGATE CALL
            NULL_ADDRESS,  # Payment token
            0,             # Payment
            NULL_ADDRESS   # Refund receiver
        ).buildTransaction({'from': deployer_address})

        tx_hash = self.ethereum_client.send_unsigned_transaction(tx, private_key=deployer_private_key,
                                                                  public_key=deployer_account)

        tx_receipt = self.ethereum_client.get_transaction_receipt(tx_hash, timeout=60)
        assert tx_receipt.status

        logger.info("Deployed and initialized Safe Master Contract=%s by %s", contract_address, deployer_address)
        return contract_address
Deploy master contract. Takes deployer_account (if unlocked in the node) or the deployer private key
        :param deployer_account: Unlocked ethereum account
        :param deployer_private_key: Private key of an ethereum account
        :return: deployed contract address