tx · Cf4zs8fS3VHjh5C5t8SNk8SQ2ujTKovFD6KjPpz9pxkF

3N3y7nQfqDc7rBUExjKQi5ZbspWRh9q8PYH:  -0.00200000 Waves

2023.11.17 12:12 [2847168] smart account 3N3y7nQfqDc7rBUExjKQi5ZbspWRh9q8PYH > SELF 0.00000000 Waves

{ "type": 13, "id": "Cf4zs8fS3VHjh5C5t8SNk8SQ2ujTKovFD6KjPpz9pxkF", "fee": 200000, "feeAssetId": null, "timestamp": 1700212365968, "version": 2, "chainId": 84, "sender": "3N3y7nQfqDc7rBUExjKQi5ZbspWRh9q8PYH", "senderPublicKey": "9ggtmbyecVRfUY2zeZhNaoLBp2iymhnQhffXQhemTJaG", "proofs": [ "53c3t9qS72utgxdc864cABnhQq8SUd45QmzTgaQmBQzmtxAbqrPadPJm2jJjBsVcgvBLttCjaqgUf6f33fSkLQ7d" ], "script": "base64:BgIECAISAAkADFRlc3RTQ1B1YktleQEgoVeU11muwc+hUBHN7HeslecfLlzb1kPRfhzSdE7YqzYACFRlc3RVc2VyCQEHQWRkcmVzcwEBGgFUmiSvdpHfcyUoO/Y3lJR5RVM/EC7LIlBGAA5UZXN0VXNlclB1YktleQEggQhA7lSDBAV96QCBw6VWWREBAkOfczsVMMZRMcDjO10ACVRlc3RVc2VyMgkBB0FkZHJlc3MBARoBVNBVQEgvriq5Wd7cAHuvw7N/9YPdF0K61wAPVGVzdFVzZXIyUHViS2V5ASAaFa4tDyIv1uhzDfwRR/IHtg7qNN7P3pYq2N1IFBp+EAATUHV6emxlTWFzdGVyQWRkcmVzcwkBB0FkZHJlc3MBARoBV85X8yTRB6SzTv7SuuIorMWQltaK0W0F7gASUHV6emxlTWFzdGVyUHViS2V5ASA7NU1uP5+++FSclkQHgFarL+ITYEXEe/I/F0P0QgUmXQANYWNjZXNzQWRkcmVzcwkAzAgCBQR0aGlzCQDMCAIFCFRlc3RVc2VyCQDMCAIFCVRlc3RVc2VyMgUDbmlsAAZhY2Nlc3MJAMwIAgUMVGV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dGlvbgYJAAECBQckbWF0Y2gwAhJSZWlzc3VlVHJhbnNhY3Rpb24EA3R0eAUHJG1hdGNoMAkAAAIJAQ9jb250YWluc0VsZW1lbnQCBQ1hY2Nlc3NBZGRyZXNzCAUDdHR4BnNlbmRlcgYHY907+g==", "height": 2847168, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Gm1pYpHu5Wsovqg8f6Rofb5zvFQQwhBZhc6CF5eqDwJ4 Next: 6KnG2oLavkjwq6H87xNeVZh2oGs8AdJ4ptH9RU84TLan Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
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"]
4+let TestSCPubKey = base58'Brp6cacBXyKUcZr5Uc6VDKsnFcaEeQ8nQzrZQyobDsuf'
55
6-let hours = 1
6+let TestUser = Address(base58'3N3y7nQfqDc7rBUExjKQi5ZbspWRh9q8PYH')
77
8-let minutes = 10
8+let TestUserPubKey = base58'9ggtmbyecVRfUY2zeZhNaoLBp2iymhnQhffXQhemTJaG'
99
10-func tryGetInteger (key) = match getInteger(this, key) {
11- case b: Int =>
12- b
13- case _ =>
14- 0
15-}
10+let TestUser2 = Address(base58'3N8ueTAufEUYDKWJDbfK7aZ4HHxBkX4DXA6')
11+
12+let TestUser2PubKey = base58'2kpmuzw1ZbrtgAN3BrR7vbEW1XrJoJKCstL7mf7XNf2P'
13+
14+let PuzzleMasterAddress = Address(base58'3PLjwHcz9NEuaTo63NZR9B9okQiKQxZSbmf')
15+
16+let PuzzleMasterPubKey = base58'4z8CKSYQBKkzx7PBb5uBP1YPa6YAHRNTApW1sQVHT5eU'
17+
18+let accessAddress = [this, TestUser, TestUser2]
19+
20+let access = [TestSCPubKey, TestUserPubKey, TestUser2PubKey]
21+
22+@Callable(i)
23+func activate () = [IntegerEntry(if ((i.caller == this))
24+ then "Activated blockheight"
25+ else "Activated by anybody blockheight", height)]
1626
1727
18-func tryGetString (key) = match getString(this, key) {
19- case b: String =>
20- b
28+@Verifier(tx)
29+func verify () = match tx {
30+ case ttx: Order|DataTransaction|SponsorFeeTransaction|SetScriptTransaction|CreateAliasTransaction|LeaseCancelTransaction|LeaseTransaction|IssueTransaction|InvokeExpressionTransaction|UpdateAssetInfoTransaction|InvokeScriptTransaction|SetAssetScriptTransaction|TransferTransaction|ExchangeTransaction|MassTransferTransaction|BurnTransaction|ReissueTransaction =>
31+ (containsElement(accessAddress, ttx.sender) == true)
2132 case _ =>
22- ""
33+ false
2334 }
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- let getFinishedPoolId = tryGetString((("boosting_" + boostingId) + "_poolId"))
49- let getPoolBoostings = tryGetString((("pool_" + getFinishedPoolId) + "_boostings"))
50- let sizeStr = size(getPoolBoostings)
51- let findIndex = value(indexOf(getPoolBoostings, boostingId))
52- let modifierLeft = if ((findIndex == 0))
53- then 0
54- else 1
55- let modifierRight = if ((findIndex == 0))
56- then 2
57- else 1
58- let leftStr = take(getPoolBoostings, (sizeStr - ((sizeStr - findIndex) + modifierLeft)))
59- let rightStr = takeRight(getPoolBoostings, (sizeStr - (findIndex + modifierRight)))
60- let openBoostingsIds = (leftStr + rightStr)
61-[IntegerEntry((("boosting_" + boostingId) + "_lastHeight"), height), ScriptTransfer(addressFromStringValue(tryGetString((("boosting_" + boostingId) + "_poolId"))), toPay, getAssetBytes(tryGetString((("boosting_" + boostingId) + "_assetId")))), StringEntry((("pool_" + getFinishedPoolId) + "_boostings"), if ((finishHeight > height))
62- then tryGetString((("pool_" + getFinishedPoolId) + "_boostings"))
63- else openBoostingsIds)]
64- }
65- else nil
66- }
67-
68-
69-func endedBoostingIds (boostingId) = {
70- let lastHeight = tryGetInteger((("boosting_" + boostingId) + "_lastHeight"))
71- let finishHeight = tryGetInteger((("boosting_" + boostingId) + "_finishHeight"))
72- if ((lastHeight >= finishHeight))
73- then [StringEntry((("list ended " + toString(height)) + " boostingIds"), ((tryGetString((("list ended " + toString(height)) + " boostingIds")) + boostingId) + ","))]
74- else [StringEntry((("list ongoing boosts " + toString(height)) + " boostingIds"), ((tryGetString((("list ongoing boosts " + toString(height)) + " boostingIds")) + boostingId) + ","))]
75- }
76-
77-
78-@Callable(i)
79-func addBoosting (poolId,days) = if ((1 > days))
80- then throw("amount of days has to be between 1 and 365")
81- else if ((days > 365))
82- then throw("amount of days has to be between 1 and 365")
83- else if (false)
84- then throw("under maintenance until further notice")
85- else {
86- let fullAmount = i.payments[0].amount
87- if ((1440 > (fullAmount / days)))
88- then throw((("boosting amount too small, minimum is " + toString((1440 * days))) + " of the smallest unit of payment asset"))
89- else {
90- let assetId = getAssetString(i.payments[0].assetId)
91- if ((height == tryGetInteger("height")))
92- then throw("wait 1 minute")
93- else {
94- let entry = if ((size(tryGetString((("pool_" + poolId) + "_boostings"))) > 11))
95- then throw("max 5 boosts per pool")
96- else invoke(this, "entryEnded", nil, nil)
97- if ((entry == entry))
98- then {
99- let boostingId = if ((size((("list ongoing boosts " + toString(height)) + " boostingIds")) > 112))
100- then throw("wait till other boosts are finished")
101- else take(tryGetString((("list ended " + toString(height)) + " boostingIds")), 1)
102- if ((addressFromString(poolId) == unit))
103- then throw("incorrect pool address")
104- 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) + ","))]
105- }
106- else throw("Strict value is not equal to itself.")
107- }
108- }
109- }
110-
111-
112-
113-@Callable(i)
114-func payBoosting (boostingId) = payBoostingResult(boostingId)
115-
116-
117-
118-@Callable(i)
119-func payBoostings () = {
120- func f (accum,next) = {
121- let in = invoke(this, "payBoosting", [next], nil)
122- if ((in == in))
123- then in
124- else throw("Strict value is not equal to itself.")
125- }
126-
127- let payments = {
128- let $l = li
129- let $s = size($l)
130- let $acc0 = 0
131- func $f0_1 ($a,$i) = if (($i >= $s))
132- then $a
133- else f($a, $l[$i])
134-
135- func $f0_2 ($a,$i) = if (($i >= $s))
136- then $a
137- else throw("List size exceeds 56")
138-
139- $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)
140- }
141- if ((payments == payments))
142- then nil
143- else throw("Strict value is not equal to itself.")
144- }
145-
146-
147-
148-@Callable(i)
149-func endedBoostings (boostingId) = endedBoostingIds(boostingId)
150-
151-
152-
153-@Callable(i)
154-func entryEnded () = {
155- func f (accum,next) = {
156- let in = invoke(this, "endedBoostings", [next], nil)
157- if ((in == in))
158- then in
159- else throw("Strict value is not equal to itself.")
160- }
161-
162- let end = {
163- let $l = li
164- let $s = size($l)
165- let $acc0 = 0
166- func $f0_1 ($a,$i) = if (($i >= $s))
167- then $a
168- else f($a, $l[$i])
169-
170- func $f0_2 ($a,$i) = if (($i >= $s))
171- then $a
172- else throw("List size exceeds 56")
173-
174- $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)
175- }
176- if ((end == end))
177- then [IntegerEntry("height", height)]
178- else throw("Strict value is not equal to itself.")
179- }
180-
181-
182-
183-@Callable(i)
184-func deleteEntr (poolId) = [DeleteEntry((("pool_" + poolId) + "_boostings"))]
185-
186-
187-
188-@Callable(i)
189-func checkStr (boostingId) = {
190- let getFinishedPoolId1 = tryGetString((("boosting_" + boostingId) + "_poolId"))
191- let getPoolBoostings = tryGetString((("pool_" + getFinishedPoolId1) + "_boostings"))
192- let sizeStr = size(getPoolBoostings)
193- if ((indexOf(getPoolBoostings, boostingId) == unit))
194- then nil
195- else {
196- let findIndex = value(indexOf(getPoolBoostings, boostingId))
197- let modifierRight = if ((findIndex == 0))
198- then 2
199- else 1
200- let modifierLeft = if ((findIndex == 0))
201- then 0
202- else 1
203- let removeEndedBoostingID = (take(getPoolBoostings, (sizeStr - ((sizeStr - findIndex) + modifierLeft))) + takeRight(getPoolBoostings, (sizeStr - (findIndex + modifierRight))))
204-[StringEntry("getFinishedPoolId", getFinishedPoolId1), StringEntry("getPoolBoostings", getPoolBoostings), IntegerEntry("findIndex", findIndex), IntegerEntry("sizeStr", sizeStr), StringEntry("left string", take(getPoolBoostings, (sizeStr - (sizeStr - findIndex)))), StringEntry("right string", takeRight(getPoolBoostings, (sizeStr - (findIndex + modifierRight)))), StringEntry((("pool_" + getFinishedPoolId1) + "_boostings"), removeEndedBoostingID)]
205- }
206- }
207-
208-
209-
210-@Callable(i)
211-func remove (boostingId) = {
212- let getFinishedPoolId = tryGetString((("boosting_" + boostingId) + "_poolId"))
213- let getPoolBoostings = tryGetString((("pool_" + getFinishedPoolId) + "_boostings"))
214- let sizeStr = size(getPoolBoostings)
215- let findIndex = value(indexOf(getPoolBoostings, boostingId))
216- let modifierLeft = if ((findIndex == 0))
217- then 0
218- else 1
219- let modifierRight = if ((findIndex == 0))
220- then 2
221- else 1
222- let leftStr = take(getPoolBoostings, (sizeStr - ((sizeStr - findIndex) + modifierLeft)))
223- let rightStr = takeRight(getPoolBoostings, (sizeStr - (findIndex + modifierRight)))
224- let openBoostingsIds = (leftStr + rightStr)
225-[StringEntry("getFinishedPoolId", getFinishedPoolId), StringEntry("getPoolBoostings", getPoolBoostings), IntegerEntry("findIndex", findIndex), IntegerEntry("sizeStr", sizeStr), StringEntry("left string", leftStr), StringEntry("right string", rightStr), StringEntry("openBoostingsIds", openBoostingsIds), StringEntry((("pool_" + getFinishedPoolId) + "_boostings"), openBoostingsIds)]
226- }
227-
22835

github/deemru/w8io/169f3d6 
50.10 ms