tx · ABZJApoav1djP3Q64dvmHhpTDBBHf38dSLwmbhoBPpAx 3MqEAEVk1NcbRAuEPAX7nyzUqMHbhvRofez: -0.00700000 Waves 2023.11.08 11:43 [2834156] smart account 3MqEAEVk1NcbRAuEPAX7nyzUqMHbhvRofez > SELF 0.00000000 Waves
{ "type": 13, "id": "ABZJApoav1djP3Q64dvmHhpTDBBHf38dSLwmbhoBPpAx", "fee": 700000, "feeAssetId": null, "timestamp": 1699433030531, "version": 2, "chainId": 84, "sender": "3MqEAEVk1NcbRAuEPAX7nyzUqMHbhvRofez", "senderPublicKey": "Brp6cacBXyKUcZr5Uc6VDKsnFcaEeQ8nQzrZQyobDsuf", "proofs": [ "wwNfaf5GR5GTYJqH7aF8aVE3o7iMFJgypRV3gMTtarz5CoR2m2qxNAuGT2vbpdpCrnAytbLU9LhV612AyPP6uu6" ], "script": "base64:BgIWCAISBAoCCAESAwoBCBIAEgMKAQgSAAkAAmxpCQDMCAICATEJAMwIAgIBMgkAzAgCAgEzCQDMCAICATQJAMwIAgIBNQkAzAgCAgE2CQDMCAICATcJAMwIAgIBOAkAzAgCAgE5CQDMCAICAjEwCQDMCAICAjExCQDMCAICAjEyCQDMCAICAjEzCQDMCAICAjE0CQDMCAICAjE1CQDMCAICAjE2CQDMCAICAjE3CQDMCAICAjE4CQDMCAICAjE5CQDMCAICAjIwCQDMCAICAjIxCQDMCAICAjIyCQDMCAICAjIzCQDMCAICAjI0CQDMCAICAjI1CQDMCAICAjI2CQDMCAICAjI3CQDMCAICAjI4CQDMCAICAjI5CQDMCAICAjMwCQDMCAICAjMxCQDMCAICAjMyCQDMCAICAjMzCQDMCAICAjM0CQDMCAICAjM1CQDMCAICAjM2CQDMCAICAjM3CQDMCAICAjM4CQDMCAICAjM5CQDMCAICAjQwCQDMCAICAjQxCQDMCAICAjQyCQDMCAICAjQzCQDMCAICAjQ0CQDMCAICAjQ1CQDMCAICAjQ2CQDMCAICAjQ3CQDMCAICAjQ4CQDMCAICAjQ5CQ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fMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIFBSRhY2MwAAAAAQACAAMABAAFAAYABwAIAAkACgALAAwADQAOAA8AEAARABIAEwAUABUAFgAXABgAGQAaABsAHAAdAB4AHwAgACEAIgAjACQAJQAmACcAKAApACoAKwAsAC0ALgAvADAAMQAyADMANAA1ADYANwA4AwkAAAIFA2VuZAUDZW5kCQDMCAIJAQxJbnRlZ2VyRW50cnkCAgZoZWlnaHQFBmhlaWdodAUDbmlsCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuALqOLDc=", "height": 2834156, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 7wux38rZdW27DZqpVSCdLyUnKf1Vz96ST24zmTKrf1Cr Next: GKFECfCpKP3NdGxAgoJuUGPeoLHA7w3JPshyyukBbV5R Diff:
Old | New | Differences | |
---|---|---|---|
79 | 79 | if ((height == tryGetInteger("height"))) | |
80 | 80 | then throw("wait 1 minute") | |
81 | 81 | else { | |
82 | - | let entry = invoke(this, "entryEnded", nil, nil) | |
82 | + | let entry = if ((size(tryGetString((("pool_" + poolId) + "_boostings"))) > 11)) | |
83 | + | then throw("max 5 boosts per pool") | |
84 | + | else invoke(this, "entryEnded", nil, nil) | |
83 | 85 | if ((entry == entry)) | |
84 | 86 | then { | |
85 | - | let get = invoke(this, "firstEndedBoostingId", nil, nil) | |
86 | - | if ((get == get)) | |
87 | - | then { | |
88 | - | let boostingId = tryGetString("first") | |
89 | - | if ((addressFromString(poolId) == unit)) | |
90 | - | then throw("incorrect pool address") | |
91 | - | 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) + ","))] | |
92 | - | } | |
93 | - | else throw("Strict value is not equal to itself.") | |
87 | + | let boostingId = if ((take(tryGetString((("list ended " + toString(height)) + " boostingIds")), 1) == "0")) | |
88 | + | then throw("wait till other boosts are finished") | |
89 | + | else take(tryGetString((("list ended " + toString(height)) + " boostingIds")), 1) | |
90 | + | if ((addressFromString(poolId) == unit)) | |
91 | + | then throw("incorrect pool address") | |
92 | + | 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) + ","))] | |
94 | 93 | } | |
95 | 94 | else throw("Strict value is not equal to itself.") | |
96 | 95 | } | |
168 | 167 | } | |
169 | 168 | ||
170 | 169 | ||
171 | - | ||
172 | - | @Callable(i) | |
173 | - | func firstEndedBoostingId () = { | |
174 | - | let StrValue = take(tryGetString((("list ended " + toString(height)) + " boostingIds")), 1) | |
175 | - | [StringEntry("first", StrValue)] | |
176 | - | } | |
177 | - | ||
178 | - |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 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 | 5 | ||
6 | 6 | let hours = 1 | |
7 | 7 | ||
8 | 8 | let minutes = 10 | |
9 | 9 | ||
10 | 10 | func tryGetInteger (key) = match getInteger(this, key) { | |
11 | 11 | case b: Int => | |
12 | 12 | b | |
13 | 13 | case _ => | |
14 | 14 | 0 | |
15 | 15 | } | |
16 | 16 | ||
17 | 17 | ||
18 | 18 | func tryGetString (key) = match getString(this, key) { | |
19 | 19 | case b: String => | |
20 | 20 | b | |
21 | 21 | case _ => | |
22 | 22 | "" | |
23 | 23 | } | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | func getAssetString (assetId) = match assetId { | |
27 | 27 | case b: ByteVector => | |
28 | 28 | toBase58String(b) | |
29 | 29 | case _ => | |
30 | 30 | "WAVES" | |
31 | 31 | } | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func getAssetBytes (assetIdStr) = if ((assetIdStr == "WAVES")) | |
35 | 35 | then unit | |
36 | 36 | else fromBase58String(assetIdStr) | |
37 | 37 | ||
38 | 38 | ||
39 | 39 | func payBoostingResult (boostingId) = { | |
40 | 40 | let lastHeight = tryGetInteger((("boosting_" + boostingId) + "_lastHeight")) | |
41 | 41 | let finishHeight = tryGetInteger((("boosting_" + boostingId) + "_finishHeight")) | |
42 | 42 | let getFinishedPoolId = tryGetString((("boosting_" + boostingId) + "_poolId")) | |
43 | 43 | let getPoolBoostings = dropRight(tryGetString((("pool_" + getFinishedPoolId) + "_boostings")), 1) | |
44 | 44 | let findIndex = value(indexOf(getPoolBoostings, boostingId)) | |
45 | 45 | if (if ((lastHeight != 0)) | |
46 | 46 | then (finishHeight > lastHeight) | |
47 | 47 | else false) | |
48 | 48 | then { | |
49 | 49 | let blockReward = (tryGetInteger((("boosting_" + boostingId) + "_totalAmount")) / ((tryGetInteger((("boosting_" + boostingId) + "_days")) * hours) * minutes)) | |
50 | 50 | let toPay = fraction((min([finishHeight, height]) - lastHeight), blockReward, 1) | |
51 | 51 | [IntegerEntry((("boosting_" + boostingId) + "_lastHeight"), height), ScriptTransfer(addressFromStringValue(tryGetString((("boosting_" + boostingId) + "_poolId"))), toPay, getAssetBytes(tryGetString((("boosting_" + boostingId) + "_assetId")))), StringEntry("getFinishedPoolId", getFinishedPoolId), StringEntry("getPoolBoostings", getPoolBoostings), IntegerEntry("findIndex", findIndex)] | |
52 | 52 | } | |
53 | 53 | else nil | |
54 | 54 | } | |
55 | 55 | ||
56 | 56 | ||
57 | 57 | func endedBoostingIds (boostingId) = { | |
58 | 58 | let lastHeight = tryGetInteger((("boosting_" + boostingId) + "_lastHeight")) | |
59 | 59 | let finishHeight = tryGetInteger((("boosting_" + boostingId) + "_finishHeight")) | |
60 | 60 | if ((lastHeight >= finishHeight)) | |
61 | 61 | then [StringEntry((("list ended " + toString(height)) + " boostingIds"), ((tryGetString((("list ended " + toString(height)) + " boostingIds")) + boostingId) + ","))] | |
62 | 62 | else nil | |
63 | 63 | } | |
64 | 64 | ||
65 | 65 | ||
66 | 66 | @Callable(i) | |
67 | 67 | func addBoosting (poolId,days) = if ((1 > days)) | |
68 | 68 | then throw("amount of days has to be between 1 and 365") | |
69 | 69 | else if ((days > 365)) | |
70 | 70 | then throw("amount of days has to be between 1 and 365") | |
71 | 71 | else if (false) | |
72 | 72 | then throw("under maintenance until further notice") | |
73 | 73 | else { | |
74 | 74 | let fullAmount = i.payments[0].amount | |
75 | 75 | if ((1440 > (fullAmount / days))) | |
76 | 76 | then throw((("boosting amount too small, minimum is " + toString((1440 * days))) + " of the smallest unit of payment asset")) | |
77 | 77 | else { | |
78 | 78 | let assetId = getAssetString(i.payments[0].assetId) | |
79 | 79 | if ((height == tryGetInteger("height"))) | |
80 | 80 | then throw("wait 1 minute") | |
81 | 81 | else { | |
82 | - | let entry = invoke(this, "entryEnded", nil, nil) | |
82 | + | let entry = if ((size(tryGetString((("pool_" + poolId) + "_boostings"))) > 11)) | |
83 | + | then throw("max 5 boosts per pool") | |
84 | + | else invoke(this, "entryEnded", nil, nil) | |
83 | 85 | if ((entry == entry)) | |
84 | 86 | then { | |
85 | - | let get = invoke(this, "firstEndedBoostingId", nil, nil) | |
86 | - | if ((get == get)) | |
87 | - | then { | |
88 | - | let boostingId = tryGetString("first") | |
89 | - | if ((addressFromString(poolId) == unit)) | |
90 | - | then throw("incorrect pool address") | |
91 | - | 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) + ","))] | |
92 | - | } | |
93 | - | else throw("Strict value is not equal to itself.") | |
87 | + | let boostingId = if ((take(tryGetString((("list ended " + toString(height)) + " boostingIds")), 1) == "0")) | |
88 | + | then throw("wait till other boosts are finished") | |
89 | + | else take(tryGetString((("list ended " + toString(height)) + " boostingIds")), 1) | |
90 | + | if ((addressFromString(poolId) == unit)) | |
91 | + | then throw("incorrect pool address") | |
92 | + | 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) + ","))] | |
94 | 93 | } | |
95 | 94 | else throw("Strict value is not equal to itself.") | |
96 | 95 | } | |
97 | 96 | } | |
98 | 97 | } | |
99 | 98 | ||
100 | 99 | ||
101 | 100 | ||
102 | 101 | @Callable(i) | |
103 | 102 | func payBoosting (boostingId) = payBoostingResult(boostingId) | |
104 | 103 | ||
105 | 104 | ||
106 | 105 | ||
107 | 106 | @Callable(i) | |
108 | 107 | func payBoostings () = { | |
109 | 108 | func f (accum,next) = { | |
110 | 109 | let in = invoke(this, "payBoosting", [next], nil) | |
111 | 110 | if ((in == in)) | |
112 | 111 | then in | |
113 | 112 | else throw("Strict value is not equal to itself.") | |
114 | 113 | } | |
115 | 114 | ||
116 | 115 | let payments = { | |
117 | 116 | let $l = li | |
118 | 117 | let $s = size($l) | |
119 | 118 | let $acc0 = 0 | |
120 | 119 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
121 | 120 | then $a | |
122 | 121 | else f($a, $l[$i]) | |
123 | 122 | ||
124 | 123 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
125 | 124 | then $a | |
126 | 125 | else throw("List size exceeds 56") | |
127 | 126 | ||
128 | 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) | |
129 | 128 | } | |
130 | 129 | if ((payments == payments)) | |
131 | 130 | then nil | |
132 | 131 | else throw("Strict value is not equal to itself.") | |
133 | 132 | } | |
134 | 133 | ||
135 | 134 | ||
136 | 135 | ||
137 | 136 | @Callable(i) | |
138 | 137 | func endedBoostings (boostingId) = endedBoostingIds(boostingId) | |
139 | 138 | ||
140 | 139 | ||
141 | 140 | ||
142 | 141 | @Callable(i) | |
143 | 142 | func entryEnded () = { | |
144 | 143 | func f (accum,next) = { | |
145 | 144 | let in = invoke(this, "endedBoostings", [next], nil) | |
146 | 145 | if ((in == in)) | |
147 | 146 | then in | |
148 | 147 | else throw("Strict value is not equal to itself.") | |
149 | 148 | } | |
150 | 149 | ||
151 | 150 | let end = { | |
152 | 151 | let $l = li | |
153 | 152 | let $s = size($l) | |
154 | 153 | let $acc0 = 0 | |
155 | 154 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
156 | 155 | then $a | |
157 | 156 | else f($a, $l[$i]) | |
158 | 157 | ||
159 | 158 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
160 | 159 | then $a | |
161 | 160 | else throw("List size exceeds 56") | |
162 | 161 | ||
163 | 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) | |
164 | 163 | } | |
165 | 164 | if ((end == end)) | |
166 | 165 | then [IntegerEntry("height", height)] | |
167 | 166 | else throw("Strict value is not equal to itself.") | |
168 | 167 | } | |
169 | 168 | ||
170 | 169 | ||
171 | - | ||
172 | - | @Callable(i) | |
173 | - | func firstEndedBoostingId () = { | |
174 | - | let StrValue = take(tryGetString((("list ended " + toString(height)) + " boostingIds")), 1) | |
175 | - | [StringEntry("first", StrValue)] | |
176 | - | } | |
177 | - | ||
178 | - |
github/deemru/w8io/026f985 47.35 ms ◑