tx · 56smDaFiP2ABtobgZiYiF3esvnAKwFVZ5PCKPMQCLwuU 3N8M61KCm8G72mK8PjacFbnnxdbFsyqQDeT: -0.01400000 Waves 2019.06.27 17:35 [560660] smart account 3N8M61KCm8G72mK8PjacFbnnxdbFsyqQDeT > SELF 0.00000000 Waves
{ "type": 13, "id": "56smDaFiP2ABtobgZiYiF3esvnAKwFVZ5PCKPMQCLwuU", "fee": 1400000, "feeAssetId": null, "timestamp": 1561646118180, "version": 1, "sender": "3N8M61KCm8G72mK8PjacFbnnxdbFsyqQDeT", "senderPublicKey": "Bhyvkx4xdbEi4KPJNZSzx9gZgzgyLEsavuj2kYSt7SST", "proofs": [ "BVBKUPFg9EetGqgtLbP9JJGDTUjtZ914juvjhNkUPnYfwdQsUw3W5g6EFHRki2j9e2oRXxcAeJBY2sacdjTYT3t" ], "script": "base64:AAIDAAAAAAAAAAAAAAAXAAAAAA9TZXJ2ZXJQdWJsaWNLZXkBAAAAIAQ1/gW4L6VUuKyMox3deX07Tu0dL8x1obg+vYqfUuwTAAAAABBSb3VsZXR0ZVNlY3Rpb25zAAAAAAAAAAAVAAAAABFEYXRhR2FtZU51bWJlcktleQIAAAALQVBQX0dBTUVfSUQAAAAADURhdGFBbW91bnRLZXkCAAAABkFNT1VOVAAAAAAORGF0YVNlY3Rpb25LZXkCAAAAB1NFQ1RJT04AAAAADURhdGFTdGF0dXNLZXkCAAAABlNUQVRVUwAAAAANRGF0YVN0YXR1c05ldwIAAAADTkVXAAAAAA1EYXRhU3RhdHVzV2luAgAAAANXSU4AAAAAD0RhdGFTdGF0dXNMb29zZQIAAAAFTE9PU0UAAAAAFkVycm9yT25seVdhdmVzQWNjZXB0ZWQCAAAAE09ubHkgd2F2ZXMgYWNjZXB0ZWQAAAAAFUVycm9yTXVzdEdyZWF0ZXJUaGFuMAIAAAAlUGFyYW1ldGVyIHNpemUgbXVzdCBiZSBncmVhdGVyIHRoYW4gMAAAAAAURXJyb3JNdXN0TGVzc1RoYW4xMDAC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RAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleQQAAAAHJG1hdGNoMAUAAAACdHgDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAFFNldFNjcmlwdFRyYW5zYWN0aW9uBAAAAANzdHgFAAAAByRtYXRjaDAGBweNtrWi", "chainId": 84, "height": 560660, "spentComplexity": 0 } View: original | compacted Prev: GZdtS2Lx7B8ZKHimU6Joos35qyhTsShn2W5RE6Vk1NSU Next: Aivg1Wp6LLHpwm2JKBzb7JCjFCT2czkqnQ2b8bvTQXyt Diff:
Old | New | Differences | |
---|---|---|---|
15 | 15 | ||
16 | 16 | let g = "NEW" | |
17 | 17 | ||
18 | - | let h = " | |
18 | + | let h = "WIN" | |
19 | 19 | ||
20 | - | let i = " | |
20 | + | let i = "LOOSE" | |
21 | 21 | ||
22 | - | let j = " | |
22 | + | let j = "Only waves accepted" | |
23 | 23 | ||
24 | - | let k = " | |
24 | + | let k = "Parameter size must be greater than 0" | |
25 | 25 | ||
26 | - | let l = " | |
26 | + | let l = "Parameter size must be less than 100" | |
27 | 27 | ||
28 | - | let m = " | |
28 | + | let m = "Bet amount must be in Waves" | |
29 | 29 | ||
30 | - | func n (o,p,q) = DataEntry(((o + "_") + p), q) | |
30 | + | let n = "Transaction's fee must be in Waves" | |
31 | + | ||
32 | + | let o = "Passed txId had been used before. Game aborted." | |
33 | + | ||
34 | + | let p = "Key not found: " | |
35 | + | ||
36 | + | let q = "Game already is over" | |
37 | + | ||
38 | + | func r (s,t,u) = DataEntry(((s + "_") + t), u) | |
31 | 39 | ||
32 | 40 | ||
33 | - | func r () = { | |
34 | - | let s = { | |
35 | - | let t = getInteger(this, c) | |
36 | - | if ($isInstanceOf(t, "Int")) | |
41 | + | func v (s,t,u) = DataEntry(((s + "_") + t), u) | |
42 | + | ||
43 | + | ||
44 | + | func w (s,t) = { | |
45 | + | let x = getString(this, ((s + "_") + t)) | |
46 | + | if ($isInstanceOf(x, "String")) | |
47 | + | then { | |
48 | + | let y = x | |
49 | + | y | |
50 | + | } | |
51 | + | else throw((p + s)) | |
52 | + | } | |
53 | + | ||
54 | + | ||
55 | + | func z (s,t) = { | |
56 | + | let x = getInteger(this, ((s + "_") + t)) | |
57 | + | if ($isInstanceOf(x, "Int")) | |
58 | + | then { | |
59 | + | let y = x | |
60 | + | y | |
61 | + | } | |
62 | + | else throw((p + s)) | |
63 | + | } | |
64 | + | ||
65 | + | ||
66 | + | func A () = { | |
67 | + | let B = { | |
68 | + | let x = getInteger(this, c) | |
69 | + | if ($isInstanceOf(x, "Int")) | |
37 | 70 | then { | |
38 | - | let | |
39 | - | | |
71 | + | let C = x | |
72 | + | C | |
40 | 73 | } | |
41 | 74 | else 0 | |
42 | 75 | } | |
43 | - | ( | |
76 | + | (B + 1) | |
44 | 77 | } | |
45 | 78 | ||
46 | 79 | ||
47 | - | @Callable(v) | |
48 | - | func GenerateRandInt (w,x) = { | |
49 | - | let y = sigVerify(fromBase58String(w), fromBase58String(x), a) | |
50 | - | if (y) | |
80 | + | func D (E,F) = { | |
81 | + | let G = sigVerify(fromBase58String(E), fromBase58String(F), a) | |
82 | + | if (G) | |
51 | 83 | then { | |
52 | - | let z = (toInt(sha256(toBytes(x))) % b) | |
53 | - | WriteSet([DataEntry("orig", toInt(sha256(toBytes(x)))), DataEntry("rand", z)]) | |
84 | + | let H = (toInt(sha256(toBytes(F))) % b) | |
85 | + | if ((0 > H)) | |
86 | + | then (-1 * H) | |
87 | + | else H | |
54 | 88 | } | |
55 | 89 | else throw("Invalid RSA signature") | |
56 | 90 | } | |
57 | 91 | ||
58 | 92 | ||
59 | - | ||
60 | - | @Callable(v) | |
61 | - | func bet (A) = { | |
62 | - | let B = r() | |
63 | - | let C = toBase58String(v.transactionId) | |
64 | - | let D = toBase58String(v.caller.bytes) | |
65 | - | let E = extract(v.payment) | |
66 | - | let F = isDefined(getString(this, C)) | |
67 | - | let G = isDefined(E.assetId) | |
68 | - | let H = isDefined(E.assetId) | |
69 | - | let I = E.amount | |
70 | - | if (G) | |
71 | - | then throw(k) | |
72 | - | else if (H) | |
73 | - | then throw(l) | |
74 | - | else if (F) | |
75 | - | then throw(m) | |
76 | - | else WriteSet([DataEntry(C, D), DataEntry(c, B), n(C, d, toString(I)), n(C, e, toString(A)), n(C, f, g)]) | |
93 | + | @Callable(I) | |
94 | + | func bet (J) = { | |
95 | + | let K = A() | |
96 | + | let L = toBase58String(I.transactionId) | |
97 | + | let M = toBase58String(I.caller.bytes) | |
98 | + | let N = extract(I.payment) | |
99 | + | let O = isDefined(getString(this, L)) | |
100 | + | let P = isDefined(N.assetId) | |
101 | + | let Q = isDefined(N.assetId) | |
102 | + | let R = N.amount | |
103 | + | if (P) | |
104 | + | then throw(m) | |
105 | + | else if (Q) | |
106 | + | then throw(n) | |
107 | + | else if (O) | |
108 | + | then throw(o) | |
109 | + | else WriteSet([DataEntry(L, M), DataEntry(c, K), v(L, d, R), v(L, e, J), r(L, f, g)]) | |
77 | 110 | } | |
78 | 111 | ||
79 | 112 | ||
80 | 113 | ||
81 | - | @Callable(v) | |
82 | - | func bet111 (A) = { | |
83 | - | let J = "last_auction_id" | |
84 | - | let K = { | |
85 | - | let t = getInteger(this, J) | |
86 | - | if ($isInstanceOf(t, "Int")) | |
87 | - | then { | |
88 | - | let L = t | |
89 | - | L | |
90 | - | } | |
91 | - | else 0 | |
92 | - | } | |
93 | - | let M = (K + 1) | |
94 | - | let N = toString(M) | |
95 | - | let O = toBase58String(v.caller.bytes) | |
96 | - | let E = value(v.payment) | |
97 | - | if (isDefined(E.assetId)) | |
98 | - | then throw(h) | |
99 | - | else { | |
100 | - | let P = toBase58String(value(E.assetId)) | |
101 | - | let Q = (("auction_" + N) + "_duration") | |
102 | - | let R = (("auction_" + N) + "_min_bid") | |
103 | - | let S = (("auction_" + N) + "_last_bid") | |
104 | - | let T = (("auction_" + N) + "_last_bid_owner") | |
105 | - | let U = (("auction_" + N) + "_owner") | |
106 | - | let V = (("auction_" + N) + "_amount") | |
107 | - | let W = (("auction_" + N) + "_asset_id") | |
108 | - | let X = (("auction_" + N) + "_is_active") | |
109 | - | let Y = ((("balance_" + O) + "_") + P) | |
110 | - | let Z = { | |
111 | - | let t = getInteger(this, Y) | |
112 | - | if ($isInstanceOf(t, "Int")) | |
113 | - | then { | |
114 | - | let L = t | |
115 | - | L | |
116 | - | } | |
117 | - | else 0 | |
118 | - | } | |
119 | - | let aa = (Z + E.amount) | |
120 | - | WriteSet([DataEntry(S, 0), DataEntry(U, O), DataEntry(V, E.amount), DataEntry(W, P), DataEntry(Y, aa), DataEntry(X, true), DataEntry(T, ""), DataEntry(J, M)]) | |
114 | + | @Callable(I) | |
115 | + | func result (L,S) = { | |
116 | + | let H = D(L, S) | |
117 | + | let T = z(L, e) | |
118 | + | let U = w(L, f) | |
119 | + | if ((U != g)) | |
120 | + | then { | |
121 | + | let V = (H == T) | |
122 | + | if (V) | |
123 | + | then WriteSet([r(L, f, h)]) | |
124 | + | else WriteSet([r(L, f, i)]) | |
121 | 125 | } | |
126 | + | else throw(q) | |
122 | 127 | } | |
123 | 128 | ||
124 | 129 | ||
125 | - | @Verifier( | |
126 | - | func | |
130 | + | @Verifier(W) | |
131 | + | func X () = if (sigVerify(W.bodyBytes, W.proofs[0], W.senderPublicKey)) | |
127 | 132 | then { | |
128 | - | let | |
129 | - | if ($isInstanceOf( | |
133 | + | let x = W | |
134 | + | if ($isInstanceOf(x, "SetScriptTransaction")) | |
130 | 135 | then { | |
131 | - | let | |
136 | + | let Y = x | |
132 | 137 | true | |
133 | 138 | } | |
134 | 139 | else false |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = base58'HSP9V7edVKjfLJUfRkEF6vfV9Tyz4Us4yqH9rkwqnHY' | |
5 | 5 | ||
6 | 6 | let b = 21 | |
7 | 7 | ||
8 | 8 | let c = "APP_GAME_ID" | |
9 | 9 | ||
10 | 10 | let d = "AMOUNT" | |
11 | 11 | ||
12 | 12 | let e = "SECTION" | |
13 | 13 | ||
14 | 14 | let f = "STATUS" | |
15 | 15 | ||
16 | 16 | let g = "NEW" | |
17 | 17 | ||
18 | - | let h = " | |
18 | + | let h = "WIN" | |
19 | 19 | ||
20 | - | let i = " | |
20 | + | let i = "LOOSE" | |
21 | 21 | ||
22 | - | let j = " | |
22 | + | let j = "Only waves accepted" | |
23 | 23 | ||
24 | - | let k = " | |
24 | + | let k = "Parameter size must be greater than 0" | |
25 | 25 | ||
26 | - | let l = " | |
26 | + | let l = "Parameter size must be less than 100" | |
27 | 27 | ||
28 | - | let m = " | |
28 | + | let m = "Bet amount must be in Waves" | |
29 | 29 | ||
30 | - | func n (o,p,q) = DataEntry(((o + "_") + p), q) | |
30 | + | let n = "Transaction's fee must be in Waves" | |
31 | + | ||
32 | + | let o = "Passed txId had been used before. Game aborted." | |
33 | + | ||
34 | + | let p = "Key not found: " | |
35 | + | ||
36 | + | let q = "Game already is over" | |
37 | + | ||
38 | + | func r (s,t,u) = DataEntry(((s + "_") + t), u) | |
31 | 39 | ||
32 | 40 | ||
33 | - | func r () = { | |
34 | - | let s = { | |
35 | - | let t = getInteger(this, c) | |
36 | - | if ($isInstanceOf(t, "Int")) | |
41 | + | func v (s,t,u) = DataEntry(((s + "_") + t), u) | |
42 | + | ||
43 | + | ||
44 | + | func w (s,t) = { | |
45 | + | let x = getString(this, ((s + "_") + t)) | |
46 | + | if ($isInstanceOf(x, "String")) | |
47 | + | then { | |
48 | + | let y = x | |
49 | + | y | |
50 | + | } | |
51 | + | else throw((p + s)) | |
52 | + | } | |
53 | + | ||
54 | + | ||
55 | + | func z (s,t) = { | |
56 | + | let x = getInteger(this, ((s + "_") + t)) | |
57 | + | if ($isInstanceOf(x, "Int")) | |
58 | + | then { | |
59 | + | let y = x | |
60 | + | y | |
61 | + | } | |
62 | + | else throw((p + s)) | |
63 | + | } | |
64 | + | ||
65 | + | ||
66 | + | func A () = { | |
67 | + | let B = { | |
68 | + | let x = getInteger(this, c) | |
69 | + | if ($isInstanceOf(x, "Int")) | |
37 | 70 | then { | |
38 | - | let | |
39 | - | | |
71 | + | let C = x | |
72 | + | C | |
40 | 73 | } | |
41 | 74 | else 0 | |
42 | 75 | } | |
43 | - | ( | |
76 | + | (B + 1) | |
44 | 77 | } | |
45 | 78 | ||
46 | 79 | ||
47 | - | @Callable(v) | |
48 | - | func GenerateRandInt (w,x) = { | |
49 | - | let y = sigVerify(fromBase58String(w), fromBase58String(x), a) | |
50 | - | if (y) | |
80 | + | func D (E,F) = { | |
81 | + | let G = sigVerify(fromBase58String(E), fromBase58String(F), a) | |
82 | + | if (G) | |
51 | 83 | then { | |
52 | - | let z = (toInt(sha256(toBytes(x))) % b) | |
53 | - | WriteSet([DataEntry("orig", toInt(sha256(toBytes(x)))), DataEntry("rand", z)]) | |
84 | + | let H = (toInt(sha256(toBytes(F))) % b) | |
85 | + | if ((0 > H)) | |
86 | + | then (-1 * H) | |
87 | + | else H | |
54 | 88 | } | |
55 | 89 | else throw("Invalid RSA signature") | |
56 | 90 | } | |
57 | 91 | ||
58 | 92 | ||
59 | - | ||
60 | - | @Callable(v) | |
61 | - | func bet (A) = { | |
62 | - | let B = r() | |
63 | - | let C = toBase58String(v.transactionId) | |
64 | - | let D = toBase58String(v.caller.bytes) | |
65 | - | let E = extract(v.payment) | |
66 | - | let F = isDefined(getString(this, C)) | |
67 | - | let G = isDefined(E.assetId) | |
68 | - | let H = isDefined(E.assetId) | |
69 | - | let I = E.amount | |
70 | - | if (G) | |
71 | - | then throw(k) | |
72 | - | else if (H) | |
73 | - | then throw(l) | |
74 | - | else if (F) | |
75 | - | then throw(m) | |
76 | - | else WriteSet([DataEntry(C, D), DataEntry(c, B), n(C, d, toString(I)), n(C, e, toString(A)), n(C, f, g)]) | |
93 | + | @Callable(I) | |
94 | + | func bet (J) = { | |
95 | + | let K = A() | |
96 | + | let L = toBase58String(I.transactionId) | |
97 | + | let M = toBase58String(I.caller.bytes) | |
98 | + | let N = extract(I.payment) | |
99 | + | let O = isDefined(getString(this, L)) | |
100 | + | let P = isDefined(N.assetId) | |
101 | + | let Q = isDefined(N.assetId) | |
102 | + | let R = N.amount | |
103 | + | if (P) | |
104 | + | then throw(m) | |
105 | + | else if (Q) | |
106 | + | then throw(n) | |
107 | + | else if (O) | |
108 | + | then throw(o) | |
109 | + | else WriteSet([DataEntry(L, M), DataEntry(c, K), v(L, d, R), v(L, e, J), r(L, f, g)]) | |
77 | 110 | } | |
78 | 111 | ||
79 | 112 | ||
80 | 113 | ||
81 | - | @Callable(v) | |
82 | - | func bet111 (A) = { | |
83 | - | let J = "last_auction_id" | |
84 | - | let K = { | |
85 | - | let t = getInteger(this, J) | |
86 | - | if ($isInstanceOf(t, "Int")) | |
87 | - | then { | |
88 | - | let L = t | |
89 | - | L | |
90 | - | } | |
91 | - | else 0 | |
92 | - | } | |
93 | - | let M = (K + 1) | |
94 | - | let N = toString(M) | |
95 | - | let O = toBase58String(v.caller.bytes) | |
96 | - | let E = value(v.payment) | |
97 | - | if (isDefined(E.assetId)) | |
98 | - | then throw(h) | |
99 | - | else { | |
100 | - | let P = toBase58String(value(E.assetId)) | |
101 | - | let Q = (("auction_" + N) + "_duration") | |
102 | - | let R = (("auction_" + N) + "_min_bid") | |
103 | - | let S = (("auction_" + N) + "_last_bid") | |
104 | - | let T = (("auction_" + N) + "_last_bid_owner") | |
105 | - | let U = (("auction_" + N) + "_owner") | |
106 | - | let V = (("auction_" + N) + "_amount") | |
107 | - | let W = (("auction_" + N) + "_asset_id") | |
108 | - | let X = (("auction_" + N) + "_is_active") | |
109 | - | let Y = ((("balance_" + O) + "_") + P) | |
110 | - | let Z = { | |
111 | - | let t = getInteger(this, Y) | |
112 | - | if ($isInstanceOf(t, "Int")) | |
113 | - | then { | |
114 | - | let L = t | |
115 | - | L | |
116 | - | } | |
117 | - | else 0 | |
118 | - | } | |
119 | - | let aa = (Z + E.amount) | |
120 | - | WriteSet([DataEntry(S, 0), DataEntry(U, O), DataEntry(V, E.amount), DataEntry(W, P), DataEntry(Y, aa), DataEntry(X, true), DataEntry(T, ""), DataEntry(J, M)]) | |
114 | + | @Callable(I) | |
115 | + | func result (L,S) = { | |
116 | + | let H = D(L, S) | |
117 | + | let T = z(L, e) | |
118 | + | let U = w(L, f) | |
119 | + | if ((U != g)) | |
120 | + | then { | |
121 | + | let V = (H == T) | |
122 | + | if (V) | |
123 | + | then WriteSet([r(L, f, h)]) | |
124 | + | else WriteSet([r(L, f, i)]) | |
121 | 125 | } | |
126 | + | else throw(q) | |
122 | 127 | } | |
123 | 128 | ||
124 | 129 | ||
125 | - | @Verifier( | |
126 | - | func | |
130 | + | @Verifier(W) | |
131 | + | func X () = if (sigVerify(W.bodyBytes, W.proofs[0], W.senderPublicKey)) | |
127 | 132 | then { | |
128 | - | let | |
129 | - | if ($isInstanceOf( | |
133 | + | let x = W | |
134 | + | if ($isInstanceOf(x, "SetScriptTransaction")) | |
130 | 135 | then { | |
131 | - | let | |
136 | + | let Y = x | |
132 | 137 | true | |
133 | 138 | } | |
134 | 139 | else false | |
135 | 140 | } | |
136 | 141 | else false | |
137 | 142 |
github/deemru/w8io/169f3d6 51.82 ms ◑