-
Notifications
You must be signed in to change notification settings - Fork 2
/
1_1569551377651.html
61 lines (56 loc) · 2.32 KB
/
1_1569551377651.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>1</title>
<style type="text/css">
button {
background-color: #000;
color: #fff;
border: 0;
font-size: 1em;
}
</style>
</head>
<body>
<button id="s">Set Data</button>
<button id="g">Get Data</button>
<script type="text/javascript">
window.BuidlProviders = {
web3: {
url: "MetaMask",
chainId: "0",
gasPrice: "0",
gasLimit: "8192000000",
},
es: {
url: "https://devchain.ss.search.secondstate.io"
}
}
</script>
<script type="text/javascript" src="http://localhost:8081/embed/index.js"></script>
<script type="text/javascript">
/* Don't modify */
var abi = [{"constant":false,"inputs":[{"name":"x","type":"uint256"}],"name":"set","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"get","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}];
var bytecode = '608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a72305820059f37cec42b77564cde89caa635fe7ef4cc9b16595b3c715387bd950e3ed2490029';
var contract = web3.ss.contract(abi);
var instance = contract.at('0x062374180fd8ebb4ce0187109b12e9d3706d4e24');
/* Don't modify */
// esss.shaAbi(JSON.stringify(abi)).then((shaResult) => {
// var sha = JSON.parse(shaResult).abiSha3;
// esss.searchUsingAbi(sha).then((searchResult) => {
// console.log(searchResult);
// });
// });
document.querySelector("#s").addEventListener("click", function() {
var n = window.prompt("Enter the number:");
n && instance.set(n);
});
document.querySelector("#g").addEventListener("click", function() {
console.log(instance.get((e,d)=>console.log(e,d.toString())));
});
</script>
</body>
</html>