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