tx · 7cDHm58dpzhQuJDBWfRddBwWdDrPcNPHJaAomN2v9wqf 3N5BTH4bjnXn7AAKoj4sswxytsPGmdXUuTx: -0.01000000 Waves 2023.03.29 13:07 [2511089] smart account 3N5BTH4bjnXn7AAKoj4sswxytsPGmdXUuTx > SELF 0.00000000 Waves
{ "type": 13, "id": "7cDHm58dpzhQuJDBWfRddBwWdDrPcNPHJaAomN2v9wqf", "fee": 1000000, "feeAssetId": null, "timestamp": 1680084647269, "version": 2, "chainId": 84, "sender": "3N5BTH4bjnXn7AAKoj4sswxytsPGmdXUuTx", "senderPublicKey": "DyeDJ3fgwVVux2WRkxpLU9BbVjTM96AyV58b7bRFzCBx", "proofs": [ "tz9TTqBpxCShFuh8Q3EV9Aq3ZBwwsoh3zLAskGwMxbgb8N9mxmsuo8up6UNZReutL97PshA7ArfSqkcCGFVYDyK" ], "script": "base64:BgIHCAISAwoBGAABAWkBFGJ1eUFsbFByb2R1Y3RzX2FzaW1pAQduZnRJbmZvBAVidXllcggFAWkGY2FsbGVyBAxidXllckJhbGFuY2UJAPAHAgUFYnV5ZXIBIIVjlaPziI6w3gwXjghOv5o/krsm2zrodo4W3BQiKkh+BAZhbW91bnQJAQV2YWx1ZQEICQCRAwIIBQFpCHBheW1lbnRzAAAGYW1vdW50BAhyZWFsY29zdAkAZQIFBmFtb3VudAkAaAIJAGkCBQZhbW91bnQA6AcAGQQLcGxhdGZvcm1mZWUJAGUCBQZhbW91bnQFCHJlYWxjb3N0BARuZlQxCQC1CQIJAJEDAgUHbmZ0SW5mbwAAAgFfBARuZlQyCQC1CQIJAJEDAgUHbmZ0SW5mbwABAgFfBARuZlQzCQC1CQIJAJEDAgUHbmZ0SW5mbwACAgFfBARuZlQ0CQC1CQIJAJEDAgUHbmZ0SW5mbwADAgFfBARuZlQ1CQC1CQIJAJEDAgUHbmZ0SW5mbwAEAgFfAwkAZgIFBmFtb3VudAUMYnV5ZXJCYWxhbmNlCQACAQI6QnV5ZXIgZG9lcyBub3Qg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2QQBCQCRAwIFBG5mVDIAAQkAaAIJAQ1wYXJzZUludFZhbHVlAQkAkQMCBQRuZlQyAAIAZAEghWOVo/OIjrDeDBeOCE6/mj+SuybbOuh2jhbcFCIqSH4JAMwIAgkBDlNjcmlwdFRyYW5zZmVyAwkBB0FkZHJlc3MBCQDZBAEJAJEDAgUEbmZUMwABCQBoAgkBDXBhcnNlSW50VmFsdWUBCQCRAwIFBG5mVDMAAgBkASCFY5Wj84iOsN4MF44ITr+aP5K7Jts66HaOFtwUIipIfgkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCQEHQWRkcmVzcwEJANkEAQkAkQMCBQRuZlQ0AAEJAGgCCQENcGFyc2VJbnRWYWx1ZQEJAJEDAgUEbmZUNAACAGQBIIVjlaPziI6w3gwXjghOv5o/krsm2zrodo4W3BQiKkh+CQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMJAQdBZGRyZXNzAQkA2QQBCQCRAwIFBG5mVDUAAQkAaAIJAQ1wYXJzZUludFZhbHVlAQkAkQMCBQRuZlQ1AAIAZAEghWOVo/OIjrDeDBeOCE6/mj+SuybbOuh2jhbcFCIqSH4FA25pbAMJAGYCCQCQAwEFB25mdEluZm8ABQkAAgECLXNvcnJ5ISBtYXhpbXVtIGxpbWl0IG9mIHlvdXIgIGNhcnQgaXMgNSBpdGVtcwUDbmlsAGTq794=", "height": 2511089, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 7b2fp8zucvXq1kjwr4xVd3jKkSeSSez1Bz3HyZwa1i85 Next: 3Tgy32yD48sW9FfnPNzffYE6Jc2hPh4JgCrNtD5hYHy8 Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let separator = "_" | |
5 | - | ||
6 | - | let kBuy = "buy" | |
7 | - | ||
8 | - | let kPrice = "price" | |
9 | - | ||
10 | - | let kSell = "sell" | |
11 | - | ||
12 | - | let maxAuctionDuration = 30 | |
13 | - | ||
14 | - | let teams = base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq' | |
15 | - | ||
16 | - | let WAVES = base58'' | |
17 | - | ||
18 | - | let kBid = "bid" | |
19 | - | ||
20 | - | let paused = true | |
21 | - | ||
22 | - | let statusForNFT = $Tuple4("OPEN", "CLOSED", "REWARDED", "CANCELED") | |
23 | - | ||
24 | - | let dAppAddress = base58'3MvjAaDYHpS4A5K4CV3kZMMEH9m9JdBSvbq' | |
25 | - | ||
26 | - | func isNft (assetId) = match assetInfo(assetId) { | |
27 | - | case token: Asset => | |
28 | - | if (if ((token.decimals == 0)) | |
29 | - | then (token.quantity == 1) | |
30 | - | else false) | |
31 | - | then (token.reissuable == false) | |
32 | - | else false | |
33 | - | case _ => | |
34 | - | false | |
35 | - | } | |
36 | - | ||
37 | - | ||
38 | - | @Callable(i) | |
39 | - | func createNft (nft_name,nft_owner,nft_dAppAddress,nft_type,nft_tags,nft_selling_price,nft_description,nft_onSell,nft_data) = { | |
40 | - | let newToken = Issue(nft_name, nft_description, 1, 0, false) | |
41 | - | let issueId = calculateAssetId(newToken) | |
42 | - | let txId = i.transactionId | |
43 | - | [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))] | |
44 | - | } | |
45 | - | ||
46 | - | ||
47 | - | ||
48 | - | @Callable(i) | |
49 | - | func sellNFT (price,payment_currency) = { | |
50 | - | let txId = i.transactionId | |
51 | - | let seller = i.caller.bytes | |
52 | - | let $t023742459 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) | |
53 | - | let token0 = $t023742459._1 | |
54 | - | let amount0 = $t023742459._2 | |
55 | - | if (!(isNft(token0))) | |
56 | - | then throw("Token is not NFT") | |
57 | - | else [StringEntry(((kPrice + separator) + toBase58String(value(i.payments[0].assetId))), price), StringEntry(((toString(i.caller) + separator) + kSell), (((toBase58String(token0) + separator) + toString(amount0)) + payment_currency))] | |
58 | - | } | |
59 | - | ||
60 | - | ||
61 | - | ||
62 | - | @Callable(i) | |
63 | - | func buyNFT (nftID,current_nft_owner) = { | |
64 | - | let assetId = fromBase58String(nftID) | |
65 | - | let checkOwnerIsSame = match getString(this, (("nft_" + current_nft_owner) + "_owner")) { | |
66 | - | case a: String => | |
67 | - | a | |
68 | - | case _ => | |
69 | - | false | |
70 | - | } | |
71 | - | let price = getStringValue(((((kPrice + separator) + nftID) + "_") + current_nft_owner)) | |
72 | - | let amount = value(i.payments[0].amount) | |
73 | - | let sellerAmount = (amount - ((amount / 1000) * 25)) | |
74 | - | let platform_fee = (amount - sellerAmount) | |
75 | - | if ((current_nft_owner == toString(i.caller))) | |
76 | - | then throw("current Owner of NFT not able to purchase") | |
77 | - | else if ((i.payments[0].assetId == teams)) | |
78 | - | then [ScriptTransfer(i.caller, 1, assetId), ScriptTransfer(Address(fromBase58String(current_nft_owner)), sellerAmount, teams), StringEntry((("nft_" + nftID) + "platform_fee"), toString(platform_fee)), StringEntry(((toString(i.caller) + separator) + kBuy), ((nftID + separator) + toString(amount))), DeleteEntry((("nft_" + current_nft_owner) + "_owner")), StringEntry((("nft_" + current_nft_owner) + "_owner"), toString(i.caller)), StringEntry(((nftID + separator) + "_owner"), toString(i.caller))] | |
79 | - | else if ((i.payments[0].assetId == unit)) | |
80 | - | then [ScriptTransfer(i.caller, 1, assetId), ScriptTransfer(Address(fromBase58String(current_nft_owner)), sellerAmount, unit), StringEntry((("nft_" + nftID) + "platform_fee"), toString(platform_fee)), StringEntry(((toString(i.caller) + separator) + kBuy), ((nftID + separator) + toString(amount))), DeleteEntry((("nft_" + current_nft_owner) + "_owner")), StringEntry((("nft_" + current_nft_owner) + "_owner"), toString(i.caller)), StringEntry(((nftID + separator) + "_owner"), toString(i.caller))] | |
81 | - | else nil | |
82 | - | } | |
83 | - | ||
84 | - | ||
85 | - | ||
86 | - | @Callable(i) | |
87 | - | func cancelSell (nftId) = { | |
88 | - | let txId = toBase58String(i.transactionId) | |
89 | - | let seller = i.caller.bytes | |
90 | - | [StringEntry(((txId + nftId) + "_nft_status"), "CANCELED"), ScriptTransfer(Address(seller), 1, fromBase58String(nftId))] | |
91 | - | } | |
92 | - | ||
93 | - | ||
94 | - | ||
95 | - | @Callable(i) | |
96 | - | func addAuction (start,end,startPrice,duration,payment_currency) = { | |
97 | - | let txId = toBase58String(i.transactionId) | |
98 | - | let nftId = value(i.payments[0].assetId) | |
99 | - | let price = value(startPrice) | |
100 | - | let endHeight = (lastBlock.height + duration) | |
101 | - | let caller = i.caller.bytes | |
102 | - | let checkNftAuctioned = match getString(this, (((toBase58String(nftId) + separator) + "nft_status_") + toBase58String(caller))) { | |
103 | - | case a: String => | |
104 | - | true | |
105 | - | case _ => | |
106 | - | false | |
107 | - | } | |
108 | - | if ((checkNftAuctioned == true)) | |
109 | - | then throw("Already in auction list") | |
110 | - | else if ((duration > maxAuctionDuration)) | |
111 | - | then throw(("Duration is too long. Must be less than or equal to 30 " + toString(maxAuctionDuration))) | |
112 | - | else if ((i.payments[0].assetId == unit)) | |
113 | - | then throw("NFT not attached") | |
114 | - | else if ((i.payments[0].assetId == teams)) | |
115 | - | then throw("NFT not attached") | |
116 | - | 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")] | |
117 | - | } | |
118 | - | ||
119 | - | ||
120 | - | ||
121 | - | @Callable(i) | |
122 | - | func placeBid (auctionId,nftId,nft_owner,bid_price,current_currency) = { | |
123 | - | let txId = toBase58String(i.transactionId) | |
124 | - | let caller = i.caller.bytes | |
125 | - | let assetId = fromBase58String(nftId) | |
126 | - | let tokenType = i.payments[0].assetId | |
127 | - | let currentBidPrice = i.payments[0].amount | |
128 | - | let getLastWinnerBidPrice = getStringValue(this, (auctionId + "_highest_bid")) | |
129 | - | let getPreviousBidderAddress = getString(this, (auctionId + "_previous_bidder")) | |
130 | - | let currentBidCount = getStringValue(this, (auctionId + "_bidder_count")) | |
131 | - | let getLastWinnerAddress = getStringValue(this, (auctionId + "_winner_of_nft")) | |
132 | - | let checkNftAuctioned = getStringValue(this, (auctionId + "_nft_status")) | |
133 | - | if ((checkNftAuctioned != "OPEN")) | |
134 | - | then throw("Not open for auction") | |
135 | - | else if ((parseIntValue(getLastWinnerBidPrice) >= currentBidPrice)) | |
136 | - | then throw("Bid is less then starting/highest Bid") | |
137 | - | else if ((getLastWinnerBidPrice == "0")) | |
138 | - | 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)] | |
139 | - | else if ((getLastWinnerBidPrice != "0")) | |
140 | - | then [ScriptTransfer(Address(fromBase58String(getLastWinnerAddress)), parseIntValue(getLastWinnerBidPrice), tokenType), StringEntry((txId + "_previous_bid_amount_refund_to_address"), getLastWinnerAddress), StringEntry((txId + "_prevoius_bid_amount_refund"), getLastWinnerBidPrice), StringEntry((auctionId + "_bidder_count"), toString((parseIntValue(currentBidCount) + 1))), StringEntry((auctionId + "_highest_bid"), toString(currentBidPrice)), StringEntry((auctionId + "_winner_of_nft"), toBase58String(i.caller.bytes)), 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)] | |
141 | - | else nil | |
142 | - | } | |
143 | - | ||
144 | - | ||
145 | - | ||
146 | - | @Callable(i) | |
147 | - | func acceptBidOffer (auctionId,nftId,bid_amount_from_user,current_currency) = { | |
148 | - | let asimiString = "9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq" | |
149 | - | let txId = toBase58String(i.transactionId) | |
150 | - | let amountUnit = fromBase58String(current_currency) | |
151 | - | let caller = i.caller.bytes | |
152 | - | let assetId = fromBase58String(nftId) | |
153 | - | let getNftWinningPrice = getStringValue(this, (auctionId + "_highest_bid")) | |
154 | - | let getNftWinningamount = ((parseIntValue(getNftWinningPrice) / 1000) * 975) | |
155 | - | let platform_fee = ((parseIntValue(getNftWinningPrice) / 1000) * 25) | |
156 | - | let getAuctionWinner = getStringValue(this, (auctionId + "_winner_of_nft")) | |
157 | - | if ((current_currency == asimiString)) | |
158 | - | then [ScriptTransfer(Address(caller), getNftWinningamount, amountUnit), ScriptTransfer(Address(fromBase58String(getAuctionWinner)), 1, assetId), StringEntry((txId + "_amount_paid_to_owner"), getNftWinningPrice), StringEntry((txId + "_nft_transfer_to"), getAuctionWinner), StringEntry((txId + "_nft_status"), "REWARDED"), StringEntry((auctionId + "_amount_paid_to_owner"), getNftWinningPrice), StringEntry((auctionId + "_nft_transfer_to"), getAuctionWinner), StringEntry((auctionId + "_nft_status"), "REWARDED")] | |
159 | - | else if ((current_currency == "WAVES")) | |
160 | - | then [ScriptTransfer(Address(caller), parseIntValue(getNftWinningPrice), unit), ScriptTransfer(Address(fromBase58String(getAuctionWinner)), 1, assetId), StringEntry((txId + "_amount_paid_to_owner"), getNftWinningPrice), StringEntry((txId + "_nft_transfer_to"), getAuctionWinner), StringEntry((txId + "_nft_status"), "REWARDED"), StringEntry((auctionId + "_amount_paid_to_owner"), getNftWinningPrice), StringEntry((auctionId + "_nft_transfer_to"), getAuctionWinner), StringEntry((auctionId + "_nft_status"), "REWARDED")] | |
161 | - | else nil | |
162 | - | } | |
163 | - | ||
164 | - | ||
165 | - | ||
166 | - | @Callable(i) | |
167 | - | func cancelAuction (auctionId) = { | |
168 | - | let txId = toBase58String(i.transactionId) | |
169 | - | let caller = i.caller.bytes | |
170 | - | let auctionStatus = getStringValue(this, (auctionId + "_nft_status")) | |
171 | - | let biddingWinner = getStringValue(this, (auctionId + "_winner_of_nft")) | |
172 | - | let nftOwner = getStringValue(this, (auctionId + "_nft_owner")) | |
173 | - | let nftId = getStringValue(this, (auctionId + "_nft_on_auction")) | |
174 | - | let biddingPrice = getStringValue(this, (auctionId + "_highest_bid")) | |
175 | - | if ((biddingWinner == "0")) | |
176 | - | then [StringEntry(((txId + auctionId) + "_nft_status"), "CANCELED"), ScriptTransfer(Address(fromBase58String(nftOwner)), 1, fromBase58String(nftId))] | |
177 | - | else if ((biddingWinner != "0")) | |
178 | - | then throw("soory you can't cancel it because already auction placed by someone") | |
179 | - | else nil | |
180 | - | } | |
181 | - | ||
182 | - | ||
183 | - | ||
184 | - | @Callable(i) | |
185 | - | func manualFundTransfer (recepientAddr,message) = { | |
186 | - | let sender = i.caller.bytes | |
187 | - | let reciver = fromBase58String(recepientAddr) | |
188 | - | let amount = i.payments[0].amount | |
189 | - | let platform_fee = ((amount / 1000) * 25) | |
190 | - | let recepient_payment = (amount - platform_fee) | |
191 | - | if ((i.payments[0].assetId == unit)) | |
192 | - | then [IntegerEntry((toBase58String(sender) + "_transfer"), amount), StringEntry("platform_fee", toString(platform_fee)), StringEntry((toBase58String(sender) + "_transfer_to"), recepientAddr), ScriptTransfer(Address(reciver), recepient_payment, unit)] | |
193 | - | else if ((i.payments[0].assetId == teams)) | |
194 | - | then [IntegerEntry((toBase58String(sender) + "_transfer"), amount), IntegerEntry("platform_fee", platform_fee), StringEntry((toBase58String(sender) + "_transfer_to"), recepientAddr), ScriptTransfer(Address(reciver), recepient_payment, teams)] | |
195 | - | else nil | |
196 | - | } | |
197 | - | ||
198 | - | ||
199 | - | ||
200 | - | @Callable(i) | |
201 | - | func backValue (auctionId) = { | |
202 | - | let caller = i.caller.bytes | |
203 | - | let nftId = getStringValue(this, (auctionId + "_nft_on_auction")) | |
204 | - | let nftOwner = getStringValue(this, (auctionId + "_nft_owner")) | |
205 | - | [StringEntry((auctionId + "_nft_status"), "Auction_time over"), ScriptTransfer(Address(fromBase58String(nftOwner)), 1, fromBase58String(nftId))] | |
206 | - | } | |
207 | - | ||
208 | - | ||
209 | - | ||
210 | - | @Callable(i) | |
211 | - | func withdrawBid (bidTxId,current_currency) = { | |
212 | - | let caller = i.caller.bytes | |
213 | - | let asimiString = "9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq" | |
214 | - | let txId = toBase58String(i.transactionId) | |
215 | - | let amountUnit = fromBase58String(current_currency) | |
216 | - | let bidPrice = getStringValue(this, (bidTxId + "_highest_bid")) | |
217 | - | let asBidder = getStringValue(this, (bidTxId + "_winner")) | |
218 | - | let bidForNFT = getStringValue(this, (bidTxId + "_nft_id")) | |
219 | - | if ((current_currency == asimiString)) | |
220 | - | then [StringEntry((bidTxId + "_nft_bid"), "WITHDRAW"), StringEntry((bidTxId + "_nft_id"), bidForNFT), StringEntry((bidTxId + "_bidding_price_refund_amount"), bidPrice), ScriptTransfer(i.caller, parseIntValue(bidPrice), amountUnit)] | |
221 | - | else if ((current_currency == "WAVES")) | |
222 | - | then [StringEntry((bidTxId + "_nft_bid"), "WITHDRAW"), StringEntry((bidTxId + "_nft_id"), bidForNFT), StringEntry((bidTxId + "_bidding_price_refund_amount"), bidPrice), ScriptTransfer(i.caller, parseIntValue(bidPrice), unit)] | |
223 | - | else nil | |
224 | - | } | |
225 | - | ||
226 | - | ||
227 | - | ||
228 | - | @Callable(i) | |
229 | - | func automateFunction (auctionId,current_currency) = { | |
230 | - | let caller = i.caller.bytes | |
231 | - | let nftId = getStringValue(this, (auctionId + "_nft_on_auction")) | |
232 | - | let nftOwner = getStringValue(this, (auctionId + "_nft_owner")) | |
233 | - | let asimiString = "9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq" | |
234 | - | let amountUnit = fromBase58String(current_currency) | |
235 | - | let getLastWinnerBidPrice = getStringValue(this, (auctionId + "_highest_bid")) | |
236 | - | let getLastWinnerAddress = getStringValue(this, (auctionId + "_winner_of_nft")) | |
237 | - | let biddingWinner = getStringValue(this, (auctionId + "_winner_of_nft")) | |
238 | - | if ((biddingWinner == "0")) | |
239 | - | then [ScriptTransfer(Address(fromBase58String(nftOwner)), 1, fromBase58String(nftId))] | |
240 | - | else if (if ((biddingWinner != "0")) | |
241 | - | then (current_currency == asimiString) | |
242 | - | else false) | |
243 | - | then [ScriptTransfer(Address(fromBase58String(nftOwner)), 1, fromBase58String(nftId)), ScriptTransfer(Address(fromBase58String(getLastWinnerAddress)), parseIntValue(getLastWinnerBidPrice), amountUnit)] | |
244 | - | else if (if ((biddingWinner != "0")) | |
245 | - | then (current_currency == "WAVES") | |
246 | - | else false) | |
247 | - | then [ScriptTransfer(Address(fromBase58String(nftOwner)), 1, fromBase58String(nftId)), ScriptTransfer(Address(fromBase58String(getLastWinnerAddress)), parseIntValue(getLastWinnerBidPrice), unit)] | |
248 | - | else nil | |
249 | - | } | |
250 | - | ||
251 | 4 | ||
252 | 5 | ||
253 | 6 | @Callable(i) | |
280 | 33 | } | |
281 | 34 | ||
282 | 35 | ||
283 | - | ||
284 | - | @Callable(i) | |
285 | - | func buyAllProducts_waves (nftInfo) = { | |
286 | - | let buyer = i.caller | |
287 | - | let buyerBalance = assetBalance(buyer, WAVES) | |
288 | - | let amount = value(i.payments[0].amount) | |
289 | - | let realcost = (amount - ((amount / 1000) * 25)) | |
290 | - | let platformfee = (amount - realcost) | |
291 | - | let nfT1 = split(nftInfo[0], "_") | |
292 | - | let nfT2 = split(nftInfo[1], "_") | |
293 | - | let nfT3 = split(nftInfo[2], "_") | |
294 | - | let nfT4 = split(nftInfo[3], "_") | |
295 | - | let nfT5 = split(nftInfo[4], "_") | |
296 | - | if ((size(nftInfo) == 1)) | |
297 | - | then [StringEntry((((((("first_nft_Info=" + "nftId") + nfT1[0]) + "seller_address") + nfT1[1]) + "price") + nfT1[2]), ("buyer" + toString(buyer))), ScriptTransfer(buyer, 1, fromBase58String(nfT1[0])), ScriptTransfer(Address(fromBase58String(nfT1[1])), (parseIntValue(nfT1[2]) * 100000000), unit)] | |
298 | - | else if ((size(nftInfo) == 2)) | |
299 | - | then [StringEntry((((((("first_nft_Info=" + "nftId") + nfT1[0]) + "seller_address") + nfT1[1]) + "price") + nfT1[2]), ("buyer" + toString(buyer))), StringEntry((((((("second_nft_Info=" + "nftId") + nfT2[0]) + "seller_address") + nfT2[1]) + "price") + nfT2[2]), ("buyer" + toString(buyer))), ScriptTransfer(buyer, 1, fromBase58String(nfT1[0])), ScriptTransfer(buyer, 1, fromBase58String(nfT2[0])), ScriptTransfer(Address(fromBase58String(nfT1[1])), (parseIntValue(nfT1[2]) * 100000000), unit), ScriptTransfer(Address(fromBase58String(nfT2[1])), (parseIntValue(nfT2[2]) * 100000000), unit)] | |
300 | - | else if ((size(nftInfo) == 3)) | |
301 | - | then [StringEntry((((((("first_nft_Info=" + "nftId") + nfT1[0]) + "seller_address") + nfT1[1]) + "price") + nfT1[2]), ("buyer" + toString(buyer))), StringEntry((((((("second_nft_Info=" + "nftId") + nfT2[0]) + "seller_address") + nfT2[1]) + "price") + nfT2[2]), ("buyer" + toString(buyer))), StringEntry((((((("third_nft_Info=" + "nftId") + nfT3[0]) + "seller_address") + nfT3[1]) + "price") + nfT3[2]), ("buyer" + toString(buyer))), ScriptTransfer(buyer, 1, fromBase58String(nfT1[0])), ScriptTransfer(buyer, 1, fromBase58String(nfT2[0])), ScriptTransfer(buyer, 1, fromBase58String(nfT3[0])), ScriptTransfer(Address(fromBase58String(nfT1[1])), parseIntValue(nfT1[2]), unit), ScriptTransfer(Address(fromBase58String(nfT2[1])), parseIntValue(nfT2[2]), unit), ScriptTransfer(Address(fromBase58String(nfT3[1])), parseIntValue(nfT3[2]), unit)] | |
302 | - | else if ((size(nftInfo) == 4)) | |
303 | - | then [StringEntry((((((("first_nft_Info=" + "nftId") + nfT1[0]) + "seller_address") + nfT1[1]) + "price") + nfT1[2]), ("buyer" + toString(buyer))), StringEntry((((((("second_nft_Info=" + "nftId") + nfT2[0]) + "seller_address") + nfT2[1]) + "price") + nfT2[2]), ("buyer" + toString(buyer))), StringEntry((((((("third_nft_Info=" + "nftId") + nfT3[0]) + "seller_address") + nfT3[1]) + "price") + nfT3[2]), ("buyer" + toString(buyer))), StringEntry((((((("fourth_nft_Info=" + "nftId") + nfT4[0]) + "seller_address") + nfT4[1]) + "price") + nfT4[2]), ("buyer" + toString(buyer))), ScriptTransfer(buyer, 1, fromBase58String(nfT1[0])), ScriptTransfer(buyer, 1, fromBase58String(nfT2[0])), ScriptTransfer(buyer, 1, fromBase58String(nfT3[0])), ScriptTransfer(buyer, 1, fromBase58String(nfT4[0])), ScriptTransfer(Address(fromBase58String(nfT1[1])), parseIntValue(nfT1[2]), unit), ScriptTransfer(Address(fromBase58String(nfT2[1])), parseIntValue(nfT2[2]), unit), ScriptTransfer(Address(fromBase58String(nfT3[1])), parseIntValue(nfT3[2]), unit), ScriptTransfer(Address(fromBase58String(nfT4[1])), parseIntValue(nfT4[2]), unit)] | |
304 | - | else if ((size(nftInfo) == 5)) | |
305 | - | then [StringEntry((((((("first_nft_Info=" + "nftId") + nfT1[0]) + "seller_address") + nfT1[1]) + "price") + nfT1[2]), ("buyer" + toString(buyer))), StringEntry((((((("second_nft_Info=" + "nftId") + nfT2[0]) + "seller_address") + nfT2[1]) + "price") + nfT2[2]), ("buyer" + toString(buyer))), StringEntry((((((("third_nft_Info=" + "nftId") + nfT3[0]) + "seller_address") + nfT3[1]) + "price") + nfT3[2]), ("buyer" + toString(buyer))), StringEntry((((((("fourth_nft_Info=" + "nftId") + nfT4[0]) + "seller_address") + nfT4[1]) + "price") + nfT4[2]), ("buyer" + toString(buyer))), StringEntry((((((("fifth_nft_Info=" + "nftId") + nfT5[0]) + "seller_address") + nfT5[1]) + "price") + nfT5[2]), ("buyer" + toString(buyer))), ScriptTransfer(buyer, 1, fromBase58String(nfT1[0])), ScriptTransfer(buyer, 1, fromBase58String(nfT2[0])), ScriptTransfer(buyer, 1, fromBase58String(nfT3[0])), ScriptTransfer(buyer, 1, fromBase58String(nfT4[0])), ScriptTransfer(buyer, 1, fromBase58String(nfT5[0])), ScriptTransfer(Address(fromBase58String(nfT1[1])), parseIntValue(nfT1[2]), unit), ScriptTransfer(Address(fromBase58String(nfT2[1])), parseIntValue(nfT2[2]), unit), ScriptTransfer(Address(fromBase58String(nfT3[1])), parseIntValue(nfT3[2]), unit), ScriptTransfer(Address(fromBase58String(nfT4[1])), parseIntValue(nfT4[2]), unit), ScriptTransfer(Address(fromBase58String(nfT5[1])), parseIntValue(nfT5[2]), unit)] | |
306 | - | else if ((size(nftInfo) > 5)) | |
307 | - | then throw("sorry! maximum limit of your cart is 5 items") | |
308 | - | else nil | |
309 | - | } | |
310 | - | ||
311 | - |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let separator = "_" | |
5 | - | ||
6 | - | let kBuy = "buy" | |
7 | - | ||
8 | - | let kPrice = "price" | |
9 | - | ||
10 | - | let kSell = "sell" | |
11 | - | ||
12 | - | let maxAuctionDuration = 30 | |
13 | - | ||
14 | - | let teams = base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq' | |
15 | - | ||
16 | - | let WAVES = base58'' | |
17 | - | ||
18 | - | let kBid = "bid" | |
19 | - | ||
20 | - | let paused = true | |
21 | - | ||
22 | - | let statusForNFT = $Tuple4("OPEN", "CLOSED", "REWARDED", "CANCELED") | |
23 | - | ||
24 | - | let dAppAddress = base58'3MvjAaDYHpS4A5K4CV3kZMMEH9m9JdBSvbq' | |
25 | - | ||
26 | - | func isNft (assetId) = match assetInfo(assetId) { | |
27 | - | case token: Asset => | |
28 | - | if (if ((token.decimals == 0)) | |
29 | - | then (token.quantity == 1) | |
30 | - | else false) | |
31 | - | then (token.reissuable == false) | |
32 | - | else false | |
33 | - | case _ => | |
34 | - | false | |
35 | - | } | |
36 | - | ||
37 | - | ||
38 | - | @Callable(i) | |
39 | - | func createNft (nft_name,nft_owner,nft_dAppAddress,nft_type,nft_tags,nft_selling_price,nft_description,nft_onSell,nft_data) = { | |
40 | - | let newToken = Issue(nft_name, nft_description, 1, 0, false) | |
41 | - | let issueId = calculateAssetId(newToken) | |
42 | - | let txId = i.transactionId | |
43 | - | [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))] | |
44 | - | } | |
45 | - | ||
46 | - | ||
47 | - | ||
48 | - | @Callable(i) | |
49 | - | func sellNFT (price,payment_currency) = { | |
50 | - | let txId = i.transactionId | |
51 | - | let seller = i.caller.bytes | |
52 | - | let $t023742459 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) | |
53 | - | let token0 = $t023742459._1 | |
54 | - | let amount0 = $t023742459._2 | |
55 | - | if (!(isNft(token0))) | |
56 | - | then throw("Token is not NFT") | |
57 | - | else [StringEntry(((kPrice + separator) + toBase58String(value(i.payments[0].assetId))), price), StringEntry(((toString(i.caller) + separator) + kSell), (((toBase58String(token0) + separator) + toString(amount0)) + payment_currency))] | |
58 | - | } | |
59 | - | ||
60 | - | ||
61 | - | ||
62 | - | @Callable(i) | |
63 | - | func buyNFT (nftID,current_nft_owner) = { | |
64 | - | let assetId = fromBase58String(nftID) | |
65 | - | let checkOwnerIsSame = match getString(this, (("nft_" + current_nft_owner) + "_owner")) { | |
66 | - | case a: String => | |
67 | - | a | |
68 | - | case _ => | |
69 | - | false | |
70 | - | } | |
71 | - | let price = getStringValue(((((kPrice + separator) + nftID) + "_") + current_nft_owner)) | |
72 | - | let amount = value(i.payments[0].amount) | |
73 | - | let sellerAmount = (amount - ((amount / 1000) * 25)) | |
74 | - | let platform_fee = (amount - sellerAmount) | |
75 | - | if ((current_nft_owner == toString(i.caller))) | |
76 | - | then throw("current Owner of NFT not able to purchase") | |
77 | - | else if ((i.payments[0].assetId == teams)) | |
78 | - | then [ScriptTransfer(i.caller, 1, assetId), ScriptTransfer(Address(fromBase58String(current_nft_owner)), sellerAmount, teams), StringEntry((("nft_" + nftID) + "platform_fee"), toString(platform_fee)), StringEntry(((toString(i.caller) + separator) + kBuy), ((nftID + separator) + toString(amount))), DeleteEntry((("nft_" + current_nft_owner) + "_owner")), StringEntry((("nft_" + current_nft_owner) + "_owner"), toString(i.caller)), StringEntry(((nftID + separator) + "_owner"), toString(i.caller))] | |
79 | - | else if ((i.payments[0].assetId == unit)) | |
80 | - | then [ScriptTransfer(i.caller, 1, assetId), ScriptTransfer(Address(fromBase58String(current_nft_owner)), sellerAmount, unit), StringEntry((("nft_" + nftID) + "platform_fee"), toString(platform_fee)), StringEntry(((toString(i.caller) + separator) + kBuy), ((nftID + separator) + toString(amount))), DeleteEntry((("nft_" + current_nft_owner) + "_owner")), StringEntry((("nft_" + current_nft_owner) + "_owner"), toString(i.caller)), StringEntry(((nftID + separator) + "_owner"), toString(i.caller))] | |
81 | - | else nil | |
82 | - | } | |
83 | - | ||
84 | - | ||
85 | - | ||
86 | - | @Callable(i) | |
87 | - | func cancelSell (nftId) = { | |
88 | - | let txId = toBase58String(i.transactionId) | |
89 | - | let seller = i.caller.bytes | |
90 | - | [StringEntry(((txId + nftId) + "_nft_status"), "CANCELED"), ScriptTransfer(Address(seller), 1, fromBase58String(nftId))] | |
91 | - | } | |
92 | - | ||
93 | - | ||
94 | - | ||
95 | - | @Callable(i) | |
96 | - | func addAuction (start,end,startPrice,duration,payment_currency) = { | |
97 | - | let txId = toBase58String(i.transactionId) | |
98 | - | let nftId = value(i.payments[0].assetId) | |
99 | - | let price = value(startPrice) | |
100 | - | let endHeight = (lastBlock.height + duration) | |
101 | - | let caller = i.caller.bytes | |
102 | - | let checkNftAuctioned = match getString(this, (((toBase58String(nftId) + separator) + "nft_status_") + toBase58String(caller))) { | |
103 | - | case a: String => | |
104 | - | true | |
105 | - | case _ => | |
106 | - | false | |
107 | - | } | |
108 | - | if ((checkNftAuctioned == true)) | |
109 | - | then throw("Already in auction list") | |
110 | - | else if ((duration > maxAuctionDuration)) | |
111 | - | then throw(("Duration is too long. Must be less than or equal to 30 " + toString(maxAuctionDuration))) | |
112 | - | else if ((i.payments[0].assetId == unit)) | |
113 | - | then throw("NFT not attached") | |
114 | - | else if ((i.payments[0].assetId == teams)) | |
115 | - | then throw("NFT not attached") | |
116 | - | 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")] | |
117 | - | } | |
118 | - | ||
119 | - | ||
120 | - | ||
121 | - | @Callable(i) | |
122 | - | func placeBid (auctionId,nftId,nft_owner,bid_price,current_currency) = { | |
123 | - | let txId = toBase58String(i.transactionId) | |
124 | - | let caller = i.caller.bytes | |
125 | - | let assetId = fromBase58String(nftId) | |
126 | - | let tokenType = i.payments[0].assetId | |
127 | - | let currentBidPrice = i.payments[0].amount | |
128 | - | let getLastWinnerBidPrice = getStringValue(this, (auctionId + "_highest_bid")) | |
129 | - | let getPreviousBidderAddress = getString(this, (auctionId + "_previous_bidder")) | |
130 | - | let currentBidCount = getStringValue(this, (auctionId + "_bidder_count")) | |
131 | - | let getLastWinnerAddress = getStringValue(this, (auctionId + "_winner_of_nft")) | |
132 | - | let checkNftAuctioned = getStringValue(this, (auctionId + "_nft_status")) | |
133 | - | if ((checkNftAuctioned != "OPEN")) | |
134 | - | then throw("Not open for auction") | |
135 | - | else if ((parseIntValue(getLastWinnerBidPrice) >= currentBidPrice)) | |
136 | - | then throw("Bid is less then starting/highest Bid") | |
137 | - | else if ((getLastWinnerBidPrice == "0")) | |
138 | - | 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)] | |
139 | - | else if ((getLastWinnerBidPrice != "0")) | |
140 | - | then [ScriptTransfer(Address(fromBase58String(getLastWinnerAddress)), parseIntValue(getLastWinnerBidPrice), tokenType), StringEntry((txId + "_previous_bid_amount_refund_to_address"), getLastWinnerAddress), StringEntry((txId + "_prevoius_bid_amount_refund"), getLastWinnerBidPrice), StringEntry((auctionId + "_bidder_count"), toString((parseIntValue(currentBidCount) + 1))), StringEntry((auctionId + "_highest_bid"), toString(currentBidPrice)), StringEntry((auctionId + "_winner_of_nft"), toBase58String(i.caller.bytes)), 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)] | |
141 | - | else nil | |
142 | - | } | |
143 | - | ||
144 | - | ||
145 | - | ||
146 | - | @Callable(i) | |
147 | - | func acceptBidOffer (auctionId,nftId,bid_amount_from_user,current_currency) = { | |
148 | - | let asimiString = "9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq" | |
149 | - | let txId = toBase58String(i.transactionId) | |
150 | - | let amountUnit = fromBase58String(current_currency) | |
151 | - | let caller = i.caller.bytes | |
152 | - | let assetId = fromBase58String(nftId) | |
153 | - | let getNftWinningPrice = getStringValue(this, (auctionId + "_highest_bid")) | |
154 | - | let getNftWinningamount = ((parseIntValue(getNftWinningPrice) / 1000) * 975) | |
155 | - | let platform_fee = ((parseIntValue(getNftWinningPrice) / 1000) * 25) | |
156 | - | let getAuctionWinner = getStringValue(this, (auctionId + "_winner_of_nft")) | |
157 | - | if ((current_currency == asimiString)) | |
158 | - | then [ScriptTransfer(Address(caller), getNftWinningamount, amountUnit), ScriptTransfer(Address(fromBase58String(getAuctionWinner)), 1, assetId), StringEntry((txId + "_amount_paid_to_owner"), getNftWinningPrice), StringEntry((txId + "_nft_transfer_to"), getAuctionWinner), StringEntry((txId + "_nft_status"), "REWARDED"), StringEntry((auctionId + "_amount_paid_to_owner"), getNftWinningPrice), StringEntry((auctionId + "_nft_transfer_to"), getAuctionWinner), StringEntry((auctionId + "_nft_status"), "REWARDED")] | |
159 | - | else if ((current_currency == "WAVES")) | |
160 | - | then [ScriptTransfer(Address(caller), parseIntValue(getNftWinningPrice), unit), ScriptTransfer(Address(fromBase58String(getAuctionWinner)), 1, assetId), StringEntry((txId + "_amount_paid_to_owner"), getNftWinningPrice), StringEntry((txId + "_nft_transfer_to"), getAuctionWinner), StringEntry((txId + "_nft_status"), "REWARDED"), StringEntry((auctionId + "_amount_paid_to_owner"), getNftWinningPrice), StringEntry((auctionId + "_nft_transfer_to"), getAuctionWinner), StringEntry((auctionId + "_nft_status"), "REWARDED")] | |
161 | - | else nil | |
162 | - | } | |
163 | - | ||
164 | - | ||
165 | - | ||
166 | - | @Callable(i) | |
167 | - | func cancelAuction (auctionId) = { | |
168 | - | let txId = toBase58String(i.transactionId) | |
169 | - | let caller = i.caller.bytes | |
170 | - | let auctionStatus = getStringValue(this, (auctionId + "_nft_status")) | |
171 | - | let biddingWinner = getStringValue(this, (auctionId + "_winner_of_nft")) | |
172 | - | let nftOwner = getStringValue(this, (auctionId + "_nft_owner")) | |
173 | - | let nftId = getStringValue(this, (auctionId + "_nft_on_auction")) | |
174 | - | let biddingPrice = getStringValue(this, (auctionId + "_highest_bid")) | |
175 | - | if ((biddingWinner == "0")) | |
176 | - | then [StringEntry(((txId + auctionId) + "_nft_status"), "CANCELED"), ScriptTransfer(Address(fromBase58String(nftOwner)), 1, fromBase58String(nftId))] | |
177 | - | else if ((biddingWinner != "0")) | |
178 | - | then throw("soory you can't cancel it because already auction placed by someone") | |
179 | - | else nil | |
180 | - | } | |
181 | - | ||
182 | - | ||
183 | - | ||
184 | - | @Callable(i) | |
185 | - | func manualFundTransfer (recepientAddr,message) = { | |
186 | - | let sender = i.caller.bytes | |
187 | - | let reciver = fromBase58String(recepientAddr) | |
188 | - | let amount = i.payments[0].amount | |
189 | - | let platform_fee = ((amount / 1000) * 25) | |
190 | - | let recepient_payment = (amount - platform_fee) | |
191 | - | if ((i.payments[0].assetId == unit)) | |
192 | - | then [IntegerEntry((toBase58String(sender) + "_transfer"), amount), StringEntry("platform_fee", toString(platform_fee)), StringEntry((toBase58String(sender) + "_transfer_to"), recepientAddr), ScriptTransfer(Address(reciver), recepient_payment, unit)] | |
193 | - | else if ((i.payments[0].assetId == teams)) | |
194 | - | then [IntegerEntry((toBase58String(sender) + "_transfer"), amount), IntegerEntry("platform_fee", platform_fee), StringEntry((toBase58String(sender) + "_transfer_to"), recepientAddr), ScriptTransfer(Address(reciver), recepient_payment, teams)] | |
195 | - | else nil | |
196 | - | } | |
197 | - | ||
198 | - | ||
199 | - | ||
200 | - | @Callable(i) | |
201 | - | func backValue (auctionId) = { | |
202 | - | let caller = i.caller.bytes | |
203 | - | let nftId = getStringValue(this, (auctionId + "_nft_on_auction")) | |
204 | - | let nftOwner = getStringValue(this, (auctionId + "_nft_owner")) | |
205 | - | [StringEntry((auctionId + "_nft_status"), "Auction_time over"), ScriptTransfer(Address(fromBase58String(nftOwner)), 1, fromBase58String(nftId))] | |
206 | - | } | |
207 | - | ||
208 | - | ||
209 | - | ||
210 | - | @Callable(i) | |
211 | - | func withdrawBid (bidTxId,current_currency) = { | |
212 | - | let caller = i.caller.bytes | |
213 | - | let asimiString = "9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq" | |
214 | - | let txId = toBase58String(i.transactionId) | |
215 | - | let amountUnit = fromBase58String(current_currency) | |
216 | - | let bidPrice = getStringValue(this, (bidTxId + "_highest_bid")) | |
217 | - | let asBidder = getStringValue(this, (bidTxId + "_winner")) | |
218 | - | let bidForNFT = getStringValue(this, (bidTxId + "_nft_id")) | |
219 | - | if ((current_currency == asimiString)) | |
220 | - | then [StringEntry((bidTxId + "_nft_bid"), "WITHDRAW"), StringEntry((bidTxId + "_nft_id"), bidForNFT), StringEntry((bidTxId + "_bidding_price_refund_amount"), bidPrice), ScriptTransfer(i.caller, parseIntValue(bidPrice), amountUnit)] | |
221 | - | else if ((current_currency == "WAVES")) | |
222 | - | then [StringEntry((bidTxId + "_nft_bid"), "WITHDRAW"), StringEntry((bidTxId + "_nft_id"), bidForNFT), StringEntry((bidTxId + "_bidding_price_refund_amount"), bidPrice), ScriptTransfer(i.caller, parseIntValue(bidPrice), unit)] | |
223 | - | else nil | |
224 | - | } | |
225 | - | ||
226 | - | ||
227 | - | ||
228 | - | @Callable(i) | |
229 | - | func automateFunction (auctionId,current_currency) = { | |
230 | - | let caller = i.caller.bytes | |
231 | - | let nftId = getStringValue(this, (auctionId + "_nft_on_auction")) | |
232 | - | let nftOwner = getStringValue(this, (auctionId + "_nft_owner")) | |
233 | - | let asimiString = "9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq" | |
234 | - | let amountUnit = fromBase58String(current_currency) | |
235 | - | let getLastWinnerBidPrice = getStringValue(this, (auctionId + "_highest_bid")) | |
236 | - | let getLastWinnerAddress = getStringValue(this, (auctionId + "_winner_of_nft")) | |
237 | - | let biddingWinner = getStringValue(this, (auctionId + "_winner_of_nft")) | |
238 | - | if ((biddingWinner == "0")) | |
239 | - | then [ScriptTransfer(Address(fromBase58String(nftOwner)), 1, fromBase58String(nftId))] | |
240 | - | else if (if ((biddingWinner != "0")) | |
241 | - | then (current_currency == asimiString) | |
242 | - | else false) | |
243 | - | then [ScriptTransfer(Address(fromBase58String(nftOwner)), 1, fromBase58String(nftId)), ScriptTransfer(Address(fromBase58String(getLastWinnerAddress)), parseIntValue(getLastWinnerBidPrice), amountUnit)] | |
244 | - | else if (if ((biddingWinner != "0")) | |
245 | - | then (current_currency == "WAVES") | |
246 | - | else false) | |
247 | - | then [ScriptTransfer(Address(fromBase58String(nftOwner)), 1, fromBase58String(nftId)), ScriptTransfer(Address(fromBase58String(getLastWinnerAddress)), parseIntValue(getLastWinnerBidPrice), unit)] | |
248 | - | else nil | |
249 | - | } | |
250 | - | ||
251 | 4 | ||
252 | 5 | ||
253 | 6 | @Callable(i) | |
254 | 7 | func buyAllProducts_asimi (nftInfo) = { | |
255 | 8 | let buyer = i.caller | |
256 | 9 | let buyerBalance = assetBalance(buyer, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq') | |
257 | 10 | let amount = value(i.payments[0].amount) | |
258 | 11 | let realcost = (amount - ((amount / 1000) * 25)) | |
259 | 12 | let platformfee = (amount - realcost) | |
260 | 13 | let nfT1 = split(nftInfo[0], "_") | |
261 | 14 | let nfT2 = split(nftInfo[1], "_") | |
262 | 15 | let nfT3 = split(nftInfo[2], "_") | |
263 | 16 | let nfT4 = split(nftInfo[3], "_") | |
264 | 17 | let nfT5 = split(nftInfo[4], "_") | |
265 | 18 | if ((amount > buyerBalance)) | |
266 | 19 | then throw("Buyer does not have enough funds to complete the purchase.") | |
267 | 20 | else if ((size(nftInfo) == 1)) | |
268 | 21 | then [StringEntry((("first_nft_Info=" + "nftId") + nfT1[0]), ("buyer" + toString(buyer))), StringEntry((("first_nft_Info=" + "seller_address") + nfT1[1]), ("price" + nfT1[2])), ScriptTransfer(buyer, 1, fromBase58String(nfT1[0])), ScriptTransfer(Address(fromBase58String(nfT1[1])), (parseIntValue(nfT1[2]) * 100), base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq')] | |
269 | 22 | else if ((size(nftInfo) == 2)) | |
270 | 23 | then [StringEntry((((((("first_nft_Info=" + "nftId") + nfT1[0]) + "seller_address") + nfT1[1]) + "price") + nfT1[2]), ("buyer" + toString(buyer))), StringEntry((((((("second_nft_Info=" + "nftId") + nfT2[0]) + "seller_address") + nfT2[1]) + "price") + nfT2[2]), ("buyer" + toString(buyer))), ScriptTransfer(buyer, 1, fromBase58String(nfT1[0])), ScriptTransfer(buyer, 1, fromBase58String(nfT2[0])), ScriptTransfer(Address(fromBase58String(nfT1[1])), (parseIntValue(nfT1[2]) * 100), base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(nfT2[1])), (parseIntValue(nfT2[2]) * 100), base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq')] | |
271 | 24 | else if ((size(nftInfo) == 3)) | |
272 | 25 | then [StringEntry((((((("first_nft_Info=" + "nftId") + nfT1[0]) + "seller_address") + nfT1[1]) + "price") + nfT1[2]), ("buyer" + toString(buyer))), StringEntry((((((("second_nft_Info=" + "nftId") + nfT2[0]) + "seller_address") + nfT2[1]) + "price") + nfT2[2]), ("buyer" + toString(buyer))), StringEntry((((((("third_nft_Info=" + "nftId") + nfT3[0]) + "seller_address") + nfT3[1]) + "price") + nfT3[2]), ("buyer" + toString(buyer))), ScriptTransfer(buyer, 1, fromBase58String(nfT1[0])), ScriptTransfer(buyer, 1, fromBase58String(nfT2[0])), ScriptTransfer(buyer, 1, fromBase58String(nfT3[0])), ScriptTransfer(Address(fromBase58String(nfT1[1])), (parseIntValue(nfT1[2]) * 100), base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(nfT2[1])), (parseIntValue(nfT2[2]) * 100), base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(nfT3[1])), (parseIntValue(nfT3[2]) * 100), base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq')] | |
273 | 26 | else if ((size(nftInfo) == 4)) | |
274 | 27 | then [StringEntry((((((("first_nft_Info=" + "nftId") + nfT1[0]) + "seller_address") + nfT1[1]) + "price") + nfT1[2]), ("buyer" + toString(buyer))), StringEntry((((((("second_nft_Info=" + "nftId") + nfT2[0]) + "seller_address") + nfT2[1]) + "price") + nfT2[2]), ("buyer" + toString(buyer))), StringEntry((((((("third_nft_Info=" + "nftId") + nfT3[0]) + "seller_address") + nfT3[1]) + "price") + nfT3[2]), ("buyer" + toString(buyer))), StringEntry((((((("fourth_nft_Info=" + "nftId") + nfT4[0]) + "seller_address") + nfT4[1]) + "price") + nfT4[2]), ("buyer" + toString(buyer))), ScriptTransfer(buyer, 1, fromBase58String(nfT1[0])), ScriptTransfer(buyer, 1, fromBase58String(nfT2[0])), ScriptTransfer(buyer, 1, fromBase58String(nfT3[0])), ScriptTransfer(buyer, 1, fromBase58String(nfT4[0])), ScriptTransfer(Address(fromBase58String(nfT1[1])), (parseIntValue(nfT1[2]) * 100), base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(nfT2[1])), (parseIntValue(nfT2[2]) * 100), base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(nfT3[1])), (parseIntValue(nfT3[2]) * 100), base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(nfT4[1])), (parseIntValue(nfT4[2]) * 100), base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq')] | |
275 | 28 | else if ((size(nftInfo) == 5)) | |
276 | 29 | then [StringEntry((((((("first_nft_Info=" + "nftId") + nfT1[0]) + "seller_address") + nfT1[1]) + "price") + nfT1[2]), ("buyer" + toString(buyer))), StringEntry((((((("second_nft_Info=" + "nftId") + nfT2[0]) + "seller_address") + nfT2[1]) + "price") + nfT2[2]), ("buyer" + toString(buyer))), StringEntry((((((("third_nft_Info=" + "nftId") + nfT3[0]) + "seller_address") + nfT3[1]) + "price") + nfT3[2]), ("buyer" + toString(buyer))), StringEntry((((((("fourth_nft_Info=" + "nftId") + nfT4[0]) + "seller_address") + nfT4[1]) + "price") + nfT4[2]), ("buyer" + toString(buyer))), StringEntry((((((("fifth_nft_Info=" + "nftId") + nfT5[0]) + "seller_address") + nfT5[1]) + "price") + nfT5[2]), ("buyer" + toString(buyer))), ScriptTransfer(buyer, 1, fromBase58String(nfT1[0])), ScriptTransfer(buyer, 1, fromBase58String(nfT2[0])), ScriptTransfer(buyer, 1, fromBase58String(nfT3[0])), ScriptTransfer(buyer, 1, fromBase58String(nfT4[0])), ScriptTransfer(buyer, 1, fromBase58String(nfT5[0])), ScriptTransfer(Address(fromBase58String(nfT1[1])), (parseIntValue(nfT1[2]) * 100), base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(nfT2[1])), (parseIntValue(nfT2[2]) * 100), base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(nfT3[1])), (parseIntValue(nfT3[2]) * 100), base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(nfT4[1])), (parseIntValue(nfT4[2]) * 100), base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(nfT5[1])), (parseIntValue(nfT5[2]) * 100), base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq')] | |
277 | 30 | else if ((size(nftInfo) > 5)) | |
278 | 31 | then throw("sorry! maximum limit of your cart is 5 items") | |
279 | 32 | else nil | |
280 | 33 | } | |
281 | 34 | ||
282 | 35 | ||
283 | - | ||
284 | - | @Callable(i) | |
285 | - | func buyAllProducts_waves (nftInfo) = { | |
286 | - | let buyer = i.caller | |
287 | - | let buyerBalance = assetBalance(buyer, WAVES) | |
288 | - | let amount = value(i.payments[0].amount) | |
289 | - | let realcost = (amount - ((amount / 1000) * 25)) | |
290 | - | let platformfee = (amount - realcost) | |
291 | - | let nfT1 = split(nftInfo[0], "_") | |
292 | - | let nfT2 = split(nftInfo[1], "_") | |
293 | - | let nfT3 = split(nftInfo[2], "_") | |
294 | - | let nfT4 = split(nftInfo[3], "_") | |
295 | - | let nfT5 = split(nftInfo[4], "_") | |
296 | - | if ((size(nftInfo) == 1)) | |
297 | - | then [StringEntry((((((("first_nft_Info=" + "nftId") + nfT1[0]) + "seller_address") + nfT1[1]) + "price") + nfT1[2]), ("buyer" + toString(buyer))), ScriptTransfer(buyer, 1, fromBase58String(nfT1[0])), ScriptTransfer(Address(fromBase58String(nfT1[1])), (parseIntValue(nfT1[2]) * 100000000), unit)] | |
298 | - | else if ((size(nftInfo) == 2)) | |
299 | - | then [StringEntry((((((("first_nft_Info=" + "nftId") + nfT1[0]) + "seller_address") + nfT1[1]) + "price") + nfT1[2]), ("buyer" + toString(buyer))), StringEntry((((((("second_nft_Info=" + "nftId") + nfT2[0]) + "seller_address") + nfT2[1]) + "price") + nfT2[2]), ("buyer" + toString(buyer))), ScriptTransfer(buyer, 1, fromBase58String(nfT1[0])), ScriptTransfer(buyer, 1, fromBase58String(nfT2[0])), ScriptTransfer(Address(fromBase58String(nfT1[1])), (parseIntValue(nfT1[2]) * 100000000), unit), ScriptTransfer(Address(fromBase58String(nfT2[1])), (parseIntValue(nfT2[2]) * 100000000), unit)] | |
300 | - | else if ((size(nftInfo) == 3)) | |
301 | - | then [StringEntry((((((("first_nft_Info=" + "nftId") + nfT1[0]) + "seller_address") + nfT1[1]) + "price") + nfT1[2]), ("buyer" + toString(buyer))), StringEntry((((((("second_nft_Info=" + "nftId") + nfT2[0]) + "seller_address") + nfT2[1]) + "price") + nfT2[2]), ("buyer" + toString(buyer))), StringEntry((((((("third_nft_Info=" + "nftId") + nfT3[0]) + "seller_address") + nfT3[1]) + "price") + nfT3[2]), ("buyer" + toString(buyer))), ScriptTransfer(buyer, 1, fromBase58String(nfT1[0])), ScriptTransfer(buyer, 1, fromBase58String(nfT2[0])), ScriptTransfer(buyer, 1, fromBase58String(nfT3[0])), ScriptTransfer(Address(fromBase58String(nfT1[1])), parseIntValue(nfT1[2]), unit), ScriptTransfer(Address(fromBase58String(nfT2[1])), parseIntValue(nfT2[2]), unit), ScriptTransfer(Address(fromBase58String(nfT3[1])), parseIntValue(nfT3[2]), unit)] | |
302 | - | else if ((size(nftInfo) == 4)) | |
303 | - | then [StringEntry((((((("first_nft_Info=" + "nftId") + nfT1[0]) + "seller_address") + nfT1[1]) + "price") + nfT1[2]), ("buyer" + toString(buyer))), StringEntry((((((("second_nft_Info=" + "nftId") + nfT2[0]) + "seller_address") + nfT2[1]) + "price") + nfT2[2]), ("buyer" + toString(buyer))), StringEntry((((((("third_nft_Info=" + "nftId") + nfT3[0]) + "seller_address") + nfT3[1]) + "price") + nfT3[2]), ("buyer" + toString(buyer))), StringEntry((((((("fourth_nft_Info=" + "nftId") + nfT4[0]) + "seller_address") + nfT4[1]) + "price") + nfT4[2]), ("buyer" + toString(buyer))), ScriptTransfer(buyer, 1, fromBase58String(nfT1[0])), ScriptTransfer(buyer, 1, fromBase58String(nfT2[0])), ScriptTransfer(buyer, 1, fromBase58String(nfT3[0])), ScriptTransfer(buyer, 1, fromBase58String(nfT4[0])), ScriptTransfer(Address(fromBase58String(nfT1[1])), parseIntValue(nfT1[2]), unit), ScriptTransfer(Address(fromBase58String(nfT2[1])), parseIntValue(nfT2[2]), unit), ScriptTransfer(Address(fromBase58String(nfT3[1])), parseIntValue(nfT3[2]), unit), ScriptTransfer(Address(fromBase58String(nfT4[1])), parseIntValue(nfT4[2]), unit)] | |
304 | - | else if ((size(nftInfo) == 5)) | |
305 | - | then [StringEntry((((((("first_nft_Info=" + "nftId") + nfT1[0]) + "seller_address") + nfT1[1]) + "price") + nfT1[2]), ("buyer" + toString(buyer))), StringEntry((((((("second_nft_Info=" + "nftId") + nfT2[0]) + "seller_address") + nfT2[1]) + "price") + nfT2[2]), ("buyer" + toString(buyer))), StringEntry((((((("third_nft_Info=" + "nftId") + nfT3[0]) + "seller_address") + nfT3[1]) + "price") + nfT3[2]), ("buyer" + toString(buyer))), StringEntry((((((("fourth_nft_Info=" + "nftId") + nfT4[0]) + "seller_address") + nfT4[1]) + "price") + nfT4[2]), ("buyer" + toString(buyer))), StringEntry((((((("fifth_nft_Info=" + "nftId") + nfT5[0]) + "seller_address") + nfT5[1]) + "price") + nfT5[2]), ("buyer" + toString(buyer))), ScriptTransfer(buyer, 1, fromBase58String(nfT1[0])), ScriptTransfer(buyer, 1, fromBase58String(nfT2[0])), ScriptTransfer(buyer, 1, fromBase58String(nfT3[0])), ScriptTransfer(buyer, 1, fromBase58String(nfT4[0])), ScriptTransfer(buyer, 1, fromBase58String(nfT5[0])), ScriptTransfer(Address(fromBase58String(nfT1[1])), parseIntValue(nfT1[2]), unit), ScriptTransfer(Address(fromBase58String(nfT2[1])), parseIntValue(nfT2[2]), unit), ScriptTransfer(Address(fromBase58String(nfT3[1])), parseIntValue(nfT3[2]), unit), ScriptTransfer(Address(fromBase58String(nfT4[1])), parseIntValue(nfT4[2]), unit), ScriptTransfer(Address(fromBase58String(nfT5[1])), parseIntValue(nfT5[2]), unit)] | |
306 | - | else if ((size(nftInfo) > 5)) | |
307 | - | then throw("sorry! maximum limit of your cart is 5 items") | |
308 | - | else nil | |
309 | - | } | |
310 | - | ||
311 | - |
github/deemru/w8io/169f3d6 50.38 ms ◑