tx · CsmgPkxdWZMtKvGVNTEJpTykPrbJP81GPE9St88paLte 3N4Kzbxu521DHPxcgrmZ4XUqN2kF6TqLTzs: -0.01000000 Waves 2023.09.14 16:53 [2755155] smart account 3N4Kzbxu521DHPxcgrmZ4XUqN2kF6TqLTzs > SELF 0.00000000 Waves
{ "type": 13, "id": "CsmgPkxdWZMtKvGVNTEJpTykPrbJP81GPE9St88paLte", "fee": 1000000, "feeAssetId": null, "timestamp": 1694699616102, "version": 2, "chainId": 84, "sender": "3N4Kzbxu521DHPxcgrmZ4XUqN2kF6TqLTzs", "senderPublicKey": "8yQuxvQ2qLzXJrgbKZHbsfnNNjuU5wfHheyVujdALGsF", "proofs": [ "4E3EyV9T7a1zv3tqWfL4rPKREwhf89R1AMS94Q5PTTEnXYGrB3xNyQ8PRqSmBw5CcV7G9Ax93KAF5akyLxg32poW" ], "script": "base64:BgIMCAISAwoBCBIDCgEIDwECbWsBAXgJALkJAgUBeAIBXwEIa2V5QWxpYXMBBWFsaWFzCQECbWsBCQDMCAICBWFsaWFzCQDMCAIFBWFsaWFzBQNuaWwBDWtleUFkclByb2plY3QBA2FkcgkBAm1rAQkAzAgCAgNhZHIJAMwIAgUDYWRyCQDMCAICB3Byb2plY3QFA25pbAERa2V5UHJvamVjdEVuYWJsZWQBB3Byb2plY3QJAQJtawEJAMwIAgIHcHJvamVjdAkAzAgCBQdwcm9qZWN0CQDMCAICB2VuYWJsZWQFA25pbAESa2V5UHJvamVjdEFkckFkbWluAgdwcm9qZWN0A2FkcgkBAm1rAQkAzAgCAgdwcm9qZWN0CQDMCAIFB3Byb2plY3QJAMwIAgIDYWRyCQDMCAIFA2FkcgkAzAgCAgVhZG1pbgUDbmlsARRrZXlQcm9qZWN0QWRySW52b2tlcgIHcHJvamVjdANhZHIJAQJtawEJAMwIAgIHcHJvamVjdAkAzAgCBQdwcm9qZWN0CQDMCAICA2FkcgkAzAgCBQNhZHIJAMwIAgIHaW52b2tlcgUDbmlsARBnZXRJbnRlZ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cnkCAgNzdHIFB3Rlc3RBZHIFA25pbAECdHgBBnZlcmlmeQAJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXlvZ8Lq", "height": 2755155, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FDMsfhsuZi2tm5SDvhD3tPWmnSNHLM7W1gMnLzV2H53v Next: GEY4LwM1whQmck3dbpWJZyEgZurL8EzbaP5UAwknBhEj Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let a = base58'3Lz23mSUvT1EswcBn2sURYJG2at8rG5aFuUrTAwaPM6Q' | |
5 | - | ||
6 | - | func b (c,d) = valueOrElse(getInteger(c), d) | |
4 | + | func a (b) = makeString(b, "_") | |
7 | 5 | ||
8 | 6 | ||
9 | - | func | |
7 | + | func c (d) = a(["alias", d]) | |
10 | 8 | ||
11 | 9 | ||
12 | - | func f (c) = if (isDefined(getString(c))) | |
10 | + | func e (f) = a(["adr", f, "project"]) | |
11 | + | ||
12 | + | ||
13 | + | func g (h) = a(["project", h, "enabled"]) | |
14 | + | ||
15 | + | ||
16 | + | func i (h,f) = a(["project", h, "adr", f, "admin"]) | |
17 | + | ||
18 | + | ||
19 | + | func j (h,f) = a(["project", h, "adr", f, "invoker"]) | |
20 | + | ||
21 | + | ||
22 | + | func k (l) = valueOrElse(getInteger(l), 0) | |
23 | + | ||
24 | + | ||
25 | + | func m (l) = valueOrElse(getString(l), "") | |
26 | + | ||
27 | + | ||
28 | + | func n (l,o) = valueOrErrorMessage(getString(l), o) | |
29 | + | ||
30 | + | ||
31 | + | func p (f,l,o) = valueOrErrorMessage(getString(f, l), o) | |
32 | + | ||
33 | + | ||
34 | + | func q (l) = valueOrElse(getBoolean(l), false) | |
35 | + | ||
36 | + | ||
37 | + | func r (l) = if (isDefined(getString(l))) | |
13 | 38 | then true | |
14 | 39 | else false | |
15 | 40 | ||
16 | 41 | ||
17 | - | func | |
42 | + | func s () = addressFromStringValue(n(c("oracle"), "Oracle addres not specified")) | |
18 | 43 | ||
19 | 44 | ||
20 | - | func | |
45 | + | func t () = p(s(), e(toString(this)), "Project name not specified") | |
21 | 46 | ||
22 | 47 | ||
23 | - | func | |
48 | + | func u (v) = !(q(i(t(), toString(v.caller)))) | |
24 | 49 | ||
25 | 50 | ||
26 | - | func m (j,l) = g(["lottery", j, "adr", l, "locked"]) | |
27 | - | ||
28 | - | ||
29 | - | func n (j) = g(["lottery", j, "finalHeight"]) | |
30 | - | ||
31 | - | ||
32 | - | func o (j) = g(["lottery", j, "startHeight"]) | |
33 | - | ||
34 | - | ||
35 | - | func p (j,q) = g(["lottery", j, "prize", toString(q), "value"]) | |
36 | - | ||
37 | - | ||
38 | - | func r (j,q) = g(["lottery", j, "prize", toString(q), "threshold"]) | |
39 | - | ||
40 | - | ||
41 | - | func s (j,q) = g(["lottery", j, "prize", toString(q), "random"]) | |
42 | - | ||
43 | - | ||
44 | - | func t (j,q) = g(["lottery", j, "prize", toString(q), "winner"]) | |
45 | - | ||
46 | - | ||
47 | - | func u (j,v,w) = g(["lottery", j, "from", toString(v), "to", toString(w), "owner"]) | |
48 | - | ||
49 | - | ||
50 | - | let x = g(["param", "activeLotteryName"]) | |
51 | - | ||
52 | - | let y = g(["param", "globalTotalStaked"]) | |
53 | - | ||
54 | - | func z () = { | |
55 | - | let j = e(x, "") | |
56 | - | if ((j == "")) | |
57 | - | then "" | |
58 | - | else { | |
59 | - | let A = getIntegerValue(n(j)) | |
60 | - | if ((height >= A)) | |
61 | - | then "" | |
62 | - | else j | |
63 | - | } | |
64 | - | } | |
65 | - | ||
66 | - | ||
67 | - | @Callable(B) | |
68 | - | func stake () = { | |
69 | - | let j = z() | |
70 | - | if ((j == "")) | |
71 | - | then throw("Lottery not active") | |
72 | - | else if ((size(B.payments) == 0)) | |
73 | - | then throw("No payment added. You must attach a payment in Dodllnode tokens") | |
74 | - | else if ((size(B.payments) != 1)) | |
75 | - | then throw("Too many payments added. There must be only one attached payment") | |
76 | - | else if ((B.payments[0].assetId != a)) | |
77 | - | then throw("Wrong payment assetID. You must attach a payment in Dodllnode tokens") | |
78 | - | else { | |
79 | - | let C = B.payments[0].amount | |
80 | - | if ((1 > C)) | |
81 | - | then throw("Not enough payment to purchase even a single ticket.") | |
82 | - | else { | |
83 | - | let D = toString(B.caller) | |
84 | - | let E = i(j) | |
85 | - | let F = b(E, 0) | |
86 | - | let G = k(j, D) | |
87 | - | let H = b(G, 0) | |
88 | - | let I = u(j, F, ((F + C) - 1)) | |
89 | - | [IntegerEntry(E, (F + C)), IntegerEntry(G, (H + C)), StringEntry(I, D)] | |
90 | - | } | |
91 | - | } | |
92 | - | } | |
51 | + | @Callable(v) | |
52 | + | func setOracle (w) = if ((v.caller != this)) | |
53 | + | then throw("Admin only") | |
54 | + | else [StringEntry(c("oracle"), w)] | |
93 | 55 | ||
94 | 56 | ||
95 | 57 | ||
96 | - | @Callable(B) | |
97 | - | func initLottery (j,A) = if ((B.caller != this)) | |
98 | - | then throw("Admin only") | |
99 | - | else [StringEntry(x, j), IntegerEntry(o(j), height), IntegerEntry(n(j), A)] | |
58 | + | @Callable(v) | |
59 | + | func test (x) = [StringEntry("str", x)] | |
100 | 60 | ||
101 | 61 | ||
102 | - | ||
103 | - | @Callable(B) | |
104 | - | func declarePrize (j,J,K,L) = if ((B.caller != this)) | |
105 | - | then throw("Admin only") | |
106 | - | else [IntegerEntry(r(j, J), K), StringEntry(p(j, J), L)] | |
107 | - | ||
108 | - | ||
109 | - | ||
110 | - | @Callable(B) | |
111 | - | func finalaizePrizeRandom (j,J) = if ((B.caller != this)) | |
112 | - | then throw("Admin only") | |
113 | - | else { | |
114 | - | let A = getIntegerValue(n(j)) | |
115 | - | if (((A + 1) > height)) | |
116 | - | then throw("Lottery is not over yet") | |
117 | - | else { | |
118 | - | let M = valueOrErrorMessage(getString(p(j, J)), "Prize does not exist") | |
119 | - | let N = s(j, J) | |
120 | - | if (f(N)) | |
121 | - | then throw("The prize random has already been finalaized") | |
122 | - | else { | |
123 | - | let O = value(blockInfoByHeight(A)) | |
124 | - | let P = value(blockInfoByHeight((A + 1))) | |
125 | - | let Q = toBigInt(sha256((((base58'2WWKxchwx7zBB' + toBytes(J)) + value(O.vrf)) + value(P.vrf)))) | |
126 | - | let R = if ((toBigInt(0) > Q)) | |
127 | - | then -(Q) | |
128 | - | else Q | |
129 | - | [StringEntry(N, toString(R))] | |
130 | - | } | |
131 | - | } | |
132 | - | } | |
133 | - | ||
134 | - | ||
135 | - | ||
136 | - | @Callable(B) | |
137 | - | func finalaizePrizeWinner (j,J,S) = if ((B.caller != this)) | |
138 | - | then throw("Admin only") | |
139 | - | else { | |
140 | - | let T = t(j, J) | |
141 | - | if (f(T)) | |
142 | - | then throw("The prize winner has already been finalaized") | |
143 | - | else { | |
144 | - | let G = k(j, S) | |
145 | - | let H = b(G, 0) | |
146 | - | let U = m(j, S) | |
147 | - | let V = b(U, 0) | |
148 | - | [IntegerEntry(G, 0), IntegerEntry(U, (V + H)), StringEntry(T, S)] | |
149 | - | } | |
150 | - | } | |
151 | - | ||
152 | - | ||
153 | - | @Verifier(W) | |
154 | - | func X () = sigVerify(W.bodyBytes, W.proofs[0], W.senderPublicKey) | |
62 | + | @Verifier(y) | |
63 | + | func z () = sigVerify(y.bodyBytes, y.proofs[0], y.senderPublicKey) | |
155 | 64 |
github/deemru/w8io/026f985 37.11 ms ◑