tx · HdkmyngesycDaLJw2uAZkdgF1MFAXHCjDEo7B938N63H 3N85YW6NZ9pLYvSdt1ASMQTGxvncnU1vUNx: -0.10000000 Waves 2022.12.26 11:00 [2376988] smart account 3N85YW6NZ9pLYvSdt1ASMQTGxvncnU1vUNx > SELF 0.00000000 Waves
{ "type": 13, "id": "HdkmyngesycDaLJw2uAZkdgF1MFAXHCjDEo7B938N63H", "fee": 10000000, "feeAssetId": null, "timestamp": 1672041647329, "version": 2, "chainId": 84, "sender": "3N85YW6NZ9pLYvSdt1ASMQTGxvncnU1vUNx", "senderPublicKey": "EKZmHJ5bK3qKKgRdq8rAamt9qrDbVMLARzRqXoQW258v", "proofs": [ "24mATc299Ya8YX4nErVP9GJjSm8gaTySR6HCmg7hDRvGoeznCFTwhk4gDLPNMfyGpCXGcWLVDgQgCAg3KJUhxk2F" ], "script": "base64:BgI9CAISCAoGCAgBCAgIEgMKAQESBAoCCAgSBgoECAgIARIGCgQICAgIEgUKAwgICBIDCgEIEgMKAQgSAwoBCCkACXNlcGFyYXRvcgIBXwAIa0F1Y3Rpb24CB2F1Y3Rpb24ABWtTZWxsAgRzZWxsAAhrVHJ1c3RlZAIHdHJ1c3RlZAAGa1ByaWNlAgVwcmljZQEKZ2V0U2xvdEtleQIGcHJlZml4BW5mdElkCQCsAgIJAKwCAgUGcHJlZml4BQlzZXBhcmF0b3IJANgEAQUFbmZ0SWQBC2dldFByaWNlS2V5AQVuZnRJZAkArAICCQCsAgIFBmtQcmljZQUJc2VwYXJhdG9yCQDYBAEFBW5mdElkAQpnZXRTZWxsS2V5AQVuZnRJZAkArAICCQCsAgIFBWtTZWxsBQlzZXBhcmF0b3IJANgEAQUFbmZ0SWQBDWdldEF1Y3Rpb25LZXkBBW5mdElkCQCsAgIJAKwCAgUIa0F1Y3Rpb24FCXNlcGFyYXRvcgkA2AQBBQVuZnRJZAENZ2V0VHJ1c3RlZEtleQEGaXNzdWVyCQCsAgIJAKwCAgUIa1RydXN0ZWQFCXNlc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YmlkZGluZ19wcmljZV9yZWZ1bmRfYW1vdW50BQhiaWRQcmljZQkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCAUBaQZjYWxsZXIJAQ1wYXJzZUludFZhbHVlAQUIYmlkUHJpY2UFBHVuaXQFA25pbAFpAQd0ZXN0QmlkAQRkYXRhCQDMCAIJAQtTdHJpbmdFbnRyeQICOEU4a2tGQllDeTQ0SkphcTZwQVo2S2l6c3VSZXNpNVVLTmhiRDFXTlp3aGhZX2hpZ2hlc3RfYmlkAgEwBQNuaWwA3y7KnQ==", "height": 2376988, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: C636reYDtfQB332tA8L4yHMVV3wipw5Xs74Zr8tZoWAM Next: 3XpAqhH5GK8jeXwqGwu114pqGjbhXfV9KrCRiMa4yoYn Diff:
Old | New | Differences | |
---|---|---|---|
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let separator = "_" | |
5 | 5 | ||
6 | - | let kBuy = "buy" | |
6 | + | let kAuction = "auction" | |
7 | + | ||
8 | + | let kSell = "sell" | |
9 | + | ||
10 | + | let kTrusted = "trusted" | |
7 | 11 | ||
8 | 12 | let kPrice = "price" | |
9 | 13 | ||
10 | - | ||
14 | + | func getSlotKey (prefix,nftId) = ((prefix + separator) + toBase58String(nftId)) | |
11 | 15 | ||
12 | - | let maxAuctionDuration = 7 | |
13 | 16 | ||
14 | - | ||
17 | + | func getPriceKey (nftId) = ((kPrice + separator) + toBase58String(nftId)) | |
15 | 18 | ||
16 | - | let statusForNFT = $Tuple4("OPEN", "CLOSED", "REWARDED", "CANCELED") | |
17 | 19 | ||
18 | - | let dAppAddress = base58'3MvjAaDYHpS4A5K4CV3kZMMEH9m9JdBSvbq' | |
20 | + | func getSellKey (nftId) = ((kSell + separator) + toBase58String(nftId)) | |
21 | + | ||
22 | + | ||
23 | + | func getAuctionKey (nftId) = ((kAuction + separator) + toBase58String(nftId)) | |
24 | + | ||
25 | + | ||
26 | + | func getTrustedKey (issuer) = ((kTrusted + separator) + toString(issuer)) | |
27 | + | ||
28 | + | ||
29 | + | func addToList (accum,nextValue) = (accum ++ [nextValue]) | |
30 | + | ||
31 | + | ||
32 | + | func joinString (params) = { | |
33 | + | let length = size(params) | |
34 | + | if ((length == 0)) | |
35 | + | then throw("Empty params") | |
36 | + | else if ((length == 1)) | |
37 | + | then makeString({ | |
38 | + | let $l = params | |
39 | + | let $s = size($l) | |
40 | + | let $acc0 = nil | |
41 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
42 | + | then $a | |
43 | + | else addToList($a, $l[$i]) | |
44 | + | ||
45 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
46 | + | then $a | |
47 | + | else throw("List size exceeds 1") | |
48 | + | ||
49 | + | $f0_2($f0_1($acc0, 0), 1) | |
50 | + | }, separator) | |
51 | + | else if ((length == 2)) | |
52 | + | then makeString({ | |
53 | + | let $l = params | |
54 | + | let $s = size($l) | |
55 | + | let $acc0 = nil | |
56 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
57 | + | then $a | |
58 | + | else addToList($a, $l[$i]) | |
59 | + | ||
60 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
61 | + | then $a | |
62 | + | else throw("List size exceeds 2") | |
63 | + | ||
64 | + | $f0_2($f0_1($f0_1($acc0, 0), 1), 2) | |
65 | + | }, separator) | |
66 | + | else if ((length == 3)) | |
67 | + | then makeString({ | |
68 | + | let $l = params | |
69 | + | let $s = size($l) | |
70 | + | let $acc0 = nil | |
71 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
72 | + | then $a | |
73 | + | else addToList($a, $l[$i]) | |
74 | + | ||
75 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
76 | + | then $a | |
77 | + | else throw("List size exceeds 3") | |
78 | + | ||
79 | + | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) | |
80 | + | }, separator) | |
81 | + | else if ((length == 4)) | |
82 | + | then makeString({ | |
83 | + | let $l = params | |
84 | + | let $s = size($l) | |
85 | + | let $acc0 = nil | |
86 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
87 | + | then $a | |
88 | + | else addToList($a, $l[$i]) | |
89 | + | ||
90 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
91 | + | then $a | |
92 | + | else throw("List size exceeds 4") | |
93 | + | ||
94 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4) | |
95 | + | }, separator) | |
96 | + | else if ((length == 5)) | |
97 | + | then makeString({ | |
98 | + | let $l = params | |
99 | + | let $s = size($l) | |
100 | + | let $acc0 = nil | |
101 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
102 | + | then $a | |
103 | + | else addToList($a, $l[$i]) | |
104 | + | ||
105 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
106 | + | then $a | |
107 | + | else throw("List size exceeds 5") | |
108 | + | ||
109 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
110 | + | }, separator) | |
111 | + | else throw("Max number of parameters exceeded") | |
112 | + | } | |
113 | + | ||
114 | + | ||
115 | + | func parseAsAuction (details) = { | |
116 | + | let res = split(details, separator) | |
117 | + | $Tuple5(addressFromStringValue(res[0]), parseIntValue(res[1]), parseIntValue(res[2]), parseIntValue(res[3]), parseIntValue(res[4])) | |
118 | + | } | |
119 | + | ||
120 | + | ||
121 | + | func parseAsSell (details) = { | |
122 | + | let res = split(details, separator) | |
123 | + | $Tuple2(addressFromStringValue(res[0]), parseIntValue(res[1])) | |
124 | + | } | |
125 | + | ||
126 | + | ||
127 | + | func joinStruct (params) = match params { | |
128 | + | case auction: (Address, Int, String, String) => | |
129 | + | joinString([toString(auction._1), toString(auction._2), auction._3, auction._4]) | |
130 | + | case sell: (Address, Int) => | |
131 | + | joinString([toString(sell._1), toString(sell._2)]) | |
132 | + | case _ => | |
133 | + | throw("Wrong params tupple") | |
134 | + | } | |
135 | + | ||
136 | + | ||
137 | + | func setAuction (seller,nftId,startPrice,start,end) = StringEntry(getAuctionKey(nftId), joinStruct($Tuple4(seller, startPrice, start, end))) | |
138 | + | ||
139 | + | ||
140 | + | func setSell (nftId,celler,price) = StringEntry(getSellKey(nftId), joinStruct($Tuple2(celler, price))) | |
141 | + | ||
142 | + | ||
143 | + | func getAuction (nftId) = value(getString(this, getAuctionKey(nftId))) | |
144 | + | ||
145 | + | ||
146 | + | func getSell (nftId) = value(getString(this, getSellKey(nftId))) | |
147 | + | ||
148 | + | ||
149 | + | func calcPriceAtCurrentMoment (assetId,moment) = { | |
150 | + | let details = getAuction(assetId) | |
151 | + | let $t027552859 = parseAsAuction(details) | |
152 | + | let seller = $t027552859._1 | |
153 | + | let startPriceValue = $t027552859._2 | |
154 | + | let endPriceValue = $t027552859._3 | |
155 | + | let startPeriodValue = $t027552859._4 | |
156 | + | let endPeriodValue = $t027552859._5 | |
157 | + | if ((moment >= endPeriodValue)) | |
158 | + | then $Tuple2(seller, endPriceValue) | |
159 | + | else { | |
160 | + | let deltaPrice = (startPriceValue - endPriceValue) | |
161 | + | let period = (endPeriodValue - startPeriodValue) | |
162 | + | let spended = (moment - startPeriodValue) | |
163 | + | $Tuple2(seller, (startPriceValue - fraction(spended, deltaPrice, period))) | |
164 | + | } | |
165 | + | } | |
166 | + | ||
19 | 167 | ||
20 | 168 | func isNft (assetId) = match assetInfo(assetId) { | |
21 | 169 | case token: Asset => | |
29 | 177 | } | |
30 | 178 | ||
31 | 179 | ||
180 | + | func isTrustedNft (assetId) = { | |
181 | + | let issuer = value(assetInfo(assetId)).issuer | |
182 | + | valueOrElse(getBoolean(this, getTrustedKey(issuer)), false) | |
183 | + | } | |
184 | + | ||
185 | + | ||
186 | + | func isSellExist (assetId) = isDefined(getString(this, getSellKey(assetId))) | |
187 | + | ||
188 | + | ||
189 | + | func isAuctionExist (assetId) = isDefined(getString(this, getAuctionKey(assetId))) | |
190 | + | ||
191 | + | ||
192 | + | func isCorrectSellPrice (price) = (price > 0) | |
193 | + | ||
194 | + | ||
195 | + | func isCorrectAuctionPrices (startPrice,endPrice) = (startPrice > endPrice) | |
196 | + | ||
197 | + | ||
198 | + | func isAdmin (caller) = (caller == this) | |
199 | + | ||
200 | + | ||
201 | + | func isValidCaller (caller,seller) = if ((caller == this)) | |
202 | + | then true | |
203 | + | else (caller == seller) | |
204 | + | ||
205 | + | ||
206 | + | func isAuctionEnded (now,end) = (now > end) | |
207 | + | ||
208 | + | ||
209 | + | func isEnoughFunds (payment,currentMomentPrice) = (payment >= currentMomentPrice) | |
210 | + | ||
211 | + | ||
212 | + | func isWawes (assetId) = (assetId == unit) | |
213 | + | ||
214 | + | ||
215 | + | func isCorrectNft (nftId) = if (!(isNft(nftId))) | |
216 | + | then throw("Token is not Nft") | |
217 | + | else if (isSellExist(nftId)) | |
218 | + | then throw("Sell already exists") | |
219 | + | else if (isAuctionExist(nftId)) | |
220 | + | then throw("Auction already exists") | |
221 | + | else unit | |
222 | + | ||
223 | + | ||
224 | + | func isCorrectPayments (paymentAsset,paymentAmount,price) = if (!(isWawes(paymentAsset))) | |
225 | + | then throw("Payment must be at WAVES") | |
226 | + | else if (!(isEnoughFunds(paymentAmount, price))) | |
227 | + | then throw("Not enough funds") | |
228 | + | else unit | |
229 | + | ||
230 | + | ||
231 | + | func calcFee () = 0 | |
232 | + | ||
233 | + | ||
234 | + | func calcTrustedFee () = 0 | |
235 | + | ||
236 | + | ||
237 | + | func resultFundsAmounts (isTrusted,paymentAmount,actualPrice) = if (isTrusted) | |
238 | + | then $Tuple2((actualPrice - calcTrustedFee()), (paymentAmount - actualPrice)) | |
239 | + | else $Tuple2((actualPrice - calcFee()), (paymentAmount - actualPrice)) | |
240 | + | ||
241 | + | ||
242 | + | func getSlot (nftId) = if (isSellExist(nftId)) | |
243 | + | then $Tuple2(kSell, getSell(nftId)) | |
244 | + | else if (isAuctionExist(nftId)) | |
245 | + | then $Tuple2(kAuction, getAuction(nftId)) | |
246 | + | else throw("Slot doesn`t exist") | |
247 | + | ||
248 | + | ||
249 | + | let kBuy = "buy" | |
250 | + | ||
251 | + | let kBid = "bid" | |
252 | + | ||
253 | + | let statusForNFT = $Tuple4("OPEN", "CLOSED", "REWARDED", "CANCELED") | |
254 | + | ||
255 | + | let dAppAddress = base58'3N85YW6NZ9pLYvSdt1ASMQTGxvncnU1vUNx' | |
256 | + | ||
32 | 257 | @Callable(i) | |
33 | - | func createNft (nft_name,nft_ | |
258 | + | func createNft (nft_name,nft_dAppAddress,nft_selling_price,nft_description,nft_onSell,nft_data) = { | |
34 | 259 | let newToken = Issue(nft_name, nft_description, 1, 0, false) | |
35 | 260 | let issueId = calculateAssetId(newToken) | |
36 | 261 | let txId = i.transactionId | |
37 | - | [newToken, ScriptTransfer(i.caller, 1, issueId | |
262 | + | [newToken, ScriptTransfer(i.caller, 1, issueId), 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))] | |
38 | 263 | } | |
39 | 264 | ||
40 | 265 | ||
42 | 267 | @Callable(i) | |
43 | 268 | func sellNFT (price) = { | |
44 | 269 | let txId = i.transactionId | |
45 | - | let seller = i.caller.bytes | |
46 | - | let $t017921877 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) | |
47 | - | let token0 = $t017921877._1 | |
48 | - | let amount0 = $t017921877._2 | |
49 | - | if (!(isNft(token0))) | |
270 | + | let $t062796364 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) | |
271 | + | let token0 = $t062796364._1 | |
272 | + | let amount0 = $t062796364._2 | |
273 | + | if (isNft(token0)) | |
50 | 274 | then throw("Token is not NFT") | |
51 | - | else [StringEntry(((kPrice + separator) + toBase58String(value(i.payments[0].assetId))), price), StringEntry(((toString(i.caller) + separator) + kSell), ((toBase58String(token0) + separator) + toString(amount0)))] | |
275 | + | else [StringEntry(((kPrice + separator) + toBase58String(value(i.payments[0].assetId))), toString(price)), StringEntry(((toString(i.caller) + separator) + kSell), ((toBase58String(token0) + separator) + toString(amount0)))] | |
52 | 276 | } | |
53 | 277 | ||
54 | 278 | ||
55 | 279 | ||
56 | 280 | @Callable(i) | |
57 | 281 | func buyNFT (nftID,current_nft_owner) = { | |
58 | - | let assetId = fromBase58String( | |
282 | + | let assetId = fromBase58String(current_nft_owner) | |
59 | 283 | let amount = value(i.payments[0].amount) | |
60 | 284 | let checkOwnerIsSame = match getString(this, (("nft_" + current_nft_owner) + "_owner")) { | |
61 | 285 | case a: String => | |
62 | 286 | a | |
63 | 287 | case _ => | |
64 | - | | |
288 | + | true | |
65 | 289 | } | |
66 | 290 | let price = getStringValue(((((kPrice + separator) + nftID) + "_") + current_nft_owner)) | |
291 | + | let owner = valueOrErrorMessage(getStringValue((separator + "Owner")), "No owner") | |
67 | 292 | if ((i.payments[0].assetId != unit)) | |
68 | 293 | then throw("Pay in waves") | |
69 | - | else if (( | |
70 | - | then throw(" | |
71 | - | else [ | |
294 | + | else if ((checkOwnerIsSame == toString(i.caller))) | |
295 | + | then throw("Owner of NFT not able to purchase") | |
296 | + | else [StringEntry(((toString(i.caller) + separator) + kBuy), (nftID + separator)), DeleteEntry((("nft_" + current_nft_owner) + "_owner"))] | |
72 | 297 | } | |
73 | 298 | ||
74 | 299 | ||
75 | 300 | ||
76 | 301 | @Callable(i) | |
77 | - | func | |
302 | + | func sellauction (start,end,startPrice,duration) = { | |
78 | 303 | let txId = toBase58String(i.transactionId) | |
79 | - | let nftId = value(i.payments[ | |
304 | + | let nftId = value(i.payments[1].assetId) | |
80 | 305 | let price = value(startPrice) | |
81 | - | let endHeight = (lastBlock.height + duration) | |
82 | 306 | let caller = i.caller.bytes | |
83 | 307 | let checkNftAuctioned = match getString(this, (((toBase58String(nftId) + separator) + "nft_status_") + toBase58String(caller))) { | |
84 | 308 | case a: String => | |
90 | 314 | then throw("NFT not attached") | |
91 | 315 | else if ((checkNftAuctioned == true)) | |
92 | 316 | then throw("Already in auction list") | |
93 | - | else if ((duration > maxAuctionDuration)) | |
94 | - | then throw(("Duration is too long. Must be less than or equal to 7 " + toString(maxAuctionDuration))) | |
95 | - | else [StringEntry(((txId + "_nft_start_auction_date_") + toBase58String(caller)), start), StringEntry(((txId + "_nft_end_auction_date_") + toBase58String(caller)), end), StringEntry((txId + "_nft_start_price"), startPrice), StringEntry((txId + "_nft_owner"), toString(i.caller)), StringEntry((txId + "_nft_on_auction"), toBase58String(nftId)), StringEntry((txId + "_previous_bidder"), "none"), StringEntry((txId + "_highest_bid"), "0"), StringEntry((txId + "_winner_of_nft"), "0"), StringEntry((txId + "_bidder_count"), "0"), StringEntry((txId + "_nft_status"), "OPEN")] | |
317 | + | else [StringEntry(((txId + "_nft_start_auction_date_") + toBase58String(caller)), start), StringEntry(((txId + "_nft_end_auction_date_") + toBase58String(caller)), end), StringEntry((txId + "_nft_start_price"), startPrice), IntegerEntry((txId + "duration_of_auction"), duration), StringEntry((txId + "_nft_owner"), toString(i.caller)), StringEntry((txId + "_nft_on_auction"), toBase58String(nftId)), StringEntry((txId + "_previous_bidder"), "none"), StringEntry((txId + "_highest_bid"), "0"), StringEntry((txId + "_winner_of_nft"), "0"), StringEntry((txId + "_bidder_count"), "0"), StringEntry((txId + "_nft_status"), "OPEN")] | |
96 | 318 | } | |
97 | 319 | ||
98 | 320 | ||
99 | 321 | ||
100 | 322 | @Callable(i) | |
101 | - | func | |
323 | + | func iqplace (auctionId,nftId,nft_owner,bid_price) = { | |
102 | 324 | let txId = toBase58String(i.transactionId) | |
103 | 325 | let caller = i.caller.bytes | |
104 | - | let assetId = | |
105 | - | let currentBidPrice = i.payments[ | |
326 | + | let assetId = fromBase64String(nftId) | |
327 | + | let currentBidPrice = i.payments[1].amount | |
106 | 328 | let getLastWinnerBidPrice = getStringValue(this, (auctionId + "_highest_bid")) | |
107 | 329 | let getPreviousBidderAddress = getString(this, (auctionId + "_previous_bidder")) | |
108 | 330 | let currentBidCount = getStringValue(this, (auctionId + "_bidder_count")) | |
114 | 336 | then throw("Not open for auction") | |
115 | 337 | else if ((parseIntValue(getLastWinnerBidPrice) >= currentBidPrice)) | |
116 | 338 | then throw("Bid is less then starting/highest Bid") | |
117 | - | else if ((getLastWinnerBidPrice == " | |
339 | + | else if ((getLastWinnerBidPrice == "3")) | |
118 | 340 | then [StringEntry((auctionId + "_highest_bid"), toString(currentBidPrice)), StringEntry((auctionId + "_winner_of_nft"), toBase58String(i.caller.bytes)), StringEntry((auctionId + "_bidder_count"), toString((parseIntValue(currentBidCount) + 1))), StringEntry((auctionId + "_nft_id"), toBase58String(assetId)), StringEntry((auctionId + "_nft_owner"), nft_owner), StringEntry((((txId + "_") + auctionId) + "_highest_bid"), toString(currentBidPrice)), StringEntry((((txId + "_") + auctionId) + "_winner"), toBase58String(i.caller.bytes)), StringEntry((((txId + "_") + auctionId) + "_bidder_count"), toString((parseIntValue(currentBidCount) + 1))), StringEntry((((txId + "_") + auctionId) + "_nft_id"), toBase58String(assetId)), StringEntry((((txId + "_") + auctionId) + "_nft_owner"), nft_owner), StringEntry((txId + "_bid_for_nft_by"), toBase58String(caller)), StringEntry((txId + "_bid_price_place"), bid_price), StringEntry((txId + "_previous_bid_amount_refund_to_address"), getLastWinnerAddress), StringEntry((txId + "_prevoius_bid_amount_refund"), getLastWinnerBidPrice)] | |
119 | 341 | else [StringEntry((auctionId + "_highest_bid"), toString(currentBidPrice)), StringEntry((auctionId + "_winner_of_nft"), toBase58String(i.caller.bytes)), StringEntry((auctionId + "_bidder_count"), toString((parseIntValue(currentBidCount) + 1))), StringEntry((auctionId + "_nft_id"), toBase58String(assetId)), StringEntry((auctionId + "_nft_owner"), nft_owner), StringEntry((((txId + "_") + auctionId) + "_highest_bid"), toString(currentBidPrice)), StringEntry((((txId + "_") + auctionId) + "_winner"), toBase58String(i.caller.bytes)), StringEntry((((txId + "_") + auctionId) + "_bidder_count"), toString((parseIntValue(currentBidCount) + 1))), StringEntry((((txId + "_") + auctionId) + "_nft_id"), toBase58String(assetId)), StringEntry((((txId + "_") + auctionId) + "_nft_owner"), nft_owner), StringEntry((txId + "_bid_for_nft_by"), toBase58String(caller)), StringEntry((txId + "_bid_price_place"), bid_price), StringEntry((txId + "_previous_bid_amount_refund_to_address"), getLastWinnerAddress), StringEntry((txId + "_prevoius_bid_amount_refund"), getLastWinnerBidPrice), ScriptTransfer(Address(fromBase58String(getLastWinnerAddress)), parseIntValue(getLastWinnerBidPrice), unit)] | |
120 | 342 | } | |
128 | 350 | let assetId = fromBase58String(nftId) | |
129 | 351 | let getNftWinningPrice = getStringValue(this, (auctionId + "_highest_bid")) | |
130 | 352 | let getAuctionWinner = getStringValue(this, (auctionId + "_winner_of_nft")) | |
131 | - | [ScriptTransfer(Address(caller), parseIntValue(getNftWinningPrice), unit | |
353 | + | [ScriptTransfer(Address(caller), parseIntValue(getNftWinningPrice), unit), StringEntry((txId + "_amount_paid_to_owner"), getNftWinningPrice), StringEntry((txId + "_nft_status"), "REWARDED"), StringEntry((auctionId + "_amount_paid_to_owner"), getNftWinningPrice), StringEntry((auctionId + "_nft_transfer_to"), getAuctionWinner), StringEntry((auctionId + "_nft_status"), "REWARDED")] | |
132 | 354 | } | |
133 | 355 | ||
134 | 356 | ||
135 | 357 | ||
136 | 358 | @Callable(i) | |
137 | - | func | |
138 | - | let txId = | |
359 | + | func cancel1Auction (auctionId) = { | |
360 | + | let txId = toBase64String(i.transactionId) | |
139 | 361 | let caller = i.caller.bytes | |
140 | 362 | let auctionStatus = getStringValue(this, (auctionId + "_nft_status")) | |
141 | 363 | let biddingWinner = getStringValue(this, (auctionId + "_winner_of_nft")) | |
143 | 365 | let nftId = getStringValue(this, (auctionId + "_nft_on_auction")) | |
144 | 366 | let biddingPrice = getStringValue(this, (auctionId + "_highest_bid")) | |
145 | 367 | if ((biddingWinner == "0")) | |
146 | - | then [ | |
147 | - | else [StringEntry((auctionId + "_nft_status"), "CANCELED"), StringEntry((auctionId + "_previous_bid_amount_refund_to_address"), biddingWinner), StringEntry((auctionId + "_prevoius_bid_amount_refund"), biddingPrice), StringEntry((txId + "_nft_status"), "CANCELED"), | |
368 | + | then [ScriptTransfer(Address(fromBase58String(nftOwner)), 1, fromBase58String(nftId))] | |
369 | + | else [StringEntry((auctionId + "_nft_status"), "CANCELED"), StringEntry((auctionId + "_previous_bid_amount_refund_to_address"), biddingWinner), StringEntry((auctionId + "_prevoius_bid_amount_refund"), biddingPrice), StringEntry((txId + "_nft_status"), "CANCELED"), ScriptTransfer(Address(fromBase58String(nftOwner)), 1, fromBase58String(nftId)), ScriptTransfer(Address(fromBase58String(biddingWinner)), parseIntValue(biddingPrice), unit)] | |
148 | 370 | } | |
149 | 371 | ||
150 | 372 | ||
151 | 373 | ||
152 | 374 | @Callable(i) | |
153 | - | func | |
375 | + | func WITH (bidTxId) = { | |
154 | 376 | let caller = i.caller.bytes | |
155 | 377 | let bidPrice = getStringValue(this, (bidTxId + "_highest_bid")) | |
156 | 378 | let asBidder = getStringValue(this, (bidTxId + "_winner")) | |
157 | 379 | let bidForNFT = getStringValue(this, (bidTxId + "_nft_id")) | |
158 | - | if (( | |
380 | + | if ((toBase64String(caller) != asBidder)) | |
159 | 381 | then throw("No bid") | |
160 | - | else [ | |
382 | + | else [StringEntry((bidTxId + "_nft_id"), bidForNFT), StringEntry((bidTxId + "_bidding_price_refund_amount"), bidPrice), ScriptTransfer(i.caller, parseIntValue(bidPrice), unit)] | |
161 | 383 | } | |
162 | 384 | ||
163 | 385 |
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 | - | let kBuy = "buy" | |
6 | + | let kAuction = "auction" | |
7 | + | ||
8 | + | let kSell = "sell" | |
9 | + | ||
10 | + | let kTrusted = "trusted" | |
7 | 11 | ||
8 | 12 | let kPrice = "price" | |
9 | 13 | ||
10 | - | ||
14 | + | func getSlotKey (prefix,nftId) = ((prefix + separator) + toBase58String(nftId)) | |
11 | 15 | ||
12 | - | let maxAuctionDuration = 7 | |
13 | 16 | ||
14 | - | ||
17 | + | func getPriceKey (nftId) = ((kPrice + separator) + toBase58String(nftId)) | |
15 | 18 | ||
16 | - | let statusForNFT = $Tuple4("OPEN", "CLOSED", "REWARDED", "CANCELED") | |
17 | 19 | ||
18 | - | let dAppAddress = base58'3MvjAaDYHpS4A5K4CV3kZMMEH9m9JdBSvbq' | |
20 | + | func getSellKey (nftId) = ((kSell + separator) + toBase58String(nftId)) | |
21 | + | ||
22 | + | ||
23 | + | func getAuctionKey (nftId) = ((kAuction + separator) + toBase58String(nftId)) | |
24 | + | ||
25 | + | ||
26 | + | func getTrustedKey (issuer) = ((kTrusted + separator) + toString(issuer)) | |
27 | + | ||
28 | + | ||
29 | + | func addToList (accum,nextValue) = (accum ++ [nextValue]) | |
30 | + | ||
31 | + | ||
32 | + | func joinString (params) = { | |
33 | + | let length = size(params) | |
34 | + | if ((length == 0)) | |
35 | + | then throw("Empty params") | |
36 | + | else if ((length == 1)) | |
37 | + | then makeString({ | |
38 | + | let $l = params | |
39 | + | let $s = size($l) | |
40 | + | let $acc0 = nil | |
41 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
42 | + | then $a | |
43 | + | else addToList($a, $l[$i]) | |
44 | + | ||
45 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
46 | + | then $a | |
47 | + | else throw("List size exceeds 1") | |
48 | + | ||
49 | + | $f0_2($f0_1($acc0, 0), 1) | |
50 | + | }, separator) | |
51 | + | else if ((length == 2)) | |
52 | + | then makeString({ | |
53 | + | let $l = params | |
54 | + | let $s = size($l) | |
55 | + | let $acc0 = nil | |
56 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
57 | + | then $a | |
58 | + | else addToList($a, $l[$i]) | |
59 | + | ||
60 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
61 | + | then $a | |
62 | + | else throw("List size exceeds 2") | |
63 | + | ||
64 | + | $f0_2($f0_1($f0_1($acc0, 0), 1), 2) | |
65 | + | }, separator) | |
66 | + | else if ((length == 3)) | |
67 | + | then makeString({ | |
68 | + | let $l = params | |
69 | + | let $s = size($l) | |
70 | + | let $acc0 = nil | |
71 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
72 | + | then $a | |
73 | + | else addToList($a, $l[$i]) | |
74 | + | ||
75 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
76 | + | then $a | |
77 | + | else throw("List size exceeds 3") | |
78 | + | ||
79 | + | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) | |
80 | + | }, separator) | |
81 | + | else if ((length == 4)) | |
82 | + | then makeString({ | |
83 | + | let $l = params | |
84 | + | let $s = size($l) | |
85 | + | let $acc0 = nil | |
86 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
87 | + | then $a | |
88 | + | else addToList($a, $l[$i]) | |
89 | + | ||
90 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
91 | + | then $a | |
92 | + | else throw("List size exceeds 4") | |
93 | + | ||
94 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4) | |
95 | + | }, separator) | |
96 | + | else if ((length == 5)) | |
97 | + | then makeString({ | |
98 | + | let $l = params | |
99 | + | let $s = size($l) | |
100 | + | let $acc0 = nil | |
101 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
102 | + | then $a | |
103 | + | else addToList($a, $l[$i]) | |
104 | + | ||
105 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
106 | + | then $a | |
107 | + | else throw("List size exceeds 5") | |
108 | + | ||
109 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
110 | + | }, separator) | |
111 | + | else throw("Max number of parameters exceeded") | |
112 | + | } | |
113 | + | ||
114 | + | ||
115 | + | func parseAsAuction (details) = { | |
116 | + | let res = split(details, separator) | |
117 | + | $Tuple5(addressFromStringValue(res[0]), parseIntValue(res[1]), parseIntValue(res[2]), parseIntValue(res[3]), parseIntValue(res[4])) | |
118 | + | } | |
119 | + | ||
120 | + | ||
121 | + | func parseAsSell (details) = { | |
122 | + | let res = split(details, separator) | |
123 | + | $Tuple2(addressFromStringValue(res[0]), parseIntValue(res[1])) | |
124 | + | } | |
125 | + | ||
126 | + | ||
127 | + | func joinStruct (params) = match params { | |
128 | + | case auction: (Address, Int, String, String) => | |
129 | + | joinString([toString(auction._1), toString(auction._2), auction._3, auction._4]) | |
130 | + | case sell: (Address, Int) => | |
131 | + | joinString([toString(sell._1), toString(sell._2)]) | |
132 | + | case _ => | |
133 | + | throw("Wrong params tupple") | |
134 | + | } | |
135 | + | ||
136 | + | ||
137 | + | func setAuction (seller,nftId,startPrice,start,end) = StringEntry(getAuctionKey(nftId), joinStruct($Tuple4(seller, startPrice, start, end))) | |
138 | + | ||
139 | + | ||
140 | + | func setSell (nftId,celler,price) = StringEntry(getSellKey(nftId), joinStruct($Tuple2(celler, price))) | |
141 | + | ||
142 | + | ||
143 | + | func getAuction (nftId) = value(getString(this, getAuctionKey(nftId))) | |
144 | + | ||
145 | + | ||
146 | + | func getSell (nftId) = value(getString(this, getSellKey(nftId))) | |
147 | + | ||
148 | + | ||
149 | + | func calcPriceAtCurrentMoment (assetId,moment) = { | |
150 | + | let details = getAuction(assetId) | |
151 | + | let $t027552859 = parseAsAuction(details) | |
152 | + | let seller = $t027552859._1 | |
153 | + | let startPriceValue = $t027552859._2 | |
154 | + | let endPriceValue = $t027552859._3 | |
155 | + | let startPeriodValue = $t027552859._4 | |
156 | + | let endPeriodValue = $t027552859._5 | |
157 | + | if ((moment >= endPeriodValue)) | |
158 | + | then $Tuple2(seller, endPriceValue) | |
159 | + | else { | |
160 | + | let deltaPrice = (startPriceValue - endPriceValue) | |
161 | + | let period = (endPeriodValue - startPeriodValue) | |
162 | + | let spended = (moment - startPeriodValue) | |
163 | + | $Tuple2(seller, (startPriceValue - fraction(spended, deltaPrice, period))) | |
164 | + | } | |
165 | + | } | |
166 | + | ||
19 | 167 | ||
20 | 168 | func isNft (assetId) = match assetInfo(assetId) { | |
21 | 169 | case token: Asset => | |
22 | 170 | if (if ((token.decimals == 0)) | |
23 | 171 | then (token.quantity == 1) | |
24 | 172 | else false) | |
25 | 173 | then (token.reissuable == false) | |
26 | 174 | else false | |
27 | 175 | case _ => | |
28 | 176 | false | |
29 | 177 | } | |
30 | 178 | ||
31 | 179 | ||
180 | + | func isTrustedNft (assetId) = { | |
181 | + | let issuer = value(assetInfo(assetId)).issuer | |
182 | + | valueOrElse(getBoolean(this, getTrustedKey(issuer)), false) | |
183 | + | } | |
184 | + | ||
185 | + | ||
186 | + | func isSellExist (assetId) = isDefined(getString(this, getSellKey(assetId))) | |
187 | + | ||
188 | + | ||
189 | + | func isAuctionExist (assetId) = isDefined(getString(this, getAuctionKey(assetId))) | |
190 | + | ||
191 | + | ||
192 | + | func isCorrectSellPrice (price) = (price > 0) | |
193 | + | ||
194 | + | ||
195 | + | func isCorrectAuctionPrices (startPrice,endPrice) = (startPrice > endPrice) | |
196 | + | ||
197 | + | ||
198 | + | func isAdmin (caller) = (caller == this) | |
199 | + | ||
200 | + | ||
201 | + | func isValidCaller (caller,seller) = if ((caller == this)) | |
202 | + | then true | |
203 | + | else (caller == seller) | |
204 | + | ||
205 | + | ||
206 | + | func isAuctionEnded (now,end) = (now > end) | |
207 | + | ||
208 | + | ||
209 | + | func isEnoughFunds (payment,currentMomentPrice) = (payment >= currentMomentPrice) | |
210 | + | ||
211 | + | ||
212 | + | func isWawes (assetId) = (assetId == unit) | |
213 | + | ||
214 | + | ||
215 | + | func isCorrectNft (nftId) = if (!(isNft(nftId))) | |
216 | + | then throw("Token is not Nft") | |
217 | + | else if (isSellExist(nftId)) | |
218 | + | then throw("Sell already exists") | |
219 | + | else if (isAuctionExist(nftId)) | |
220 | + | then throw("Auction already exists") | |
221 | + | else unit | |
222 | + | ||
223 | + | ||
224 | + | func isCorrectPayments (paymentAsset,paymentAmount,price) = if (!(isWawes(paymentAsset))) | |
225 | + | then throw("Payment must be at WAVES") | |
226 | + | else if (!(isEnoughFunds(paymentAmount, price))) | |
227 | + | then throw("Not enough funds") | |
228 | + | else unit | |
229 | + | ||
230 | + | ||
231 | + | func calcFee () = 0 | |
232 | + | ||
233 | + | ||
234 | + | func calcTrustedFee () = 0 | |
235 | + | ||
236 | + | ||
237 | + | func resultFundsAmounts (isTrusted,paymentAmount,actualPrice) = if (isTrusted) | |
238 | + | then $Tuple2((actualPrice - calcTrustedFee()), (paymentAmount - actualPrice)) | |
239 | + | else $Tuple2((actualPrice - calcFee()), (paymentAmount - actualPrice)) | |
240 | + | ||
241 | + | ||
242 | + | func getSlot (nftId) = if (isSellExist(nftId)) | |
243 | + | then $Tuple2(kSell, getSell(nftId)) | |
244 | + | else if (isAuctionExist(nftId)) | |
245 | + | then $Tuple2(kAuction, getAuction(nftId)) | |
246 | + | else throw("Slot doesn`t exist") | |
247 | + | ||
248 | + | ||
249 | + | let kBuy = "buy" | |
250 | + | ||
251 | + | let kBid = "bid" | |
252 | + | ||
253 | + | let statusForNFT = $Tuple4("OPEN", "CLOSED", "REWARDED", "CANCELED") | |
254 | + | ||
255 | + | let dAppAddress = base58'3N85YW6NZ9pLYvSdt1ASMQTGxvncnU1vUNx' | |
256 | + | ||
32 | 257 | @Callable(i) | |
33 | - | func createNft (nft_name,nft_ | |
258 | + | func createNft (nft_name,nft_dAppAddress,nft_selling_price,nft_description,nft_onSell,nft_data) = { | |
34 | 259 | let newToken = Issue(nft_name, nft_description, 1, 0, false) | |
35 | 260 | let issueId = calculateAssetId(newToken) | |
36 | 261 | let txId = i.transactionId | |
37 | - | [newToken, ScriptTransfer(i.caller, 1, issueId | |
262 | + | [newToken, ScriptTransfer(i.caller, 1, issueId), 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))] | |
38 | 263 | } | |
39 | 264 | ||
40 | 265 | ||
41 | 266 | ||
42 | 267 | @Callable(i) | |
43 | 268 | func sellNFT (price) = { | |
44 | 269 | let txId = i.transactionId | |
45 | - | let seller = i.caller.bytes | |
46 | - | let $t017921877 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) | |
47 | - | let token0 = $t017921877._1 | |
48 | - | let amount0 = $t017921877._2 | |
49 | - | if (!(isNft(token0))) | |
270 | + | let $t062796364 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) | |
271 | + | let token0 = $t062796364._1 | |
272 | + | let amount0 = $t062796364._2 | |
273 | + | if (isNft(token0)) | |
50 | 274 | then throw("Token is not NFT") | |
51 | - | else [StringEntry(((kPrice + separator) + toBase58String(value(i.payments[0].assetId))), price), StringEntry(((toString(i.caller) + separator) + kSell), ((toBase58String(token0) + separator) + toString(amount0)))] | |
275 | + | else [StringEntry(((kPrice + separator) + toBase58String(value(i.payments[0].assetId))), toString(price)), StringEntry(((toString(i.caller) + separator) + kSell), ((toBase58String(token0) + separator) + toString(amount0)))] | |
52 | 276 | } | |
53 | 277 | ||
54 | 278 | ||
55 | 279 | ||
56 | 280 | @Callable(i) | |
57 | 281 | func buyNFT (nftID,current_nft_owner) = { | |
58 | - | let assetId = fromBase58String( | |
282 | + | let assetId = fromBase58String(current_nft_owner) | |
59 | 283 | let amount = value(i.payments[0].amount) | |
60 | 284 | let checkOwnerIsSame = match getString(this, (("nft_" + current_nft_owner) + "_owner")) { | |
61 | 285 | case a: String => | |
62 | 286 | a | |
63 | 287 | case _ => | |
64 | - | | |
288 | + | true | |
65 | 289 | } | |
66 | 290 | let price = getStringValue(((((kPrice + separator) + nftID) + "_") + current_nft_owner)) | |
291 | + | let owner = valueOrErrorMessage(getStringValue((separator + "Owner")), "No owner") | |
67 | 292 | if ((i.payments[0].assetId != unit)) | |
68 | 293 | then throw("Pay in waves") | |
69 | - | else if (( | |
70 | - | then throw(" | |
71 | - | else [ | |
294 | + | else if ((checkOwnerIsSame == toString(i.caller))) | |
295 | + | then throw("Owner of NFT not able to purchase") | |
296 | + | else [StringEntry(((toString(i.caller) + separator) + kBuy), (nftID + separator)), DeleteEntry((("nft_" + current_nft_owner) + "_owner"))] | |
72 | 297 | } | |
73 | 298 | ||
74 | 299 | ||
75 | 300 | ||
76 | 301 | @Callable(i) | |
77 | - | func | |
302 | + | func sellauction (start,end,startPrice,duration) = { | |
78 | 303 | let txId = toBase58String(i.transactionId) | |
79 | - | let nftId = value(i.payments[ | |
304 | + | let nftId = value(i.payments[1].assetId) | |
80 | 305 | let price = value(startPrice) | |
81 | - | let endHeight = (lastBlock.height + duration) | |
82 | 306 | let caller = i.caller.bytes | |
83 | 307 | let checkNftAuctioned = match getString(this, (((toBase58String(nftId) + separator) + "nft_status_") + toBase58String(caller))) { | |
84 | 308 | case a: String => | |
85 | 309 | true | |
86 | 310 | case _ => | |
87 | 311 | false | |
88 | 312 | } | |
89 | 313 | if ((i.payments[0].assetId == unit)) | |
90 | 314 | then throw("NFT not attached") | |
91 | 315 | else if ((checkNftAuctioned == true)) | |
92 | 316 | then throw("Already in auction list") | |
93 | - | else if ((duration > maxAuctionDuration)) | |
94 | - | then throw(("Duration is too long. Must be less than or equal to 7 " + toString(maxAuctionDuration))) | |
95 | - | else [StringEntry(((txId + "_nft_start_auction_date_") + toBase58String(caller)), start), StringEntry(((txId + "_nft_end_auction_date_") + toBase58String(caller)), end), StringEntry((txId + "_nft_start_price"), startPrice), StringEntry((txId + "_nft_owner"), toString(i.caller)), StringEntry((txId + "_nft_on_auction"), toBase58String(nftId)), StringEntry((txId + "_previous_bidder"), "none"), StringEntry((txId + "_highest_bid"), "0"), StringEntry((txId + "_winner_of_nft"), "0"), StringEntry((txId + "_bidder_count"), "0"), StringEntry((txId + "_nft_status"), "OPEN")] | |
317 | + | else [StringEntry(((txId + "_nft_start_auction_date_") + toBase58String(caller)), start), StringEntry(((txId + "_nft_end_auction_date_") + toBase58String(caller)), end), StringEntry((txId + "_nft_start_price"), startPrice), IntegerEntry((txId + "duration_of_auction"), duration), StringEntry((txId + "_nft_owner"), toString(i.caller)), StringEntry((txId + "_nft_on_auction"), toBase58String(nftId)), StringEntry((txId + "_previous_bidder"), "none"), StringEntry((txId + "_highest_bid"), "0"), StringEntry((txId + "_winner_of_nft"), "0"), StringEntry((txId + "_bidder_count"), "0"), StringEntry((txId + "_nft_status"), "OPEN")] | |
96 | 318 | } | |
97 | 319 | ||
98 | 320 | ||
99 | 321 | ||
100 | 322 | @Callable(i) | |
101 | - | func | |
323 | + | func iqplace (auctionId,nftId,nft_owner,bid_price) = { | |
102 | 324 | let txId = toBase58String(i.transactionId) | |
103 | 325 | let caller = i.caller.bytes | |
104 | - | let assetId = | |
105 | - | let currentBidPrice = i.payments[ | |
326 | + | let assetId = fromBase64String(nftId) | |
327 | + | let currentBidPrice = i.payments[1].amount | |
106 | 328 | let getLastWinnerBidPrice = getStringValue(this, (auctionId + "_highest_bid")) | |
107 | 329 | let getPreviousBidderAddress = getString(this, (auctionId + "_previous_bidder")) | |
108 | 330 | let currentBidCount = getStringValue(this, (auctionId + "_bidder_count")) | |
109 | 331 | let getLastWinnerAddress = getStringValue(this, (auctionId + "_winner_of_nft")) | |
110 | 332 | let checkNftAuctioned = getStringValue(this, (auctionId + "_nft_status")) | |
111 | 333 | if ((i.payments[0].assetId != unit)) | |
112 | 334 | then throw("Pay in waves") | |
113 | 335 | else if ((checkNftAuctioned != "OPEN")) | |
114 | 336 | then throw("Not open for auction") | |
115 | 337 | else if ((parseIntValue(getLastWinnerBidPrice) >= currentBidPrice)) | |
116 | 338 | then throw("Bid is less then starting/highest Bid") | |
117 | - | else if ((getLastWinnerBidPrice == " | |
339 | + | else if ((getLastWinnerBidPrice == "3")) | |
118 | 340 | then [StringEntry((auctionId + "_highest_bid"), toString(currentBidPrice)), StringEntry((auctionId + "_winner_of_nft"), toBase58String(i.caller.bytes)), StringEntry((auctionId + "_bidder_count"), toString((parseIntValue(currentBidCount) + 1))), StringEntry((auctionId + "_nft_id"), toBase58String(assetId)), StringEntry((auctionId + "_nft_owner"), nft_owner), StringEntry((((txId + "_") + auctionId) + "_highest_bid"), toString(currentBidPrice)), StringEntry((((txId + "_") + auctionId) + "_winner"), toBase58String(i.caller.bytes)), StringEntry((((txId + "_") + auctionId) + "_bidder_count"), toString((parseIntValue(currentBidCount) + 1))), StringEntry((((txId + "_") + auctionId) + "_nft_id"), toBase58String(assetId)), StringEntry((((txId + "_") + auctionId) + "_nft_owner"), nft_owner), StringEntry((txId + "_bid_for_nft_by"), toBase58String(caller)), StringEntry((txId + "_bid_price_place"), bid_price), StringEntry((txId + "_previous_bid_amount_refund_to_address"), getLastWinnerAddress), StringEntry((txId + "_prevoius_bid_amount_refund"), getLastWinnerBidPrice)] | |
119 | 341 | else [StringEntry((auctionId + "_highest_bid"), toString(currentBidPrice)), StringEntry((auctionId + "_winner_of_nft"), toBase58String(i.caller.bytes)), StringEntry((auctionId + "_bidder_count"), toString((parseIntValue(currentBidCount) + 1))), StringEntry((auctionId + "_nft_id"), toBase58String(assetId)), StringEntry((auctionId + "_nft_owner"), nft_owner), StringEntry((((txId + "_") + auctionId) + "_highest_bid"), toString(currentBidPrice)), StringEntry((((txId + "_") + auctionId) + "_winner"), toBase58String(i.caller.bytes)), StringEntry((((txId + "_") + auctionId) + "_bidder_count"), toString((parseIntValue(currentBidCount) + 1))), StringEntry((((txId + "_") + auctionId) + "_nft_id"), toBase58String(assetId)), StringEntry((((txId + "_") + auctionId) + "_nft_owner"), nft_owner), StringEntry((txId + "_bid_for_nft_by"), toBase58String(caller)), StringEntry((txId + "_bid_price_place"), bid_price), StringEntry((txId + "_previous_bid_amount_refund_to_address"), getLastWinnerAddress), StringEntry((txId + "_prevoius_bid_amount_refund"), getLastWinnerBidPrice), ScriptTransfer(Address(fromBase58String(getLastWinnerAddress)), parseIntValue(getLastWinnerBidPrice), unit)] | |
120 | 342 | } | |
121 | 343 | ||
122 | 344 | ||
123 | 345 | ||
124 | 346 | @Callable(i) | |
125 | 347 | func acceptBidOffer (auctionId,nftId,bid_amount_from_user) = { | |
126 | 348 | let txId = toBase58String(i.transactionId) | |
127 | 349 | let caller = i.caller.bytes | |
128 | 350 | let assetId = fromBase58String(nftId) | |
129 | 351 | let getNftWinningPrice = getStringValue(this, (auctionId + "_highest_bid")) | |
130 | 352 | let getAuctionWinner = getStringValue(this, (auctionId + "_winner_of_nft")) | |
131 | - | [ScriptTransfer(Address(caller), parseIntValue(getNftWinningPrice), unit | |
353 | + | [ScriptTransfer(Address(caller), parseIntValue(getNftWinningPrice), unit), StringEntry((txId + "_amount_paid_to_owner"), getNftWinningPrice), StringEntry((txId + "_nft_status"), "REWARDED"), StringEntry((auctionId + "_amount_paid_to_owner"), getNftWinningPrice), StringEntry((auctionId + "_nft_transfer_to"), getAuctionWinner), StringEntry((auctionId + "_nft_status"), "REWARDED")] | |
132 | 354 | } | |
133 | 355 | ||
134 | 356 | ||
135 | 357 | ||
136 | 358 | @Callable(i) | |
137 | - | func | |
138 | - | let txId = | |
359 | + | func cancel1Auction (auctionId) = { | |
360 | + | let txId = toBase64String(i.transactionId) | |
139 | 361 | let caller = i.caller.bytes | |
140 | 362 | let auctionStatus = getStringValue(this, (auctionId + "_nft_status")) | |
141 | 363 | let biddingWinner = getStringValue(this, (auctionId + "_winner_of_nft")) | |
142 | 364 | let nftOwner = getStringValue(this, (auctionId + "_nft_owner")) | |
143 | 365 | let nftId = getStringValue(this, (auctionId + "_nft_on_auction")) | |
144 | 366 | let biddingPrice = getStringValue(this, (auctionId + "_highest_bid")) | |
145 | 367 | if ((biddingWinner == "0")) | |
146 | - | then [ | |
147 | - | else [StringEntry((auctionId + "_nft_status"), "CANCELED"), StringEntry((auctionId + "_previous_bid_amount_refund_to_address"), biddingWinner), StringEntry((auctionId + "_prevoius_bid_amount_refund"), biddingPrice), StringEntry((txId + "_nft_status"), "CANCELED"), | |
368 | + | then [ScriptTransfer(Address(fromBase58String(nftOwner)), 1, fromBase58String(nftId))] | |
369 | + | else [StringEntry((auctionId + "_nft_status"), "CANCELED"), StringEntry((auctionId + "_previous_bid_amount_refund_to_address"), biddingWinner), StringEntry((auctionId + "_prevoius_bid_amount_refund"), biddingPrice), StringEntry((txId + "_nft_status"), "CANCELED"), ScriptTransfer(Address(fromBase58String(nftOwner)), 1, fromBase58String(nftId)), ScriptTransfer(Address(fromBase58String(biddingWinner)), parseIntValue(biddingPrice), unit)] | |
148 | 370 | } | |
149 | 371 | ||
150 | 372 | ||
151 | 373 | ||
152 | 374 | @Callable(i) | |
153 | - | func | |
375 | + | func WITH (bidTxId) = { | |
154 | 376 | let caller = i.caller.bytes | |
155 | 377 | let bidPrice = getStringValue(this, (bidTxId + "_highest_bid")) | |
156 | 378 | let asBidder = getStringValue(this, (bidTxId + "_winner")) | |
157 | 379 | let bidForNFT = getStringValue(this, (bidTxId + "_nft_id")) | |
158 | - | if (( | |
380 | + | if ((toBase64String(caller) != asBidder)) | |
159 | 381 | then throw("No bid") | |
160 | - | else [ | |
382 | + | else [StringEntry((bidTxId + "_nft_id"), bidForNFT), StringEntry((bidTxId + "_bidding_price_refund_amount"), bidPrice), ScriptTransfer(i.caller, parseIntValue(bidPrice), unit)] | |
161 | 383 | } | |
162 | 384 | ||
163 | 385 | ||
164 | 386 | ||
165 | 387 | @Callable(i) | |
166 | 388 | func testBid (data) = [StringEntry("E8kkFBYCy44JJaq6pAZ6KizsuResi5UKNhbD1WNZwhhY_highest_bid", "0")] | |
167 | 389 | ||
168 | 390 |
github/deemru/w8io/169f3d6 69.40 ms ◑