tx · 8DHKAReNEPMw6h3HmzD61THrJy7nTsc7b9j6vAuSfRG3 3MvjAaDYHpS4A5K4CV3kZMMEH9m9JdBSvbq: -0.50000000 Waves 2022.11.30 13:53 [2339743] smart account 3MvjAaDYHpS4A5K4CV3kZMMEH9m9JdBSvbq > SELF 0.00000000 Waves
{ "type": 13, "id": "8DHKAReNEPMw6h3HmzD61THrJy7nTsc7b9j6vAuSfRG3", "fee": 50000000, "feeAssetId": null, "timestamp": 1669805640019, "version": 2, "chainId": 84, "sender": "3MvjAaDYHpS4A5K4CV3kZMMEH9m9JdBSvbq", "senderPublicKey": "H6UqxUDcJamDRg1uykVcWMn4zhAMTV7i1nfPq1moLWmJ", "proofs": [ "61ufbR1fswqE6WjZj6cJd5EiC5dVfPcYd4r5PzihXdSs7TSqodbaAh7UhojprCFB32SPCjvUd5FZ145rK8xaZF71" ], "script": "base64:BgJNCAISCwoJCAgICAgBCAgIEgQKAggIEgMKAQgSAwoBARIDCgEBEgUKAwgIARIDCgEIEgMKAQgSAwoBCBIECgIIARIGCgQICAEBEgMKAQgoAAlzZXBhcmF0b3ICAV8ACGtBdWN0aW9uAgdhdWN0aW9uAAVrU2VsbAIEc2VsbAAIa1RydXN0ZWQCB3RydXN0ZWQABmtQcmljZQIFcHJpY2UBCmdldFNsb3RLZXkCBnByZWZpeAVuZnRJZAkArAICCQCsAgIFBnByZWZpeAUJc2VwYXJhdG9yCQDYBAEFBW5mdElkAQtnZXRQcmljZUtleQEFbmZ0SWQJAKwCAgkArAICBQZrUHJpY2UFCXNlcGFyYXRvcgkA2AQBBQVuZnRJZAEKZ2V0U2VsbEtleQEFbmZ0SWQJAKwCAgkArAICBQVrU2VsbAUJc2VwYXJhdG9yCQDYBAEFBW5mdElkAQ1nZXRBdWN0aW9uS2V5AQVuZnRJZAkArAICCQCsAgIFCGtBdWN0aW9uBQlzZXBhcmF0b3IJANgEAQUFbmZ0SWQBDWdldFRydXN0ZWRLZXkBBmlzc3VlcgkArAICCQCsAgI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JZAIBXwkA2AQBCAUGY2FsbGVyBWJ5dGVzBQluZnRfb3duZXIJAMwIAgkBC1N0cmluZ0VudHJ5AgkArAICCQCsAgIJAKwCAgIMYmlkZGluZ19mb3JfBQVuZnRJZAIEX2J5XwkA2AQBCAUGY2FsbGVyBWJ5dGVzCQCsAgIJAKwCAgUFbmZ0SWQCAV8JANgEAQgFBmNhbGxlcgVieXRlcwkAzAgCCQELU3RyaW5nRW50cnkCCQCsAgIJAKwCAgkArAICAg5taW5fcHJpY2VfZm9yXwUFbmZ0SWQCBF9ieV8JANgEAQgFBmNhbGxlcgVieXRlcwkApAMBBQltaW5fcHJpY2UJAMwIAgkBC1N0cmluZ0VudHJ5AgkArAICCQCsAgIJAKwCAgINYmlkX3ByaWNlX2ZvcgUFbmZ0SWQCBF9ieV8JANgEAQgFBmNhbGxlcgVieXRlcwkApAMBBQliaWRfcHJpY2UJAMwIAgkBC1N0cmluZ0VudHJ5AgkArAICCQCsAgIJAKwCAgIWdHJhbnNmZXJfYmlkX3ByaWNlX2ZvcgUFbmZ0SWQCBF9ieV8JANgEAQgFBmNhbGxlcgVieXRlcwkA2AQBBQtkQXBwQWRkcmVzcwUDbmlsAWkBCmFjZXB0T2ZmZXIBB21lc3NhZ2UJAMwIAgkBDlNjcmlwdFRyYW5zZmVyAwgFAWkGY2FsbGVyAIDC1y8FBHVuaXQFA25pbAA5jvRO", "height": 2339743, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8nCNFksUF2nXH2wiGNhTtRuFS8VKyLoNeaP62E5ch1Kt Next: FznHkJJJPAsNpsEpLwq1Cx43EpDcFNZ7BF9HupjBjkfN Diff:
Old | New | Differences | |
---|---|---|---|
436 | 436 | then throw("Pay in waves") | |
437 | 437 | else if ((checkNftAuctioned != statusForNFT._1)) | |
438 | 438 | then throw("Not open in auction list") | |
439 | - | else [StringEntry(((("nft_id_" + nftId) + "_") + toBase58String(caller.bytes)), nftId), StringEntry(((("nft_owner_" + nftId) + "_") + toBase58String(caller.bytes)), nft_owner), StringEntry(((("bidding_for_" + nftId) + "_by_") + toBase58String(caller.bytes)), ((nftId + "_") + toBase58String(caller.bytes))), StringEntry(((("min_price_for_" + nftId) + "_by_") + toBase58String(caller.bytes)), toString(min_price)), StringEntry(((("bid_price_for" + nftId) + "_by_") + toBase58String(caller.bytes)), toString(bid_price))] | |
439 | + | else [StringEntry(((("nft_id_" + nftId) + "_") + toBase58String(caller.bytes)), nftId), StringEntry(((("nft_owner_" + nftId) + "_") + toBase58String(caller.bytes)), nft_owner), StringEntry(((("bidding_for_" + nftId) + "_by_") + toBase58String(caller.bytes)), ((nftId + "_") + toBase58String(caller.bytes))), StringEntry(((("min_price_for_" + nftId) + "_by_") + toBase58String(caller.bytes)), toString(min_price)), StringEntry(((("bid_price_for" + nftId) + "_by_") + toBase58String(caller.bytes)), toString(bid_price)), StringEntry(((("transfer_bid_price_for" + nftId) + "_by_") + toBase58String(caller.bytes)), toBase58String(dAppAddress))] | |
440 | 440 | } | |
441 | 441 | ||
442 | 442 |
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, String, String) => | |
129 | 129 | joinString([toString(auction._1), toString(auction._2), auction._3, 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 $t027552859 = parseAsAuction(details) | |
152 | 152 | let seller = $t027552859._1 | |
153 | 153 | let startPriceValue = $t027552859._2 | |
154 | 154 | let endPriceValue = $t027552859._3 | |
155 | 155 | let startPeriodValue = $t027552859._4 | |
156 | 156 | let endPeriodValue = $t027552859._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 | 195 | func isCorrectAuctionPrices (startPrice,endPrice) = (startPrice > endPrice) | |
196 | 196 | ||
197 | 197 | ||
198 | 198 | func isAdmin (caller) = (caller == this) | |
199 | 199 | ||
200 | 200 | ||
201 | 201 | func isValidCaller (caller,seller) = if ((caller == this)) | |
202 | 202 | then true | |
203 | 203 | else (caller == seller) | |
204 | 204 | ||
205 | 205 | ||
206 | 206 | func isAuctionEnded (now,end) = (now > end) | |
207 | 207 | ||
208 | 208 | ||
209 | 209 | func isEnoughFunds (payment,currentMomentPrice) = (payment >= currentMomentPrice) | |
210 | 210 | ||
211 | 211 | ||
212 | 212 | func isWawes (assetId) = (assetId == unit) | |
213 | 213 | ||
214 | 214 | ||
215 | 215 | func isCorrectNft (nftId) = if (!(isNft(nftId))) | |
216 | 216 | then throw("Token is not Nft") | |
217 | 217 | else if (isSellExist(nftId)) | |
218 | 218 | then throw("Sell already exists") | |
219 | 219 | else if (isAuctionExist(nftId)) | |
220 | 220 | then throw("Auction already exists") | |
221 | 221 | else unit | |
222 | 222 | ||
223 | 223 | ||
224 | 224 | func isCorrectPayments (paymentAsset,paymentAmount,price) = if (!(isWawes(paymentAsset))) | |
225 | 225 | then throw("Payment must be at WAVES") | |
226 | 226 | else if (!(isEnoughFunds(paymentAmount, price))) | |
227 | 227 | then throw("Not enough funds") | |
228 | 228 | else unit | |
229 | 229 | ||
230 | 230 | ||
231 | 231 | func calcFee () = 0 | |
232 | 232 | ||
233 | 233 | ||
234 | 234 | func calcTrustedFee () = 0 | |
235 | 235 | ||
236 | 236 | ||
237 | 237 | func resultFundsAmounts (isTrusted,paymentAmount,actualPrice) = if (isTrusted) | |
238 | 238 | then $Tuple2((actualPrice - calcTrustedFee()), (paymentAmount - actualPrice)) | |
239 | 239 | else $Tuple2((actualPrice - calcFee()), (paymentAmount - actualPrice)) | |
240 | 240 | ||
241 | 241 | ||
242 | 242 | func getSlot (nftId) = if (isSellExist(nftId)) | |
243 | 243 | then $Tuple2(kSell, getSell(nftId)) | |
244 | 244 | else if (isAuctionExist(nftId)) | |
245 | 245 | then $Tuple2(kAuction, getAuction(nftId)) | |
246 | 246 | else throw("Slot doesn`t exist") | |
247 | 247 | ||
248 | 248 | ||
249 | 249 | let kBuy = "buy" | |
250 | 250 | ||
251 | 251 | let statusForNFT = $Tuple4("OPEN", "CLOSED", "REWARDED", "CANCELED") | |
252 | 252 | ||
253 | 253 | let dAppAddress = base58'3MvjAaDYHpS4A5K4CV3kZMMEH9m9JdBSvbq' | |
254 | 254 | ||
255 | 255 | @Callable(i) | |
256 | 256 | func createNFT (nft_name,nft_owner,nft_dAppAddress,nft_type,nft_tags,nft_selling_price,nft_description,nft_onSell,nft_data) = { | |
257 | 257 | let newToken = Issue(nft_name, nft_description, 1, 0, false) | |
258 | 258 | let issueId = calculateAssetId(newToken) | |
259 | 259 | let txId = i.transactionId | |
260 | 260 | [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), StringEntry(((toBase58String(txId) + separator) + "issue_nft"), toBase58String(issueId))] | |
261 | 261 | } | |
262 | 262 | ||
263 | 263 | ||
264 | 264 | ||
265 | 265 | @Callable(i) | |
266 | 266 | func issueNft (name,meta) = { | |
267 | 267 | let newToken = Issue(name, meta, 1, 0, false) | |
268 | 268 | let issueId = calculateAssetId(newToken) | |
269 | 269 | [newToken, ScriptTransfer(i.caller, 1, issueId), StringEntry(((toBase58String(issueId) + separator) + "Owner"), toString(i.caller))] | |
270 | 270 | } | |
271 | 271 | ||
272 | 272 | ||
273 | 273 | ||
274 | 274 | @Callable(i) | |
275 | 275 | func buyNFT (nftID) = { | |
276 | 276 | let assetId = fromBase58String(nftID) | |
277 | 277 | let amount = value(i.payments[0].amount) | |
278 | 278 | let price = valueOrErrorMessage(getString(((kPrice + separator) + nftID)), "There is no price for this NFT") | |
279 | 279 | let owner = valueOrErrorMessage(getStringValue(((nftID + separator) + "Owner")), "No owner") | |
280 | 280 | if ((i.payments[0].assetId != unit)) | |
281 | 281 | then throw("Pay in waves") | |
282 | 282 | else if ((parseIntValue(price) > amount)) | |
283 | 283 | then throw("Invalid payment") | |
284 | 284 | else [ScriptTransfer(i.caller, 1, assetId), ScriptTransfer(value(addressFromString(owner)), parseIntValue(price), unit), StringEntry(((toString(i.caller) + separator) + kBuy), ((nftID + separator) + toString(amount)))] | |
285 | 285 | } | |
286 | 286 | ||
287 | 287 | ||
288 | 288 | ||
289 | 289 | @Callable(i) | |
290 | 290 | func sellNFT (price) = { | |
291 | 291 | let $t074627547 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) | |
292 | 292 | let token0 = $t074627547._1 | |
293 | 293 | let amount0 = $t074627547._2 | |
294 | 294 | if (!(isNft(token0))) | |
295 | 295 | then throw("Token is not NFT") | |
296 | 296 | else [StringEntry(((kPrice + separator) + toBase58String(value(i.payments[0].assetId))), toString(price)), StringEntry(((toString(i.caller) + separator) + kSell), ((toBase58String(token0) + separator) + toString(amount0)))] | |
297 | 297 | } | |
298 | 298 | ||
299 | 299 | ||
300 | 300 | ||
301 | 301 | @Callable(i) | |
302 | 302 | func addSell (price) = { | |
303 | 303 | let nftId = value(i.payments[0].assetId) | |
304 | 304 | valueOrElse(isCorrectNft(nftId), if (!(isCorrectSellPrice(price))) | |
305 | 305 | then throw("Price must be > 0") | |
306 | 306 | else [setSell(nftId, i.caller, price)]) | |
307 | 307 | } | |
308 | 308 | ||
309 | 309 | ||
310 | 310 | ||
311 | 311 | @Callable(i) | |
312 | 312 | func addAuction (start,end,startPrice) = { | |
313 | 313 | let nftId = value(i.payments[0].assetId) | |
314 | 314 | let price = value(startPrice) | |
315 | 315 | let auction = $Tuple4(i.caller, price, start, end) | |
316 | 316 | let caller = i.caller.bytes | |
317 | 317 | let checkNftAuctioned = match getString(this, (((toBase58String(nftId) + separator) + "nft_status_") + toBase58String(caller))) { | |
318 | 318 | case a: String => | |
319 | 319 | a | |
320 | 320 | case _ => | |
321 | 321 | false | |
322 | 322 | } | |
323 | 323 | if ((checkNftAuctioned == statusForNFT._1)) | |
324 | 324 | then throw("Already in Auction list") | |
325 | 325 | else [StringEntry(((toBase58String(nftId) + "_nft_start_auction_date_") + toBase58String(caller)), start), StringEntry(((toBase58String(nftId) + "_nft_end_auction_date_") + toBase58String(caller)), end), IntegerEntry(((toBase58String(nftId) + "_nft_start_price_") + toBase58String(caller)), startPrice), StringEntry(((toBase58String(nftId) + separator) + "nft_owner"), toString(i.caller)), StringEntry((((toBase58String(nftId) + separator) + "nft_status_") + toBase58String(caller)), statusForNFT._1)] | |
326 | 326 | } | |
327 | 327 | ||
328 | 328 | ||
329 | 329 | ||
330 | 330 | @Callable(i) | |
331 | 331 | func buyFromSlot (nftId) = { | |
332 | 332 | let $t093409429 = $Tuple2(i.payments[0].assetId, value(i.payments[0].amount)) | |
333 | 333 | let paymentAsset = $t093409429._1 | |
334 | 334 | let paymentAmount = $t093409429._2 | |
335 | 335 | let assetId = fromBase58String(nftId) | |
336 | 336 | let $t094739511 = getSlot(assetId) | |
337 | 337 | let type = $t094739511._1 | |
338 | 338 | let details = $t094739511._2 | |
339 | 339 | let baseRes = [ScriptTransfer(i.caller, 1, assetId), DeleteEntry(getSlotKey(type, assetId))] | |
340 | 340 | if ((type == kSell)) | |
341 | 341 | then { | |
342 | 342 | let $t096539700 = parseAsSell(details) | |
343 | 343 | let seller = $t096539700._1 | |
344 | 344 | let priceValue = $t096539700._2 | |
345 | 345 | valueOrElse(isCorrectPayments(paymentAsset, paymentAmount, priceValue), { | |
346 | 346 | let $t097859887 = resultFundsAmounts(isTrustedNft(assetId), paymentAmount, priceValue) | |
347 | 347 | let sellerAmount = $t097859887._1 | |
348 | 348 | let buyerAmount = $t097859887._2 | |
349 | 349 | let updatedRes = (baseRes ++ [ScriptTransfer(seller, sellerAmount, unit)]) | |
350 | 350 | if ((buyerAmount > 0)) | |
351 | 351 | then (updatedRes ++ [ScriptTransfer(i.caller, buyerAmount, unit)]) | |
352 | 352 | else updatedRes | |
353 | 353 | }) | |
354 | 354 | } | |
355 | 355 | else { | |
356 | 356 | let $t01010410173 = calcPriceAtCurrentMoment(assetId, height) | |
357 | 357 | let seller = $t01010410173._1 | |
358 | 358 | let actualPrice = $t01010410173._2 | |
359 | 359 | valueOrElse(isCorrectPayments(paymentAsset, paymentAmount, actualPrice), { | |
360 | 360 | let $t01025910362 = resultFundsAmounts(isTrustedNft(assetId), paymentAmount, actualPrice) | |
361 | 361 | let sellerAmount = $t01025910362._1 | |
362 | 362 | let buyerAmount = $t01025910362._2 | |
363 | 363 | let updatedRes = (baseRes ++ [ScriptTransfer(seller, sellerAmount, unit)]) | |
364 | 364 | if ((buyerAmount > 0)) | |
365 | 365 | then (updatedRes ++ [ScriptTransfer(i.caller, buyerAmount, unit)]) | |
366 | 366 | else updatedRes | |
367 | 367 | }) | |
368 | 368 | } | |
369 | 369 | } | |
370 | 370 | ||
371 | 371 | ||
372 | 372 | ||
373 | 373 | @Callable(i) | |
374 | 374 | func declineSlot (nftId) = { | |
375 | 375 | let assetId = fromBase58String(nftId) | |
376 | 376 | let $t01066310701 = getSlot(assetId) | |
377 | 377 | let type = $t01066310701._1 | |
378 | 378 | let details = $t01066310701._2 | |
379 | 379 | let baseRes = [DeleteEntry(getSlotKey(type, assetId))] | |
380 | 380 | if ((type == kSell)) | |
381 | 381 | then { | |
382 | 382 | let $t01079310840 = parseAsSell(details) | |
383 | 383 | let seller = $t01079310840._1 | |
384 | 384 | let priceValue = $t01079310840._2 | |
385 | 385 | if (!(isValidCaller(i.caller, seller))) | |
386 | 386 | then throw("Invalid caller") | |
387 | 387 | else (baseRes ++ [ScriptTransfer(seller, 1, assetId)]) | |
388 | 388 | } | |
389 | 389 | else { | |
390 | 390 | let $t01098511089 = parseAsAuction(details) | |
391 | 391 | let seller = $t01098511089._1 | |
392 | 392 | let startPriceValue = $t01098511089._2 | |
393 | 393 | let endPriceValue = $t01098511089._3 | |
394 | 394 | let startPeriodValue = $t01098511089._4 | |
395 | 395 | let endPeriodValue = $t01098511089._5 | |
396 | 396 | if (!(isValidCaller(i.caller, seller))) | |
397 | 397 | then throw("Invalid caller") | |
398 | 398 | else if (!(isAuctionEnded(height, endPeriodValue))) | |
399 | 399 | then throw("Wait for end of auction") | |
400 | 400 | else (baseRes ++ [ScriptTransfer(seller, 1, assetId)]) | |
401 | 401 | } | |
402 | 402 | } | |
403 | 403 | ||
404 | 404 | ||
405 | 405 | ||
406 | 406 | @Callable(i) | |
407 | 407 | func setTrustedIssuer (trustedAddr) = if (!(isAdmin(i.caller))) | |
408 | 408 | then throw("Only admin") | |
409 | 409 | else [BooleanEntry(getTrustedKey(addressFromStringValue(trustedAddr)), true)] | |
410 | 410 | ||
411 | 411 | ||
412 | 412 | ||
413 | 413 | @Callable(i) | |
414 | 414 | func getPriceAtCurrentMoment (nftId,moment) = { | |
415 | 415 | let assetId = fromBase58String(nftId) | |
416 | 416 | let $t01163011693 = calcPriceAtCurrentMoment(assetId, moment) | |
417 | 417 | let seller = $t01163011693._1 | |
418 | 418 | let price = $t01163011693._2 | |
419 | 419 | [IntegerEntry(getPriceKey(assetId), price)] | |
420 | 420 | } | |
421 | 421 | ||
422 | 422 | ||
423 | 423 | ||
424 | 424 | @Callable(i) | |
425 | 425 | func placeBid (nftId,nft_owner,min_price,bid_price) = { | |
426 | 426 | let caller = i.caller | |
427 | 427 | let assetId = fromBase58String(nftId) | |
428 | 428 | let amount = value(i.payments[0].amount) | |
429 | 429 | let checkNftAuctioned = match getString(this, (((nftId + separator) + "nft_status_") + nft_owner)) { | |
430 | 430 | case a: String => | |
431 | 431 | a | |
432 | 432 | case _ => | |
433 | 433 | false | |
434 | 434 | } | |
435 | 435 | if ((i.payments[0].assetId != unit)) | |
436 | 436 | then throw("Pay in waves") | |
437 | 437 | else if ((checkNftAuctioned != statusForNFT._1)) | |
438 | 438 | then throw("Not open in auction list") | |
439 | - | else [StringEntry(((("nft_id_" + nftId) + "_") + toBase58String(caller.bytes)), nftId), StringEntry(((("nft_owner_" + nftId) + "_") + toBase58String(caller.bytes)), nft_owner), StringEntry(((("bidding_for_" + nftId) + "_by_") + toBase58String(caller.bytes)), ((nftId + "_") + toBase58String(caller.bytes))), StringEntry(((("min_price_for_" + nftId) + "_by_") + toBase58String(caller.bytes)), toString(min_price)), StringEntry(((("bid_price_for" + nftId) + "_by_") + toBase58String(caller.bytes)), toString(bid_price))] | |
439 | + | else [StringEntry(((("nft_id_" + nftId) + "_") + toBase58String(caller.bytes)), nftId), StringEntry(((("nft_owner_" + nftId) + "_") + toBase58String(caller.bytes)), nft_owner), StringEntry(((("bidding_for_" + nftId) + "_by_") + toBase58String(caller.bytes)), ((nftId + "_") + toBase58String(caller.bytes))), StringEntry(((("min_price_for_" + nftId) + "_by_") + toBase58String(caller.bytes)), toString(min_price)), StringEntry(((("bid_price_for" + nftId) + "_by_") + toBase58String(caller.bytes)), toString(bid_price)), StringEntry(((("transfer_bid_price_for" + nftId) + "_by_") + toBase58String(caller.bytes)), toBase58String(dAppAddress))] | |
440 | 440 | } | |
441 | 441 | ||
442 | 442 | ||
443 | 443 | ||
444 | 444 | @Callable(i) | |
445 | 445 | func aceptOffer (message) = [ScriptTransfer(i.caller, 100000000, unit)] | |
446 | 446 | ||
447 | 447 |
github/deemru/w8io/026f985 51.94 ms ◑