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:BgIZCAISABIAEgQKAggBEgUKAwgBCBIECgIIAQ0ADmxvdHRlcnlBc3NldElECQDZBAECLDNMejIzbVNVdlQxRXN3Y0JuMnNVUllKRzJhdDhyRzVhRnVVclRBd2FQTTZRAAp0aWNrZXRTaXplAAEBEGdldEludGVnZXJPckVsc2UCA2tleQN2YWwJAQt2YWx1ZU9yRWxzZQIJAJ8IAQUDa2V5BQN2YWwBD2dldFN0cmluZ09yRWxzZQIDa2V5A3ZhbAkBC3ZhbHVlT3JFbHNlAgkAoggBBQNrZXkFA3ZhbAECbWsBAXgJALkJAgUBeAIBXwERa2V5QWRyVG90YWxTdGFrZWQBA2FkcgkBAm1rAQkAzAgCAgNhZHIJAMwIAgUDYWRyCQDMCAICC3RvdGFsU3Rha2VkBQNuaWwBFWtleUxvdHRlcnlUb3RhbFN0YWtlZAELbG90dGVyeU5hbWUJAQJtawEJAMwIAgIHbG90dGVyeQkAzAgCBQtsb3R0ZXJ5TmFtZQkAzAgCAgt0b3RhbFN0YWtlZAUDbmlsARhrZXlBZHJMb3R0ZXJ5VG90YWxTdGFrZWQCC2xv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lcnlOYW1lBQdwcml6ZUlkBQZjaG9pY2UFA25pbAECdHgBBnZlcmlmeQAJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXkyZVgQ", "height": 2731791, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 5rxT1MWEwcwwUD3qydr6f7zcpkDfgaAjDLmyViRqxCQw Next: 2c4qd4Kg7oweKqkdKQLzX6DVJLwGxV8v3sytMRHVCYZS Diff:
OldNewDifferences
130130 then throw("prize does not exist")
131131 else {
132132 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")))
134134 let N = toInt((toBigInt(M) % toBigInt(z)))
135135 [StringEntry("lastHash", toString(toBigInt(M))), IntegerEntry(q(l, I), N)]
136136 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let a = fromBase58String("3Lz23mSUvT1EswcBn2sURYJG2at8rG5aFuUrTAwaPM6Q")
55
66 let b = 1
77
88 func c (d,e) = valueOrElse(getInteger(d), e)
99
1010
1111 func f (d,e) = valueOrElse(getString(d), e)
1212
1313
1414 func g (h) = makeString(h, "_")
1515
1616
1717 func i (j) = g(["adr", j, "totalStaked"])
1818
1919
2020 func k (l) = g(["lottery", l, "totalStaked"])
2121
2222
2323 func m (l,j) = g(["lottery", l, "adr", j, "totalStaked"])
2424
2525
2626 func n (l) = g(["lottery", l, "finalHeight"])
2727
2828
2929 func o (l,p) = g(["lottery", l, "prize", toString(p), "value"])
3030
3131
3232 func q (l,p) = g(["lottery", l, "prize", toString(p), "choice"])
3333
3434
3535 let r = g(["param", "activeLotteryName"])
3636
3737 func s () = {
3838 let l = f(r, "")
3939 if ((l == ""))
4040 then ""
4141 else {
4242 let t = getIntegerValue(n(l))
4343 if (((height - 1) >= t))
4444 then ""
4545 else l
4646 }
4747 }
4848
4949
5050 @Callable(u)
5151 func stake () = {
5252 let l = s()
5353 if ((l == ""))
5454 then throw("Lottery not active")
5555 else if ((size(u.payments) == 0))
5656 then throw("No payment added")
5757 else if ((size(u.payments) != 1))
5858 then throw("Too many payments added")
5959 else if ((u.payments[0].assetId != a))
6060 then throw("Wrong payment assetId")
6161 else {
6262 let v = u.payments[0].amount
6363 let w = (v / b)
6464 if ((w == 0))
6565 then throw("Not enough to buy at least one ticket")
6666 else {
6767 let x = toString(u.caller)
6868 let y = k(l)
6969 let z = getIntegerValue(y)
7070 let A = g(["owner", l, toString(z), toString(((z + w) - 1))])
7171 let B = i(x)
7272 let C = c(B, 0)
7373 let D = m(l, x)
7474 let E = c(D, 0)
7575 let F = (v - (w * b))
7676 [ScriptTransfer(u.caller, F, a), IntegerEntry(y, (z + w)), StringEntry(A, x), IntegerEntry(B, (C + w)), IntegerEntry(D, (E + w))]
7777 }
7878 }
7979 }
8080
8181
8282
8383 @Callable(u)
8484 func claim () = if ((size(u.payments) > 0))
8585 then throw("No payments needed")
8686 else {
8787 let x = toString(u.caller)
8888 let l = s()
8989 let G = if ((l == ""))
9090 then 0
9191 else c(m(l, x), 0)
9292 let B = i(x)
9393 let C = c(B, 0)
9494 let H = (C - G)
9595 if ((0 >= H))
9696 then throw("No assets available for claim")
9797 else [ScriptTransfer(u.caller, H, a), IntegerEntry(B, (C - H))]
9898 }
9999
100100
101101
102102 @Callable(u)
103103 func startLottery (l,t) = if ((u.caller != this))
104104 then throw("Admin only")
105105 else [StringEntry(r, l), IntegerEntry(n(l), t), IntegerEntry(k(l), 0)]
106106
107107
108108
109109 @Callable(u)
110110 func declarePrize (l,I,J) = if ((u.caller != this))
111111 then throw("Admin only")
112112 else [StringEntry(o(l, I), J)]
113113
114114
115115
116116 @Callable(u)
117117 func finalaizePrizeChoice (l,I) = if ((u.caller != this))
118118 then throw("Admin only")
119119 else {
120120 let t = getIntegerValue(n(l))
121121 if ((t > height))
122122 then throw("Lottery is not over yet")
123123 else {
124124 let z = getIntegerValue(k(l))
125125 if ((z == 0))
126126 then throw("No one entered the lottery")
127127 else {
128128 let K = f(o(l, I), "")
129129 if ((K == ""))
130130 then throw("prize does not exist")
131131 else {
132132 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")))
134134 let N = toInt((toBigInt(M) % toBigInt(z)))
135135 [StringEntry("lastHash", toString(toBigInt(M))), IntegerEntry(q(l, I), N)]
136136 }
137137 }
138138 }
139139 }
140140
141141
142142 @Verifier(O)
143143 func P () = sigVerify(O.bodyBytes, O.proofs[0], O.senderPublicKey)
144144

github/deemru/w8io/026f985 
37.86 ms