|
1 |
| -contract('Conference', function(accounts) { |
2 |
| - console.log(accounts); |
3 |
| - var owner_account = accounts; |
| 1 | +metamaskIsInstalled(); |
| 2 | + |
| 3 | +console.log(web3.isConnected()); |
| 4 | + |
| 5 | +abi = JSON.parse('[{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"registrantsPaid","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"organizer","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"recipient","type":"address"},{"name":"amount","type":"uint256"}],"name":"refundTicket","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"destroy","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"newquota","type":"uint256"}],"name":"changeQuota","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"quota","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"numRegistrants","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"buyTicket","outputs":[],"payable":false,"type":"function"},{"inputs":[],"payable":false,"type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_from","type":"address"},{"indexed":false,"name":"_amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_to","type":"address"},{"indexed":false,"name":"_amount","type":"uint256"}],"name":"Refund","type":"event"}]'); |
| 6 | +var Conference = web3.eth.contract(abi); |
| 7 | +var contractAddress = '0x7fe180e63198e50057c3f2817d058e8904c650e3'; |
| 8 | +var contractInstance = Conference.at(contractAddress); |
| 9 | + |
| 10 | +var etherscanTxUrl = "https://etherscan.io/tx/0x57d9096861063b468194362d08cf7bffca656ea62db3c4cdaa558c124f2311db"; |
| 11 | +var etherscanUrl = "https://etherscan.io/address/0x7fe180e63198e50057c3f2817d058e8904c650e3#code"; |
| 12 | + |
| 13 | + |
| 14 | +web3.version.getNetwork((err, netId) => { |
| 15 | + switch (netId) { |
| 16 | + case "1": |
| 17 | + $('#network').text(""); |
| 18 | + contractAddress = '0x7fe180e63198e50057c3f2817d058e8904c650e3'; |
| 19 | + break; |
| 20 | + case "2": |
| 21 | + alert('This is the deprecated Morden test network.'); |
| 22 | + break; |
| 23 | + case "3": |
| 24 | + $('#network').text("ROPSTEN TEST NETWORK"); |
| 25 | + contractAddress = '0xec4e3a1ad06a2ebdc462eaf6bf361404676a441f'; |
| 26 | + contractInstance = Conference.at(contractAddress); |
| 27 | + etherscanTxUrl = "https://ropsten.etherscan.io/tx/0x88799ff0c66cb9e95df05f968c3a8bce86bd50c1774ba29d6eadea7138f5fa79"; |
| 28 | + etherscanUrl = "https://ropsten.etherscan.io/address/0xec4e3a1ad06a2ebdc462eaf6bf361404676a441f#code"; |
| 29 | + break; |
| 30 | + case "4": |
| 31 | + $('#network').text("RINKEBY TEST NETWORK"); |
| 32 | + alert('This contract does not exist on the Rinkeby test network. Please switch to the Main or Ropsten network') |
| 33 | + break; |
| 34 | + case "42": |
| 35 | + $('#network').text("KOVAN TEST NETWORK"); |
| 36 | + contractAddress = '0x6328426be01834de85ec0c10e3e940e629290bb1'; |
| 37 | + contractInstance = Conference.at(contractAddress); |
| 38 | + etherscanTxUrl = "https://kovan.etherscan.io/tx/"; |
| 39 | + etherscanUrl = "https://kovan.etherscan.io/address/#code"; |
| 40 | + //TODO ADD contractAddress = kovan address |
| 41 | + https://kovan.etherscan.io/address/0x6328426be01834de85ec0c10e3e940e629290bb1 |
| 42 | + break; |
| 43 | + default: |
| 44 | + $('#network').text("NETWORK: UNKNOWN"); |
| 45 | + //TODO ADD contractAddress = undefined |
| 46 | + } |
| 47 | +}) |
| 48 | + |
| 49 | +var ticket_abi = ticket_abi = JSON.parse('[{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"registrantsPaid","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"organizer","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"recipient","type":"address"},{"name":"amount","type":"uint256"}],"name":"refundTicket","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"destroy","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"newquota","type":"uint256"}],"name":"changeQuota","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"quota","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"numRegistrants","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"buyTicket","outputs":[],"payable":false,"type":"function"},{"inputs":[],"payable":false,"type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_from","type":"address"},{"indexed":false,"name":"_amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_to","type":"address"},{"indexed":false,"name":"_amount","type":"uint256"}],"name":"Refund","type":"event"}]'); |
| 50 | +var ticket = web3.eth.contract(ticket_abi); |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | +// contract('Conference', function(accounts) { |
| 56 | + // console.log(accounts); |
| 57 | + // var owner_account = accounts; |
4 | 58 | // var sender_account = accounts[1];
|
5 | 59 |
|
6 | 60 |
|
|
0 commit comments