tx · SjbfFVsLpcRBrpFifxzUYoU1xP6TV7m5zTVEF3DFYNL 3Mt71RiSbWYENDmeyndvwjoJZwUsXfUkR6b: -0.01400000 Waves 2021.02.06 10:37 [1386040] smart account 3Mt71RiSbWYENDmeyndvwjoJZwUsXfUkR6b > SELF 0.00000000 Waves
{ "type": 13, "id": "SjbfFVsLpcRBrpFifxzUYoU1xP6TV7m5zTVEF3DFYNL", "fee": 1400000, "feeAssetId": null, "timestamp": 1612597162040, "version": 2, "chainId": 84, "sender": "3Mt71RiSbWYENDmeyndvwjoJZwUsXfUkR6b", "senderPublicKey": "3BKFQLeo5ExZ5Y1pt9Ftzsno7aRwzD96zoYVHP3tcLgV", "proofs": [ "41Qd51shLxWXBNDLCK7auSuEoHusuU63jh3UWBbUgBDZBC4BKJe2yMDnAwHtAVweqkUw7asef6a9cLu7VmR7Xd2g" ], "script": "base64:AAIDAAAAAAAAABAIARIHCgUBAQEBCBIDCgEIAAAACwAAAAARbG90dGVyeXBvb2xhbW91bnQCAAAAEF9sb3R0ZXJ5X2Ftb3VudF8AAAAAFmxvdHRlcnlwb29scHJvYmFiaWxpdHkCAAAAFV9sb3R0ZXJ5X3Byb2JhYmlsaXR5XwAAAAAdbG90dGVyeXBvb2xwcm9iYWJpbGl0eWRlY2ltYWwCAAAAHV9sb3R0ZXJ5X3Byb2JhYmlsaXR5X2RlY2ltYWxfAAAAABBsb3R0ZXJ5cG9vbHByaWNlAgAAAA9fbG90dGVyeV9wcmljZV8AAAAADWxvdHRlcnlwcmljZXMCAAAAEF9sb3R0ZXJ5X3ByaWNlc18AAAAADGxhc3RIYXNoUmFuZAIAAAARX2hhc2hfbGFzdF9yb3VuZF8AAAAADWxhc3RQbGF5Um91bmQCAAAAFl9sYXN0X3BsYXlfcm91bmRfX2hhc2gBAAAACnJhbmRvbWl6ZXIAAAABAAAAA2ludgQAAAAIbGFzdFBsYXkEAAAAByRtYXRjaDAJAAQcAAAAAgUAAAAEdGhpcwUAAAANbGFzdFBsY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gUAAAANbGFzdFBsYXlSb3VuZAUAAAAIcmFuZGhhc2gJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgUAAAANbGFzdFBsYXlSb3VuZAIAAAAJIF9pbnRlZ2VyCQAEsQAAAAEFAAAACHJhbmRoYXNoCQAETAAAAAIFAAAAEWRhdFNpemVQcmljZUVudHJ5BQAAAANuaWwJAQAAAAxTY3JpcHRSZXN1bHQAAAACBQAAAAl3cml0ZVNldHMJAQAAAAtUcmFuc2ZlclNldAAAAAEFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAEAAAAByRtYXRjaDAFAAAAAnR4AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAA9EYXRhVHJhbnNhY3Rpb24GAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABRTZXRTY3JpcHRUcmFuc2FjdGlvbgYJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5PB+W0Q==", "height": 1386040, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 7rLWAFSujGvV6RQgkfzJ6vtPfj77xzawdzkjLKvJCAJo Next: 3r5uhb6FoSRytjRGU7SDD8LEEhNsYVTiLDNh7BQMCtSo Diff:
Old | New | Differences | |
---|---|---|---|
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = "_lottery_amount_" | |
5 | 5 | ||
6 | - | let b = "_lottery_ | |
6 | + | let b = "_lottery_probability_" | |
7 | 7 | ||
8 | - | let c = "_lottery_ | |
8 | + | let c = "_lottery_probability_decimal_" | |
9 | 9 | ||
10 | - | let d = "_lottery_ | |
10 | + | let d = "_lottery_price_" | |
11 | 11 | ||
12 | - | let e = "_ | |
12 | + | let e = "_lottery_prices_" | |
13 | 13 | ||
14 | - | let f = "_last | |
14 | + | let f = "_hash_last_round_" | |
15 | 15 | ||
16 | - | func g (h) = { | |
17 | - | let i = { | |
18 | - | let j = getBinary(this, f) | |
19 | - | if ($isInstanceOf(j, "ByteVector")) | |
16 | + | let g = "_last_play_round__hash" | |
17 | + | ||
18 | + | func h (i) = { | |
19 | + | let j = { | |
20 | + | let k = getBinary(this, g) | |
21 | + | if ($isInstanceOf(k, "ByteVector")) | |
20 | 22 | then { | |
21 | - | let | |
22 | - | | |
23 | + | let l = k | |
24 | + | l | |
23 | 25 | } | |
24 | - | else if ($isInstanceOf( | |
26 | + | else if ($isInstanceOf(k, "Unit")) | |
25 | 27 | then base58'RxGd4bcUocouhA8beYPZ' | |
26 | 28 | else throw("Match error") | |
27 | 29 | } | |
28 | - | let | |
29 | - | sha256( | |
30 | + | let m = (((((j + i.transactionId) + i.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height)) | |
31 | + | sha256(m) | |
30 | 32 | } | |
31 | 33 | ||
32 | 34 | ||
33 | - | func | |
34 | - | let | |
35 | - | let | |
36 | - | let | |
37 | - | size( | |
35 | + | func n () = { | |
36 | + | let o = getStringValue(this, e) | |
37 | + | let p = take(o, (size(o) - 1)) | |
38 | + | let q = split(p, ",") | |
39 | + | size(q) | |
38 | 40 | } | |
39 | 41 | ||
40 | 42 | ||
41 | - | func | |
42 | - | let | |
43 | - | let | |
44 | - | split( | |
43 | + | func r () = { | |
44 | + | let o = getStringValue(this, e) | |
45 | + | let p = take(o, (size(o) - 1)) | |
46 | + | split(p, ",") | |
45 | 47 | } | |
46 | 48 | ||
47 | 49 | ||
48 | - | func | |
49 | - | let | |
50 | - | if (( | |
50 | + | func s (t,u) = { | |
51 | + | let v = getIntegerValue(this, (a + t)) | |
52 | + | if ((v == 0)) | |
51 | 53 | then throw("Amount exceeded") | |
52 | - | else if (( | |
54 | + | else if ((u == true)) | |
53 | 55 | then { | |
54 | - | let | |
55 | - | | |
56 | + | let w = (v - 1) | |
57 | + | w | |
56 | 58 | } | |
57 | - | else | |
59 | + | else v | |
58 | 60 | } | |
59 | 61 | ||
60 | 62 | ||
61 | - | @Callable( | |
62 | - | func updateprobability ( | |
63 | - | let | |
64 | - | let | |
65 | - | if ($isInstanceOf( | |
63 | + | @Callable(x) | |
64 | + | func updateprobability (y,z,A,B,t) = { | |
65 | + | let C = { | |
66 | + | let k = getString(this, e) | |
67 | + | if ($isInstanceOf(k, "String")) | |
66 | 68 | then { | |
67 | - | let | |
68 | - | | |
69 | + | let D = k | |
70 | + | D | |
69 | 71 | } | |
70 | 72 | else "" | |
71 | 73 | } | |
72 | - | let | |
73 | - | let | |
74 | - | let | |
75 | - | if ($isInstanceOf( | |
76 | - | then (( | |
77 | - | else if ($isInstanceOf( | |
74 | + | let E = indexOf(C, t) | |
75 | + | let F = { | |
76 | + | let k = E | |
77 | + | if ($isInstanceOf(k, "Unit")) | |
78 | + | then ((C + t) + ",") | |
79 | + | else if ($isInstanceOf(k, "Int")) | |
78 | 80 | then { | |
79 | - | let | |
80 | - | | |
81 | + | let G = k | |
82 | + | C | |
81 | 83 | } | |
82 | 84 | else throw("Match error") | |
83 | 85 | } | |
84 | - | let | |
85 | - | ScriptResult( | |
86 | + | let H = WriteSet([DataEntry((a + t), z), DataEntry((b + t), y), DataEntry((d + t), A), DataEntry(e, F), DataEntry(c, B)]) | |
87 | + | ScriptResult(H, TransferSet(nil)) | |
86 | 88 | } | |
87 | 89 | ||
88 | 90 | ||
89 | 91 | ||
90 | - | @Callable(w) | |
91 | - | func startlotto (s) = { | |
92 | - | let G = toBase58String(w.caller.bytes) | |
93 | - | let H = getIntegerValue(this, (a + s)) | |
94 | - | let I = getIntegerValue(this, (b + s)) | |
95 | - | let J = getIntegerValue(this, (c + s)) | |
96 | - | let K = g(w) | |
97 | - | let L = m() | |
98 | - | let M = q() | |
99 | - | let N = DataEntry((G + "_winprices_size_"), L) | |
100 | - | let O = (toInt(K) % 1000) | |
101 | - | if ((I > (O * I))) | |
92 | + | @Callable(x) | |
93 | + | func startlotto (t) = { | |
94 | + | let I = toBase58String(x.caller.bytes) | |
95 | + | let J = getIntegerValue(this, (a + t)) | |
96 | + | let K = getIntegerValue(this, (b + t)) | |
97 | + | let L = getIntegerValue(this, (d + t)) | |
98 | + | let M = getIntegerValue(this, (c + t)) | |
99 | + | let N = h(x) | |
100 | + | let O = n() | |
101 | + | let P = r() | |
102 | + | let Q = DataEntry((I + "_winprices_size_"), O) | |
103 | + | let R = 1000 | |
104 | + | let S = (toInt(N) % (M * 1000)) | |
105 | + | if ((K > S)) | |
102 | 106 | then { | |
103 | - | let | |
104 | - | let | |
105 | - | let | |
106 | - | ScriptResult( | |
107 | + | let T = TransferSet([ScriptTransfer(x.caller, L, unit)]) | |
108 | + | let U = s(t, true) | |
109 | + | let V = WriteSet([DataEntry((I + "_winning_ticket_"), L), DataEntry((I + "_wininning_address_"), I), DataEntry((a + t), U), DataEntry(f, S), DataEntry(g, N), DataEntry((g + " _integer"), toInt(N)), Q]) | |
110 | + | ScriptResult(V, T) | |
107 | 111 | } | |
108 | 112 | else { | |
109 | - | let | |
110 | - | let | |
111 | - | ScriptResult( | |
113 | + | let U = s(t, true) | |
114 | + | let V = WriteSet([DataEntry((I + "_winning_ticket_"), ""), DataEntry((I + "_wininning_address_"), ""), DataEntry((a + t), U), DataEntry(f, S), DataEntry(g, N), DataEntry((g + " _integer"), toInt(N)), Q]) | |
115 | + | ScriptResult(V, TransferSet(nil)) | |
112 | 116 | } | |
113 | 117 | } | |
114 | 118 | ||
115 | 119 | ||
116 | - | @Verifier( | |
117 | - | func | |
118 | - | let | |
119 | - | if ($isInstanceOf( | |
120 | + | @Verifier(W) | |
121 | + | func X () = { | |
122 | + | let k = W | |
123 | + | if ($isInstanceOf(k, "DataTransaction")) | |
120 | 124 | then true | |
121 | - | else if ($isInstanceOf( | |
125 | + | else if ($isInstanceOf(k, "SetScriptTransaction")) | |
122 | 126 | then true | |
123 | - | else sigVerify( | |
127 | + | else sigVerify(W.bodyBytes, W.proofs[0], W.senderPublicKey) | |
124 | 128 | } | |
125 | 129 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = "_lottery_amount_" | |
5 | 5 | ||
6 | - | let b = "_lottery_ | |
6 | + | let b = "_lottery_probability_" | |
7 | 7 | ||
8 | - | let c = "_lottery_ | |
8 | + | let c = "_lottery_probability_decimal_" | |
9 | 9 | ||
10 | - | let d = "_lottery_ | |
10 | + | let d = "_lottery_price_" | |
11 | 11 | ||
12 | - | let e = "_ | |
12 | + | let e = "_lottery_prices_" | |
13 | 13 | ||
14 | - | let f = "_last | |
14 | + | let f = "_hash_last_round_" | |
15 | 15 | ||
16 | - | func g (h) = { | |
17 | - | let i = { | |
18 | - | let j = getBinary(this, f) | |
19 | - | if ($isInstanceOf(j, "ByteVector")) | |
16 | + | let g = "_last_play_round__hash" | |
17 | + | ||
18 | + | func h (i) = { | |
19 | + | let j = { | |
20 | + | let k = getBinary(this, g) | |
21 | + | if ($isInstanceOf(k, "ByteVector")) | |
20 | 22 | then { | |
21 | - | let | |
22 | - | | |
23 | + | let l = k | |
24 | + | l | |
23 | 25 | } | |
24 | - | else if ($isInstanceOf( | |
26 | + | else if ($isInstanceOf(k, "Unit")) | |
25 | 27 | then base58'RxGd4bcUocouhA8beYPZ' | |
26 | 28 | else throw("Match error") | |
27 | 29 | } | |
28 | - | let | |
29 | - | sha256( | |
30 | + | let m = (((((j + i.transactionId) + i.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height)) | |
31 | + | sha256(m) | |
30 | 32 | } | |
31 | 33 | ||
32 | 34 | ||
33 | - | func | |
34 | - | let | |
35 | - | let | |
36 | - | let | |
37 | - | size( | |
35 | + | func n () = { | |
36 | + | let o = getStringValue(this, e) | |
37 | + | let p = take(o, (size(o) - 1)) | |
38 | + | let q = split(p, ",") | |
39 | + | size(q) | |
38 | 40 | } | |
39 | 41 | ||
40 | 42 | ||
41 | - | func | |
42 | - | let | |
43 | - | let | |
44 | - | split( | |
43 | + | func r () = { | |
44 | + | let o = getStringValue(this, e) | |
45 | + | let p = take(o, (size(o) - 1)) | |
46 | + | split(p, ",") | |
45 | 47 | } | |
46 | 48 | ||
47 | 49 | ||
48 | - | func | |
49 | - | let | |
50 | - | if (( | |
50 | + | func s (t,u) = { | |
51 | + | let v = getIntegerValue(this, (a + t)) | |
52 | + | if ((v == 0)) | |
51 | 53 | then throw("Amount exceeded") | |
52 | - | else if (( | |
54 | + | else if ((u == true)) | |
53 | 55 | then { | |
54 | - | let | |
55 | - | | |
56 | + | let w = (v - 1) | |
57 | + | w | |
56 | 58 | } | |
57 | - | else | |
59 | + | else v | |
58 | 60 | } | |
59 | 61 | ||
60 | 62 | ||
61 | - | @Callable( | |
62 | - | func updateprobability ( | |
63 | - | let | |
64 | - | let | |
65 | - | if ($isInstanceOf( | |
63 | + | @Callable(x) | |
64 | + | func updateprobability (y,z,A,B,t) = { | |
65 | + | let C = { | |
66 | + | let k = getString(this, e) | |
67 | + | if ($isInstanceOf(k, "String")) | |
66 | 68 | then { | |
67 | - | let | |
68 | - | | |
69 | + | let D = k | |
70 | + | D | |
69 | 71 | } | |
70 | 72 | else "" | |
71 | 73 | } | |
72 | - | let | |
73 | - | let | |
74 | - | let | |
75 | - | if ($isInstanceOf( | |
76 | - | then (( | |
77 | - | else if ($isInstanceOf( | |
74 | + | let E = indexOf(C, t) | |
75 | + | let F = { | |
76 | + | let k = E | |
77 | + | if ($isInstanceOf(k, "Unit")) | |
78 | + | then ((C + t) + ",") | |
79 | + | else if ($isInstanceOf(k, "Int")) | |
78 | 80 | then { | |
79 | - | let | |
80 | - | | |
81 | + | let G = k | |
82 | + | C | |
81 | 83 | } | |
82 | 84 | else throw("Match error") | |
83 | 85 | } | |
84 | - | let | |
85 | - | ScriptResult( | |
86 | + | let H = WriteSet([DataEntry((a + t), z), DataEntry((b + t), y), DataEntry((d + t), A), DataEntry(e, F), DataEntry(c, B)]) | |
87 | + | ScriptResult(H, TransferSet(nil)) | |
86 | 88 | } | |
87 | 89 | ||
88 | 90 | ||
89 | 91 | ||
90 | - | @Callable(w) | |
91 | - | func startlotto (s) = { | |
92 | - | let G = toBase58String(w.caller.bytes) | |
93 | - | let H = getIntegerValue(this, (a + s)) | |
94 | - | let I = getIntegerValue(this, (b + s)) | |
95 | - | let J = getIntegerValue(this, (c + s)) | |
96 | - | let K = g(w) | |
97 | - | let L = m() | |
98 | - | let M = q() | |
99 | - | let N = DataEntry((G + "_winprices_size_"), L) | |
100 | - | let O = (toInt(K) % 1000) | |
101 | - | if ((I > (O * I))) | |
92 | + | @Callable(x) | |
93 | + | func startlotto (t) = { | |
94 | + | let I = toBase58String(x.caller.bytes) | |
95 | + | let J = getIntegerValue(this, (a + t)) | |
96 | + | let K = getIntegerValue(this, (b + t)) | |
97 | + | let L = getIntegerValue(this, (d + t)) | |
98 | + | let M = getIntegerValue(this, (c + t)) | |
99 | + | let N = h(x) | |
100 | + | let O = n() | |
101 | + | let P = r() | |
102 | + | let Q = DataEntry((I + "_winprices_size_"), O) | |
103 | + | let R = 1000 | |
104 | + | let S = (toInt(N) % (M * 1000)) | |
105 | + | if ((K > S)) | |
102 | 106 | then { | |
103 | - | let | |
104 | - | let | |
105 | - | let | |
106 | - | ScriptResult( | |
107 | + | let T = TransferSet([ScriptTransfer(x.caller, L, unit)]) | |
108 | + | let U = s(t, true) | |
109 | + | let V = WriteSet([DataEntry((I + "_winning_ticket_"), L), DataEntry((I + "_wininning_address_"), I), DataEntry((a + t), U), DataEntry(f, S), DataEntry(g, N), DataEntry((g + " _integer"), toInt(N)), Q]) | |
110 | + | ScriptResult(V, T) | |
107 | 111 | } | |
108 | 112 | else { | |
109 | - | let | |
110 | - | let | |
111 | - | ScriptResult( | |
113 | + | let U = s(t, true) | |
114 | + | let V = WriteSet([DataEntry((I + "_winning_ticket_"), ""), DataEntry((I + "_wininning_address_"), ""), DataEntry((a + t), U), DataEntry(f, S), DataEntry(g, N), DataEntry((g + " _integer"), toInt(N)), Q]) | |
115 | + | ScriptResult(V, TransferSet(nil)) | |
112 | 116 | } | |
113 | 117 | } | |
114 | 118 | ||
115 | 119 | ||
116 | - | @Verifier( | |
117 | - | func | |
118 | - | let | |
119 | - | if ($isInstanceOf( | |
120 | + | @Verifier(W) | |
121 | + | func X () = { | |
122 | + | let k = W | |
123 | + | if ($isInstanceOf(k, "DataTransaction")) | |
120 | 124 | then true | |
121 | - | else if ($isInstanceOf( | |
125 | + | else if ($isInstanceOf(k, "SetScriptTransaction")) | |
122 | 126 | then true | |
123 | - | else sigVerify( | |
127 | + | else sigVerify(W.bodyBytes, W.proofs[0], W.senderPublicKey) | |
124 | 128 | } | |
125 | 129 |
github/deemru/w8io/169f3d6 65.36 ms ◑