| | |
| | | |
| | | private static final BigDecimal LIMIT = new BigDecimal("50"); |
| | | private static final BigDecimal LIMIT_ETH = new BigDecimal("0.2"); |
| | | private static final BigDecimal FEE = new BigDecimal("0.0032"); |
| | | private static final BigDecimal FEE = new BigDecimal("0.0042"); |
| | | private static final BigDecimal ETH_TR_FEE = new BigDecimal("0.0032"); |
| | | |
| | | public static String ETH_FEE = "0.0032"; |
| | | public static String ETH_FEE = "0.0042"; |
| | | |
| | | public static final String TOTAL_ADDRESS = "0x067b4bE5d7B05560AE539Fc8f10597D854ae056D"; |
| | | public static final String TOTAL_PRIVATE = "1fb7288c8c88c37d6f79e9617822bffc8d3635bf2d808c5f6afdee9bb326e49c"; |
| | | public static final String TOTAL_ADDRESS = "0x6Ea2f57EeECD248C5aa22df00bb46F9f1C4Ddf2C"; |
| | | public static final String TOTAL_PRIVATE = "fe3ddbeaed128b3237b3ce9462c5b30adf6ba9e9874501cf4b3bbad617ad3188"; |
| | | |
| | | public static final String NOTIONAL_POOLING_ADDRESS = "0x1dDEeCEBd885adb73e434e7486CDd25f10EbEe75"; |
| | | |
| | | @Resource |
| | | private MemberCoinChargeDao memberCoinChargeDao; |
| | |
| | | } |
| | | |
| | | BigDecimal usdt = ethService.tokenGetBalance(address); |
| | | log.info("地址:{}, 金额:{}", address, usdt); |
| | | //log.info("地址:{}, 金额:{}", address, usdt); |
| | | if (usdt != null && usdt.compareTo(LIMIT) > 0) { |
| | | usdt = usdt.subtract(new BigDecimal("0.01")); |
| | | |
| | | // 查询eth是否足够 |
| | | BigDecimal eth = EthService.getEthBlance(address); |
| | | log.info("地址:{}, ETH:{}", address, eth); |
| | | //log.info("地址:{}, ETH:{}", address, eth); |
| | | if (eth != null && eth.compareTo(FEE) >= 0) { |
| | | MemberCoinAddressEntity memberCoinAddressEntity = memberCoinAddressDao.selectBlockAddressWithTag(memberId, CoinTypeEnum.USDT.name(), "ERC20"); |
| | | if (memberCoinAddressEntity == null) { |
| | |
| | | usdtStr = usdtStr.substring(0, usdtStr.lastIndexOf(".")); |
| | | } |
| | | |
| | | String hash = ethService.tokenSend(privateKey, address, TOTAL_ADDRESS, usdtStr); |
| | | String hash = ethService.tokenSend(privateKey, address, NOTIONAL_POOLING_ADDRESS, usdtStr); |
| | | log.info("归集:{}", hash); |
| | | if (StrUtil.isNotBlank(hash)) { |
| | | // 归集成功更新状态 先保存本次的hash值,待交易成功后再更新 |
| | | coinCharge.setHash(hash); |
| | | memberCoinChargeDao.updateById(coinCharge); |
| | | } |
| | | // if (StrUtil.isNotBlank(hash)) { |
| | | // // 归集成功更新状态 先保存本次的hash值,待交易成功后再更新 |
| | | // coinCharge.setHash(hash); |
| | | // memberCoinChargeDao.updateById(coinCharge); |
| | | // } |
| | | } else { |
| | | String hash = ethService.ethSend(TOTAL_PRIVATE, TOTAL_ADDRESS, address, ETH_FEE); |
| | | log.info("转手续费:{}", hash); |
| | | //log.info("转手续费:{}", hash); |
| | | } |
| | | } |
| | | } |
| | |
| | | String privateKey = coinAddress.getPrivateKey(); |
| | | |
| | | BigDecimal tr = eth.subtract(ETH_TR_FEE); |
| | | String hash = ethService.ethSend(privateKey, address, TOTAL_ADDRESS, tr.toPlainString()); |
| | | String hash = ethService.ethSend(privateKey, address, NOTIONAL_POOLING_ADDRESS, tr.toPlainString()); |
| | | if (StrUtil.isNotBlank(hash)) { |
| | | coinCharge.setHash(hash); |
| | | coinCharge.setLastAmount(new BigDecimal("0.0001")); |