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