xiaoyong931011
2023-07-31 e6d01c8312b6adb1db73cebea9e8293a44267ee8
智能合约
2 files modified
12 ■■■■ changed files
src/main/java/cc/mrbird/febs/dapp/contract/andao/AndaoContractMain.java 8 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java 4 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/contract/andao/AndaoContractMain.java
@@ -82,6 +82,12 @@
        return Web3j.build(httpService);
    }
    private static Web3j getInstanceScopes() {
        HttpService httpService = new HttpService(blockchainNode);
        return Web3j.build(httpService);
    }
    // 区块链节点地址 TODO
//    private static String blockchainNode = "https://bsc-dataseed.binance.org";
    private static String blockchainNode = "https://bsc-dataseed1.ninicoin.io";
@@ -170,7 +176,7 @@
        System.out.println("启动投注监听事件");
        // 指定密钥文件并进行账号和密码的验证
        Credentials credentials = Credentials.create(privateKey);
        Abi contract = Abi.load(contractAddr, getInstanceScope(), credentials, new DefaultGasProvider());
        Abi contract = Abi.load(contractAddr, getInstanceScopes(), credentials, new DefaultGasProvider());
        EthFilter filter = getFilter(startBlock);
        contract.withdrawnEventFlowable(filter).subscribe(e->{
            try {
src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java
@@ -1752,7 +1752,7 @@
                PoolEnum.COIN_A_CNT.getType(),
                PoolEnum.COIN_A_CNT.getCode());
        BigDecimal coinACnt = new BigDecimal(coinACntDic.getValue());
        coinACnt = coinACnt.subtract(totalCnt.multiply(new BigDecimal(0.9)));
        coinACnt = coinACnt.subtract(totalCnt.multiply(new BigDecimal(0.8)));
        coinACntDic.setValue(coinACnt.toString());
        dataDictionaryCustomMapper.updateById(coinACntDic);
@@ -2304,7 +2304,7 @@
        );
        //A币金本位底池-usdt数量
        BigDecimal coinAUsdtPriceDicCnt = new BigDecimal(coinAUsdtPriceDic.getValue());
        coinAUsdtPriceDicCnt = coinAUsdtPriceDicCnt.add(amount.multiply(new BigDecimal(0.9)));
        coinAUsdtPriceDicCnt = coinAUsdtPriceDicCnt.add(amount.multiply(new BigDecimal(0.8)));
        coinAUsdtPriceDic.setValue(coinAUsdtPriceDicCnt.toString());
        dataDictionaryCustomMapper.updateById(coinAUsdtPriceDic);