tx · GDQ1cPy9CCeFH4kceDc89HpCxDzq7DsNNcmt9aXwkDqZ 3N6hQF6HBBQ5JCKB8Xs17Q61wkG3VrLvbGd: -0.10000000 Waves 2021.11.13 05:02 [1788603] smart account 3N6hQF6HBBQ5JCKB8Xs17Q61wkG3VrLvbGd > SELF 0.00000000 Waves
{ "type": 13, "id": "GDQ1cPy9CCeFH4kceDc89HpCxDzq7DsNNcmt9aXwkDqZ", "fee": 10000000, "feeAssetId": null, "timestamp": 1636768939033, "version": 2, "chainId": 84, "sender": "3N6hQF6HBBQ5JCKB8Xs17Q61wkG3VrLvbGd", "senderPublicKey": "7Hi4o6vBstRs79NMVMjEove52dmP87RAcvNDAXN8C4Wi", "proofs": [ "5EqH2wNTSm8V2ymnamYgzYU62firJYMqJ5MvmF2fqeGQm5K5MuYe5TEGtZsRs2prjfdGfY59w34T7kakxZ43uJXr" ], "script": "base64:AAIFAAAAAAAAAAwIAhIDCgEIEgMKAQgAAAANAAAAAAZjYXNpbm8CAAAAIzNONmhRRjZIQkJRNUpDS0I4WHMxN1E2MXdrRzNWckx2YkdkAAAAAAVXQVZFUwAAAAAAO5rKAAAAAAAGbWF4QmV0CQAAaAAAAAIAAAAAAAAAAGQFAAAABVdBVkVTAAAAAAlzZXBhcmF0b3ICAAAAASwBAAAACmdldE5ld0RlY2sAAAAACQAETAAAAAICAAAAAzAxQwkABEwAAAACAgAAAAMwMkMJAARMAAAAAgIAAAADMDNDCQAETAAAAAICAAAAAzA0QwkABEwAAAACAgAAAAMwNUMJAARMAAAAAgIAAAADMDZDCQAETAAAAAICAAAAAzA3QwkABEwAAAACAgAAAAMwOEMJAARMAAAAAgIAAAADMDlDCQAETAAAAAICAAAAAzEwQwkABEwAAAACAgAAAAMxMUMJAARMAAAAAgIAAAADMTJDCQAETAAAAAICAAAAAzEzQwkABEwAAAACAgAAAAMwMUQJAARMAAAAAgIAAAADMDJECQAETAAAAAICAAAAAzAzRAkABEwAAAACAgAAAAMwNEQJAARMAAAAAg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G5vIHdpbm5lcgQAAAAGd2lubmVyCQEAAAARQGV4dHJOYXRpdmUoMTA1MykAAAACBQAAAAR0aGlzCQABLAAAAAIFAAAABXJvdW5kAgAAAAdfd2lubmVyBAAAAAljdXJTdW1CZXQJAQAAABFAZXh0ck5hdGl2ZSgxMDUwKQAAAAIFAAAABHRoaXMJAAEsAAAAAgUAAAAFbWVLZXkCAAAACF9zdW1CZXRzAwkAAAAAAAACBQAAAAljdXJTdW1CZXQAAAAAAAAAAAAJAAACAAAAAQIAAAAaWW91IHdvbiBub3RoaW5nIHRoaXMgcm91bmQDCQAAAAAAAAIFAAAABndpbm5lcgUAAAANY2FsbGVyQWRkcmVzcwkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACBQAAAAt3aXRoZHJhd0tleQkAAaQAAAABBQAAAAljdXJTdW1CZXQJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAAljdXJTdW1CZXQFAAAABHVuaXQFAAAAA25pbAkAAAIAAAABAgAAABZZb3UgYXJlIG5vdCB0aGUgd2lubmVyAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXm4vrut", "height": 1788603, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GzRbzDdEZWxK8ZvcYfTsmZjQqPDSzCvDxzkaDcT3wYJz Next: 3Xik9hri5yVkEgykdMhcAj7YDb7V4PGp18EDGfgjnmcM Diff:
Old | New | Differences | |
---|---|---|---|
59 | 59 | } | |
60 | 60 | ||
61 | 61 | ||
62 | - | func z (A) = parseIntValue(take(A, 2)) | |
62 | + | func z (A) = { | |
63 | + | let B = parseIntValue(take(A, 2)) | |
64 | + | if ((B == 1)) | |
65 | + | then 20 | |
66 | + | else B | |
67 | + | } | |
63 | 68 | ||
64 | 69 | ||
65 | - | func | |
66 | - | let | |
67 | - | let G = z( | |
68 | - | if (( | |
69 | - | then | |
70 | + | func C (D,E,F,a) = { | |
71 | + | let B = z(D) | |
72 | + | let G = z(E) | |
73 | + | if ((B > G)) | |
74 | + | then F | |
70 | 75 | else a | |
71 | 76 | } | |
72 | 77 | ||
84 | 89 | ||
85 | 90 | @Callable(x) | |
86 | 91 | func bet (K) = { | |
87 | - | let | |
88 | - | let L = ((K + "_") + | |
89 | - | let | |
92 | + | let F = toBase58String(x.caller.bytes) | |
93 | + | let L = ((K + "_") + F) | |
94 | + | let B = w(x) | |
90 | 95 | let M = (L + "_sumBets") | |
91 | 96 | let N = s(this, M) | |
92 | 97 | let O = { | |
93 | - | let q = getInteger(this, ( | |
98 | + | let q = getInteger(this, (K + "_drawSequence")) | |
94 | 99 | if ($isInstanceOf(q, "Int")) | |
95 | 100 | then { | |
96 | 101 | let v = q | |
99 | 104 | else 0 | |
100 | 105 | } | |
101 | 106 | let I = (L + "_available") | |
102 | - | let P = (N + | |
107 | + | let P = (N + B) | |
103 | 108 | if (if (isDefined(getBoolean(this, (K + "_stop")))) | |
104 | 109 | then true | |
105 | 110 | else isDefined(getString(this, K))) | |
108 | 113 | then throw(((("Maximum amount of bets for round " + toString(c)) + ". With your bet it's ") + toString(P))) | |
109 | 114 | else { | |
110 | 115 | let Q = H(this, I) | |
111 | - | let R = h((L + makeString(Q, d)), o( | |
112 | - | let | |
116 | + | let R = h((L + makeString(Q, d)), o(F), size(Q)) | |
117 | + | let D = Q[(R % size(Q))] | |
113 | 118 | let S = removeByIndex(Q, (R % size(Q))) | |
114 | 119 | let T = f(S) | |
115 | - | let U = h((L + makeString(T, d)), o( | |
116 | - | let | |
120 | + | let U = h((L + makeString(T, d)), o(F), size(T)) | |
121 | + | let E = T[(U % size(T))] | |
117 | 122 | let V = removeByIndex(T, (R % size(T))) | |
118 | - | if ((z( | |
119 | - | then [StringEntry(I, makeString(V, d)), StringEntry((L + "_salt_debug"), L), IntegerEntry((L + "_LastRandonNumber"), U), IntegerEntry((L + "_sumBets"), P), StringEntry((L + "_playerCard"), | |
123 | + | if ((z(D) == z(E))) | |
124 | + | then [StringEntry(I, makeString(V, d)), StringEntry((L + "_salt_debug"), L), IntegerEntry((L + "_LastRandonNumber"), U), IntegerEntry((L + "_sumBets"), P), StringEntry((L + "_playerCard"), D), StringEntry((L + "_casinoCard"), E), IntegerEntry((K + "_drawSequence"), (O + 1))] | |
120 | 125 | else { | |
121 | - | let W = | |
122 | - | [StringEntry(I, makeString(V, d)), StringEntry((L + "_salt_debug"), L), IntegerEntry((L + "_LastRandonNumber"), U), IntegerEntry((L + "_sumBets"), P), StringEntry((L + "_playerCard"), | |
126 | + | let W = C(D, E, F, a) | |
127 | + | [StringEntry(I, makeString(V, d)), StringEntry((L + "_salt_debug"), L), IntegerEntry((L + "_LastRandonNumber"), U), IntegerEntry((L + "_sumBets"), P), StringEntry((L + "_playerCard"), D), StringEntry((L + "_casinoCard"), E), BooleanEntry((L + "_stop"), true), StringEntry((K + "_winner"), W)] | |
123 | 128 | } | |
124 | 129 | } | |
125 | 130 | } | |
128 | 133 | ||
129 | 134 | @Callable(x) | |
130 | 135 | func withdraw (K) = { | |
131 | - | let | |
132 | - | let L = ((K + "_") + | |
136 | + | let F = toBase58String(x.caller.bytes) | |
137 | + | let L = ((K + "_") + F) | |
133 | 138 | let X = (L + "_withdraw") | |
134 | 139 | if (isDefined(getString(this, X))) | |
135 | 140 | then throw("You have already got your prize") | |
136 | - | else if (isDefined(getInteger(this, ( | |
141 | + | else if (isDefined(getInteger(this, (K + "_drawSequence")))) | |
137 | 142 | then throw("There is no winner, it was a draw") | |
138 | - | else if (!(isDefined(getString(this, ( | |
143 | + | else if (!(isDefined(getString(this, (K + "_winner"))))) | |
139 | 144 | then throw("There is no winner") | |
140 | 145 | else { | |
141 | - | let W = getStringValue(this, ( | |
146 | + | let W = getStringValue(this, (K + "_winner")) | |
142 | 147 | let Y = getIntegerValue(this, (L + "_sumBets")) | |
143 | 148 | if ((Y == 0)) | |
144 | 149 | then throw("You won nothing this round") | |
145 | - | else if ((W == | |
150 | + | else if ((W == F)) | |
146 | 151 | then [StringEntry(X, toString(Y)), ScriptTransfer(x.caller, Y, unit)] | |
147 | 152 | else throw("You are not the winner") | |
148 | 153 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = "3N6hQF6HBBQ5JCKB8Xs17Q61wkG3VrLvbGd" | |
5 | 5 | ||
6 | 6 | let b = 1000000000 | |
7 | 7 | ||
8 | 8 | let c = (100 * b) | |
9 | 9 | ||
10 | 10 | let d = "," | |
11 | 11 | ||
12 | 12 | func e () = ["01C", "02C", "03C", "04C", "05C", "06C", "07C", "08C", "09C", "10C", "11C", "12C", "13C", "01D", "02D", "03D", "04D", "05D", "06D", "07D", "08D", "09D", "10D", "11D", "12D", "13D", "01H", "02H", "03H", "04H", "05H", "06H", "07H", "08H", "09H", "10H", "11H", "12H", "13H", "01S", "02S", "03S", "04S", "05S", "06S", "07S", "08S", "09S", "10S", "11S", "12S", "13S"] | |
13 | 13 | ||
14 | 14 | ||
15 | 15 | func f (g) = if ((0 >= size(g))) | |
16 | 16 | then e() | |
17 | 17 | else g | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func h (i,j,k) = { | |
21 | 21 | let l = sha256(toBytes((i + j))) | |
22 | 22 | let m = toInt(l) | |
23 | 23 | let n = (m % k) | |
24 | 24 | if ((0 > n)) | |
25 | 25 | then ((-1 * n) + 1) | |
26 | 26 | else (n + 1) | |
27 | 27 | } | |
28 | 28 | ||
29 | 29 | ||
30 | 30 | func o (p) = { | |
31 | 31 | let q = getInteger(this, (p + "_LastRandonNumber")) | |
32 | 32 | if ($isInstanceOf(q, "Int")) | |
33 | 33 | then { | |
34 | 34 | let r = q | |
35 | 35 | toString(r) | |
36 | 36 | } | |
37 | 37 | else p | |
38 | 38 | } | |
39 | 39 | ||
40 | 40 | ||
41 | 41 | func s (t,u) = { | |
42 | 42 | let q = getInteger(t, u) | |
43 | 43 | if ($isInstanceOf(q, "Int")) | |
44 | 44 | then { | |
45 | 45 | let v = q | |
46 | 46 | v | |
47 | 47 | } | |
48 | 48 | else 0 | |
49 | 49 | } | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func w (x) = if ((size(x.payments) == 0)) | |
53 | 53 | then throw("Payment must be attached") | |
54 | 54 | else { | |
55 | 55 | let y = x.payments[0] | |
56 | 56 | if (isDefined(y.assetId)) | |
57 | 57 | then throw("This function accepts WAVES tokens only") | |
58 | 58 | else y.amount | |
59 | 59 | } | |
60 | 60 | ||
61 | 61 | ||
62 | - | func z (A) = parseIntValue(take(A, 2)) | |
62 | + | func z (A) = { | |
63 | + | let B = parseIntValue(take(A, 2)) | |
64 | + | if ((B == 1)) | |
65 | + | then 20 | |
66 | + | else B | |
67 | + | } | |
63 | 68 | ||
64 | 69 | ||
65 | - | func | |
66 | - | let | |
67 | - | let G = z( | |
68 | - | if (( | |
69 | - | then | |
70 | + | func C (D,E,F,a) = { | |
71 | + | let B = z(D) | |
72 | + | let G = z(E) | |
73 | + | if ((B > G)) | |
74 | + | then F | |
70 | 75 | else a | |
71 | 76 | } | |
72 | 77 | ||
73 | 78 | ||
74 | 79 | func H (t,I) = if (isDefined(getString(t, I))) | |
75 | 80 | then { | |
76 | 81 | let J = getStringValue(t, I) | |
77 | 82 | let g = split(J, d) | |
78 | 83 | if ((size(g) == 0)) | |
79 | 84 | then e() | |
80 | 85 | else g | |
81 | 86 | } | |
82 | 87 | else e() | |
83 | 88 | ||
84 | 89 | ||
85 | 90 | @Callable(x) | |
86 | 91 | func bet (K) = { | |
87 | - | let | |
88 | - | let L = ((K + "_") + | |
89 | - | let | |
92 | + | let F = toBase58String(x.caller.bytes) | |
93 | + | let L = ((K + "_") + F) | |
94 | + | let B = w(x) | |
90 | 95 | let M = (L + "_sumBets") | |
91 | 96 | let N = s(this, M) | |
92 | 97 | let O = { | |
93 | - | let q = getInteger(this, ( | |
98 | + | let q = getInteger(this, (K + "_drawSequence")) | |
94 | 99 | if ($isInstanceOf(q, "Int")) | |
95 | 100 | then { | |
96 | 101 | let v = q | |
97 | 102 | (v + 1) | |
98 | 103 | } | |
99 | 104 | else 0 | |
100 | 105 | } | |
101 | 106 | let I = (L + "_available") | |
102 | - | let P = (N + | |
107 | + | let P = (N + B) | |
103 | 108 | if (if (isDefined(getBoolean(this, (K + "_stop")))) | |
104 | 109 | then true | |
105 | 110 | else isDefined(getString(this, K))) | |
106 | 111 | then throw("This round is already played") | |
107 | 112 | else if ((P > c)) | |
108 | 113 | then throw(((("Maximum amount of bets for round " + toString(c)) + ". With your bet it's ") + toString(P))) | |
109 | 114 | else { | |
110 | 115 | let Q = H(this, I) | |
111 | - | let R = h((L + makeString(Q, d)), o( | |
112 | - | let | |
116 | + | let R = h((L + makeString(Q, d)), o(F), size(Q)) | |
117 | + | let D = Q[(R % size(Q))] | |
113 | 118 | let S = removeByIndex(Q, (R % size(Q))) | |
114 | 119 | let T = f(S) | |
115 | - | let U = h((L + makeString(T, d)), o( | |
116 | - | let | |
120 | + | let U = h((L + makeString(T, d)), o(F), size(T)) | |
121 | + | let E = T[(U % size(T))] | |
117 | 122 | let V = removeByIndex(T, (R % size(T))) | |
118 | - | if ((z( | |
119 | - | then [StringEntry(I, makeString(V, d)), StringEntry((L + "_salt_debug"), L), IntegerEntry((L + "_LastRandonNumber"), U), IntegerEntry((L + "_sumBets"), P), StringEntry((L + "_playerCard"), | |
123 | + | if ((z(D) == z(E))) | |
124 | + | then [StringEntry(I, makeString(V, d)), StringEntry((L + "_salt_debug"), L), IntegerEntry((L + "_LastRandonNumber"), U), IntegerEntry((L + "_sumBets"), P), StringEntry((L + "_playerCard"), D), StringEntry((L + "_casinoCard"), E), IntegerEntry((K + "_drawSequence"), (O + 1))] | |
120 | 125 | else { | |
121 | - | let W = | |
122 | - | [StringEntry(I, makeString(V, d)), StringEntry((L + "_salt_debug"), L), IntegerEntry((L + "_LastRandonNumber"), U), IntegerEntry((L + "_sumBets"), P), StringEntry((L + "_playerCard"), | |
126 | + | let W = C(D, E, F, a) | |
127 | + | [StringEntry(I, makeString(V, d)), StringEntry((L + "_salt_debug"), L), IntegerEntry((L + "_LastRandonNumber"), U), IntegerEntry((L + "_sumBets"), P), StringEntry((L + "_playerCard"), D), StringEntry((L + "_casinoCard"), E), BooleanEntry((L + "_stop"), true), StringEntry((K + "_winner"), W)] | |
123 | 128 | } | |
124 | 129 | } | |
125 | 130 | } | |
126 | 131 | ||
127 | 132 | ||
128 | 133 | ||
129 | 134 | @Callable(x) | |
130 | 135 | func withdraw (K) = { | |
131 | - | let | |
132 | - | let L = ((K + "_") + | |
136 | + | let F = toBase58String(x.caller.bytes) | |
137 | + | let L = ((K + "_") + F) | |
133 | 138 | let X = (L + "_withdraw") | |
134 | 139 | if (isDefined(getString(this, X))) | |
135 | 140 | then throw("You have already got your prize") | |
136 | - | else if (isDefined(getInteger(this, ( | |
141 | + | else if (isDefined(getInteger(this, (K + "_drawSequence")))) | |
137 | 142 | then throw("There is no winner, it was a draw") | |
138 | - | else if (!(isDefined(getString(this, ( | |
143 | + | else if (!(isDefined(getString(this, (K + "_winner"))))) | |
139 | 144 | then throw("There is no winner") | |
140 | 145 | else { | |
141 | - | let W = getStringValue(this, ( | |
146 | + | let W = getStringValue(this, (K + "_winner")) | |
142 | 147 | let Y = getIntegerValue(this, (L + "_sumBets")) | |
143 | 148 | if ((Y == 0)) | |
144 | 149 | then throw("You won nothing this round") | |
145 | - | else if ((W == | |
150 | + | else if ((W == F)) | |
146 | 151 | then [StringEntry(X, toString(Y)), ScriptTransfer(x.caller, Y, unit)] | |
147 | 152 | else throw("You are not the winner") | |
148 | 153 | } | |
149 | 154 | } | |
150 | 155 | ||
151 | 156 | ||
152 | 157 | @Verifier(Z) | |
153 | 158 | func aa () = sigVerify(Z.bodyBytes, Z.proofs[0], Z.senderPublicKey) | |
154 | 159 |
github/deemru/w8io/026f985 47.65 ms ◑