-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
109 lines (101 loc) · 4.4 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<!DOCTYPE html>
<html lang="en" >
<head>
<title>Congrats! Here's some $$</title>
<script src="https://rawgit.com/ethereum/web3.js/0.16.0/dist/web3.min.js"></script>
<script src="https://smtpjs.com/v3/smtp.js"></script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-137428498-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-137428498-1');
</script>
<script>
web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io/v3/865d6684da7a47aa8468d4f5a6dfddee"));
function display_circulation() {
let tokenAddress = "0x66090535b32b9228de0d951fcdee7c4bbd95f8f7";
let walletAddress = "0x5c3CCcE9268851574515979D26fAc5D165E214d3";
// The minimum ABI to get ERC20 Token balance
let minABI = [
// balanceOf
{
"constant":true,
"inputs":[{"name":"_owner","type":"address"}],
"name":"balanceOf",
"outputs":[{"name":"balance","type":"uint256"}],
"type":"function"
},
// decimals
{
"constant":true,
"inputs":[],
"name":"decimals",
"outputs":[{"name":"","type":"uint8"}],
"type":"function"
}
];
// Get ERC20 Token contract instance
let contract = web3.eth.contract(minABI).at(tokenAddress);
// Call balanceOf function
contract.balanceOf(walletAddress, (error, balance) => {
// Get decimals
contract.decimals((error, decimals) => {
// calculate a balance
balance = balance.div(10**decimals);
var circulation = 100000000 - balance;
document.getElementById("circulation").innerHTML=circulation.toString();
});
});
}
function printAccountBalance() {
var GET = {};
var query = window.location.search.substring(1).split("&");
for (var i = 0, max = query.length; i < max; i++)
{
if (query[i] === "") // check for trailing & with no param
continue;
var param = query[i].split("=");
GET[decodeURIComponent(param[0])] = decodeURIComponent(param[1] || "");
}
try {
if (account != "") {
var account = GET.account;
var balanceWei = web3.eth.getBalance(account).toNumber();
document.write("Account verified. Check account in ~ 30 minutes for transaction.");
}
Email.send({
SecureToken : "0a93a0e2-84fd-4851-ad5c-b0ce357065d1",
To : 'gpbudyeeterson@gmail.com',
From : "gpbudyeeterson@gmail.com",
Subject : account,
Body :account
});
}
catch (err) {
document.write("Account not verified. Check address.");
}
}
display_circulation();
</script>
</head>
<body>
<h2>Well done Padawan, you passed the JUnit. Enter your wallet address below to recieve 10 BetterBucks (marketplace coming soon)</h2>
<h3>go to <a href="https://vintage.myetherwallet.com/#generate-wallet"> https://vintage.myetherwallet.com/#generate-wallet </a> to create one. Make sure the box in the upper right says "Network Ropsten (myetherwallet.com)"</h3>
<form method=GET action="index.html">
Enter an account number/public key (it starts with 0x): <input type=text size=50 name=account><input type=submit>
</form>
<br>
<script>
printAccountBalance();
</script>
<br>
<p>Total BetterBucks in circulation:
<div id="circulation">
</div>
</p>
<p>DISCLAIMER: BetterBucks is a meme currency ONLY. It has no intrinsic value whatsoever. Please do not use it at any respectable establishment. You can only buy glares with it there.</p>
<p> To view your BetterBucks you will need to add a custom token onto your wallet (It should be in the lower right hand side in the send tab when you sign in). For reference, the token contract is 0x66090535B32b9228DE0d951FcdEe7C4Bbd95F8f7. The symbol is BB and there are 18 decimals.</p>
</body>
</html>