/
etheria-0pt9_0xe46.sol
643 lines (592 loc) · 67.7 KB
/
etheria-0pt9_0xe46.sol
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
/*
Etheria v0.9
Block 407810
Oct-19-2015 02:54:36 PM +UTC
0xe468d26721b703d224d05563cb64746a7a40e1f4
Function hashes:
{
"54385526": "setStatus(uint8,uint8,string)", // unused (costs 0.1 ETH)
"a5ffca0e": "acceptOffer(uint8,uint8,uint8)", // used for wrapping/unwrapping only
"8cae1374": "editBlock(uint8,uint8,uint256,int8[5])", // unused under modern build mechanics
"959eac47": "farmTile(uint8,uint8)", // unused under modern build mechanics
"fa93019c": "getBlocks(uint8,uint8)", // unused under modern build mechanics
"a55cab95": "getName(uint8,uint8)",
"6a864559": "getOfferers(uint8,uint8)", // used for wrapping/unwrapping only
"c7dafc78": "getOffers(uint8,uint8)", // used for wrapping/unwrapping only
"e039e4a1": "getOwner(uint8,uint8)",
"d39eb301": "getStatus(uint8,uint8)", // unused (setStatus costs 0.1 ETH)
"4b42d208": "getUint8FromByte32(bytes32,uint8)", // unused under modern build mechanics
"182db370": "getWhatHappened()",
"6266b514": "makeOffer(uint8,uint8)", // used for wrapping/unwrapping only
"a713081c": "rejectOffer(uint8,uint8,uint8)", // used for wrapping/unwrapping only
"edffcd57": "retractOffer(uint8,uint8)", // used for wrapping/unwrapping only
"93eec1fb": "setName(uint8,uint8,string)"
}
Note: No kill or locking mechanisms
var etheriaAddress = "0xe468d26721b703d224d05563cb64746a7a40e1f4";
var abi = [
{"constant":true,"inputs":[],"name":"getWhatHappened","outputs":[{"name":"","type":"uint8"}],"type":"function","payable":false,"stateMutability":"view"},
{"constant":true,"inputs":[{"name":"_b32","type":"bytes32"},{"name":"byteindex","type":"uint8"}],"name":"getUint8FromByte32","outputs":[{"name":"","type":"uint8"}],"type":"function","payable":false,"stateMutability":"view"},
{"constant":false,"inputs":[{"name":"col","type":"uint8"},{"name":"row","type":"uint8"},{"name":"_s","type":"string"}],"name":"setStatus","outputs":[],"type":"function","payable":true,"stateMutability":"payable"},
{"constant":false,"inputs":[{"name":"col","type":"uint8"},{"name":"row","type":"uint8"}],"name":"makeOffer","outputs":[],"type":"function","payable":true,"stateMutability":"payable"},
{"constant":true,"inputs":[{"name":"col","type":"uint8"},{"name":"row","type":"uint8"}],"name":"getOfferers","outputs":[{"name":"","type":"address[]"}],"type":"function","payable":false,"stateMutability":"view"},
{"constant":false,"inputs":[{"name":"col","type":"uint8"},{"name":"row","type":"uint8"},{"name":"index","type":"uint256"},{"name":"_block","type":"int8[5]"}],"name":"editBlock","outputs":[],"type":"function","payable":true,"stateMutability":"payable"},
{"constant":false,"inputs":[{"name":"col","type":"uint8"},{"name":"row","type":"uint8"},{"name":"_n","type":"string"}],"name":"setName","outputs":[],"type":"function","payable":true,"stateMutability":"payable"},
{"constant":false,"inputs":[{"name":"col","type":"uint8"},{"name":"row","type":"uint8"}],"name":"farmTile","outputs":[],"type":"function","payable":true,"stateMutability":"payable"},
{"constant":true,"inputs":[{"name":"col","type":"uint8"},{"name":"row","type":"uint8"}],"name":"getName","outputs":[{"name":"","type":"string"}],"type":"function","payable":false,"stateMutability":"view"},
{"constant":false,"inputs":[{"name":"col","type":"uint8"},{"name":"row","type":"uint8"},{"name":"i","type":"uint8"}],"name":"acceptOffer","outputs":[],"type":"function","payable":true,"stateMutability":"payable"},
{"constant":false,"inputs":[{"name":"col","type":"uint8"},{"name":"row","type":"uint8"},{"name":"i","type":"uint8"}],"name":"rejectOffer","outputs":[],"type":"function","payable":true,"stateMutability":"payable"},
{"constant":true,"inputs":[{"name":"col","type":"uint8"},{"name":"row","type":"uint8"}],"name":"getOffers","outputs":[{"name":"","type":"uint256[]"}],"type":"function","payable":false,"stateMutability":"view"},
{"constant":true,"inputs":[{"name":"col","type":"uint8"},{"name":"row","type":"uint8"}],"name":"getStatus","outputs":[{"name":"","type":"string"}],"type":"function","payable":false,"stateMutability":"view"},
{"constant":true,"inputs":[{"name":"col","type":"uint8"},{"name":"row","type":"uint8"}],"name":"getOwner","outputs":[{"name":"","type":"address"}],"type":"function","payable":false,"stateMutability":"view"},
{"constant":false,"inputs":[{"name":"col","type":"uint8"},{"name":"row","type":"uint8"}],"name":"retractOffer","outputs":[],"type":"function","payable":true,"stateMutability":"payable"},
{"constant":true,"inputs":[{"name":"col","type":"uint8"},{"name":"row","type":"uint8"}],"name":"getBlocks","outputs":[{"name":"","type":"int8[5][]"}],"type":"function","payable":false,"stateMutability":"view"},
{"inputs":[],"type":"constructor","payable":true,"stateMutability":"payable"},
{"type":"fallback","payable":true,"stateMutability":"payable"}
];
var etheria = new web3.eth.Contract(abi, etheriaAddress);
Exact bytecode match with source below and Solidity: 0.1.6 w/ default optimization (200) (compile 4 times due to solc determinism bug)
chain: 0x606060405236156100c45760e060020a6000350463182db37081146100c65780634b42d208146100ec578063543855261461012f5780636266b514146101b35780636a864559146101e55780638cae13741461028a57806393eec1fb14610321578063959eac47146103ca578063a55cab95146103e3578063a5ffca0e14610480578063a713081c1461049e578063c7dafc78146104b6578063d39eb3011461054e578063e039e4a1146105eb578063edffcd571461062f578063fa93019c14610646575b005b61220b5460a060020a900460ff165b6040805160ff929092168252519081900360200190f35b6100d56004356024355b60006040836002840260ff908116808403601090810a92603e92909203900a9085908190819081908a168114156123045786935061230a565b604080516020604435600481810135601f81018490048402850184019095528484526100c4948135946024803595939460649492939101918190840183828082843750949650505050505050600034600014156109e85761220b805460a060020a60ff021916742800000000000000000000000000000000000000001790556108a1565b6100c4600435602435600060003460001415611c305761220b805460a060020a60ff02191660a060020a1790556108a1565b610715600435602435604080516020810190915260008152600183602181101561000257506101088402018260218110156100025790906008020160005060010160005080548060200260200160405190810160405280929190818152602001828054801561027e57602002820191906000526020600020905b8154600160a060020a031681526001919091019060200180831161025f575b50505050509050610629565b6040805160a08181019092526100c49160048035926024359260443592916101049160649060059083908390808284375090955050505050506000610300604051908101604052806018905b60008152602001906001900390816102d65750506040805161030081019091526018815b60008152602001906001900390816102fa579050506000600060006000610efa8b8b610375565b604080516020604435600481810135601f81018490048402850184019095528484526100c494813594602480359593946064949293910191819084018382808284375094965050505050505060006108a784845b600060008360ff1610806103965750805460001960ff918216018116908416115b806103a4575060008260ff16105b806103bd575060005460ff908116600019018116908316115b1561062957506001610629565b6100c4600435602435600060006000610c2b8585610375565b61075f60043560243560408051602081019091526000815260018360218110156100025750610108840201826021811015610002579090600802016000506040805160069092018054602060026001831615610100026000190190921691909104601f810182900482028501820190935282845290919083018282801561027e5780601f106108445761010080835404028352916020019161027e565b6100c460043560243560443560006000600060006120b88787610375565b6100c4600435602435604435600061186f8484610375565b61071560043560243560408051602081019091526000815260018360218110156100025750610108840201826021811015610002579090600802016000506040805160029092018054602081810285018101909352808452909183018282801561027e57602002820191906000526020600020905b81600050548152602001906001019080831161052b575b50505050509050610629565b61075f60043560243560408051602081019091526000815260018360218110156100025750610108840201826021811015610002579090600802016000506040805160079092018054602060026001831615610100026000190190921691909104601f810182900482028501820190935282845290919083018282801561027e5780601f106108445761010080835404028352916020019161027e565b6107cd6004356024356000600183602181101561000257506101088402018260218110156100025790906008020160005054600160a060020a031690505b92915050565b6100c460043560243560006000611b1a8484610375565b6107e960043560243560408051602081019091526000815260018360218110156100025761010802016000508260218110156100025760080201600050600301600050805480602002602001604051908101604052809291908181526020016000905b82821015610edf576000848152602081206040805160a08101918290529291850191600591908390855b825461010083900a900460000b8152602060019283018181049485019490930390920291018084116106d35790505050505050815260200190600101906106a9565b60405180806020018281038252838181518152602001915080519060200190602002808383829060006004602084601f0104600302600f01f1509050019250505060405180910390f35b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600302600f01f150905090810190601f1680156107bf5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60408051600160a060020a039092168252519081900360200190f35b60405180806020018281038252838181518152602001915080516000925b818410156108335760208481028401015160a08083818460006004601ef1509050019260010192610807565b925050509250505060405180910390f35b820191906000526020600020905b81548152906001019060200180831161085257509394506106299350505050565b505061220b80547434000000000000000000000000000000000000000060a060020a60ff0219919091161790555b50505050565b156108dc5761220b80547432000000000000000000000000000000000000000060a060020a60ff0219919091161790556108a1565b60018460218110156100025750610108850201836021811015610002579090600802016000508054909150600160a060020a03908116339091161461094b5761220b80547433000000000000000000000000000000000000000060a060020a60ff0219919091161790556108a1565b81816006016000509080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106109b457805160ff19168380011785555b506108739291505b808211156109e457600081556001016109a0565b82800160010185558215610998579182015b828111156109985782518260005055916020019190600101906109c6565b5090565b67016345785d8a00003414610a485760405133600160a060020a031690600090349082818181858883f1505061220b80547429000000000000000000000000000000000000000060a060020a60ff021991909116179055506108a1915050565b610a528484610375565b15610aa85760405133600160a060020a031690600090349082818181858883f1505061220b8054742a000000000000000000000000000000000000000060a060020a60ff021991909116179055506108a1915050565b60018460218110156100025750610108850201836021811015610002579090600802016000508054909150600160a060020a039081163390911614610b385760405133600160a060020a031690600090349082818181858883f1505061220b8054742b000000000000000000000000000000000000000060a060020a60ff021991909116179055506108a1915050565b81816007016000509080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610b9157805160ff19168380011785555b50610bc19291506109a0565b82800160010185558215610b85579182015b82811115610b85578251826000505591602001919060010190610ba3565b505061220b8054742c000000000000000000000000000000000000000060a060020a60ff0219919091161790556108a1565b43600484015561220b80547421000000000000000000000000000000000000000060a060020a60ff02199091161790555b5050505050565b15610c605761220b8054741e000000000000000000000000000000000000000060a060020a60ff021991909116179055610c24565b60018560218110156100025750610108860201846021811015610002579090600802016000508054909350600160a060020a039081163390911614610ccf5761220b8054741f000000000000000000000000000000000000000060a060020a60ff021991909116179055610c24565b6110e0836004016000505443031015610d125761220b80547420000000000000000000000000000000000000000060a060020a60ff021991909116179055610c24565b505043600019014060005b600a8160ff161015610bf35760038301805460018101808355919082908015829011610d5a57600083815260209020610d5a9181019083016109a0565b505050506020610d6a83836100f6565b60038501805460ff929092169290920691906000198101908110156100025750805460008281526020812091909101600019908101805460ff191660f860020a95860295909504949094179093558154909281019081101561000257906000526020600020900160005060016101000a81548160ff021916908360f860020a9081020402179055506000836003016000506001856003016000508054905003815481101561000257906000526020600020900160005060026101000a81548160ff021916908360f860020a908102040217905550600019836003016000506001856003016000508054905003815481101561000257906000526020600020900160005060036101000a81548160ff021916908360f860020a9081020402179055506000836003016000506001856003016000508054905003815481101561000257906000526020600020900160005060046101000a81548160ff021916908360f860020a908102040217905550600101610d1d565b505050509050610629565b50505b5050505050505050505050565b15610f2f5761220b80547414000000000000000000000000000000000000000060a060020a60ff021991909116179055610eed565b60018b602181101561000257506101088c02018a6021811015610002579090600802016000508054909750600160a060020a039081163390911614610f9e5761220b80547415000000000000000000000000000000000000000060a060020a60ff021991909116179055610eed565b6060880151600090810b1215610fde5761220b80547416000000000000000000000000000000000000000060a060020a60ff021991909116179055610eed565b6003870180548a9081101561000257506000908152602081208a0154810b810b808a526040805161220a5460e360020a630379eaeb02825260ff9390931660048201529051600160a060020a039290921692631bcf5758926024838101936103009390839003909101908290876161da5a03f11561000257506040805161030080820180845261220a548e5160e360020a630379eaeb0290925260ff919091166103048401529251919a50600160a060020a03929092169350610324808b01929190818c0301816000876161da5a03f1156100025750505060405180610300016040529450600093505b60188460ff16101561135b57602088015185856018811015610002579090602002015101858560188110156100025760009290920b602092909202015287600290906020020151858560010160188110156100025790906020020151018585600101601881101561000257600092830b602091820290920191909152860151600290820b07810b1480159061117a5750600285856001016018811015610002579090602002015160000b0760000b6000145b156111ac5784846018811015610002576020020151600101858560188110156100025760009290920b60209290920201525b606088015185600286016018811015610002579090602002015101858560020160188110156100025760009290920b60209290920201526003870180548a9081101561000257506000908152602081208a01546101009004900b86856018811015610002579090602002015101868560188110156100025760009290920b60209290920201526003870180548a9081101561000257906000526020600020900160005060029054906101000a900460000b868560010160188110156100025790906020020151018685600101601881101561000257600092830b602091820290920191909152870151600290820b07810b148015906112c85750600286856001016018811015610002579090602002015160000b0760000b6000145b156112fa5785846018811015610002576020020151600101868560188110156100025760009290920b60209290920201525b6003870180548a9081101561000257506000908152602081208a015463010000009004900b8660028601601881101561000257602081028201519092019160188110156100025760009290920b6020929092020152600393909301926110c8565b6114518b8b8a8860006000600060006000610600604051908101604052806030905b600081526020019060019003908161137d57506000905060018b602181101561000257506101088c02018a6021811015610002579090600802016000509450600093505b60188460ff16101561238f576124a288856018811015610002576020020151896001870160188110156100025760200201516000600060008360000b60201913158015611412575060218460000b13155b156128935760028460000b0760000b60001415156128ab578460000b60311913158015611443575060318560000b13155b15612886576001925061288b565b151561145c57610eed565b6000876003016000508a815481101561000257508152602081208a015463010000009004810b810b1261165757600092505b60188360ff16101561169857600091505b6005870154821015611708576005870180548390811015610002576000918252602082200154810b900b86846018811015610002579090602002015160000b14801561152457506005870180548390811015610002576020600090812091909101546101009004810b900b90508660018501601881101561000257602002015160000b145b801561156757506005870180548390811015610002576000918252602082200154620100009004810b900b8660028501601881101561000257602002015160000b145b1561164b57848360188110156100025760200201516005880180548490811015610002576000918252602090912001805460ff191660f860020a9283029290920491909117905584600184016018811015610002576020020151600588018054849081101561000257906000526020600020900160005060016101000a81548160ff021916908360f860020a90810204021790555084836002016018811015610002576020020151600588018054849081101561000257906000526020600020900160005060026101000a81548160ff021916908360f860020a9081020402179055505b6001919091019061149f565b5060005b60188160ff1610156116985760058701805460018101808355909190828015829011611714576000838152602090206117149181019083016109a0565b87876003016000508a815481101561000257506000908152602081208b01916001830191839060a08301905b8382111561182157835183826101000a81548160ff021916908360f860020a90810204021790555092602001926001016020816000010492830192600103026116c4565b6003929092019161148e565b505050508481601881101561000257602002015160058801805460001981019081101561000257906000526020600020900160005060006101000a81548160ff021916908360f860020a908102040217905550848160010160188110156100025760058901805460209290920290920151919060001981019081101561000257906000526020600020900160005060016101000a81548160ff021916908360f860020a908102040217905550848160020160188110156100025760058901805460209290920290920151919060001981019081101561000257906000526020600020900160005060026101000a81548160ff021916908360f860020a90810204021790555060030161165b565b801561184e5782816101000a81549060ff0219169055600101602081600001049283019260010302611821565b5050610eea9291505b808211156109e457805460ff19168155600101611857565b156118a45761220b80547446000000000000000000000000000000000000000060a060020a60ff0219919091161790556108a1565b60018460218110156100025750610108850201836021811015610002579090600802016000508054909150600160a060020a0390811633909116146119135761220b80547447000000000000000000000000000000000000000060a060020a60ff0219919091161790556108a1565b60008260ff16108061192f575060028101546000190160ff8316115b156119645761220b80547448000000000000000000000000000000000000000060a060020a60ff0219919091161790556108a1565b611aea8484845b6000806001856021811015610002576101080201846021811015610002576008020160018101805491935090849081101561000257908252602082200154600283018054600160a060020a0392909216918391908690811015610002579060005260206000209001600050546040516000818181858888f19350505050508160010160005083815481101561000257906000526020600020900160006101000a815490600160a060020a030219169055816002016000508381548110156100025790600052602060002090016000506000905550600182015b600182015460ff8216101561231d57600182018054829081101561000257508054600082815260209020830154600160a060020a0316919060001984019081101561000257505060206000208201600019018054600160a060020a03191690911790556002820180548290811015610002575080546000828152602090208301549190600019840190811015610002575050602060002082016000190155600101611a44565b61220b80547449000000000000000000000000000000000000000060a060020a60ff0219919091161790556108a1565b15611b4c5761220b805460a060020a60ff021916743c00000000000000000000000000000000000000001790556108a1565b60018460218110156100025750610108850201836021811015610002579090600802016000509150600090505b600182015460ff82161015611bf35733600160a060020a03168260010160005082815481101561000257600091825260209091200154600160a060020a03161415611c235761220b8054743d000000000000000000000000000000000000000060a060020a60ff0219909116179055611c2b84848361196b565b61220b8054743e000000000000000000000000000000000000000060a060020a60ff0219919091161790556108a1565b600101611b79565b6108a1565b611c3a8484610375565b15611c905761220b80547402000000000000000000000000000000000000000060a060020a60ff02199190911617905560405133600160a060020a031690600090349082818181858883f19350505050506108a1565b60018460218110156100025750610108850201836021811015610002579090600802016000508054909250600160a060020a031660001415611db35734670de0b6b3a7640000141580611d5d575061220b54604080517f4166c1fd00000000000000000000000000000000000000000000000000000000815260ff8781166004830152861660248201529051607d92600160a060020a031691634166c1fd91604482810192602092919082900301816000876161da5a03f1156100025750506040515160ff169190911090505b15611e515760405133600160a060020a031690600090349082818181858883f1505061220b80547403000000000000000000000000000000000000000060a060020a60ff021991909116179055506108a1915050565b8154600160a060020a03908116339091161480611dd65750662386f26fc1000034105b80611dea575069d3c21bcecceda100000034115b80611dfb57506001820154600a9010155b15611eb35760405133600160a060020a031690600090349082818181858883f1505061220b80547405000000000000000000000000000000000000000060a060020a60ff021991909116179055506108a1915050565b60405161220954600160a060020a031690600090349082818181858883f150508454600160a060020a03191633178555505061220b80547404000000000000000000000000000000000000000060a060020a60ff0219909116179055506108a1565b5060005b600182015460ff82161015611f845733600160a060020a03168260010160005082815481101561000257600091825260209091200154600160a060020a03161415611fb45733600160a060020a03166000836002016000508381548110156100025790825260208220018150546040516000818181858888f15050505060028301805434925083908110156100025790600052602060002090016000505561220b80547406000000000000000000000000000000000000000060a060020a60ff02199091161790556108a1565b60018281018054918201808255828015829011611fbc57818360005260206000209182019101611fbc91906109a0565b600101611eb7565b50505060028301805460018101808355909250828015829011611ff257818360005260206000209182019101611ff291906109a0565b505050506001820180543391906000198101908110156100025750805460009182526020909120016000199081018054600160a060020a03191690921790915560028301805434928101908110156100025790600052602060002090016000505561220b80547407000000000000000000000000000000000000000060a060020a60ff02199091161790556108a1565b5061220b80547453000000000000000000000000000000000000000060a060020a60ff0219919091161790555b50505050505050565b156120ed5761220b80547450000000000000000000000000000000000000000060a060020a60ff0219919091161790556120af565b60018760218110156100025750610108880201866021811015610002579090600802016000508054909450600160a060020a03908116339091161461215c5761220b80547451000000000000000000000000000000000000000060a060020a60ff0219919091161790556120af565b60008560ff161080612178575060028401546000190160ff8616115b156121ad5761220b80547452000000000000000000000000000000000000000060a060020a60ff0219919091161790556120af565b6002840180548690811015610002575060009081526020812086015460405161220954919550600a86049450600160a060020a03919091169190849082818181858883f1508754600160a060020a031693509086039082818181858883f19350505050508360010160005085815481101561000257506000908152602081208601548554600160a060020a031916600160a060020a039190911617855590505b600184015460ff821610156122c55760ff818116908616146122bd576001840180548290811015610002576000918252602082200154600286018054600160a060020a0392909216929184908110156100025790825260208220018150546040516000818181858888f150505050505b60010161224d565b600184018054600080835591825260209091206122e4918101906109a0565b5060028401805460008083559182526020909120612082918101906109a0565b85870693505b5050508181069003049695505050505050565b600182018054600019810180835590919082801582901161234f5760008381526020902061234f9181019083016109a0565b50505060028301805460001981018083559092508280158290116123865781836000526020600020918201910161238691906109a0565b50505050610c24565b85600014156126275761220a54600160a060020a0316630878bc518a6000909060200201516040518260e060020a028152600401808260ff168152602001915050610600604051808303816000876161da5a03f1156100025750505060405180610600016040529150600090505b60308160ff1610801561240e575085155b156124715781816030811015610002576020020151600090810b14801561244a575081816001016030811015610002576020020151600090810b145b801561246b575081816002016030811015610002576020020151600090810b145b15612665575b61220b805460a060020a60ff021916740d000000000000000000000000000000000000000017905560009650612657565b15156124dc5761220b8054740a000000000000000000000000000000000000000060a060020a60ff02199190911617905560009650612657565b600092505b60058501548310156125e0576005850180548490811015610002576000918252602082200154810b900b8885601881101561000257602002015160000b14801561256457506005850180548490811015610002576020600090812091909101546101009004810b900b90508860018601601881101561000257602002015160000b145b80156125a757506005850180548490811015610002576000918252602082200154620100009004810b900b8860028601601881101561000257602002015160000b145b1561261b5761220b8054740b000000000000000000000000000000000000000060a060020a60ff02199190911617905560009650612657565b856000148015612605575087846002016018811015610002576020020151600090810b145b1561260f57600195505b600393909301926113c1565b600192909201916124e1565b61220b8054740e000000000000000000000000000000000000000060a060020a60ff021991909116179055600196505b505050505050949350505050565b60208901518282603081101561000257602002015101828260308110156100025760009290920b6020929092020152604089015182600183016030811015610002576020020151018260018301603081101561000257600092830b602091820290920191909152830151600290820b07810b148015906127025750600282826001016030811015610002579090602002015160000b0760000b6000145b156127345781816030811015610002576020020151600101828260308110156100025760009290920b60209290920201525b606089015182600283016030811015610002576020020151018260028301603081101561000257600092830b6020919091029091015292505b60058501548310801561277e575085155b15612872576005850180548490811015610002576000918252602082200154810b900b8282603081101561000257602002015160000b1480156127f95750600585018054849081101561000257602060009081209281529101546101009004810b900b8260018301603081101561000257602002015160000b145b801561283c57506005850180548490811015610002576000918252602082200154620100009004810b900b8260028301603081101561000257602002015160000b145b1561287a5761220b805460a060020a60ff021916740c000000000000000000000000000000000000000017905560019650612657565b6003016123fd565b6001929092019161276d565b600092505b505092915050565b60008560000b12156128d057600019850291506128d4565b8460000b6030191315801561144357506031600086900b13612886576001925061288b565b8491505b60008460000b12156128eb575060001983026128ee565b50825b60008460000b12158015612906575060008560000b12155b80612922575060008460000b128015612922575060008560000b135b156129565760028460000b0760000b60001415156129845760c660028302600383020160ff1611612886576001925061288b565b60028460000b0760000b600014156129845760c660028302600383020160ff1611612886576001925061288b565b60c66002600184010260001983016003020160ff1611612886576001925061288b56
compiled:606060405236156100c45760e060020a6000350463182db37081146100c65780634b42d208146100ec578063543855261461012f5780636266b514146101b35780636a864559146101e55780638cae13741461028a57806393eec1fb14610321578063959eac47146103ca578063a55cab95146103e3578063a5ffca0e14610480578063a713081c1461049e578063c7dafc78146104b6578063d39eb3011461054e578063e039e4a1146105eb578063edffcd571461062f578063fa93019c14610646575b005b61220b5460a060020a900460ff165b6040805160ff929092168252519081900360200190f35b6100d56004356024355b60006040836002840260ff908116808403601090810a92603e92909203900a9085908190819081908a168114156123045786935061230a565b604080516020604435600481810135601f81018490048402850184019095528484526100c4948135946024803595939460649492939101918190840183828082843750949650505050505050600034600014156109e85761220b805460a060020a60ff021916742800000000000000000000000000000000000000001790556108a1565b6100c4600435602435600060003460001415611c305761220b805460a060020a60ff02191660a060020a1790556108a1565b610715600435602435604080516020810190915260008152600183602181101561000257506101088402018260218110156100025790906008020160005060010160005080548060200260200160405190810160405280929190818152602001828054801561027e57602002820191906000526020600020905b8154600160a060020a031681526001919091019060200180831161025f575b50505050509050610629565b6040805160a08181019092526100c49160048035926024359260443592916101049160649060059083908390808284375090955050505050506000610300604051908101604052806018905b60008152602001906001900390816102d65750506040805161030081019091526018815b60008152602001906001900390816102fa579050506000600060006000610efa8b8b610375565b604080516020604435600481810135601f81018490048402850184019095528484526100c494813594602480359593946064949293910191819084018382808284375094965050505050505060006108a784845b600060008360ff1610806103965750805460001960ff918216018116908416115b806103a4575060008260ff16105b806103bd575060005460ff908116600019018116908316115b1561062957506001610629565b6100c4600435602435600060006000610c2b8585610375565b61075f60043560243560408051602081019091526000815260018360218110156100025750610108840201826021811015610002579090600802016000506040805160069092018054602060026001831615610100026000190190921691909104601f810182900482028501820190935282845290919083018282801561027e5780601f106108445761010080835404028352916020019161027e565b6100c460043560243560443560006000600060006120b88787610375565b6100c4600435602435604435600061186f8484610375565b61071560043560243560408051602081019091526000815260018360218110156100025750610108840201826021811015610002579090600802016000506040805160029092018054602081810285018101909352808452909183018282801561027e57602002820191906000526020600020905b81600050548152602001906001019080831161052b575b50505050509050610629565b61075f60043560243560408051602081019091526000815260018360218110156100025750610108840201826021811015610002579090600802016000506040805160079092018054602060026001831615610100026000190190921691909104601f810182900482028501820190935282845290919083018282801561027e5780601f106108445761010080835404028352916020019161027e565b6107cd6004356024356000600183602181101561000257506101088402018260218110156100025790906008020160005054600160a060020a031690505b92915050565b6100c460043560243560006000611b1a8484610375565b6107e960043560243560408051602081019091526000815260018360218110156100025761010802016000508260218110156100025760080201600050600301600050805480602002602001604051908101604052809291908181526020016000905b82821015610edf576000848152602081206040805160a08101918290529291850191600591908390855b825461010083900a900460000b8152602060019283018181049485019490930390920291018084116106d35790505050505050815260200190600101906106a9565b60405180806020018281038252838181518152602001915080519060200190602002808383829060006004602084601f0104600302600f01f1509050019250505060405180910390f35b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600302600f01f150905090810190601f1680156107bf5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60408051600160a060020a039092168252519081900360200190f35b60405180806020018281038252838181518152602001915080516000925b818410156108335760208481028401015160a08083818460006004601ef1509050019260010192610807565b925050509250505060405180910390f35b820191906000526020600020905b81548152906001019060200180831161085257509394506106299350505050565b505061220b80547434000000000000000000000000000000000000000060a060020a60ff0219919091161790555b50505050565b156108dc5761220b80547432000000000000000000000000000000000000000060a060020a60ff0219919091161790556108a1565b60018460218110156100025750610108850201836021811015610002579090600802016000508054909150600160a060020a03908116339091161461094b5761220b80547433000000000000000000000000000000000000000060a060020a60ff0219919091161790556108a1565b81816006016000509080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106109b457805160ff19168380011785555b506108739291505b808211156109e457600081556001016109a0565b82800160010185558215610998579182015b828111156109985782518260005055916020019190600101906109c6565b5090565b67016345785d8a00003414610a485760405133600160a060020a031690600090349082818181858883f1505061220b80547429000000000000000000000000000000000000000060a060020a60ff021991909116179055506108a1915050565b610a528484610375565b15610aa85760405133600160a060020a031690600090349082818181858883f1505061220b8054742a000000000000000000000000000000000000000060a060020a60ff021991909116179055506108a1915050565b60018460218110156100025750610108850201836021811015610002579090600802016000508054909150600160a060020a039081163390911614610b385760405133600160a060020a031690600090349082818181858883f1505061220b8054742b000000000000000000000000000000000000000060a060020a60ff021991909116179055506108a1915050565b81816007016000509080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610b9157805160ff19168380011785555b50610bc19291506109a0565b82800160010185558215610b85579182015b82811115610b85578251826000505591602001919060010190610ba3565b505061220b8054742c000000000000000000000000000000000000000060a060020a60ff0219919091161790556108a1565b43600484015561220b80547421000000000000000000000000000000000000000060a060020a60ff02199091161790555b5050505050565b15610c605761220b8054741e000000000000000000000000000000000000000060a060020a60ff021991909116179055610c24565b60018560218110156100025750610108860201846021811015610002579090600802016000508054909350600160a060020a039081163390911614610ccf5761220b8054741f000000000000000000000000000000000000000060a060020a60ff021991909116179055610c24565b6110e0836004016000505443031015610d125761220b80547420000000000000000000000000000000000000000060a060020a60ff021991909116179055610c24565b505043600019014060005b600a8160ff161015610bf35760038301805460018101808355919082908015829011610d5a57600083815260209020610d5a9181019083016109a0565b505050506020610d6a83836100f6565b60038501805460ff929092169290920691906000198101908110156100025750805460008281526020812091909101600019908101805460ff191660f860020a95860295909504949094179093558154909281019081101561000257906000526020600020900160005060016101000a81548160ff021916908360f860020a9081020402179055506000836003016000506001856003016000508054905003815481101561000257906000526020600020900160005060026101000a81548160ff021916908360f860020a908102040217905550600019836003016000506001856003016000508054905003815481101561000257906000526020600020900160005060036101000a81548160ff021916908360f860020a9081020402179055506000836003016000506001856003016000508054905003815481101561000257906000526020600020900160005060046101000a81548160ff021916908360f860020a908102040217905550600101610d1d565b505050509050610629565b50505b5050505050505050505050565b15610f2f5761220b80547414000000000000000000000000000000000000000060a060020a60ff021991909116179055610eed565b60018b602181101561000257506101088c02018a6021811015610002579090600802016000508054909750600160a060020a039081163390911614610f9e5761220b80547415000000000000000000000000000000000000000060a060020a60ff021991909116179055610eed565b6060880151600090810b1215610fde5761220b80547416000000000000000000000000000000000000000060a060020a60ff021991909116179055610eed565b6003870180548a9081101561000257506000908152602081208a0154810b810b808a526040805161220a5460e360020a630379eaeb02825260ff9390931660048201529051600160a060020a039290921692631bcf5758926024838101936103009390839003909101908290876161da5a03f11561000257506040805161030080820180845261220a548e5160e360020a630379eaeb0290925260ff919091166103048401529251919a50600160a060020a03929092169350610324808b01929190818c0301816000876161da5a03f1156100025750505060405180610300016040529450600093505b60188460ff16101561135b57602088015185856018811015610002579090602002015101858560188110156100025760009290920b602092909202015287600290906020020151858560010160188110156100025790906020020151018585600101601881101561000257600092830b602091820290920191909152860151600290820b07810b1480159061117a5750600285856001016018811015610002579090602002015160000b0760000b6000145b156111ac5784846018811015610002576020020151600101858560188110156100025760009290920b60209290920201525b606088015185600286016018811015610002579090602002015101858560020160188110156100025760009290920b60209290920201526003870180548a9081101561000257506000908152602081208a01546101009004900b86856018811015610002579090602002015101868560188110156100025760009290920b60209290920201526003870180548a9081101561000257906000526020600020900160005060029054906101000a900460000b868560010160188110156100025790906020020151018685600101601881101561000257600092830b602091820290920191909152870151600290820b07810b148015906112c85750600286856001016018811015610002579090602002015160000b0760000b6000145b156112fa5785846018811015610002576020020151600101868560188110156100025760009290920b60209290920201525b6003870180548a9081101561000257506000908152602081208a015463010000009004900b8660028601601881101561000257602081028201519092019160188110156100025760009290920b6020929092020152600393909301926110c8565b6114518b8b8a8860006000600060006000610600604051908101604052806030905b600081526020019060019003908161137d57506000905060018b602181101561000257506101088c02018a6021811015610002579090600802016000509450600093505b60188460ff16101561238f576124a288856018811015610002576020020151896001870160188110156100025760200201516000600060008360000b60201913158015611412575060218460000b13155b156128935760028460000b0760000b60001415156128ab578460000b60311913158015611443575060318560000b13155b15612886576001925061288b565b151561145c57610eed565b6000876003016000508a815481101561000257508152602081208a015463010000009004810b810b1261165757600092505b60188360ff16101561169857600091505b6005870154821015611708576005870180548390811015610002576000918252602082200154810b900b86846018811015610002579090602002015160000b14801561152457506005870180548390811015610002576020600090812091909101546101009004810b900b90508660018501601881101561000257602002015160000b145b801561156757506005870180548390811015610002576000918252602082200154620100009004810b900b8660028501601881101561000257602002015160000b145b1561164b57848360188110156100025760200201516005880180548490811015610002576000918252602090912001805460ff191660f860020a9283029290920491909117905584600184016018811015610002576020020151600588018054849081101561000257906000526020600020900160005060016101000a81548160ff021916908360f860020a90810204021790555084836002016018811015610002576020020151600588018054849081101561000257906000526020600020900160005060026101000a81548160ff021916908360f860020a9081020402179055505b6001919091019061149f565b5060005b60188160ff1610156116985760058701805460018101808355909190828015829011611714576000838152602090206117149181019083016109a0565b87876003016000508a815481101561000257506000908152602081208b01916001830191839060a08301905b8382111561182157835183826101000a81548160ff021916908360f860020a90810204021790555092602001926001016020816000010492830192600103026116c4565b6003929092019161148e565b505050508481601881101561000257602002015160058801805460001981019081101561000257906000526020600020900160005060006101000a81548160ff021916908360f860020a908102040217905550848160010160188110156100025760058901805460209290920290920151919060001981019081101561000257906000526020600020900160005060016101000a81548160ff021916908360f860020a908102040217905550848160020160188110156100025760058901805460209290920290920151919060001981019081101561000257906000526020600020900160005060026101000a81548160ff021916908360f860020a90810204021790555060030161165b565b801561184e5782816101000a81549060ff0219169055600101602081600001049283019260010302611821565b5050610eea9291505b808211156109e457805460ff19168155600101611857565b156118a45761220b80547446000000000000000000000000000000000000000060a060020a60ff0219919091161790556108a1565b60018460218110156100025750610108850201836021811015610002579090600802016000508054909150600160a060020a0390811633909116146119135761220b80547447000000000000000000000000000000000000000060a060020a60ff0219919091161790556108a1565b60008260ff16108061192f575060028101546000190160ff8316115b156119645761220b80547448000000000000000000000000000000000000000060a060020a60ff0219919091161790556108a1565b611aea8484845b6000806001856021811015610002576101080201846021811015610002576008020160018101805491935090849081101561000257908252602082200154600283018054600160a060020a0392909216918391908690811015610002579060005260206000209001600050546040516000818181858888f19350505050508160010160005083815481101561000257906000526020600020900160006101000a815490600160a060020a030219169055816002016000508381548110156100025790600052602060002090016000506000905550600182015b600182015460ff8216101561231d57600182018054829081101561000257508054600082815260209020830154600160a060020a0316919060001984019081101561000257505060206000208201600019018054600160a060020a03191690911790556002820180548290811015610002575080546000828152602090208301549190600019840190811015610002575050602060002082016000190155600101611a44565b61220b80547449000000000000000000000000000000000000000060a060020a60ff0219919091161790556108a1565b15611b4c5761220b805460a060020a60ff021916743c00000000000000000000000000000000000000001790556108a1565b60018460218110156100025750610108850201836021811015610002579090600802016000509150600090505b600182015460ff82161015611bf35733600160a060020a03168260010160005082815481101561000257600091825260209091200154600160a060020a03161415611c235761220b8054743d000000000000000000000000000000000000000060a060020a60ff0219909116179055611c2b84848361196b565b61220b8054743e000000000000000000000000000000000000000060a060020a60ff0219919091161790556108a1565b600101611b79565b6108a1565b611c3a8484610375565b15611c905761220b80547402000000000000000000000000000000000000000060a060020a60ff02199190911617905560405133600160a060020a031690600090349082818181858883f19350505050506108a1565b60018460218110156100025750610108850201836021811015610002579090600802016000508054909250600160a060020a031660001415611db35734670de0b6b3a7640000141580611d5d575061220b54604080517f4166c1fd00000000000000000000000000000000000000000000000000000000815260ff8781166004830152861660248201529051607d92600160a060020a031691634166c1fd91604482810192602092919082900301816000876161da5a03f1156100025750506040515160ff169190911090505b15611e515760405133600160a060020a031690600090349082818181858883f1505061220b80547403000000000000000000000000000000000000000060a060020a60ff021991909116179055506108a1915050565b8154600160a060020a03908116339091161480611dd65750662386f26fc1000034105b80611dea575069d3c21bcecceda100000034115b80611dfb57506001820154600a9010155b15611eb35760405133600160a060020a031690600090349082818181858883f1505061220b80547405000000000000000000000000000000000000000060a060020a60ff021991909116179055506108a1915050565b60405161220954600160a060020a031690600090349082818181858883f150508454600160a060020a03191633178555505061220b80547404000000000000000000000000000000000000000060a060020a60ff0219909116179055506108a1565b5060005b600182015460ff82161015611f845733600160a060020a03168260010160005082815481101561000257600091825260209091200154600160a060020a03161415611fb45733600160a060020a03166000836002016000508381548110156100025790825260208220018150546040516000818181858888f15050505060028301805434925083908110156100025790600052602060002090016000505561220b80547406000000000000000000000000000000000000000060a060020a60ff02199091161790556108a1565b60018281018054918201808255828015829011611fbc57818360005260206000209182019101611fbc91906109a0565b600101611eb7565b50505060028301805460018101808355909250828015829011611ff257818360005260206000209182019101611ff291906109a0565b505050506001820180543391906000198101908110156100025750805460009182526020909120016000199081018054600160a060020a03191690921790915560028301805434928101908110156100025790600052602060002090016000505561220b80547407000000000000000000000000000000000000000060a060020a60ff02199091161790556108a1565b5061220b80547453000000000000000000000000000000000000000060a060020a60ff0219919091161790555b50505050505050565b156120ed5761220b80547450000000000000000000000000000000000000000060a060020a60ff0219919091161790556120af565b60018760218110156100025750610108880201866021811015610002579090600802016000508054909450600160a060020a03908116339091161461215c5761220b80547451000000000000000000000000000000000000000060a060020a60ff0219919091161790556120af565b60008560ff161080612178575060028401546000190160ff8616115b156121ad5761220b80547452000000000000000000000000000000000000000060a060020a60ff0219919091161790556120af565b6002840180548690811015610002575060009081526020812086015460405161220954919550600a86049450600160a060020a03919091169190849082818181858883f1508754600160a060020a031693509086039082818181858883f19350505050508360010160005085815481101561000257506000908152602081208601548554600160a060020a031916600160a060020a039190911617855590505b600184015460ff821610156122c55760ff818116908616146122bd576001840180548290811015610002576000918252602082200154600286018054600160a060020a0392909216929184908110156100025790825260208220018150546040516000818181858888f150505050505b60010161224d565b600184018054600080835591825260209091206122e4918101906109a0565b5060028401805460008083559182526020909120612082918101906109a0565b85870693505b5050508181069003049695505050505050565b600182018054600019810180835590919082801582901161234f5760008381526020902061234f9181019083016109a0565b50505060028301805460001981018083559092508280158290116123865781836000526020600020918201910161238691906109a0565b50505050610c24565b85600014156126275761220a54600160a060020a0316630878bc518a6000909060200201516040518260e060020a028152600401808260ff168152602001915050610600604051808303816000876161da5a03f1156100025750505060405180610600016040529150600090505b60308160ff1610801561240e575085155b156124715781816030811015610002576020020151600090810b14801561244a575081816001016030811015610002576020020151600090810b145b801561246b575081816002016030811015610002576020020151600090810b145b15612665575b61220b805460a060020a60ff021916740d000000000000000000000000000000000000000017905560009650612657565b15156124dc5761220b8054740a000000000000000000000000000000000000000060a060020a60ff02199190911617905560009650612657565b600092505b60058501548310156125e0576005850180548490811015610002576000918252602082200154810b900b8885601881101561000257602002015160000b14801561256457506005850180548490811015610002576020600090812091909101546101009004810b900b90508860018601601881101561000257602002015160000b145b80156125a757506005850180548490811015610002576000918252602082200154620100009004810b900b8860028601601881101561000257602002015160000b145b1561261b5761220b8054740b000000000000000000000000000000000000000060a060020a60ff02199190911617905560009650612657565b856000148015612605575087846002016018811015610002576020020151600090810b145b1561260f57600195505b600393909301926113c1565b600192909201916124e1565b61220b8054740e000000000000000000000000000000000000000060a060020a60ff021991909116179055600196505b505050505050949350505050565b60208901518282603081101561000257602002015101828260308110156100025760009290920b6020929092020152604089015182600183016030811015610002576020020151018260018301603081101561000257600092830b602091820290920191909152830151600290820b07810b148015906127025750600282826001016030811015610002579090602002015160000b0760000b6000145b156127345781816030811015610002576020020151600101828260308110156100025760009290920b60209290920201525b606089015182600283016030811015610002576020020151018260028301603081101561000257600092830b6020919091029091015292505b60058501548310801561277e575085155b15612872576005850180548490811015610002576000918252602082200154810b900b8282603081101561000257602002015160000b1480156127f95750600585018054849081101561000257602060009081209281529101546101009004810b900b8260018301603081101561000257602002015160000b145b801561283c57506005850180548490811015610002576000918252602082200154620100009004810b900b8260028301603081101561000257602002015160000b145b1561287a5761220b805460a060020a60ff021916740c000000000000000000000000000000000000000017905560019650612657565b6003016123fd565b6001929092019161276d565b600092505b505092915050565b60008560000b12156128d057600019850291506128d4565b8460000b6030191315801561144357506031600086900b13612886576001925061288b565b8491505b60008460000b12156128eb575060001983026128ee565b50825b60008460000b12158015612906575060008560000b12155b80612922575060008460000b128015612922575060008560000b135b156129565760028460000b0760000b60001415156129845760c660028302600383020160ff1611612886576001925061288b565b60028460000b0760000b600014156129845760c660028302600383020160ff1611612886576001925061288b565b60c66002600184010260001983016003020160ff1611612886576001925061288b56
*/
contract BlockDefStorage
{
function getOccupies(uint8 which) public returns (int8[24])
{}
function getAttachesto(uint8 which) public returns (int8[48])
{}
}
contract MapElevationRetriever
{
function getElevation(uint8 col, uint8 row) public constant returns (uint8)
{}
}
contract Etheria //is mortal
{
uint8 mapsize = 33;
Tile[33][33] tiles;
address creator;
struct Tile
{
address owner;
address[] offerers;
uint[] offers;
int8[5][] blocks; //0 = which,1 = blockx,2 = blocky,3 = blockz, 4 = color
uint lastfarm;
int8[3][] occupado;
string name;
string status;
}
BlockDefStorage bds;
MapElevationRetriever mer;
function Etheria() {
creator = msg.sender;
bds = BlockDefStorage(0x782bdf7015b71b64f6750796dd087fde32fd6fdc);
mer = MapElevationRetriever(0x68549d7dbb7a956f955ec1263f55494f05972a6b);
}
function getOwner(uint8 col, uint8 row) public constant returns(address)
{
return tiles[col][row].owner; // no harm if col,row are invalid
}
/***
* _ _ ___ ___ ___ _____ _____ _____ ___ _____ _ _ _____
* | \ | | / _ \ | \/ || ___| ___ / ___|_ _/ _ \_ _| | | / ___|
* | \| |/ /_\ \| . . || |__ ( _ ) \ `--. | |/ /_\ \| | | | | \ `--.
* | . ` || _ || |\/| || __| / _ \/\ `--. \ | || _ || | | | | |`--. \
* | |\ || | | || | | || |___ | (_> < /\__/ / | || | | || | | |_| /\__/ /
* \_| \_/\_| |_/\_| |_/\____/ \___/\/ \____/ \_/\_| |_/\_/ \___/\____/
*
*
*/
function getName(uint8 col, uint8 row) public constant returns(string)
{
return tiles[col][row].name; // no harm if col,row are invalid
}
function setName(uint8 col, uint8 row, string _n) public
{
if(isOOB(col,row)) // row and/or col was not between 0-mapsize
{
whathappened = 50;
return;
}
Tile tile = tiles[col][row];
if(tile.owner != msg.sender)
{
whathappened = 51;
return;
}
tile.name = _n;
whathappened = 52;
return;
}
function getStatus(uint8 col, uint8 row) public constant returns(string)
{
return tiles[col][row].status; // no harm if col,row are invalid
}
function setStatus(uint8 col, uint8 row, string _s) public // setting status costs .1 eth. (currently 5 cents. Cry me a river.)
{
if(msg.value == 0) // the only situation where we don't refund money.
{
whathappened = 40;
return;
}
if(msg.value != 100000000000000000) // the only situation
{
msg.sender.send(msg.value); // return their money
whathappened = 41;
return;
}
if(isOOB(col,row)) // row and/or col was not between 0-mapsize
{
msg.sender.send(msg.value); // return their money
whathappened = 42;
return;
}
Tile tile = tiles[col][row];
if(tile.owner != msg.sender)
{
msg.sender.send(msg.value); // return their money
whathappened = 43;
return;
}
tile.status = _s;
whathappened = 44;
return;
}
/***
* ______ ___ _________ ________ _ _ _____ ___________ _____ _____ _____ _ _ _____
* | ___/ _ \ | ___ \ \/ |_ _| \ | | __ \ ___ | ___| _ \_ _|_ _|_ _| \ | | __ \
* | |_ / /_\ \| |_/ / . . | | | | \| | | \/ ( _ ) | |__ | | | | | | | | | | | \| | | \/
* | _|| _ || /| |\/| | | | | . ` | | __ / _ \/\ | __|| | | | | | | | | | | . ` | | __
* | | | | | || |\ \| | | |_| |_| |\ | |_\ \ | (_> < | |___| |/ / _| |_ | | _| |_| |\ | |_\ \
* \_| \_| |_/\_| \_\_| |_/\___/\_| \_/\____/ \___/\/ \____/|___/ \___/ \_/ \___/\_| \_/\____/
*
*/
function farmTile(uint8 col, uint8 row) public
{
if(isOOB(col,row)) // row and/or col was not between 0-mapsize
{
whathappened = 30;
return;
}
Tile tile = tiles[col][row];
if(tile.owner != msg.sender)
{
whathappened = 31;
return;
}
if((block.number - tile.lastfarm) < 4320) // a day's worth of blocks hasn't passed yet. can only farm once a day. (Assumes block times of 20 seconds.)
{
whathappened = 32;
return;
}
bytes32 lastblockhash = block.blockhash(block.number - 1);
for(uint8 i = 0; i < 10; i++)
{
tile.blocks.length+=1;
tile.blocks[tile.blocks.length - 1][0] = int8(getUint8FromByte32(lastblockhash,i) % 32); // which, guaranteed 0-31
tile.blocks[tile.blocks.length - 1][1] = 0; // x
tile.blocks[tile.blocks.length - 1][2] = 0; // y
tile.blocks[tile.blocks.length - 1][3] = -1; // z
tile.blocks[tile.blocks.length - 1][4] = 0; // color
}
tile.lastfarm = block.number;
whathappened = 33;
return;
}
function editBlock(uint8 col, uint8 row, uint index, int8[5] _block)
{
if(isOOB(col,row)) // row and/or col was not between 0-mapsize
{
whathappened = 20;
return;
}
Tile tile = tiles[col][row];
if(tile.owner != msg.sender) // 1. DID THE OWNER SEND THIS MESSAGE?
{
whathappened = 21;
return;
}
if(_block[3] < 0) // 2. IS THE Z LOCATION OF THE BLOCK BELOW ZERO? BLOCKS CANNOT BE HIDDEN
{
whathappened = 22;
return;
}
_block[0] = tile.blocks[index][0]; // can't change the which, so set it to whatever it already was
int8[24] memory didoccupy = bds.getOccupies(uint8(_block[0]));
int8[24] memory wouldoccupy = bds.getOccupies(uint8(_block[0]));
for(uint8 b = 0; b < 24; b+=3) // always 8 hexes, calculate the didoccupy
{
wouldoccupy[b] = wouldoccupy[b]+_block[1];
wouldoccupy[b+1] = wouldoccupy[b+1]+_block[2];
if(wouldoccupy[1] % 2 != 0 && wouldoccupy[b+1] % 2 == 0) // if anchor y is odd and this hex y is even, (SW NE beam goes 11,`2`2,23,`3`4,35,`4`6,47,`5`8 ` = x value incremented by 1. Same applies to SW NE beam from 01,12,13,24,25,36,37,48)
wouldoccupy[b] = wouldoccupy[b]+1; // then offset x by +1
wouldoccupy[b+2] = wouldoccupy[b+2]+_block[3];
didoccupy[b] = didoccupy[b]+tile.blocks[index][1];
didoccupy[b+1] = didoccupy[b+1]+tile.blocks[index][2];
if(didoccupy[1] % 2 != 0 && didoccupy[b+1] % 2 == 0) // if anchor y and this hex y are both odd,
didoccupy[b] = didoccupy[b]+1; // then offset x by +1
didoccupy[b+2] = didoccupy[b+2]+tile.blocks[index][3];
}
if(!isValidLocation(col,row,_block, wouldoccupy))
{
return; // whathappened is already set
}
// EVERYTHING CHECKED OUT, WRITE OR OVERWRITE THE HEXES IN OCCUPADO
if(tile.blocks[index][3] >= 0) // If the previous z was greater than 0 (i.e. not hidden) ...
{
for(uint8 l = 0; l < 24; l+=3) // loop 8 times,find the previous occupado entries and overwrite them
{
for(uint o = 0; o < tile.occupado.length; o++)
{
if(didoccupy[l] == tile.occupado[o][0] && didoccupy[l+1] == tile.occupado[o][1] && didoccupy[l+2] == tile.occupado[o][2]) // x,y,z equal?
{
tile.occupado[o][0] = wouldoccupy[l]; // found it. Overwrite it
tile.occupado[o][1] = wouldoccupy[l+1];
tile.occupado[o][2] = wouldoccupy[l+2];
}
}
}
}
else // previous block was hidden
{
for(uint8 ll = 0; ll < 24; ll+=3) // add the 8 new hexes to occupado
{
tile.occupado.length++;
tile.occupado[tile.occupado.length-1][0] = wouldoccupy[ll];
tile.occupado[tile.occupado.length-1][1] = wouldoccupy[ll+1];
tile.occupado[tile.occupado.length-1][2] = wouldoccupy[ll+2];
}
}
tile.blocks[index] = _block;
return;
}
function getBlocks(uint8 col, uint8 row) public constant returns (int8[5][])
{
return tiles[col][row].blocks; // no harm if col,row are invalid
}
/***
* _________________ ___________ _____
* | _ | ___| ___| ___| ___ \/ ___|
* | | | | |_ | |_ | |__ | |_/ /\ `--.
* | | | | _| | _| | __|| / `--. \
* \ \_/ / | | | | |___| |\ \ /\__/ /
* \___/\_| \_| \____/\_| \_|\____/
*
*/
function makeOffer(uint8 col, uint8 row)
{
if(msg.value == 0) // checking this first means that we will ALWAYS need to return money on any other failure
{
whathappened = 1;
return;
} // do nothing, just return
if(isOOB(col,row)) // row and/or col was not between 0-mapsize
{
whathappened = 2;
msg.sender.send(msg.value); // return their money
return;
}
Tile tile = tiles[col][row];
if(tile.owner == address(0x0000000000000000000000000000000000000000)) // if UNOWNED
{
if(msg.value != 1000000000000000000 || mer.getElevation(col,row) < 125) // 1 ETH is the starting value. If not return; // Also, if below sea level, return.
{
msg.sender.send(msg.value); // return their money
whathappened = 3;
return;
}
else
{
creator.send(msg.value); // this was a valid offer, send money to contract creator
tile.owner = msg.sender; // set tile owner to the buyer
whathappened = 4;
return;
}
}
else // if already OWNED
{
if(tile.owner == msg.sender || msg.value < 10000000000000000 || msg.value > 1000000000000000000000000 || tile.offerers.length >= 10 ) // trying to make an offer on their own tile. or the offer list is full (10 max) or the value is out of range (.01 ETH - 1 mil ETH is range)
{
msg.sender.send(msg.value); // return the money
whathappened = 5;
return;
}
else
{
for(uint8 i = 0; i < tile.offerers.length; i++)
{
if(tile.offerers[i] == msg.sender) // user has already made an offer. Update it and return;
{
msg.sender.send(tile.offers[i]); // return their previous money
tile.offers[i] = msg.value; // set the new offer
whathappened = 6;
return;
}
}
// the user has not yet made an offer
tile.offerers.length++; // make room for 1 more
tile.offers.length++; // make room for 1 more
tile.offerers[tile.offerers.length - 1] = msg.sender; // record who is making the offer
tile.offers[tile.offers.length - 1] = msg.value; // record the offer
whathappened = 7;
return;
}
}
}
function retractOffer(uint8 col, uint8 row) // retracts the first offer in the array by this user.
{
if(isOOB(col,row)) // row and/or col was not between 0-mapsize
{
whathappened = 60;
return;
}
Tile tile = tiles[col][row];
for(uint8 i = 0; i < tile.offerers.length; i++)
{
if(tile.offerers[i] == msg.sender) // this user has an offer on file. Remove it.
{
whathappened = 61;
removeOffer(col,row,i);
return;
}
}
whathappened = 62; // no offer found for msg.sender
return;
}
function rejectOffer(uint8 col, uint8 row, uint8 i) // index 0-10
{
if(isOOB(col,row)) // row and/or col was not between 0-mapsize
{
whathappened = 70;
return;
}
Tile tile = tiles[col][row];
if(tile.owner != msg.sender) // only the owner can reject offers
{
whathappened = 71;
return;
}
if(i < 0 || i > (tile.offers.length - 1)) // index oob
{
whathappened = 72;
return;
}
removeOffer(col,row,i);
whathappened = 73;
return;
}
function removeOffer(uint8 col, uint8 row, uint8 i) private // index 0-10, can't be odd
{
Tile tile = tiles[col][row]; // private method. No need to check col,row validity
tile.offerers[i].send(tile.offers[i]); // return the money
// delete user and offer and reshape the array
delete tile.offerers[i]; // zero out user
delete tile.offers[i]; // zero out offer
for(uint8 j = i+1; j < tile.offerers.length; j++) // close the arrays after the gap
{
tile.offerers[j-1] = tile.offerers[j];
tile.offers[j-1] = tile.offers[j];
}
tile.offerers.length--;
tile.offers.length--;
return;
}
function acceptOffer(uint8 col, uint8 row, uint8 i) // accepts the offer at index (1-10)
{
if(isOOB(col,row)) // row and/or col was not between 0-mapsize
{
whathappened = 80;
return;
}
Tile tile = tiles[col][row];
if(tile.owner != msg.sender) // only the owner can reject offers
{
whathappened = 81;
return;
}
if(i < 0 || i > (tile.offers.length - 1)) // index oob
{
whathappened = 82;
return;
}
uint offeramount = tile.offers[i];
uint housecut = offeramount / 10;
creator.send(housecut);
tile.owner.send(offeramount-housecut); // send offer money to oldowner
tile.owner = tile.offerers[i]; // new owner is the offerer
for(uint8 j = 0; j < tile.offerers.length; j++) // return all the other offerers' offer money
{
if(j != i) // don't return money for the purchaser
tile.offerers[j].send(tile.offers[j]);
}
delete tile.offerers; // delete all offerers
delete tile.offers; // delete all offers
whathappened = 83;
return;
}
function getOfferers(uint8 col, uint8 row) constant returns (address[])
{
return tiles[col][row].offerers; // no harm if col,row are invalid
}
function getOffers(uint8 col, uint8 row) constant returns (uint[])
{
return tiles[col][row].offers; // no harm if col,row are invalid
}
function isOOB(uint8 col, uint8 row) private constant returns (bool)
{
if(col < 0 || col > (mapsize-1) || row < 0 || row > (mapsize-1))
return true; // is out of bounds
}
/***
* _ _ _____ _____ _ _____ _______ __
* | | | |_ _|_ _| | |_ _|_ _\ \ / /
* | | | | | | | | | | | | | | \ V /
* | | | | | | | | | | | | | | \ /
* | |_| | | | _| |_| |_____| |_ | | | |
* \___/ \_/ \___/\_____/\___/ \_/ \_/
*
*/
// this logic COULD be reduced a little, but the gain is minimal and readability suffers
function blockHexCoordsValid(int8 x, int8 y) private constant returns (bool)
{
if(-33 <= y && y <= 33)
{
if(y % 2 != 0 ) // odd
{
if(-50 <= x && x <= 49)
return true;
}
else // even
{
if(-49 <= x && x <= 49)
return true;
}
}
else
{
uint8 absx;
uint8 absy;
if(x < 0)
absx = uint8(x*-1);
else
absx = uint8(x);
if(y < 0)
absy = uint8(y*-1);
else
absy = uint8(y);
if((y >= 0 && x >= 0) || (y < 0 && x > 0)) // first or 4th quadrants
{
if(y % 2 != 0 ) // odd
{
if (((absx*2) + (absy*3)) <= 198)
return true;
}
else // even
{
if ((((absx+1)*2) + ((absy-1)*3)) <= 198)
return true;
}
}
else
{
if(y % 2 == 0 ) // even
{
if (((absx*2) + (absy*3)) <= 198)
return true;
}
else // odd
{
if ((((absx+1)*2) + ((absy-1)*3)) <= 198)
return true;
}
}
}
return false;
}
// SEVERAL CHECKS TO BE PERFORMED
// 1. DID THE OWNER SEND THIS MESSAGE? (SEE editBlock)
// 2. IS THE Z LOCATION OF THE BLOCK BELOW ZERO? BLOCKS CANNOT BE HIDDEN AFTER SHOWING (SEE editBlock)
// 3. DO ANY OF THE PROPOSED HEXES FALL OUTSIDE OF THE TILE?
// 4. DO ANY OF THE PROPOSED HEXES CONFLICT WITH ENTRIES IN OCCUPADO?
// 5. DO ANY OF THE BLOCKS TOUCH ANOTHER?
// 6. NONE OF THE OCCUPY BLOCKS TOUCHED THE GROUND. BUT MAYBE THEY TOUCH ANOTHER BLOCK?
function isValidLocation(uint8 col, uint8 row, int8[5] _block, int8[24] wouldoccupy) private constant returns (bool)
{
bool touches;
Tile tile = tiles[col][row]; // since this is a private method, we don't need to check col,row validity
for(uint8 b = 0; b < 24; b+=3) // always 8 hexes, calculate the wouldoccupy and the didoccupy
{
if(!blockHexCoordsValid(wouldoccupy[b], wouldoccupy[b+1])) // 3. DO ANY OF THE PROPOSED HEXES FALL OUTSIDE OF THE TILE?
{
whathappened = 10;
return false;
}
for(uint o = 0; o < tile.occupado.length; o++) // 4. DO ANY OF THE PROPOSED HEXES CONFLICT WITH ENTRIES IN OCCUPADO?
{
if(wouldoccupy[b] == tile.occupado[o][0] && wouldoccupy[b+1] == tile.occupado[o][1] && wouldoccupy[b+2] == tile.occupado[o][2]) // do the x,y,z entries of each match?
{
whathappened = 11;
return false; // this hex conflicts. The proposed block does not avoid overlap. Return false immediately.
}
}
if(touches == false && wouldoccupy[b+2] == 0) // 5. DO ANY OF THE BLOCKS TOUCH ANOTHER? (GROUND ONLY FOR NOW)
{
touches = true; // once true, always true til the end of this method. We must keep looping to check all the hexes for conflicts and tile boundaries, though, so we can't return true here.
}
}
// now if we're out of the loop and here, there were no conflicts and the block was found to be in the tile boundary.
// touches may be true or false, so we need to check
if(touches == false) // 6. NONE OF THE OCCUPY BLOCKS TOUCHED THE GROUND. BUT MAYBE THEY TOUCH ANOTHER BLOCK?
{
int8[48] memory attachesto = bds.getAttachesto(uint8(_block[0]));
for(uint8 a = 0; a < 48 && !touches; a+=3) // always 8 hexes, calculate the wouldoccupy and the didoccupy
{
if(attachesto[a] == 0 && attachesto[a+1] == 0 && attachesto[a+2] == 0) // there are no more attachestos available, break (0,0,0 signifies end)
break;
attachesto[a] = attachesto[a]+_block[1];
attachesto[a+1] = attachesto[a+1]+_block[2];
if(attachesto[1] % 2 != 0 && attachesto[a+1] % 2 == 0) // if anchor y and this hex y are both odd, (for attachesto, anchory is the same as for occupies, but the z is different. Nothing to worry about)
attachesto[a] = attachesto[a]+1; // then offset x by +1
attachesto[a+2] = attachesto[a+2]+_block[3];
for(o = 0; o < tile.occupado.length && !touches; o++)
{
if(attachesto[a] == tile.occupado[o][0] && attachesto[a+1] == tile.occupado[o][1] && attachesto[a+2] == tile.occupado[o][2]) // a valid attachesto found in occupado?
{
whathappened = 12;
return true; // in bounds, didn't conflict and now touches is true. All good. Return.
}
}
}
whathappened = 13;
return false;
}
else // touches was true by virtue of a z = 0 above (touching the ground). Return true;
{
whathappened = 14;
return true;
}
}
// This function is handy for getting random numbers from 0-255 without getting a new hash every time.
// With one bytes32, there are 32 of these available, depending on the index
function getUint8FromByte32(bytes32 _b32, uint8 byteindex) public constant returns(uint8) {
uint numdigits = 64;
uint buint = uint(_b32);
uint upperpowervar = 16 ** (numdigits - (byteindex*2)); // @i=0 upperpowervar=16**64 (SEE EXCEPTION BELOW), @i=1 upperpowervar=16**62, @i upperpowervar=16**60
uint lowerpowervar = 16 ** (numdigits - 2 - (byteindex*2)); // @i=0 upperpowervar=16**62, @i=1 upperpowervar=16**60, @i upperpowervar=16**58
uint postheadchop;
if(byteindex == 0)
postheadchop = buint; //for byteindex 0, buint is just the input number. 16^64 is out of uint range, so this exception has to be made.
else
postheadchop = buint % upperpowervar; // @i=0 _b32=a1b2c3d4... postheadchop=a1b2c3d4, @i=1 postheadchop=b2c3d4, @i=2 postheadchop=c3d4
uint remainder = postheadchop % lowerpowervar; // @i=0 remainder=b2c3d4, @i=1 remainder=c3d4, @i=2 remainder=d4
uint evenedout = postheadchop - remainder; // @i=0 evenedout=a1000000, @i=1 remainder=b20000, @i=2 remainder=c300
uint b = evenedout / lowerpowervar; // @i=0 b=a1 (to uint), @i=1 b=b2, @i=2 b=c3
return uint8(b);
}
uint8 whathappened;
function getWhatHappened() public constant returns (uint8)
{
return whathappened;
}
}