tx · C19BQ5MzffCJG4HmoE3h3waLdqBJooZeSFpj6EJfekKR 3N4Kzbxu521DHPxcgrmZ4XUqN2kF6TqLTzs: -0.01000000 Waves 2023.08.29 08:55 [2731591] smart account 3N4Kzbxu521DHPxcgrmZ4XUqN2kF6TqLTzs > SELF 0.00000000 Waves
{ "type": 13, "id": "C19BQ5MzffCJG4HmoE3h3waLdqBJooZeSFpj6EJfekKR", "fee": 1000000, "feeAssetId": null, "timestamp": 1693288524024, "version": 2, "chainId": 84, "sender": "3N4Kzbxu521DHPxcgrmZ4XUqN2kF6TqLTzs", "senderPublicKey": "8yQuxvQ2qLzXJrgbKZHbsfnNNjuU5wfHheyVujdALGsF", "proofs": [ "gQTUNLj33odXVssQheRfwDJAUCA6xof4B8Q7h6Vo62Je1G9hga2RdTtB5ju88tcvSzZPXcdHPc1MqVEyi16QH8G" ], "script": "base64:BgIOCAISABIAEgQKAggBEgAKAA5sb3R0ZXJ5QXNzZXRJRAkA2QQBAiwzTHoyM21TVXZUMUVzd2NCbjJzVVJZSkcyYXQ4ckc1YUZ1VXJUQXdhUE02UQAKdGlja2V0U2l6ZQCAwtcvARBnZXRJbnRlZ2VyT3JFbHNlAgNrZXkDdmFsCQELdmFsdWVPckVsc2UCCQCfCAEFA2tleQUDdmFsAQJtawEBeAkAuQkCBQF4AgFfARFrZXlBZHJUb3RhbFN0YWtlZAEDYWRyCQECbWsBCQDMCAIFA2FkcgkAzAgCAgt0b3RhbFN0YWtlZAUDbmlsARVrZXlMb3R0ZXJ5VG90YWxTdGFrZWQBC2xvdHRlcnlOYW1lCQECbWsBCQDMCAIFC2xvdHRlcnlOYW1lCQDMCAICEmxvdHRlcnlUb3RhbFN0YWtlZAUDbmlsARhrZXlBZHJMb3R0ZXJ5VG90YWxTdGFrZWQCC2xvdHRlcnlOYW1lA2FkcgkBAm1rAQkAzAgCBQtsb3R0ZXJ5TmFtZQkAzAgCBQNhZHIJAMwIAgILdG90YWxTdGFrZWQFA25pbAEVa2V5TG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ckVudHJ5AgIDaW50AAEJAMwIAgkBC1N0cmluZ0VudHJ5AgIDc3RyAgAJAMwIAgkBC0RlbGV0ZUVudHJ5AQIDc3RyCQDMCAIFBWFzc2V0CQDMCAIJAQdSZWlzc3VlAwUHYXNzZXRJZAABBwkAzAgCCQEEQnVybgIFB2Fzc2V0SWQAAQkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCAUBaQZjYWxsZXIAAQUHYXNzZXRJZAUDbmlsAQJ0eAEGdmVyaWZ5AAkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleT4s2Eg=", "height": 2731591, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: G148PL3j2GbrSs6go1b4RZfbopEtcDCx9D7KoBVppm65 Next: BvGb3AiKngy5DaVxLBf6WFEVvNCQ5xoeHGKsuHZm3qnQ Diff:
Old | New | Differences | |
---|---|---|---|
5 | 5 | ||
6 | 6 | let b = 100000000 | |
7 | 7 | ||
8 | - | func c (d) = | |
8 | + | func c (d,e) = valueOrElse(getInteger(d), e) | |
9 | 9 | ||
10 | 10 | ||
11 | - | func | |
11 | + | func f (g) = makeString(g, "_") | |
12 | 12 | ||
13 | 13 | ||
14 | - | func | |
14 | + | func h (i) = f([i, "totalStaked"]) | |
15 | 15 | ||
16 | 16 | ||
17 | - | @Callable(h) | |
18 | - | func stake () = if ((valueOrElse(getBoolean(this, "lotteryIsStarted"), false) != true)) | |
19 | - | then throw("Lottery has not started yet") | |
17 | + | func j (k) = f([k, "lotteryTotalStaked"]) | |
18 | + | ||
19 | + | ||
20 | + | func l (k,i) = f([k, i, "totalStaked"]) | |
21 | + | ||
22 | + | ||
23 | + | func m (k) = f([k, "lotteryFinalHeight"]) | |
24 | + | ||
25 | + | ||
26 | + | func n () = getStringValue("currentLotteryName") | |
27 | + | ||
28 | + | ||
29 | + | func o () = if ((valueOrElse(getBoolean("lotteryIsStarted"), false) != true)) | |
30 | + | then false | |
20 | 31 | else { | |
21 | - | let i = e("currentLotteryName") | |
22 | - | let j = g(c([i, "lotteryFinalHeight"])) | |
23 | - | if (((height - 1) >= j)) | |
24 | - | then throw("Lottery has not started yet") | |
25 | - | else if ((size(h.payments) == 0)) | |
32 | + | let k = n() | |
33 | + | k | |
34 | + | } | |
35 | + | ||
36 | + | ||
37 | + | @Callable(p) | |
38 | + | func stake () = if ((valueOrElse(getBoolean("lotteryIsStarted"), false) != true)) | |
39 | + | then throw("Lottery not active") | |
40 | + | else { | |
41 | + | let k = n() | |
42 | + | let q = getIntegerValue(m(k)) | |
43 | + | if (((height - 1) >= q)) | |
44 | + | then throw("Lottery not active") | |
45 | + | else if ((size(p.payments) == 0)) | |
26 | 46 | then throw("No payment added") | |
27 | - | else if ((size( | |
47 | + | else if ((size(p.payments) != 1)) | |
28 | 48 | then throw("Too many payments added") | |
29 | - | else if (( | |
49 | + | else if ((p.payments[0].assetId != a)) | |
30 | 50 | then throw("Wrong payment assetId") | |
31 | 51 | else { | |
32 | - | let | |
33 | - | let | |
34 | - | if (( | |
52 | + | let r = p.payments[0].amount | |
53 | + | let s = (r / b) | |
54 | + | if ((s == 0)) | |
35 | 55 | then throw("Not enough to buy at least one ticket") | |
36 | 56 | else { | |
37 | - | let m = c([i, "pointer"]) | |
38 | - | [ScriptTransfer(h.caller, (k - (l * b)), a)] | |
57 | + | let t = toString(p.caller) | |
58 | + | let u = j(k) | |
59 | + | let v = getIntegerValue(u) | |
60 | + | let w = f([k, toString(v), toString(((v + s) - 1)), "Owner"]) | |
61 | + | let x = h(t) | |
62 | + | let y = c(x, 0) | |
63 | + | let z = l(k, t) | |
64 | + | let A = c(z, 0) | |
65 | + | [ScriptTransfer(p.caller, (r - (s * b)), a), IntegerEntry(u, (v + s)), StringEntry(w, t), IntegerEntry(x, (y + s)), IntegerEntry(z, (A + s))] | |
39 | 66 | } | |
40 | 67 | } | |
41 | 68 | } | |
42 | 69 | ||
43 | 70 | ||
44 | 71 | ||
45 | - | @Callable(h) | |
46 | - | func initLottery (i,j) = if ((h.caller != this)) | |
47 | - | then throw("admin only") | |
48 | - | else [BooleanEntry("lotteryIsStarted", true), StringEntry("currentLotteryName", i), IntegerEntry(c([i, "lotteryFinalHeight"]), j), IntegerEntry(c([i, "pointer"]), 0)] | |
72 | + | @Callable(p) | |
73 | + | func claim () = { | |
74 | + | let k = o() | |
75 | + | let B = if ((k == false)) | |
76 | + | then 1 | |
77 | + | else 0 | |
78 | + | [IntegerEntry("temp", B)] | |
79 | + | } | |
49 | 80 | ||
50 | 81 | ||
51 | 82 | ||
52 | - | @Callable(h) | |
83 | + | @Callable(p) | |
84 | + | func initLottery (k,q) = if ((p.caller != this)) | |
85 | + | then throw("admin only") | |
86 | + | else [BooleanEntry("lotteryIsStarted", true), StringEntry("currentLotteryName", k), IntegerEntry(m(k), q), IntegerEntry(j(k), 0)] | |
87 | + | ||
88 | + | ||
89 | + | ||
90 | + | @Callable(p) | |
53 | 91 | func call () = { | |
54 | - | let | |
55 | - | let | |
56 | - | [BinaryEntry("bin", base58''), BooleanEntry("bool", true), IntegerEntry("int", 1), StringEntry("str", ""), DeleteEntry("str"), | |
92 | + | let C = Issue("Asset", "", 1, 0, true, unit, 0) | |
93 | + | let D = calculateAssetId(C) | |
94 | + | [BinaryEntry("bin", base58''), BooleanEntry("bool", true), IntegerEntry("int", 1), StringEntry("str", ""), DeleteEntry("str"), C, Reissue(D, 1, false), Burn(D, 1), ScriptTransfer(p.caller, 1, D)] | |
57 | 95 | } | |
58 | 96 | ||
59 | 97 | ||
60 | - | @Verifier( | |
61 | - | func | |
98 | + | @Verifier(E) | |
99 | + | func F () = sigVerify(E.bodyBytes, E.proofs[0], E.senderPublicKey) | |
62 | 100 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = fromBase58String("3Lz23mSUvT1EswcBn2sURYJG2at8rG5aFuUrTAwaPM6Q") | |
5 | 5 | ||
6 | 6 | let b = 100000000 | |
7 | 7 | ||
8 | - | func c (d) = | |
8 | + | func c (d,e) = valueOrElse(getInteger(d), e) | |
9 | 9 | ||
10 | 10 | ||
11 | - | func | |
11 | + | func f (g) = makeString(g, "_") | |
12 | 12 | ||
13 | 13 | ||
14 | - | func | |
14 | + | func h (i) = f([i, "totalStaked"]) | |
15 | 15 | ||
16 | 16 | ||
17 | - | @Callable(h) | |
18 | - | func stake () = if ((valueOrElse(getBoolean(this, "lotteryIsStarted"), false) != true)) | |
19 | - | then throw("Lottery has not started yet") | |
17 | + | func j (k) = f([k, "lotteryTotalStaked"]) | |
18 | + | ||
19 | + | ||
20 | + | func l (k,i) = f([k, i, "totalStaked"]) | |
21 | + | ||
22 | + | ||
23 | + | func m (k) = f([k, "lotteryFinalHeight"]) | |
24 | + | ||
25 | + | ||
26 | + | func n () = getStringValue("currentLotteryName") | |
27 | + | ||
28 | + | ||
29 | + | func o () = if ((valueOrElse(getBoolean("lotteryIsStarted"), false) != true)) | |
30 | + | then false | |
20 | 31 | else { | |
21 | - | let i = e("currentLotteryName") | |
22 | - | let j = g(c([i, "lotteryFinalHeight"])) | |
23 | - | if (((height - 1) >= j)) | |
24 | - | then throw("Lottery has not started yet") | |
25 | - | else if ((size(h.payments) == 0)) | |
32 | + | let k = n() | |
33 | + | k | |
34 | + | } | |
35 | + | ||
36 | + | ||
37 | + | @Callable(p) | |
38 | + | func stake () = if ((valueOrElse(getBoolean("lotteryIsStarted"), false) != true)) | |
39 | + | then throw("Lottery not active") | |
40 | + | else { | |
41 | + | let k = n() | |
42 | + | let q = getIntegerValue(m(k)) | |
43 | + | if (((height - 1) >= q)) | |
44 | + | then throw("Lottery not active") | |
45 | + | else if ((size(p.payments) == 0)) | |
26 | 46 | then throw("No payment added") | |
27 | - | else if ((size( | |
47 | + | else if ((size(p.payments) != 1)) | |
28 | 48 | then throw("Too many payments added") | |
29 | - | else if (( | |
49 | + | else if ((p.payments[0].assetId != a)) | |
30 | 50 | then throw("Wrong payment assetId") | |
31 | 51 | else { | |
32 | - | let | |
33 | - | let | |
34 | - | if (( | |
52 | + | let r = p.payments[0].amount | |
53 | + | let s = (r / b) | |
54 | + | if ((s == 0)) | |
35 | 55 | then throw("Not enough to buy at least one ticket") | |
36 | 56 | else { | |
37 | - | let m = c([i, "pointer"]) | |
38 | - | [ScriptTransfer(h.caller, (k - (l * b)), a)] | |
57 | + | let t = toString(p.caller) | |
58 | + | let u = j(k) | |
59 | + | let v = getIntegerValue(u) | |
60 | + | let w = f([k, toString(v), toString(((v + s) - 1)), "Owner"]) | |
61 | + | let x = h(t) | |
62 | + | let y = c(x, 0) | |
63 | + | let z = l(k, t) | |
64 | + | let A = c(z, 0) | |
65 | + | [ScriptTransfer(p.caller, (r - (s * b)), a), IntegerEntry(u, (v + s)), StringEntry(w, t), IntegerEntry(x, (y + s)), IntegerEntry(z, (A + s))] | |
39 | 66 | } | |
40 | 67 | } | |
41 | 68 | } | |
42 | 69 | ||
43 | 70 | ||
44 | 71 | ||
45 | - | @Callable(h) | |
46 | - | func initLottery (i,j) = if ((h.caller != this)) | |
47 | - | then throw("admin only") | |
48 | - | else [BooleanEntry("lotteryIsStarted", true), StringEntry("currentLotteryName", i), IntegerEntry(c([i, "lotteryFinalHeight"]), j), IntegerEntry(c([i, "pointer"]), 0)] | |
72 | + | @Callable(p) | |
73 | + | func claim () = { | |
74 | + | let k = o() | |
75 | + | let B = if ((k == false)) | |
76 | + | then 1 | |
77 | + | else 0 | |
78 | + | [IntegerEntry("temp", B)] | |
79 | + | } | |
49 | 80 | ||
50 | 81 | ||
51 | 82 | ||
52 | - | @Callable(h) | |
83 | + | @Callable(p) | |
84 | + | func initLottery (k,q) = if ((p.caller != this)) | |
85 | + | then throw("admin only") | |
86 | + | else [BooleanEntry("lotteryIsStarted", true), StringEntry("currentLotteryName", k), IntegerEntry(m(k), q), IntegerEntry(j(k), 0)] | |
87 | + | ||
88 | + | ||
89 | + | ||
90 | + | @Callable(p) | |
53 | 91 | func call () = { | |
54 | - | let | |
55 | - | let | |
56 | - | [BinaryEntry("bin", base58''), BooleanEntry("bool", true), IntegerEntry("int", 1), StringEntry("str", ""), DeleteEntry("str"), | |
92 | + | let C = Issue("Asset", "", 1, 0, true, unit, 0) | |
93 | + | let D = calculateAssetId(C) | |
94 | + | [BinaryEntry("bin", base58''), BooleanEntry("bool", true), IntegerEntry("int", 1), StringEntry("str", ""), DeleteEntry("str"), C, Reissue(D, 1, false), Burn(D, 1), ScriptTransfer(p.caller, 1, D)] | |
57 | 95 | } | |
58 | 96 | ||
59 | 97 | ||
60 | - | @Verifier( | |
61 | - | func | |
98 | + | @Verifier(E) | |
99 | + | func F () = sigVerify(E.bodyBytes, E.proofs[0], E.senderPublicKey) | |
62 | 100 |
github/deemru/w8io/169f3d6 35.90 ms ◑