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) {
|
}
|
}
|