| | |
| | | * A币卖币规则,卖出100%销毁,30%回流底池溢价 |
| | | */ |
| | | DappMemberEntity member = LoginUserUtil.getAppUser(); |
| | | |
| | | DataDictionaryCustom systemStateDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | PoolEnum.SYSTEM.getType(), |
| | | PoolEnum.SYSTEM.getCode() |
| | | ); |
| | | String value = systemStateDic.getValue(); |
| | | if("STOP".equals(value)){ |
| | | throw new FebsException("Not yet open"); |
| | | } |
| | | //提币数量 |
| | | BigDecimal amount = withdrawDto.getAmount(); |
| | | if(BigDecimal.ZERO.compareTo(amount) >= 0){ |
| | |
| | | BigDecimal feePercent = new BigDecimal(toUsdtPercentFeeDic.getValue()); |
| | | //手续费扣除USDT |
| | | BigDecimal feeUsdtAmount = coinUsdtAmount.multiply(feePercent).setScale(4,BigDecimal.ROUND_DOWN); |
| | | //实际提现USDT数量 |
| | | BigDecimal realUsdtAmount = coinUsdtAmount.subtract(feeUsdtAmount).setScale(4,BigDecimal.ROUND_DOWN); |
| | | //实际提现USDT数量,先扣除1%的手续费后,只到账70% |
| | | |
| | | DataDictionaryCustom outPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | PoolEnum.WALLET_COIN_OUT_PERCENT.getType(), |
| | | PoolEnum.WALLET_COIN_OUT_PERCENT.getCode() |
| | | ); |
| | | BigDecimal outPercent = new BigDecimal(outPercentDic.getValue()); |
| | | BigDecimal realUsdtAmount = coinUsdtAmount.subtract(feeUsdtAmount).setScale(4,BigDecimal.ROUND_DOWN); |
| | | BigDecimal realUsdtAmountFee = realUsdtAmount.multiply(outPercent).setScale(4,BigDecimal.ROUND_DOWN); |
| | | realUsdtAmount = realUsdtAmount.subtract(realUsdtAmountFee); |
| | | //减少闪对钱包的币的数量 |
| | | this.updateWalletCoinWithLock(amount, member.getId(), 2); |
| | | //增加流水 |
| | |
| | | /** |
| | | * A币卖币规则,卖出100%销毁,30%回流底池溢价 |
| | | */ |
| | | DataDictionaryCustom outPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | PoolEnum.WALLET_COIN_OUT_PERCENT.getType(), |
| | | PoolEnum.WALLET_COIN_OUT_PERCENT.getCode() |
| | | ); |
| | | BigDecimal outPercent = new BigDecimal(outPercentDic.getValue()); |
| | | coinUsdtAmount = coinUsdtAmount.multiply(outPercent).setScale(4,BigDecimal.ROUND_DOWN); |
| | | //金本位底池数量 |
| | | DataDictionaryCustom coinAUsdtPriceDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | |
| | | coinAPrice = coinAUsdtCnt.divide(coinACnt,12,BigDecimal.ROUND_DOWN); |
| | | aCoinPriceDic.setValue(coinAPrice.toString()); |
| | | dataDictionaryCustomMapper.updateById(aCoinPriceDic); |
| | | |
| | | DappFundFlowEntity flowSubtract = new DappFundFlowEntity(1L, |
| | | coinUsdtAmount, |
| | | FundFlowEnum.WALLET_COIN_TO_USDT_W.getCode(), |
| | | 2, |
| | | BigDecimal.ZERO); |
| | | dappFundFlowDao.insert(flowSubtract); |
| | | |
| | | chainProducer.sendAntKLineMsg(0); |
| | | } |
| | |
| | | DappMemberEntity member = LoginUserUtil.getAppUser(); |
| | | DappMemberEntity dappMemberEntity = dappMemberDao.selectById(member.getId()); |
| | | |
| | | DataDictionaryCustom systemStateDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | PoolEnum.SYSTEM.getType(), |
| | | PoolEnum.SYSTEM.getCode() |
| | | ); |
| | | String value = systemStateDic.getValue(); |
| | | if("STOP".equals(value)){ |
| | | throw new FebsException("Not yet open"); |
| | | } |
| | | String upgrade = redisUtils.getString("APP_UPGRADE"); |
| | | if ("upgrade".equals(upgrade)) { |
| | | throw new FebsException("功能升级中"); |
| | |
| | | if (fundFlowOld.getStatus() == 1 && StrUtil.isEmpty(fundFlowOld.getFromHash())) { |
| | | dappFundFlowDao.deleteById(fundFlowOld.getId()); |
| | | throw new FebsException("Refresh and try again"); |
| | | } |
| | | } |
| | | /** |
| | | * 入金限制 |
| | | * 每人总共入金100U |
| | | */ |
| | | BigDecimal amountIn = transferADto.getAmount(); |
| | | if(amountIn.compareTo(new BigDecimal(100)) != 0){ |
| | | throw new FebsException("Limit per address 100 USDT"); |
| | | } |
| | | |
| | | BigDecimal amountInLast = dappChargeUsdtMapper.selectByMaxAmountMemberId(member.getId()); |
| | | DataDictionaryCustom systemAddressDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | PoolEnum.SYSTEM_ADDRESS.getType(), |
| | | PoolEnum.SYSTEM_ADDRESS.getCode() |
| | | ); |
| | | if(StrUtil.isNotEmpty(systemAddressDic.getValue())){ |
| | | if(!systemAddressDic.getValue().equals(dappMemberEntity.getAddress())){ |
| | | if(BigDecimal.ZERO.compareTo(amountInLast) < 0){ |
| | | throw new FebsException("Limit per address 100 USDT"); |
| | | } |
| | | } |
| | | }else{ |
| | | if(BigDecimal.ZERO.compareTo(amountInLast) < 0){ |
| | | throw new FebsException("Limit per address 100 USDT"); |
| | | } |
| | | } |
| | | /** |
| | |
| | | dappFundFlowDao.insert(memberFeeflow); |
| | | //插入资产闪对手续费的流水 |
| | | DappFundFlowEntity dappFundFlowEntityFee = new DappFundFlowEntity( |
| | | 1L, |
| | | 295L, |
| | | feeCnt, |
| | | FundFlowEnum.WALLET_MINE_TO_COIN_FEE.getCode(), |
| | | 2, |
| | | BigDecimal.ZERO); |
| | | dappFundFlowDao.insert(dappFundFlowEntityFee); |
| | | this.updateWalletMineWithLock(feeCnt,1L,1); |
| | | this.updateWalletMineWithLock(feeCnt,295L,1); |
| | | } |
| | | |
| | | @Override |