forked from wavesaber/messageintheblockchain
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
85 lines (69 loc) · 3.14 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
<!DOCTYPE html>
<html>
<head>
<title>Message in the blockchain</title>
<meta charset="UTF-8"/>
<link rel="stylesheet" href="css/style2.css">
</head>
<body background="bg.jpg">
<div id="meta-mask-required"></div>
<div class="bufferTop"></div>
<h1>THE BACKBONE OF BULLSHIT IS HERE</h1>
<section class="subtitle">
Blockchained. Expensive. Legit
</section>
<div class="bufferBottomSmall"></div>
<section>
<div class="messageBG">
<div class="message" id='currentText'></div>
</div>
</section>
<div class="bufferBottom"></div>
<section id="inputElements" class="money">
<h2>Put your message here by paying more than the previous idiot. It's all on the blockchain.</h2>
<input type="text" id="inputText" , placeholder="Put your fucking message here..."></input>
<div>
<div style="display:flex; flex-direction:row; justify-content: space-around">
<button onclick="send()" id="blueB">Blockchain it!</button>
<button onclick="send()" id="greenB">I'm feeling lucky</button>
</div>
<h2 id='mostSent'>placeholder $$$</h2>
</div>
</section>
<div class="whitePaper">
<a href="./whitepaper.pdf" ; style="color:white"> Whitepaper </a>
</div>
<script src="https://cdn.rawgit.com/ethereum/web3.js/develop/dist/web3.js"></script>
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js"></script>
<script src="app.js"></script>
<script>
// document.addEventListener('DOMContentLoaded', function() {
// });
window.onload = function () {
}
function send() {
if (typeof web3 === 'undefined') {
alert('You need the https://metamask.io/ browser plugin to be able to experience the blockchain vibes :)')
}
else {
var amount = window.prompt("ETH:")
inputText = document.getElementById("inputText").value
if (inputText.length > 50) {
alert("Maximum text size is 50 characters!")
} else {
abi = JSON.parse('[ { "constant": false, "inputs": [ { "name": "newText", "type": "string" } ], "name": "setText", "outputs": [ { "name": "", "type": "bool" } ], "payable": true, "stateMutability": "payable", "type": "function" }, { "constant": true, "inputs": [], "name": "mostSent", "outputs": [ { "name": "", "type": "uint256", "value": "1000000000000000000" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "currentText", "outputs": [ { "name": "", "type": "string", "value": "awefjasdfaj" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" }, { "payable": true, "stateMutability": "payable", "type": "fallback" } ]')
contractInstance = web3.eth.contract(abi).at('0x631c0D6f503C900e969C14d80A61D94e34cb0899');
contractInstance.setText(inputText, {
from: web3.eth.accounts[0],
gas: 4000000,
gasPrice: web3.toWei('2', 'gwei'),
value: amount * 10 ** 18
}, function (error, a) {
console.log(error, a)
})
}
}
}
</script>
</body>
</html>