| | |
| | | "https://bsc-dataseed1.ninicoin.io", |
| | | "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", |
| | | ""), |
| | | BNB("BSC", "0xBa6206B3Be305278Ea65bA54C4E6188B252AEc4a", |
| | | "0x1bc264d17bd2b1f3c0480764272284b8e6c8b0a39a590c26940f84f7b090cc74", |
| | | "https://bsc-dataseed1.ninicoin.io", |
| | | "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", |
| | | ""), |
| | | |
| | | /** |
| | | * 币安链 代币合约 |
| | |
| | | |
| | | public String tokenTransfer(String privateKey, String fromAddress, String toAddress, String amount) throws ExecutionException, InterruptedException { |
| | | String gas = getGas(); |
| | | // String gas = "5"; |
| | | |
| | | BigDecimal amountPow = new BigDecimal(amount).multiply(BigDecimal.TEN.pow(decimals())); |
| | | amount = amountPow.toPlainString(); |
| | |
| | | DappFundFlowEntity selectNewestFundFlow(@Param("memberId") Long memberId, @Param("type") Integer type); |
| | | |
| | | BigDecimal selectSumAmountByMemberIdAndTypeAndStatus(@Param("memberId") Long memberId,@Param("type")int type, @Param("status")int status); |
| | | |
| | | DappFundFlowEntity selectInfoById(@Param("id")Long id); |
| | | |
| | | int updateStatusById(@Param("status")int status, @Param("id")Long id); |
| | | } |
| | |
| | | public void bnbTransfer(Long id) { |
| | | log.info("{}",id); |
| | | //获取对应的流水记录 |
| | | DappFundFlowEntity dappFundFlowEntity = dappFundFlowDao.selectById(id); |
| | | DappFundFlowEntity dappFundFlowEntity = dappFundFlowDao.selectInfoById(id); |
| | | if(ObjectUtil.isEmpty(dappFundFlowEntity)){ |
| | | return; |
| | | } |
| | | if(DappFundFlowEntity.WITHDRAW_STATUS_AGREE == dappFundFlowEntity.getStatus()){ |
| | | return; |
| | | } |
| | | Long memberId = dappFundFlowEntity.getMemberId(); |
| | | DappMemberEntity dappMemberEntity = dappMemberDao.selectById(memberId); |
| | | if(ObjectUtil.isEmpty(dappMemberEntity)){ |
| | | return; |
| | | } |
| | | Integer count = dappFundFlowDao.updateStatusById(DappFundFlowEntity.WITHDRAW_STATUS_AGREE,dappFundFlowEntity.getId()); |
| | | // if(count > 0){ |
| | | // //金额 |
| | | // BigDecimal amount = dappFundFlowEntity.getAmount(); |
| | | // Long memberId = dappFundFlowEntity.getMemberId(); |
| | | // DappMemberEntity dappMemberEntity = dappMemberDao.selectById(memberId); |
| | | // if(ObjectUtil.isEmpty(dappMemberEntity)){ |
| | | // return; |
| | | // } |
| | | // //目标地址 |
| | | // String address = dappMemberEntity.getAddress(); |
| | | // String hash = ChainService.getInstance(ChainEnum.BSC_USDT.name()).transfer(address, amount); |
| | |
| | | // return; |
| | | // } |
| | | // dappFundFlowEntity.setToHash(hash); |
| | | dappFundFlowEntity.setStatus(DappFundFlowEntity.WITHDRAW_STATUS_AGREE); |
| | | dappFundFlowDao.updateById(dappFundFlowEntity); |
| | | |
| | | // dappFundFlowDao.updateById(dappFundFlowEntity); |
| | | // } |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | //插入一条会员入列记录,即加入动能队列 |
| | | DappSystemProfit dappSystemProfit = new DappSystemProfit(member.getId(), transferDto.getAmount()); |
| | | DappSystemProfit dappSystemProfit = new DappSystemProfit(member.getId(), flow.getAmount()); |
| | | dappSystemProfitDao.insert(dappSystemProfit); |
| | | |
| | | flow.setFromHash(transferDto.getTxHash()); |
| | |
| | | and type = #{type} |
| | | and status = #{status} |
| | | </select> |
| | | |
| | | <select id="selectInfoById" resultType="cc.mrbird.febs.dapp.entity.DappFundFlowEntity"> |
| | | select a.* from dapp_fund_flow |
| | | where a.id = #{id} |
| | | for update |
| | | </select> |
| | | |
| | | <update id="updateStatusById"> |
| | | update dapp_fund_flow |
| | | set status = #{status}, |
| | | version = version + 1 |
| | | where id = #{id} |
| | | and version = 1 |
| | | and status = 1 |
| | | </update> |
| | | </mapper> |
| | |
| | | import cc.mrbird.febs.common.contants.AppContants; |
| | | import cc.mrbird.febs.dapp.chain.ChainEnum; |
| | | import cc.mrbird.febs.dapp.chain.ChainService; |
| | | import cc.mrbird.febs.dapp.entity.DappFundFlowEntity; |
| | | import cc.mrbird.febs.dapp.entity.DappMemberEntity; |
| | | import cc.mrbird.febs.dapp.entity.DataDictionaryCustom; |
| | | import cc.mrbird.febs.dapp.mapper.DappFundFlowDao; |
| | | import cc.mrbird.febs.dapp.mapper.DappMemberDao; |
| | | import cc.mrbird.febs.dapp.mapper.DataDictionaryCustomMapper; |
| | | import cn.hutool.core.util.StrUtil; |
| | |
| | | |
| | | @Autowired |
| | | private DataDictionaryCustomMapper dataDictionaryCustomMapper; |
| | | |
| | | @Autowired |
| | | private DappFundFlowDao dappFundFlowDao; |
| | | // String address = dappMemberEntity.getAddress(); |
| | | // String hash = ChainService.getInstance(ChainEnum.BSC_USDT.name()).transfer(address, amount); |
| | | // if(StrUtil.isEmpty(hash)){ |
| | |
| | | public void tranfer(){ |
| | | String address = "0xD9076245473060DDa1a65f5f3D89a4D0598995E6"; |
| | | BigDecimal amount = new BigDecimal("0.0009"); |
| | | String hash = ChainService.getInstance(ChainEnum.BSC_USDT.name()).transfer(address, amount); |
| | | if(StrUtil.isEmpty(hash)){ |
| | | return; |
| | | } |
| | | String hash = ChainService.getInstance(ChainEnum.BNB.name()).transfer(address, amount); |
| | | //// if(StrUtil.isEmpty(hash)){ |
| | | //// return; |
| | | //// } |
| | | // BigDecimal balance = ChainService.getInstance(ChainEnum.WBNB.name()).balanceOf(ChainEnum.WBNB.getAddress()); |
| | | // Integer count = dappFundFlowDao.updateStatusById(DappFundFlowEntity.WITHDRAW_STATUS_AGREE,464L); |
| | | System.out.println(hash); |
| | | } |
| | | |