tx · 4Y8Z9cWR9s7QZzhiaCcLXpTb9WX3r2zFV7jvbgoqHAu6 3N85YW6NZ9pLYvSdt1ASMQTGxvncnU1vUNx: -0.10000000 Waves 2022.11.25 14:07 [2332550] smart account 3N85YW6NZ9pLYvSdt1ASMQTGxvncnU1vUNx > SELF 0.00000000 Waves
{ "type": 13, "id": "4Y8Z9cWR9s7QZzhiaCcLXpTb9WX3r2zFV7jvbgoqHAu6", "fee": 10000000, "feeAssetId": null, "timestamp": 1669374429011, "version": 2, "chainId": 84, "sender": "3N85YW6NZ9pLYvSdt1ASMQTGxvncnU1vUNx", "senderPublicKey": "EKZmHJ5bK3qKKgRdq8rAamt9qrDbVMLARzRqXoQW258v", "proofs": [ "5SQnMW1d6ZAZAipyhMCg59vxfoYZQHEMDqB8d1rhqDdWYyAC2x8KhKBFeR6DCMJecg2PmCFuk8qWkGxpFTL4MJ32" ], "script": "base64:BgJACAISCwoJCAgICAgBCAgIEgQKAggIEgMKAQgSAwoBARIDCgEBEgUKAwEBARIDCgEIEgMKAQgSAwoBCBIECgIIAScACXNlcGFyYXRvcgIBXwAIa0F1Y3Rpb24CB2F1Y3Rpb24ABWtTZWxsAgRzZWxsAAhrVHJ1c3RlZAIHdHJ1c3RlZAAGa1ByaWNlAgVwcmljZQEKZ2V0U2xvdEtleQIGcHJlZml4BW5mdElkCQCsAgIJAKwCAgUGcHJlZml4BQlzZXBhcmF0b3IJANgEAQUFbmZ0SWQBC2dldFByaWNlS2V5AQVuZnRJZAkArAICCQCsAgIFBmtQcmljZQUJc2VwYXJhdG9yCQDYBAEFBW5mdElkAQpnZXRTZWxsS2V5AQVuZnRJZAkArAICCQCsAgIFBWtTZWxsBQlzZXBhcmF0b3IJANgEAQUFbmZ0SWQBDWdldEF1Y3Rpb25LZXkBBW5mdElkCQCsAgIJAKwCAgUIa0F1Y3Rpb24FCXNlcGFyYXRvcgkA2AQBBQVuZnRJZAENZ2V0VHJ1c3RlZEtleQEGaXNzdWVyCQCsAgIJAK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VHJhbnNmZXIDBQZzZWxsZXIAAQUHYXNzZXRJZAUDbmlsAWkBEHNldFRydXN0ZWRJc3N1ZXIBC3RydXN0ZWRBZGRyAwkBASEBCQEHaXNBZG1pbgEIBQFpBmNhbGxlcgkAAgECCk9ubHkgYWRtaW4JAMwIAgkBDEJvb2xlYW5FbnRyeQIJAQ1nZXRUcnVzdGVkS2V5AQkBEUBleHRyTmF0aXZlKDEwNjIpAQULdHJ1c3RlZEFkZHIGBQNuaWwBaQEXZ2V0UHJpY2VBdEN1cnJlbnRNb21lbnQCBW5mdElkBm1vbWVudAQHYXNzZXRJZAkA2QQBBQVuZnRJZAQNJHQwMTA3MDUxMDc2OAkBGGNhbGNQcmljZUF0Q3VycmVudE1vbWVudAIFB2Fzc2V0SWQFBm1vbWVudAQGc2VsbGVyCAUNJHQwMTA3MDUxMDc2OAJfMQQFcHJpY2UIBQ0kdDAxMDcwNTEwNzY4Al8yCQDMCAIJAQxJbnRlZ2VyRW50cnkCCQELZ2V0UHJpY2VLZXkBBQdhc3NldElkBQVwcmljZQUDbmlsAP4CYgQ=", "height": 2332550, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: E9ev8VUisQ1ZrXJzscSL3RuN2uYxYKQXNvC6h8ejX6F3 Next: GAVjSyw788D5FD3fn21cAdgK7oG8eLzEHkbqjJFBnxBE Diff:
Old | New | Differences | |
---|---|---|---|
192 | 192 | func isCorrectSellPrice (price) = (price > 0) | |
193 | 193 | ||
194 | 194 | ||
195 | - | func isCorrectAuctionPeriod (start,end) = (end > start) | |
196 | - | ||
197 | - | ||
198 | 195 | func isCorrectAuctionPrices (startPrice,endPrice) = (startPrice > endPrice) | |
199 | 196 | ||
200 | 197 | ||
291 | 288 | ||
292 | 289 | @Callable(i) | |
293 | 290 | func sellNFT (price) = { | |
294 | - | let $ | |
295 | - | let token0 = $ | |
296 | - | let amount0 = $ | |
291 | + | let $t074157500 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) | |
292 | + | let token0 = $t074157500._1 | |
293 | + | let amount0 = $t074157500._2 | |
297 | 294 | if (!(isNft(token0))) | |
298 | 295 | then throw("Token is not NFT") | |
299 | 296 | else [StringEntry(((kPrice + separator) + toBase58String(value(i.payments[0].assetId))), toString(price)), StringEntry(((toString(i.caller) + separator) + kSell), ((toBase58String(token0) + separator) + toString(amount0)))] | |
314 | 311 | @Callable(i) | |
315 | 312 | func addAuction (startPrice,start,end) = { | |
316 | 313 | let nftId = value(i.payments[0].assetId) | |
317 | - | valueOrElse(isCorrectNft(nftId), if (!(isCorrectAuctionPeriod(start, end))) | |
318 | - | then throw("Period is not correct") | |
319 | - | else [setAuction(i.caller, nftId, startPrice, start, end), StringEntry(((toBase58String(nftId) + separator) + "nft_owner"), toString(i.caller))]) | |
314 | + | valueOrElse(isCorrectNft(nftId), [setAuction(i.caller, nftId, startPrice, start, end), StringEntry(((toBase58String(nftId) + separator) + "nft_owner"), toString(i.caller))]) | |
320 | 315 | } | |
321 | 316 | ||
322 | 317 | ||
323 | 318 | ||
324 | 319 | @Callable(i) | |
325 | 320 | func buyFromSlot (nftId) = { | |
326 | - | let $ | |
327 | - | let paymentAsset = $ | |
328 | - | let paymentAmount = $ | |
321 | + | let $t084158504 = $Tuple2(i.payments[0].assetId, value(i.payments[0].amount)) | |
322 | + | let paymentAsset = $t084158504._1 | |
323 | + | let paymentAmount = $t084158504._2 | |
329 | 324 | let assetId = fromBase58String(nftId) | |
330 | - | let $ | |
331 | - | let type = $ | |
332 | - | let details = $ | |
325 | + | let $t085488586 = getSlot(assetId) | |
326 | + | let type = $t085488586._1 | |
327 | + | let details = $t085488586._2 | |
333 | 328 | let baseRes = [ScriptTransfer(i.caller, 1, assetId), DeleteEntry(getSlotKey(type, assetId))] | |
334 | 329 | if ((type == kSell)) | |
335 | 330 | then { | |
336 | - | let $ | |
337 | - | let seller = $ | |
338 | - | let priceValue = $ | |
331 | + | let $t087288775 = parseAsSell(details) | |
332 | + | let seller = $t087288775._1 | |
333 | + | let priceValue = $t087288775._2 | |
339 | 334 | valueOrElse(isCorrectPayments(paymentAsset, paymentAmount, priceValue), { | |
340 | - | let $ | |
341 | - | let sellerAmount = $ | |
342 | - | let buyerAmount = $ | |
335 | + | let $t088608962 = resultFundsAmounts(isTrustedNft(assetId), paymentAmount, priceValue) | |
336 | + | let sellerAmount = $t088608962._1 | |
337 | + | let buyerAmount = $t088608962._2 | |
343 | 338 | let updatedRes = (baseRes ++ [ScriptTransfer(seller, sellerAmount, unit)]) | |
344 | 339 | if ((buyerAmount > 0)) | |
345 | 340 | then (updatedRes ++ [ScriptTransfer(i.caller, buyerAmount, unit)]) | |
347 | 342 | }) | |
348 | 343 | } | |
349 | 344 | else { | |
350 | - | let $ | |
351 | - | let seller = $ | |
352 | - | let actualPrice = $ | |
345 | + | let $t091799248 = calcPriceAtCurrentMoment(assetId, height) | |
346 | + | let seller = $t091799248._1 | |
347 | + | let actualPrice = $t091799248._2 | |
353 | 348 | valueOrElse(isCorrectPayments(paymentAsset, paymentAmount, actualPrice), { | |
354 | - | let $ | |
355 | - | let sellerAmount = $ | |
356 | - | let buyerAmount = $ | |
349 | + | let $t093349437 = resultFundsAmounts(isTrustedNft(assetId), paymentAmount, actualPrice) | |
350 | + | let sellerAmount = $t093349437._1 | |
351 | + | let buyerAmount = $t093349437._2 | |
357 | 352 | let updatedRes = (baseRes ++ [ScriptTransfer(seller, sellerAmount, unit)]) | |
358 | 353 | if ((buyerAmount > 0)) | |
359 | 354 | then (updatedRes ++ [ScriptTransfer(i.caller, buyerAmount, unit)]) | |
367 | 362 | @Callable(i) | |
368 | 363 | func declineSlot (nftId) = { | |
369 | 364 | let assetId = fromBase58String(nftId) | |
370 | - | let $ | |
371 | - | let type = $ | |
372 | - | let details = $ | |
365 | + | let $t097389776 = getSlot(assetId) | |
366 | + | let type = $t097389776._1 | |
367 | + | let details = $t097389776._2 | |
373 | 368 | let baseRes = [DeleteEntry(getSlotKey(type, assetId))] | |
374 | 369 | if ((type == kSell)) | |
375 | 370 | then { | |
376 | - | let $ | |
377 | - | let seller = $ | |
378 | - | let priceValue = $ | |
371 | + | let $t098689915 = parseAsSell(details) | |
372 | + | let seller = $t098689915._1 | |
373 | + | let priceValue = $t098689915._2 | |
379 | 374 | if (!(isValidCaller(i.caller, seller))) | |
380 | 375 | then throw("Invalid caller") | |
381 | 376 | else (baseRes ++ [ScriptTransfer(seller, 1, assetId)]) | |
382 | 377 | } | |
383 | 378 | else { | |
384 | - | let $ | |
385 | - | let seller = $ | |
386 | - | let startPriceValue = $ | |
387 | - | let endPriceValue = $ | |
388 | - | let startPeriodValue = $ | |
389 | - | let endPeriodValue = $ | |
379 | + | let $t01006010164 = parseAsAuction(details) | |
380 | + | let seller = $t01006010164._1 | |
381 | + | let startPriceValue = $t01006010164._2 | |
382 | + | let endPriceValue = $t01006010164._3 | |
383 | + | let startPeriodValue = $t01006010164._4 | |
384 | + | let endPeriodValue = $t01006010164._5 | |
390 | 385 | if (!(isValidCaller(i.caller, seller))) | |
391 | 386 | then throw("Invalid caller") | |
392 | 387 | else if (!(isAuctionEnded(height, endPeriodValue))) | |
407 | 402 | @Callable(i) | |
408 | 403 | func getPriceAtCurrentMoment (nftId,moment) = { | |
409 | 404 | let assetId = fromBase58String(nftId) | |
410 | - | let $ | |
411 | - | let seller = $ | |
412 | - | let price = $ | |
405 | + | let $t01070510768 = calcPriceAtCurrentMoment(assetId, moment) | |
406 | + | let seller = $t01070510768._1 | |
407 | + | let price = $t01070510768._2 | |
413 | 408 | [IntegerEntry(getPriceKey(assetId), price)] | |
414 | 409 | } | |
415 | 410 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let separator = "_" | |
5 | 5 | ||
6 | 6 | let kAuction = "auction" | |
7 | 7 | ||
8 | 8 | let kSell = "sell" | |
9 | 9 | ||
10 | 10 | let kTrusted = "trusted" | |
11 | 11 | ||
12 | 12 | let kPrice = "price" | |
13 | 13 | ||
14 | 14 | func getSlotKey (prefix,nftId) = ((prefix + separator) + toBase58String(nftId)) | |
15 | 15 | ||
16 | 16 | ||
17 | 17 | func getPriceKey (nftId) = ((kPrice + separator) + toBase58String(nftId)) | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func getSellKey (nftId) = ((kSell + separator) + toBase58String(nftId)) | |
21 | 21 | ||
22 | 22 | ||
23 | 23 | func getAuctionKey (nftId) = ((kAuction + separator) + toBase58String(nftId)) | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | func getTrustedKey (issuer) = ((kTrusted + separator) + toString(issuer)) | |
27 | 27 | ||
28 | 28 | ||
29 | 29 | func addToList (accum,nextValue) = (accum ++ [nextValue]) | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | func joinString (params) = { | |
33 | 33 | let length = size(params) | |
34 | 34 | if ((length == 0)) | |
35 | 35 | then throw("Empty params") | |
36 | 36 | else if ((length == 1)) | |
37 | 37 | then makeString({ | |
38 | 38 | let $l = params | |
39 | 39 | let $s = size($l) | |
40 | 40 | let $acc0 = nil | |
41 | 41 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
42 | 42 | then $a | |
43 | 43 | else addToList($a, $l[$i]) | |
44 | 44 | ||
45 | 45 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
46 | 46 | then $a | |
47 | 47 | else throw("List size exceeds 1") | |
48 | 48 | ||
49 | 49 | $f0_2($f0_1($acc0, 0), 1) | |
50 | 50 | }, separator) | |
51 | 51 | else if ((length == 2)) | |
52 | 52 | then makeString({ | |
53 | 53 | let $l = params | |
54 | 54 | let $s = size($l) | |
55 | 55 | let $acc0 = nil | |
56 | 56 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
57 | 57 | then $a | |
58 | 58 | else addToList($a, $l[$i]) | |
59 | 59 | ||
60 | 60 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
61 | 61 | then $a | |
62 | 62 | else throw("List size exceeds 2") | |
63 | 63 | ||
64 | 64 | $f0_2($f0_1($f0_1($acc0, 0), 1), 2) | |
65 | 65 | }, separator) | |
66 | 66 | else if ((length == 3)) | |
67 | 67 | then makeString({ | |
68 | 68 | let $l = params | |
69 | 69 | let $s = size($l) | |
70 | 70 | let $acc0 = nil | |
71 | 71 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
72 | 72 | then $a | |
73 | 73 | else addToList($a, $l[$i]) | |
74 | 74 | ||
75 | 75 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
76 | 76 | then $a | |
77 | 77 | else throw("List size exceeds 3") | |
78 | 78 | ||
79 | 79 | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) | |
80 | 80 | }, separator) | |
81 | 81 | else if ((length == 4)) | |
82 | 82 | then makeString({ | |
83 | 83 | let $l = params | |
84 | 84 | let $s = size($l) | |
85 | 85 | let $acc0 = nil | |
86 | 86 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
87 | 87 | then $a | |
88 | 88 | else addToList($a, $l[$i]) | |
89 | 89 | ||
90 | 90 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
91 | 91 | then $a | |
92 | 92 | else throw("List size exceeds 4") | |
93 | 93 | ||
94 | 94 | $f0_2($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4) | |
95 | 95 | }, separator) | |
96 | 96 | else if ((length == 5)) | |
97 | 97 | then makeString({ | |
98 | 98 | let $l = params | |
99 | 99 | let $s = size($l) | |
100 | 100 | let $acc0 = nil | |
101 | 101 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
102 | 102 | then $a | |
103 | 103 | else addToList($a, $l[$i]) | |
104 | 104 | ||
105 | 105 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
106 | 106 | then $a | |
107 | 107 | else throw("List size exceeds 5") | |
108 | 108 | ||
109 | 109 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
110 | 110 | }, separator) | |
111 | 111 | else throw("Max number of parameters exceeded") | |
112 | 112 | } | |
113 | 113 | ||
114 | 114 | ||
115 | 115 | func parseAsAuction (details) = { | |
116 | 116 | let res = split(details, separator) | |
117 | 117 | $Tuple5(addressFromStringValue(res[0]), parseIntValue(res[1]), parseIntValue(res[2]), parseIntValue(res[3]), parseIntValue(res[4])) | |
118 | 118 | } | |
119 | 119 | ||
120 | 120 | ||
121 | 121 | func parseAsSell (details) = { | |
122 | 122 | let res = split(details, separator) | |
123 | 123 | $Tuple2(addressFromStringValue(res[0]), parseIntValue(res[1])) | |
124 | 124 | } | |
125 | 125 | ||
126 | 126 | ||
127 | 127 | func joinStruct (params) = match params { | |
128 | 128 | case auction: (Address, Int, Int, Int) => | |
129 | 129 | joinString([toString(auction._1), toString(auction._2), toString(auction._3), toString(auction._4)]) | |
130 | 130 | case sell: (Address, Int) => | |
131 | 131 | joinString([toString(sell._1), toString(sell._2)]) | |
132 | 132 | case _ => | |
133 | 133 | throw("Wrong params tupple") | |
134 | 134 | } | |
135 | 135 | ||
136 | 136 | ||
137 | 137 | func setAuction (seller,nftId,startPrice,start,end) = StringEntry(getAuctionKey(nftId), joinStruct($Tuple4(seller, startPrice, start, end))) | |
138 | 138 | ||
139 | 139 | ||
140 | 140 | func setSell (nftId,celler,price) = StringEntry(getSellKey(nftId), joinStruct($Tuple2(celler, price))) | |
141 | 141 | ||
142 | 142 | ||
143 | 143 | func getAuction (nftId) = value(getString(this, getAuctionKey(nftId))) | |
144 | 144 | ||
145 | 145 | ||
146 | 146 | func getSell (nftId) = value(getString(this, getSellKey(nftId))) | |
147 | 147 | ||
148 | 148 | ||
149 | 149 | func calcPriceAtCurrentMoment (assetId,moment) = { | |
150 | 150 | let details = getAuction(assetId) | |
151 | 151 | let $t027592863 = parseAsAuction(details) | |
152 | 152 | let seller = $t027592863._1 | |
153 | 153 | let startPriceValue = $t027592863._2 | |
154 | 154 | let endPriceValue = $t027592863._3 | |
155 | 155 | let startPeriodValue = $t027592863._4 | |
156 | 156 | let endPeriodValue = $t027592863._5 | |
157 | 157 | if ((moment >= endPeriodValue)) | |
158 | 158 | then $Tuple2(seller, endPriceValue) | |
159 | 159 | else { | |
160 | 160 | let deltaPrice = (startPriceValue - endPriceValue) | |
161 | 161 | let period = (endPeriodValue - startPeriodValue) | |
162 | 162 | let spended = (moment - startPeriodValue) | |
163 | 163 | $Tuple2(seller, (startPriceValue - fraction(spended, deltaPrice, period))) | |
164 | 164 | } | |
165 | 165 | } | |
166 | 166 | ||
167 | 167 | ||
168 | 168 | func isNft (assetId) = match assetInfo(assetId) { | |
169 | 169 | case token: Asset => | |
170 | 170 | if (if ((token.decimals == 0)) | |
171 | 171 | then (token.quantity == 1) | |
172 | 172 | else false) | |
173 | 173 | then (token.reissuable == false) | |
174 | 174 | else false | |
175 | 175 | case _ => | |
176 | 176 | false | |
177 | 177 | } | |
178 | 178 | ||
179 | 179 | ||
180 | 180 | func isTrustedNft (assetId) = { | |
181 | 181 | let issuer = value(assetInfo(assetId)).issuer | |
182 | 182 | valueOrElse(getBoolean(this, getTrustedKey(issuer)), false) | |
183 | 183 | } | |
184 | 184 | ||
185 | 185 | ||
186 | 186 | func isSellExist (assetId) = isDefined(getString(this, getSellKey(assetId))) | |
187 | 187 | ||
188 | 188 | ||
189 | 189 | func isAuctionExist (assetId) = isDefined(getString(this, getAuctionKey(assetId))) | |
190 | 190 | ||
191 | 191 | ||
192 | 192 | func isCorrectSellPrice (price) = (price > 0) | |
193 | 193 | ||
194 | 194 | ||
195 | - | func isCorrectAuctionPeriod (start,end) = (end > start) | |
196 | - | ||
197 | - | ||
198 | 195 | func isCorrectAuctionPrices (startPrice,endPrice) = (startPrice > endPrice) | |
199 | 196 | ||
200 | 197 | ||
201 | 198 | func isAdmin (caller) = (caller == this) | |
202 | 199 | ||
203 | 200 | ||
204 | 201 | func isValidCaller (caller,seller) = if ((caller == this)) | |
205 | 202 | then true | |
206 | 203 | else (caller == seller) | |
207 | 204 | ||
208 | 205 | ||
209 | 206 | func isAuctionEnded (now,end) = (now > end) | |
210 | 207 | ||
211 | 208 | ||
212 | 209 | func isEnoughFunds (payment,currentMomentPrice) = (payment >= currentMomentPrice) | |
213 | 210 | ||
214 | 211 | ||
215 | 212 | func isWawes (assetId) = (assetId == unit) | |
216 | 213 | ||
217 | 214 | ||
218 | 215 | func isCorrectNft (nftId) = if (!(isNft(nftId))) | |
219 | 216 | then throw("Token is not Nft") | |
220 | 217 | else if (isSellExist(nftId)) | |
221 | 218 | then throw("Sell already exists") | |
222 | 219 | else if (isAuctionExist(nftId)) | |
223 | 220 | then throw("Auction already exists") | |
224 | 221 | else unit | |
225 | 222 | ||
226 | 223 | ||
227 | 224 | func isCorrectPayments (paymentAsset,paymentAmount,price) = if (!(isWawes(paymentAsset))) | |
228 | 225 | then throw("Payment must be at WAVES") | |
229 | 226 | else if (!(isEnoughFunds(paymentAmount, price))) | |
230 | 227 | then throw("Not enough funds") | |
231 | 228 | else unit | |
232 | 229 | ||
233 | 230 | ||
234 | 231 | func calcFee () = 0 | |
235 | 232 | ||
236 | 233 | ||
237 | 234 | func calcTrustedFee () = 0 | |
238 | 235 | ||
239 | 236 | ||
240 | 237 | func resultFundsAmounts (isTrusted,paymentAmount,actualPrice) = if (isTrusted) | |
241 | 238 | then $Tuple2((actualPrice - calcTrustedFee()), (paymentAmount - actualPrice)) | |
242 | 239 | else $Tuple2((actualPrice - calcFee()), (paymentAmount - actualPrice)) | |
243 | 240 | ||
244 | 241 | ||
245 | 242 | func getSlot (nftId) = if (isSellExist(nftId)) | |
246 | 243 | then $Tuple2(kSell, getSell(nftId)) | |
247 | 244 | else if (isAuctionExist(nftId)) | |
248 | 245 | then $Tuple2(kAuction, getAuction(nftId)) | |
249 | 246 | else throw("Slot doesn`t exist") | |
250 | 247 | ||
251 | 248 | ||
252 | 249 | let kBuy = "buy" | |
253 | 250 | ||
254 | 251 | let ASIMI_TOKEN = base58'EbLVSrAi6vS3AkLwBinzZCvAXP2yYiFJEzj1MBVHcwZ5' | |
255 | 252 | ||
256 | 253 | @Callable(i) | |
257 | 254 | func createNft (nft_name,nft_owner,nft_dAppAddress,nft_type,nft_tags,nft_selling_price,nft_description,nft_onSell,nft_data) = { | |
258 | 255 | let newToken = Issue(nft_name, nft_description, 1, 0, false) | |
259 | 256 | let issueId = calculateAssetId(newToken) | |
260 | 257 | [newToken, ScriptTransfer(i.caller, 1, issueId), StringEntry(((toBase58String(issueId) + separator) + "Owner"), toString(i.caller)), StringEntry(((toBase58String(issueId) + separator) + "nft_type"), nft_type), StringEntry(((toBase58String(issueId) + separator) + "nft_tags"), nft_tags), StringEntry(((toBase58String(issueId) + separator) + "nft_dAppAddress"), nft_dAppAddress), IntegerEntry(((toBase58String(issueId) + separator) + "nft_selling_price"), nft_selling_price), StringEntry(((toBase58String(issueId) + separator) + "nft_onSell"), nft_onSell), StringEntry(((toBase58String(issueId) + separator) + "nft_data"), nft_data)] | |
261 | 258 | } | |
262 | 259 | ||
263 | 260 | ||
264 | 261 | ||
265 | 262 | @Callable(i) | |
266 | 263 | func issueNft (name,meta) = { | |
267 | 264 | let newToken = Issue(name, meta, 1, 0, false) | |
268 | 265 | let issueId = calculateAssetId(newToken) | |
269 | 266 | [newToken, ScriptTransfer(i.caller, 1, issueId), StringEntry(((toBase58String(issueId) + separator) + "Owner"), toString(i.caller))] | |
270 | 267 | } | |
271 | 268 | ||
272 | 269 | ||
273 | 270 | ||
274 | 271 | @Callable(i) | |
275 | 272 | func buyNFT (nftID) = { | |
276 | 273 | let assetId = fromBase58String(nftID) | |
277 | 274 | let amount = value(i.payments[0].amount) | |
278 | 275 | let amount1 = value(i.payments[1].amount) | |
279 | 276 | let price = valueOrErrorMessage(getString(((kPrice + separator) + nftID)), "There is no price for this NFT") | |
280 | 277 | let owner = valueOrErrorMessage(getStringValue(((nftID + separator) + "Owner")), "No owner") | |
281 | 278 | if ((i.payments[0].assetId != unit)) | |
282 | 279 | then throw("Pay in waves") | |
283 | 280 | else if ((i.payments[1].assetId != ASIMI_TOKEN)) | |
284 | 281 | then throw("Pay in ASIMI") | |
285 | 282 | else if ((parseIntValue(price) > amount)) | |
286 | 283 | then throw("Invalid payment WAVES") | |
287 | 284 | else [ScriptTransfer(i.caller, 1, assetId), ScriptTransfer(value(addressFromString(owner)), parseIntValue(price), unit), StringEntry(((toString(i.caller) + separator) + kBuy), ((nftID + separator) + toString(amount)))] | |
288 | 285 | } | |
289 | 286 | ||
290 | 287 | ||
291 | 288 | ||
292 | 289 | @Callable(i) | |
293 | 290 | func sellNFT (price) = { | |
294 | - | let $ | |
295 | - | let token0 = $ | |
296 | - | let amount0 = $ | |
291 | + | let $t074157500 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) | |
292 | + | let token0 = $t074157500._1 | |
293 | + | let amount0 = $t074157500._2 | |
297 | 294 | if (!(isNft(token0))) | |
298 | 295 | then throw("Token is not NFT") | |
299 | 296 | else [StringEntry(((kPrice + separator) + toBase58String(value(i.payments[0].assetId))), toString(price)), StringEntry(((toString(i.caller) + separator) + kSell), ((toBase58String(token0) + separator) + toString(amount0)))] | |
300 | 297 | } | |
301 | 298 | ||
302 | 299 | ||
303 | 300 | ||
304 | 301 | @Callable(i) | |
305 | 302 | func addSell (price) = { | |
306 | 303 | let nftId = value(i.payments[0].assetId) | |
307 | 304 | valueOrElse(isCorrectNft(nftId), if (!(isCorrectSellPrice(price))) | |
308 | 305 | then throw("Price must be > 0") | |
309 | 306 | else [setSell(nftId, i.caller, price)]) | |
310 | 307 | } | |
311 | 308 | ||
312 | 309 | ||
313 | 310 | ||
314 | 311 | @Callable(i) | |
315 | 312 | func addAuction (startPrice,start,end) = { | |
316 | 313 | let nftId = value(i.payments[0].assetId) | |
317 | - | valueOrElse(isCorrectNft(nftId), if (!(isCorrectAuctionPeriod(start, end))) | |
318 | - | then throw("Period is not correct") | |
319 | - | else [setAuction(i.caller, nftId, startPrice, start, end), StringEntry(((toBase58String(nftId) + separator) + "nft_owner"), toString(i.caller))]) | |
314 | + | valueOrElse(isCorrectNft(nftId), [setAuction(i.caller, nftId, startPrice, start, end), StringEntry(((toBase58String(nftId) + separator) + "nft_owner"), toString(i.caller))]) | |
320 | 315 | } | |
321 | 316 | ||
322 | 317 | ||
323 | 318 | ||
324 | 319 | @Callable(i) | |
325 | 320 | func buyFromSlot (nftId) = { | |
326 | - | let $ | |
327 | - | let paymentAsset = $ | |
328 | - | let paymentAmount = $ | |
321 | + | let $t084158504 = $Tuple2(i.payments[0].assetId, value(i.payments[0].amount)) | |
322 | + | let paymentAsset = $t084158504._1 | |
323 | + | let paymentAmount = $t084158504._2 | |
329 | 324 | let assetId = fromBase58String(nftId) | |
330 | - | let $ | |
331 | - | let type = $ | |
332 | - | let details = $ | |
325 | + | let $t085488586 = getSlot(assetId) | |
326 | + | let type = $t085488586._1 | |
327 | + | let details = $t085488586._2 | |
333 | 328 | let baseRes = [ScriptTransfer(i.caller, 1, assetId), DeleteEntry(getSlotKey(type, assetId))] | |
334 | 329 | if ((type == kSell)) | |
335 | 330 | then { | |
336 | - | let $ | |
337 | - | let seller = $ | |
338 | - | let priceValue = $ | |
331 | + | let $t087288775 = parseAsSell(details) | |
332 | + | let seller = $t087288775._1 | |
333 | + | let priceValue = $t087288775._2 | |
339 | 334 | valueOrElse(isCorrectPayments(paymentAsset, paymentAmount, priceValue), { | |
340 | - | let $ | |
341 | - | let sellerAmount = $ | |
342 | - | let buyerAmount = $ | |
335 | + | let $t088608962 = resultFundsAmounts(isTrustedNft(assetId), paymentAmount, priceValue) | |
336 | + | let sellerAmount = $t088608962._1 | |
337 | + | let buyerAmount = $t088608962._2 | |
343 | 338 | let updatedRes = (baseRes ++ [ScriptTransfer(seller, sellerAmount, unit)]) | |
344 | 339 | if ((buyerAmount > 0)) | |
345 | 340 | then (updatedRes ++ [ScriptTransfer(i.caller, buyerAmount, unit)]) | |
346 | 341 | else updatedRes | |
347 | 342 | }) | |
348 | 343 | } | |
349 | 344 | else { | |
350 | - | let $ | |
351 | - | let seller = $ | |
352 | - | let actualPrice = $ | |
345 | + | let $t091799248 = calcPriceAtCurrentMoment(assetId, height) | |
346 | + | let seller = $t091799248._1 | |
347 | + | let actualPrice = $t091799248._2 | |
353 | 348 | valueOrElse(isCorrectPayments(paymentAsset, paymentAmount, actualPrice), { | |
354 | - | let $ | |
355 | - | let sellerAmount = $ | |
356 | - | let buyerAmount = $ | |
349 | + | let $t093349437 = resultFundsAmounts(isTrustedNft(assetId), paymentAmount, actualPrice) | |
350 | + | let sellerAmount = $t093349437._1 | |
351 | + | let buyerAmount = $t093349437._2 | |
357 | 352 | let updatedRes = (baseRes ++ [ScriptTransfer(seller, sellerAmount, unit)]) | |
358 | 353 | if ((buyerAmount > 0)) | |
359 | 354 | then (updatedRes ++ [ScriptTransfer(i.caller, buyerAmount, unit)]) | |
360 | 355 | else updatedRes | |
361 | 356 | }) | |
362 | 357 | } | |
363 | 358 | } | |
364 | 359 | ||
365 | 360 | ||
366 | 361 | ||
367 | 362 | @Callable(i) | |
368 | 363 | func declineSlot (nftId) = { | |
369 | 364 | let assetId = fromBase58String(nftId) | |
370 | - | let $ | |
371 | - | let type = $ | |
372 | - | let details = $ | |
365 | + | let $t097389776 = getSlot(assetId) | |
366 | + | let type = $t097389776._1 | |
367 | + | let details = $t097389776._2 | |
373 | 368 | let baseRes = [DeleteEntry(getSlotKey(type, assetId))] | |
374 | 369 | if ((type == kSell)) | |
375 | 370 | then { | |
376 | - | let $ | |
377 | - | let seller = $ | |
378 | - | let priceValue = $ | |
371 | + | let $t098689915 = parseAsSell(details) | |
372 | + | let seller = $t098689915._1 | |
373 | + | let priceValue = $t098689915._2 | |
379 | 374 | if (!(isValidCaller(i.caller, seller))) | |
380 | 375 | then throw("Invalid caller") | |
381 | 376 | else (baseRes ++ [ScriptTransfer(seller, 1, assetId)]) | |
382 | 377 | } | |
383 | 378 | else { | |
384 | - | let $ | |
385 | - | let seller = $ | |
386 | - | let startPriceValue = $ | |
387 | - | let endPriceValue = $ | |
388 | - | let startPeriodValue = $ | |
389 | - | let endPeriodValue = $ | |
379 | + | let $t01006010164 = parseAsAuction(details) | |
380 | + | let seller = $t01006010164._1 | |
381 | + | let startPriceValue = $t01006010164._2 | |
382 | + | let endPriceValue = $t01006010164._3 | |
383 | + | let startPeriodValue = $t01006010164._4 | |
384 | + | let endPeriodValue = $t01006010164._5 | |
390 | 385 | if (!(isValidCaller(i.caller, seller))) | |
391 | 386 | then throw("Invalid caller") | |
392 | 387 | else if (!(isAuctionEnded(height, endPeriodValue))) | |
393 | 388 | then throw("Wait for end of auction") | |
394 | 389 | else (baseRes ++ [ScriptTransfer(seller, 1, assetId)]) | |
395 | 390 | } | |
396 | 391 | } | |
397 | 392 | ||
398 | 393 | ||
399 | 394 | ||
400 | 395 | @Callable(i) | |
401 | 396 | func setTrustedIssuer (trustedAddr) = if (!(isAdmin(i.caller))) | |
402 | 397 | then throw("Only admin") | |
403 | 398 | else [BooleanEntry(getTrustedKey(addressFromStringValue(trustedAddr)), true)] | |
404 | 399 | ||
405 | 400 | ||
406 | 401 | ||
407 | 402 | @Callable(i) | |
408 | 403 | func getPriceAtCurrentMoment (nftId,moment) = { | |
409 | 404 | let assetId = fromBase58String(nftId) | |
410 | - | let $ | |
411 | - | let seller = $ | |
412 | - | let price = $ | |
405 | + | let $t01070510768 = calcPriceAtCurrentMoment(assetId, moment) | |
406 | + | let seller = $t01070510768._1 | |
407 | + | let price = $t01070510768._2 | |
413 | 408 | [IntegerEntry(getPriceKey(assetId), price)] | |
414 | 409 | } | |
415 | 410 | ||
416 | 411 |
github/deemru/w8io/026f985 61.16 ms ◑