| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jsoup.Jsoup; |
| | | import org.jsoup.nodes.Document; |
| | | import org.jsoup.nodes.Element; |
| | | import org.jsoup.select.Elements; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.math.BigInteger; |
| | | import java.math.RoundingMode; |
| | | import java.net.MalformedURLException; |
| | | import java.net.URL; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | Object makePoolObj = redisUtils.get(AppContants.REDIS_KEY_MAKE_POOL_CNT); |
| | | BigDecimal balance; |
| | | if (makePoolObj == null) { |
| | | balance = ChainService.getInstance(ChainEnum.BSC_TFC_MAKE.name()).balanceOf(ChainEnum.BSC_TFC_MAKE.getAddress()); |
| | | balance = ChainService.getInstance(ChainEnum.BSC_TFC.name()).balanceOf(ChainEnum.BSC_TFC.getAddress()); |
| | | redisUtils.set(AppContants.REDIS_KEY_MAKE_POOL_CNT, balance); |
| | | } else { |
| | | balance = (BigDecimal) makePoolObj; |
| | |
| | | system.setUsdtTotal(usdtTotal); |
| | | system.setUsdtRemain(usdtRemain); |
| | | |
| | | system.setFeeRatio(BigDecimal.TEN); |
| | | system.setFeeRatio(new BigDecimal("7")); |
| | | system.setBuyFeeRatio(new BigDecimal("3")); |
| | | return system; |
| | | } |
| | | |
| | |
| | | // 发送转账消息 |
| | | chainProducer.sendOnlineTransfer(JSONObject.toJSONString(map)); |
| | | } |
| | | |
| | | @Override |
| | | public void tradeNftProfitDistribute(Long id) { |
| | | DappFundFlowEntity fundFlow = dappFundFlowDao.selectById(id); |
| | | |
| | | BigInteger totalNFT = ChainService.getInstance(ChainEnum.BSC_TFC.name()).totalSupply(); |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | // public static void main(String[] args) throws IOException { |
| | | // Document parse = Jsoup.parse(new URL("https://bscscan.com/token/generic-tokenholders2?a=0x03c7d3f141c5f03971604958170e253362e13be6"), 10000000); |
| | | // |
| | | // Elements tbodys = parse.getElementsByTag("tbody"); |
| | | // |
| | | // Element tbody = tbodys.get(0); |
| | | // |
| | | // Elements elements = tbody.getElementsMatchingOwnText("^0x.*$"); |
| | | // |
| | | // String text = elements.get(0).text(); |
| | | // System.out.println(1111); |
| | | // } |
| | | |
| | | @Override |
| | | public void mining() { |
| | |
| | | @Override |
| | | public void userBuyReward(Long id) { |
| | | // 系统未启动不参与 |
| | | String hasStart = redisUtils.getString(AppContants.SYSTEM_START_FLAG); |
| | | if (!"start".equals(hasStart)) { |
| | | if (!systemHasStart()) { |
| | | return; |
| | | } |
| | | |
| | |
| | | DappMemberEntity member = dappMemberDao.selectById(fundFlow.getMemberId()); |
| | | DappMemberEntity referer = dappMemberDao.selectMemberInfoByInviteId(member.getRefererId()); |
| | | if (referer == null || "admin".equals(referer.getAccountType())) { |
| | | return; |
| | | } |
| | | |
| | | if (!hasProfit(referer.getAddress())) { |
| | | return; |
| | | } |
| | | |
| | |
| | | return; |
| | | } |
| | | |
| | | BigDecimal balance = ChainService.getInstance(ChainEnum.BSC_TFC.name()).balanceOf(member.getAddress()); |
| | | BigDecimal usdtBalance = balance.multiply(newestPrice()); |
| | | |
| | | DataDictionaryCustom data = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(AppContants.DIC_TYPE_SYSTEM_SETTING, AppContants.DIC_VALUE_MINI_HOLD_COIN_LIMIT); |
| | | BigDecimal miniLimit = new BigDecimal(data.getValue()); |
| | | if (usdtBalance.compareTo(miniLimit) < 0) { |
| | | if (!hasProfit(parent.getAddress())) { |
| | | return; |
| | | } |
| | | |
| | |
| | | return new BigDecimal("0.05"); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public boolean hasProfit(String address) { |
| | | BigDecimal balance = ChainService.getInstance(ChainEnum.BSC_TFC.name()).balanceOf(address); |
| | | BigDecimal usdtBalance = balance.multiply(newestPrice()); |
| | | |
| | | DataDictionaryCustom data = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(AppContants.DIC_TYPE_SYSTEM_SETTING, AppContants.DIC_VALUE_MINI_HOLD_COIN_LIMIT); |
| | | BigDecimal miniLimit = new BigDecimal(data.getValue()); |
| | | if (usdtBalance.compareTo(miniLimit) < 0) { |
| | | return false; |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | } |