-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathindex.js
171 lines (162 loc) · 36.9 KB
/
index.js
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
160
161
162
163
164
165
166
167
168
169
170
171
$(() => {
let Web3 = require("web3");
let web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545'));
let abi = require('./abi').abi;
let shortAbi = require('./abi').shortABI;
if (typeof window.web3 !== 'undefined')
{
web3 = new Web3(window.web3.currentProvider);
console.log("injected provider used");
web3.eth.defaultAccount = web3.eth.coinbase;
try
{
window.web3.currentProvider.enable();
}
catch(e) {
//do nothing, just don't halt the program
console.log("backward incompatible web3 with privacy mode + " + e);
}
}
else
{
alert("no injected provider found, using localhost:8545, please ensure your local node is running " +
"and rpc and rpccorsdomain is enabled");
}
let tokens = [] /* let of type uint256[] here */ ;
let nameOfContract = ""/* let of type string here */ ;
let symbolForContract = "" /* let of type string here */ ;
let organiserAddr = "" /* let of type address here */ ;
let paymasterAddr = ""/* let of type address here */ ;
let recipientAddr = "" /* let of type address here */ ;
let state = "";
let buildingName = "";
let street = "";
let erc875Contract = web3.eth.contract(abi);
let contractAddr = "";
let tokenVal = "0x00000000000000000000000000000000EF6351E10000000000000000F7";
let locality = "";
function init()
{
let address = web3.eth.coinbase;
nameOfContract = $("#eventName").val();
symbolForContract = $("#tokenSymbol").val();
organiserAddr = $("#ownerAddress").val();
paymasterAddr = address;
recipientAddr = $("#recipientAddress").val();
state = $("#state").val();
buildingName = $("#buildingInput").val();
street = $("#streetInput").val();
locality = $("#localityInput").val();
let numberOfTokens = $("#numberOfTokens").val();
if(numberOfTokens == "")
{
//default 20
numberOfTokens = 20;
}
console.log("number of tokens: " + numberOfTokens);
for(let i = 0; i < parseInt(numberOfTokens); i++)
{
tokens.push(tokenVal);
}
if(organiserAddr == "") organiserAddr = address;
if(recipientAddr == "") recipientAddr = address;
//once initialized, deploy
deploy();
}
$("#deploy").click(() =>
{
init();
});
function deploy() {
$("#notice").show(); //let the user know that the contract is being deployed
web3.eth.getBlock("latest", (err, data) =>
{
let gasLimit = 471238800000; //geth default limit
let gasPrice = 3000000000;
if(!err)
{
gasLimit = data.gasLimit;
}
console.log("tokens: " + tokens);
console.log("organiser: " + organiserAddr);
console.log("pay: " + paymasterAddr);
console.log("recipient: " + recipientAddr);
console.log("building: " + buildingName);
console.log("street: " + street);
console.log("locality: " + locality);
console.log("state: " + state);
console.log("symbol: " + symbolForContract);
console.log("name: " + nameOfContract);
console.log("gas price: " + gasPrice);
console.log("gas limit: " + gasLimit);
erc875Contract.new(
tokens,
organiserAddr,
paymasterAddr,
recipientAddr,
buildingName,
street,
locality,
state,
symbolForContract,
nameOfContract,
{
from: web3.eth.coinbase,
gas: '4700000',
data: '0x60806040526000600660006101000a81548160ff02191690831515021790555060405180807f62616c616e63654f66286164647265737329000000000000000000000000000081525060120190506040518091039020600c60006101000a81548163ffffffff02191690837c01000000000000000000000000000000000000000000000000000000009004021790555060405180807f74726164652875696e743235362c75696e743235365b5d2c75696e74382c627981526020017f74657333322c6279746573333229000000000000000000000000000000000000815250602e0190506040518091039020600c60046101000a81548163ffffffff02191690837c01000000000000000000000000000000000000000000000000000000009004021790555060405180807f70617373546f2875696e743235362c75696e743235365b5d2c75696e74382c6281526020017f7974657333322c627974657333322c616464726573732900000000000000000081525060370190506040518091039020600c60086101000a81548163ffffffff02191690837c01000000000000000000000000000000000000000000000000000000009004021790555060405180807f737061776e50617373546f2875696e743235362c75696e743235365b5d2c756981526020017f6e74382c627974657333322c627974657333322c616464726573732900000000815250603c0190506040518091039020600c806101000a81548163ffffffff02191690837c0100000000000000000000000000000000000000000000000000000000900402179055503480156200025d57600080fd5b5060405162003da638038062003da68339810180604052810190808051820192919060200180519060200190929190805190602001909291908051906020019092919080518201929190602001805182019291906020018051820192919060200180518201929190602001805182019291906020018051820192919050505088600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555087600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550896000808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209080519060200190620003b292919062000459565b5085600a9080519060200190620003cb929190620004ab565b508460099080519060200190620003e4929190620004ab565b508360089080519060200190620003fd929190620004ab565b50826007908051906020019062000416929190620004ab565b5081600b90805190602001906200042f929190620004ab565b50806005908051906020019062000448929190620004ab565b50505050505050505050506200055a565b82805482825590600052602060002090810192821562000498579160200282015b82811115620004975782518255916020019190600101906200047a565b5b509050620004a7919062000532565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620004ee57805160ff19168380011785556200051f565b828001600101855582156200051f579182015b828111156200051e57825182559160200191906001019062000501565b5b5090506200052e919062000532565b5090565b6200055791905b808211156200055357600081600090555060010162000539565b5090565b90565b61383c806200056a6000396000f3006080604052600436106101b7576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063015a0488146101bc57806301ffc9a71461027557806302218bc5146102d957806306fdde031461037f578063139cea1c1461040f57806315070401146104b557806316e4cbf9146105455780631bb750821461059c5780632b4e4e96146105e15780633095c1ad14610667578063313ce567146106a857806331bfee0a146106d957806340c1b7ad1461073057806344c9af28146107d657806348dec51d1461087c5780634bd13cdd146109a15780634f452b9a14610a4d57806370a0823114610a7c5780637419662614610b145780637a23079114610ba45780637e53748614610c305780637f9f7f3d14610c8757806395d89b4114610d17578063a75186c714610da7578063aba7786b14610ecc578063b961de4414610f3e578063bb6e7de914611063578063c19d93fb1461107a578063c9116b691461110a578063cf0b41a314611176578063d9548e53146111dc578063e7dc333614611221578063f0141d84146112b1578063f6be7ed3146112dc578063fe60ebdc14611401575b600080fd5b3480156101c857600080fd5b506102736004803603810190808035906020019092919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803560ff16906020019092919080356000191690602001909291908035600019169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114a7565b005b34801561028157600080fd5b506102bf60048036038101908080357bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916906020019092919050505061182f565b604051808215151515815260200191505060405180910390f35b3480156102e557600080fd5b5061030460048036038101908080359060200190929190505050611a0d565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610344578082015181840152602081019050610329565b50505050905090810190601f1680156103715780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561038b57600080fd5b50610394611ab1565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103d45780820151818401526020810190506103b9565b50505050905090810190601f1680156104015780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561041b57600080fd5b5061043a60048036038101908080359060200190929190505050611b53565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561047a57808201518184015260208101905061045f565b50505050905090810190601f1680156104a75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104c157600080fd5b506104ca611bf7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561050a5780820151818401526020810190506104ef565b50505050905090810190601f1680156105375780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561055157600080fd5b5061055a611c99565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156105a857600080fd5b506105c760048036038101908080359060200190929190505050611cbf565b604051808215151515815260200191505060405180910390f35b3480156105ed57600080fd5b50610665600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050611d16565b005b34801561067357600080fd5b5061069260048036038101908080359060200190929190505050611f1e565b6040518082815260200191505060405180910390f35b3480156106b457600080fd5b506106bd611f41565b604051808260ff1660ff16815260200191505060405180910390f35b3480156106e557600080fd5b506106ee611f46565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561073c57600080fd5b5061075b60048036038101908080359060200190929190505050611f4e565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561079b578082015181840152602081019050610780565b50505050905090810190601f1680156107c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156107e257600080fd5b5061080160048036038101908080359060200190929190505050611ff2565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610841578082015181840152602081019050610826565b50505050905090810190601f16801561086e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561088857600080fd5b5061092660048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050612096565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561096657808201518184015260208101905061094b565b50505050905090810190601f1680156109935780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610a4b6004803603810190808035906020019092919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803560ff16906020019092919080356000191690602001909291908035600019169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612111565b005b348015610a5957600080fd5b50610a6261236c565b604051808215151515815260200191505060405180910390f35b348015610a8857600080fd5b50610abd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612375565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610b00578082015181840152602081019050610ae5565b505050509050019250505060405180910390f35b348015610b2057600080fd5b50610b2961240b565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610b69578082015181840152602081019050610b4e565b50505050905090810190601f168015610b965780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610c2e6004803603810190808035906020019092919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803560ff169060200190929190803560001916906020019092919080356000191690602001909291905050506124a9565b005b348015610c3c57600080fd5b50610c45612814565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610c9357600080fd5b50610c9c61283a565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610cdc578082015181840152602081019050610cc1565b50505050905090810190601f168015610d095780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610d2357600080fd5b50610d2c6128d8565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610d6c578082015181840152602081019050610d51565b50505050905090810190601f168015610d995780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610db357600080fd5b50610e5160048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050612976565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610e91578082015181840152602081019050610e76565b50505050905090810190601f168015610ebe5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610ed857600080fd5b50610f3c600480360381019080803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192908035151590602001909291905050506129f1565b005b348015610f4a57600080fd5b50610fe860048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050612a6b565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561102857808201518184015260208101905061100d565b50505050905090810190601f1680156110555780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561106f57600080fd5b50611078612ae6565b005b34801561108657600080fd5b5061108f612b7d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156110cf5780820151818401526020810190506110b4565b50505050905090810190601f1680156110fc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561111657600080fd5b5061111f612c1b565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015611162578082015181840152602081019050611147565b505050509050019250505060405180910390f35b34801561118257600080fd5b506111da60048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050612caf565b005b3480156111e857600080fd5b5061120760048036038101908080359060200190929190505050612dcd565b604051808215151515815260200191505060405180910390f35b34801561122d57600080fd5b50611236612de6565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561127657808201518184015260208101905061125b565b50505050905090810190601f1680156112a35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156112bd57600080fd5b506112c6612e84565b6040518082815260200191505060405180910390f35b3480156112e857600080fd5b5061138660048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050612e8f565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156113c65780820151818401526020810190506113ab565b50505050905090810190601f1680156113f35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561140d57600080fd5b506114a5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050612f0a565b005b6000806000806000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561150b57600080fd5b428b1180611519575060008b145b151561152457600080fd5b61153060008c8c613186565b94506001858a8a8a604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af11580156115a9573d6000803e3d6000fd5b505050602060405103519350600092505b89518310156117655789838151811015156115d157fe5b90602001906020020151915060008060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208381548110151561162a57fe5b90600052602060002001541415151561163f57fe5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208281548110151561168a57fe5b906000526020600020015490506000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190806001815401808255809150509060018203906000526020600020016000909192909190915055506000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208281548110151561174a57fe5b906000526020600020016000905582806001019350506115ba565b8573ffffffffffffffffffffffffffffffffffffffff167fcf7370598f037d339864eec2202ca184ad6af5b4a0f56335d83f97ed76bafcc08b8b8b8b60405180806020018560ff1660ff16815260200184600019166000191681526020018360001916600019168152602001828103825286818151815260200191508051906020019060200280838360005b8381101561180c5780820151818401526020810190506117f1565b505050509050019550505050505060405180910390a25050505050505050505050565b6000600c60009054906101000a90047c0100000000000000000000000000000000000000000000000000000000027bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806119105750600c60049054906101000a90047c0100000000000000000000000000000000000000000000000000000000027bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806119835750600c60089054906101000a90047c0100000000000000000000000000000000000000000000000000000000027bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806119f55750600c809054906101000a90047c0100000000000000000000000000000000000000000000000000000000027bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b15611a035760019050611a08565b600090505b919050565b606060088054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611aa55780601f10611a7a57610100808354040283529160200191611aa5565b820191906000526020600020905b815481529060010190602001808311611a8857829003601f168201915b50505050509050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611b495780601f10611b1e57610100808354040283529160200191611b49565b820191906000526020600020905b815481529060010190602001808311611b2c57829003601f168201915b5050505050905090565b6060600a8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611beb5780601f10611bc057610100808354040283529160200191611beb565b820191906000526020600020905b815481529060010190602001808311611bce57829003601f168201915b50505050509050919050565b6060600b8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611c8f5780601f10611c6457610100808354040283529160200191611c8f565b820191906000526020600020905b815481529060010190602001808311611c7257829003601f168201915b5050505050905090565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600090505b600180549050811015611d0b5782600182815481101515611ce457fe5b90600052602060002001541415611cfe5760019150611d10565b8080600101915050611cc7565b600091505b50919050565b600080600091505b8251821015611ec9578282815181101515611d3557fe5b90602001906020020151905060008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002082815481101515611d8e57fe5b906000526020600020015414151515611da657600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002082815481101515611e2f57fe5b906000526020600020015490806001815401808255809150509060018203906000526020600020016000909192909190915055506000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081815481101515611eae57fe5b90600052602060002001600090558180600101925050611d1e565b8373ffffffffffffffffffffffffffffffffffffffff167f69ca02dd4edd7bf0a4abb9ed3b7af3f14778db5d61921c7dc7cd545266326de284516040518082815260200191505060405180910390a250505050565b600181815481101515611f2d57fe5b906000526020600020016000915090505481565b600081565b600030905090565b606060098054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611fe65780601f10611fbb57610100808354040283529160200191611fe6565b820191906000526020600020905b815481529060010190602001808311611fc957829003601f168201915b50505050509050919050565b606060078054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561208a5780601f1061205f5761010080835404028352916020019161208a565b820191906000526020600020905b81548152906001019060200180831161206d57829003601f168201915b50505050509050919050565b6060600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156120f457600080fd5b816008908051906020019061210a92919061376b565b5092915050565b6000806000428911806121245750600089145b151561212f57600080fd5b61213a348a8a6134b8565b9250600183888888604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af11580156121b3573d6000803e3d6000fd5b505050602060405103519150600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151561221b57600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f19350505050158015612283573d6000803e3d6000fd5b50600090505b8751811015612361576000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002088828151811015156122de57fe5b9060200190602002015190806001815401808255809150509060018203906000526020600020016000909192909190915055506001888281518110151561232157fe5b9060200190602002015190806001815401808255809150509060018203906000526020600020016000909192909190915055508080600101915050612289565b505050505050505050565b60006001905090565b60606000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054806020026020016040519081016040528092919081815260200182805480156123ff57602002820191906000526020600020905b8154815260200190600101908083116123eb575b50505050509050919050565b60098054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156124a15780601f10612476576101008083540402835291602001916124a1565b820191906000526020600020905b81548152906001019060200180831161248457829003601f168201915b505050505081565b600080600080428911806124bd5750600089145b15156124c857600080fd5b6124d3348a8a613186565b9350600184888888604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af115801561254c573d6000803e3d6000fd5b505050602060405103519250600091505b875182101561270557878281518110151561257457fe5b90602001906020020151905060008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020828154811015156125cd57fe5b9060005260206000200154141515156125e257fe5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208281548110151561266b57fe5b906000526020600020015490806001815401808255809150509060018203906000526020600020016000909192909190915055506000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020818154811015156126ea57fe5b9060005260206000200160009055818060010192505061255d565b8273ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f1935050505015801561274b573d6000803e3d6000fd5b508273ffffffffffffffffffffffffffffffffffffffff167f951553379d49c26bc057f41de147adc24a09bda33b6b23374354bfbfb96edae88989898960405180806020018560ff1660ff16815260200184600019166000191681526020018360001916600019168152602001828103825286818151815260200191508051906020019060200280838360005b838110156127f35780820151818401526020810190506127d8565b505050509050019550505050505060405180910390a2505050505050505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60088054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156128d05780601f106128a5576101008083540402835291602001916128d0565b820191906000526020600020905b8154815290600101906020018083116128b357829003601f168201915b505050505081565b600b8054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561296e5780601f106129435761010080835404028352916020019161296e565b820191906000526020600020905b81548152906001019060200180831161295157829003601f168201915b505050505081565b6060600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156129d457600080fd5b81600790805190602001906129ea92919061376b565b5092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612a4d57600080fd5b80600660006101000a81548160ff0219169083151502179055505050565b6060600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612ac957600080fd5b81600a9080519060200190612adf92919061376b565b5092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612b4257600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b60078054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015612c135780601f10612be857610100808354040283529160200191612c13565b820191906000526020600020905b815481529060010190602001808311612bf657829003601f168201915b505050505081565b60606000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805480602002602001604051908101604052809291908181526020018280548015612ca557602002820191906000526020600020905b815481526020019060010190808311612c91575b5050505050905090565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612d0d57600080fd5b600090505b8151811015612dc957600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208282815181101515612d8957fe5b9060200190602002015190806001815401808255809150509060018203906000526020600020016000909192909190915055508080600101915050612d12565b5050565b6000600660009054906101000a900460ff169050919050565b600a8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015612e7c5780601f10612e5157610100808354040283529160200191612e7c565b820191906000526020600020905b815481529060010190602001808311612e5f57829003601f168201915b505050505081565b60008060ff16905090565b6060600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612eed57600080fd5b8160099080519060200190612f0392919061376b565b5092915050565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612f6957600080fd5b600091505b8251821015613119578282815181101515612f8557fe5b90602001906020020151905060008060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002082815481101515612fde57fe5b906000526020600020015414151515612ff657600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208281548110151561307f57fe5b906000526020600020015490806001815401808255809150509060018203906000526020600020016000909192909190915055506000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020818154811015156130fe57fe5b90600052602060002001600090558180600101925050612f6e565b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fc0d84ce5c7ff9ca21adb0f8436ff3f4951b4bb78c4e2fae2b6837958b3946ffd85516040518082815260200191505060405180910390a35050505050565b6000606060008060028551026054016040519080825280601f01601f1916602001820160405280156131c75781602001602082028038833980820191505090505b5092506131d2611f46565b9150600090505b602081101561323a5780600802879060020a0260010283828151811015156131fd57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080806001019150506131d9565b600090505b60208110156132a35780600802869060020a02600102836020830181518110151561326657fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350808060010191505061323f565b600090505b60148110156133275780600802826c01000000000000000000000000026bffffffffffffffffffffffff19169060020a0283826040018151811015156132ea57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080806001019150506132a8565b600090505b8451811015613449576008858281518110151561334557fe5b906020019060200201519060020a90047f010000000000000000000000000000000000000000000000000000000000000002836002830260540181518110151561338b57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535084818151811015156133c957fe5b906020019060200201517f010000000000000000000000000000000000000000000000000000000000000002836001600284026054010181518110151561340c57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350808060010191505061332c565b826040518082805190602001908083835b60208310151561347f578051825260208201915060208101905060208303925061345a565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902093505050509392505050565b60006060600080600060208651026054016040519080825280601f01601f1916602001820160405280156134fb5781602001602082028038833980820191505090505b509350613506611f46565b9250600091505b602082101561356e5781600802889060020a02600102848381518110151561353157fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350818060010192505061350d565b600091505b60208210156135d75781600802879060020a02600102846020840181518110151561359a57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508180600101925050613573565b600091505b601482101561365b5781600802836c01000000000000000000000000026bffffffffffffffffffffffff19169060020a02848360400181518110151561361e57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535081806001019250506135dc565b600091505b85518210156136fb57600090505b60208110156136ee5780600802868381518110151561368957fe5b906020019060200201519060020a02600102848260208502605401018151811015156136b157fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350808060010191505061366e565b8180600101925050613660565b836040518082805190602001908083835b602083101515613731578051825260208201915060208101905060208303925061370c565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390209450505050509392505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106137ac57805160ff19168380011785556137da565b828001600101855582156137da579182015b828111156137d95782518255916020019190600101906137be565b5b5090506137e791906137eb565b5090565b61380d91905b808211156138095760008160009055506001016137f1565b5090565b905600a165627a7a723058209367d91697bf603c1ce4bea86a20953c5d8bed1160d4b396b1c092257a3b51b50029'
}, function (e, contract){
console.log(e, contract);
if (e) {
alert(e);
return;
}
if (typeof contract.address !== 'undefined')
{
contractAddr = contract.address;
alert('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash);
//set xcontract button
$("#viewOnXContract").show().click(() =>
{
window.location.href = "https://xcontract.herokuapp.com/api/" + JSON.stringify(shortAbi) + "/" + contract.address
});
$("#viewOnEtherscan").show().click(() => {
redirectToEtherscan(contract.address);
});
$("#addMoreTokens").show();
$("#addMoreTokensButton").show();
$("#addMoreTokensLabel").show();
}
});
});
}
$("#addMoreTokensButton").click(() =>
{
let contract = erc875Contract.at(contractAddr);
let tokens = $("#addMoreTokens").val();
let tokensToAdd = [];
for(let i = 0; i < tokens; i++)
{
tokensToAdd.push(tokenVal);
}
contract.loadNewTickets.sendTransaction(tokensToAdd, (err, data) =>
{
if(err)
{
alert(err);
}
else
{
alert("Tx submitted: " + data);
}
})
});
function redirectToEtherscan(address)
{
web3.version.getNetwork((err, networkId) => {
if (networkId == 3) window.location.href = "https://ropsten.etherscan.io/address/" + address;
else if (networkId == 4) window.location.href = "https://rinkeby.etherscan.io/address/" + address;
else if (networkId == 42) window.location.href = "https://kovan.etherscan.io/address/" + address;
else window.location.href = "https://etherscan.io/address/" + address;
});
}
});