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:BgIZCAISABIAEgQKAggBEgUKAwgBCBIECgIIAQ0ADmxvdHRlcnlBc3NldElECQDZBAECLDNMejIzbVNVdlQxRXN3Y0JuMnNVUllKRzJhdDhyRzVhRnVVclRBd2FQTTZRAAp0aWNrZXRTaXplAAEBEGdldEludGVnZXJPckVsc2UCA2tleQN2YWwJAQt2YWx1ZU9yRWxzZQIJAJ8IAQUDa2V5BQN2YWwBD2dldFN0cmluZ09yRWxzZQIDa2V5A3ZhbAkBC3ZhbHVlT3JFbHNlAgkAoggBBQNrZXkFA3ZhbAECbWsBAXgJALkJAgUBeAIBXwERa2V5QWRyVG90YWxTdGFrZWQBA2FkcgkBAm1rAQkAzAgCAgNhZHIJAMwIAgUDYWRyCQDMCAICC3RvdGFsU3Rha2VkBQNuaWwBFWtleUxvdHRlcnlUb3RhbFN0YWtlZAELbG90dGVyeU5hbWUJAQJtawEJAMwIAgIHbG90dGVyeQkAzAgCBQtsb3R0ZXJ5TmFtZQkAzAgCAgt0b3RhbFN0YWtlZAUDbmlsARhrZXlBZHJMb3R0ZXJ5VG90YWxTdG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aAjDLmyViRqxCQw 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, 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 = value(blockInfoByHeight(t))
129129 let L = sha256((toBytes(I) + value(K.vrf)))
130130 let M = toInt((toBigInt(L) % toBigInt(z)))
131131 [StringEntry("lastHash", toString(toBigInt(L))), IntegerEntry(q(l, I), M)]
132132 }
133133 }
134134 }
135135
136136
137137 @Verifier(N)
138138 func O () = sigVerify(N.bodyBytes, N.proofs[0], N.senderPublicKey)
139139

github/deemru/w8io/169f3d6 
50.21 ms