import asyncio
import aiohttp
import time
import requests

bscscan_api_key = '<TRUFFLEHOG_REDACTED_BSCSCAN>'
semaphore = asyncio.Semaphore(1)

API_KEY = "<TRUFFLEHOG_REDACTED_BSCSCAN>"
BASE_URL = "https://api.bscscan.com/api"

REFERENCE_CONTRACT_ADDRESS = "0xEb275100cfe7B47bEAF38a2Dfef267B9006cA108"

async def get_latest_block_number():
    async with aiohttp.ClientSession() as session:
        url = f'https://api.bscscan.com/api?module=proxy&action=eth_blockNumber&apikey={bscscan_api_key}'
        async with session.get(url) as response:
            data = await response.json()
            return int(data['result'], 16)


async def get_external_transactions(block_number):
    async with semaphore:
        async with aiohttp.ClientSession() as session:
            url = f'https://api.bscscan.com/api?module=proxy&action=eth_getBlockByNumber&tag={block_number}&boolean=true&apikey={bscscan_api_key}'

            try:
                async with session.get(url) as response:
                    data = await response.json()
            except Exception as e:
                print(f'Error in API request: {e}')
                return []

            if data['result'] is None or isinstance(data['result'], str):
                print(f"Error: Cannot find the block")
                return []

            return data['result'].get('transactions', [])


async def get_contract_address(tx_hash):
    async with semaphore:
        async with aiohttp.ClientSession() as session:
            url = f'https://api.bscscan.com/api?module=proxy&action=eth_getTransactionReceipt&txhash={tx_hash}&apikey={bscscan_api_key}'

            try:
                async with session.get(url) as response:
                    data = await response.json()
            except Exception as e:
                print(f'Error in API request: {e}')
                return None

            if data['result'] is None or not isinstance(data['result'], dict):
                print(f"Error: Cannot find the address")
                return None

            return data['result'].get('contractAddress')


def check_method_id(input_data):
    method_id = input_data[:10]
    return method_id[-4:] == '6040'


async def process_block(block_number_int, contract_addresses):
    block_number = hex(block_number_int)
    transactions = await get_external_transactions(block_number)

    if not transactions:
        print(f'No transactions found in block {block_number_int}')
    else:
        for tx in transactions:
            if check_method_id(tx['input']):
                if tx['to'] is None:
                    contract_address = await get_contract_address(tx['hash'])
                    contract_addresses.append(contract_address)
         return contract_addresses


async def collect_contract_addresses(block_start, block_end):
    contract_addresses = []
    tasks = [process_block(block_number, contract_addresses) for block_number in range(block_start, block_end + 1)]
    await asyncio.gather(*tasks)
    return contract_addresses


async def main():
    contract_addresses = await collect_contract_addresses(block_start, block_end)
    return contract_addresses


def get_contract_source_code(address):
    params = {
        "module": "contract",
        "action": "getsourcecode",
        "address": address,
        "apiKey": API_KEY
    }

    response = requests.get(BASE_URL, params=params)
    data = response.json()

    if data["status"] == "1":
        return data["result"][0]["SourceCode"]
    else:
        return None


def find_similar_contracts(reference_address, candidate_addresses):
    reference_source_code = get_contract_source_code(reference_address)
    if reference_source_code is None:
        print(f"No source code found for reference contract: {reference_address}")
        return []

    similar_contracts = []
    for address in candidate_addresses:
        candidate_source_code = get_contract_source_code(address)
        if candidate_source_code is not None and candidate_source_code == reference_source_code:
            similar_contracts.append(address)

    return similar_contracts


if __name__ == "__main__":
    block_start = await get_latest_block_number()
    block_end = block_start + 10

    # Modify this line to receive contract_addresses from main function
    candidate_addresses = asyncio.run(main())

    # Use candidate_addresses in the find_similar_contracts function
    similar_contracts = find_similar_contracts(REFERENCE_CONTRACT_ADDRESS, candidate_addresses)
    print("Contracts with similar source code:")
    for address in similar_contracts:
        print(address)

The code above gives an error

C:\Users\AshotxXx\PycharmProjects\ByteCodes\FindAndMatchByteCode\venv\Scripts\python.exe C:\Users\AshotxXx\PycharmProjects\ByteCodes\FindAndMatchByteCode\main.py 
  File "C:\Users\AshotxXx\PycharmProjects\ByteCodes\FindAndMatchByteCode\main.py", line 77
    return contract_addresses
                             ^
IndentationError: unindent does not match any outer indentation level

Process finished with exit code 1

Fix it