1 | | - | {-# STDLIB_VERSION 6 #-} |
---|
2 | | - | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | | - | {-# CONTENT_TYPE DAPP #-} |
---|
4 | | - | let a = "__" |
---|
5 | | - | |
---|
6 | | - | func b () = makeString(["%s", "wxAssetId"], a) |
---|
7 | | - | |
---|
8 | | - | |
---|
9 | | - | let c = makeString(["%s", "backendPublicKey"], a) |
---|
10 | | - | |
---|
11 | | - | func d (e,f,g) = makeString(["%s%s%s%s", "existsReferrerToReferral", e, f, g], a) |
---|
12 | | - | |
---|
13 | | - | |
---|
14 | | - | func h (e,i) = makeString(["%s%s%s", "claimedReferrer", e, i], a) |
---|
15 | | - | |
---|
16 | | - | |
---|
17 | | - | func j (e,i) = makeString(["%s%s%s", "claimedReferral", e, i], a) |
---|
18 | | - | |
---|
19 | | - | |
---|
20 | | - | func k (e,i) = makeString(["%s%s%s", "unclaimedReferrer", e, i], a) |
---|
21 | | - | |
---|
22 | | - | |
---|
23 | | - | func l (e,i) = makeString(["%s%s%s", "unclaimedReferral", e, i], a) |
---|
24 | | - | |
---|
25 | | - | |
---|
26 | | - | func m (e,g) = makeString(["%s%s%s", "referrer", e, g], a) |
---|
27 | | - | |
---|
28 | | - | |
---|
29 | | - | func n (e) = makeString(["%s%s", "programName", e], a) |
---|
30 | | - | |
---|
31 | | - | |
---|
32 | | - | func o (e,f) = makeString(["%s%s%s", "totalReferralCount", e, f], a) |
---|
33 | | - | |
---|
34 | | - | |
---|
35 | | - | func p (e,f) = makeString(["%s%s%s", "activeReferralCount", e, f], a) |
---|
36 | | - | |
---|
37 | | - | |
---|
38 | | - | func q (e,g) = makeString(["%s%s%s", "activeReferral", e, g], a) |
---|
39 | | - | |
---|
40 | | - | |
---|
41 | | - | func r (s) = makeString(["%s%s", "claimedTotalAddress", s], a) |
---|
42 | | - | |
---|
43 | | - | |
---|
44 | | - | func t (s) = makeString(["%s%s", "unclaimedTotalAddress", s], a) |
---|
45 | | - | |
---|
46 | | - | |
---|
47 | | - | func u (e) = makeString(["%s%s", "claimedTotal", e], a) |
---|
48 | | - | |
---|
49 | | - | |
---|
50 | | - | func v (e) = makeString(["%s%s", "rewardsTotal", e], a) |
---|
51 | | - | |
---|
52 | | - | |
---|
53 | | - | func w (e) = makeString(["%s%s", "rewardAssetId", e], a) |
---|
54 | | - | |
---|
55 | | - | |
---|
56 | | - | func x (e) = makeString(["%s%s", "treasuryContract", e], a) |
---|
57 | | - | |
---|
58 | | - | |
---|
59 | | - | func y (e) = makeString(["%s%s", "implementationContract", e], a) |
---|
60 | | - | |
---|
61 | | - | |
---|
62 | | - | func z (s) = makeString(["%s%s", "allReferralPrograms", s], a) |
---|
63 | | - | |
---|
64 | | - | |
---|
65 | | - | func A () = "%s__managerPublicKey" |
---|
66 | | - | |
---|
67 | | - | |
---|
68 | | - | func B () = "%s__pendingManagerPublicKey" |
---|
69 | | - | |
---|
70 | | - | |
---|
71 | | - | func C (e,D,E,F) = makeString(["%s%s%s%s%s", "history", F, e, D, E], a) |
---|
72 | | - | |
---|
73 | | - | |
---|
74 | | - | func G (H) = makeString(["%d%d%d", toString(lastBlock.height), toString(lastBlock.timestamp), toString(H)], a) |
---|
75 | | - | |
---|
76 | | - | |
---|
77 | | - | func I (J) = throw(makeString(["referral.ride:", J], " ")) |
---|
78 | | - | |
---|
79 | | - | |
---|
80 | | - | func K () = { |
---|
81 | | - | let L = getString(A()) |
---|
82 | | - | if ($isInstanceOf(L, "String")) |
---|
83 | | - | then { |
---|
84 | | - | let M = L |
---|
85 | | - | fromBase58String(M) |
---|
86 | | - | } |
---|
87 | | - | else if ($isInstanceOf(L, "Unit")) |
---|
88 | | - | then unit |
---|
89 | | - | else throw("Match error") |
---|
90 | | - | } |
---|
91 | | - | |
---|
92 | | - | |
---|
93 | | - | func N () = { |
---|
94 | | - | let L = getString(B()) |
---|
95 | | - | if ($isInstanceOf(L, "String")) |
---|
96 | | - | then { |
---|
97 | | - | let M = L |
---|
98 | | - | fromBase58String(M) |
---|
99 | | - | } |
---|
100 | | - | else if ($isInstanceOf(L, "Unit")) |
---|
101 | | - | then unit |
---|
102 | | - | else throw("Match error") |
---|
103 | | - | } |
---|
104 | | - | |
---|
105 | | - | |
---|
106 | | - | func O (P) = { |
---|
107 | | - | let Q = I("permission denied") |
---|
108 | | - | let L = K() |
---|
109 | | - | if ($isInstanceOf(L, "ByteVector")) |
---|
110 | | - | then { |
---|
111 | | - | let R = L |
---|
112 | | - | if ((P.callerPublicKey == R)) |
---|
113 | | - | then true |
---|
114 | | - | else Q |
---|
115 | | - | } |
---|
116 | | - | else if ($isInstanceOf(L, "Unit")) |
---|
117 | | - | then if ((P.caller == this)) |
---|
118 | | - | then true |
---|
119 | | - | else Q |
---|
120 | | - | else throw("Match error") |
---|
121 | | - | } |
---|
122 | | - | |
---|
123 | | - | |
---|
124 | | - | func S (s,e) = { |
---|
125 | | - | let T = valueOrElse(getString(z(s)), "") |
---|
126 | | - | let U = if (contains(T, e)) |
---|
127 | | - | then nil |
---|
128 | | - | else { |
---|
129 | | - | let V = if ((T == "")) |
---|
130 | | - | then e |
---|
131 | | - | else makeString([T, e], a) |
---|
132 | | - | [StringEntry(z(s), V)] |
---|
133 | | - | } |
---|
134 | | - | U |
---|
135 | | - | } |
---|
136 | | - | |
---|
137 | | - | |
---|
138 | | - | @Callable(P) |
---|
139 | | - | func claimInternal (e,i,W) = { |
---|
140 | | - | let X = if (valueOrElse(getBoolean(n(e)), false)) |
---|
141 | | - | then true |
---|
142 | | - | else I("program does not exist") |
---|
143 | | - | if ((X == X)) |
---|
144 | | - | then { |
---|
145 | | - | let Y = if (W) |
---|
146 | | - | then $Tuple5(valueOrElse(getInteger(j(e, i)), 0), valueOrElse(getInteger(l(e, i)), 0), j(e, i), l(e, i), C(e, i, toBase58String(P.transactionId), "claimReferral")) |
---|
147 | | - | else $Tuple5(valueOrElse(getInteger(h(e, i)), 0), valueOrElse(getInteger(k(e, i)), 0), h(e, i), k(e, i), C(e, i, toBase58String(P.transactionId), "claimReferrer")) |
---|
148 | | - | let Z = Y._1 |
---|
149 | | - | let aa = Y._2 |
---|
150 | | - | let ab = Y._3 |
---|
151 | | - | let ac = Y._4 |
---|
152 | | - | let ad = Y._5 |
---|
153 | | - | let ae = valueOrElse(getInteger(u(e)), 0) |
---|
154 | | - | let af = value(addressFromString(value(getString(x(e))))) |
---|
155 | | - | let ag = fromBase58String(value(getString(w(e)))) |
---|
156 | | - | let ah = valueOrElse(getInteger(r(i)), 0) |
---|
157 | | - | let ai = valueOrElse(getInteger(t(i)), 0) |
---|
158 | | - | if (if (W) |
---|
159 | | - | then (aa == 0) |
---|
160 | | - | else false) |
---|
161 | | - | then $Tuple2(nil, 0) |
---|
162 | | - | else { |
---|
163 | | - | let aj = if ((aa > 0)) |
---|
164 | | - | then true |
---|
165 | | - | else I("nothing to claim") |
---|
166 | | - | if ((aj == aj)) |
---|
167 | | - | then { |
---|
168 | | - | let ak = (Z + aa) |
---|
169 | | - | let al = (ae + aa) |
---|
170 | | - | let am = (ah + aa) |
---|
171 | | - | let an = (ai - aa) |
---|
172 | | - | let ao = value(assetBalance(this, ag)) |
---|
173 | | - | if ((ao == ao)) |
---|
174 | | - | then { |
---|
175 | | - | let ap = invoke(af, "withdrawReferralReward", [aa], nil) |
---|
176 | | - | if ((ap == ap)) |
---|
177 | | - | then { |
---|
178 | | - | let aq = value(assetBalance(this, ag)) |
---|
179 | | - | if ((aq == aq)) |
---|
180 | | - | then { |
---|
181 | | - | let ar = (aq - ao) |
---|
182 | | - | if ((ar == ar)) |
---|
183 | | - | then { |
---|
184 | | - | let as = if ((ar == aa)) |
---|
185 | | - | then true |
---|
186 | | - | else I("insufficient balance on referral contract") |
---|
187 | | - | if ((as == as)) |
---|
188 | | - | then $Tuple2([IntegerEntry(ab, ak), IntegerEntry(ac, 0), IntegerEntry(u(e), al), IntegerEntry(r(i), am), IntegerEntry(t(i), an), ScriptTransfer(addressFromStringValue(i), aa, ag), StringEntry(ad, G(aa))], aa) |
---|
189 | | - | else throw("Strict value is not equal to itself.") |
---|
190 | | - | } |
---|
191 | | - | else throw("Strict value is not equal to itself.") |
---|
192 | | - | } |
---|
193 | | - | else throw("Strict value is not equal to itself.") |
---|
194 | | - | } |
---|
195 | | - | else throw("Strict value is not equal to itself.") |
---|
196 | | - | } |
---|
197 | | - | else throw("Strict value is not equal to itself.") |
---|
198 | | - | } |
---|
199 | | - | else throw("Strict value is not equal to itself.") |
---|
200 | | - | } |
---|
201 | | - | } |
---|
202 | | - | else throw("Strict value is not equal to itself.") |
---|
203 | | - | } |
---|
204 | | - | |
---|
205 | | - | |
---|
206 | | - | |
---|
207 | | - | @Callable(P) |
---|
208 | | - | func claimBulkInternal (at,au,av) = { |
---|
209 | | - | let aw = if ((P.caller == this)) |
---|
210 | | - | then true |
---|
211 | | - | else I("permission denied") |
---|
212 | | - | if ((aw == aw)) |
---|
213 | | - | then if ((av == size(au))) |
---|
214 | | - | then nil |
---|
215 | | - | else { |
---|
216 | | - | let e = au[av] |
---|
217 | | - | let ax = valueOrElse(getInteger(k(e, at)), 0) |
---|
218 | | - | let ad = C(e, at, toBase58String(P.transactionId), "claimBulk") |
---|
219 | | - | let ay = invoke(this, "claimBulkInternal", [at, au, (av + 1)], nil) |
---|
220 | | - | if ((ay == ay)) |
---|
221 | | - | then { |
---|
222 | | - | let az = valueOrElse(getInteger(k(e, at)), 0) |
---|
223 | | - | let aA = if ((az > 0)) |
---|
224 | | - | then invoke(this, "claimInternal", [e, at, false], nil) |
---|
225 | | - | else unit |
---|
226 | | - | if ((aA == aA)) |
---|
227 | | - | then $Tuple2(nil, [ay, aA]) |
---|
228 | | - | else throw("Strict value is not equal to itself.") |
---|
229 | | - | } |
---|
230 | | - | else throw("Strict value is not equal to itself.") |
---|
231 | | - | } |
---|
232 | | - | else throw("Strict value is not equal to itself.") |
---|
233 | | - | } |
---|
234 | | - | |
---|
235 | | - | |
---|
236 | | - | |
---|
237 | | - | @Callable(P) |
---|
238 | | - | func incUnclaimedWithPaymentInternal (aB,e,aC,av,aD) = { |
---|
239 | | - | let aw = if ((P.caller == this)) |
---|
240 | | - | then true |
---|
241 | | - | else I("permission denied") |
---|
242 | | - | if ((aw == aw)) |
---|
243 | | - | then { |
---|
244 | | - | let aE = (size(aB) == size(aC)) |
---|
245 | | - | let aF = if (aE) |
---|
246 | | - | then true |
---|
247 | | - | else I("lists in args must be same size") |
---|
248 | | - | if ((aF == aF)) |
---|
249 | | - | then if ((av == size(aB))) |
---|
250 | | - | then $Tuple2(nil, aD) |
---|
251 | | - | else { |
---|
252 | | - | let f = aC[av] |
---|
253 | | - | let ai = valueOrElse(getInteger(t(f)), 0) |
---|
254 | | - | let aG = valueOrElse(getInteger(k(e, f)), 0) |
---|
255 | | - | let aH = valueOrElse(getInteger(v(e)), 0) |
---|
256 | | - | let an = (ai + aB[av]) |
---|
257 | | - | let aI = (aG + aB[av]) |
---|
258 | | - | let aJ = (aD + aB[av]) |
---|
259 | | - | let aK = invoke(this, "incUnclaimedWithPaymentInternal", [aB, e, aC, (av + 1), aJ], nil) |
---|
260 | | - | if ((aK == aK)) |
---|
261 | | - | then { |
---|
262 | | - | let aL = S(f, e) |
---|
263 | | - | $Tuple2(([IntegerEntry(t(f), an), IntegerEntry(k(e, f), aI), IntegerEntry(v(e), (aH + aB[av]))] ++ aL), aK) |
---|
264 | | - | } |
---|
265 | | - | else throw("Strict value is not equal to itself.") |
---|
266 | | - | } |
---|
267 | | - | else throw("Strict value is not equal to itself.") |
---|
268 | | - | } |
---|
269 | | - | else throw("Strict value is not equal to itself.") |
---|
270 | | - | } |
---|
271 | | - | |
---|
272 | | - | |
---|
273 | | - | |
---|
274 | | - | @Callable(P) |
---|
275 | | - | func createReferralProgram (e,af,aM,ag) = { |
---|
276 | | - | let aw = O(P) |
---|
277 | | - | if ((aw == aw)) |
---|
278 | | - | then { |
---|
279 | | - | let aN = if ((getBoolean(n(e)) == unit)) |
---|
280 | | - | then true |
---|
281 | | - | else I("program name already exists") |
---|
282 | | - | if ((aN == aN)) |
---|
283 | | - | then { |
---|
284 | | - | let aO = if (!(contains(e, a))) |
---|
285 | | - | then !(contains(e, " ")) |
---|
286 | | - | else false |
---|
287 | | - | let X = if (aO) |
---|
288 | | - | then true |
---|
289 | | - | else I("invalid program name") |
---|
290 | | - | if ((X == X)) |
---|
291 | | - | then { |
---|
292 | | - | let aP = if ((assetInfo(fromBase58String(ag)) != unit)) |
---|
293 | | - | then true |
---|
294 | | - | else I("invalid reward asset id") |
---|
295 | | - | if ((aP == aP)) |
---|
296 | | - | then $Tuple2([BooleanEntry(n(e), true), StringEntry(x(e), af), StringEntry(y(e), aM), StringEntry(w(e), ag), IntegerEntry(v(e), 0)], unit) |
---|
297 | | - | else throw("Strict value is not equal to itself.") |
---|
298 | | - | } |
---|
299 | | - | else throw("Strict value is not equal to itself.") |
---|
300 | | - | } |
---|
301 | | - | else throw("Strict value is not equal to itself.") |
---|
302 | | - | } |
---|
303 | | - | else throw("Strict value is not equal to itself.") |
---|
304 | | - | } |
---|
305 | | - | |
---|
306 | | - | |
---|
307 | | - | |
---|
308 | | - | @Callable(P) |
---|
309 | | - | func createPair (e,f,g,aQ) = { |
---|
310 | | - | let X = if (valueOrElse(getBoolean(n(e)), false)) |
---|
311 | | - | then true |
---|
312 | | - | else I("program does not exist") |
---|
313 | | - | if ((X == X)) |
---|
314 | | - | then { |
---|
315 | | - | let aR = if ((getBoolean(d(e, f, g)) == unit)) |
---|
316 | | - | then true |
---|
317 | | - | else I("pair already exists") |
---|
318 | | - | if ((aR == aR)) |
---|
319 | | - | then { |
---|
320 | | - | let aS = if ((f != g)) |
---|
321 | | - | then true |
---|
322 | | - | else I("cannot refer to self") |
---|
323 | | - | if ((aS == aS)) |
---|
324 | | - | then { |
---|
325 | | - | let aT = toBytes(makeString([e, f, g], ":")) |
---|
326 | | - | let aU = fromBase58String(value(getString(c))) |
---|
327 | | - | let aV = if (sigVerify(aT, aQ, aU)) |
---|
328 | | - | then true |
---|
329 | | - | else I("bad signature") |
---|
330 | | - | if ((aV == aV)) |
---|
331 | | - | then { |
---|
332 | | - | let aW = valueOrElse(getInteger(o(e, f)), 0) |
---|
333 | | - | let aX = (aW + 1) |
---|
334 | | - | let aL = S(f, e) |
---|
335 | | - | let U = S(g, e) |
---|
336 | | - | $Tuple2((([BooleanEntry(d(e, f, g), true), IntegerEntry(o(e, f), aX), StringEntry(m(e, g), f)] ++ aL) ++ U), unit) |
---|
337 | | - | } |
---|
338 | | - | else throw("Strict value is not equal to itself.") |
---|
339 | | - | } |
---|
340 | | - | else throw("Strict value is not equal to itself.") |
---|
341 | | - | } |
---|
342 | | - | else throw("Strict value is not equal to itself.") |
---|
343 | | - | } |
---|
344 | | - | else throw("Strict value is not equal to itself.") |
---|
345 | | - | } |
---|
346 | | - | |
---|
347 | | - | |
---|
348 | | - | |
---|
349 | | - | @Callable(P) |
---|
350 | | - | func updateReferralActivity (e,g,aY) = { |
---|
351 | | - | let aM = value(getString(y(e))) |
---|
352 | | - | let aZ = (getBoolean(q(e, g)) != unit) |
---|
353 | | - | let f = value(getString(m(e, g))) |
---|
354 | | - | let aw = if ((toString(P.caller) == aM)) |
---|
355 | | - | then true |
---|
356 | | - | else I("permission denied") |
---|
357 | | - | if ((aw == aw)) |
---|
358 | | - | then { |
---|
359 | | - | let ba = if ((aZ == aY)) |
---|
360 | | - | then $Tuple2(nil, unit) |
---|
361 | | - | else { |
---|
362 | | - | let ba = if ((aY == true)) |
---|
363 | | - | then { |
---|
364 | | - | let bb = (valueOrElse(getInteger(p(e, f)), 0) + 1) |
---|
365 | | - | $Tuple2([BooleanEntry(q(e, g), true), IntegerEntry(p(e, f), bb)], unit) |
---|
366 | | - | } |
---|
367 | | - | else { |
---|
368 | | - | let bb = (valueOrElse(getInteger(p(e, f)), 0) - 1) |
---|
369 | | - | $Tuple2([DeleteEntry(q(e, g)), IntegerEntry(p(e, f), bb)], unit) |
---|
370 | | - | } |
---|
371 | | - | ba |
---|
372 | | - | } |
---|
373 | | - | ba |
---|
374 | | - | } |
---|
375 | | - | else throw("Strict value is not equal to itself.") |
---|
376 | | - | } |
---|
377 | | - | |
---|
378 | | - | |
---|
379 | | - | |
---|
380 | | - | @Callable(P) |
---|
381 | | - | func incUnclaimed (e,g,bc,bd) = { |
---|
382 | | - | let aM = value(getString(y(e))) |
---|
383 | | - | let f = value(getString(m(e, g))) |
---|
384 | | - | let aw = if ((toString(P.caller) == aM)) |
---|
385 | | - | then true |
---|
386 | | - | else I("permission denied") |
---|
387 | | - | if ((aw == aw)) |
---|
388 | | - | then { |
---|
389 | | - | let be = if ((e == "wxlock")) |
---|
390 | | - | then true |
---|
391 | | - | else I("invalid program") |
---|
392 | | - | if ((be == be)) |
---|
393 | | - | then { |
---|
394 | | - | let bf = if (contains(valueOrElse(getString(z(f)), ""), e)) |
---|
395 | | - | then true |
---|
396 | | - | else I(((("referrer not in program=" + e) + " addr=") + f)) |
---|
397 | | - | if ((bf == bf)) |
---|
398 | | - | then { |
---|
399 | | - | let bg = if (contains(valueOrElse(getString(z(g)), ""), e)) |
---|
400 | | - | then true |
---|
401 | | - | else I(((("referral not in program=" + e) + " addr=") + g)) |
---|
402 | | - | if ((bg == bg)) |
---|
403 | | - | then { |
---|
404 | | - | let bh = valueOrElse(getInteger(t(f)), 0) |
---|
405 | | - | let aG = valueOrElse(getInteger(k(e, f)), 0) |
---|
406 | | - | let bi = valueOrElse(getInteger(t(g)), 0) |
---|
407 | | - | let bj = valueOrElse(getInteger(l(e, g)), 0) |
---|
408 | | - | let aH = valueOrElse(getInteger(v(e)), 0) |
---|
409 | | - | let bk = (bh + bc) |
---|
410 | | - | let aI = (aG + bc) |
---|
411 | | - | let bl = (bi + bd) |
---|
412 | | - | let bm = (bj + bd) |
---|
413 | | - | $Tuple2([IntegerEntry(t(f), bk), IntegerEntry(t(g), bl), IntegerEntry(k(e, f), aI), IntegerEntry(l(e, g), bm), IntegerEntry(v(e), ((aH + bc) + bd))], unit) |
---|
414 | | - | } |
---|
415 | | - | else throw("Strict value is not equal to itself.") |
---|
416 | | - | } |
---|
417 | | - | else throw("Strict value is not equal to itself.") |
---|
418 | | - | } |
---|
419 | | - | else throw("Strict value is not equal to itself.") |
---|
420 | | - | } |
---|
421 | | - | else throw("Strict value is not equal to itself.") |
---|
422 | | - | } |
---|
423 | | - | |
---|
424 | | - | |
---|
425 | | - | |
---|
426 | | - | @Callable(P) |
---|
427 | | - | func incUnclaimedWithPayment (e,aC) = { |
---|
428 | | - | let be = if ((e == "wxSpotFee")) |
---|
429 | | - | then true |
---|
430 | | - | else I("invalid program") |
---|
431 | | - | if ((be == be)) |
---|
432 | | - | then { |
---|
433 | | - | func bn (bo,bp) = { |
---|
434 | | - | let bq = (toBase58String(value(bp.assetId)) == value(getString(w(e)))) |
---|
435 | | - | let br = if (bq) |
---|
436 | | - | then true |
---|
437 | | - | else I("invalid asset id") |
---|
438 | | - | if ((br == br)) |
---|
439 | | - | then (bo :+ bp.amount) |
---|
440 | | - | else throw("Strict value is not equal to itself.") |
---|
441 | | - | } |
---|
442 | | - | |
---|
443 | | - | let bs = { |
---|
444 | | - | let bt = P.payments |
---|
445 | | - | let bu = size(bt) |
---|
446 | | - | let bv = nil |
---|
447 | | - | func bw (bx,by) = if ((by >= bu)) |
---|
448 | | - | then bx |
---|
449 | | - | else bn(bx, bt[by]) |
---|
450 | | - | |
---|
451 | | - | func bz (bx,by) = if ((by >= bu)) |
---|
452 | | - | then bx |
---|
453 | | - | else throw("List size exceeds 10") |
---|
454 | | - | |
---|
455 | | - | bz(bw(bw(bw(bw(bw(bw(bw(bw(bw(bw(bv, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) |
---|
456 | | - | } |
---|
457 | | - | let aD = { |
---|
458 | | - | let bA = invoke(this, "incUnclaimedWithPaymentInternal", [bs, e, aC, 0, 0], nil) |
---|
459 | | - | if ($isInstanceOf(bA, "Int")) |
---|
460 | | - | then bA |
---|
461 | | - | else throw(($getType(bA) + " couldn't be cast to Int")) |
---|
462 | | - | } |
---|
463 | | - | if ((aD == aD)) |
---|
464 | | - | then { |
---|
465 | | - | let af = addressFromStringValue(value(getString(x(e)))) |
---|
466 | | - | let ag = fromBase58String(value(getString(w(e)))) |
---|
467 | | - | [ScriptTransfer(af, aD, ag)] |
---|
468 | | - | } |
---|
469 | | - | else throw("Strict value is not equal to itself.") |
---|
470 | | - | } |
---|
471 | | - | else throw("Strict value is not equal to itself.") |
---|
472 | | - | } |
---|
473 | | - | |
---|
474 | | - | |
---|
475 | | - | |
---|
476 | | - | @Callable(P) |
---|
477 | | - | func claim (e) = { |
---|
478 | | - | let X = if (valueOrElse(getBoolean(n(e)), false)) |
---|
479 | | - | then true |
---|
480 | | - | else I("program does not exist") |
---|
481 | | - | if ((X == X)) |
---|
482 | | - | then { |
---|
483 | | - | let W = (toString(P.caller) == value(getString(y(e)))) |
---|
484 | | - | let i = if (W) |
---|
485 | | - | then toString(P.originCaller) |
---|
486 | | - | else toString(P.caller) |
---|
487 | | - | let bB = invoke(this, "claimInternal", [e, i, W], nil) |
---|
488 | | - | if ((bB == bB)) |
---|
489 | | - | then $Tuple2(nil, bB) |
---|
490 | | - | else throw("Strict value is not equal to itself.") |
---|
491 | | - | } |
---|
492 | | - | else throw("Strict value is not equal to itself.") |
---|
493 | | - | } |
---|
494 | | - | |
---|
495 | | - | |
---|
496 | | - | |
---|
497 | | - | @Callable(P) |
---|
498 | | - | func claimBulk () = { |
---|
499 | | - | let bC = toString(P.caller) |
---|
500 | | - | let bD = getString(z(toString(P.caller))) |
---|
501 | | - | let bE = if (isDefined(bD)) |
---|
502 | | - | then true |
---|
503 | | - | else I("no referral programs") |
---|
504 | | - | if ((bE == bE)) |
---|
505 | | - | then { |
---|
506 | | - | let bF = split(value(bD), "__") |
---|
507 | | - | let bG = invoke(this, "claimBulkInternal", [bC, bF, 0], nil) |
---|
508 | | - | if ((bG == bG)) |
---|
509 | | - | then $Tuple2(nil, bG) |
---|
510 | | - | else throw("Strict value is not equal to itself.") |
---|
511 | | - | } |
---|
512 | | - | else throw("Strict value is not equal to itself.") |
---|
513 | | - | } |
---|
514 | | - | |
---|
515 | | - | |
---|
516 | | - | |
---|
517 | | - | @Callable(P) |
---|
518 | | - | func claimREADONLY (e,D) = { |
---|
519 | | - | let Z = valueOrElse(getInteger(h(e, D)), 0) |
---|
520 | | - | let aa = valueOrElse(getInteger(k(e, D)), 0) |
---|
521 | | - | $Tuple2(nil, [aa, Z]) |
---|
522 | | - | } |
---|
523 | | - | |
---|
524 | | - | |
---|
525 | | - | |
---|
526 | | - | @Callable(P) |
---|
527 | | - | func claimBulkREADONLY (at) = { |
---|
528 | | - | let ah = valueOrElse(getInteger(r(at)), 0) |
---|
529 | | - | let ai = valueOrElse(getInteger(t(at)), 0) |
---|
530 | | - | $Tuple2(nil, [ai, ah]) |
---|
531 | | - | } |
---|
532 | | - | |
---|
533 | | - | |
---|
534 | | - | |
---|
535 | | - | @Callable(P) |
---|
536 | | - | func setTotalKeys (e,s) = { |
---|
537 | | - | let bH = valueOrElse(getInteger(h(e, s)), 0) |
---|
538 | | - | let bI = valueOrElse(getInteger(j(e, s)), 0) |
---|
539 | | - | let az = valueOrElse(getInteger(k(e, s)), 0) |
---|
540 | | - | let bJ = valueOrElse(getInteger(l(e, s)), 0) |
---|
541 | | - | let ah = (bH + bI) |
---|
542 | | - | let ai = (az + bJ) |
---|
543 | | - | $Tuple2([IntegerEntry(r(s), ah), IntegerEntry(t(s), ai)], unit) |
---|
544 | | - | } |
---|
545 | | - | |
---|
546 | | - | |
---|
547 | | - | |
---|
548 | | - | @Callable(P) |
---|
549 | | - | func setManager (bK) = { |
---|
550 | | - | let aw = O(P) |
---|
551 | | - | if ((aw == aw)) |
---|
552 | | - | then { |
---|
553 | | - | let bL = fromBase58String(bK) |
---|
554 | | - | if ((bL == bL)) |
---|
555 | | - | then [StringEntry(B(), bK)] |
---|
556 | | - | else throw("Strict value is not equal to itself.") |
---|
557 | | - | } |
---|
558 | | - | else throw("Strict value is not equal to itself.") |
---|
559 | | - | } |
---|
560 | | - | |
---|
561 | | - | |
---|
562 | | - | |
---|
563 | | - | @Callable(P) |
---|
564 | | - | func confirmManager () = { |
---|
565 | | - | let bM = N() |
---|
566 | | - | let bN = if (isDefined(bM)) |
---|
567 | | - | then true |
---|
568 | | - | else I("no pending manager") |
---|
569 | | - | if ((bN == bN)) |
---|
570 | | - | then { |
---|
571 | | - | let bO = if ((P.callerPublicKey == value(bM))) |
---|
572 | | - | then true |
---|
573 | | - | else I("you are not pending manager") |
---|
574 | | - | if ((bO == bO)) |
---|
575 | | - | then [StringEntry(A(), toBase58String(value(bM))), DeleteEntry(B())] |
---|
576 | | - | else throw("Strict value is not equal to itself.") |
---|
577 | | - | } |
---|
578 | | - | else throw("Strict value is not equal to itself.") |
---|
579 | | - | } |
---|
580 | | - | |
---|
581 | | - | |
---|
582 | | - | @Verifier(bP) |
---|
583 | | - | func bQ () = { |
---|
584 | | - | let bR = { |
---|
585 | | - | let L = K() |
---|
586 | | - | if ($isInstanceOf(L, "ByteVector")) |
---|
587 | | - | then { |
---|
588 | | - | let R = L |
---|
589 | | - | R |
---|
590 | | - | } |
---|
591 | | - | else if ($isInstanceOf(L, "Unit")) |
---|
592 | | - | then bP.senderPublicKey |
---|
593 | | - | else throw("Match error") |
---|
594 | | - | } |
---|
595 | | - | sigVerify(bP.bodyBytes, bP.proofs[0], bR) |
---|
596 | | - | } |
---|
597 | | - | |
---|
| 1 | + | # no script |
---|