tx · DNhqtpMLqzvLAn4aX3se1YdqLfEFyTtNgDTtRreouQpb 3MuVEuhXaTvF3ELakZksUP77a4bT8gPJtm6: -0.01000000 Waves 2021.12.06 13:18 [1822271] smart account 3MuVEuhXaTvF3ELakZksUP77a4bT8gPJtm6 > SELF 0.00000000 Waves
{ "type": 13, "id": "DNhqtpMLqzvLAn4aX3se1YdqLfEFyTtNgDTtRreouQpb", "fee": 1000000, "feeAssetId": null, "timestamp": 1638785923414, "version": 2, "chainId": 84, "sender": "3MuVEuhXaTvF3ELakZksUP77a4bT8gPJtm6", "senderPublicKey": "2LizaCNygFYwGFKe34vvFHgJc4ckK7MpzRzziRNn56Cu", "proofs": [ "36PhLM1FpCCGYqjc3JN9GqUCvizu4gkxcHJ6FFNy3xGJy8b1BA1vesvLHUYpmbi4Q5dgWy4BKUPUUEsE8aCu2WG9" ], "script": "base64:AAIDAAAAAAAAAAcIARIDCgEIAAAABAAAAAAMYW5zd2Vyc0NvdW50AAAAAAAAAAADAAAAAAdhbnN3ZXJzCQAETAAAAAICAAAADkl0IGlzIGNlcnRhaW4uCQAETAAAAAICAAAAE0l0IGlzIGRlY2lkZWRseSBzby4JAARMAAAAAgIAAAAOVmVyeSBkb3VidGZ1bC4FAAAAA25pbAEAAAAJZ2V0QW5zd2VyAAAAAgAAAAhxdWVzdGlvbgAAAA5wcmV2aW91c0Fuc3dlcgQAAAAEaGFzaAkAAfcAAAABCQABmwAAAAEJAAEsAAAAAgUAAAAIcXVlc3Rpb24FAAAADnByZXZpb3VzQW5zd2VyBAAAAAVpbmRleAkABLEAAAABBQAAAARoYXNoCQABkQAAAAIFAAAAB2Fuc3dlcnMJAABqAAAAAgUAAAAFaW5kZXgFAAAADGFuc3dlcnNDb3VudAEAAAARZ2V0UHJldmlvdXNBbnN3ZXIAAAABAAAAB2FkZHJlc3MEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwkAASwAAAACBQAAAAdhZGRyZXNzAgAAAAJfYQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhBQAAAAdhZGRyZXNzAAAAAQAAAAFpAQAAAAZ0ZWxsbWUAAAABAAAACHF1ZXN0aW9uBAAAAA1jYWxsZXJBZGRyZXNzCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAABmFuc3dlcgkBAAAACWdldEFuc3dlcgAAAAIFAAAACHF1ZXN0aW9uCQEAAAARZ2V0UHJldmlvdXNBbnN3ZXIAAAABBQAAAA1jYWxsZXJBZGRyZXNzCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIFAAAADWNhbGxlckFkZHJlc3MCAAAAAl9xBQAAAAhxdWVzdGlvbgkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACBQAAAA1jYWxsZXJBZGRyZXNzAgAAAAJfYQUAAAAGYW5zd2VyBQAAAANuaWwAAAAAIIHySw==", "height": 1822271, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6s59VKruHww9xcxnM4mUwFivC8wwfZizYaJRtUnSovqV Next: 7N6UjyYgYduXAZPbwdpWyTVCbza3P5h5dehGghEWBccL Full:
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let | |
4 | + | let answersCount = 3 | |
5 | 5 | ||
6 | - | let | |
6 | + | let answers = ["It is certain.", "It is decidedly so.", "Very doubtful."] | |
7 | 7 | ||
8 | - | let separ = "|||||" | |
8 | + | func getAnswer (question,previousAnswer) = { | |
9 | + | let hash = sha256(toBytes((question + previousAnswer))) | |
10 | + | let index = toInt(hash) | |
11 | + | answers[(index % answersCount)] | |
12 | + | } | |
9 | 13 | ||
10 | - | let incrprice = 50 | |
11 | 14 | ||
12 | - | let initprice = "100000" | |
15 | + | func getPreviousAnswer (address) = match getString(this, (address + "_a")) { | |
16 | + | case a: String => | |
17 | + | a | |
18 | + | case _ => | |
19 | + | address | |
20 | + | } | |
13 | 21 | ||
14 | - | let masterfee = 1 | |
15 | 22 | ||
16 | 23 | @Callable(i) | |
17 | - | func paint (idata) = { | |
18 | - | let callerAdress = toBase58String(i.caller.bytes) | |
19 | - | let reqdata = split(idata, "-|-") | |
20 | - | let color = if ((size(reqdata) > 1)) | |
21 | - | then reqdata[1] | |
22 | - | else "0" | |
23 | - | let url = if ((size(reqdata) > 2)) | |
24 | - | then reqdata[2] | |
25 | - | else "-" | |
26 | - | let pixxy = split(reqdata[0], separ) | |
27 | - | let number = min([30, size(pixxy)]) | |
28 | - | let emptycommand = ["--", "--", masteradr, "0"] | |
29 | - | let newrecord = [callerAdress, initprice, color, url] | |
30 | - | func validxy (x) = match parseInt(pixxy[x]) { | |
31 | - | case a: Int => | |
32 | - | if (if ((parseIntValue(pixxy[x]) > -1)) | |
33 | - | then (1000 > parseIntValue(pixxy[x])) | |
34 | - | else false) | |
35 | - | then parseIntValue(pixxy[x]) | |
36 | - | else -1 | |
37 | - | case _ => | |
38 | - | -1 | |
39 | - | } | |
40 | - | ||
41 | - | func getrecord (x) = match getString(pixxy[x]) { | |
42 | - | case a: String => | |
43 | - | getStringValue(pixxy[x]) | |
44 | - | case _ => | |
45 | - | "" | |
46 | - | } | |
47 | - | ||
48 | - | func command (x) = if (if ((x > (number - 1))) | |
49 | - | then true | |
50 | - | else (0 > validxy(x))) | |
51 | - | then emptycommand | |
52 | - | else if ((getrecord(x) == "")) | |
53 | - | then [pixxy[x], makeString(newrecord, separ), masteradr, initprice] | |
54 | - | else { | |
55 | - | let oldrecord = split(getStringValue(pixxy[x]), separ) | |
56 | - | let price = oldrecord[1] | |
57 | - | [pixxy[x], makeString([callerAdress, toString(fraction(parseIntValue(price), (100 + incrprice), 100)), color, url], separ), oldrecord[0], price] | |
58 | - | } | |
59 | - | ||
60 | - | let all = [command(0), command(1), command(2), command(3), command(4), command(5), command(6), command(7), command(8), command(9), command(10), command(11), command(12), command(13), command(14), command(15), command(16), command(17), command(18), command(19), command(20), command(21), command(22), command(23), command(24), command(25), command(26), command(27), command(28)] | |
61 | - | let payment = toString(fraction(((((((((((((((((((((((((((((parseIntValue(all[0][3]) + parseIntValue(all[1][3])) + parseIntValue(all[2][3])) + parseIntValue(all[3][3])) + parseIntValue(all[4][3])) + parseIntValue(all[5][3])) + parseIntValue(all[6][3])) + parseIntValue(all[7][3])) + parseIntValue(all[8][3])) + parseIntValue(all[9][3])) + parseIntValue(all[10][3])) + parseIntValue(all[11][3])) + parseIntValue(all[12][3])) + parseIntValue(all[13][3])) + parseIntValue(all[14][3])) + parseIntValue(all[15][3])) + parseIntValue(all[16][3])) + parseIntValue(all[17][3])) + parseIntValue(all[18][3])) + parseIntValue(all[19][3])) + parseIntValue(all[20][3])) + parseIntValue(all[21][3])) + parseIntValue(all[22][3])) + parseIntValue(all[23][3])) + parseIntValue(all[24][3])) + parseIntValue(all[25][3])) + parseIntValue(all[26][3])) + parseIntValue(all[27][3])) + parseIntValue(all[28][3])), (100 + masterfee), 100)) | |
62 | - | $Tuple2([StringEntry(all[0][0], all[0][1]), ScriptTransfer(Address(fromBase58String(all[0][2])), parseIntValue(all[0][3]), unit), StringEntry(all[1][0], all[1][1]), ScriptTransfer(Address(fromBase58String(all[1][2])), parseIntValue(all[1][3]), unit), StringEntry(all[2][0], all[2][1]), ScriptTransfer(Address(fromBase58String(all[2][2])), parseIntValue(all[2][3]), unit), StringEntry(all[3][0], all[3][1]), ScriptTransfer(Address(fromBase58String(all[3][2])), parseIntValue(all[3][3]), unit), StringEntry(all[4][0], all[4][1]), ScriptTransfer(Address(fromBase58String(all[4][2])), parseIntValue(all[4][3]), unit), StringEntry(all[5][0], all[5][1]), ScriptTransfer(Address(fromBase58String(all[5][2])), parseIntValue(all[5][3]), unit), StringEntry(all[6][0], all[6][1]), ScriptTransfer(Address(fromBase58String(all[6][2])), parseIntValue(all[6][3]), unit), StringEntry(all[7][0], all[7][1]), ScriptTransfer(Address(fromBase58String(all[7][2])), parseIntValue(all[7][3]), unit), StringEntry(all[8][0], all[8][1]), ScriptTransfer(Address(fromBase58String(all[8][2])), parseIntValue(all[8][3]), unit), StringEntry(all[9][0], all[9][1]), ScriptTransfer(Address(fromBase58String(all[9][2])), parseIntValue(all[9][3]), unit), StringEntry(all[10][0], all[10][1]), ScriptTransfer(Address(fromBase58String(all[10][2])), parseIntValue(all[10][3]), unit), StringEntry(all[11][0], all[11][1]), ScriptTransfer(Address(fromBase58String(all[11][2])), parseIntValue(all[11][3]), unit), StringEntry(all[12][0], all[12][1]), ScriptTransfer(Address(fromBase58String(all[12][2])), parseIntValue(all[12][3]), unit), StringEntry(all[13][0], all[13][1]), ScriptTransfer(Address(fromBase58String(all[13][2])), parseIntValue(all[13][3]), unit), StringEntry(all[14][0], all[14][1]), ScriptTransfer(Address(fromBase58String(all[14][2])), parseIntValue(all[14][3]), unit), StringEntry(all[15][0], all[15][1]), ScriptTransfer(Address(fromBase58String(all[15][2])), parseIntValue(all[15][3]), unit), StringEntry(all[16][0], all[16][1]), ScriptTransfer(Address(fromBase58String(all[16][2])), parseIntValue(all[16][3]), unit), StringEntry(all[17][0], all[17][1]), ScriptTransfer(Address(fromBase58String(all[17][2])), parseIntValue(all[17][3]), unit), StringEntry(all[18][0], all[18][1]), ScriptTransfer(Address(fromBase58String(all[18][2])), parseIntValue(all[18][3]), unit), StringEntry(all[19][0], all[19][1]), ScriptTransfer(Address(fromBase58String(all[19][2])), parseIntValue(all[19][3]), unit), StringEntry(all[20][0], all[20][1]), ScriptTransfer(Address(fromBase58String(all[20][2])), parseIntValue(all[20][3]), unit), StringEntry(all[21][0], all[21][1]), ScriptTransfer(Address(fromBase58String(all[21][2])), parseIntValue(all[21][3]), unit), StringEntry(all[22][0], all[22][1]), ScriptTransfer(Address(fromBase58String(all[22][2])), parseIntValue(all[22][3]), unit), StringEntry(all[23][0], all[23][1]), ScriptTransfer(Address(fromBase58String(all[23][2])), parseIntValue(all[23][3]), unit), StringEntry(all[24][0], all[24][1]), ScriptTransfer(Address(fromBase58String(all[24][2])), parseIntValue(all[24][3]), unit), StringEntry(all[25][0], all[25][1]), ScriptTransfer(Address(fromBase58String(all[25][2])), parseIntValue(all[25][3]), unit), StringEntry(all[26][0], all[26][1]), ScriptTransfer(Address(fromBase58String(all[26][2])), parseIntValue(all[26][3]), unit), StringEntry(all[27][0], all[27][1]), ScriptTransfer(Address(fromBase58String(all[27][2])), parseIntValue(all[27][3]), unit), StringEntry(all[28][0], all[28][1]), ScriptTransfer(Address(fromBase58String(all[28][2])), parseIntValue(all[28][3]), unit), ScriptTransfer(i.caller, 0, unit)], unit) | |
24 | + | func tellme (question) = { | |
25 | + | let callerAddress = toBase58String(i.caller.bytes) | |
26 | + | let answer = getAnswer(question, getPreviousAnswer(callerAddress)) | |
27 | + | WriteSet([DataEntry((callerAddress + "_q"), question), DataEntry((callerAddress + "_a"), answer)]) | |
63 | 28 | } | |
64 | 29 | ||
65 | 30 |
github/deemru/w8io/169f3d6 77.74 ms ◑