4 files modified
1 files added
| | |
| | | ""), |
| | | |
| | | /** |
| | | * 卡牌 |
| | | */ |
| | | BSC_NFT_SDC("BSC", "0x3afD1Bf0994214DBe5ccfA7d8643261B195532c2", |
| | | "0x07ee6de0ca4b289f8e69484f70d09988c6df6697f411dc623179930a3578994f", |
| | | "https://bsc-dataseed1.ninicoin.io", |
| | | "0xb7FDE337f2236F78B2823d9F97eAB03ce893CC3D", |
| | | ""), |
| | | |
| | | /** |
| | | * 币安 usdt合约 |
| | | * 0x55d398326f99059fF775485246999027B3197955 |
| | | * 测试链 0x337610d27c682E347C9cD60BD4b3b107C9d34dDd |
| | |
| | | "0x7bee8cf9441800655376ba95729c0807231367cf75702dd3b17fa5290196bb87", |
| | | "https://bsc-dataseed1.ninicoin.io", |
| | | "0xb27e44f98543e480dbd071b6605005e3d99b3dd4", |
| | | ""), |
| | | |
| | | /** |
| | | * 多余手续费收集地址 |
| | | */ |
| | | BSC_TFC_FEE("BSC", "0x8084Cf691B69c70De8A7c345E63CaA740B730FA5", |
| | | "0x7bee8cf9441800655376ba95729c0807231367cf75702dd3b17fa5290196bb87", |
| | | "https://bsc-dataseed1.ninicoin.io", |
| | | "0xb27e44f98543e480dbd071b6605005e3d99b3dd4", |
| | | ""); |
| | | |
| | | |
| | | private String chain; |
| | | |
| | | private String address; |
| | |
| | | import cc.mrbird.febs.rabbit.producer.ChainProducer; |
| | | import cc.mrbird.febs.tree.MatrixTree; |
| | | import cc.mrbird.febs.tree.MemberNode; |
| | | import cc.mrbird.febs.tree.TreeConstants; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.date.DateUnit; |
| | | import cn.hutool.core.date.DateUtil; |
| | |
| | | |
| | | /** |
| | | * 复投后,推一个拿一轮,推两个拿两轮,推三个后终身有效。 |
| | | * 按规则每轮未能提取的奖金分配: |
| | | * 50%直接进入TFC底池 |
| | | * 20%给到推荐人 |
| | | * 30%留下待提。 |
| | | * 200u单。 |
| | | * 无直推则收益200U |
| | | * 一人加一轮400u,二人二轮 |
| | | * 三人永久。 |
| | | */ |
| | | if (directCnt.size() < 3 && member.getOutCnt() != 0 && member.getOutCnt() - 1 == directCnt.size()) { |
| | | BigDecimal amount = new BigDecimal("190"); |
| | | |
| | | BigDecimal sourcePool = amount.multiply(new BigDecimal("0.5")); |
| | | BigDecimal directAmount = amount.multiply(new BigDecimal("0.2")); |
| | | |
| | | BigDecimal remain = amount.subtract(sourcePool).subtract(directAmount); |
| | | |
| | | new Thread(() -> { |
| | | ChainService.getInstance(ChainEnum.BSC_USDT.name()).transfer("0xb06cc3dAF362a1670F12eBD0242022b538Ca72ef", sourcePool); |
| | | }).start(); |
| | | |
| | | if (parent != null) { |
| | | dappWalletService.updateWalletCoinWithLock(directAmount, parent.getId(), 1); |
| | | |
| | | DappFundFlowEntity direct = new DappFundFlowEntity(parent.getId(), directAmount, 3, 2, null, null); |
| | | dappFundFlowDao.insert(direct); |
| | | return; |
| | | } else { |
| | | BigDecimal amount = null; |
| | | if (directCnt.size() < 1) { |
| | | amount = TreeConstants.PUT_IN_AMOUNT; |
| | | } else { |
| | | amount = TreeConstants.FULL_PROFIT_AMOUNT; |
| | | } |
| | | |
| | | dappWalletService.addFrozenAmountWithLock(remain, memberId); |
| | | } else { |
| | | dappWalletService.releaseFrozenAmountWithLock(memberId); |
| | | |
| | | member.setOutCnt(member.getOutCnt() + 1); |
| | | dappMemberDao.updateById(member); |
| | | |
| | | dappWalletService.updateWalletCoinWithLock(new BigDecimal(190), member.getId(), 1); |
| | | dappWalletService.updateWalletCoinWithLock(amount, member.getId(), 1); |
| | | |
| | | DappFundFlowEntity matrixProfitFlow = new DappFundFlowEntity(memberId, new BigDecimal("190"), 2, 2, null, null); |
| | | DappFundFlowEntity matrixProfitFlow = new DappFundFlowEntity(memberId, amount, 2, 2, null, null); |
| | | dappFundFlowDao.insert(matrixProfitFlow); |
| | | } |
| | | |
| | | DappFundFlowEntity rePutInFlow = new DappFundFlowEntity(memberId, new BigDecimal("100").negate(), 1, 2, null, null); |
| | | DappFundFlowEntity rePutInFlow = new DappFundFlowEntity(memberId, TreeConstants.PUT_IN_AMOUNT.negate(), 1, 2, null, null); |
| | | dappFundFlowDao.insert(rePutInFlow); |
| | | |
| | | DappFundFlowEntity safePoolFlow = new DappFundFlowEntity(memberId, new BigDecimal("10").negate(), 4, 2, null, null); |
| | | dappFundFlowDao.insert(safePoolFlow); |
| | | |
| | | DappMineDataEntity mineData = dappSystemDao.selectMineDataForOne(); |
| | | mineData.setSafePool(mineData.getSafePool().add(BigDecimal.TEN)); |
| | | dappSystemDao.updateMineData(mineData); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void tfcNewPrice(String data) { |
| | | redisUtils.set(AppContants.REDIS_KEY_TFC_NEW_PRICE, new BigDecimal(data)); |
| | | // redisUtils.set(AppContants.REDIS_KEY_TFC_NEW_PRICE, new BigDecimal(data)); |
| | | } |
| | | |
| | | @Override |
| | |
| | | DappFundFlowEntity feeFlow = new DappFundFlowEntity(member.getId(), withdrawDto.getFee().negate(), 7, 2, null, null); |
| | | dappFundFlowDao.insert(feeFlow); |
| | | |
| | | DappFundFlowEntity fundFlow = new DappFundFlowEntity(member.getId(), withdrawDto.getAmount().negate(), 5, 2, withdrawDto.getFee(), null); |
| | | DappFundFlowEntity fundFlow = new DappFundFlowEntity(member.getId(), withdrawDto.getAmount().negate(), 5, 1, withdrawDto.getFee(), null); |
| | | dappFundFlowDao.insert(fundFlow); |
| | | |
| | | String hash = ChainService.getInstance(ChainEnum.BSC_USDT.name()).transfer(member.getAddress(), withdrawDto.getAmount()); |
| | | fundFlow.setToHash(hash); |
| | | dappFundFlowDao.updateById(fundFlow); |
| | | // String hash = ChainService.getInstance(ChainEnum.BSC_USDT.name()).transfer(member.getAddress(), withdrawDto.getAmount()); |
| | | // fundFlow.setToHash(hash); |
| | | // dappFundFlowDao.updateById(fundFlow); |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("fee", withdrawDto.getFee()); |
| | | map.put("address", ChainEnum.BSC_TFC_FEE.getAddress()); |
| | | map.put("flow", feeFlow.getId()); |
| | | chainProducer.sendTfcFee(JSONObject.toJSONString(map)); |
| | | // Map<String, Object> map = new HashMap<>(); |
| | | // map.put("fee", withdrawDto.getFee()); |
| | | // map.put("address", ChainEnum.BSC_TFC_FEE.getAddress()); |
| | | // map.put("flow", feeFlow.getId()); |
| | | // chainProducer.sendTfcFee(JSONObject.toJSONString(map)); |
| | | } |
| | | |
| | | @Override |
| | |
| | | new Thread(() -> { |
| | | log.info("监听:[{} - {}]", finalBlock, end); |
| | | ChainService.contractEventListener(finalBlock, end, bscUsdtContractEvent, ChainEnum.BSC_USDT_LISTENER.name()); |
| | | ChainService.contractEventListener(finalBlock, end, bscCoinContractEvent, ChainEnum.BSC_TFC_FEE.name()); |
| | | ChainService.contractEventListener(finalBlock, end, bscCoinContractEvent, ChainEnum.BSC_TFC_LISTENER.name()); |
| | | }).start(); |
| | | |
| | | block = block.add(section); |
| | |
| | | } |
| | | } |
| | | ChainService.contractEventListener(block, bscUsdtContractEvent, ChainEnum.BSC_USDT_LISTENER.name()); |
| | | ChainService.contractEventListener(block, bscCoinContractEvent, ChainEnum.BSC_TFC_FEE.name()); |
| | | ChainService.contractEventListener(block, bscCoinContractEvent, ChainEnum.BSC_TFC_LISTENER.name()); |
| | | |
| | | long end = System.currentTimeMillis(); |
| | | log.info("区块链监听启动完成, 消耗时间{}", end - start); |
New file |
| | |
| | | package cc.mrbird.febs.tree; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | public interface TreeConstants { |
| | | |
| | | /** |
| | | * 投入金额 |
| | | */ |
| | | BigDecimal PUT_IN_AMOUNT = new BigDecimal("200"); |
| | | |
| | | /** |
| | | * 满收益(至少推荐一人) |
| | | */ |
| | | BigDecimal FULL_PROFIT_AMOUNT = new BigDecimal("400"); |
| | | |
| | | } |