-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmercurius.html
48 lines (37 loc) · 1.24 KB
/
mercurius.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
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="web3.js"></script>
<script type="text/javascript" src="contractABI.js"></script>
<script type="text/javascript">
var Web3 = require('web3');
var httpProvider = 'http://10.217.2.141:9545';
var contractAddress = '0xf12b5dd4ead5f743c6baa640b0216200e89b60da';
var ownerAddress = '0x627306090abab3a6e1400e9345bc60c78a8bef57';
if (typeof web3 !== 'undefined') {
web3 = new Web3(web3.currentProvider);
} else {
web3 = new Web3(new Web3.providers.HttpProvider(httpProvider));
}
var contract = web3.eth.contract(contractABI);
var contractInstance = contract.at(contractAddress);
var balance = contractInstance.balanceOf(ownerAddress);
balance = balance.toString(10);
console.log(balance);
// iterate algo loop
for (var i = 0; i < balance; i++) {
var strategy = contractInstance.getStrategy(ownerAddress, i);
console.log(strategy);
}
// Smart Contract Event
var mint = contractInstance.Mint();
mint.watch(function (error, result) {
if (error) {
console.error(error);
} else {
console.log(result);
}
});
</script>
</head>
</html>