tx · 7nv2AegxVknj7GqRr3cJvx42qp2FUKfwsmoedpSCGPFE 3N4Kzbxu521DHPxcgrmZ4XUqN2kF6TqLTzs: -0.01000000 Waves 2023.08.29 12:11 [2731791] smart account 3N4Kzbxu521DHPxcgrmZ4XUqN2kF6TqLTzs > SELF 0.00000000 Waves
{ "type": 13, "id": "7nv2AegxVknj7GqRr3cJvx42qp2FUKfwsmoedpSCGPFE", "fee": 1000000, "feeAssetId": null, "timestamp": 1693300327307, "version": 2, "chainId": 84, "sender": "3N4Kzbxu521DHPxcgrmZ4XUqN2kF6TqLTzs", "senderPublicKey": "8yQuxvQ2qLzXJrgbKZHbsfnNNjuU5wfHheyVujdALGsF", "proofs": [ "54vK747Gwf8jz6gERpjAgfYKA3kMAW2DPGMCd4fo2a5nJ2CrE1zgmHu92wgK3xeHpe8BDzR6BEKSLdizaj3cMExf" ], "script": "base64:BgIZCAISABIAEgQKAggBEgUKAwgBCBIECgIIAQ0ADmxvdHRlcnlBc3NldElECQDZBAECLDNMejIzbVNVdlQxRXN3Y0JuMnNVUllKRzJhdDhyRzVhRnVVclRBd2FQTTZRAAp0aWNrZXRTaXplAAEBEGdldEludGVnZXJPckVsc2UCA2tleQN2YWwJAQt2YWx1ZU9yRWxzZQIJAJ8IAQUDa2V5BQN2YWwBD2dldFN0cmluZ09yRWxzZQIDa2V5A3ZhbAkBC3ZhbHVlT3JFbHNlAgkAoggBBQNrZXkFA3ZhbAECbWsBAXgJALkJAgUBeAIBXwERa2V5QWRyVG90YWxTdGFrZWQBA2FkcgkBAm1rAQkAzAgCAgNhZHIJAMwIAgUDYWRyCQDMCAICC3RvdGFsU3Rha2VkBQNuaWwBFWtleUxvdHRlcnlUb3RhbFN0YWtlZAELbG90dGVyeU5hbWUJAQJtawEJAMwIAgIHbG90dGVyeQkAzAgCBQtsb3R0ZXJ5TmFtZQkAzAgCAgt0b3RhbFN0YWtlZAUDbmlsARhrZXlBZHJMb3R0ZXJ5VG90YWxTdGFrZWQCC2xvd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cnlOYW1lBQdwcml6ZUlkBQZjaG9pY2UFA25pbAECdHgBBnZlcmlmeQAJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXkyZVgQ", "height": 2731791, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 5rxT1MWEwcwwUD3qydr6f7zcpkDfgaAjDLmyViRqxCQw Next: 2c4qd4Kg7oweKqkdKQLzX6DVJLwGxV8v3sytMRHVCYZS Diff:
Old | New | Differences | |
---|---|---|---|
130 | 130 | then throw("prize does not exist") | |
131 | 131 | else { | |
132 | 132 | let L = value(blockInfoByHeight(t)) | |
133 | - | let M = sha256((toBytes(I) + value(L.vrf))) | |
133 | + | let M = sha256(((toBytes(I) + value(L.vrf)) + toBytes("dodlllottery"))) | |
134 | 134 | let N = toInt((toBigInt(M) % toBigInt(z))) | |
135 | 135 | [StringEntry("lastHash", toString(toBigInt(M))), IntegerEntry(q(l, I), N)] | |
136 | 136 | } |
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, "adr", 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 = f(o(l, I), "") | |
129 | 129 | if ((K == "")) | |
130 | 130 | then throw("prize does not exist") | |
131 | 131 | else { | |
132 | 132 | let L = value(blockInfoByHeight(t)) | |
133 | - | let M = sha256((toBytes(I) + value(L.vrf))) | |
133 | + | let M = sha256(((toBytes(I) + value(L.vrf)) + toBytes("dodlllottery"))) | |
134 | 134 | let N = toInt((toBigInt(M) % toBigInt(z))) | |
135 | 135 | [StringEntry("lastHash", toString(toBigInt(M))), IntegerEntry(q(l, I), N)] | |
136 | 136 | } | |
137 | 137 | } | |
138 | 138 | } | |
139 | 139 | } | |
140 | 140 | ||
141 | 141 | ||
142 | 142 | @Verifier(O) | |
143 | 143 | func P () = sigVerify(O.bodyBytes, O.proofs[0], O.senderPublicKey) | |
144 | 144 |
github/deemru/w8io/026f985 37.86 ms ◑