| | |
| | | * 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 outPercent = new BigDecimal(outPercentDic.getValue()); |
| | | BigDecimal realUsdtAmount = coinUsdtAmount.subtract(feeUsdtAmount).setScale(4,BigDecimal.ROUND_DOWN); |
| | | realUsdtAmount = realUsdtAmount.multiply(outPercent).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); |
| | | //增加流水 |
| | |
| | | } |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | String ss = "0x2bBAD0d2362a8dbdc655fBa5A0cd51d5379e38f7,0xd5c13dc4372d1e02b93add9dcca901bef51168be,0xe22bb5fB2e0F8ED9366785dADD33cA19355d037c,0x7685E62E679886494E3cdc3DE7103E026f815AF0,0x6893bE8F4fb73595A13f32bA5e1d198Ab135516C"; |
| | | // if(ss.contains("0xd5c13dc4372d1e02b93add9dcca901bef51168be")){ |
| | | // System.out.println(1); |
| | | // }else{ |
| | | // System.out.println(2); |
| | | // } |
| | | // getLocalAddress("0x2bBAD0d2362a8dbdc655fBa5A0cd51d5379e38f7"); |
| | | } |
| | | |
| | | @Override |
| | | public Long transferA(TransferADto transferADto) { |
| | | 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(amountIn.compareTo(new BigDecimal(100)) != 0){ |
| | | throw new FebsException("Limit per address 100 USDT"); |
| | | } |
| | | BigDecimal amountInLast = dappChargeUsdtMapper.selectByMaxAmountMemberId(member.getId()); |
| | | if(BigDecimal.ZERO.compareTo(amountInLast) < 0){ |
| | | throw new FebsException("Limit per address 100 USDT"); |
| | | |
| | | // BigDecimal amountInLast = dappChargeUsdtMapper.selectByMaxAmountMemberId(member.getId()); |
| | | /** |
| | | * 限制用户买入总额, |
| | | * 目前每人限一单,总金额限制100U |
| | | */ |
| | | BigDecimal amountInLast = dappChargeUsdtMapper.selectBySumAmountMemberId(member.getId()); |
| | | DataDictionaryCustom systemAddressDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | PoolEnum.SYSTEM_ADDRESS.getType(), |
| | | PoolEnum.SYSTEM_ADDRESS.getCode() |
| | | ); |
| | | if(StrUtil.isNotEmpty(systemAddressDic.getValue())){ |
| | | // if(!(dappMemberEntity.getAddress().equals("0x2bBAD0d2362a8dbdc655fBa5A0cd51d5379e38f7") |
| | | // ||dappMemberEntity.getAddress().equals("0xd5c13dc4372d1e02b93add9dcca901bef51168be") |
| | | // ||dappMemberEntity.getAddress().equals("0xe22bb5fB2e0F8ED9366785dADD33cA19355d037c") |
| | | // ||dappMemberEntity.getAddress().equals("0x7685E62E679886494E3cdc3DE7103E026f815AF0") |
| | | // ||dappMemberEntity.getAddress().equals("0x6893bE8F4fb73595A13f32bA5e1d198Ab135516C") |
| | | // )){ |
| | | // if(BigDecimal.ZERO.compareTo(amountInLast) < 0){ |
| | | // throw new FebsException("Limit per address 100 USDT"); |
| | | // } |
| | | // } |
| | | if(getLocalAddress(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"); |
| | | } |
| | | } |
| | | /** |
| | | * 验证账户是否有入金金额的10%的AUSD |
| | |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public boolean getLocalAddress(String address){ |
| | | /** |
| | | * dappMemberEntity.getAddress().equals("0x2bBAD0d2362a8dbdc655fBa5A0cd51d5379e38f7") |
| | | * ||dappMemberEntity.getAddress().equals("0xd5c13dc4372d1e02b93add9dcca901bef51168be") |
| | | * ||dappMemberEntity.getAddress().equals("0xe22bb5fB2e0F8ED9366785dADD33cA19355d037c") |
| | | * ||dappMemberEntity.getAddress().equals("0x7685E62E679886494E3cdc3DE7103E026f815AF0") |
| | | * ||dappMemberEntity.getAddress().equals("0x6893bE8F4fb73595A13f32bA5e1d198Ab135516C" |
| | | */ |
| | | if(address.equals("0x2bBAD0d2362a8dbdc655fBa5A0cd51d5379e38f7")){ |
| | | return false; |
| | | } |
| | | if(address.equals("0xd5c13dc4372d1e02b93add9dcca901bef51168be")){ |
| | | return false; |
| | | } |
| | | if(address.equals("0xe22bb5fB2e0F8ED9366785dADD33cA19355d037c")){ |
| | | return false; |
| | | } |
| | | if(address.equals("0x7685E62E679886494E3cdc3DE7103E026f815AF0")){ |
| | | return false; |
| | | } |
| | | if(address.equals("0x6893bE8F4fb73595A13f32bA5e1d198Ab135516C")){ |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | |
| | | coinCnt.negate(), |
| | | FundFlowEnum.ANDAO_MEMBER_TO_MENBER.getCode(), |
| | | 2, |
| | | BigDecimal.ZERO); |
| | | BigDecimal.ZERO, |
| | | dappMemberEntity.getAddress(), |
| | | memberParent.getAddress(), |
| | | memberParent.getId()); |
| | | dappFundFlowDao.insert(aCoinCntFlow); |
| | | //闪对钱包20% 手续费(扣币) |
| | | DataDictionaryCustom dic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | |
| | | aCoinCntReal, |
| | | FundFlowEnum.ANDAO_MEMBER_TO_MENBER.getCode(), |
| | | 2, |
| | | BigDecimal.ZERO); |
| | | BigDecimal.ZERO, |
| | | dappMemberEntity.getAddress(), |
| | | memberParent.getAddress(), |
| | | dappMemberEntity.getId()); |
| | | dappFundFlowDao.insert(dappFundFlowEntity); |
| | | |
| | | //金本位底池数量 |
| | |
| | | coinCnt.negate(), |
| | | FundFlowEnum.AUSDT_MEMBER_TO_MENBER.getCode(), |
| | | 2, |
| | | BigDecimal.ZERO); |
| | | BigDecimal.ZERO, |
| | | dappMemberEntity.getAddress(), |
| | | memberParent.getAddress(), |
| | | memberParent.getId()); |
| | | dappFundFlowDao.insert(aCoinCntFlow); |
| | | |
| | | DappUsdtPerkEntity parentEntity = dappUsdtPerkEntityMapper.selectByMemberId(memberParent.getId()); |
| | | BigDecimal availableAmountParent = parentEntity.getAusdAmount(); |
| | | if(ObjectUtil.isEmpty(parentEntity)){ |
| | | parentEntity = new DappUsdtPerkEntity(); |
| | | parentEntity.setMemberId(memberParent.getId()); |
| | | dappUsdtPerkEntityMapper.insert(parentEntity); |
| | | } |
| | | BigDecimal availableAmountParent = ObjectUtil.isEmpty(parentEntity.getAusdAmount()) ? BigDecimal.ZERO : parentEntity.getAusdAmount(); |
| | | parentEntity.setAusdAmount(availableAmountParent.add(coinCnt)); |
| | | dappUsdtPerkEntityMapper.updateById(parentEntity); |
| | | //插入资产闪对的流水 |
| | |
| | | coinCnt, |
| | | FundFlowEnum.AUSDT_MEMBER_TO_MENBER.getCode(), |
| | | 2, |
| | | BigDecimal.ZERO); |
| | | BigDecimal.ZERO, |
| | | dappMemberEntity.getAddress(), |
| | | memberParent.getAddress(), |
| | | dappMemberEntity.getId()); |
| | | dappFundFlowDao.insert(aCoinCntFlowParent); |
| | | } |
| | | } |