tx · 41fKokXwTHvJ65Lw7ajxqmLAX9bnqN8BrUGS9wCz3ft7

3MqEAEVk1NcbRAuEPAX7nyzUqMHbhvRofez:  -0.00200000 Waves

2023.11.06 15:11 [2831465] smart account 3MqEAEVk1NcbRAuEPAX7nyzUqMHbhvRofez > SELF 0.00000000 Waves

{ "type": 13, "id": "41fKokXwTHvJ65Lw7ajxqmLAX9bnqN8BrUGS9wCz3ft7", "fee": 200000, "feeAssetId": null, "timestamp": 1699272734136, "version": 2, "chainId": 84, "sender": "3MqEAEVk1NcbRAuEPAX7nyzUqMHbhvRofez", "senderPublicKey": "Brp6cacBXyKUcZr5Uc6VDKsnFcaEeQ8nQzrZQyobDsuf", "proofs": [ "qzGEioVfmMcpZ8b1p8VuEeXpW4UyjjFGkZgJJJff9MFerDNxSVAuTtpK64P7hgt8aEhTMkwQbLB8YTJCrNx5H2T" ], "script": "base64:AAIDAAAAAAAAAAQIARIAAAAAAgEAAAAKcmFuZG9taXplcgAAAAEAAAADaW52BAAAAAhsYXN0UGxheQQAAAAHJG1hdGNoMAkABBwAAAACBQAAAAR0aGlzAgAAAAhsYXN0UGxheQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAKQnl0ZVZlY3RvcgQAAAABcwUAAAAHJG1hdGNoMAUAAAABcwMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAEVW5pdAEAAAAMV2F2ZXNMb3R0b1YyCQAAAgAAAAECAAAAC01hdGNoIGVycm9yBAAAAARyYW5kCQAAywAAAAIJAADLAAAAAgkAAMsAAAACCQAAywAAAAIJAADLAAAAAgUAAAAIbGFzdFBsYXkIBQAAAANpbnYAAAANdHJhbnNhY3Rpb25JZAgFAAAAA2ludgAAAA9jYWxsZXJQdWJsaWNLZXkIBQAAAAlsYXN0QmxvY2sAAAATZ2VuZXJhdGlvblNpZ25hdHVyZQkAAZoAAAABCAUAAAAJbGFzdEJsb2NrAAAACXRpbWVzdGFtcAkAAZoAAAABCAUAAAAJbGFzdEJsb2Nr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AQAAAAxTY3JpcHRSZXN1bHQAAAACBQAAAA13cml0ZUxhc3RQbGF5BQAAAAt3aW5UcmFuc2ZlcgkBAAAADFNjcmlwdFJlc3VsdAAAAAIFAAAADXdyaXRlTGFzdFBsYXkJAQAAAAtUcmFuc2ZlclNldAAAAAEFAAAAA25pbAAAAAEAAAABaQEAAAAFbG90dG8AAAAACQEAAAAKc3RhcnRMb3R0bwAAAAEFAAAAAWkAAAAAWA2Nzg==", "height": 2831465, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Abx553A48RhWokDnYebkgZJYmo3BezxaS7ajyA5qbPp2 Next: 4MGF2L8p4r6Xqb6SH3B8jxrvErdFCno9qmR5LgQ4EEfh Full:
OldNewDifferences
1-{-# STDLIB_VERSION 5 #-}
1+{-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let li = ["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", "55", "56"]
5-
6-let hours = 1
7-
8-let minutes = 10
9-
10-func tryGetInteger (key) = match getInteger(this, key) {
11- case b: Int =>
12- b
13- case _ =>
14- 0
15-}
16-
17-
18-func tryGetString (key) = match getString(this, key) {
19- case b: String =>
20- b
21- case _ =>
22- ""
23-}
24-
25-
26-func getAssetString (assetId) = match assetId {
27- case b: ByteVector =>
28- toBase58String(b)
29- case _ =>
30- "WAVES"
31-}
32-
33-
34-func getAssetBytes (assetIdStr) = if ((assetIdStr == "WAVES"))
35- then unit
36- else fromBase58String(assetIdStr)
37-
38-
39-func payBoostingResult (boostingId) = {
40- let lastHeight = tryGetInteger((("boosting_" + boostingId) + "_lastHeight"))
41- let finishHeight = tryGetInteger((("boosting_" + boostingId) + "_finishHeight"))
42- if (if ((lastHeight != 0))
43- then (finishHeight > lastHeight)
44- else false)
45- then {
46- let blockReward = (tryGetInteger((("boosting_" + boostingId) + "_totalAmount")) / ((tryGetInteger((("boosting_" + boostingId) + "_days")) * hours) * minutes))
47- let toPay = fraction((min([finishHeight, height]) - lastHeight), blockReward, 1)
48-[IntegerEntry((("boosting_" + boostingId) + "_lastHeight"), height), ScriptTransfer(addressFromStringValue(tryGetString((("boosting_" + boostingId) + "_poolId"))), toPay, getAssetBytes(tryGetString((("boosting_" + boostingId) + "_assetId"))))]
49- }
50- else nil
4+func randomizer (inv) = {
5+ let lastPlay = match getBinary(this, "lastPlay") {
6+ case s: ByteVector =>
7+ s
8+ case _: Unit =>
9+ base58'2ee4oFDYriWJ9EMeR'
10+ case _ =>
11+ throw("Match error")
12+ }
13+ let rand = (((((lastPlay + inv.transactionId) + inv.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height))
14+ sha256(rand)
5115 }
5216
5317
54-func endedBoostingIds (boostingId) = {
55- let lastHeight = tryGetInteger((("boosting_" + boostingId) + "_lastHeight"))
56- let finishHeight = tryGetInteger((("boosting_" + boostingId) + "_finishHeight"))
57- if ((lastHeight >= finishHeight))
58- then [StringEntry((("list ended " + toString(height)) + " boostingIds"), ((tryGetString((("list ended " + toString(height)) + " boostingIds")) + boostingId) + ","))]
59- else nil
18+func startLotto (inv) = {
19+ let playLimit = (wavesBalance(this) / 100)
20+ let payment = extract(inv.payment)
21+ if (!(isDefined(inv.payment)))
22+ then throw("Should be with Payment in Waves")
23+ else if (isDefined(payment.assetId))
24+ then throw("Payment should be in Waves")
25+ else if ((payment.amount > playLimit))
26+ then throw(("Payment should be less than " + toString(playLimit)))
27+ else {
28+ let randhash = randomizer(inv)
29+ let winTransfer = TransferSet([ScriptTransfer(inv.caller, ((payment.amount * 190) / 100), unit)])
30+ let writeLastPlay = WriteSet([DataEntry("lastPlay", randhash)])
31+ if ((500 > (toInt(randhash) % 1000)))
32+ then ScriptResult(writeLastPlay, winTransfer)
33+ else ScriptResult(writeLastPlay, TransferSet(nil))
34+ }
6035 }
6136
6237
6338 @Callable(i)
64-func addBoosting (poolId,days) = if ((1 > days))
65- then throw("amount of days has to be between 1 and 365")
66- else if ((days > 365))
67- then throw("amount of days has to be between 1 and 365")
68- else if (if ((i.caller != this))
69- then (i.caller != Address(base58'3N3y7nQfqDc7rBUExjKQi5ZbspWRh9q8PYH'))
70- else false)
71- then throw("under maintenance until further notice")
72- else {
73- let fullAmount = i.payments[0].amount
74- if ((1440 > (fullAmount / days)))
75- then throw((("boosting amount too small, minimum is " + toString((1440 * days))) + " of the smallest unit of payment asset"))
76- else {
77- let assetId = getAssetString(i.payments[0].assetId)
78- if ((height == tryGetInteger("height")))
79- then throw("wait 1 minute")
80- else {
81- let entry = invoke(this, "entryEnded", nil, nil)
82- if ((entry == entry))
83- then {
84- let get = invoke(this, "firstEndedBoostingId", nil, nil)
85- if ((get == get))
86- then {
87- let boostingId = toString(tryGetInteger("first"))
88- if ((addressFromString(poolId) == unit))
89- then throw("incorrect pool address")
90- else [IntegerEntry((("boosting_" + boostingId) + "_days"), days), IntegerEntry((("boosting_" + boostingId) + "_totalAmount"), fullAmount), IntegerEntry((("boosting_" + boostingId) + "_dailyAmount"), (fullAmount / days)), IntegerEntry((("boosting_" + boostingId) + "_startHeight"), height), IntegerEntry((("boosting_" + boostingId) + "_finishHeight"), (height + ((days * hours) * minutes))), IntegerEntry((("boosting_" + boostingId) + "_finishTimestamp"), (lastBlock.timestamp + ((((days * hours) * minutes) * 60) * 1000))), IntegerEntry((("boosting_" + boostingId) + "_lastHeight"), height), StringEntry((("boosting_" + boostingId) + "_assetId"), assetId), StringEntry((("boosting_" + boostingId) + "_owner"), toString(i.caller)), StringEntry((("boosting_" + boostingId) + "_poolId"), poolId), StringEntry((("pool_" + poolId) + "_boostings"), ((tryGetString((("pool_" + poolId) + "_boostings")) + boostingId) + ","))]
91- }
92- else throw("Strict value is not equal to itself.")
93- }
94- else throw("Strict value is not equal to itself.")
95- }
96- }
97- }
98-
99-
100-
101-@Callable(i)
102-func payBoosting (boostingId) = payBoostingResult(boostingId)
103-
104-
105-
106-@Callable(i)
107-func payBoostings () = {
108- func f (accum,next) = {
109- let in = invoke(this, "payBoosting", [next], nil)
110- if ((in == in))
111- then in
112- else throw("Strict value is not equal to itself.")
113- }
114-
115- let payments = {
116- let $l = li
117- let $s = size($l)
118- let $acc0 = 0
119- func $f0_1 ($a,$i) = if (($i >= $s))
120- then $a
121- else f($a, $l[$i])
122-
123- func $f0_2 ($a,$i) = if (($i >= $s))
124- then $a
125- else throw("List size exceeds 56")
126-
127- $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($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)
128- }
129- if ((payments == payments))
130- then nil
131- else throw("Strict value is not equal to itself.")
132- }
133-
134-
135-
136-@Callable(i)
137-func endedBoostings (boostingId) = endedBoostingIds(boostingId)
138-
139-
140-
141-@Callable(i)
142-func entryEnded () = {
143- func f (accum,next) = {
144- let in = invoke(this, "endedBoostings", [next], nil)
145- if ((in == in))
146- then in
147- else throw("Strict value is not equal to itself.")
148- }
149-
150- let end = {
151- let $l = li
152- let $s = size($l)
153- let $acc0 = 0
154- func $f0_1 ($a,$i) = if (($i >= $s))
155- then $a
156- else f($a, $l[$i])
157-
158- func $f0_2 ($a,$i) = if (($i >= $s))
159- then $a
160- else throw("List size exceeds 56")
161-
162- $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($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)
163- }
164- if ((end == end))
165- then [IntegerEntry("height", height)]
166- else throw("Strict value is not equal to itself.")
167- }
168-
169-
170-
171-@Callable(i)
172-func firstEndedBoostingId () = {
173- func fold (accum,next) = (accum :+ parseIntValue(next))
174-
175- let StringValue = dropRight(tryGetString((("list ended " + toString(height)) + " boostingIds")), 1)
176- let list = {
177- let $l = split(StringValue, ",")
178- let $s = size($l)
179- let $acc0 = nil
180- func $f0_1 ($a,$i) = if (($i >= $s))
181- then $a
182- else fold($a, $l[$i])
183-
184- func $f0_2 ($a,$i) = if (($i >= $s))
185- then $a
186- else throw("List size exceeds 56")
187-
188- $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($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)
189- }
190- let firstOfList = list[0]
191-[IntegerEntry("first", firstOfList)]
192- }
39+func lotto () = startLotto(i)
19340
19441

github/deemru/w8io/c3f4982 
31.13 ms