| | |
| | | DappMemberEntity member = LoginUserUtil.getAppUser(); |
| | | |
| | | SystemDto system = new SystemDto(); |
| | | String hasStart = redisUtils.getString(AppContants.SYSTEM_START_FLAG); |
| | | // 启动未启动 |
| | | if (!"start".equals(hasStart)) { |
| | | system.setFeeRatio(new BigDecimal("7")); |
| | | system.setBuyFeeRatio(new BigDecimal("3")); |
| | | system.setUsdtRemain(BigDecimal.ZERO); |
| | | system.setUsdtTotal(BigDecimal.ZERO); |
| | | system.setSaleRemain(BigDecimal.ZERO); |
| | | system.setSaleTotal(BigDecimal.ZERO); |
| | | Object makePoolObj = redisUtils.get(AppContants.REDIS_KEY_MAKE_POOL_CNT); |
| | | BigDecimal balance; |
| | | if (makePoolObj == null) { |
| | | balance = ChainService.getInstance(ChainEnum.BSC_TFC.name()).balanceOf(ChainEnum.BSC_TFC.getAddress()); |
| | | redisUtils.set(AppContants.REDIS_KEY_MAKE_POOL_CNT, balance); |
| | | } else { |
| | | balance = (BigDecimal) makePoolObj; |
| | | } |
| | | system.setBuyRemain(balance); |
| | | system.setBuyTotal(balance); |
| | | |
| | | |
| | | Object maxDailyBuy = redisUtils.get(AppContants.REDIS_KEY_IDO_USDT_MAX_BUY_DAILY + member.getAddress()); |
| | | if (maxDailyBuy == null) { |
| | | DateTime tomorrow = DateUtil.beginOfDay(DateUtil.tomorrow()); |
| | | long time = DateUtil.between(new Date(), tomorrow, DateUnit.SECOND, true); |
| | | |
| | | redisUtils.set(AppContants.REDIS_KEY_IDO_USDT_MAX_BUY_DAILY + member.getAddress(), new BigDecimal("1000"), time); |
| | | } |
| | | |
| | | return system; |
| | | } |
| | | |
| | | RedisTransferPoolVo transferPool = (RedisTransferPoolVo) redisUtils.get(AppContants.REDIS_KEY_TRANSFER_POOL_VOL); |
| | | BigDecimal poolRemain = (BigDecimal) redisUtils.get(AppContants.REDIS_KEY_TRANSFER_POOL_VOL_REMAIN); |
| | | // 买币数量 |
| | | system.setBuyTotal(transferPool.getTodayVol()); |
| | | system.setBuyRemain(poolRemain); |
| | | |
| | | ContractChainService instance = ChainService.getInstance(ChainEnum.BSC_TFC.name()); |
| | | BigDecimal balance = instance.balanceOf(member.getAddress()); |
| | | |
| | | Object o = redisUtils.get(AppContants.REDIS_KEY_COIN_REMAIN + member.getAddress()); |
| | | |
| | | BigDecimal minLimit = new BigDecimal(50); |
| | | BigDecimal coinTotal; |
| | | if (balance.compareTo(minLimit) > 0) { |
| | | coinTotal = balance.multiply(BigDecimal.valueOf(0.3)).setScale(instance.decimals(), RoundingMode.HALF_DOWN); |
| | | } else { |
| | | coinTotal = new BigDecimal(50); |
| | | } |
| | | |
| | | BigDecimal remain; |
| | | if (o == null) { |
| | | DateTime tomorrow = DateUtil.beginOfDay(DateUtil.tomorrow()); |
| | | long time = DateUtil.between(new Date(), tomorrow, DateUnit.SECOND, true); |
| | | |
| | | remain = coinTotal; |
| | | redisUtils.set(AppContants.REDIS_KEY_COIN_REMAIN + member.getAddress(), remain, time); |
| | | } else { |
| | | remain = (BigDecimal) o; |
| | | } |
| | | // 卖币数量 |
| | | system.setSaleTotal(coinTotal); |
| | | system.setSaleRemain(remain); |
| | | |
| | | BigDecimal usdtRemain = (BigDecimal) redisUtils.get(AppContants.REDIS_KEY_USDT_OUT_LIMIT_REMAIN); |
| | | BigDecimal usdtTotal = (BigDecimal) redisUtils.get(AppContants.REDIS_KEY_USDT_OUT_LIMIT); |
| | | |
| | | // usdt数量 |
| | | system.setUsdtTotal(usdtTotal); |
| | | system.setUsdtRemain(usdtRemain); |
| | | |
| | | system.setFeeRatio(new BigDecimal("7")); |
| | | system.setBuyFeeRatio(new BigDecimal("3")); |
| | | system.setBuyAmount(new BigDecimal("100")); |
| | | return system; |
| | | } |
| | | |