fix
Helius
2021-11-30 c13c98374281a6316348979841a2fb249575ac26
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package com.xcong.excoin;
 
import cn.hutool.crypto.SecureUtil;
import com.xcong.excoin.modules.blackchain.service.Trc20Service;
import com.xcong.excoin.modules.blackchain.service.TrxUsdtUpdateService;
import com.xcong.excoin.modules.coin.dao.OrderCoinsDao;
import com.xcong.excoin.modules.coin.entity.OrderCoinsEntity;
import com.xcong.excoin.modules.coin.service.OrderCoinService;
import com.xcong.excoin.rabbit.consumer.UsdtUpdateConsumer;
import com.xcong.excoin.rabbit.producer.UsdtUpdateProducer;
import com.xcong.excoin.trade.CoinTrader;
import com.xcong.excoin.utils.CoinTypeConvert;
import com.xcong.excoin.utils.RedisUtils;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.tron.trident.core.ApiWrapper;
import org.tron.trident.core.contract.Contract;
import org.tron.trident.core.contract.Trc20Contract;
 
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
 
@Slf4j
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class TradeTest {
 
    @Resource
    private OrderCoinService orderCoinService;
 
    @Resource
    OrderCoinsDao orderCoinsDao;
    @Resource
    RedisUtils redisUtils;
 
    @Test
    public void buy(){
        redisUtils.set("GBZ_NEW_PRICE",new BigDecimal("12.33"));
    }
 
//    public static void main(String[] args) throws InterruptedException {
//        String s = SecureUtil.md5("330021");
//        System.out.println(s);
//    }
 
    @Test
    public void gbz() {
        System.out.println(redisUtils.getString(CoinTypeConvert.convertToKey("GBZ"+"/USDT")));
    }
 
    @Autowired
    private UsdtUpdateConsumer usdtUpdateConsumer;
 
    @Resource
    TrxUsdtUpdateService trxUsdtUpdateService;
 
    @Test
    public void xccTest() {
        String content = "{\"address\":\"TGq1DCMs1bR9pA9fwj2bKZwNWRyWZykJBZ\",\"balance\":10000,\"hash\":\"0563c844e00ded7a2851276e06240efd06ba00468450ab586dd05f0d686aa5a5\",\"symbol\":\"XCC_TRC20\"}";
//        usdtUpdateConsumer.doSomething(content);
 
 
        trxUsdtUpdateService.poolByAddress("TGq1DCMs1bR9pA9fwj2bKZwNWRyWZykJBZ");
 
 
//        ApiWrapper wrapper = ApiWrapper.ofMainnet("af4913d8462ca83e0a2df587072e42ec565bc26f6bec0724d1bf2e80d4c0bcb7", Trc20Service.API_KEY);
//        Contract trc20Contract = wrapper.getContract("TL2pea32CTtxJ48pJmnLQuoRHeoX79dLCT");
//        Trc20Contract token =  new Trc20Contract(trc20Contract, "TZ5sZBLU5pdZbqN56rVsUEQuRHzYGRSY8a", wrapper);
//
//        System.out.println(token.balanceOf("TZ5sZBLU5pdZbqN56rVsUEQuRHzYGRSY8a"));;
    }
 
    @Autowired
    private UsdtUpdateProducer usdtUpdateProducer;
 
    @Test
    public void blockTest() {
//        usdtUpdateProducer.sendTrc20BlockMsg("35908596");
 
 
        trxUsdtUpdateService.monitorCoinListener(35908596L);
    }
 
    public static void main(String[] args) {
    }
}