From 292a4634d9c52ce193eca9de356d65960bdc35f4 Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Fri, 15 Jan 2021 18:20:37 +0800 Subject: [PATCH] 20210115 --- src/test/java/com/xcong/excoin/GuijiTest.java | 47 +++++++++++++++++++++++++++++++++++++---------- 1 files changed, 37 insertions(+), 10 deletions(-) diff --git a/src/test/java/com/xcong/excoin/GuijiTest.java b/src/test/java/com/xcong/excoin/GuijiTest.java index b0f35e2..4ef29a9 100644 --- a/src/test/java/com/xcong/excoin/GuijiTest.java +++ b/src/test/java/com/xcong/excoin/GuijiTest.java @@ -23,13 +23,13 @@ import lombok.extern.slf4j.Slf4j; @Slf4j -@SpringBootTest +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class GuijiTest { private static final BigDecimal LIMIT = new BigDecimal("50"); - private static final BigDecimal FEE = new BigDecimal("0.0044"); + private static final BigDecimal FEE = new BigDecimal("0.005"); - public static String ETH_FEE = "0.0044"; + public static String ETH_FEE = "0.005"; public static final String TOTAL_ADDRESS = "0x067b4bE5d7B05560AE539Fc8f10597D854ae056D"; public static final String TOTAL_PRIVATE = "1fb7288c8c88c37d6f79e9617822bffc8d3635bf2d808c5f6afdee9bb326e49c"; @@ -42,13 +42,22 @@ private MemberWalletCoinDao memberWalletCoinDao; @Test + public void poolTest() { + String address = "0x19177bfd062852a4398cae3ab701a82a6b959bf2"; + EthService ethService = new EthService(); + BigDecimal balance = ethService.tokenGetBalance(address); + BigDecimal eth = EthService.getEthBlance(address); + + log.info("--->{}, {}", balance, eth); + } + public void pool() throws ExecutionException, InterruptedException { //List<MemberCoinChargeEntity> list = memberCoinChargeDao.selectAllBySymbolAndTag(CoinTypeEnum.USDT.name(), "ERC20", 1); List<MemberCoinChargeEntity> list = new ArrayList<MemberCoinChargeEntity>(); MemberCoinChargeEntity coin = new MemberCoinChargeEntity(); - coin.setAddress("0x4b859f7ba68e2757ae935f9e7426da0c73f63a68"); - coin.setMemberId(184L); - coin.setLastAmount(new BigDecimal(70.83975901)); + coin.setAddress("0xdf24223ab4599a47aa9383c5c9914edd68ae63dc"); + coin.setMemberId(1L); + coin.setLastAmount(new BigDecimal(51.01000101)); list.add(coin); if (CollUtil.isNotEmpty(list)) { EthService ethService = new EthService(); @@ -84,7 +93,7 @@ usdtStr = usdtStr.substring(0, usdtStr.lastIndexOf(".")); } - String hash = ethService.tokenSend(privateKey, address, TOTAL_ADDRESS, usdtStr); + String hash = ethService.tokenSend(privateKey, address, TOTAL_ADDRESS, usdtStr,null); System.out.println("归集:"+hash); if (StrUtil.isNotBlank(hash)) { // 归集成功更新状态 先保存本次的hash值,待交易成功后再更新 @@ -92,15 +101,33 @@ memberCoinChargeDao.updateById(coinCharge); } } else { - String hash = ethService.ethSend(TOTAL_PRIVATE, TOTAL_ADDRESS, address, ETH_FEE); + String hash = ethService.ethSend(TOTAL_PRIVATE, TOTAL_ADDRESS, address, ETH_FEE,null); System.out.println("转手续费:"+hash); } } } } } - - + /** + * 向特定账号转手续费 + */ + @Test + public void pushFee() { + String toAddress = "0xbc6050a2898511bda406660267e6667448070552"; + EthService ethService = new EthService(); + try { + String hash = ethService.ethSend(TOTAL_PRIVATE, TOTAL_ADDRESS, toAddress, "0.0032",null); + System.out.println("转手续费:"+hash); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (ExecutionException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + } -- Gitblit v1.9.1