106 | | - | func claimInvestPuzzle () = if ((i.caller != this)) |
---|
107 | | - | then throw("access only by project owner") |
---|
108 | | - | else { |
---|
109 | | - | let romeBalanceBefore = assetBalance(this, rome) |
---|
110 | | - | if ((romeBalanceBefore == romeBalanceBefore)) |
---|
111 | | - | then { |
---|
112 | | - | let claimPuzzleStaking = invoke(puzzleStaking, "claimReward", nil, nil) |
---|
113 | | - | if ((claimPuzzleStaking == claimPuzzleStaking)) |
---|
114 | | - | then { |
---|
115 | | - | let poolOneTokenInv = invoke(Address(base58'3PR1Qvi9mHT35SwWEkLSqqE2L8thiPLdVWU'), "generateIndexWithOneTokenAndStake", [toBase58String(poolBBB)], [AttachedPayment(puzzle, assetBalance(this, puzzle))]) |
---|
116 | | - | if ((poolOneTokenInv == poolOneTokenInv)) |
---|
117 | | - | then { |
---|
118 | | - | let romeBalanceAfter = assetBalance(this, rome) |
---|
119 | | - | [IntegerEntry("Activated blockheight", height), IntegerEntry(keyBurnxtnAmount, assetBalance(this, burnxtn)), IntegerEntry(keyRomeAmount, (romeBalanceAfter - romeBalanceBefore)), IntegerEntry(keyWavesAmount, if (((wavesBalance(this).available - d8) > 0)) |
---|
120 | | - | then (wavesBalance(this).available - d8) |
---|
121 | | - | else 0), IntegerEntry(keyWhirlpoolAmount, assetBalance(this, whirlpool))] |
---|
122 | | - | } |
---|
123 | | - | else throw("Strict value is not equal to itself.") |
---|
124 | | - | } |
---|
125 | | - | else throw("Strict value is not equal to itself.") |
---|
126 | | - | } |
---|
127 | | - | else throw("Strict value is not equal to itself.") |
---|
128 | | - | } |
---|
129 | | - | |
---|
130 | | - | |
---|
131 | | - | |
---|
132 | | - | @Callable(i) |
---|
133 | | - | func invoker1 () = { |
---|
134 | | - | let reset = invoke(this, "resetCount", nil, nil) |
---|
135 | | - | if ((reset == reset)) |
---|
136 | | - | then { |
---|
137 | | - | let list = split_4C(addresses, ",") |
---|
138 | | - | func r (accum,address) = invoke(this, "countNFTpower", [address], nil) |
---|
139 | | - | |
---|
140 | | - | let invoker = { |
---|
141 | | - | let $l = list |
---|
142 | | - | let $s = size($l) |
---|
143 | | - | let $acc0 = nil |
---|
144 | | - | func $f0_1 ($a,$i) = if (($i >= $s)) |
---|
145 | | - | then $a |
---|
146 | | - | else r($a, $l[$i]) |
---|
147 | | - | |
---|
148 | | - | func $f0_2 ($a,$i) = if (($i >= $s)) |
---|
149 | | - | then $a |
---|
150 | | - | else throw("List size exceeds 30") |
---|
151 | | - | |
---|
152 | | - | $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($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) |
---|
153 | | - | } |
---|
154 | | - | if ((invoker == invoker)) |
---|
155 | | - | then { |
---|
156 | | - | let p = invoke(this, "data", nil, nil) |
---|
157 | | - | if ((p == p)) |
---|
158 | | - | then [IntegerEntry("WFS puzzle value", fraction(fraction(tryGetInteger(this, keyTotalPuzzleValue), 1, tryGetInteger(this, keyTotalNFTpower)), 10, 9)), IntegerEntry("BBB puzzle value", fraction(fraction(tryGetInteger(this, keyTotalPuzzleValue), 10, tryGetInteger(this, keyTotalNFTpower)), 10, 9))] |
---|
159 | | - | else throw("Strict value is not equal to itself.") |
---|
160 | | - | } |
---|
161 | | - | else throw("Strict value is not equal to itself.") |
---|
162 | | - | } |
---|
163 | | - | else throw("Strict value is not equal to itself.") |
---|
164 | | - | } |
---|
165 | | - | |
---|
166 | | - | |
---|
167 | | - | |
---|
168 | | - | @Callable(i) |
---|
169 | | - | func resetCount () = [IntegerEntry(keyTotalNFTpower, 0)] |
---|
170 | | - | |
---|
171 | | - | |
---|
172 | | - | |
---|
173 | | - | @Callable(i) |
---|
174 | | - | func countNFTpower (address) = { |
---|
175 | | - | func foldFunc (acc,WFS) = ((acc + assetBalance(addressFromStringValue(address), fromBase58String(WFS))) + (if ((tryGetString(puzzleMarket, (("nft_" + WFS) + "_seller")) == address)) |
---|
176 | | - | then 1 |
---|
177 | | - | else 0)) |
---|
178 | | - | |
---|
179 | | - | let shareWFS = { |
---|
180 | | - | let $l = WFSlist |
---|
181 | | - | let $s = size($l) |
---|
182 | | - | let $acc0 = 0 |
---|
183 | | - | func $f0_1 ($a,$i) = if (($i >= $s)) |
---|
184 | | - | then $a |
---|
185 | | - | else foldFunc($a, $l[$i]) |
---|
186 | | - | |
---|
187 | | - | func $f0_2 ($a,$i) = if (($i >= $s)) |
---|
188 | | - | then $a |
---|
189 | | - | else throw("List size exceeds 10") |
---|
190 | | - | |
---|
191 | | - | $f0_2($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) |
---|
192 | | - | } |
---|
193 | | - | func foldFuncB (acc,BBB) = ((acc + assetBalance(addressFromStringValue(address), fromBase58String(BBB))) + (if ((tryGetString(puzzleMarket, (("nft_" + BBB) + "_seller")) == address)) |
---|
194 | | - | then 1 |
---|
195 | | - | else 0)) |
---|
196 | | - | |
---|
197 | | - | let shareBBB = { |
---|
198 | | - | let $l = BBBlist |
---|
199 | | - | let $s = size($l) |
---|
200 | | - | let $acc0 = 0 |
---|
201 | | - | func $f1_1 ($a,$i) = if (($i >= $s)) |
---|
202 | | - | then $a |
---|
203 | | - | else foldFuncB($a, $l[$i]) |
---|
204 | | - | |
---|
205 | | - | func $f1_2 ($a,$i) = if (($i >= $s)) |
---|
206 | | - | then $a |
---|
207 | | - | else throw("List size exceeds 10") |
---|
208 | | - | |
---|
209 | | - | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) |
---|
210 | | - | } |
---|
211 | | - | if (((shareWFS + shareBBB) == 0)) |
---|
212 | | - | then { |
---|
213 | | - | let list = split_4C(addresses, ",") |
---|
214 | | - | let noNFTindex = value(indexOf(list, address)) |
---|
215 | | - | let listMinusNoNFT = removeByIndex(list, noNFTindex) |
---|
216 | | - | let minusNoNFTstr = (makeString(listMinusNoNFT, ",") + ",") |
---|
217 | | - | [StringEntry(keyAddressesRegistered, minusNoNFTstr)] |
---|
218 | | - | } |
---|
219 | | - | else [IntegerEntry((address + "_WFS"), shareWFS), IntegerEntry((address + "_BBB"), (shareBBB * 10)), IntegerEntry(keyTotalNFTpower, (tryGetInteger(this, keyTotalNFTpower) + (shareWFS + (shareBBB * 10))))] |
---|
220 | | - | } |
---|
221 | | - | |
---|
222 | | - | |
---|
223 | | - | |
---|
224 | | - | @Callable(i) |
---|
225 | | - | func data () = [IntegerEntry("puzzle balance", assetBalance(this, puzzle)), IntegerEntry("puzzle staked", puzzleStaked), IntegerEntry("puzzle BBB LP", BBBlpInPuzzle), IntegerEntry(keyTotalPuzzleValue, ((assetBalance(this, puzzle) + puzzleStaked) + BBBlpInPuzzle))] |
---|
226 | | - | |
---|
227 | | - | |
---|
228 | | - | |
---|
229 | | - | @Callable(i) |
---|
230 | | - | func invoker2 () = if ((i.caller != this)) |
---|
231 | | - | then throw("access only by project owner") |
---|
232 | | - | else { |
---|
233 | | - | let t = invoke(this, "trackTotalPaid", nil, nil) |
---|
234 | | - | if ((t == t)) |
---|
235 | | - | then { |
---|
236 | | - | let list = split_4C(addresses, ",") |
---|
237 | | - | func r (accum,address) = invoke(this, "distributeRewards", [address], nil) |
---|
238 | | - | |
---|
239 | | - | let invoker = { |
---|
240 | | - | let $l = list |
---|
241 | | - | let $s = size($l) |
---|
242 | | - | let $acc0 = nil |
---|
243 | | - | func $f0_1 ($a,$i) = if (($i >= $s)) |
---|
244 | | - | then $a |
---|
245 | | - | else r($a, $l[$i]) |
---|
246 | | - | |
---|
247 | | - | func $f0_2 ($a,$i) = if (($i >= $s)) |
---|
248 | | - | then $a |
---|
249 | | - | else throw("List size exceeds 20") |
---|
250 | | - | |
---|
251 | | - | $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($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) |
---|
252 | | - | } |
---|
253 | | - | if ((invoker == invoker)) |
---|
254 | | - | then { |
---|
255 | | - | let bs = invoke(this, "burnSurf", nil, nil) |
---|
256 | | - | if ((bs == bs)) |
---|
257 | | - | then nil |
---|
258 | | - | else throw("Strict value is not equal to itself.") |
---|
259 | | - | } |
---|
260 | | - | else throw("Strict value is not equal to itself.") |
---|
261 | | - | } |
---|
262 | | - | else throw("Strict value is not equal to itself.") |
---|
263 | | - | } |
---|
264 | | - | |
---|
265 | | - | |
---|
266 | | - | |
---|
267 | | - | @Callable(i) |
---|
268 | | - | func trackTotalPaid () = { |
---|
269 | | - | let amountBurnxtn = tryGetInteger(this, keyBurnxtnAmount) |
---|
270 | | - | let amountWhirlpool = tryGetInteger(this, keyWhirlpoolAmount) |
---|
271 | | - | let amountWaves = tryGetInteger(this, keyWavesAmount) |
---|
272 | | - | let amountRome = tryGetInteger(this, keyRomeAmount) |
---|
273 | | - | [IntegerEntry(keyTotalBurnxtnPaid, (amountBurnxtn + tryGetInteger(this, keyTotalBurnxtnPaid))), IntegerEntry(keyTotalWhirlpoolPaid, (amountWhirlpool + tryGetInteger(this, keyTotalWhirlpoolPaid))), IntegerEntry(keyTotalWavesPaid, (amountWaves + tryGetInteger(this, keyTotalWavesPaid))), IntegerEntry(keyTotalRomePaid, (amountRome + tryGetInteger(this, keyTotalRomePaid)))] |
---|
274 | | - | } |
---|
275 | | - | |
---|
276 | | - | |
---|
277 | | - | |
---|
278 | | - | @Callable(i) |
---|
279 | | - | func distributeRewards (address) = if ((i.caller != this)) |
---|
280 | | - | then throw("access only by project owner") |
---|
281 | | - | else { |
---|
282 | | - | func foldFunc (acc,WFS) = ((acc + assetBalance(addressFromStringValue(address), fromBase58String(WFS))) + (if ((tryGetString(puzzleMarket, (("nft_" + WFS) + "_seller")) == address)) |
---|
283 | | - | then 1 |
---|
284 | | - | else 0)) |
---|
285 | | - | |
---|
286 | | - | let shareWFS = { |
---|
287 | | - | let $l = WFSlist |
---|
288 | | - | let $s = size($l) |
---|
289 | | - | let $acc0 = 0 |
---|
290 | | - | func $f0_1 ($a,$i) = if (($i >= $s)) |
---|
291 | | - | then $a |
---|
292 | | - | else foldFunc($a, $l[$i]) |
---|
293 | | - | |
---|
294 | | - | func $f0_2 ($a,$i) = if (($i >= $s)) |
---|
295 | | - | then $a |
---|
296 | | - | else throw("List size exceeds 10") |
---|
297 | | - | |
---|
298 | | - | $f0_2($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) |
---|
299 | | - | } |
---|
300 | | - | func foldFuncB (acc,BBB) = ((acc + assetBalance(addressFromStringValue(address), fromBase58String(BBB))) + (if ((tryGetString(puzzleMarket, (("nft_" + BBB) + "_seller")) == address)) |
---|
301 | | - | then 1 |
---|
302 | | - | else 0)) |
---|
303 | | - | |
---|
304 | | - | let shareBBB = { |
---|
305 | | - | let $l = BBBlist |
---|
306 | | - | let $s = size($l) |
---|
307 | | - | let $acc0 = 0 |
---|
308 | | - | func $f1_1 ($a,$i) = if (($i >= $s)) |
---|
309 | | - | then $a |
---|
310 | | - | else foldFuncB($a, $l[$i]) |
---|
311 | | - | |
---|
312 | | - | func $f1_2 ($a,$i) = if (($i >= $s)) |
---|
313 | | - | then $a |
---|
314 | | - | else throw("List size exceeds 10") |
---|
315 | | - | |
---|
316 | | - | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) |
---|
317 | | - | } |
---|
318 | | - | func foldFuncC (acc,SURFboard) = ((acc + assetBalance(addressFromStringValue(address), fromBase58String(SURFboard))) + (if ((tryGetString(puzzleMarket, (("nft_" + SURFboard) + "_seller")) == address)) |
---|
319 | | - | then 1 |
---|
320 | | - | else 0)) |
---|
321 | | - | |
---|
322 | | - | let amountSURFboard = { |
---|
323 | | - | let $l = SURFboardList |
---|
324 | | - | let $s = size($l) |
---|
325 | | - | let $acc0 = 0 |
---|
326 | | - | func $f2_1 ($a,$i) = if (($i >= $s)) |
---|
327 | | - | then $a |
---|
328 | | - | else foldFuncC($a, $l[$i]) |
---|
329 | | - | |
---|
330 | | - | func $f2_2 ($a,$i) = if (($i >= $s)) |
---|
331 | | - | then $a |
---|
332 | | - | else throw("List size exceeds 20") |
---|
333 | | - | |
---|
334 | | - | $f2_2($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) |
---|
335 | | - | } |
---|
336 | | - | let amountBurnxtn = fraction(tryGetInteger(this, keyBurnxtnAmount), (shareWFS + (shareBBB * 10)), tryGetInteger(this, keyTotalNFTpower)) |
---|
337 | | - | let amountWhirlpool = fraction(tryGetInteger(this, keyWhirlpoolAmount), (shareWFS + (shareBBB * 10)), tryGetInteger(this, keyTotalNFTpower)) |
---|
338 | | - | let amountWaves = fraction(tryGetInteger(this, keyWavesAmount), (shareWFS + (shareBBB * 10)), tryGetInteger(this, keyTotalNFTpower)) |
---|
339 | | - | let amountRome = fraction(tryGetInteger(this, keyRomeAmount), (shareWFS + (shareBBB * 10)), tryGetInteger(this, keyTotalNFTpower)) |
---|
340 | | - | [ScriptTransfer(addressFromStringValue(address), amountBurnxtn, burnxtn), ScriptTransfer(addressFromStringValue(address), amountWhirlpool, whirlpool), ScriptTransfer(addressFromStringValue(address), amountWaves, unit), ScriptTransfer(addressFromStringValue(address), amountRome, rome), ScriptTransfer(addressFromStringValue(address), (amountSURFboard * d6), surf)] |
---|
341 | | - | } |
---|
342 | | - | |
---|
343 | | - | |
---|
344 | | - | |
---|
345 | | - | @Callable(i) |
---|
346 | | - | func burnSurf () = [Burn(surf, d6), IntegerEntry("SURF total burned", (tryGetInteger(this, "SURF total burned") + d6))] |
---|
347 | | - | |
---|
348 | | - | |
---|
349 | | - | |
---|
350 | | - | @Callable(i) |
---|
351 | | - | func register () = if (contains(tryGetString(this, keyAddressesRegistered), toString(i.caller))) |
---|
352 | | - | then throw("already registered") |
---|
353 | | - | else if ((size(split_4C(addresses, ",")) == 30)) |
---|
354 | | - | then throw("max reached") |
---|
355 | | - | else [StringEntry(keyAddressesRegistered, ((tryGetString(this, keyAddressesRegistered) + toString(i.caller)) + ","))] |
---|
356 | | - | |
---|
357 | | - | |
---|
358 | | - | |
---|
359 | | - | @Callable(i) |
---|
360 | | - | func registerManually (address) = if (contains(tryGetString(this, keyAddressesRegistered), address)) |
---|
361 | | - | then throw("already registered") |
---|
362 | | - | else if ((size(split_4C(addresses, ",")) == 40)) |
---|
363 | | - | then throw("max reached") |
---|
364 | | - | else if ((i.caller != this)) |
---|
365 | | - | then throw("access only by project owner") |
---|
366 | | - | else [StringEntry(keyAddressesRegistered, ((tryGetString(this, keyAddressesRegistered) + address) + ","))] |
---|
367 | | - | |
---|
368 | | - | |
---|
369 | | - | |
---|
370 | | - | @Callable(i) |
---|
371 | | - | func claimByAnybody () = if (((getIntegerValue(this, "Activated blockheight") + (30 * 1440)) > height)) |
---|
372 | | - | then throw(("Wait till blockheight:" + toString((getIntegerValue(this, "Activated blockheight") + (30 * 1440))))) |
---|
373 | | - | else { |
---|
374 | | - | let puzzleBalanceBefore = assetBalance(this, puzzle) |
---|
375 | | - | if ((puzzleBalanceBefore == puzzleBalanceBefore)) |
---|
376 | | - | then { |
---|
377 | | - | let romeBalanceBefore = assetBalance(this, rome) |
---|
378 | | - | if ((romeBalanceBefore == romeBalanceBefore)) |
---|
379 | | - | then { |
---|
380 | | - | let claimPuzzleStaking = invoke(puzzleStaking, "claimReward", nil, nil) |
---|
381 | | - | if ((claimPuzzleStaking == claimPuzzleStaking)) |
---|
382 | | - | then { |
---|
383 | | - | let claimInv = invoke(Address(poolBBB), "claimIndexRewards", nil, nil) |
---|
384 | | - | if ((claimInv == claimInv)) |
---|
385 | | - | then { |
---|
386 | | - | let puzzleBalanceAfter = assetBalance(this, puzzle) |
---|
387 | | - | let romeBalanceAfter = assetBalance(this, rome) |
---|
388 | | - | [IntegerEntry(keyBurnxtnAmount, assetBalance(this, burnxtn)), IntegerEntry(keyRomeAmount, (romeBalanceAfter - romeBalanceBefore)), IntegerEntry(keyPuzzleAmount, (puzzleBalanceAfter - puzzleBalanceBefore)), IntegerEntry(keyWavesAmount, if (((wavesBalance(this).available - d8) > 0)) |
---|
389 | | - | then (wavesBalance(this).available - d8) |
---|
390 | | - | else 0), IntegerEntry(keyWhirlpoolAmount, assetBalance(this, whirlpool))] |
---|
391 | | - | } |
---|
392 | | - | else throw("Strict value is not equal to itself.") |
---|
393 | | - | } |
---|
394 | | - | else throw("Strict value is not equal to itself.") |
---|
395 | | - | } |
---|
396 | | - | else throw("Strict value is not equal to itself.") |
---|
397 | | - | } |
---|
398 | | - | else throw("Strict value is not equal to itself.") |
---|
399 | | - | } |
---|
400 | | - | |
---|
401 | | - | |
---|
402 | | - | |
---|
403 | | - | @Callable(i) |
---|
404 | | - | func invokerByAnybody () = if (((getIntegerValue(this, "Activated blockheight") + (30 * 1440)) > height)) |
---|
405 | | - | then throw(("Wait till blockheight:" + toString((getIntegerValue(this, "Activated blockheight") + (30 * 1440))))) |
---|
406 | | - | else { |
---|
407 | | - | let reset = invoke(this, "distributeRewardsByAnybody", nil, nil) |
---|
408 | | - | if ((reset == reset)) |
---|
409 | | - | then { |
---|
410 | | - | let list = split_4C(addresses, ",") |
---|
411 | | - | func r (accum,address) = invoke(this, "countNFTpower", [address], nil) |
---|
412 | | - | |
---|
413 | | - | let invoker = { |
---|
414 | | - | let $l = list |
---|
415 | | - | let $s = size($l) |
---|
416 | | - | let $acc0 = nil |
---|
417 | | - | func $f0_1 ($a,$i) = if (($i >= $s)) |
---|
418 | | - | then $a |
---|
419 | | - | else r($a, $l[$i]) |
---|
420 | | - | |
---|
421 | | - | func $f0_2 ($a,$i) = if (($i >= $s)) |
---|
422 | | - | then $a |
---|
423 | | - | else throw("List size exceeds 40") |
---|
424 | | - | |
---|
425 | | - | $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($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) |
---|
426 | | - | } |
---|
427 | | - | if ((invoker == invoker)) |
---|
428 | | - | then nil |
---|
429 | | - | else throw("Strict value is not equal to itself.") |
---|
430 | | - | } |
---|
431 | | - | else throw("Strict value is not equal to itself.") |
---|
432 | | - | } |
---|
433 | | - | |
---|
434 | | - | |
---|
435 | | - | |
---|
436 | | - | @Callable(i) |
---|
437 | | - | func distributeRewardsByAnybody (address) = if ((i.caller != this)) |
---|
438 | | - | then throw("access only by project owner") |
---|
439 | | - | else { |
---|
440 | | - | func foldFunc (acc,WFS) = ((acc + assetBalance(addressFromStringValue(address), fromBase58String(WFS))) + (if ((tryGetString(puzzleMarket, (("nft_" + WFS) + "_seller")) == address)) |
---|
441 | | - | then 1 |
---|
442 | | - | else 0)) |
---|
443 | | - | |
---|
444 | | - | let shareWFS = { |
---|
445 | | - | let $l = WFSlist |
---|
446 | | - | let $s = size($l) |
---|
447 | | - | let $acc0 = 0 |
---|
448 | | - | func $f0_1 ($a,$i) = if (($i >= $s)) |
---|
449 | | - | then $a |
---|
450 | | - | else foldFunc($a, $l[$i]) |
---|
451 | | - | |
---|
452 | | - | func $f0_2 ($a,$i) = if (($i >= $s)) |
---|
453 | | - | then $a |
---|
454 | | - | else throw("List size exceeds 10") |
---|
455 | | - | |
---|
456 | | - | $f0_2($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) |
---|
457 | | - | } |
---|
458 | | - | func foldFuncB (acc,BBB) = ((acc + assetBalance(addressFromStringValue(address), fromBase58String(BBB))) + (if ((tryGetString(puzzleMarket, (("nft_" + BBB) + "_seller")) == address)) |
---|
459 | | - | then 1 |
---|
460 | | - | else 0)) |
---|
461 | | - | |
---|
462 | | - | let shareBBB = { |
---|
463 | | - | let $l = BBBlist |
---|
464 | | - | let $s = size($l) |
---|
465 | | - | let $acc0 = 0 |
---|
466 | | - | func $f1_1 ($a,$i) = if (($i >= $s)) |
---|
467 | | - | then $a |
---|
468 | | - | else foldFuncB($a, $l[$i]) |
---|
469 | | - | |
---|
470 | | - | func $f1_2 ($a,$i) = if (($i >= $s)) |
---|
471 | | - | then $a |
---|
472 | | - | else throw("List size exceeds 10") |
---|
473 | | - | |
---|
474 | | - | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) |
---|
475 | | - | } |
---|
476 | | - | if (((shareWFS + shareBBB) == 0)) |
---|
477 | | - | then { |
---|
478 | | - | let list = split_4C(addresses, ",") |
---|
479 | | - | let noNFTindex = value(indexOf(list, address)) |
---|
480 | | - | let listMinusNoNFT = removeByIndex(list, noNFTindex) |
---|
481 | | - | let minusNoNFTstr = (makeString(listMinusNoNFT, ",") + ",") |
---|
482 | | - | [StringEntry(keyAddressesRegistered, minusNoNFTstr)] |
---|
483 | | - | } |
---|
484 | | - | else { |
---|
485 | | - | let amountBurnxtn = fraction(tryGetInteger(this, keyBurnxtnAmount), (shareWFS + (shareBBB * 10)), tryGetInteger(this, keyTotalNFTpower)) |
---|
486 | | - | let amountWhirlpool = fraction(tryGetInteger(this, keyWhirlpoolAmount), (shareWFS + (shareBBB * 10)), tryGetInteger(this, keyTotalNFTpower)) |
---|
487 | | - | let amountWaves = fraction(tryGetInteger(this, keyWavesAmount), (shareWFS + (shareBBB * 10)), tryGetInteger(this, keyTotalNFTpower)) |
---|
488 | | - | let amountRome = fraction(tryGetInteger(this, keyRomeAmount), (shareWFS + (shareBBB * 10)), tryGetInteger(this, keyTotalNFTpower)) |
---|
489 | | - | let amountPuzzle = fraction(tryGetInteger(this, keyPuzzleAmount), (shareWFS + (shareBBB * 10)), tryGetInteger(this, keyTotalNFTpower)) |
---|
490 | | - | [ScriptTransfer(addressFromStringValue(address), amountBurnxtn, burnxtn), IntegerEntry(keyTotalBurnxtnPaid, (amountBurnxtn + tryGetInteger(this, keyTotalBurnxtnPaid))), ScriptTransfer(addressFromStringValue(address), amountWhirlpool, whirlpool), IntegerEntry(keyTotalWhirlpoolPaid, (amountWhirlpool + tryGetInteger(this, keyTotalWhirlpoolPaid))), ScriptTransfer(addressFromStringValue(address), amountWaves, unit), IntegerEntry(keyTotalWavesPaid, (amountWaves + tryGetInteger(this, keyTotalWavesPaid))), ScriptTransfer(addressFromStringValue(address), amountRome, rome), IntegerEntry(keyTotalRomePaid, (amountRome + tryGetInteger(this, keyTotalRomePaid))), ScriptTransfer(addressFromStringValue(address), amountPuzzle, puzzle), IntegerEntry(keyTotalPuzzlePaid, (amountPuzzle + tryGetInteger(this, keyTotalPuzzlePaid)))] |
---|
491 | | - | } |
---|
492 | | - | } |
---|
493 | | - | |
---|
494 | | - | |
---|
495 | | - | |
---|
496 | | - | @Callable(i) |
---|
497 | | - | func deleteEntry () = if ((i.caller != this)) |
---|
498 | | - | then throw("access only by project owner") |
---|
499 | | - | else [DeleteEntry(keyAddressesRegistered)] |
---|
500 | | - | |
---|
501 | | - | |
---|
502 | | - | |
---|
503 | | - | @Callable(i) |
---|
504 | | - | func addWFSid (WFSnumber,WFSassetId) = if ((i.caller != this)) |
---|
505 | | - | then throw("access only by project owner") |
---|
506 | | - | else [StringEntry((WFSnumber + ""), WFSassetId)] |
---|
507 | | - | |
---|
508 | | - | |
---|
509 | | - | |
---|
510 | | - | @Callable(i) |
---|
511 | | - | func changeIntegerEntry (keyString,integer) = if ((i.caller != this)) |
---|
512 | | - | then throw("access only by project owner") |
---|
513 | | - | else [IntegerEntry(keyString, integer)] |
---|
514 | | - | |
---|
515 | | - | |
---|
516 | | - | |
---|
517 | | - | @Callable(i) |
---|
518 | | - | func checkMarketEntry (BBB,address) = [IntegerEntry("NFTs on market", if ((getStringValue(puzzleMarket, (("nft_" + BBB) + "_seller")) == address)) |
---|
519 | | - | then 1 |
---|
520 | | - | else 0)] |
---|
| 7 | + | func call () = [StringEntry("amp", getStringValue(Address(base58'3PJazesjmprZcXYcFx3LxBux9T7q6qYoEDu'), "amp"))] |
---|