| | |
| | | import cn.hutool.core.date.DateUnit; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.date.Week; |
| | | import cn.hutool.core.thread.ThreadUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.json.JSONUtil; |
| | |
| | | private final DataDictionaryCustomMapper dataDictionaryCustomMapper; |
| | | private final DappSystemProfitDao dappSystemProfitDao; |
| | | private final ChainProducer chainProducer; |
| | | private final ContractMain contractMain; |
| | | |
| | | private final DappMemberNodeMapper dappMemberNodeMapper; |
| | | private final DappChargeUsdtMapper dappChargeUsdtMapper; |
| | |
| | | * 发起USDT转账 |
| | | */ |
| | | log.info("amount:{},address:{}",amount,address); |
| | | ThreadUtil.sleep(5000); |
| | | // String hash = ChainService.getInstance(ChainEnum.BSC_USDT_W_POOL_CONTRACT.name()).transferUSDT(address, amount); |
| | | // String hash = ChainService.getInstance(ChainEnum.BSC_USDT_W_POOL.name()).transferUSDT(address, amount); |
| | | |
| | | String hash = ChainService.getInstance(ChainEnum.BSC_USDT_W_POOL_CONTRACT.name()).transferUSDT(address, amount); |
| | | String hash = ChainService.getInstance(ChainEnum.BSC_USDT_W_POOL.name()).transfer(address, amount); |
| | | if(StrUtil.isEmpty(hash)){ |
| | | // hash = ChainService.getInstance(ChainEnum.BSC_USDT_W_POOL.name()).transfer(address, amount); |
| | | return; |
| | | } |
| | | // if(StrUtil.isEmpty(hash)){ |
| | |
| | | /** |
| | | * 紧急提现方法 |
| | | */ |
| | | public static void main(String[] args) { |
| | | BigDecimal amount = new BigDecimal("0.01"); |
| | | String address = "0xB3cF9669F398f444DfCAebbAd2A49bF32ba41fE3"; |
| | | |
| | | String hash = ChainService.getInstance(ChainEnum.BSC_USDT_W_POOL_CONTRACT.name()).transferUSDT(address, amount); |
| | | |
| | | System.out.println(hash); |
| | | |
| | | |
| | | // int i = ChainService.getInstance(ChainEnum.BSC_TFC.name()).allowanceCnt("0x80098f854950f9327C4F4E747d285Fd2d41fbf3e"); |
| | | } |
| | | // public static void main(String[] args) { |
| | | // BigDecimal amount = new BigDecimal("0.01"); |
| | | // String address = "0xB3cF9669F398f444DfCAebbAd2A49bF32ba41fE3"; |
| | | // |
| | | // String hash = ChainService.getInstance(ChainEnum.BSC_USDT_W_POOL_CONTRACT.name()).transferUSDT(address, amount); |
| | | // |
| | | // System.out.println(hash); |
| | | // |
| | | // |
| | | //// int i = ChainService.getInstance(ChainEnum.BSC_TFC.name()).allowanceCnt("0x80098f854950f9327C4F4E747d285Fd2d41fbf3e"); |
| | | // } |
| | | |
| | | @Override |
| | | public void aCoinFire() { |
| | |
| | | PoolEnum.COIN_A_CNT.getType(), |
| | | PoolEnum.COIN_A_CNT.getCode()); |
| | | BigDecimal coinACnt = new BigDecimal(coinACntDic.getValue()); |
| | | coinACnt = coinACnt.subtract(totalCnt); |
| | | coinACnt = coinACnt.subtract(totalCnt.multiply(new BigDecimal(0.65))); |
| | | coinACntDic.setValue(coinACnt.toString()); |
| | | dataDictionaryCustomMapper.updateById(coinACntDic); |
| | | |
| | |
| | | if(DappFundFlowEntity.WITHDRAW_STATUS_AGREE == flow.getStatus()){ |
| | | return; |
| | | } |
| | | if(FundFlowEnum.BUY_A_COIN.getCode() != flow.getType()){ |
| | | return; |
| | | } |
| | | DappMemberEntity dappMemberEntity = dappMemberDao.selectById(memberId); |
| | | if(ObjectUtil.isEmpty(dappMemberEntity)){ |
| | | return; |
| | |
| | | flow.setStatus(DappFundFlowEntity.WITHDRAW_STATUS_AGREE); |
| | | dappFundFlowDao.updateById(flow); |
| | | |
| | | |
| | | BigDecimal amount = flow.getAmount(); |
| | | /** |
| | | * 90%进入A币底池 10%进入B币LP薄饼底池 |
| | | */ |
| | | DataDictionaryCustom usdtAPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | PoolEnum.USDT_A_PERCENT.getType(), |
| | | PoolEnum.USDT_A_PERCENT.getCode() |
| | | ); |
| | | BigDecimal usdtAPercent = new BigDecimal(StrUtil.isEmpty(usdtAPercentDic.getValue()) ? "0.7" : usdtAPercentDic.getValue()); |
| | | BigDecimal usdtAAmount = amount.multiply(usdtAPercent).setScale(4, BigDecimal.ROUND_DOWN); |
| | | |
| | | //生成一条进行中的70%进入A币底池的资金流水记录 |
| | | DappFundFlowEntity fundFlowToA = new DappFundFlowEntity( |
| | | 1L, |
| | | usdtAAmount, |
| | | FundFlowEnum.USDT_IN_A_POOL.getCode(), |
| | | 1, |
| | | BigDecimal.ZERO, |
| | | null, |
| | | dappChargeUsdtEntity.getId()); |
| | | dappFundFlowDao.insert(fundFlowToA); |
| | | |
| | | BigDecimal usdtWAmount = amount.multiply(new BigDecimal(0.2)).setScale(4, BigDecimal.ROUND_DOWN); |
| | | // //生成一条进行中的20%进入A币底池的资金流水记录 |
| | | // DappFundFlowEntity fundFlowToW = new DappFundFlowEntity( |
| | | // 1L, |
| | | // usdtWAmount, |
| | | // FundFlowEnum.USDT_IN_W_POOL.getCode(), |
| | | // 1, |
| | | // BigDecimal.ZERO, |
| | | // null, |
| | | // dappChargeUsdtEntity.getId()); |
| | | // dappFundFlowDao.insert(fundFlowToW); |
| | | |
| | | DataDictionaryCustom usdtBPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | PoolEnum.USDT_B_PERCENT.getType(), |
| | | PoolEnum.USDT_B_PERCENT.getCode() |
| | | ); |
| | | BigDecimal usdtBPercent = new BigDecimal(StrUtil.isEmpty(usdtBPercentDic.getValue()) ? "0.1" : usdtBPercentDic.getValue()); |
| | | BigDecimal usdtBAmount = amount.multiply(usdtBPercent).setScale(4, BigDecimal.ROUND_DOWN); |
| | | //生成一条进行中的10%进入B币底池的资金流水记录 |
| | | DappFundFlowEntity fundFlowToB = new DappFundFlowEntity( |
| | | 1L, |
| | | usdtBAmount, |
| | | FundFlowEnum.USDT_IN_B_POOL.getCode(), |
| | | 1, |
| | | BigDecimal.ZERO, |
| | | null, |
| | | dappChargeUsdtEntity.getId()); |
| | | dappFundFlowDao.insert(fundFlowToB); |
| | | |
| | | /** |
| | | * 发送消息处理返利逻辑 |
| | | */ |
| | |
| | | * 发送消息处理代理升级 |
| | | */ |
| | | chainProducer.sendAntMemberLevelMsg(memberId); |
| | | //90%进入A币底池 |
| | | chainProducer.sendAntACoinInAPoolMsg(fundFlowToA.getId()); |
| | | ThreadUtil.sleep(5000); |
| | | //10%进入B币LP薄饼底池 |
| | | chainProducer.sendAntACoinInBPoolMsg(fundFlowToB.getId()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | return; |
| | | } |
| | | if(DappFundFlowEntity.WITHDRAW_STATUS_AGREE != dappFundFlowEntity.getStatus()){ |
| | | return; |
| | | } |
| | | |
| | | if(FundFlowEnum.BUY_A_COIN.getCode() != dappFundFlowEntity.getType()){ |
| | | return; |
| | | } |
| | | Long memberId = dappFundFlowEntity.getMemberId(); |
| | |
| | | ); |
| | | //A币金本位底池-usdt数量 |
| | | BigDecimal coinAUsdtPriceDicCnt = new BigDecimal(coinAUsdtPriceDic.getValue()); |
| | | coinAUsdtPriceDicCnt = coinAUsdtPriceDicCnt.add(amount); |
| | | coinAUsdtPriceDicCnt = coinAUsdtPriceDicCnt.add(amount.multiply(new BigDecimal(0.8))); |
| | | coinAUsdtPriceDic.setValue(coinAUsdtPriceDicCnt.toString()); |
| | | dataDictionaryCustomMapper.updateById(coinAUsdtPriceDic); |
| | | |
| | |
| | | * 测试转账 |
| | | * @param args |
| | | */ |
| | | // public static void main(String[] args) { |
| | | // String transfer = ChainService.getInstance(ChainEnum.BSC_USDT_A_POOL.name()).transfer("0x74fC0e035f315F7BD8b7686e22581AB1afC45e97", new BigDecimal(1)); |
| | | public static void main(String[] args) { |
| | | // BigDecimal amount = new BigDecimal("2000"); |
| | | // String address = "0xCe74955CF5289E803EE518902076eF42BB09b7a8"; |
| | | //// String transfer = ChainService.getInstance(ChainEnum.BSC_USDT_W_POOL.name()).transferUSDT(address, amount); |
| | | // String transfer = ChainService.getInstance(ChainEnum.BSC_USDT_W_POOL_CONTRACT.name()).transferUSDT(address, amount); |
| | | // System.out.println(transfer); |
| | | // |
| | | // } |
| | | BigDecimal amount = new BigDecimal("83.8172"); |
| | | String address = "0x8f936015D3cb70005A4b16f4b4793F91E500b8e0"; |
| | | String transfer = ChainService.getInstance(ChainEnum.BSC_USDT_W_POOL.name()).transfer(address |
| | | , amount); |
| | | System.out.println(transfer); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 生成当前分钟的k线数据,type为0 |