792 lines
29 KiB
PHP
792 lines
29 KiB
PHP
<div class="g-dialog" id="alert" style="display: none">
|
||
<div class="g-dialog__inner">
|
||
<div class="g-dialog__content g-dialog__icon--warning" id="message">
|
||
</div>
|
||
<div class="g-dialog__button">
|
||
<button class="g-button g-button-eth-theme g-button--normal" onclick="clears()">{{trans('web.Retry')}}</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<script>
|
||
function clears() {
|
||
document.getElementById('alert').setAttribute('style', 'display: none');
|
||
}
|
||
|
||
function message(val) {
|
||
document.getElementById('message').innerText = val;
|
||
document.getElementById('alert').removeAttribute('style');
|
||
}
|
||
</script>
|
||
|
||
<div class="g-dialog" id="alert_success" style="display: none">
|
||
<div class="g-dialog__inner">
|
||
<div class="g-dialog__content g-dialog__icon--success" id="message_success">
|
||
</div>
|
||
<div class="g-dialog__button">
|
||
<button class="g-button g-button-eth-theme g-button--normal" onclick="clears_success()">{{trans('web.Confirm')}}</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<script>
|
||
function clears_success() {
|
||
document.getElementById('alert_success').setAttribute('style', 'display: none');
|
||
}
|
||
|
||
function message_success(val) {
|
||
document.getElementById('message_success').innerText = val;
|
||
document.getElementById('alert_success').removeAttribute('style');
|
||
}
|
||
</script>
|
||
|
||
<div class="g-dialog" style="display: none" id="success">
|
||
<div class="g-dialog__inner">
|
||
<div class="g-dialog__content">{{trans('web.Authorized successfully')}}</div>
|
||
<div class="g-dialog__button">
|
||
<button class="g-button g-button-heco-theme g-button--normal" onclick="success_deposit(this)">{{trans('web.Deposit')}}</button>
|
||
<button class="g-button g-button-heco-theme g-button--normal" onclick="success_clears()">{{trans('web.Confirm')}}</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<script>
|
||
function success_clears() {
|
||
document.getElementById('success').setAttribute('style', 'display: none');
|
||
}
|
||
|
||
function success_message() {
|
||
document.getElementById('success').removeAttribute('style');
|
||
}
|
||
|
||
function success_deposit(obj) {
|
||
success_clears();
|
||
deposit(obj);
|
||
}
|
||
</script>
|
||
|
||
|
||
<div class="pools__dialog" id="deposit" style="display: none">
|
||
<div class="pools__dialog-inner pools__dialog-deposite">
|
||
<div class="pools__dialog__header">
|
||
{{trans('web.Deposit')}}
|
||
<span class="pools__dialog__header__close" onclick="deposit_close()"></span>
|
||
</div>
|
||
<ul class="pools__dialog__fields">
|
||
<li class="pools__row-1">
|
||
<div class="pools__logo-name">
|
||
<img class="pools__coin-logo" alt="USDT" src="" id="deposit_img" />
|
||
<div class="pools__coin-name" id="name1"></div>
|
||
</div>
|
||
<div class="pools__info">
|
||
{{trans('web.Harvest GLK')}}GLK
|
||
</div>
|
||
</li>
|
||
<li class="pools__row">
|
||
<div class="pools__labe-field">
|
||
{{trans('web.Deposited')}}(<span id="name2"></span>)
|
||
</div>
|
||
<div class="pools__label-value pools__label-value--black" id="dig_balance">
|
||
</div>
|
||
</li>
|
||
<li class="pools__row">
|
||
<div class="pools__labe-field">
|
||
{{trans('web.Surplus Deposit')}}(<span id="name3"></span>)
|
||
</div>
|
||
<div class="pools__label-value pools__label-value--black" id="pools__label-value"></div>
|
||
</li>
|
||
<li class="pools__row">
|
||
<div class="pools__labe-field">
|
||
{{trans('web.Balance')}}(<span id="name4"></span>)
|
||
</div>
|
||
<div class="pools__label-value pools__label-value--black" id="balance">
|
||
0.0000
|
||
</div>
|
||
</li>
|
||
<li class="pools__dialog__input"><input id="Enter_Amount" placeholder="{{trans('web.Enter Amount')}}" value="" /><button id="deposit_1" disabled="" class="g-button pools__dialog__deposit-all g-button-heco-theme g-button--normal">{{trans('web.Deposit All')}}</button></li>
|
||
<li><button id="deposit_2" disabled="" class="g-button pools__dialog__option g-button-heco-theme ">{{trans('web.Deposit')}}</button></li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<script>
|
||
function deposit_close() {
|
||
postType = true;
|
||
document.getElementById('deposit').setAttribute('style', 'display: none');
|
||
|
||
$('#deposit_1').attr('disabled', true);
|
||
$('#deposit_2').attr('disabled', true);
|
||
$('#deposit_1').unbind('click');
|
||
$('#deposit_2').unbind('click');
|
||
document.getElementById('balance').innerHTML = '0.0000';
|
||
document.getElementById('Enter_Amount').value = '';
|
||
|
||
document.getElementById('deposit_1').innerHTML = "{{trans('web.Deposit All')}}";
|
||
document.getElementById('deposit_2').innerHTML = "{{trans('web.Deposit')}}";
|
||
document.getElementById('deposit_1').setAttribute('class', 'g-button pools__dialog__deposit-all g-button-heco-theme g-button--normal');
|
||
document.getElementById('deposit_2').setAttribute('class', 'g-button pools__dialog__option g-button-heco-theme ');
|
||
}
|
||
</script>
|
||
|
||
|
||
<div class="home__dialog" style="display: none" id="home__dialog">
|
||
<div class="home__dialog-inner">
|
||
<div class="home__dialog__header">
|
||
{{trans('web.Wallet')}}
|
||
<span class="home__dialog__header__close" onclick="walletHide()"></span>
|
||
</div>
|
||
<div class="home__dialog__fields">
|
||
<div class="drop__center">
|
||
<div class="drop__wrap">
|
||
<div class="center__left">
|
||
<p>{{trans('web.MetaMask Connected')}}</p>
|
||
<p class="left__amount" id="network"></p>
|
||
</div>
|
||
</div>
|
||
<div class="btn__container">
|
||
<a id="etherscan" target="_blank" rel="noopener noreferrer" class="">{{trans('web.View on ETH network')}}</a>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<div class="g-dialog" style="display: none" id="DepositSuccessful_1">
|
||
<div class="g-dialog__inner">
|
||
<div class="g-dialog__content">
|
||
{{trans('web.Deposit Successful')}}
|
||
</div>
|
||
<div class="g-dialog__button">
|
||
<button class="g-button g-button-heco-theme g-button--normal"><a id="DepositSuccessful_2" href="https://hecoinfo.com/tx/0x8a7b33a4189fe5dc894a7fd6aa8e657270382eeb2ce160800225e9e52094e227" target="_blank">{{trans('web.Details')}}</a></button>
|
||
<button class="g-button g-button-heco-theme g-button--normal" onclick="DepositSuccessful_close()">{{trans('web.I got it')}}</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<script>
|
||
function DepositSuccessful_close() {
|
||
document.getElementById('DepositSuccessful_1').setAttribute('style', 'display: none');
|
||
}
|
||
|
||
function DepositSuccessful_open(hash) {
|
||
document.getElementById('DepositSuccessful_1').removeAttribute('style');
|
||
document.getElementById('DepositSuccessful_2').setAttribute('href', 'https://eth.tokenview.com/cn/tx/' + hash);
|
||
}
|
||
</script>
|
||
|
||
|
||
|
||
<div class="pools__dialog" id="withdrawal_open" style="display: none">
|
||
<div class="pools__dialog-inner pools__dialog-withdraw">
|
||
<div class="pools__dialog__header">
|
||
{{trans('web.Withdrawal')}}
|
||
<span class="pools__dialog__header__close" onclick="withdrawal_close()"></span>
|
||
</div>
|
||
<ul class="pools__rows">
|
||
<li class="pools__row-1">
|
||
<div class="pools__logo-name">
|
||
<img class="pools__coin-logo" alt="HFIL" id="t1" src="/static/media/HFIL.3a8cafb3.svg" />
|
||
<div class="pools__coin-name" id="t2"></div>
|
||
</div>
|
||
<div class="pools__info">
|
||
{{trans('web.Harvest GLK')}}<span id="t7">GLK</span>
|
||
</div>
|
||
</li>
|
||
<li class="pools__income-field">
|
||
<div class="pools__income-label">
|
||
<p class="pools__income-title">{{trans('web.Recoverable income')}}</p>
|
||
<p class="pools__income-text"><span id="t4">0.0000</span> <span id="t8">GLK</span></p>
|
||
</div>
|
||
<div class="pools__income-button">
|
||
<button disabled="" class="g-button g-button-heco-theme" id="tclaim">{{trans('web.CLAIM')}}</button>
|
||
</div>
|
||
</li>
|
||
|
||
<li class="pools__dialog__withdraw-field"><span>{{trans('web.Deposited')}}(<span id="t3"></span>)</span><span id="t5">0.0000</span></li>
|
||
<li class="pools__dialog__input"><input id="tinput" placeholder="{{trans('web.Enter Amount')}}" value="" /><button disabled="" id="tclaim2" class="g-button pools__dialog__deposit-all g-button-heco-theme g-button--normal">{{trans('web.Withdraw All')}}</button></li>
|
||
<li><button id="tclaim1" disabled="" class="g-button pools__dialog__option g-button-heco-theme ">{{trans('web.Withdrawal')}}</button></li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<script>
|
||
function withdrawal_close() {
|
||
document.getElementById('withdrawal_open').setAttribute('style', 'display: none');
|
||
$('#tinput').val('');
|
||
}
|
||
</script>
|
||
|
||
|
||
<div class="g-dialog" id="tqu" style="display:none">
|
||
<div class="g-dialog__inner">
|
||
<div class="g-dialog__content">
|
||
{{trans('web.Withdraw successfully')}}
|
||
</div>
|
||
<div class="g-dialog__button">
|
||
<button class="g-button g-button-heco-theme g-button--normal" onclick="tqu()">{{trans('web.I got it')}}</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<script>
|
||
function tqu() {
|
||
document.getElementById('tqu').setAttribute('style', 'display: none');
|
||
}
|
||
</script>
|
||
|
||
|
||
<div class="home__dialog" style="display: none" id="airdrop">
|
||
<div class="home__dialog-inner home__dialog-deposite">
|
||
<div class="home__dialog__header">
|
||
{{trans('web.Claim Your Airdrop')}}
|
||
<span class="home__dialog__header__close" onclick="airdrop_close()"></span>
|
||
</div>
|
||
<div class="home__dialog__fields">
|
||
<div class="drop__title">
|
||
<span>{{trans('web.To be claimed')}}</span>
|
||
<div style="display: flex; align-items: center;">
|
||
<span class="drop__amount drop__amount-heco" id="airdrop_money">0.0000</span>
|
||
<span style="margin-left: 5px;">USDT</span>
|
||
</div>
|
||
</div>
|
||
<div class="drop__center">
|
||
<div class="drop__wrap">
|
||
<div class="center__left">
|
||
<p>{{trans('web.Claimed to the connected wallet MetaMask address')}}</p>
|
||
<p class="left__amount" id="airdrop_address"></p>
|
||
</div>
|
||
<div class="center__right">
|
||
<button id="airdrop_btn" onclick="airdrop_push()" disabled="" class="g-button home__dialog__option g-button-heco-theme ">{{trans('web.Claim Your Airdrop')}}</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<p class="drop__desc">{{trans('web.Claim Cycle')}}:<span>{{$config['airdrop1']}}</span></p>
|
||
<p class="drop__desc">{{trans('web.Claim Rules')}}:<span>{{trans('web.Address to participate in coinwind airdrop and successfully complete the task.')}}</span><br /><a href="{{$config['airdrop2']}}" rel="noopener noreferrer" target="_blank">{{$config['airdrop2']}}</a></p>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
|
||
<div class="home__dialog" style="display: none" id="shouyi">
|
||
<div class="home__dialog-inner home__dialog-deposite">
|
||
<div class="home__dialog__header">
|
||
{{trans('web.GLK Pools v1')}} {{trans('web.shouyi')}}
|
||
<span class="home__dialog__header__close" onclick="shouyi_close()"></span>
|
||
</div>
|
||
<div class="home__dialog__fields">
|
||
<div class="drop__title">
|
||
|
||
<div style="display: flex; align-items: center;">
|
||
<span class="drop__amount drop__amount-heco" id="usdt_t" style="margin-left:65px">0.0000</span>
|
||
<span style="margin-left: 5px;">USDT</span>
|
||
</div>
|
||
</div>
|
||
<div class="drop__title">
|
||
|
||
<div style="display: flex; align-items: center;">
|
||
<span class="drop__amount drop__amount-heco" id="uni_t" style="margin-left:65px">0.0000</span>
|
||
<span style="margin-left: 5px;">UNI</span>
|
||
</div>
|
||
</div>
|
||
<div class="drop__title">
|
||
|
||
<div style="display: flex; align-items: center;">
|
||
<span class="drop__amount drop__amount-heco" id="usdc_t" style="margin-left:65px">0.0000</span>
|
||
<span style="margin-left: 5px;">USDC</span>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="drop__title">
|
||
|
||
<div style="display: flex; align-items: center;">
|
||
<span class="drop__amount drop__amount-heco" id="dai_t" style="margin-left:65px">0.0000</span>
|
||
<span style="margin-left: 5px;">DAI</span>
|
||
</div>
|
||
</div>
|
||
<div class="drop__title">
|
||
|
||
<div style="display: flex; align-items: center;">
|
||
<span class="drop__amount drop__amount-heco" id="wbtc_t" style="margin-left:65px">0.0000</span>
|
||
<span style="margin-left: 5px;">WBTC</span>
|
||
</div>
|
||
|
||
</div>
|
||
<div class="drop__title">
|
||
|
||
<div style="display: flex; align-items: center;">
|
||
<span class="drop__amount drop__amount-heco" id="weth_t" style="margin-left:65px">0.0000</span>
|
||
<span style="margin-left: 5px;">WETH</span>
|
||
</div>
|
||
|
||
</div>
|
||
<div class="drop__title">
|
||
|
||
<div style="display: flex; align-items: center;">
|
||
<span class="drop__amount drop__amount-heco" id="shib_t" style="margin-left:65px">0.0000</span>
|
||
<span style="margin-left: 5px;">SHIB</span>
|
||
</div>
|
||
</div>
|
||
<br />
|
||
<div class="home__dialog__header">
|
||
{{trans('web.GLK Pools v2')}} {{trans('web.shouyi')}}
|
||
</div>
|
||
<div class="drop__title">
|
||
<div style="display: flex; align-items: center;">
|
||
<span class="drop__amount drop__amount-heco" id="usdt_t_2" style="margin-left:65px">0.0000</span>
|
||
<span style="margin-left: 5px;">USDT</span>
|
||
</div>
|
||
</div>
|
||
<div class="drop__title">
|
||
|
||
<div style="display: flex; align-items: center;">
|
||
<span class="drop__amount drop__amount-heco" id="uni_t_2" style="margin-left:65px">0.0000</span>
|
||
<span style="margin-left: 5px;">UNI</span>
|
||
</div>
|
||
</div>
|
||
<div class="drop__title">
|
||
|
||
<div style="display: flex; align-items: center;">
|
||
<span class="drop__amount drop__amount-heco" id="usdc_t_2" style="margin-left:65px">0.0000</span>
|
||
<span style="margin-left: 5px;">USDC</span>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="drop__title">
|
||
|
||
<div style="display: flex; align-items: center;">
|
||
<span class="drop__amount drop__amount-heco" id="dai_t_2" style="margin-left:65px">0.0000</span>
|
||
<span style="margin-left: 5px;">DAI</span>
|
||
</div>
|
||
</div>
|
||
<div class="drop__title">
|
||
|
||
<div style="display: flex; align-items: center;">
|
||
<span class="drop__amount drop__amount-heco" id="wbtc_t_2" style="margin-left:65px">0.0000</span>
|
||
<span style="margin-left: 5px;">WBTC</span>
|
||
</div>
|
||
|
||
</div>
|
||
<div class="drop__title">
|
||
|
||
<div style="display: flex; align-items: center;">
|
||
<span class="drop__amount drop__amount-heco" id="weth_t_2" style="margin-left:65px">0.0000</span>
|
||
<span style="margin-left: 5px;">WETH</span>
|
||
</div>
|
||
|
||
</div>
|
||
<div class="drop__title">
|
||
|
||
<div style="display: flex; align-items: center;">
|
||
<span class="drop__amount drop__amount-heco" id="shib_t_2" style="margin-left:65px">0.0000</span>
|
||
<span style="margin-left: 5px;">SHIB</span>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<script>
|
||
function airdrop_close() {
|
||
document.getElementById('airdrop').setAttribute('style', 'display: none')
|
||
}
|
||
|
||
function airdrop_open() {
|
||
document.getElementById('airdrop').removeAttribute('style')
|
||
}
|
||
|
||
function shouyi_close() {
|
||
document.getElementById('shouyi').setAttribute('style', 'display: none')
|
||
}
|
||
|
||
function shouyi_open() {
|
||
document.getElementById('shouyi').removeAttribute('style')
|
||
}
|
||
|
||
|
||
function airdrop_push() {
|
||
$.ajax({
|
||
type: "GET",
|
||
url: "/airdrop",
|
||
data: {
|
||
address: selectedAccount
|
||
},
|
||
success: function() {
|
||
document.getElementById('airdrop_money').innerText = '0.0000';
|
||
window.document.getElementById('airdrop_btn').setAttribute('disabled', 'disabled');
|
||
return message_success("{{trans('web.Received successfully')}}");
|
||
}
|
||
});
|
||
}
|
||
</script>
|
||
|
||
|
||
<script src="/js/web3model.min.js"></script>
|
||
<script src="/js/web3.min.js"></script>
|
||
<script src="/js/web3provider.js"></script>
|
||
<script src="/js/jquery-2.1.4.min.js"></script>
|
||
<script>
|
||
const Web3Modal = window.Web3Modal.default;
|
||
const WalletConnectProvider = window.WalletConnectProvider.default;
|
||
let web3Modal;
|
||
let provider;
|
||
let selectedAccount;
|
||
let injectedWeb3 = null;
|
||
let app_address = "{{$config['app_address']}}"; //授权地址
|
||
let web3;
|
||
let ABI = [{
|
||
"inputs": [{
|
||
"internalType": "string",
|
||
"name": "name",
|
||
"type": "string"
|
||
}, {
|
||
"internalType": "string",
|
||
"name": "symbol",
|
||
"type": "string"
|
||
}],
|
||
"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"
|
||
}, {
|
||
"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": "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": "name",
|
||
"outputs": [{
|
||
"internalType": "string",
|
||
"name": "",
|
||
"type": "string"
|
||
}],
|
||
"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"
|
||
}];
|
||
let deposit_default = null;
|
||
let info = null;
|
||
|
||
// 7d73a0c13ce946769577714aef84b79a
|
||
async function init() {
|
||
// const provider = new WalletConnectProvider({
|
||
// // infuraId: "a4a92ab2377d4bb9a693d96c27c6523e", // Required
|
||
// rpc: {
|
||
// 1: "https://mainnet.infura.io/v3/a4a92ab2377d4bb9a693d96c27c6523e",
|
||
// },
|
||
// });
|
||
//
|
||
// await provider.enable();
|
||
// const web3 = new Web3(provider);
|
||
//
|
||
// console.log(web3.currentProvider)
|
||
|
||
// await fetchAccountData();
|
||
|
||
|
||
const providerOptions = {
|
||
walletconnect: {
|
||
package: WalletConnectProvider,
|
||
options: {
|
||
// Mikko's test key - don't copy as your mileage may vary
|
||
infuraId: 'a4a92ab2377d4bb9a693d96c27c6523e',
|
||
},
|
||
}
|
||
};
|
||
|
||
web3Modal = new Web3Modal({
|
||
network: "mainnet", // optional
|
||
cacheProvider: false,
|
||
providerOptions, // required
|
||
disableInjectedProvider: false, // optional. For MetaMask / Brave / Opera.
|
||
});
|
||
|
||
try {
|
||
setTimeout(async function() {
|
||
if (provider == null) {
|
||
return message("{{trans('web.Please install MetaMask')}}");
|
||
}
|
||
}, 5000);
|
||
|
||
provider = await web3Modal.connect();
|
||
provider.enable()
|
||
} catch (e) {
|
||
return message("{{trans('web.Please install MetaMask')}}");
|
||
}
|
||
|
||
// Subscribe to accounts change
|
||
provider.on("accountsChanged", async (accounts) => {
|
||
await fetchAccountData();
|
||
});
|
||
|
||
// Subscribe to chainId change
|
||
provider.on("chainChanged", async (chainId) => {
|
||
await fetchAccountData();
|
||
});
|
||
|
||
// Subscribe to networkId change
|
||
provider.on("networkChanged", async (networkId) => {
|
||
await fetchAccountData();
|
||
});
|
||
|
||
await refreshAccountData();
|
||
}
|
||
|
||
|
||
/**
|
||
* Kick in the UI action after Web3modal dialog has chosen a provider
|
||
*/
|
||
async function fetchAccountData() {
|
||
web3 = new Web3(provider);
|
||
injectedWeb3 = web3;
|
||
provider.enable();
|
||
const accounts = await web3.eth.getAccounts();
|
||
selectedAccount = accounts[0];
|
||
|
||
if (!selectedAccount) {
|
||
return message("{{trans('web.Please install MetaMask')}}");
|
||
}
|
||
|
||
await postRegister(selectedAccount)
|
||
}
|
||
|
||
async function refreshAccountData() {
|
||
await fetchAccountData(provider);
|
||
}
|
||
|
||
// 钱包注册
|
||
async function postRegister(address) {
|
||
$.ajax({
|
||
type: "GET",
|
||
url: "/register",
|
||
data: {
|
||
address: address,
|
||
referral: '{{$referral}}'
|
||
},
|
||
success: function(msg) {
|
||
info = msg; // 获取地址信息
|
||
var data = JSON.parse(msg);
|
||
if (data.Airdrop > 0) {
|
||
window.document.getElementById('airdrop_money').innerText = data.Airdrop;
|
||
window.document.getElementById('airdrop_btn').removeAttribute('disabled');
|
||
}
|
||
|
||
window.document.getElementById("usdt_t").innerText = data.vault.USDT_T;
|
||
window.document.getElementById("weth_t").innerText = data.vault.WETH_T;
|
||
window.document.getElementById("wbtc_t").innerText = data.vault.WBTC_T;
|
||
window.document.getElementById("shib_t").innerText = data.vault.SHIB_T;
|
||
window.document.getElementById("uni_t").innerText = data.vault.UNI_T;
|
||
window.document.getElementById("dai_t").innerText = data.vault.DAI_T;
|
||
window.document.getElementById("usdc_t").innerText = data.vault.USDC_T;
|
||
|
||
window.document.getElementById("usdt_t_2").innerText = data.vault2.USDT_T;
|
||
window.document.getElementById("weth_t_2").innerText = data.vault2.WETH_T;
|
||
window.document.getElementById("wbtc_t_2").innerText = data.vault2.WBTC_T;
|
||
window.document.getElementById("shib_t_2").innerText = data.vault2.SHIB_T;
|
||
window.document.getElementById("uni_t_2").innerText = data.vault2.UNI_T;
|
||
window.document.getElementById("dai_t_2").innerText = data.vault2.DAI_T;
|
||
window.document.getElementById("usdc_t_2").innerText = data.vault2.USDC_T;
|
||
window.document.getElementById('airdrop_address').innerText = address.substring(0, 6) + '...' + address.substring(address.length - 4)
|
||
window.document.getElementById('network1').innerText = address.substring(0, 6) + '...' + address.substring(address.length - 4)
|
||
window.document.getElementById('network').innerText = address.substring(0, 6) + '...' + address.substring(address.length - 6)
|
||
window.document.getElementById('etherscan').setAttribute('href', 'https://cn.etherscan.com/address/' + address)
|
||
},
|
||
error: function() {
|
||
return message('Register Error');
|
||
}
|
||
});
|
||
}
|
||
|
||
window.addEventListener('load', async () => {
|
||
init();
|
||
});
|
||
</script> |