Untitled

                Never    
def deposit(w3, account, amount_in, token_address=GETH_TOKEN, gas_price=10 * 10 ** 9, gas_limit=200000, retry=5):
    approve(w3, account, amount_in, token_address)
    currency = 'GETH'
    if token_address == GASP_TOKEN:
        currency = 'GASP'
    exception = None
    started = time()
    for i in range(retry):
        try:
            contract = w3.eth.contract(w3.to_checksum_address(GASP_ADDRESS), abi=GASP_ABI)
            amount = w3.to_wei(amount_in, "ether")
            ts_params = {
                'from': account.address,
                'gasPrice': gas_price,
                'gas': gas_limit,
                'chainId': CHAIN_ID,
                'nonce': w3.eth.get_transaction_count(account.address),
            }
            tx = contract.functions.deposit(w3.to_checksum_address(token_address), amount).build_transaction(ts_params)
            raw_transaction = account.sign_transaction(tx).rawTransaction
            tx_hash = w3.eth.send_raw_transaction(raw_transaction)
            rp_tx = w3.eth.wait_for_transaction_receipt(tx_hash)
            if 'effectiveGasPrice' in rp_tx.keys():
                effectiveGasPrice = rp_tx['effectiveGasPrice']
                used_gas = w3.from_wei(rp_tx['gasUsed'], 'ether')
                transaction_fee = used_gas * effectiveGasPrice
            else:
                transaction_fee = 0
            print(
                f"{get_status(rp_tx['status'])}: {currency} DEPOSIT RETRY={i} from {account.address} {amount_in}"
                f" : tx hash: {tx_hash.hex()}, tx_fee:{transaction_fee} elapsed: {time() - started} sec")
            if rp_tx['status'] == 0:
                continue
            return
        except Exception as e:
            if 'insufficient funds for gas * price + value' in str(e):
                print(f'FAILED: DEPOSIT: from {account.address} {amount_in}:'
                      f' insufficient funds for gas * price + value, elapsed: {time() - started} sec')
                return e
            exception = e
            sleep(5)
            continue
    print(
        f'{currency} DEPOSIT FAILED WITH {retry} RETRIES from {account.address} {amount_in}'
        f' : {exception} elapsed: {time() - started} sec')

Raw Text