| | |
| | | <div class="layui-card"> |
| | | <div class="layui-card-body febs-table-full"> |
| | | <form class="layui-form layui-table-form" lay-filter="user-table-form"> |
| | | <div class="layui-row"> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <span></span> |
| | | <span>点击刷新获取最新价格:</span> |
| | | <div class="layui-form-item"> |
| | | <div class="layui-col-md10"> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label layui-form-label-sm">开始时间</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" name="startTime" id="febs-form-group-date-start" lay-verify="date" |
| | | placeholder="yyyy-MM-dd HH:mm:ss" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-input-inline"> |
| | | <span id="countdown"></span> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label layui-form-label-sm">结束时间</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" name="endTime" id="febs-form-group-date-end" lay-verify="date" |
| | | placeholder="yyyy-MM-dd HH:mm:ss" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area"> |
| | | <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="reset"> |
| | | <i class="layui-icon"></i> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area"> |
| | | <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain table-action" id="query"> |
| | | <i class="layui-icon"></i> |
| | | </div> |
| | | <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="reset"> |
| | | <i class="layui-icon"></i> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </form> |
| | | <table lay-filter="coinPriceTable" lay-data="{id: 'coinPriceTable'}"></table> |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <script type="text/html" id="isJump"> |
| | | {{# |
| | | var isJump = { |
| | | 2: {title: '否', color: 'red' }, |
| | | 1: {title: '是' , color: 'green'} |
| | | }[d.isJump]; |
| | | }} |
| | | <span class="layui-badge febs-bg-{{isJump.color}}">{{ isJump.title }}</span> |
| | | </script> |
| | | <script type="text/html" id="isInside"> |
| | | {{# |
| | | var isInside = { |
| | | 2: {title: '外' , color: 'green'}, |
| | | 1: {title: '内', color: 'red'} |
| | | }[d.isInside]; |
| | | }} |
| | | <span class="layui-badge febs-bg-{{isInside.color}}">{{ isInside.title }}</span> |
| | | </script> |
| | | <script type="text/html" id="showPort"> |
| | | {{# |
| | | var showPort = { |
| | | 2: {title: '手机' , color: 'green'}, |
| | | 1: {title: 'pc', color: 'red'} |
| | | }[d.showPort]; |
| | | }} |
| | | <span class="layui-badge febs-bg-{{showPort.color}}">{{ showPort.title }}</span> |
| | | </script> |
| | | <script type="text/html" id="isTop"> |
| | | {{# |
| | | var isTop = { |
| | | 2: {title: '否', color: 'red' }, |
| | | 1: {title: '是' , color: 'green'} |
| | | }[d.isTop]; |
| | | }} |
| | | <span class="layui-badge febs-bg-{{isTop.color}}">{{ isTop.title }}</span> |
| | | </script> |
| | | <!-- 表格操作栏 start --> |
| | | <script type="text/html" id="user-option"> |
| | | <!-- <span shiro:lacksPermission="user:view,user:update,user:delete">--> |
| | | <!-- <span class="layui-badge-dot febs-bg-orange"></span> 无权限--> |
| | | <!-- </span>--> |
| | | <!-- <a lay-event="edit" shiro:hasPermission="user:update">编辑--> |
| | | <a lay-event="edit">编辑 |
| | | <i class="layui-icon febs-edit-area febs-blue"></i> |
| | | </a> |
| | | <!-- <a lay-event="delete" shiro:hasPermission="user:update">删除--> |
| | | <a lay-event="delete">删除 |
| | | <i class="layui-icon febs-edit-area febs-blue"></i> |
| | | </a> |
| | | </script> |
| | | <!-- 表格操作栏 end --> |
| | | <script data-th-inline="none" type="text/javascript"> |
| | | // 引入组件并初始化 |
| | | layui.use(['dropdown', 'jquery', 'laydate', 'form', 'table', 'febs'], function () { |
| | | layui.use(['dropdown', 'jquery', 'laydate', 'form', 'table', 'febs','laydate'], function () { |
| | | var $ = layui.jquery, |
| | | laydate = layui.laydate, |
| | | febs = layui.febs, |
| | |
| | | table = layui.table, |
| | | dropdown = layui.dropdown, |
| | | $view = $('#febs-coin-price'), |
| | | $query = $view.find('#query'), |
| | | $reset = $view.find('#reset'), |
| | | $add = $view.find('#add'), |
| | | $searchForm = $view.find('form'), |
| | | sortObject = {field: 'spread', type: null}, |
| | | laydate = layui.laydate, |
| | | tableIns |
| | | ; |
| | | |
| | | //日期范围 |
| | | laydate.render({ |
| | | elem: '#febs-form-group-date-start',type: 'datetime' |
| | | }); |
| | | |
| | | laydate.render({ |
| | | elem: '#febs-form-group-date-end',type: 'datetime' |
| | | }); |
| | | form.render(); |
| | | |
| | | // 表格初始化 |
| | |
| | | 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); |
| | | }); |
| | | |
| | | // 查询按钮 |
| | | $query.on('click', function () { |
| | | var params = $.extend(getQueryParams(), {field: sortObject.field, order: sortObject.type}); |
| | | tableIns.reload({where: params, page: {curr: null}}); |
| | | }); |
| | | |
| | | // 刷新按钮 |
| | | $reset.on('click', function () { |
| | | $searchForm[0].reset(); |
| | | sortObject.type = 'null'; |
| | | tableIns.reload({where: getQueryParams(), page: {curr: null}, initSort: sortObject}); |
| | | |
| | | // getPrice(tokens.tokenA,tokens.tokenB).then(price => { |
| | | // coinPriceAdd(amount); |
| | | // }); |
| | | }); |
| | | // $reset.on('click', function () { |
| | | // // 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}); |
| | | // |
| | | // // getPrice(tokens.tokenA,tokens.tokenB).then(price => { |
| | | // // coinPriceAdd(amount); |
| | | // // }); |
| | | // }); |
| | | |
| | | // 获取查询参数 |
| | | function getQueryParams() { |
| | | return {}; |
| | | let startTimestr = $searchForm.find('input[name="startTime"]').val().trim(); |
| | | let endTimeStr = $searchForm.find('input[name="endTime"]').val().trim(); |
| | | if(startTimestr != '' && endTimeStr != '' && startTimestr >= endTimeStr){ |
| | | febs.alert.warn('开始时间需要小于结束时间'); |
| | | return{}; |
| | | } |
| | | return { |
| | | startTime: $searchForm.find('input[name="startTime"]').val().trim(), |
| | | endTime: $searchForm.find('input[name="endTime"]').val().trim() |
| | | }; |
| | | } |
| | | |
| | | function initTable() { |
| | | tableIns = febs.table.init({ |
| | | elem: $view.find('table'), |
| | | id: 'coinPriceTable', |
| | | url: ctx + 'admin/banner/coinPrice', |
| | | totalRow : true, |
| | | url: ctx + 'admin/banner/hdRecord', |
| | | cols: [[ |
| | | // {field: 'id', title: '', minWidth: 10,align:'left'}, |
| | | {field: 'price', title: '价格', minWidth: 120,align:'center'}, |
| | | {field: 'id', title: '', minWidth: 10,align:'left',totalRowText:"合计"}, |
| | | {field: 'transactionHash', title: '交易HASH', minWidth: 300,align:'left'}, |
| | | {field: 'coinEvery', title: '滑点', minWidth: 120,align:'center', totalRow:true}, |
| | | {field: 'price', title: '价格', minWidth: 120,align:'center', totalRow:true}, |
| | | {field: 'usdtEvery', title: '滑点USDT', minWidth: 120,align:'center', totalRow:true}, |
| | | {field: 'createTime', title: '时间', minWidth: 120,align:'center'}, |
| | | ]] |
| | | }); |
| | |
| | | } |
| | | |
| | | // 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(() => { |