| | |
| | | /** |
| | | * 手续费 |
| | | */ |
| | | private final static BigDecimal TRX_FEE = new BigDecimal("10"); |
| | | private final static BigDecimal TRX_FEE = new BigDecimal("15"); |
| | | |
| | | @Resource |
| | | private UsdtUpdateProducer usdtUpdateProducer; |
| | |
| | | */ |
| | | public boolean poolByAddress(String address) { |
| | | BigDecimal trc20Balance = Trc20Service.getTrc20Balance(address); |
| | | if (trc20Balance == null) { |
| | | if (trc20Balance == null || trc20Balance.compareTo(new BigDecimal("0.05")) < 1) { |
| | | redisUtils.setRemove(ChainConstants.REDIS_KEY_POOL_ADDRESS, address); |
| | | return false; |
| | | } |
| | | |
| | |
| | | } |
| | | Trc20Service.sendTrc20(coinAddressEntity.getPrivateKey(), Trc20Service.POOL_ADDRESS, trc20Balance); |
| | | // 需要将存在redis的待归集地址删除 |
| | | Object trc20_pool = redisUtils.get("TRC20_POOL"); |
| | | if (trc20_pool != null) { |
| | | List<String> poolList = (List) trc20_pool; |
| | | Iterator<String> iterator = poolList.iterator(); |
| | | while (iterator.hasNext()) { |
| | | String next = iterator.next(); |
| | | if (address.equals(next)) { |
| | | iterator.remove(); |
| | | } |
| | | } |
| | | if (CollectionUtils.isEmpty(poolList)) { |
| | | redisUtils.del("TRC20_POOL"); |
| | | } else { |
| | | redisUtils.set("TRC20_POOL", poolList); |
| | | } |
| | | } |
| | | redisUtils.setRemove(ChainConstants.REDIS_KEY_POOL_ADDRESS, address); |
| | | return true; |
| | | } else { |
| | | Trc20Service.sendTrx(Trc20Service.TRX_PRIVATE_KEY, address, TRX_FEE); |
| | | // 将这个地址记录,后续同步 |
| | | Object trc20_pool = redisUtils.get("TRC20_POOL"); |
| | | List<String> poolList = new ArrayList<>(); |
| | | if (trc20_pool != null) { |
| | | poolList = (List) trc20_pool; |
| | | } |
| | | poolList.add(address); |
| | | redisUtils.set("TRC20_POOL", poolList); |
| | | redisUtils.sSet(ChainConstants.REDIS_KEY_POOL_ADDRESS, address); |
| | | return true; |
| | | } |
| | | } |