-
Notifications
You must be signed in to change notification settings - Fork 0
/
circ.html
49 lines (43 loc) · 2.14 KB
/
circ.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
<!DOCTYPE html>
<html>
<body>
<span id="circSupply"></span>
<script>
window.addEventListener('load', octoCircSupply);
function octoCircSupply() {
Promise.all([
// get total supply
fetch('https://api.etherscan.io/api?module=stats&action=tokensupply&contractaddress=0x7240ac91f01233baaf8b064248e80feaa5912ba3&apikey=8YEHP7JBGSKZGT8DZV6K1XFGYN6TDDHZD1'),
// get interest program
fetch('https://api.etherscan.io/api?module=account&action=tokenbalance&contractaddress=0x7240ac91f01233baaf8b064248e80feaa5912ba3&address=0xb51d93791e19d8cf1fdf1851aa97e7695a9135c0&tag=latest&apikey=8YEHP7JBGSKZGT8DZV6K1XFGYN6TDDHZD1'),
// get interest program deposits
fetch('https://api.etherscan.io/api?module=account&action=tokenbalance&contractaddress=0x7240ac91f01233baaf8b064248e80feaa5912ba3&address=0x0A4E9F69F5B2E1e661da9Ed98956f928200ea4Ba&tag=latest&apikey=8YEHP7JBGSKZGT8DZV6K1XFGYN6TDDHZD1'),
// get sent to contract and lost forever
fetch('https://api.etherscan.io/api?module=account&action=tokenbalance&contractaddress=0x7240ac91f01233baaf8b064248e80feaa5912ba3&address=0x7240ac91f01233baaf8b064248e80feaa5912ba3&tag=latest&apikey=8YEHP7JBGSKZGT8DZV6K1XFGYN6TDDHZD1'),
// get project reserve
fetch('https://api.etherscan.io/api?module=account&action=tokenbalance&contractaddress=0x7240ac91f01233baaf8b064248e80feaa5912ba3&address=0xD06777d9b02F677214073cC3C5338904CBa7894a&tag=latest&apikey=8YEHP7JBGSKZGT8DZV6K1XFGYN6TDDHZD1')
])
.then(function (responses) {
// Get a JSON object from each of the responses
return Promise.all(responses.map(function (response) {
return response.json();
}));
})
.then(function (data) {
// Log the data to the console
console.log(data);
// Calc circ supply
let circSupplyGwei = data[0]['result'] - data[1]['result'] - data[2]['result'] - data[3]['result'] - data[4]['result'];
let circSupply = circSupplyGwei/1000000000000000000;
console.log("circSupply : "+ circSupply);
let circSupplyContainer = document.getElementById('circSupply')
circSupplyContainer.innerHTML = `${circSupply}`;
})
.catch(function (error) {
// if there's an error, log it
console.log(error);
});
}
</script>
</body>
</html>