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/resources/templates/febs/views/modules/banner/coinPrice.html | 1498 +++++++++++++++++++++++++++++++++--------------------------
1 files changed, 842 insertions(+), 656 deletions(-)
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(() => {
--
Gitblit v1.9.1