tx · DotzstxB6JW7CBfCas71EawsPf2gZWJm1K8RDmoCPYE

3MpdJJV3WyZufiGHRtb7xbY2Vsc2pBFcJYZ:  -0.01400000 Waves

2021.05.13 08:34 [1523495] smart account 3MpdJJV3WyZufiGHRtb7xbY2Vsc2pBFcJYZ > SELF 0.00000000 Waves

{ "type": 13, "id": "DotzstxB6JW7CBfCas71EawsPf2gZWJm1K8RDmoCPYE", "fee": 1400000, "feeAssetId": null, "timestamp": 1620884066461, "version": 1, "sender": "3MpdJJV3WyZufiGHRtb7xbY2Vsc2pBFcJYZ", "senderPublicKey": "ALG9JVGNn9aCL68dbg1AmW6yDQv1b8EDLq99pQS8L1k6", "proofs": [ "qESVjMczdkR6EEnxhV8sM6TAR7wH3ezLshNpU3ENuXLggDkbucqD7uCx3rXRL4xovjVikRttYWzoWDw85XW3oat" ], "script": "base64:AAIEAAAAAAAAAA8IAhIAEgMKAQgSBAoCCAEAAAAWAAAAABNnYW1lTWFzdGVyUHVibGljS2V5AQAAACCKqFcQ1VSNQa7ZONz4ZD59H7wLfuowVwcQ1qI/fK6ACwAAAAAKZGljZU51bWJlcgkABEwAAAACAAAAAAAAAAACCQAETAAAAAIAAAAAAAAAAAMJAARMAAAAAgAAAAAAAAAABAkABEwAAAACAAAAAAAAAAAFCQAETAAAAAIAAAAAAAAAAAYJAARMAAAAAgAAAAAAAAAABwkABEwAAAACAAAAAAAAAAAICQAETAAAAAIAAAAAAAAAAAkJAARMAAAAAgAAAAAAAAAACgkABEwAAAACAAAAAAAAAAALCQAETAAAAAIAAAAAAAAAAAwFAAAAA25pbAAAAAAJZ2FtZVRva2VuAQAAACCvQNOoGbkt3wVk9kpr+yD9dOUY7LBdGNCbLK5MVkSodQAAAAAJUlNBUFVCTElDCQACWwAAAAECAAABkmJhc2U2NDpNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQWpudDJQZE4xUGRqZDoKN3JzWHpiYXBndWNuOWUxWGZmVX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ZXIFAAAAA25pbAkAAAIAAAABAgAAABlMYXN0IGJsb2NrIGRvZXNuJ3QgZXhpc3QuCQAAAgAAAAECAAAAEVNIQSBkb2Vzbid0IGV4aXN0CQAAAgAAAAECAAAAKUdhbWUgZG9lcyBub3QgZXhpc3Qgb3IgaGFzIGFscmVhZHkgZW5kZWQuAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAQAAAAHJG1hdGNoMAUAAAACdHgJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5bxHpMg==", "chainId": 84, "height": 1523495, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FvBSZcN9ooGY4EL1yyq4uJrD1MiGhYhkkheNRAs4Dwzu Next: FjumHL3NMo3Aj5LJstW9BYVJrF2SZmzhfSDAxi9gr3we Diff:
OldNewDifferences
33 {-# CONTENT_TYPE DAPP #-}
44 let a = base58'ALG9JVGNn9aCL68dbg1AmW6yDQv1b8EDLq99pQS8L1k6'
55
6-let b = [1, 2, 3, 4, 5, 6, 7, 8]
6+let b = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
77
88 let c = base58'Co7gTLr7ZJvVKwToLpuZJqmkVecy5uwupYH6qCkKuhc8'
99
10-let d = 0
10+let d = fromBase64String("base64:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjnt2PdN1Pdjd:
11+7rsXzbapgucn9e1XffUx1o7grAlw8C6NFuv1PPj7KnQ6RtN9xhniLF4xKlc7//TYXd1uHWmx9vu9hjciYX9UMRJnhlZO2q34mxPdcgLDKhJHDN726KI0wHpFQ5dHMyzoMLdWsahFc1Wx/XxroK2Kc1y2JBWN2akRlkxSDcluqbbUcWMyrwG6iWuVlhej5xfcuerg/psK35WGn7SLF29tWuR2x+24nM+BJUsuRG7yBZUhGrYzJk2gvpucRLea6AFRvow7RdyMYAwKFrr6mgQ0VcUw2T750e1oGanY0UdU3NPsKIgvU4Ft4uibMlMMBJvcrsEbDQHfDlwIDAQAB")
1112
12-let e = 1
13+let e = 0
1314
14-let f = 2
15+let f = 1
1516
16-let g = "G_GAMECOUNTER"
17+let g = 2
1718
18-let h = "B_PASSBETS_"
19+let h = "G_GAMECOUNTER"
1920
20-let i = "G_CurrentPoint_"
21+let i = "G_TOTALCRAPSBETS"
2122
2223 let j = 0
2324
2425 func k (l) = (l != a)
2526
2627
27-func m (n) = (("G_" + toString(n)) + "_STATE")
28+func m (n) = (("G_" + toString(n)) + "_FIRSTPOINT")
2829
2930
30-func o (n) = (("G_" + toString(n)) + "_SUMSHA")
31+func o (n) = (("G_" + toString(n)) + "_CURRENTPOINT")
3132
3233
33-func p (n) = (("G_" + toString(n)) + "_STARTHEIGHT")
34+func p (n) = (("G_" + toString(n)) + "_STATE")
3435
3536
36-func q (n) = getInteger(this, m(n))
37+func q (n) = (("G_" + toString(n)) + "_SUMSHA")
3738
3839
39-func r (n) = getString(this, o(n))
40+func r (n) = (("G_" + toString(n)) + "_STARTHEIGHT")
4041
4142
4243 func s (n) = getInteger(this, p(n))
4344
4445
45-func t () = getInteger(this, g)
46+func t (n) = getString(this, q(n))
4647
4748
48-func u (v) = b[(toInt(v) % 8)]
49+func u (n) = getInteger(this, r(n))
4950
5051
51-@Callable(w)
52-func initGame () = if (k(w.callerPublicKey))
52+func v () = getInteger(this, h)
53+
54+
55+func w (n) = getInteger(this, o(n))
56+
57+
58+func x (n) = getInteger(this, m(n))
59+
60+
61+@Callable(y)
62+func initGame () = if (k(y.callerPublicKey))
5363 then throw("initGame_FORBIDDEN")
5464 else {
55- let x = t()
56- if ($isInstanceOf(x, "Int"))
65+ let z = v()
66+ if ($isInstanceOf(z, "Int"))
5767 then {
58- let y = x
68+ let A = z
5969 throw("INIT_ALREADY_DONE")
6070 }
61- else [IntegerEntry(g, 0)]
71+ else [IntegerEntry(h, 0), IntegerEntry(i, 0)]
6272 }
6373
6474
6575
66-@Callable(w)
67-func startGame (v) = if (k(w.callerPublicKey))
76+@Callable(y)
77+func startGame (B) = if (k(y.callerPublicKey))
6878 then throw("startGame_FORBIDDEN")
6979 else {
70- let x = t()
71- if ($isInstanceOf(x, "Int"))
80+ let z = v()
81+ if ($isInstanceOf(z, "Int"))
7282 then {
73- let z = x
74- let A = (z + 1)
75-[IntegerEntry(g, A), IntegerEntry(m(A), 0), IntegerEntry(p(A), lastBlock.height), StringEntry(o(A), toBase58String(sha256(fromBase64String(v))))]
83+ let C = z
84+ let D = (C + 1)
85+[IntegerEntry(h, D), IntegerEntry(p(D), 0), IntegerEntry(r(D), lastBlock.height), StringEntry(q(D), toBase58String(sha256(fromBase64String(B))))]
7686 }
7787 else throw("INIT_NEED")
7888 }
7989
8090
81-@Verifier(B)
82-func C () = {
83- let x = B
84- sigVerify(B.bodyBytes, B.proofs[0], B.senderPublicKey)
91+
92+@Callable(y)
93+func throwDices (E,F) = if (k(y.callerPublicKey))
94+ then throw("throwDices_FORBIDDEN")
95+ else {
96+ let z = s(F)
97+ if ($isInstanceOf(z, "Int"))
98+ then {
99+ let G = z
100+ if ((G == g))
101+ then throw("Game is finished")
102+ else {
103+ let H = t(F)
104+ if ($isInstanceOf(H, "String"))
105+ then {
106+ let I = H
107+ let J = fromBase64String(E)
108+ let K = rsaVerify(SHA256, fromBase58String(I), J, d)
109+ let L = blockInfoByHeight((lastBlock.height - 1))
110+ if ($isInstanceOf(L, "BlockInfo"))
111+ then {
112+ let M = L
113+ let B = sha256((take(J, 4) + take(M.generationSignature, 4)))
114+ if (!(K))
115+ then throw("INVALID_RSA_SIGN")
116+ else {
117+ let N = (toInt(B) % 8)
118+ let C = b[N]
119+ if ((G == e))
120+ then [IntegerEntry(p(F), f), IntegerEntry(o(F), C)]
121+ else [IntegerEntry(p(F), f), IntegerEntry(m(F), C)]
122+ }
123+ }
124+ else throw("Last block doesn't exist.")
125+ }
126+ else throw("SHA doesn't exist")
127+ }
128+ }
129+ else throw("Game does not exist or has already ended.")
130+ }
131+
132+
133+@Verifier(O)
134+func P () = {
135+ let z = O
136+ sigVerify(O.bodyBytes, O.proofs[0], O.senderPublicKey)
85137 }
86138
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let a = base58'ALG9JVGNn9aCL68dbg1AmW6yDQv1b8EDLq99pQS8L1k6'
55
6-let b = [1, 2, 3, 4, 5, 6, 7, 8]
6+let b = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
77
88 let c = base58'Co7gTLr7ZJvVKwToLpuZJqmkVecy5uwupYH6qCkKuhc8'
99
10-let d = 0
10+let d = fromBase64String("base64:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjnt2PdN1Pdjd:
11+7rsXzbapgucn9e1XffUx1o7grAlw8C6NFuv1PPj7KnQ6RtN9xhniLF4xKlc7//TYXd1uHWmx9vu9hjciYX9UMRJnhlZO2q34mxPdcgLDKhJHDN726KI0wHpFQ5dHMyzoMLdWsahFc1Wx/XxroK2Kc1y2JBWN2akRlkxSDcluqbbUcWMyrwG6iWuVlhej5xfcuerg/psK35WGn7SLF29tWuR2x+24nM+BJUsuRG7yBZUhGrYzJk2gvpucRLea6AFRvow7RdyMYAwKFrr6mgQ0VcUw2T750e1oGanY0UdU3NPsKIgvU4Ft4uibMlMMBJvcrsEbDQHfDlwIDAQAB")
1112
12-let e = 1
13+let e = 0
1314
14-let f = 2
15+let f = 1
1516
16-let g = "G_GAMECOUNTER"
17+let g = 2
1718
18-let h = "B_PASSBETS_"
19+let h = "G_GAMECOUNTER"
1920
20-let i = "G_CurrentPoint_"
21+let i = "G_TOTALCRAPSBETS"
2122
2223 let j = 0
2324
2425 func k (l) = (l != a)
2526
2627
27-func m (n) = (("G_" + toString(n)) + "_STATE")
28+func m (n) = (("G_" + toString(n)) + "_FIRSTPOINT")
2829
2930
30-func o (n) = (("G_" + toString(n)) + "_SUMSHA")
31+func o (n) = (("G_" + toString(n)) + "_CURRENTPOINT")
3132
3233
33-func p (n) = (("G_" + toString(n)) + "_STARTHEIGHT")
34+func p (n) = (("G_" + toString(n)) + "_STATE")
3435
3536
36-func q (n) = getInteger(this, m(n))
37+func q (n) = (("G_" + toString(n)) + "_SUMSHA")
3738
3839
39-func r (n) = getString(this, o(n))
40+func r (n) = (("G_" + toString(n)) + "_STARTHEIGHT")
4041
4142
4243 func s (n) = getInteger(this, p(n))
4344
4445
45-func t () = getInteger(this, g)
46+func t (n) = getString(this, q(n))
4647
4748
48-func u (v) = b[(toInt(v) % 8)]
49+func u (n) = getInteger(this, r(n))
4950
5051
51-@Callable(w)
52-func initGame () = if (k(w.callerPublicKey))
52+func v () = getInteger(this, h)
53+
54+
55+func w (n) = getInteger(this, o(n))
56+
57+
58+func x (n) = getInteger(this, m(n))
59+
60+
61+@Callable(y)
62+func initGame () = if (k(y.callerPublicKey))
5363 then throw("initGame_FORBIDDEN")
5464 else {
55- let x = t()
56- if ($isInstanceOf(x, "Int"))
65+ let z = v()
66+ if ($isInstanceOf(z, "Int"))
5767 then {
58- let y = x
68+ let A = z
5969 throw("INIT_ALREADY_DONE")
6070 }
61- else [IntegerEntry(g, 0)]
71+ else [IntegerEntry(h, 0), IntegerEntry(i, 0)]
6272 }
6373
6474
6575
66-@Callable(w)
67-func startGame (v) = if (k(w.callerPublicKey))
76+@Callable(y)
77+func startGame (B) = if (k(y.callerPublicKey))
6878 then throw("startGame_FORBIDDEN")
6979 else {
70- let x = t()
71- if ($isInstanceOf(x, "Int"))
80+ let z = v()
81+ if ($isInstanceOf(z, "Int"))
7282 then {
73- let z = x
74- let A = (z + 1)
75-[IntegerEntry(g, A), IntegerEntry(m(A), 0), IntegerEntry(p(A), lastBlock.height), StringEntry(o(A), toBase58String(sha256(fromBase64String(v))))]
83+ let C = z
84+ let D = (C + 1)
85+[IntegerEntry(h, D), IntegerEntry(p(D), 0), IntegerEntry(r(D), lastBlock.height), StringEntry(q(D), toBase58String(sha256(fromBase64String(B))))]
7686 }
7787 else throw("INIT_NEED")
7888 }
7989
8090
81-@Verifier(B)
82-func C () = {
83- let x = B
84- sigVerify(B.bodyBytes, B.proofs[0], B.senderPublicKey)
91+
92+@Callable(y)
93+func throwDices (E,F) = if (k(y.callerPublicKey))
94+ then throw("throwDices_FORBIDDEN")
95+ else {
96+ let z = s(F)
97+ if ($isInstanceOf(z, "Int"))
98+ then {
99+ let G = z
100+ if ((G == g))
101+ then throw("Game is finished")
102+ else {
103+ let H = t(F)
104+ if ($isInstanceOf(H, "String"))
105+ then {
106+ let I = H
107+ let J = fromBase64String(E)
108+ let K = rsaVerify(SHA256, fromBase58String(I), J, d)
109+ let L = blockInfoByHeight((lastBlock.height - 1))
110+ if ($isInstanceOf(L, "BlockInfo"))
111+ then {
112+ let M = L
113+ let B = sha256((take(J, 4) + take(M.generationSignature, 4)))
114+ if (!(K))
115+ then throw("INVALID_RSA_SIGN")
116+ else {
117+ let N = (toInt(B) % 8)
118+ let C = b[N]
119+ if ((G == e))
120+ then [IntegerEntry(p(F), f), IntegerEntry(o(F), C)]
121+ else [IntegerEntry(p(F), f), IntegerEntry(m(F), C)]
122+ }
123+ }
124+ else throw("Last block doesn't exist.")
125+ }
126+ else throw("SHA doesn't exist")
127+ }
128+ }
129+ else throw("Game does not exist or has already ended.")
130+ }
131+
132+
133+@Verifier(O)
134+func P () = {
135+ let z = O
136+ sigVerify(O.bodyBytes, O.proofs[0], O.senderPublicKey)
85137 }
86138

github/deemru/w8io/169f3d6 
46.21 ms