tx · 7pzKBzxRANweUkY3Z7jnwyjETCRWVooLEbqEUqdtUAQf

3NB65vyDJGReajuAGcg4wQh1wyVDACv6hkY:  -0.00600000 Waves

2024.06.03 23:46 [3135001] smart account 3NB65vyDJGReajuAGcg4wQh1wyVDACv6hkY > SELF 0.00000000 Waves

{ "type": 13, "id": "7pzKBzxRANweUkY3Z7jnwyjETCRWVooLEbqEUqdtUAQf", "fee": 600000, "feeAssetId": null, "timestamp": 1717447599211, "version": 2, "chainId": 84, "sender": "3NB65vyDJGReajuAGcg4wQh1wyVDACv6hkY", "senderPublicKey": "4NP9KQZMdzMG7m84UiXniZymeKvUNRwGtexsXGedihU7", "proofs": [ "3u3TuGy9bxvPPsB1UN47KoGKymq7CfpKQQvr6xHWfPPdZvR7DdPf6fJeag2DCK9cJHJ7LPo7L64vgRn3zAYX8LSR" ], "script": "base64:BgIVCAISBgoEAQECAhIECgIBAhIDCgEBEAADU0VQAgJfXwEEam9pbgEFYXJyYXkJALkJAgUFYXJyYXkFA1NFUAEIc2VwYXJhdGUBBnN0cmluZwkAtQkCBQZzdHJpbmcFA1NFUAEPbG90dGVyeUNvdW50S2V5AAkBBGpvaW4BCQDMCAICAiVzCQDMCAICDGxvdHRlcnlDb3VudAUDbmlsARhsb3R0ZXJ5RW5kQmxvY2tIZWlnaHRLZXkBCWxvdHRlcnlJZAkBBGpvaW4BCQDMCAICAiVzCQDMCAICFWxvdHRlcnlFbmRCbG9ja0hlaWdodAkAzAgCCQCkAwEFCWxvdHRlcnlJZAUDbmlsARJsb3R0ZXJ5QmV0UHJpY2VLZXkBCWxvdHRlcnlJZAkBBGpvaW4BCQDMCAICAiVzCQDMCAICD2xvdHRlcnlCZXRQcmljZQkAzAgCCQCkAwEFCWxvdHRlcnlJZAUDbmlsARJsb3R0ZXJ5QmV0QXNzZXRLZXkBCWxvdHRlcnlJZAkBBGpvaW4BCQDMCAICAiVzCQDMCAICD2xvdHRlcnlCZXRUb2tlbgkAzAgCCQCkAwEFCWxvd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HQWRkcmVzcwEFCHJlZmZlcmVyCQBrAwUDY2FwAAoAAQUIYmV0VG9rZW4FA25pbAECdHgBBnZlcmlmeQAJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXkkIWSf", "height": 3135001, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 6 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let SEP = "__"
5+
6+func join (array) = makeString(array, SEP)
7+
8+
9+func separate (string) = split(string, SEP)
10+
11+
12+func lotteryCountKey () = join(["%s", "lotteryCount"])
13+
14+
15+func lotteryEndBlockHeightKey (lotteryId) = join(["%s", "lotteryEndBlockHeight", toString(lotteryId)])
16+
17+
18+func lotteryBetPriceKey (lotteryId) = join(["%s", "lotteryBetPrice", toString(lotteryId)])
19+
20+
21+func lotteryBetAssetKey (lotteryId) = join(["%s", "lotteryBetToken", toString(lotteryId)])
22+
23+
24+func lotteryIsFinishedKey (lotteryId) = join(["%s", "lotteryIsFinished", toString(lotteryId)])
25+
26+
27+func lotteryWinnerTicketIdKey (lotteryId) = join(["%s", "lotteryWinnerTicketId", toString(lotteryId)])
28+
29+
30+func lotteryCountTicketsKey (lotteryId) = join(["%s", "lotteryCountTicketsKey", toString(lotteryId)])
31+
32+
33+func lotteryReffererKey (lotteryId) = join(["%s", "lotteryReffererKey", toString(lotteryId)])
34+
35+
36+func lotteryTicketOwnerKey (lotteryId,ticketId) = join(["%s", "lotteryTicketOwner", toString(lotteryId), toString(ticketId)])
37+
38+
39+let pieceOfShitArray90 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89]
40+
41+func payOneAsset (i,asset) = if ((size(i.payments) == 1))
42+ then if ((value(i.payments[0].assetId) == asset))
43+ then i.payments[0].amount
44+ else throw("wrong asset")
45+ else throw("only 1 payment")
46+
47+
48+func randomizer (blockHeight) = {
49+ let block = blockInfoByHeight(blockHeight)
50+ if ((block == unit))
51+ then throw("block not mined")
52+ else {
53+ let rand = ((lastBlock.generationSignature + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height))
54+ sha256(rand)
55+ }
56+ }
57+
58+
59+func getWinner (lotteryId) = {
60+ let blockHeight = getIntegerValue(lotteryEndBlockHeightKey(lotteryId))
61+ let countTickets = getIntegerValue(lotteryCountTicketsKey(lotteryId))
62+ let rand = randomizer(blockHeight)
63+ let winNumber = (toInt(rand) % countTickets)
64+ getBinaryValue(lotteryTicketOwnerKey(lotteryId, winNumber))
65+ }
66+
67+
68+@Callable(i)
69+func create (endBlockHeight,betPrice,betToken,refferer) = if ((lastBlock.height >= endBlockHeight))
70+ then throw("incorrect endBlockHeight")
71+ else {
72+ let count = match getInteger(lotteryCountKey()) {
73+ case a: Int =>
74+ a
75+ case _ =>
76+ 0
77+ }
78+[IntegerEntry(lotteryCountKey(), (count + 1)), IntegerEntry(lotteryEndBlockHeightKey(count), endBlockHeight), IntegerEntry(lotteryBetPriceKey(count), betPrice), BinaryEntry(lotteryBetAssetKey(count), betToken), BooleanEntry(lotteryIsFinishedKey(count), false), IntegerEntry(lotteryCountTicketsKey(count), 0), BinaryEntry(lotteryReffererKey(count), refferer)]
79+ }
80+
81+
82+
83+@Callable(i)
84+func buy (lotteryId,referrer) = {
85+ let isFinished = getBooleanValue(lotteryIsFinishedKey(lotteryId))
86+ let betAsset = getBinaryValue(lotteryBetAssetKey(lotteryId))
87+ let betPrice = getIntegerValue(lotteryBetPriceKey(lotteryId))
88+ let totalCountTickets = getIntegerValue(lotteryCountTicketsKey(lotteryId))
89+ if (isFinished)
90+ then throw("lottery alredy finished")
91+ else {
92+ let amount = payOneAsset(i, betAsset)
93+ let purchasedTickets = (amount / betPrice)
94+ func f (accum,next) = if ((purchasedTickets > next))
95+ then (accum :+ BinaryEntry(lotteryTicketOwnerKey(lotteryId, (totalCountTickets + next)), i.callerPublicKey))
96+ else accum
97+
98+ ({
99+ let $l = pieceOfShitArray90
100+ let $s = size($l)
101+ let $acc0 = nil
102+ func $f0_1 ($a,$i) = if (($i >= $s))
103+ then $a
104+ else f($a, $l[$i])
105+
106+ func $f0_2 ($a,$i) = if (($i >= $s))
107+ then $a
108+ else throw("List size exceeds 90")
109+
110+ $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50), 51), 52), 53), 54), 55), 56), 57), 58), 59), 60), 61), 62), 63), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90)
111+ } ++ [IntegerEntry(lotteryCountTicketsKey(lotteryId), (totalCountTickets + purchasedTickets))])
112+ }
113+ }
114+
115+
116+
117+@Callable(i)
118+func claim (lotteryId) = {
119+ let winner = getWinner(lotteryId)
120+ if ((winner != i.callerPublicKey))
121+ then throw("not win")
122+ else {
123+ let betPrice = getIntegerValue(lotteryBetPriceKey(lotteryId))
124+ let totalCountTickets = getIntegerValue(lotteryCountTicketsKey(lotteryId))
125+ let betToken = getBinaryValue(lotteryBetAssetKey(lotteryId))
126+ let refferer = getBinaryValue(lotteryReffererKey(lotteryId))
127+ let cap = (betPrice * totalCountTickets)
128+[ScriptTransfer(i.caller, fraction(cap, 10, 7), betToken), ScriptTransfer(Address(refferer), fraction(cap, 10, 1), betToken)]
129+ }
130+ }
131+
132+
133+@Verifier(tx)
134+func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
135+

github/deemru/w8io/026f985 
25.74 ms