xiaoyong931011
2023-07-18 8544aaaa58deeae1df8d5843e29ddf37e56d93de
src/main/java/cc/mrbird/febs/dapp/contract/andao/AndaoContractMain.java
@@ -160,7 +160,29 @@
            }catch (Exception exception) {
                exception.printStackTrace();
            }
        });
        },
                error -> System.out.println("onError: " + error),
                () -> System.out.println("onComplete will not be printed!")
        );
    }
    public void listenBettings(BigInteger startBlock){
        System.out.println("启动投注监听事件");
        // 指定密钥文件并进行账号和密码的验证
        Credentials credentials = Credentials.create(privateKey);
        Abi contract = Abi.load(contractAddr, getInstanceScope(), credentials, new DefaultGasProvider());
        EthFilter filter = getFilter(startBlock);
        contract.withdrawnEventFlowable(filter).subscribe(e->{
            try {
                // 更新区块编号 TODO
                redisService.set("BNB_BLOCK_NUMBER",e.log.getBlockNumber().intValue());
            }catch (Exception exception) {
                exception.printStackTrace();
            }
        },
                error -> System.out.println("onError: " + error),
                () -> System.out.println("onComplete will not be printed!")
        );
    }
    /**