| | |
| | | /** |
| | | * A币卖币规则,卖出100%销毁,30%回流底池溢价 |
| | | */ |
| | | coinUsdtAmount = coinUsdtAmount.multiply(outPercent).setScale(4,BigDecimal.ROUND_DOWN); |
| | | BigDecimal coinUsdtAmountFee = coinUsdtAmount.multiply(outPercent).setScale(4,BigDecimal.ROUND_DOWN); |
| | | // coinUsdtAmount = coinUsdtAmount.multiply(outPercent).setScale(4,BigDecimal.ROUND_DOWN); |
| | | //金本位底池数量 |
| | | DataDictionaryCustom coinAUsdtPriceDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | PoolEnum.COIN_A_USDT_PRICE.getType(), |
| | | PoolEnum.COIN_A_USDT_PRICE.getCode() |
| | | ); |
| | | BigDecimal coinAUsdtCnt = new BigDecimal(coinAUsdtPriceDic.getValue()); |
| | | coinAUsdtCnt = coinAUsdtCnt.add(coinUsdtAmount).setScale(4,BigDecimal.ROUND_DOWN); |
| | | coinAUsdtCnt = coinAUsdtCnt.subtract(coinUsdtAmount).add(coinUsdtAmountFee).setScale(4,BigDecimal.ROUND_DOWN); |
| | | coinAUsdtPriceDic.setValue(coinAUsdtCnt.toString()); |
| | | dataDictionaryCustomMapper.updateById(coinAUsdtPriceDic); |
| | | //币本位底池数量 |
| | |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | String ss = "0x2bBAD0d2362a8dbdc655fBa5A0cd51d5379e38f7,0xd5c13dc4372d1e02b93add9dcca901bef51168be,0xe22bb5fB2e0F8ED9366785dADD33cA19355d037c,0x7685E62E679886494E3cdc3DE7103E026f815AF0,0x6893bE8F4fb73595A13f32bA5e1d198Ab135516C"; |
| | | // String ss = "0x2bBAD0d2362a8dbdc655fBa5A0cd51d5379e38f7,0xd5c13dc4372d1e02b93add9dcca901bef51168be,0xe22bb5fB2e0F8ED9366785dADD33cA19355d037c,0x7685E62E679886494E3cdc3DE7103E026f815AF0,0x6893bE8F4fb73595A13f32bA5e1d198Ab135516C"; |
| | | // if(ss.contains("0xd5c13dc4372d1e02b93add9dcca901bef51168be")){ |
| | | // System.out.println(1); |
| | | // }else{ |
| | | // System.out.println(2); |
| | | // } |
| | | // getLocalAddress("0x2bBAD0d2362a8dbdc655fBa5A0cd51d5379e38f7"); |
| | | BigDecimal amountIn = BigDecimal.valueOf(951); |
| | | BigDecimal result = amountIn.divide(BigDecimal.valueOf(100)); |
| | | System.out.println(result.remainder(BigDecimal.ONE).equals(BigDecimal.ZERO)); |
| | | // BigDecimal amountIn = BigDecimal.valueOf(951); |
| | | // BigDecimal result = amountIn.divide(BigDecimal.valueOf(100)); |
| | | // System.out.println(result.remainder(BigDecimal.ONE).equals(BigDecimal.ZERO)); |
| | | Long memberId = 294L; |
| | | if(294L == memberId){ |
| | | System.out.println(1); |
| | | }else{ |
| | | System.out.println(2); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | BigDecimal feePercent = new BigDecimal(StrUtil.isEmpty(dic.getValue()) ? "0.2" : dic.getValue()); |
| | | //手续费 |
| | | BigDecimal feeCnt = coinCnt.multiply(feePercent).setScale(4,BigDecimal.ROUND_DOWN); |
| | | if(294L == member.getId()){ |
| | | feeCnt = BigDecimal.ZERO; |
| | | } |
| | | //闪对钱包获取的 |
| | | BigDecimal aCoinCntReal = coinCnt.subtract(feeCnt).setScale(4, BigDecimal.ROUND_DOWN); |
| | | //增加闪对钱包 |
| | |
| | | dappMemberEntity.getId()); |
| | | dappFundFlowDao.insert(dappFundFlowEntity); |
| | | |
| | | //金本位底池数量 |
| | | DataDictionaryCustom coinAUsdtPriceDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | PoolEnum.COIN_A_USDT_PRICE.getType(), |
| | | PoolEnum.COIN_A_USDT_PRICE.getCode() |
| | | ); |
| | | BigDecimal coinAUsdtCnt = new BigDecimal(coinAUsdtPriceDic.getValue()); |
| | | //币本位底池数量 |
| | | DataDictionaryCustom coinACntDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | PoolEnum.COIN_A_CNT.getType(), |
| | | PoolEnum.COIN_A_CNT.getCode() |
| | | ); |
| | | BigDecimal coinACnt = new BigDecimal(coinACntDic.getValue()); |
| | | coinACnt = coinACnt.subtract(feeCnt).setScale(4,BigDecimal.ROUND_DOWN); |
| | | coinACntDic.setValue(coinACnt.toString()); |
| | | dataDictionaryCustomMapper.updateById(coinACntDic); |
| | | if(BigDecimal.ZERO.compareTo(feeCnt) < 0){ |
| | | //金本位底池数量 |
| | | DataDictionaryCustom coinAUsdtPriceDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | PoolEnum.COIN_A_USDT_PRICE.getType(), |
| | | PoolEnum.COIN_A_USDT_PRICE.getCode() |
| | | ); |
| | | BigDecimal coinAUsdtCnt = new BigDecimal(coinAUsdtPriceDic.getValue()); |
| | | //币本位底池数量 |
| | | DataDictionaryCustom coinACntDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | PoolEnum.COIN_A_CNT.getType(), |
| | | PoolEnum.COIN_A_CNT.getCode() |
| | | ); |
| | | BigDecimal coinACnt = new BigDecimal(coinACntDic.getValue()); |
| | | coinACnt = coinACnt.subtract(feeCnt).setScale(4,BigDecimal.ROUND_DOWN); |
| | | coinACntDic.setValue(coinACnt.toString()); |
| | | dataDictionaryCustomMapper.updateById(coinACntDic); |
| | | |
| | | DataDictionaryCustom aCoinPriceDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | PoolEnum.COIN_A_PRICE.getType(), |
| | | PoolEnum.COIN_A_PRICE.getCode() |
| | | ); |
| | | BigDecimal coinAPrice = new BigDecimal(aCoinPriceDic.getValue()); |
| | | coinAPrice = coinAUsdtCnt.divide(coinACnt,12,BigDecimal.ROUND_DOWN); |
| | | aCoinPriceDic.setValue(coinAPrice.toString()); |
| | | dataDictionaryCustomMapper.updateById(aCoinPriceDic); |
| | | DataDictionaryCustom aCoinPriceDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | PoolEnum.COIN_A_PRICE.getType(), |
| | | PoolEnum.COIN_A_PRICE.getCode() |
| | | ); |
| | | BigDecimal coinAPrice = new BigDecimal(aCoinPriceDic.getValue()); |
| | | coinAPrice = coinAUsdtCnt.divide(coinACnt,12,BigDecimal.ROUND_DOWN); |
| | | aCoinPriceDic.setValue(coinAPrice.toString()); |
| | | dataDictionaryCustomMapper.updateById(aCoinPriceDic); |
| | | |
| | | chainProducer.sendAntKLineMsg(0); |
| | | |
| | | chainProducer.sendAntKLineMsg(0); |
| | | } |
| | | } |
| | | |
| | | @Override |