| | |
| | | |
| | | @Override |
| | | public void compile(EthUsdtContract.TransferEventResponse e) { |
| | | if (e.to != null && ADDRESS.equals(e.from)) { |
| | | if (ADDRESS.equals(e.to)) { |
| | | DappMemberEntity fromMember = dappMemberService.findByAddress(e.from, null); |
| | | if (fromMember == null) { |
| | | fromMember = dappMemberService.insertMember(e.from, null); |
| | | } |
| | | |
| | | BigInteger tokens = e.tokens; |
| | | |
| | | BigDecimal amount = BigDecimal.valueOf(tokens.intValue()).divide(BigDecimal.TEN.pow(decimals), decimals, RoundingMode.HALF_DOWN); |
| | | |
| | | DappFundFlowEntity fundFlow = new DappFundFlowEntity(fromMember.getId(), amount, 2, null, null, e.log.getTransactionHash()); |
| | | dappFundFlowDao.insert(fundFlow); |
| | | |
| | | // TODO price |
| | | BigDecimal newPrice = BigDecimal.valueOf(1); |
| | | |
| | | BigDecimal transferAmount = amount.multiply(newPrice); |
| | | String hash = ChainService.getInstance(ChainEnum.BSC_TFC.name()).transfer(e.from, transferAmount); |
| | | fundFlow.setToHash(hash); |
| | | dappFundFlowDao.updateById(fundFlow); |
| | | // BigInteger tokens = e.tokens; |
| | | // BigDecimal amount = BigDecimal.valueOf(tokens.intValue()).divide(BigDecimal.TEN.pow(decimals), decimals, RoundingMode.HALF_DOWN); |
| | | // |
| | | // DappFundFlowEntity fundFlow = new DappFundFlowEntity(fromMember.getId(), amount, 2, null, null, e.log.getTransactionHash()); |
| | | // dappFundFlowDao.insert(fundFlow); |
| | | // |
| | | // // TODO price |
| | | // BigDecimal newPrice = BigDecimal.valueOf(1); |
| | | // |
| | | // BigDecimal transferAmount = amount.multiply(newPrice); |
| | | // String hash = ChainService.getInstance(ChainEnum.BSC_TFC.name()).transfer(e.from, transferAmount); |
| | | // fundFlow.setToHash(hash); |
| | | // dappFundFlowDao.updateById(fundFlow); |
| | | } |
| | | } |
| | | } |