-
Notifications
You must be signed in to change notification settings - Fork 2
/
2019_1574342245046.html
159 lines (148 loc) · 13.5 KB
/
2019_1574342245046.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<!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>2019普华科技大会</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
<style type="text/css">
button {
background-color: #000;
color: #fff;
border: 0;
font-size: 1em;
}
</style>
</head>
<body>
<div class="container">
<br/>
<div class="jumbotron">
<p class="lead" id="greeting">请稍等 。。。</p>
<hr/>
<form id="form">
<div class="form-group">
<label for="name">您的姓名</label>
<input type="text" class="form-control" id="name" placeholder="">
</div>
<button type="button" id="submit" class="btn btn-primary">发送</button>
</form>
<div id="formSubmitted" style="display:none">共识上链中,请等 20 秒 ...</div>
<p id="me" style="display:none"><span id="myname" class="badge badge-info"></span> 已经签到。谢谢</p>
</div>
<h4>已经签到</h4>
<table class="table table-striped">
<thead>
<tr>
<th scope="col">姓名</th>
<th scope="col">单位</th>
</tr>
</thead>
<tbody id="checkins">
</tbody>
</table>
<p style="text-align:center">永久记录在 <a target="_blank" href="https://app.cybermiles.io/">CyberMiles</a> 电商公链</p>
</div>
<script type="text/javascript">
window.BuidlProviders = {
web3: {
url: "https://rpc.cybermiles.net.cn:8545",
chainId: "18",
gasPrice: "5000000000",
gasLimit: "8000000",
},
es: {
url: "https://cmt.search.secondstate.io"
}
}
</script>
<script type="text/javascript" src="https://buidl.secondstate.io/embed/main.js"></script>
<script src="https://code.jquery.com/jquery-3.4.1.js"></script>
<script type="text/javascript">
/* Don't modify */
var abi = [{"constant":true,"inputs":[],"name":"success","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getAddrs","outputs":[{"name":"","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_addr","type":"address"}],"name":"getCheckin","outputs":[{"name":"","type":"string"},{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_name","type":"string"},{"name":"_organization","type":"string"}],"name":"addCheckin","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_greeting","type":"string"},{"name":"_success","type":"string"}],"name":"setGreeting","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"greeting","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getGreeting","outputs":[{"name":"","type":"string"},{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_greeting","type":"string"},{"name":"_success","type":"string"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"}];
var bytecode = '608060405234801561001057600080fd5b50604051610eae380380610eae8339810180604052810190808051820192919060200180518201929190505050336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600190805190602001906100939291906100b2565b5080600290805190602001906100aa9291906100b2565b505050610157565b82805460018160011615610100020d166002900490600052602060002090601f016020900481019282601f106100f357805160ff1916838001178555610121565b82800160010185558215610121579182015b82811115610120578251825591602001919060010190610105565b5b50905061012e9190610132565b5090565b61015491905b80821115610150576000816000905550600101610138565b5090565b90565b610d48806101666000396000f300608060405260043610610083576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630b93381b146100885780633f416eb3146101185780637b263a0e146101845780637cf158ac146102ac578063d4e107291461035b578063ef690cc01461040a578063fe50cc721461049a575b600080fd5b34801561009457600080fd5b5061009d610596565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100dd5780820151818401526020810190506100c2565b50505050905090810190601f16801561010a5780820d805160018360200d6101000a0d1916815260200191505b509250505060405180910390f35b34801561012457600080fd5b5061012d610634565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610170578082015181840152602081019050610155565b505050509050019250505060405180910390f35b34801561019057600080fd5b506101c5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506106c2565b604051808060200180602001838103835285818151815260200191508051906020019080838360005b838110156102095780820151818401526020810190506101ee565b50505050905090810190601f1680156102365780820d805160018360200d6101000a0d1916815260200191505b50838103825284818151815260200191508051906020019080838360005b8381101561026f578082015181840152602081019050610254565b50505050905090810190601f16801561029c5780820d805160018360200d6101000a0d1916815260200191505b5094505050505060405180910390f35b3480156102b857600080fd5b50610359600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505061088a565b005b34801561036757600080fd5b50610408600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610985565b005b34801561041657600080fd5b5061041f610a12565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561045f578082015181840152602081019050610444565b50505050905090810190601f16801561048c5780820d805160018360200d6101000a0d1916815260200191505b509250505060405180910390f35b3480156104a657600080fd5b506104af610ab0565b604051808060200180602001838103835285818151815260200191508051906020019080838360005b838110156104f35780820151818401526020810190506104d8565b50505050905090810190601f1680156105205780820d805160018360200d6101000a0d1916815260200191505b50838103825284818151815260200191508051906020019080838360005b8381101561055957808201518184015260208101905061053e565b50505050905090810190601f1680156105865780820d805160018360200d6101000a0d1916815260200191505b5094505050505060405180910390f35b6002805460018160011615610100020d166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020d1660029004801561062c5780601f106106015761010080835404028352916020019161062c565b820191906000526020600020905b81548152906001019060200180831161060f5782900d601f168201915b505050505081565b606060048054806020026020016040519081016040528092919081815260200182805480156106b857602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001906001019080831161066e575b5050505050905090565b606080600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181805460018160011615610100020d166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020d166002900480156107de5780601f106107b3576101008083540402835291602001916107de565b820191906000526020600020905b8154815290600101906020018083116107c15782900d601f168201915b5050505050915080805460018160011615610100020d166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020d1660029004801561087a5780601f1061084f5761010080835404028352916020019161087a565b820191906000526020600020905b81548152906001019060200180831161085d5782900d601f168201915b5050505050905091509150915091565b604080519081016040528083815260200182815250600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000190805190602001906108fa929190610bf7565b506020820151816001019080519060200190610917929190610bf7565b5090505060043390806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109e057600080fd5b81600190805190602001906109f6929190610c77565b508060029080519060200190610a0d929190610c77565b505050565b6001805460018160011615610100020d166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020d16600290048015610aa85780601f10610a7d57610100808354040283529160200191610aa8565b820191906000526020600020905b815481529060010190602001808311610a8b5782900d601f168201915b505050505081565b6060806001600281805460018160011615610100020d166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020d16600290048015610b4c5780601f10610b2157610100808354040283529160200191610b4c565b820191906000526020600020905b815481529060010190602001808311610b2f5782900d601f168201915b5050505050915080805460018160011615610100020d166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020d16600290048015610be85780601f10610bbd57610100808354040283529160200191610be8565b820191906000526020600020905b815481529060010190602001808311610bcb5782900d601f168201915b50505050509050915091509091565b82805460018160011615610100020d166002900490600052602060002090601f016020900481019282601f10610c3857805160ff1916838001178555610c66565b82800160010185558215610c66579182015b82811115610c65578251825591602001919060010190610c4a565b5b509050610c739190610cf7565b5090565b82805460018160011615610100020d166002900490600052602060002090601f016020900481019282601f10610cb857805160ff1916838001178555610ce6565b82800160010185558215610ce6579182015b82811115610ce5578251825591602001919060010190610cca565b5b509050610cf39190610cf7565b5090565b610d1991905b80821115610d15576000816000905550600101610cfd565b5090565b905600a165627a7a723058207e64cf7f86fd64f96ce828d71c0ed86832d178ab5f3e80a581b4f1016585e4780029';
var cAddr = '0x61b06d132c55b3446ec747479a3c99da615cb182';
/* Don't modify */
var instance = null;
window.addEventListener('web3Ready', function() {
var contract = web3.ss.contract(abi);
instance = contract.at(cAddr);
reload();
});
var names = {
'Michael Yuan' : 'Second State',
'胡晓维' : 'Second State'
};
function reload() {
var greeting = "";
var success = "";
instance.getGreeting(function (e, r) {
greeting = r[0];
success = r[1];
console.log(greeting);
$("#greeting").html(greeting);
});
$("#formSubmitted").css("display", "none");
$("#me").css("display", "none");
web3.ss.getAccounts(function (e, address) {
if (!e) {
instance.getCheckin(address, function (ee, result) {
if (result[0]) {
$("#greeting").html(success);
$("#form").css("display", "none");
$("#me").css("display", "block");
$("#myname").html(result[0]);
}
});
var checkins = "";
instance.getAddrs(function (ee, addrs) {
addrs.forEach(function(addr) {
instance.getCheckin(addr, function (ee, r) {
if (!ee) {
var content = $("#checkins").html();
if (content.indexOf(r[0])!==-1 && content.indexOf(r[1])!==-1) {
// skip
} else {
checkins = checkins + "<tr><td>" + r[0] + "</td><td>" + r[1] + "</td></tr>";
$("#checkins").html(checkins);
}
}
});
});
});
$("#checkins").html(checkins);
}
});
}
$("#submit").click(function() {
var n = $("#name").val().trim();
var o = names[n];
if (!n) {
alert("请输入姓名");
return false;
}
web3.ss.getAccounts(function (e, address) {
if (!e) {
if (confirm("确认签到 " + n + " [" + o + "]")) {
$("#formSubmitted").css("display", "block");
instance.addCheckin (n, o, {
gas: 499000,
gasPrice: 0
}, function (ee, r) {
if (ee) {
window.alert("Failed at " + address);
}
});
setTimeout(function () {
reload ();
}, 20 * 1000);
}
}
});
return false;
});
</script>
</body>
</html>