tx · 6PWxpjd41M9JynSV4Q5srSY76JrzevxnJaGZADo77pKy 3N3QGoxpTairHzyavoHpRPyTVMyLdX46MwJ: -0.01400000 Waves 2021.02.02 16:02 [1380576] smart account 3N3QGoxpTairHzyavoHpRPyTVMyLdX46MwJ > SELF 0.00000000 Waves
{ "type": 13, "id": "6PWxpjd41M9JynSV4Q5srSY76JrzevxnJaGZADo77pKy", "fee": 1400000, "feeAssetId": null, "timestamp": 1612270956256, "version": 2, "chainId": 84, "sender": "3N3QGoxpTairHzyavoHpRPyTVMyLdX46MwJ", "senderPublicKey": "84ye9pvBU1ixETjmeNbvvD5czb8ZEjsSJuNyFGkYFmwd", "proofs": [ "5Qr5azEjRjoowXM7TwcRjGVgLa7h2G7MJWCvScNZWayn5QHAKLeV5RdbXi9TmimgBCqNTrJkXmbn6iZPmqmmMJwF" ], "script": "base64:AAIEAAAAAAAAAB0IAhIDCgEIEgMKAQgSAwoBCBIECgIIARIECgIICAAAACEAAAAABE5PTkUCAAAABG5vbmUAAAAABkJBTk5FRAIAAAAGYmFubmVkAAAAAAZBQ1RJVkUCAAAABmFjdGl2ZQAAAAAFQ0xPU0UCAAAABWNsb3NlAAAAAARPUEVOAgAAAARvcGVuAAAAAAhhc3NldEtleQIAAAAFYXNzZXQAAAAAC2tleVByaWNlS2V5AgAAAAlrZXlfcHJpY2UAAAAACG93bmVyS2V5AgAAAAVvd25lcgAAAAAHYWN0aW9ucwkABEwAAAACBQAAAARPUEVOCQAETAAAAAIFAAAABUNMT1NFBQAAAANuaWwAAAAAFGRldmljZUluaXRpYWxDb3VudGVyAAAAAAAAAAAAAAAAAAlrZXlEZXZpY2UAAAAAAAAAAAAAAAAADWtleVZhbGlkVW50aWwAAAAAAAAAAAEBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAA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gYWxsb3dlZAMJAQAAABNrZXlUaW1lc3RhbXBJbnZhbGlkAAAAAQUAAAAHa2V5SW5mbwkAAAIAAAABAgAAAAtLZXkgZXhwaXJlZAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQEAAAAPZGV2aWNlQWN0aW9uS2V5AAAAAQUAAAAJZGV2aWNlU3RyBQAAAAZhY3Rpb24JAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAQAAABZkZXZpY2VBY3Rpb25Db3VudGVyS2V5AAAAAQUAAAAJZGV2aWNlU3RyCQAAZAAAAAIJAQAAABhkZXZpY2VBY3Rpb25Db3VudGVyVmFsdWUAAAABBQAAAAlkZXZpY2VTdHIAAAAAAAAAAAEFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5stq+fQ==", "height": 1380576, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 554LGE8MG5HSEZ45xTuBF7vw2uTJq8Aq8kiRNufgBvsR Next: 6ZGgb1WXermoi8aooaTac7St6pDmY3J2nC5jR9XgbTJA Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = "none" | |
5 | 5 | ||
6 | 6 | let b = "banned" | |
7 | 7 | ||
8 | 8 | let c = "active" | |
9 | 9 | ||
10 | 10 | let d = "close" | |
11 | 11 | ||
12 | 12 | let e = "open" | |
13 | 13 | ||
14 | 14 | let f = "asset" | |
15 | 15 | ||
16 | 16 | let g = "key_price" | |
17 | 17 | ||
18 | 18 | let h = "owner" | |
19 | 19 | ||
20 | 20 | let i = [e, d] | |
21 | 21 | ||
22 | 22 | let j = 0 | |
23 | 23 | ||
24 | 24 | let k = 0 | |
25 | 25 | ||
26 | 26 | let l = 1 | |
27 | 27 | ||
28 | 28 | func m (n) = { | |
29 | 29 | let o = getInteger(this, n) | |
30 | 30 | if ($isInstanceOf(o, "Int")) | |
31 | 31 | then { | |
32 | 32 | let p = o | |
33 | 33 | p | |
34 | 34 | } | |
35 | 35 | else 0 | |
36 | 36 | } | |
37 | 37 | ||
38 | 38 | ||
39 | 39 | func q (n) = { | |
40 | 40 | let o = getString(this, n) | |
41 | 41 | if ($isInstanceOf(o, "String")) | |
42 | 42 | then { | |
43 | 43 | let p = o | |
44 | 44 | p | |
45 | 45 | } | |
46 | 46 | else a | |
47 | 47 | } | |
48 | 48 | ||
49 | 49 | ||
50 | 50 | func r (n) = { | |
51 | 51 | let o = getInteger(this, n) | |
52 | 52 | if ($isInstanceOf(o, "Int")) | |
53 | 53 | then { | |
54 | 54 | let p = o | |
55 | 55 | p | |
56 | 56 | } | |
57 | 57 | else 0 | |
58 | 58 | } | |
59 | 59 | ||
60 | 60 | ||
61 | 61 | func s (t,n) = { | |
62 | 62 | let o = getString(t, n) | |
63 | 63 | if ($isInstanceOf(o, "String")) | |
64 | 64 | then { | |
65 | 65 | let p = o | |
66 | 66 | p | |
67 | 67 | } | |
68 | 68 | else a | |
69 | 69 | } | |
70 | 70 | ||
71 | 71 | ||
72 | 72 | func u () = fromBase58String(q(f)) | |
73 | 73 | ||
74 | 74 | ||
75 | 75 | func v (t) = ("user_" + t) | |
76 | 76 | ||
77 | 77 | ||
78 | 78 | func w (t) = { | |
79 | 79 | let o = getString(this, v(t)) | |
80 | 80 | if ($isInstanceOf(o, "String")) | |
81 | 81 | then { | |
82 | 82 | let p = o | |
83 | 83 | p | |
84 | 84 | } | |
85 | 85 | else a | |
86 | 86 | } | |
87 | 87 | ||
88 | 88 | ||
89 | 89 | func x (t) = ("device_" + t) | |
90 | 90 | ||
91 | 91 | ||
92 | 92 | func y (t) = ("device_counter_" + t) | |
93 | 93 | ||
94 | 94 | ||
95 | 95 | func z (t) = q(x(t)) | |
96 | 96 | ||
97 | 97 | ||
98 | 98 | func A (t) = m(y(t)) | |
99 | 99 | ||
100 | 100 | ||
101 | 101 | func B (C) = ("key_" + C) | |
102 | 102 | ||
103 | 103 | ||
104 | 104 | func D (C) = q(B(C)) | |
105 | 105 | ||
106 | 106 | ||
107 | 107 | func E (F,n) = { | |
108 | 108 | let G = B(n) | |
109 | 109 | let H = s(F, G) | |
110 | 110 | if ((H != a)) | |
111 | 111 | then false | |
112 | 112 | else true | |
113 | 113 | } | |
114 | 114 | ||
115 | 115 | ||
116 | 116 | func I (n) = { | |
117 | 117 | let F = split(n.description, "_")[k] | |
118 | 118 | let o = addressFromString(F) | |
119 | 119 | if ($isInstanceOf(o, "Address")) | |
120 | 120 | then { | |
121 | 121 | let J = o | |
122 | 122 | J | |
123 | 123 | } | |
124 | 124 | else throw("Not a device key") | |
125 | 125 | } | |
126 | 126 | ||
127 | 127 | ||
128 | 128 | func K (L) = { | |
129 | 129 | let o = assetInfo(L) | |
130 | 130 | if ($isInstanceOf(o, "Asset")) | |
131 | 131 | then { | |
132 | 132 | let J = o | |
133 | 133 | J | |
134 | 134 | } | |
135 | 135 | else throw("Not a key") | |
136 | 136 | } | |
137 | 137 | ||
138 | 138 | ||
139 | 139 | func M (n) = { | |
140 | 140 | let N = parseIntValue(split(n.description, "_")[l]) | |
141 | 141 | (lastBlock.timestamp > N) | |
142 | 142 | } | |
143 | 143 | ||
144 | 144 | ||
145 | 145 | func O (F) = { | |
146 | 146 | let o = getInteger(F, g) | |
147 | 147 | if ($isInstanceOf(o, "Int")) | |
148 | 148 | then { | |
149 | 149 | let J = o | |
150 | 150 | J | |
151 | 151 | } | |
152 | 152 | else throw("Price not specified in device") | |
153 | 153 | } | |
154 | 154 | ||
155 | 155 | ||
156 | 156 | func P (F) = { | |
157 | 157 | let o = getString(F, h) | |
158 | 158 | if ($isInstanceOf(o, "String")) | |
159 | 159 | then { | |
160 | 160 | let J = o | |
161 | 161 | J | |
162 | 162 | } | |
163 | 163 | else throw("Owner not specified in device") | |
164 | 164 | } | |
165 | 165 | ||
166 | 166 | ||
167 | 167 | func Q (R,S,T) = if ((1 > size(R.payments))) | |
168 | 168 | then throw("wrong payments count") | |
169 | 169 | else if ((R.payments[0].assetId != S)) | |
170 | 170 | then throw("wrong asset, supported only xyz") | |
171 | 171 | else if ((R.payments[0].amount != T)) | |
172 | 172 | then throw(("wrong payment value, expected " + toString(T))) | |
173 | 173 | else false | |
174 | 174 | ||
175 | 175 | ||
176 | 176 | func U (V) = { | |
177 | 177 | let o = indexOf(i, V) | |
178 | 178 | if ($isInstanceOf(o, "Int")) | |
179 | 179 | then { | |
180 | 180 | let p = o | |
181 | 181 | false | |
182 | 182 | } | |
183 | 183 | else true | |
184 | 184 | } | |
185 | 185 | ||
186 | 186 | ||
187 | 187 | @Callable(R) | |
188 | 188 | func addDevice (W) = if ((R.caller != this)) | |
189 | 189 | then throw("Not permitted") | |
190 | 190 | else if ((z(W) != a)) | |
191 | 191 | then throw("Device already added") | |
192 | 192 | else [StringEntry(x(W), d), IntegerEntry(y(W), j)] | |
193 | 193 | ||
194 | 194 | ||
195 | 195 | ||
196 | 196 | @Callable(R) | |
197 | 197 | func addUser (W) = if ((R.caller != this)) | |
198 | 198 | then throw("Not permitted") | |
199 | 199 | else [StringEntry(v(W), c)] | |
200 | 200 | ||
201 | 201 | ||
202 | 202 | ||
203 | 203 | @Callable(R) | |
204 | 204 | func removeUser (W) = if ((R.caller != this)) | |
205 | 205 | then throw("Not permitted") | |
206 | 206 | else [DeleteEntry(v(W))] | |
207 | 207 | ||
208 | 208 | ||
209 | 209 | ||
210 | 210 | @Callable(R) | |
211 | 211 | func requestKey (W,X) = { | |
212 | 212 | let Y = lastBlock.timestamp | |
213 | 213 | let Z = (Y + X) | |
214 | 214 | let aa = P(addressFromStringValue(W)) | |
215 | 215 | let ab = O(addressFromStringValue(W)) | |
216 | 216 | let S = u() | |
217 | 217 | if ((toBase58String(R.caller.bytes) != aa)) | |
218 | 218 | then throw("Not permitted") | |
219 | 219 | else if ((x(W) == a)) | |
220 | 220 | then throw("No such device") | |
221 | 221 | else if (Q(R, S, ab)) | |
222 | 222 | then throw("wrong price") | |
223 | 223 | else { | |
224 | 224 | let ac = Issue("DeviceKeyGen", ((W + "_") + toString(Z)), 1, 0, false) | |
225 | 225 | let ad = calculateAssetId(ac) | |
226 | 226 | [ac, ScriptTransfer(R.caller, 1, ad)] | |
227 | 227 | } | |
228 | 228 | } | |
229 | 229 | ||
230 | 230 | ||
231 | 231 | ||
232 | 232 | @Callable(R) | |
233 | 233 | func deviceAction (ae,V) = { | |
234 | 234 | let af = (1 > assetBalance(R.caller, fromBase58String(ae))) | |
235 | 235 | let ag = K(fromBase58String(ae)) | |
236 | 236 | let F = I(ag) | |
237 | 237 | let ah = toBase58String(F.bytes) | |
238 | 238 | if (af) | |
239 | 239 | then throw("Key not owned") | |
240 | 240 | else if ((x(ah) == a)) | |
241 | 241 | then throw("No such device") | |
242 | 242 | else if (E(F, ae)) | |
243 | 243 | then throw("Key not whitelisted") | |
244 | 244 | else if (U(V)) | |
245 | 245 | then throw("Action is not allowed") | |
246 | 246 | else if (M(ag)) | |
247 | 247 | then throw("Key expired") | |
248 | 248 | else [StringEntry(x(ah), V), IntegerEntry(y(ah), (A(ah) + 1))] | |
249 | 249 | } | |
250 | 250 | ||
251 | 251 | ||
252 | 252 | @Verifier(ai) | |
253 | 253 | func aj () = sigVerify(ai.bodyBytes, ai.proofs[0], ai.senderPublicKey) | |
254 | 254 |
github/deemru/w8io/169f3d6 30.68 ms ◑