| | |
| | | public static final String REDIS_KEY_SYMBOL_DAILY_PRICE = "SYMBOL_DAILY_PRICE";
|
| | |
|
| | | public static final BigDecimal NFT_ACTIVE_PRICE = new BigDecimal("10");
|
| | |
|
| | | public static final String REDIS_KEY_TFC_NEW_PRICE = "TFC_NEW_PRICE";
|
| | | }
|
| | |
| | | boolean hasProfit(String address); |
| | | |
| | | void sdmWithdrawFee(String data); |
| | | |
| | | void tfcNewPrice(); |
| | | } |
| | |
| | | public void sdmWithdrawFee(String data) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void tfcNewPrice() { |
| | | BigDecimal newPrice; |
| | | if (!systemHasStart()) { |
| | | newPrice = new BigDecimal("0.05"); |
| | | } else { |
| | | ContractChainService tfcInstance = ChainService.getInstance(ChainEnum.BSC_TFC.name()); |
| | | // u剩余数量 |
| | | BigDecimal sourceU = ChainService.getInstance(ChainEnum.BSC_USDT.name()).balanceOf(ChainEnum.BSC_USDT_SOURCE.getAddress()); |
| | | // 源池代币剩余数量 |
| | | BigDecimal sourceCoin = tfcInstance.balanceOf(ChainEnum.BSC_USDT_SOURCE.getAddress()); |
| | | |
| | | newPrice = sourceU.divide(sourceCoin, tfcInstance.decimals(), RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | chainProducer.sendTfcNewPrice(newPrice.toPlainString()); |
| | | } |
| | | } |
| | |
| | | log.info("挖矿"); |
| | | systemService.mining(); |
| | | } |
| | | |
| | | @Scheduled(cron = "0/10 * * * * ?") |
| | | public void tfcNewPriceJob() { |
| | | systemService.tfcNewPrice(); |
| | | } |
| | | |
| | | } |
| | |
| | | public static final String USER_BUY_REWARD = "queue_tfc_user_buy_reward"; |
| | | public static final String NFT_BOX = "queue_tfc_nft_box"; |
| | | public static final String WITHDRAW_FEE = "queue_withdraw_fee"; |
| | | public static final String TFC_NEW_PRICE = "queue_tfc_new_price"; |
| | | } |
| | |
| | | DISTRIB_PROFIT("exchange_distrib_profit", "route_key_distrib_profit", "queue_tfc_distrib_profit"), |
| | | USER_BUY_REWARD("exchange_user_buy_reward", "route_key_user_buy_reward", "queue_tfc_user_buy_reward"), |
| | | NFT_BOX("exchange_nft_box", "route_key_nft_box", "queue_tfc_nft_box"), |
| | | WITHDRAW_FEE("exchange_withdraw_fee", "route_key_withdraw_fee", "queue_withdraw_fee"); |
| | | WITHDRAW_FEE("exchange_withdraw_fee", "route_key_withdraw_fee", "queue_withdraw_fee"), |
| | | TFC_NEW_PRICE("exchange_tfc_new_price", "route_key_tfc_new_price", "queue_tfc_new_price"); |
| | | |
| | | private String exchange; |
| | | |
| | |
| | | return BindingBuilder.bind(withdrawFeeQueue()).to(withdrawFeeExchange()).with(QueueEnum.WITHDRAW_FEE.getRoute()); |
| | | } |
| | | // === 提现手续费 end === |
| | | |
| | | // === tfc最新价 start === |
| | | @Bean |
| | | public DirectExchange tfcNewPriceExchange() { |
| | | return new DirectExchange(QueueEnum.TFC_NEW_PRICE.getExchange()); |
| | | } |
| | | |
| | | @Bean |
| | | public Queue tfcNewPriceQueue() { |
| | | return new Queue(QueueEnum.TFC_NEW_PRICE.getQueue()); |
| | | } |
| | | |
| | | @Bean |
| | | public Binding tfcNewPriceBind() { |
| | | return BindingBuilder.bind(tfcNewPriceQueue()).to(tfcNewPriceExchange()).with(QueueEnum.TFC_NEW_PRICE.getRoute()); |
| | | } |
| | | // === tfc最新价 end === |
| | | } |
| | |
| | | CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); |
| | | rabbitTemplate.convertAndSend(QueueEnum.NFT_BOX.getExchange(), QueueEnum.NFT_BOX.getRoute(), id, correlationData); |
| | | } |
| | | |
| | | /** |
| | | * 消费者在矩阵项目 |
| | | * @param data |
| | | */ |
| | | public void sendTfcNewPrice(String data) { |
| | | log.info("发送tfc最新价:{}", data); |
| | | CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); |
| | | rabbitTemplate.convertAndSend(QueueEnum.TFC_NEW_PRICE.getExchange(), QueueEnum.TFC_NEW_PRICE.getRoute(), data, correlationData); |
| | | } |
| | | } |