tx · B3LiJpVd2zpdeNcMuYYtDC1Gw7tL6YgReqTqdapNmKs3 3N4Kzbxu521DHPxcgrmZ4XUqN2kF6TqLTzs: -0.01000000 Waves 2023.08.29 11:57 [2731775] smart account 3N4Kzbxu521DHPxcgrmZ4XUqN2kF6TqLTzs > SELF 0.00000000 Waves
{ "type": 13, "id": "B3LiJpVd2zpdeNcMuYYtDC1Gw7tL6YgReqTqdapNmKs3", "fee": 1000000, "feeAssetId": null, "timestamp": 1693299502391, "version": 2, "chainId": 84, "sender": "3N4Kzbxu521DHPxcgrmZ4XUqN2kF6TqLTzs", "senderPublicKey": "8yQuxvQ2qLzXJrgbKZHbsfnNNjuU5wfHheyVujdALGsF", "proofs": [ "Tf9Eo2tiNZtMrhPkYMTMbD3DQeN37Q31GSA2b8CTPMDPDVZtH5ziFC4mCm1SJZjY6WByEn4wa4DTwQ3VBsHoUrs" ], "script": "base64:BgIZCAISABIAEgQKAggBEgUKAwgBCBIECgIIAQ0ADmxvdHRlcnlBc3NldElECQDZBAECLDNMejIzbVNVdlQxRXN3Y0JuMnNVUllKRzJhdDhyRzVhRnVVclRBd2FQTTZRAAp0aWNrZXRTaXplAAEBEGdldEludGVnZXJPckVsc2UCA2tleQN2YWwJAQt2YWx1ZU9yRWxzZQIJAJ8IAQUDa2V5BQN2YWwBD2dldFN0cmluZ09yRWxzZQIDa2V5A3ZhbAkBC3ZhbHVlT3JFbHNlAgkAoggBBQNrZXkFA3ZhbAECbWsBAXgJALkJAgUBeAIBXwERa2V5QWRyVG90YWxTdGFrZWQBA2FkcgkBAm1rAQkAzAgCAgNhZHIJAMwIAgUDYWRyCQDMCAICC3RvdGFsU3Rha2VkBQNuaWwBFWtleUxvdHRlcnlUb3RhbFN0YWtlZAELbG90dGVyeU5hbWUJAQJtawEJAMwIAgIHbG90dGVyeQkAzAgCBQtsb3R0ZXJ5TmFtZQkAzAgCAgt0b3RhbFN0YWtlZAUDbmlsARhrZXlBZHJMb3R0ZXJ5VG90YWxTdGF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AjDLmyViRqxCQw Full:
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 = 1 | |
7 | 7 | ||
8 | 8 | func c (d,e) = valueOrElse(getInteger(d), e) | |
9 | 9 | ||
10 | 10 | ||
11 | 11 | func f (d,e) = valueOrElse(getString(d), e) | |
12 | 12 | ||
13 | 13 | ||
14 | 14 | func g (h) = makeString(h, "_") | |
15 | 15 | ||
16 | 16 | ||
17 | 17 | func i (j) = g(["adr", j, "totalStaked"]) | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func k (l) = g(["lottery", l, "totalStaked"]) | |
21 | 21 | ||
22 | 22 | ||
23 | 23 | func m (l,j) = g(["lottery", l, j, "totalStaked"]) | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | func n (l) = g(["lottery", l, "finalHeight"]) | |
27 | 27 | ||
28 | 28 | ||
29 | 29 | func o (l,p) = g(["lottery", l, "prize", toString(p), "value"]) | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | func q (l,p) = g(["lottery", l, "prize", toString(p), "choice"]) | |
33 | 33 | ||
34 | 34 | ||
35 | 35 | let r = g(["param", "activeLotteryName"]) | |
36 | 36 | ||
37 | 37 | func s () = { | |
38 | 38 | let l = f(r, "") | |
39 | 39 | if ((l == "")) | |
40 | 40 | then "" | |
41 | 41 | else { | |
42 | 42 | let t = getIntegerValue(n(l)) | |
43 | 43 | if (((height - 1) >= t)) | |
44 | 44 | then "" | |
45 | 45 | else l | |
46 | 46 | } | |
47 | 47 | } | |
48 | 48 | ||
49 | 49 | ||
50 | 50 | @Callable(u) | |
51 | 51 | func stake () = { | |
52 | 52 | let l = s() | |
53 | 53 | if ((l == "")) | |
54 | 54 | then throw("Lottery not active") | |
55 | 55 | else if ((size(u.payments) == 0)) | |
56 | 56 | then throw("No payment added") | |
57 | 57 | else if ((size(u.payments) != 1)) | |
58 | 58 | then throw("Too many payments added") | |
59 | 59 | else if ((u.payments[0].assetId != a)) | |
60 | 60 | then throw("Wrong payment assetId") | |
61 | 61 | else { | |
62 | 62 | let v = u.payments[0].amount | |
63 | 63 | let w = (v / b) | |
64 | 64 | if ((w == 0)) | |
65 | 65 | then throw("Not enough to buy at least one ticket") | |
66 | 66 | else { | |
67 | 67 | let x = toString(u.caller) | |
68 | 68 | let y = k(l) | |
69 | 69 | let z = getIntegerValue(y) | |
70 | 70 | let A = g(["owner", l, toString(z), toString(((z + w) - 1))]) | |
71 | 71 | let B = i(x) | |
72 | 72 | let C = c(B, 0) | |
73 | 73 | let D = m(l, x) | |
74 | 74 | let E = c(D, 0) | |
75 | 75 | let F = (v - (w * b)) | |
76 | 76 | [ScriptTransfer(u.caller, F, a), IntegerEntry(y, (z + w)), StringEntry(A, x), IntegerEntry(B, (C + w)), IntegerEntry(D, (E + w))] | |
77 | 77 | } | |
78 | 78 | } | |
79 | 79 | } | |
80 | 80 | ||
81 | 81 | ||
82 | 82 | ||
83 | 83 | @Callable(u) | |
84 | 84 | func claim () = if ((size(u.payments) > 0)) | |
85 | 85 | then throw("No payments needed") | |
86 | 86 | else { | |
87 | 87 | let x = toString(u.caller) | |
88 | 88 | let l = s() | |
89 | 89 | let G = if ((l == "")) | |
90 | 90 | then 0 | |
91 | 91 | else c(m(l, x), 0) | |
92 | 92 | let B = i(x) | |
93 | 93 | let C = c(B, 0) | |
94 | 94 | let H = (C - G) | |
95 | 95 | if ((0 >= H)) | |
96 | 96 | then throw("No assets available for claim") | |
97 | 97 | else [ScriptTransfer(u.caller, H, a), IntegerEntry(B, (C - H))] | |
98 | 98 | } | |
99 | 99 | ||
100 | 100 | ||
101 | 101 | ||
102 | 102 | @Callable(u) | |
103 | 103 | func startLottery (l,t) = if ((u.caller != this)) | |
104 | 104 | then throw("Admin only") | |
105 | 105 | else [StringEntry(r, l), IntegerEntry(n(l), t), IntegerEntry(k(l), 0)] | |
106 | 106 | ||
107 | 107 | ||
108 | 108 | ||
109 | 109 | @Callable(u) | |
110 | 110 | func declarePrize (l,I,J) = if ((u.caller != this)) | |
111 | 111 | then throw("Admin only") | |
112 | 112 | else [StringEntry(o(l, I), J)] | |
113 | 113 | ||
114 | 114 | ||
115 | 115 | ||
116 | 116 | @Callable(u) | |
117 | 117 | func finalaizePrizeChoice (l,I) = if ((u.caller != this)) | |
118 | 118 | then throw("Admin only") | |
119 | 119 | else { | |
120 | 120 | let t = getIntegerValue(n(l)) | |
121 | 121 | if ((t > height)) | |
122 | 122 | then throw("Lottery is not over yet") | |
123 | 123 | else { | |
124 | 124 | let z = getIntegerValue(k(l)) | |
125 | 125 | if ((z == 0)) | |
126 | 126 | then throw("No one entered the lottery") | |
127 | 127 | else { | |
128 | 128 | let K = value(blockInfoByHeight(t)) | |
129 | 129 | let L = sha256((toBytes(I) + value(K.vrf))) | |
130 | 130 | let M = toInt((toBigInt(L) % toBigInt(z))) | |
131 | 131 | [StringEntry("lastHash", toString(toBigInt(L))), IntegerEntry(q(l, I), M)] | |
132 | 132 | } | |
133 | 133 | } | |
134 | 134 | } | |
135 | 135 | ||
136 | 136 | ||
137 | 137 | @Verifier(N) | |
138 | 138 | func O () = sigVerify(N.bodyBytes, N.proofs[0], N.senderPublicKey) | |
139 | 139 |
github/deemru/w8io/169f3d6 50.21 ms ◑