From 1d5f689f34d827ac4be67fd84212a5cb7fc80d57 Mon Sep 17 00:00:00 2001
From: KKSU <15274802129@163.com>
Date: Tue, 16 Apr 2024 16:17:14 +0800
Subject: [PATCH] 滑点自动发放
---
src/main/java/cc/mrbird/febs/dapp/entity/DappHdRecord.java | 8
src/main/java/cc/mrbird/febs/rabbit/consumer/ChainConsumer.java | 2
src/main/java/cc/mrbird/febs/dapp/service/impl/AdminBannerServiceImpl.java | 8
src/main/java/cc/mrbird/febs/job/GiveMeMoneyJob.java | 59 +
src/main/java/cc/mrbird/febs/dapp/chain/ContractChainService.java | 1
src/main/java/cc/mrbird/febs/dapp/service/IAdminBannerService.java | 3
src/main/java/cc/mrbird/febs/dapp/service/impl/AsyncCjServiceImpl.java | 42
src/main/resources/templates/febs/views/modules/banner/coinPrice.html | 1498 +++++++++++++++++++++++++++++----------------------
src/main/java/cc/mrbird/febs/dapp/chain/ChainEnum.java | 5
src/main/java/cc/mrbird/febs/dapp/mapper/DappHdRecordMapper.java | 2
src/main/java/cc/mrbird/febs/dapp/chain/EthService.java | 34 +
src/main/java/cc/mrbird/febs/dapp/controller/AdminBannerController.java | 12
src/main/resources/templates/febs/views/modules/banner/coinSet.html | 42
src/main/resources/mapper/dapp/DappHdRecordMapper.xml | 7
src/main/java/cc/mrbird/febs/dapp/chain/TrxService.java | 5
15 files changed, 1,009 insertions(+), 719 deletions(-)
diff --git a/src/main/java/cc/mrbird/febs/dapp/chain/ChainEnum.java b/src/main/java/cc/mrbird/febs/dapp/chain/ChainEnum.java
index b8f9812..fe307e9 100644
--- a/src/main/java/cc/mrbird/febs/dapp/chain/ChainEnum.java
+++ b/src/main/java/cc/mrbird/febs/dapp/chain/ChainEnum.java
@@ -46,6 +46,11 @@
"https://bsc-dataseed1.ninicoin.io",
"0x46ac4921e58773ca22826df1640672b91b1db2b3",
""),
+ BSC_GFA("BSC", "0x977a9ddfb965a9a3416fa72ca7f91c4949c18f25",
+ "0xefe98e00cd227b6322e892c82fcbd8eadf119c3188b7e574bc624f65405d61bf",
+ "https://bsc-dataseed1.ninicoin.io",
+ "0xaC97ff8173c41b83111b411A3Fa62D7C6ff385be",
+ ""),
/**
* 源池币
diff --git a/src/main/java/cc/mrbird/febs/dapp/chain/ContractChainService.java b/src/main/java/cc/mrbird/febs/dapp/chain/ContractChainService.java
index 1602c42..95b3fab 100644
--- a/src/main/java/cc/mrbird/febs/dapp/chain/ContractChainService.java
+++ b/src/main/java/cc/mrbird/febs/dapp/chain/ContractChainService.java
@@ -8,6 +8,7 @@
BigInteger balanceOfUnDecimal(String address);
BigDecimal balanceOf(String address);
+ BigDecimal getPrice(String address);
BigInteger allowance(String address);
diff --git a/src/main/java/cc/mrbird/febs/dapp/chain/EthService.java b/src/main/java/cc/mrbird/febs/dapp/chain/EthService.java
index 66f037d..331110b 100644
--- a/src/main/java/cc/mrbird/febs/dapp/chain/EthService.java
+++ b/src/main/java/cc/mrbird/febs/dapp/chain/EthService.java
@@ -153,6 +153,40 @@
}
@Override
+ public BigDecimal getPrice(String address) {
+ BigInteger decimals = BigInteger.ZERO;
+ try {
+ String methodName = "getPrice";
+ List<Type> inputParameters = new ArrayList<>();
+ List<TypeReference<?>> outputParameters = new ArrayList<>();
+ TypeReference<Uint256> typeReference = new TypeReference<Uint256>() {
+ };
+ outputParameters.add(typeReference);
+ Function function = new Function(methodName, inputParameters, outputParameters);
+ String data = FunctionEncoder.encode(function);
+ Transaction transaction = Transaction.createEthCallTransaction(null, contractAddress, data);
+
+ EthCall ethCall;
+ try {
+ ethCall = web3j.ethCall(transaction, DefaultBlockParameterName.LATEST).send();
+ List<Type> results = FunctionReturnDecoder.decode(ethCall.getValue(), function.getOutputParameters());
+ decimals = (BigInteger) results.get(0).getValue();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ int decimal = decimals();
+ double res = new BigDecimal(decimals).divide(BigDecimal.valueOf(Math.pow(10, decimal)), 8, RoundingMode.HALF_DOWN).doubleValue();
+ if (res > 0) {
+ return new BigDecimal(res);
+ }
+ return BigDecimal.ZERO;
+ }
+
+ @Override
public BigInteger allowance(String address) {
String methodName = "allowance";
List<TypeReference<?>> outputParameters = new ArrayList<>();
diff --git a/src/main/java/cc/mrbird/febs/dapp/chain/TrxService.java b/src/main/java/cc/mrbird/febs/dapp/chain/TrxService.java
index d8c8e99..ddbec38 100644
--- a/src/main/java/cc/mrbird/febs/dapp/chain/TrxService.java
+++ b/src/main/java/cc/mrbird/febs/dapp/chain/TrxService.java
@@ -75,6 +75,11 @@
}
@Override
+ public BigDecimal getPrice(String address) {
+ return null;
+ }
+
+ @Override
public int decimals() {
return 0;
}
diff --git a/src/main/java/cc/mrbird/febs/dapp/controller/AdminBannerController.java b/src/main/java/cc/mrbird/febs/dapp/controller/AdminBannerController.java
index 004df4a..603dc9a 100644
--- a/src/main/java/cc/mrbird/febs/dapp/controller/AdminBannerController.java
+++ b/src/main/java/cc/mrbird/febs/dapp/controller/AdminBannerController.java
@@ -7,6 +7,7 @@
import cc.mrbird.febs.common.enumerates.DataDicEnum;
import cc.mrbird.febs.common.utils.RedisUtils;
import cc.mrbird.febs.dapp.entity.DappCoinPrice;
+import cc.mrbird.febs.dapp.entity.DappHdRecord;
import cc.mrbird.febs.dapp.entity.PlatformBanner;
import cc.mrbird.febs.dapp.mapper.DataDictionaryCustomMapper;
import cc.mrbird.febs.dapp.service.DappSystemService;
@@ -43,6 +44,15 @@
@GetMapping("coinPrice")
public FebsResponse coinPrice(DappCoinPrice dappCoinPrice, QueryRequest request) {
Map<String, Object> data = getDataTable(iAdminBannerService.findCoinPriceInPage(dappCoinPrice, request));
+ return new FebsResponse().success().data(data);
+ }
+
+ /**
+ * 价格---列表
+ */
+ @GetMapping("hdRecord")
+ public FebsResponse hdRecord(DappHdRecord dappHdRecord, QueryRequest request) {
+ Map<String, Object> data = getDataTable(iAdminBannerService.findHdRecordInPage(dappHdRecord, request));
return new FebsResponse().success().data(data);
}
@@ -111,7 +121,7 @@
if(BigDecimal.ZERO.compareTo(coinAmount) > 0){
return new FebsResponse().fail().message("请设置钱包GFA");
}
- dappSystemService.tradeProfitDistribute(1L);
+// dappSystemService.tradeProfitDistribute(1L);
return new FebsResponse().success().message("操作成功");
}
diff --git a/src/main/java/cc/mrbird/febs/dapp/entity/DappHdRecord.java b/src/main/java/cc/mrbird/febs/dapp/entity/DappHdRecord.java
index fd3e7f5..68db672 100644
--- a/src/main/java/cc/mrbird/febs/dapp/entity/DappHdRecord.java
+++ b/src/main/java/cc/mrbird/febs/dapp/entity/DappHdRecord.java
@@ -11,8 +11,8 @@
public class DappHdRecord extends BaseEntity {
private BigDecimal price;
- private BigDecimal usdtEvery;//每日新增
- private BigDecimal usdtAmount;//总数
- private BigDecimal coinEvery;
- private BigDecimal coinAmount;
+ private BigDecimal usdtEvery;//滑点新增
+ private BigDecimal usdtAmount;//滑点累计
+ private BigDecimal coinEvery;//币量新增
+ private BigDecimal coinAmount;//币量累计
}
diff --git a/src/main/java/cc/mrbird/febs/dapp/mapper/DappHdRecordMapper.java b/src/main/java/cc/mrbird/febs/dapp/mapper/DappHdRecordMapper.java
index d6b34e1..ac30c73 100644
--- a/src/main/java/cc/mrbird/febs/dapp/mapper/DappHdRecordMapper.java
+++ b/src/main/java/cc/mrbird/febs/dapp/mapper/DappHdRecordMapper.java
@@ -15,6 +15,8 @@
IPage<DappCoinPrice> findCoinPriceInPage(Page<DappCoinPrice> page, @Param("record")DappCoinPrice dappCoinPrice);
+ IPage<DappHdRecord> findHdRecordInPage(Page<DappHdRecord> page, @Param("record")DappHdRecord dappCoinPrice);
+
DappHdRecord selectNewRecord();
}
diff --git a/src/main/java/cc/mrbird/febs/dapp/service/IAdminBannerService.java b/src/main/java/cc/mrbird/febs/dapp/service/IAdminBannerService.java
index 5a7cf54..fa90002 100644
--- a/src/main/java/cc/mrbird/febs/dapp/service/IAdminBannerService.java
+++ b/src/main/java/cc/mrbird/febs/dapp/service/IAdminBannerService.java
@@ -3,6 +3,7 @@
import cc.mrbird.febs.common.entity.FebsResponse;
import cc.mrbird.febs.common.entity.QueryRequest;
import cc.mrbird.febs.dapp.entity.DappCoinPrice;
+import cc.mrbird.febs.dapp.entity.DappHdRecord;
import cc.mrbird.febs.dapp.entity.PlatformBanner;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
@@ -25,4 +26,6 @@
IPage<DappCoinPrice> findCoinPriceInPage(DappCoinPrice dappCoinPrice, QueryRequest request);
FebsResponse coinPriceAdd(String price);
+
+ IPage<DappHdRecord> findHdRecordInPage(DappHdRecord dappHdRecord, QueryRequest request);
}
diff --git a/src/main/java/cc/mrbird/febs/dapp/service/impl/AdminBannerServiceImpl.java b/src/main/java/cc/mrbird/febs/dapp/service/impl/AdminBannerServiceImpl.java
index 9974d24..48a465a 100644
--- a/src/main/java/cc/mrbird/febs/dapp/service/impl/AdminBannerServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/dapp/service/impl/AdminBannerServiceImpl.java
@@ -4,6 +4,7 @@
import cc.mrbird.febs.common.entity.QueryRequest;
import cc.mrbird.febs.common.enumerates.DataDicEnum;
import cc.mrbird.febs.dapp.entity.DappCoinPrice;
+import cc.mrbird.febs.dapp.entity.DappHdRecord;
import cc.mrbird.febs.dapp.entity.DataDictionaryCustom;
import cc.mrbird.febs.dapp.entity.PlatformBanner;
import cc.mrbird.febs.dapp.mapper.DappCoinPriceMapper;
@@ -104,4 +105,11 @@
asyncCjService.redisCacheUpdate(DataDicEnum.GFA_PRICE.getValue(),bigDecimal.toString(),0);
return new FebsResponse().success();
}
+
+ @Override
+ public IPage<DappHdRecord> findHdRecordInPage(DappHdRecord dappHdRecord, QueryRequest request) {
+ Page<DappHdRecord> page = new Page<>(request.getPageNum(), request.getPageSize());
+ IPage<DappHdRecord> dappHdRecordIPage = dappHdRecordMapper.findHdRecordInPage(page, dappHdRecord);
+ return dappHdRecordIPage;
+ }
}
diff --git a/src/main/java/cc/mrbird/febs/dapp/service/impl/AsyncCjServiceImpl.java b/src/main/java/cc/mrbird/febs/dapp/service/impl/AsyncCjServiceImpl.java
index 1c47c8b..5b840ec 100644
--- a/src/main/java/cc/mrbird/febs/dapp/service/impl/AsyncCjServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/dapp/service/impl/AsyncCjServiceImpl.java
@@ -242,10 +242,6 @@
*/
//当天实际当天滑点
-
- BigDecimal gfaPrice = new BigDecimal(
- redisUtils.getString(DataDicEnum.GFA_PRICE.getValue())
- ).setScale(2,BigDecimal.ROUND_DOWN);
BigDecimal usdtAmount = new BigDecimal(
redisUtils.getString(DataDicEnum.GFA_HUA_DIAN_WALLET_USDT_AMOUNT.getValue())
).setScale(2,BigDecimal.ROUND_DOWN);
@@ -255,20 +251,8 @@
if(BigDecimal.ZERO.compareTo(usdtAmount) > 0){
return;
}
- if(BigDecimal.ZERO.compareTo(coinAmount) > 0){
- return;
- }
BigDecimal usdtAmountReal = usdtAmount;
BigDecimal coinAmountReal = coinAmount;
- //生成一条记录
- DappHdRecord dappHdRecordAdd = new DappHdRecord();
- dappHdRecordAdd.setPrice(gfaPrice);
- dappHdRecordAdd.setUsdtEvery(usdtAmountReal);
- dappHdRecordAdd.setUsdtAmount(usdtAmountReal);
- dappHdRecordAdd.setCoinEvery(coinAmountReal);
- dappHdRecordAdd.setCoinAmount(coinAmountReal);
- dappHdRecordMapper.insert(dappHdRecordAdd);
-
/**
* 5%滑奖分配:
* 1%用自身质押
@@ -281,9 +265,9 @@
//平分份数
BigDecimal totalPercent = new BigDecimal(selfPercent + teamPercent + workPercent);
//每一份有多少
- BigDecimal divideEveryUsdt = usdtAmountReal.divide(totalPercent, 4, BigDecimal.ROUND_DOWN);
+ BigDecimal divideEveryUsdt = usdtAmountReal.divide(totalPercent, 8, BigDecimal.ROUND_DOWN);
//每一份有多少
- BigDecimal divideEveryCoin = coinAmountReal.divide(totalPercent, 4, BigDecimal.ROUND_DOWN);
+ BigDecimal divideEveryCoin = coinAmountReal.divide(totalPercent, 8, BigDecimal.ROUND_DOWN);
//1%用自身质押
selfHdPerk(selfPercent,divideEveryUsdt,divideEveryCoin);
//3%用于团队业绩计算
@@ -360,16 +344,19 @@
memberPerkMap.put(memberId,teamAchieveMemberSum);
}
- BigDecimal everyUsdt = multiplyDivideEveryUsdt.divide(memberPerkTotal,4,BigDecimal.ROUND_DOWN);
- BigDecimal everyCoin = multiplyDivideEveryCoin.divide(memberPerkTotal,4,BigDecimal.ROUND_DOWN);
+ BigDecimal everyUsdt = multiplyDivideEveryUsdt.divide(memberPerkTotal,8,BigDecimal.ROUND_DOWN);
+ BigDecimal everyCoin = multiplyDivideEveryCoin.divide(memberPerkTotal,8,BigDecimal.ROUND_DOWN);
Set<Long> set = memberPerkMap.keySet(); // 得到所有key的集合
for (Long memberId : set) {
//当前生效中的团队业绩
BigDecimal amountMember = memberPerkMap.get(memberId);
//这个人实际可以分到的数量USDT
- BigDecimal multiplyUsdt = amountMember.multiply(everyUsdt).setScale(4, BigDecimal.ROUND_DOWN);
+ BigDecimal multiplyUsdt = amountMember.multiply(everyUsdt).setScale(8, BigDecimal.ROUND_DOWN);
+ if(BigDecimal.ZERO.compareTo(multiplyUsdt) >= 0){
+ continue;
+ }
//这个人实际可以分到的数量COIN
- BigDecimal multiplyCoin = amountMember.multiply(everyCoin).setScale(4, BigDecimal.ROUND_DOWN);
+ BigDecimal multiplyCoin = amountMember.multiply(everyCoin).setScale(8, BigDecimal.ROUND_DOWN);
DappMemberEntity dappMemberEntityExit = dappMemberDao.selectById(memberId);
if(ObjectUtil.isEmpty(dappMemberEntityExit)){
continue;
@@ -428,8 +415,8 @@
if(BigDecimal.ZERO.compareTo(amountMemberTotal) >= 0){
return;
}
- BigDecimal everyUsdt = multiplyDivideEveryUsdt.divide(amountMemberTotal,4,BigDecimal.ROUND_DOWN);
- BigDecimal everyCoin = multiplyDivideEveryCoin.divide(amountMemberTotal,4,BigDecimal.ROUND_DOWN);
+ BigDecimal everyUsdt = multiplyDivideEveryUsdt.divide(amountMemberTotal,8,BigDecimal.ROUND_DOWN);
+ BigDecimal everyCoin = multiplyDivideEveryCoin.divide(amountMemberTotal,8,BigDecimal.ROUND_DOWN);
Map<Long, List<DappAchieve>> collect = dappAchieves.stream().collect(Collectors.groupingBy(DappAchieve::getMemberId));
Set<Long> set = collect.keySet(); // 得到所有key的集合
@@ -437,9 +424,12 @@
//当前每个人生效中的质押总数
BigDecimal amountMember = collect.get(memberId).stream().map(DappAchieve::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
//这个人实际可以分到的数量USDT
- BigDecimal multiplyUsdt = amountMember.multiply(everyUsdt).setScale(4, BigDecimal.ROUND_DOWN);
+ BigDecimal multiplyUsdt = amountMember.multiply(everyUsdt).setScale(8, BigDecimal.ROUND_DOWN);
+ if(BigDecimal.ZERO.compareTo(multiplyUsdt) >= 0){
+ continue;
+ }
//这个人实际可以分到的数量COIN
- BigDecimal multiplyCoin = amountMember.multiply(everyCoin).setScale(4, BigDecimal.ROUND_DOWN);
+ BigDecimal multiplyCoin = amountMember.multiply(everyCoin).setScale(8, BigDecimal.ROUND_DOWN);
DappMemberEntity dappMemberEntityExit = dappMemberDao.selectById(memberId);
if(ObjectUtil.isEmpty(dappMemberEntityExit)){
diff --git a/src/main/java/cc/mrbird/febs/job/GiveMeMoneyJob.java b/src/main/java/cc/mrbird/febs/job/GiveMeMoneyJob.java
index 7dc855c..01f2fe3 100644
--- a/src/main/java/cc/mrbird/febs/job/GiveMeMoneyJob.java
+++ b/src/main/java/cc/mrbird/febs/job/GiveMeMoneyJob.java
@@ -3,12 +3,18 @@
import cc.mrbird.febs.common.contants.AppContants;
import cc.mrbird.febs.common.enumerates.DataDicEnum;
import cc.mrbird.febs.common.utils.RedisUtils;
+import cc.mrbird.febs.dapp.chain.ChainEnum;
+import cc.mrbird.febs.dapp.chain.ChainService;
import cc.mrbird.febs.dapp.entity.DappAddressList;
+import cc.mrbird.febs.dapp.entity.DappHdRecord;
import cc.mrbird.febs.dapp.mapper.DappAdressListDao;
+import cc.mrbird.febs.dapp.mapper.DappHdRecordMapper;
import cc.mrbird.febs.dapp.mapper.DappMemberDao;
import cc.mrbird.febs.dapp.service.DappSystemService;
import cc.mrbird.febs.rabbit.producer.ChainProducer;
import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
@@ -33,25 +39,58 @@
private DappSystemService dappSystemService;
@Autowired
private RedisUtils redisUtils;
+ @Autowired
+ private DappHdRecordMapper dappHdRecordMapper;
/**
* 每日定时零点计算滑点
*/
- @Scheduled(cron = "0 0 0 * * ?")
+ @Scheduled(cron = "0 0/5 * * * ? ")
public void mineJob() {
+ /**
+ * 定时器循环计算每个时间跨度内增加的滑点数量
+ */
log.info("滑点奖励");
- BigDecimal usdtAmount = new BigDecimal(
- redisUtils.getString(DataDicEnum.GFA_HUA_DIAN_WALLET_USDT_AMOUNT.getValue())
- ).setScale(2,BigDecimal.ROUND_DOWN);
- BigDecimal coinAmount = new BigDecimal(
- redisUtils.getString(DataDicEnum.GFA_HUA_DIAN_WALLET_COIN_AMOUNT.getValue())
- ).setScale(2,BigDecimal.ROUND_DOWN);
- if(BigDecimal.ZERO.compareTo(usdtAmount) > 0){
- return;
+ //获取滑点钱包的余额
+ BigDecimal coinCnt = ChainService.getInstance(ChainEnum.BSC_GFA.name()).balanceOf("0x1Ea392645f816BF15f1Fc87728eA010585bAAE7D").setScale(8,BigDecimal.ROUND_DOWN);
+ BigDecimal coinPrice = ChainService.getInstance(ChainEnum.BSC_GFA.name()).getPrice("0x1Ea392645f816BF15f1Fc87728eA010585bAAE7D").setScale(8,BigDecimal.ROUND_DOWN);
+ //获取上一时刻的数据
+ BigDecimal coinAmountOld =BigDecimal.ZERO;
+ DappHdRecord dappHdRecord = dappHdRecordMapper.selectNewRecord();
+ if(ObjectUtil.isNotEmpty(dappHdRecord)){
+ coinAmountOld = dappHdRecord.getCoinAmount();
}
- if(BigDecimal.ZERO.compareTo(coinAmount) > 0){
+
+ //更新此刻的USDT数量
+ String existToken = redisUtils.getString(DataDicEnum.GFA_HUA_DIAN_WALLET_USDT_AMOUNT.getValue());
+ if (StrUtil.isNotBlank(existToken)) {
+ redisUtils.del(existToken);
+ }
+ //这个时间段的新增余额
+ //此刻的余额-上一次账户的余额 = 这个时间段的新增余额
+ BigDecimal subtract = coinCnt.subtract(coinAmountOld);
+ //获取这个时刻的滑点入账数量
+ BigDecimal multiply = coinPrice.multiply(subtract).multiply(new BigDecimal("0.97")).setScale(8,BigDecimal.ROUND_DOWN);
+ //更新这个时间段的滑点数量
+ redisUtils.set(DataDicEnum.GFA_HUA_DIAN_WALLET_USDT_AMOUNT.getValue(), multiply, 0);
+
+ //生成一条记录
+ DappHdRecord dappHdRecordAdd = new DappHdRecord();
+ dappHdRecordAdd.setPrice(coinPrice);
+ dappHdRecordAdd.setUsdtEvery(multiply);
+ dappHdRecordAdd.setCoinEvery(subtract);
+ dappHdRecordAdd.setCoinAmount(coinCnt);
+ dappHdRecordMapper.insert(dappHdRecordAdd);
+
+ if(BigDecimal.ZERO.compareTo(subtract) >= 0){
return;
}
dappSystemService.tradeProfitDistribute(1L);
}
+ public static void main(String[] args) {
+// System.out.println(ChainService.getInstance(ChainEnum.BSC_GFA.name()).totalSupply());
+// System.out.println(ChainService.getInstance(ChainEnum.BSC_GFA.name()).balanceOf("0x1Ea392645f816BF15f1Fc87728eA010585bAAE7D"));
+ System.out.println(ChainService.getInstance(ChainEnum.BSC_GFA.name()).getPrice("0x1Ea392645f816BF15f1Fc87728eA010585bAAE7D"));
+ }
+
}
diff --git a/src/main/java/cc/mrbird/febs/rabbit/consumer/ChainConsumer.java b/src/main/java/cc/mrbird/febs/rabbit/consumer/ChainConsumer.java
index 598fab3..5b78de5 100644
--- a/src/main/java/cc/mrbird/febs/rabbit/consumer/ChainConsumer.java
+++ b/src/main/java/cc/mrbird/febs/rabbit/consumer/ChainConsumer.java
@@ -31,7 +31,7 @@
@RabbitListener(queues = QueueConstants.QUEUE_GFA_ZY_HUA_DIAN)
public void distrbProfit(Long id) {
log.info("收到滑点分配消息:{}", id);
- dappSystemService.tradeProfitDistribute(id);
+// dappSystemService.tradeProfitDistribute(id);
}
@RabbitListener(queues = QueueConstants.USER_BUY_REWARD)
diff --git a/src/main/resources/mapper/dapp/DappHdRecordMapper.xml b/src/main/resources/mapper/dapp/DappHdRecordMapper.xml
index a63bccb..dd1d7e7 100644
--- a/src/main/resources/mapper/dapp/DappHdRecordMapper.xml
+++ b/src/main/resources/mapper/dapp/DappHdRecordMapper.xml
@@ -16,6 +16,13 @@
dapp_coin_price
order by CREATE_TIME desc
</select>
+ <select id="findHdRecordInPage" resultType="cc.mrbird.febs.dapp.entity.DappHdRecord">
+ SELECT
+ *
+ FROM
+ dapp_hd_record
+ order by CREATE_TIME desc
+ </select>
<select id="selectNewRecord" resultType="cc.mrbird.febs.dapp.entity.DappHdRecord">
SELECT
diff --git a/src/main/resources/templates/febs/views/modules/banner/coinPrice.html b/src/main/resources/templates/febs/views/modules/banner/coinPrice.html
index cf8d73d..a9baad5 100644
--- a/src/main/resources/templates/febs/views/modules/banner/coinPrice.html
+++ b/src/main/resources/templates/febs/views/modules/banner/coinPrice.html
@@ -8,7 +8,7 @@
<div class="layui-inline">
<div class="layui-input-inline">
<span></span>
- <span>点击刷新获取最新价格:</span>
+<!-- <span>点击刷新获取最新价格:</span>-->
</div>
<div class="layui-input-inline">
<span id="countdown"></span>
@@ -39,7 +39,7 @@
</script>
<script type="text/html" id="isInside">
{{#
- var isInside = {
+ var isInside = {
2: {title: '外' , color: 'green'},
1: {title: '内', color: 'red'}
}[d.isInside];
@@ -48,7 +48,7 @@
</script>
<script type="text/html" id="showPort">
{{#
- var showPort = {
+ var showPort = {
2: {title: '手机' , color: 'green'},
1: {title: 'pc', color: 'red'}
}[d.showPort];
@@ -57,7 +57,7 @@
</script>
<script type="text/html" id="isTop">
{{#
- var isTop = {
+ var isTop = {
2: {title: '否', color: 'red' },
1: {title: '是' , color: 'green'}
}[d.isTop];
@@ -106,15 +106,18 @@
var data = obj.data,
layEvent = obj.event;
});
-
- // 刷新按钮
$reset.on('click', function () {
- getBalanceOf("0xCEBfd36e03BD80c7015Cbad17eFfBc33d2923FF3").then(amount => {
- console.log("余额:"+amount);
- document.getElementById('countdown').innerHTML = amount ;
-
- coinPriceAdd(amount);
- });
+ // getBalanceOf("0xf5807B8F3691bFfDf155daFdF2f0449e9F6fE423").then(amount => {
+ // console.log("余额:"+amount);
+ // // coinPriceAdd(amount);
+ // document.getElementById('countdownBalance').innerHTML = "余额:"+amount;
+ // });
+ // getPrice().then(amount => {
+ // console.log("价格:"+amount);
+ //
+ // document.getElementById('countdownPrice').innerHTML = "价格:"+amount ;
+ // // coinPriceAdd(amount);
+ // });
$searchForm[0].reset();
sortObject.type = 'null';
tableIns.reload({where: getQueryParams(), page: {curr: null}, initSort: sortObject});
@@ -133,10 +136,13 @@
tableIns = febs.table.init({
elem: $view.find('table'),
id: 'coinPriceTable',
- url: ctx + 'admin/banner/coinPrice',
+ url: ctx + 'admin/banner/hdRecord',
cols: [[
// {field: 'id', title: '', minWidth: 10,align:'left'},
+ {field: 'coinAmount', title: '滑点累计币量', minWidth: 120,align:'center'},
+ {field: 'coinEvery', title: '新增滑点', minWidth: 120,align:'center'},
{field: 'price', title: '价格', minWidth: 120,align:'center'},
+ {field: 'usdtEvery', title: '新增USDT', minWidth: 120,align:'center'},
{field: 'createTime', title: '时间', minWidth: 120,align:'center'},
]]
});
@@ -175,658 +181,838 @@
}
// setInterval(() => {
- // getPrice(tokens.tokenA,tokens.tokenB).then(price => {
- // coinPriceAdd(price);
+ // getBalanceOf("0xf5807B8F3691bFfDf155daFdF2f0449e9F6fE423").then(amount => {
+ // coinPriceAdd(amount);
// });
// }, 10 * 1000);//10秒一次
//获取地址拥有的代币数量
- const providers = new ethers.providers.JsonRpcProvider('https://data-seed-prebsc-1-s1.bnbchain.org:8545');
- // const providers = new ethers.providers.JsonRpcProvider('https://https://bsc-testnet.public.blastapi.io/');
+ // const providers = new ethers.providers.JsonRpcProvider('https://data-seed-prebsc-1-s1.bnbchain.org:8545');//正式
+ const providers = new ethers.providers.JsonRpcProvider('https://bsc-testnet.public.blastapi.io/');//测试
+ const contract = {
+ // gfaCoin: '0xaC97ff8173c41b83111b411A3Fa62D7C6ff385be',//正式
+ gfaCoin: '0xB4dAA960EAbd566D495bCfaCC0453A9Baabe6D46',//测试
+ };
+ const gfaContract = new ethers.Contract(
+ contract.gfaCoin,
+ [
+ {
+ "inputs": [
+ {
+ "internalType": "string[]",
+ "name": "symbolParam",
+ "type": "string[]"
+ },
+ {
+ "internalType": "address[]",
+ "name": "adr",
+ "type": "address[]"
+ }
+ ],
+ "stateMutability": "nonpayable",
+ "type": "constructor"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "owner",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "spender",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Approval",
+ "type": "event"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "spender",
+ "type": "address"
+ },
+ {
+ "internalType": "uint256",
+ "name": "amount",
+ "type": "uint256"
+ }
+ ],
+ "name": "approve",
+ "outputs": [
+ {
+ "internalType": "bool",
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "anonymous": false,
+ "inputs": [],
+ "name": "AutoNukeLP",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "internalType": "address",
+ "name": "adr",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "amount",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "price",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "sameCoin",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "finxMineCoin",
+ "type": "uint256"
+ }
+ ],
+ "name": "CoinReward",
+ "type": "event"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "spender",
+ "type": "address"
+ },
+ {
+ "internalType": "uint256",
+ "name": "subtractedValue",
+ "type": "uint256"
+ }
+ ],
+ "name": "decreaseAllowance",
+ "outputs": [
+ {
+ "internalType": "bool",
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "spender",
+ "type": "address"
+ },
+ {
+ "internalType": "uint256",
+ "name": "addedValue",
+ "type": "uint256"
+ }
+ ],
+ "name": "increaseAllowance",
+ "outputs": [
+ {
+ "internalType": "bool",
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "uint256",
+ "name": "startState",
+ "type": "uint256"
+ }
+ ],
+ "name": "launch",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "previousOwner",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "newOwner",
+ "type": "address"
+ }
+ ],
+ "name": "OwnershipTransferred",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "internalType": "address",
+ "name": "sender",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "amount",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "volumn",
+ "type": "uint256"
+ }
+ ],
+ "name": "Pawn",
+ "type": "event"
+ },
+ {
+ "inputs": [],
+ "name": "renounceOwnership",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "black",
+ "type": "address"
+ },
+ {
+ "internalType": "bool",
+ "name": "enable",
+ "type": "bool"
+ }
+ ],
+ "name": "setBlack",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "uint256",
+ "name": "buyFee",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "saleFee",
+ "type": "uint256"
+ }
+ ],
+ "name": "setFee",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "whiteAddr",
+ "type": "address"
+ },
+ {
+ "internalType": "bool",
+ "name": "enable",
+ "type": "bool"
+ }
+ ],
+ "name": "setPawnWhiteAddress",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "uint256",
+ "name": "pawnBurnRatio",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "minRatio",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "pawnRatio",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "lpBurnRatio",
+ "type": "uint256"
+ }
+ ],
+ "name": "setRates",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "uint256",
+ "name": "mineTime",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "exchangeTime",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "burnTime",
+ "type": "uint256"
+ }
+ ],
+ "name": "setTimes",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "recipient",
+ "type": "address"
+ },
+ {
+ "internalType": "uint256",
+ "name": "amount",
+ "type": "uint256"
+ }
+ ],
+ "name": "transfer",
+ "outputs": [
+ {
+ "internalType": "bool",
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "from",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "to",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Transfer",
+ "type": "event"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "sender",
+ "type": "address"
+ },
+ {
+ "internalType": "address",
+ "name": "recipient",
+ "type": "address"
+ },
+ {
+ "internalType": "uint256",
+ "name": "amount",
+ "type": "uint256"
+ }
+ ],
+ "name": "transferFrom",
+ "outputs": [
+ {
+ "internalType": "bool",
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "owner",
+ "type": "address"
+ },
+ {
+ "internalType": "address",
+ "name": "spender",
+ "type": "address"
+ }
+ ],
+ "name": "allowance",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "account",
+ "type": "address"
+ }
+ ],
+ "name": "balanceOf",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "decimals",
+ "outputs": [
+ {
+ "internalType": "uint8",
+ "name": "",
+ "type": "uint8"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "getLastExchangeTime",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "getLastMineTime",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "getLastTimes",
+ "outputs": [
+ {
+ "internalType": "uint256[]",
+ "name": "",
+ "type": "uint256[]"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "getOwner",
+ "outputs": [
+ {
+ "internalType": "address",
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "getPawnVolumn",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "getPrice",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "_price",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "getRates",
+ "outputs": [
+ {
+ "internalType": "uint256[]",
+ "name": "",
+ "type": "uint256[]"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "getRewardAddressList",
+ "outputs": [
+ {
+ "internalType": "address[]",
+ "name": "",
+ "type": "address[]"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "adr",
+ "type": "address"
+ }
+ ],
+ "name": "getRewardHisotryTotal",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "adr",
+ "type": "address"
+ }
+ ],
+ "name": "getRewardHistory",
+ "outputs": [
+ {
+ "components": [
+ {
+ "internalType": "uint256",
+ "name": "amount",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "goldAmount",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "coinAmount",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "price",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "timesptemp",
+ "type": "uint256"
+ }
+ ],
+ "internalType": "struct Reward.RewardHistory[]",
+ "name": "",
+ "type": "tuple[]"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "adr",
+ "type": "address"
+ }
+ ],
+ "name": "getRewardList",
+ "outputs": [
+ {
+ "components": [
+ {
+ "internalType": "address",
+ "name": "reward",
+ "type": "address"
+ },
+ {
+ "internalType": "uint256",
+ "name": "amount",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "remain",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "price",
+ "type": "uint256"
+ },
+ {
+ "internalType": "uint256",
+ "name": "timestemp",
+ "type": "uint256"
+ }
+ ],
+ "internalType": "struct Reward.RewardData[]",
+ "name": "",
+ "type": "tuple[]"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "getTimes",
+ "outputs": [
+ {
+ "internalType": "uint256[]",
+ "name": "",
+ "type": "uint256[]"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "getTotalMineCnt",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "getTotalRemainCnt",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "adr",
+ "type": "address"
+ }
+ ],
+ "name": "getWaitRelease",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ }
+ ],
+ "name": "isBlackAddr",
+ "outputs": [
+ {
+ "internalType": "bool",
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "name",
+ "outputs": [
+ {
+ "internalType": "string",
+ "name": "",
+ "type": "string"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "owner",
+ "outputs": [
+ {
+ "internalType": "address",
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "symbol",
+ "outputs": [
+ {
+ "internalType": "string",
+ "name": "",
+ "type": "string"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "totalSupply",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ }
+ ],
+ providers
+ );
+ //获取地址余额
async function getBalanceOf(address){
- const contract = {
- gfaCoin: '0x33107d4502C8C59a8b96834c76d427B67AC1d873',
- };
- const gfaContract = new ethers.Contract(
- contract.gfaCoin,
- [
- {
- "inputs": [
- {
- "internalType": "string[]",
- "name": "symbolParam",
- "type": "string[]"
- },
- {
- "internalType": "address[]",
- "name": "adr",
- "type": "address[]"
- }
- ],
- "stateMutability": "nonpayable",
- "type": "constructor"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "owner",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "spender",
- "type": "address"
- },
- {
- "indexed": false,
- "internalType": "uint256",
- "name": "value",
- "type": "uint256"
- }
- ],
- "name": "Approval",
- "type": "event"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "spender",
- "type": "address"
- },
- {
- "internalType": "uint256",
- "name": "amount",
- "type": "uint256"
- }
- ],
- "name": "approve",
- "outputs": [
- {
- "internalType": "bool",
- "name": "",
- "type": "bool"
- }
- ],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "anonymous": false,
- "inputs": [],
- "name": "AutoNukeLP",
- "type": "event"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "spender",
- "type": "address"
- },
- {
- "internalType": "uint256",
- "name": "subtractedValue",
- "type": "uint256"
- }
- ],
- "name": "decreaseAllowance",
- "outputs": [
- {
- "internalType": "bool",
- "name": "",
- "type": "bool"
- }
- ],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "spender",
- "type": "address"
- },
- {
- "internalType": "uint256",
- "name": "addedValue",
- "type": "uint256"
- }
- ],
- "name": "increaseAllowance",
- "outputs": [
- {
- "internalType": "bool",
- "name": "",
- "type": "bool"
- }
- ],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "uint256",
- "name": "startState",
- "type": "uint256"
- }
- ],
- "name": "launch",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "previousOwner",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "newOwner",
- "type": "address"
- }
- ],
- "name": "OwnershipTransferred",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": false,
- "internalType": "address",
- "name": "sender",
- "type": "address"
- },
- {
- "indexed": false,
- "internalType": "uint256",
- "name": "amount",
- "type": "uint256"
- },
- {
- "indexed": false,
- "internalType": "uint256",
- "name": "volumn",
- "type": "uint256"
- }
- ],
- "name": "Pawn",
- "type": "event"
- },
- {
- "inputs": [],
- "name": "renounceOwnership",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "uint256",
- "name": "mineTime",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "exchangeTime",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "burnTime",
- "type": "uint256"
- }
- ],
- "name": "setTimes",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "recipient",
- "type": "address"
- },
- {
- "internalType": "uint256",
- "name": "amount",
- "type": "uint256"
- }
- ],
- "name": "transfer",
- "outputs": [
- {
- "internalType": "bool",
- "name": "",
- "type": "bool"
- }
- ],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "from",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "to",
- "type": "address"
- },
- {
- "indexed": false,
- "internalType": "uint256",
- "name": "value",
- "type": "uint256"
- }
- ],
- "name": "Transfer",
- "type": "event"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "sender",
- "type": "address"
- },
- {
- "internalType": "address",
- "name": "recipient",
- "type": "address"
- },
- {
- "internalType": "uint256",
- "name": "amount",
- "type": "uint256"
- }
- ],
- "name": "transferFrom",
- "outputs": [
- {
- "internalType": "bool",
- "name": "",
- "type": "bool"
- }
- ],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "owner",
- "type": "address"
- },
- {
- "internalType": "address",
- "name": "spender",
- "type": "address"
- }
- ],
- "name": "allowance",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "account",
- "type": "address"
- }
- ],
- "name": "balanceOf",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "decimals",
- "outputs": [
- {
- "internalType": "uint8",
- "name": "",
- "type": "uint8"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "getLastExchangeTime",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "getLastMineTime",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "getOwner",
- "outputs": [
- {
- "internalType": "address",
- "name": "",
- "type": "address"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "getPawnVolumn",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "getPrice",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "_price",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "getRewardAddressList",
- "outputs": [
- {
- "internalType": "address[]",
- "name": "",
- "type": "address[]"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "adr",
- "type": "address"
- }
- ],
- "name": "getRewardHisotryTotal",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "adr",
- "type": "address"
- }
- ],
- "name": "getRewardHistory",
- "outputs": [
- {
- "components": [
- {
- "internalType": "uint256",
- "name": "amount",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "goldAmount",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "coinAmount",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "price",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "timesptemp",
- "type": "uint256"
- }
- ],
- "internalType": "struct Reward.RewardHistory[]",
- "name": "",
- "type": "tuple[]"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "adr",
- "type": "address"
- }
- ],
- "name": "getRewardList",
- "outputs": [
- {
- "components": [
- {
- "internalType": "address",
- "name": "reward",
- "type": "address"
- },
- {
- "internalType": "uint256",
- "name": "amount",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "remain",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "price",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "timestemp",
- "type": "uint256"
- }
- ],
- "internalType": "struct Reward.RewardData[]",
- "name": "",
- "type": "tuple[]"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "getTotalMineCnt",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "getTotalRemainCnt",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "adr",
- "type": "address"
- }
- ],
- "name": "getWaitRelease",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "name",
- "outputs": [
- {
- "internalType": "string",
- "name": "",
- "type": "string"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "owner",
- "outputs": [
- {
- "internalType": "address",
- "name": "",
- "type": "address"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "symbol",
- "outputs": [
- {
- "internalType": "string",
- "name": "",
- "type": "string"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "totalSupply",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- }
- ],
- providers
- );
const amounts = await gfaContract.balanceOf(address);//获取余额
+ const decimals = await gfaContract.decimals();//获取精度
+ return (amounts.toString()/10 ** decimals).toString();
+ }
+ //获取价格
+ async function getPrice(){
const price = await gfaContract.getPrice();//获取价格
const decimals = await gfaContract.decimals();//获取精度
- // await gfaContract.allowance(0xCEBfd36e03BD80c7015Cbad17eFfBc33d2923FF3,1000000);
- // // return amounts.toString()/1e18;
- //
- // return (amounts.toString()/10 ** decimals).toString() +",价格:"+ price/10 ** decimals;
return ( price/10 ** decimals).toString();
}
// setInterval(() => {
diff --git a/src/main/resources/templates/febs/views/modules/banner/coinSet.html b/src/main/resources/templates/febs/views/modules/banner/coinSet.html
index 556ab4e..8b10403 100644
--- a/src/main/resources/templates/febs/views/modules/banner/coinSet.html
+++ b/src/main/resources/templates/febs/views/modules/banner/coinSet.html
@@ -135,23 +135,23 @@
<!-- </div>-->
<!-- </div>-->
- <blockquote class="layui-elem-quote blue-border">滑点设置</blockquote>
- <div class="layui-row layui-col-space10 layui-form-item">
+<!-- <blockquote class="layui-elem-quote blue-border">滑点设置</blockquote>-->
+<!-- <div class="layui-row layui-col-space10 layui-form-item">-->
+<!--<!– <div class="layui-col-lg6">–>-->
+<!--<!– <label class="layui-form-label febs-form-item-require">钱包GFA:</label>–>-->
+<!--<!– <div class="layui-input-block">–>-->
+<!--<!– <input type="text" name="coinAmount" lay-verify="required" placeholder="" autocomplete="off" class="layui-input">–>-->
+<!--<!– </div>–>-->
+<!--<!– <div class="layui-word-aux" style="margin-left: 150px;">GFA滑点钱包的GFA数量</div>–>-->
+<!--<!– </div>–>-->
<!-- <div class="layui-col-lg6">-->
-<!-- <label class="layui-form-label febs-form-item-require">钱包GFA:</label>-->
+<!-- <label class="layui-form-label febs-form-item-require">钱包USDT:</label>-->
<!-- <div class="layui-input-block">-->
-<!-- <input type="text" name="coinAmount" lay-verify="required" placeholder="" autocomplete="off" class="layui-input">-->
+<!-- <input type="text" name="usdtAmount" lay-verify="required" placeholder="" autocomplete="off" class="layui-input">-->
<!-- </div>-->
-<!-- <div class="layui-word-aux" style="margin-left: 150px;">GFA滑点钱包的GFA数量</div>-->
+<!-- <div class="layui-word-aux" style="margin-left: 150px;">GFA滑点钱包的USDT数量</div>-->
<!-- </div>-->
- <div class="layui-col-lg6">
- <label class="layui-form-label febs-form-item-require">钱包USDT:</label>
- <div class="layui-input-block">
- <input type="text" name="usdtAmount" lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
- </div>
- <div class="layui-word-aux" style="margin-left: 150px;">GFA滑点钱包的USDT数量</div>
- </div>
- </div>
+<!-- </div>-->
<div class="layui-row layui-col-space10 layui-form-item">
<div class="layui-col-lg6">
<label class="layui-form-label febs-form-item-require">滑点级数:</label>
@@ -186,7 +186,7 @@
</div>
</div>
<div class="layui-card-footer">
- <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="coin-set-form-hdSubmit" id="hdSubmit">释放每日滑点</button>
+<!-- <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="coin-set-form-hdSubmit" id="hdSubmit">释放每日滑点</button>-->
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="coin-set-form-submit" id="submit">保存</button>
</div>
</div>
@@ -271,12 +271,12 @@
return false;
});
- $hdSubmit.on('click', function () {
- febs.modal.confirm('确认释放滑点', '确认释放滑点?', function () {
- febs.post(ctx + 'admin/banner/hdSubmit', function () {
- febs.alert.success('操作成功');
- });
- });
- });
+ // $hdSubmit.on('click', function () {
+ // febs.modal.confirm('确认释放滑点', '确认释放滑点?', function () {
+ // febs.post(ctx + 'admin/banner/hdSubmit', function () {
+ // febs.alert.success('操作成功');
+ // });
+ // });
+ // });
});
</script>
\ No newline at end of file
--
Gitblit v1.9.1