tx · E9K8M7KeZ2xZ9DLpZBrZHq5cygVAmtNXsJgVPkfNx88A 3N2tusqAtDctK8iSTXS6F9rimmftmSuwLUX: -0.05000000 Waves 2019.10.29 15:37 [741438] smart account 3N2tusqAtDctK8iSTXS6F9rimmftmSuwLUX > SELF 0.00000000 Waves
{ "type": 13, "id": "E9K8M7KeZ2xZ9DLpZBrZHq5cygVAmtNXsJgVPkfNx88A", "fee": 5000000, "feeAssetId": null, "timestamp": 1572352661583, "version": 1, "sender": "3N2tusqAtDctK8iSTXS6F9rimmftmSuwLUX", "senderPublicKey": "ACfUG5PwG2GssMuyEwVEhkYAbbbP1geSHR8XoNxLyu6V", "proofs": [ "3yPDDoWdpq7ePYfh3DRXqeA3aSQoxVjJb3FxMaAQbYQsAiR3SCrpNhLX1ykqrmFbPAQjwCThdsY7eUzdoE1NapdA" ], "script": "base64:AAIDAAAAAAAAAAwIARIDCgEIEgMKAQgAAAAiAAAAAAlSU0FQVUJMSUMJAAJbAAAAAQIAAAGPYmFzZTY0Ok1JSUJJakFOQmdrcWhraUc5dzBCQVFFRkFBT0NBUThBTUlJQkNnS0NBUUVBZzRkQVI2WGJCREFTOWhyL0VqM2RKdjZGZmM0NjZ4L21PR01XVTNsckFCczNxYThCSG11Skdua2ZicEVmMnZBd1lUT1dQdnZ6Zk0xME9CYmZsb1N5cTNjOU1LdnlUZTFsdUJMR3FXNHZaVVhJeXZTZ3oxbGl5VVZlZklReTNkeUY5amJlVFpiQzBiYmNULzdPM0RFTCswMXo2QStyRENhY1NaMGxHb2xTUTZBbmhMeHpJa1ZwT1FKYnJCbUMreCtadVpQQ01Xekp5bmQ1YWVPbjdqYWovbWtSVnl4ZTZnLzBPaFd6NE5paVpYZXVNUkIrOG1LeTBmV0QvVWxJbFpXSHNBUzJabXJrWEtxakxxMC8wd3I4SUxKa3pualNxZG5JNUliamczdVFyai80QU4raTlyMjhhUTczL1prUHRZNVNidzBBT2lBQkJ1N2dIbXE5YXlWeFpRSURBUUFCAAAA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JBQAAAA5TVEFURVNVQk1JVFRFRAUAAAAGcGFDb2luBQAAAA9wbGF5ZXJBUHViS2V5NTgFAAAAB3BheVR5cGUIBQAAAAdwYXltZW50AAAABmFtb3VudAUAAAAGd2luQW10AgAAAAACAAAAAAIAAAAACQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAAPR0FNRVNDT1VOVEVSS0VZBQAAAApuZXdHYW1lTnVtCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAAZnYW1lSWQFAAAAC2dhbWVEYXRhU3RyBQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEFAAAAA25pbAAAAAFpAQAAABNjYW5jZWxDb2luQ2hhbGxlbmdlAAAAAQAAAAZnYW1lSWQEAAAADGdhbWVEYXRhTGlzdAkBAAAAE0V4dHJhY3RHYW1lRGF0YUxpc3QAAAABBQAAAAZnYW1lSWQJAAACAAAAAQIAAAAGYXNkYXNkAAAAAHY19PI=", "chainId": 84, "height": 741438, "spentComplexity": 0 } View: original | compacted Prev: HSXCuSBoqLK2amHT72gN7Lt2UARLmaLP1hiD74hHfEXW Next: CBf5MMqUGzr2W74fyEG1D7ERGR6V8RST6qRAejNtfMCb Diff:
Old | New | Differences | |
---|---|---|---|
146 | 146 | ||
147 | 147 | ||
148 | 148 | func am (an) = { | |
149 | - | let ao = { | |
150 | - | let z = getString(this, an) | |
151 | - | if ($isInstanceOf(z, "String")) | |
152 | - | then { | |
153 | - | let ap = z | |
154 | - | ap | |
155 | - | } | |
156 | - | else throw(("Couldn't find game by " + an)) | |
157 | - | } | |
158 | - | ah(ao) | |
149 | + | let ao = getStringValue(this, an) | |
150 | + | throw(ao) | |
159 | 151 | } | |
160 | 152 | ||
161 | 153 | ||
162 | - | func | |
163 | - | then ( | |
154 | + | func ap (aq,ar,J) = if (if ((ar != k)) | |
155 | + | then (ar != l) | |
164 | 156 | else false) | |
165 | 157 | then throw("Invalid play, change your bet to RED or BLUE coin. Game aborted.") | |
166 | 158 | else if (if ((J == "WBET")) | |
167 | - | then (n > | |
159 | + | then (n > aq) | |
168 | 160 | else false) | |
169 | 161 | then throw(("The minimum bet on Wbet is " + toString((n / f)))) | |
170 | 162 | else if (if ((J == "WAVES")) | |
171 | - | then (m > | |
163 | + | then (m > aq) | |
172 | 164 | else false) | |
173 | 165 | then throw(("The minimum bet on Waves is " + toString((m / f)))) | |
174 | - | else ((( | |
166 | + | else (((aq * 2) * (100 - (d + e))) / 100) | |
175 | 167 | ||
176 | 168 | ||
177 | - | @Callable( | |
169 | + | @Callable(as) | |
178 | 170 | func playCoin (aj) = { | |
179 | - | let an = toBase58String( | |
180 | - | let | |
181 | - | let K = extract( | |
182 | - | let | |
171 | + | let an = toBase58String(as.transactionId) | |
172 | + | let at = isDefined(getString(this, an)) | |
173 | + | let K = extract(as.payment) | |
174 | + | let au = isDefined(as.feeAssetId) | |
183 | 175 | if (if ((K.assetId != assetInfo(base58'WAVES'))) | |
184 | 176 | then (K.assetId != c) | |
185 | 177 | else false) | |
186 | 178 | then throw("Payment should be in Wbet or Waves. Game aborted.") | |
187 | - | else if ( | |
179 | + | else if (au) | |
188 | 180 | then throw("Transaction's fee must be in Waves. Game aborted.") | |
189 | - | else if ( | |
181 | + | else if (at) | |
190 | 182 | then throw("Passed gameId had been used before. Game aborted.") | |
191 | 183 | else { | |
192 | - | let | |
193 | - | let S = toBase58String( | |
184 | + | let av = x() | |
185 | + | let S = toBase58String(as.callerPublicKey) | |
194 | 186 | let T = J(K) | |
195 | - | let V = | |
196 | - | let | |
197 | - | ScriptResult(WriteSet([DataEntry(b, | |
187 | + | let V = ap(K.amount, aj, T) | |
188 | + | let aw = P(g, aj, S, T, K.amount, V, "", "", "") | |
189 | + | ScriptResult(WriteSet([DataEntry(b, av), DataEntry(an, aw)]), TransferSet(nil)) | |
198 | 190 | } | |
199 | 191 | } | |
200 | 192 | ||
201 | 193 | ||
202 | 194 | ||
203 | - | @Callable(at) | |
204 | - | func acceptCoinChallenge (an,ay) = { | |
205 | - | let az = am(an) | |
206 | - | let Q = az[o] | |
207 | - | let aj = az[p] | |
208 | - | let ak = az[q] | |
209 | - | let T = az[r] | |
210 | - | let al = parseIntValue(az[s]) | |
211 | - | let V = parseIntValue(az[t]) | |
212 | - | let K = extract(at.payment) | |
213 | - | let av = isDefined(at.feeAssetId) | |
214 | - | let aA = toBase58String(at.callerPublicKey) | |
215 | - | let aB = J(K) | |
216 | - | if (if ((K.assetId != assetInfo(base58'WAVES'))) | |
217 | - | then (K.assetId != c) | |
218 | - | else false) | |
219 | - | then throw("Payment should be in Wbet or Waves. Game aborted.") | |
220 | - | else if (av) | |
221 | - | then throw("Transaction's fee must be in Waves. Game aborted.") | |
222 | - | else if ((ak == aA)) | |
223 | - | then throw("You can't accept a challenge created by yourself. Game aborted.") | |
224 | - | else if ((T != aB)) | |
225 | - | then throw("Payment must be made in the same currency token as the bet, WBET/WBET or WAVES/WAVES. Game aborted.") | |
226 | - | else if ((al != K.amount)) | |
227 | - | then throw("Payout must be equal to the challenger bet amount. Game aborted.") | |
228 | - | else if ((Q != g)) | |
229 | - | then throw("Invalid game state for passed gameId. Game aborted.") | |
230 | - | else { | |
231 | - | let I = B(at, 100, 0) | |
232 | - | let Y = if ((I > 50)) | |
233 | - | then k | |
234 | - | else l | |
235 | - | let aC = if ((aj == k)) | |
236 | - | then l | |
237 | - | else k | |
238 | - | let aD = P(h, aj, ak, T, al, V, aC, aA, Y) | |
239 | - | ScriptResult(WriteSet([DataEntry(an, aD)]), TransferSet(nil)) | |
240 | - | } | |
241 | - | } | |
242 | - | ||
243 | - | ||
244 | - | ||
245 | - | @Callable(at) | |
195 | + | @Callable(as) | |
246 | 196 | func cancelCoinChallenge (an) = { | |
247 | - | let | |
197 | + | let ax = am(an) | |
248 | 198 | throw("asdasd") | |
249 | 199 | } | |
250 | 200 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = fromBase64String("base64:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAg4dAR6XbBDAS9hr/Ej3dJv6Ffc466x/mOGMWU3lrABs3qa8BHmuJGnkfbpEf2vAwYTOWPvvzfM10OBbfloSyq3c9MKvyTe1luBLGqW4vZUXIyvSgz1liyUVefIQy3dyF9jbeTZbC0bbcT/7O3DEL+01z6A+rDCacSZ0lGolSQ6AnhLxzIkVpOQJbrBmC+x+ZuZPCMWzJynd5aeOn7jaj/mkRVyxe6g/0OhWz4NiiZXeuMRB+8mKy0fWD/UlIlZWHsAS2ZmrkXKqjLq0/0wr8ILJkznjSqdnI5Ibjg3uQrj/4AN+i9r28aQ73/ZkPtY5Sbw0AOiABBu7gHmq9ayVxZQIDAQAB") | |
5 | 5 | ||
6 | 6 | let b = "$GAME_NUM" | |
7 | 7 | ||
8 | 8 | let c = base58'23vgV9p9pD83A7CFbsDEc4zjanep7UeFo4ZRS6oGorhv' | |
9 | 9 | ||
10 | 10 | let d = 4 | |
11 | 11 | ||
12 | 12 | let e = 2 | |
13 | 13 | ||
14 | 14 | let f = 100000000 | |
15 | 15 | ||
16 | 16 | let g = "SUBMITTED" | |
17 | 17 | ||
18 | 18 | let h = "ACCEPTED" | |
19 | 19 | ||
20 | 20 | let i = "FINISHED" | |
21 | 21 | ||
22 | 22 | let j = "CANCELED" | |
23 | 23 | ||
24 | 24 | let k = "RED" | |
25 | 25 | ||
26 | 26 | let l = "BLUE" | |
27 | 27 | ||
28 | 28 | let m = ((1 * f) / 2) | |
29 | 29 | ||
30 | 30 | let n = (100 * f) | |
31 | 31 | ||
32 | 32 | let o = 0 | |
33 | 33 | ||
34 | 34 | let p = 1 | |
35 | 35 | ||
36 | 36 | let q = 2 | |
37 | 37 | ||
38 | 38 | let r = 3 | |
39 | 39 | ||
40 | 40 | let s = 4 | |
41 | 41 | ||
42 | 42 | let t = 5 | |
43 | 43 | ||
44 | 44 | let u = 6 | |
45 | 45 | ||
46 | 46 | let v = 7 | |
47 | 47 | ||
48 | 48 | let w = 8 | |
49 | 49 | ||
50 | 50 | func x () = { | |
51 | 51 | let y = { | |
52 | 52 | let z = getInteger(this, b) | |
53 | 53 | if ($isInstanceOf(z, "Int")) | |
54 | 54 | then { | |
55 | 55 | let A = z | |
56 | 56 | A | |
57 | 57 | } | |
58 | 58 | else 0 | |
59 | 59 | } | |
60 | 60 | (y + 1) | |
61 | 61 | } | |
62 | 62 | ||
63 | 63 | ||
64 | 64 | func B (C,D,E) = { | |
65 | 65 | let F = { | |
66 | 66 | let z = getBinary(this, "lastPlay") | |
67 | 67 | if ($isInstanceOf(z, "ByteVector")) | |
68 | 68 | then { | |
69 | 69 | let G = z | |
70 | 70 | G | |
71 | 71 | } | |
72 | 72 | else if ($isInstanceOf(z, "Unit")) | |
73 | 73 | then { | |
74 | 74 | let H = z | |
75 | 75 | base58'2ee4oFDYriWJ9EMeR' | |
76 | 76 | } | |
77 | 77 | else throw() | |
78 | 78 | } | |
79 | 79 | let I = (((((F + C.transactionId) + C.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height)) | |
80 | 80 | (((toInt(sha256(I)) % 1000) % ((D - E) + 1)) + 1) | |
81 | 81 | } | |
82 | 82 | ||
83 | 83 | ||
84 | 84 | func J (K) = if ((K.assetId == c)) | |
85 | 85 | then "WBET" | |
86 | 86 | else "WAVES" | |
87 | 87 | ||
88 | 88 | ||
89 | 89 | func L (M) = if ((M == "WBET")) | |
90 | 90 | then c | |
91 | 91 | else unit | |
92 | 92 | ||
93 | 93 | ||
94 | 94 | func N (O) = { | |
95 | 95 | let G = size(O) | |
96 | 96 | if ((G == 0)) | |
97 | 97 | then throw("Parameter size must be greater then 0") | |
98 | 98 | else if ((G > 99)) | |
99 | 99 | then throw("Parameter size must be less then 100") | |
100 | 100 | else if ((10 > G)) | |
101 | 101 | then (("0" + toString(G)) + O) | |
102 | 102 | else (toString(G) + O) | |
103 | 103 | } | |
104 | 104 | ||
105 | 105 | ||
106 | 106 | func P (Q,R,S,T,U,V,W,X,Y) = { | |
107 | 107 | let Z = ((((((((((N(Q) + "_") + N(R)) + "_") + N(S)) + "_") + N(T)) + "_") + N(toString(U))) + "_") + N(toString(V))) | |
108 | 108 | if (if (if ((W == "")) | |
109 | 109 | then true | |
110 | 110 | else (X == "")) | |
111 | 111 | then true | |
112 | 112 | else (Y == "")) | |
113 | 113 | then Z | |
114 | 114 | else ((((((Z + "_") + N(W)) + "_") + N(X)) + "_") + N(Y)) | |
115 | 115 | } | |
116 | 116 | ||
117 | 117 | ||
118 | 118 | func aa (ab) = if ((size(ab) > 0)) | |
119 | 119 | then drop(ab, 1) | |
120 | 120 | else ab | |
121 | 121 | ||
122 | 122 | ||
123 | 123 | func ac (ab) = { | |
124 | 124 | let G = size(ab) | |
125 | 125 | if ((G > 0)) | |
126 | 126 | then { | |
127 | 127 | let ad = parseIntValue(take(ab, 2)) | |
128 | 128 | let ae = take(drop(ab, 2), ad) | |
129 | 129 | let af = drop(ab, (ad + 2)) | |
130 | 130 | let ag = aa(af) | |
131 | 131 | [ae, ag] | |
132 | 132 | } | |
133 | 133 | else throw("Empty string was passed into parseNextAttribute func") | |
134 | 134 | } | |
135 | 135 | ||
136 | 136 | ||
137 | 137 | func ah (ai) = { | |
138 | 138 | let Q = ac(ai) | |
139 | 139 | let aj = ac(Q[1]) | |
140 | 140 | let ak = ac(aj[1]) | |
141 | 141 | let T = ac(ak[1]) | |
142 | 142 | let al = ac(T[1]) | |
143 | 143 | let V = ac(al[1]) | |
144 | 144 | [Q[0], aj[0], ak[0], T[0], al[0], V[0]] | |
145 | 145 | } | |
146 | 146 | ||
147 | 147 | ||
148 | 148 | func am (an) = { | |
149 | - | let ao = { | |
150 | - | let z = getString(this, an) | |
151 | - | if ($isInstanceOf(z, "String")) | |
152 | - | then { | |
153 | - | let ap = z | |
154 | - | ap | |
155 | - | } | |
156 | - | else throw(("Couldn't find game by " + an)) | |
157 | - | } | |
158 | - | ah(ao) | |
149 | + | let ao = getStringValue(this, an) | |
150 | + | throw(ao) | |
159 | 151 | } | |
160 | 152 | ||
161 | 153 | ||
162 | - | func | |
163 | - | then ( | |
154 | + | func ap (aq,ar,J) = if (if ((ar != k)) | |
155 | + | then (ar != l) | |
164 | 156 | else false) | |
165 | 157 | then throw("Invalid play, change your bet to RED or BLUE coin. Game aborted.") | |
166 | 158 | else if (if ((J == "WBET")) | |
167 | - | then (n > | |
159 | + | then (n > aq) | |
168 | 160 | else false) | |
169 | 161 | then throw(("The minimum bet on Wbet is " + toString((n / f)))) | |
170 | 162 | else if (if ((J == "WAVES")) | |
171 | - | then (m > | |
163 | + | then (m > aq) | |
172 | 164 | else false) | |
173 | 165 | then throw(("The minimum bet on Waves is " + toString((m / f)))) | |
174 | - | else ((( | |
166 | + | else (((aq * 2) * (100 - (d + e))) / 100) | |
175 | 167 | ||
176 | 168 | ||
177 | - | @Callable( | |
169 | + | @Callable(as) | |
178 | 170 | func playCoin (aj) = { | |
179 | - | let an = toBase58String( | |
180 | - | let | |
181 | - | let K = extract( | |
182 | - | let | |
171 | + | let an = toBase58String(as.transactionId) | |
172 | + | let at = isDefined(getString(this, an)) | |
173 | + | let K = extract(as.payment) | |
174 | + | let au = isDefined(as.feeAssetId) | |
183 | 175 | if (if ((K.assetId != assetInfo(base58'WAVES'))) | |
184 | 176 | then (K.assetId != c) | |
185 | 177 | else false) | |
186 | 178 | then throw("Payment should be in Wbet or Waves. Game aborted.") | |
187 | - | else if ( | |
179 | + | else if (au) | |
188 | 180 | then throw("Transaction's fee must be in Waves. Game aborted.") | |
189 | - | else if ( | |
181 | + | else if (at) | |
190 | 182 | then throw("Passed gameId had been used before. Game aborted.") | |
191 | 183 | else { | |
192 | - | let | |
193 | - | let S = toBase58String( | |
184 | + | let av = x() | |
185 | + | let S = toBase58String(as.callerPublicKey) | |
194 | 186 | let T = J(K) | |
195 | - | let V = | |
196 | - | let | |
197 | - | ScriptResult(WriteSet([DataEntry(b, | |
187 | + | let V = ap(K.amount, aj, T) | |
188 | + | let aw = P(g, aj, S, T, K.amount, V, "", "", "") | |
189 | + | ScriptResult(WriteSet([DataEntry(b, av), DataEntry(an, aw)]), TransferSet(nil)) | |
198 | 190 | } | |
199 | 191 | } | |
200 | 192 | ||
201 | 193 | ||
202 | 194 | ||
203 | - | @Callable(at) | |
204 | - | func acceptCoinChallenge (an,ay) = { | |
205 | - | let az = am(an) | |
206 | - | let Q = az[o] | |
207 | - | let aj = az[p] | |
208 | - | let ak = az[q] | |
209 | - | let T = az[r] | |
210 | - | let al = parseIntValue(az[s]) | |
211 | - | let V = parseIntValue(az[t]) | |
212 | - | let K = extract(at.payment) | |
213 | - | let av = isDefined(at.feeAssetId) | |
214 | - | let aA = toBase58String(at.callerPublicKey) | |
215 | - | let aB = J(K) | |
216 | - | if (if ((K.assetId != assetInfo(base58'WAVES'))) | |
217 | - | then (K.assetId != c) | |
218 | - | else false) | |
219 | - | then throw("Payment should be in Wbet or Waves. Game aborted.") | |
220 | - | else if (av) | |
221 | - | then throw("Transaction's fee must be in Waves. Game aborted.") | |
222 | - | else if ((ak == aA)) | |
223 | - | then throw("You can't accept a challenge created by yourself. Game aborted.") | |
224 | - | else if ((T != aB)) | |
225 | - | then throw("Payment must be made in the same currency token as the bet, WBET/WBET or WAVES/WAVES. Game aborted.") | |
226 | - | else if ((al != K.amount)) | |
227 | - | then throw("Payout must be equal to the challenger bet amount. Game aborted.") | |
228 | - | else if ((Q != g)) | |
229 | - | then throw("Invalid game state for passed gameId. Game aborted.") | |
230 | - | else { | |
231 | - | let I = B(at, 100, 0) | |
232 | - | let Y = if ((I > 50)) | |
233 | - | then k | |
234 | - | else l | |
235 | - | let aC = if ((aj == k)) | |
236 | - | then l | |
237 | - | else k | |
238 | - | let aD = P(h, aj, ak, T, al, V, aC, aA, Y) | |
239 | - | ScriptResult(WriteSet([DataEntry(an, aD)]), TransferSet(nil)) | |
240 | - | } | |
241 | - | } | |
242 | - | ||
243 | - | ||
244 | - | ||
245 | - | @Callable(at) | |
195 | + | @Callable(as) | |
246 | 196 | func cancelCoinChallenge (an) = { | |
247 | - | let | |
197 | + | let ax = am(an) | |
248 | 198 | throw("asdasd") | |
249 | 199 | } | |
250 | 200 | ||
251 | 201 |
github/deemru/w8io/026f985 36.88 ms ◑