57 | | - | |
---|
58 | | - | |
---|
59 | | - | @Callable(i) |
---|
60 | | - | func sellNFT (price,payment_currency) = { |
---|
61 | | - | let txId = i.transactionId |
---|
62 | | - | let seller = i.caller.bytes |
---|
63 | | - | let $t023152400 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) |
---|
64 | | - | let token0 = $t023152400._1 |
---|
65 | | - | let amount0 = $t023152400._2 |
---|
66 | | - | if (!(isNft(token0))) |
---|
67 | | - | then throw("Token is not NFT") |
---|
68 | | - | else [StringEntry(((kPrice + separator) + toBase58String(value(i.payments[0].assetId))), price), StringEntry(((toString(i.caller) + separator) + kSell), (((toBase58String(token0) + separator) + toString(amount0)) + payment_currency))] |
---|
69 | | - | } |
---|
70 | | - | |
---|
71 | | - | |
---|
72 | | - | |
---|
73 | | - | @Callable(i) |
---|
74 | | - | func buyNFT (nftID,current_nft_owner,creator,royalityPercentage) = { |
---|
75 | | - | let assetId = fromBase58String(nftID) |
---|
76 | | - | let checkOwnerIsSame = match getString(this, (("nft_" + current_nft_owner) + "_owner")) { |
---|
77 | | - | case a: String => |
---|
78 | | - | a |
---|
79 | | - | case _ => |
---|
80 | | - | false |
---|
81 | | - | } |
---|
82 | | - | let price = getStringValue(((((kPrice + separator) + nftID) + "_") + current_nft_owner)) |
---|
83 | | - | let amount = value(i.payments[0].amount) |
---|
84 | | - | let sellerAmount = (amount - ((amount / 1000) * 25)) |
---|
85 | | - | let platform_fee = (amount - sellerAmount) |
---|
86 | | - | let royalityPercentage1 = royalityPercentage |
---|
87 | | - | let royalityAmount = ((amount * parseIntValue(royalityPercentage1)) / 100) |
---|
88 | | - | let sellerCost = (amount - (royalityAmount + platform_fee)) |
---|
89 | | - | if ((current_nft_owner == toString(i.caller))) |
---|
90 | | - | then throw("current Owner of NFT not able to purchase") |
---|
91 | | - | else if (if ((i.payments[0].assetId == teams)) |
---|
92 | | - | then (creator != current_nft_owner) |
---|
93 | | - | else false) |
---|
94 | | - | then [ScriptTransfer(i.caller, 1, assetId), ScriptTransfer(Address(fromBase58String(current_nft_owner)), sellerCost, teams), ScriptTransfer(Address(fromBase58String(creator)), royalityAmount, teams), IntegerEntry((("nft_" + nftID) + "platform_fee"), 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))] |
---|
95 | | - | else if (if ((i.payments[0].assetId == teams)) |
---|
96 | | - | then (creator == current_nft_owner) |
---|
97 | | - | else false) |
---|
98 | | - | 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))] |
---|
99 | | - | else if (if ((i.payments[0].assetId == unit)) |
---|
100 | | - | then (creator != current_nft_owner) |
---|
101 | | - | else false) |
---|
102 | | - | then [ScriptTransfer(i.caller, 1, assetId), ScriptTransfer(Address(fromBase58String(current_nft_owner)), sellerCost, unit), ScriptTransfer(Address(fromBase58String(creator)), royalityAmount, 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))] |
---|
103 | | - | else if (if ((i.payments[0].assetId == unit)) |
---|
104 | | - | then (creator == current_nft_owner) |
---|
105 | | - | else false) |
---|
106 | | - | 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))] |
---|
107 | | - | else nil |
---|
108 | | - | } |
---|
109 | | - | |
---|
110 | | - | |
---|
111 | | - | |
---|
112 | | - | @Callable(i) |
---|
113 | | - | func cancelSell (nftId) = { |
---|
114 | | - | let txId = toBase58String(i.transactionId) |
---|
115 | | - | let seller = i.caller.bytes |
---|
116 | | - | [StringEntry(((txId + nftId) + "_nft_status"), "CANCELED"), ScriptTransfer(Address(seller), 1, fromBase58String(nftId))] |
---|
117 | | - | } |
---|
118 | | - | |
---|
119 | | - | |
---|
120 | | - | |
---|
121 | | - | @Callable(i) |
---|
122 | | - | func addAuction (start,end,startPrice,duration,payment_currency) = { |
---|
123 | | - | let txId = toBase58String(i.transactionId) |
---|
124 | | - | let nftId = value(i.payments[0].assetId) |
---|
125 | | - | let price = value(startPrice) |
---|
126 | | - | let endHeight = (lastBlock.height + duration) |
---|
127 | | - | let caller = i.caller.bytes |
---|
128 | | - | let checkNftAuctioned = match getString(this, (((toBase58String(nftId) + separator) + "nft_status_") + toBase58String(caller))) { |
---|
129 | | - | case a: String => |
---|
130 | | - | true |
---|
131 | | - | case _ => |
---|
132 | | - | false |
---|
133 | | - | } |
---|
134 | | - | if ((checkNftAuctioned == true)) |
---|
135 | | - | then throw("Already in auction list") |
---|
136 | | - | else if ((duration > maxAuctionDuration)) |
---|
137 | | - | then throw(("Duration is too long. Must be less than or equal to 30 " + toString(maxAuctionDuration))) |
---|
138 | | - | else if ((i.payments[0].assetId == unit)) |
---|
139 | | - | then throw("NFT not attached") |
---|
140 | | - | else if ((i.payments[0].assetId == teams)) |
---|
141 | | - | then throw("NFT not attached") |
---|
142 | | - | 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")] |
---|
143 | | - | } |
---|
144 | | - | |
---|
145 | | - | |
---|
146 | | - | |
---|
147 | | - | @Callable(i) |
---|
148 | | - | func placeBid (auctionId,nftId,nft_owner,bid_price,current_currency) = { |
---|
149 | | - | let txId = toBase58String(i.transactionId) |
---|
150 | | - | let caller = i.caller.bytes |
---|
151 | | - | let assetId = fromBase58String(nftId) |
---|
152 | | - | let tokenType = i.payments[0].assetId |
---|
153 | | - | let currentBidPrice = i.payments[0].amount |
---|
154 | | - | let getLastWinnerBidPrice = getStringValue(this, (auctionId + "_highest_bid")) |
---|
155 | | - | let getPreviousBidderAddress = getString(this, (auctionId + "_previous_bidder")) |
---|
156 | | - | let currentBidCount = getStringValue(this, (auctionId + "_bidder_count")) |
---|
157 | | - | let getLastWinnerAddress = getStringValue(this, (auctionId + "_winner_of_nft")) |
---|
158 | | - | let checkNftAuctioned = getStringValue(this, (auctionId + "_nft_status")) |
---|
159 | | - | if ((checkNftAuctioned != "OPEN")) |
---|
160 | | - | then throw("Not open for auction") |
---|
161 | | - | else if ((parseIntValue(getLastWinnerBidPrice) >= currentBidPrice)) |
---|
162 | | - | then throw("Bid is less then starting/highest Bid") |
---|
163 | | - | else if ((getLastWinnerBidPrice == "0")) |
---|
164 | | - | 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)] |
---|
165 | | - | else if ((getLastWinnerBidPrice != "0")) |
---|
166 | | - | 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)] |
---|
167 | | - | else nil |
---|
168 | | - | } |
---|
169 | | - | |
---|
170 | | - | |
---|
171 | | - | |
---|
172 | | - | @Callable(i) |
---|
173 | | - | func acceptBidOffer (auctionId,nftId,bid_amount_from_user,current_nft_owner,creator,royalityPercentage,current_currency) = { |
---|
174 | | - | let asimiString = "9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq" |
---|
175 | | - | let txId = toBase58String(i.transactionId) |
---|
176 | | - | let amountUnit = fromBase58String(current_currency) |
---|
177 | | - | let caller = i.caller.bytes |
---|
178 | | - | let assetId = fromBase58String(nftId) |
---|
179 | | - | let getNftWinningPrice = getStringValue(this, (auctionId + "_highest_bid")) |
---|
180 | | - | let getNftWinningamount = ((parseIntValue(getNftWinningPrice) / 1000) * 975) |
---|
181 | | - | let platform_fee = ((parseIntValue(getNftWinningPrice) / 1000) * 25) |
---|
182 | | - | let royalityAmount = ((parseIntValue(getNftWinningPrice) * parseIntValue(royalityPercentage)) / 100) |
---|
183 | | - | let auctionerCost = (parseIntValue(getNftWinningPrice) - (royalityAmount + platform_fee)) |
---|
184 | | - | let getAuctionWinner = getStringValue(this, (auctionId + "_winner_of_nft")) |
---|
185 | | - | if (if ((current_currency == asimiString)) |
---|
186 | | - | then (creator != current_nft_owner) |
---|
187 | | - | else false) |
---|
188 | | - | then [ScriptTransfer(Address(caller), auctionerCost, amountUnit), ScriptTransfer(Address(fromBase58String(getAuctionWinner)), 1, assetId), ScriptTransfer(Address(fromBase58String(creator)), royalityAmount, amountUnit), 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")] |
---|
189 | | - | else if (if ((current_currency == asimiString)) |
---|
190 | | - | then (creator == current_nft_owner) |
---|
191 | | - | else false) |
---|
192 | | - | 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")] |
---|
193 | | - | else if (if ((current_currency == "WAVES")) |
---|
194 | | - | then (creator != current_nft_owner) |
---|
195 | | - | else false) |
---|
196 | | - | then [ScriptTransfer(Address(caller), auctionerCost, unit), ScriptTransfer(Address(fromBase58String(getAuctionWinner)), 1, assetId), ScriptTransfer(Address(fromBase58String(creator)), royalityAmount, unit), StringEntry("platform_fee", toString(platform_fee)), 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")] |
---|
197 | | - | else if (if ((current_currency == "WAVES")) |
---|
198 | | - | then (creator == current_nft_owner) |
---|
199 | | - | else false) |
---|
200 | | - | then [ScriptTransfer(Address(caller), getNftWinningamount, 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")] |
---|
201 | | - | else nil |
---|
202 | | - | } |
---|
203 | | - | |
---|
204 | | - | |
---|
205 | | - | |
---|
206 | | - | @Callable(i) |
---|
207 | | - | func cancelAuction (auctionId) = { |
---|
208 | | - | let txId = toBase58String(i.transactionId) |
---|
209 | | - | let caller = i.caller.bytes |
---|
210 | | - | let auctionStatus = getStringValue(this, (auctionId + "_nft_status")) |
---|
211 | | - | let biddingWinner = getStringValue(this, (auctionId + "_winner_of_nft")) |
---|
212 | | - | let nftOwner = getStringValue(this, (auctionId + "_nft_owner")) |
---|
213 | | - | let nftId = getStringValue(this, (auctionId + "_nft_on_auction")) |
---|
214 | | - | let biddingPrice = getStringValue(this, (auctionId + "_highest_bid")) |
---|
215 | | - | if ((biddingWinner == "0")) |
---|
216 | | - | then [StringEntry(((txId + auctionId) + "_nft_status"), "CANCELED"), ScriptTransfer(Address(fromBase58String(nftOwner)), 1, fromBase58String(nftId))] |
---|
217 | | - | else if ((biddingWinner != "0")) |
---|
218 | | - | then throw("sorry! you can't cancel it because already auction placed by someone") |
---|
219 | | - | else nil |
---|
220 | | - | } |
---|
221 | | - | |
---|
222 | | - | |
---|
223 | | - | |
---|
224 | | - | @Callable(i) |
---|
225 | | - | func manualFundTransfer (recepientAddr) = { |
---|
226 | | - | let sender = i.caller.bytes |
---|
227 | | - | let reciver = fromBase58String(recepientAddr) |
---|
228 | | - | let amount = i.payments[0].amount |
---|
229 | | - | if ((i.payments[0].assetId == unit)) |
---|
230 | | - | then [IntegerEntry((toBase58String(sender) + "_transfer"), amount), StringEntry((toBase58String(sender) + "_transfer_to"), recepientAddr), ScriptTransfer(Address(reciver), amount, unit)] |
---|
231 | | - | else if ((i.payments[0].assetId == teams)) |
---|
232 | | - | then [IntegerEntry((toBase58String(sender) + "_transfer"), amount), StringEntry((toBase58String(sender) + "_transfer_to"), recepientAddr), ScriptTransfer(Address(reciver), amount, teams)] |
---|
233 | | - | else nil |
---|
234 | | - | } |
---|
235 | | - | |
---|
236 | | - | |
---|
237 | | - | |
---|
238 | | - | @Callable(i) |
---|
239 | | - | func nftback (auctionId) = { |
---|
240 | | - | let caller = i.caller.bytes |
---|
241 | | - | let nftId = getStringValue(this, (auctionId + "_nft_on_auction")) |
---|
242 | | - | let nftOwner = getStringValue(this, (auctionId + "_nft_owner")) |
---|
243 | | - | [StringEntry((auctionId + "_nft_status"), "Auction_time over"), ScriptTransfer(Address(fromBase58String(nftOwner)), 1, fromBase58String(nftId))] |
---|
244 | | - | } |
---|
245 | | - | |
---|
246 | | - | |
---|
247 | | - | |
---|
248 | | - | @Callable(i) |
---|
249 | | - | func withdrawMoney (auctionId,current_currency) = { |
---|
250 | | - | let caller = i.caller.bytes |
---|
251 | | - | let asimiString = "9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq" |
---|
252 | | - | let txId = toBase58String(i.transactionId) |
---|
253 | | - | let amountUnit = fromBase58String(current_currency) |
---|
254 | | - | let bidPrice = getStringValue(this, (auctionId + "_highest_bid")) |
---|
255 | | - | let asBidder = getStringValue(this, (auctionId + "_winner")) |
---|
256 | | - | let bidForNFT = getStringValue(this, (auctionId + "_nft_id")) |
---|
257 | | - | if ((current_currency == asimiString)) |
---|
258 | | - | then [StringEntry((auctionId + "_nft_bid"), "WITHDRAW"), StringEntry((auctionId + "_nft_id"), bidForNFT), StringEntry((auctionId + "_bidding_price_refund_amount"), bidPrice), ScriptTransfer(i.caller, parseIntValue(bidPrice), amountUnit)] |
---|
259 | | - | else if ((current_currency == "WAVES")) |
---|
260 | | - | then [StringEntry((auctionId + "_nft_bid"), "WITHDRAW"), StringEntry((auctionId + "_nft_id"), bidForNFT), StringEntry((auctionId + "_bidding_price_refund_amount"), bidPrice), ScriptTransfer(i.caller, parseIntValue(bidPrice), unit)] |
---|
261 | | - | else nil |
---|
262 | | - | } |
---|
263 | | - | |
---|
264 | | - | |
---|
265 | | - | |
---|
266 | | - | @Callable(i) |
---|
267 | | - | func buyAllProducts_asimi (nftInfo) = { |
---|
268 | | - | let buyer = i.caller |
---|
269 | | - | let buyerBalance = assetBalance(buyer, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq') |
---|
270 | | - | let nfT1 = split(nftInfo[0], "_") |
---|
271 | | - | let nfT2 = split(nftInfo[1], "_") |
---|
272 | | - | let nfT3 = split(nftInfo[2], "_") |
---|
273 | | - | let nfT4 = split(nftInfo[3], "_") |
---|
274 | | - | let nfT5 = split(nftInfo[4], "_") |
---|
275 | | - | let amount = value(i.payments[0].amount) |
---|
276 | | - | let realcost = (amount - ((amount / 1000) * 25)) |
---|
277 | | - | let platformfee = (amount - realcost) |
---|
278 | | - | let royalityAmount = ((amount / 100) * parseIntValue(nfT1[3])) |
---|
279 | | - | let lastCost = (amount - (royalityAmount + platformfee)) |
---|
280 | | - | let amount1 = value(i.payments[1].amount) |
---|
281 | | - | let realcost1 = (amount1 - ((amount1 / 1000) * 25)) |
---|
282 | | - | let platformfee1 = (amount1 - realcost1) |
---|
283 | | - | let royalityAmount1 = ((amount1 / 100) * parseIntValue(nfT2[3])) |
---|
284 | | - | let lastCost1 = (amount1 - (royalityAmount1 + platformfee1)) |
---|
285 | | - | let amount2 = value(i.payments[2].amount) |
---|
286 | | - | let realcost2 = (amount2 - ((amount2 / 1000) * 25)) |
---|
287 | | - | let platformfee2 = (amount2 - realcost2) |
---|
288 | | - | let royalityAmount2 = ((amount2 / 100) * parseIntValue(nfT3[3])) |
---|
289 | | - | let lastCost2 = (amount2 - (royalityAmount2 + platformfee2)) |
---|
290 | | - | let amount3 = value(i.payments[3].amount) |
---|
291 | | - | let realcost3 = (amount3 - ((amount3 / 1000) * 25)) |
---|
292 | | - | let platformfee3 = (amount3 - realcost3) |
---|
293 | | - | let royalityAmount3 = ((amount3 / 100) * parseIntValue(nfT4[3])) |
---|
294 | | - | let lastCost3 = (amount3 - (royalityAmount3 + platformfee3)) |
---|
295 | | - | let amount4 = value(i.payments[4].amount) |
---|
296 | | - | let realcost4 = (amount4 - ((amount4 / 1000) * 25)) |
---|
297 | | - | let platformfee4 = (amount4 - realcost4) |
---|
298 | | - | let royalityAmount4 = ((amount4 / 100) * parseIntValue(nfT5[3])) |
---|
299 | | - | let lastCost4 = (amount4 - (royalityAmount4 + platformfee4)) |
---|
300 | | - | if ((size(nftInfo) == 1)) |
---|
301 | | - | then [StringEntry((((((("first_nft_Info=" + "nftId") + nfT1[0]) + "creator") + nfT1[4]) + "royalitypercent") + nfT1[3]), ("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])), lastCost, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(nfT1[4])), royalityAmount, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq')] |
---|
302 | | - | else if ((size(nftInfo) == 2)) |
---|
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))), ScriptTransfer(buyer, 1, fromBase58String(nfT1[0])), ScriptTransfer(buyer, 1, fromBase58String(nfT2[0])), ScriptTransfer(Address(fromBase58String(nfT1[1])), lastCost, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(nfT1[4])), royalityAmount, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(nfT2[1])), lastCost1, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(nfT2[4])), royalityAmount1, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq')] |
---|
304 | | - | else if ((size(nftInfo) == 3)) |
---|
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))), ScriptTransfer(buyer, 1, fromBase58String(nfT1[0])), ScriptTransfer(buyer, 1, fromBase58String(nfT2[0])), ScriptTransfer(buyer, 1, fromBase58String(nfT3[0])), ScriptTransfer(Address(fromBase58String(nfT1[1])), lastCost, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(nfT1[4])), royalityAmount, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(nfT2[1])), lastCost1, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(nfT2[4])), royalityAmount1, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(nfT3[1])), lastCost2, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(nfT3[4])), royalityAmount2, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq')] |
---|
306 | | - | else if ((size(nftInfo) == 4)) |
---|
307 | | - | 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])), lastCost, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(nfT1[4])), royalityAmount, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(nfT2[1])), lastCost1, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(nfT2[4])), royalityAmount1, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(nfT3[1])), lastCost2, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(nfT3[4])), royalityAmount2, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(nfT4[1])), lastCost3, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(nfT4[4])), royalityAmount3, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq')] |
---|
308 | | - | else if ((size(nftInfo) == 5)) |
---|
309 | | - | 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])), lastCost, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(nfT1[4])), royalityAmount, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(nfT2[1])), lastCost1, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(nfT2[4])), royalityAmount1, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(nfT3[1])), lastCost2, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(nfT3[4])), royalityAmount2, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(nfT4[1])), lastCost3, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(nfT4[4])), royalityAmount3, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(nfT5[1])), lastCost4, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(nfT5[4])), royalityAmount4, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq')] |
---|
310 | | - | else if ((size(nftInfo) > 5)) |
---|
311 | | - | then throw("sorry! maximum limit of your cart is 5 items") |
---|
312 | | - | else nil |
---|
313 | | - | } |
---|
314 | | - | |
---|
315 | | - | |
---|
316 | | - | |
---|
317 | | - | @Callable(i) |
---|
318 | | - | func buyAllProducts_waves (nftInfo) = { |
---|
319 | | - | let buyer = i.caller |
---|
320 | | - | let buyerBalance = assetBalance(buyer, WAVES) |
---|
321 | | - | let nfT1 = split(nftInfo[0], "_") |
---|
322 | | - | let nfT2 = split(nftInfo[1], "_") |
---|
323 | | - | let nfT3 = split(nftInfo[2], "_") |
---|
324 | | - | let nfT4 = split(nftInfo[3], "_") |
---|
325 | | - | let nfT5 = split(nftInfo[4], "_") |
---|
326 | | - | let amount = value(i.payments[0].amount) |
---|
327 | | - | let realcost = (amount - ((amount / 1000) * 25)) |
---|
328 | | - | let platformfee = (amount - realcost) |
---|
329 | | - | let royalityAmount = ((amount / 100) * parseIntValue(nfT1[3])) |
---|
330 | | - | let lastCost = (amount - (royalityAmount + platformfee)) |
---|
331 | | - | let amount1 = value(i.payments[1].amount) |
---|
332 | | - | let realcost1 = (amount1 - ((amount1 / 1000) * 25)) |
---|
333 | | - | let platformfee1 = (amount1 - realcost1) |
---|
334 | | - | let royalityAmount1 = ((amount1 / 100) * parseIntValue(nfT2[3])) |
---|
335 | | - | let lastCost1 = (amount1 - (royalityAmount1 + platformfee1)) |
---|
336 | | - | let amount2 = value(i.payments[2].amount) |
---|
337 | | - | let realcost2 = (amount2 - ((amount2 / 1000) * 25)) |
---|
338 | | - | let platformfee2 = (amount2 - realcost2) |
---|
339 | | - | let royalityAmount2 = ((amount2 / 100) * parseIntValue(nfT3[3])) |
---|
340 | | - | let lastCost2 = (amount2 - (royalityAmount2 + platformfee2)) |
---|
341 | | - | let amount3 = value(i.payments[3].amount) |
---|
342 | | - | let realcost3 = (amount3 - ((amount3 / 1000) * 25)) |
---|
343 | | - | let platformfee3 = (amount3 - realcost3) |
---|
344 | | - | let royalityAmount3 = ((amount3 / 100) * parseIntValue(nfT4[3])) |
---|
345 | | - | let lastCost3 = (amount3 - (royalityAmount3 + platformfee3)) |
---|
346 | | - | let amount4 = value(i.payments[4].amount) |
---|
347 | | - | let realcost4 = (amount4 - ((amount4 / 1000) * 25)) |
---|
348 | | - | let platformfee4 = (amount4 - realcost4) |
---|
349 | | - | let royalityAmount4 = ((amount4 / 100) * parseIntValue(nfT5[3])) |
---|
350 | | - | let lastCost4 = (amount4 - (royalityAmount4 + platformfee4)) |
---|
351 | | - | if ((size(nftInfo) == 1)) |
---|
352 | | - | 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])), lastCost, unit), ScriptTransfer(Address(fromBase58String(nfT1[4])), royalityAmount, unit)] |
---|
353 | | - | else if ((size(nftInfo) == 2)) |
---|
354 | | - | 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])), lastCost, unit), ScriptTransfer(Address(fromBase58String(nfT1[4])), royalityAmount, unit), ScriptTransfer(Address(fromBase58String(nfT2[1])), lastCost1, unit), ScriptTransfer(Address(fromBase58String(nfT2[4])), royalityAmount1, unit)] |
---|
355 | | - | else if ((size(nftInfo) == 3)) |
---|
356 | | - | 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])), lastCost, unit), ScriptTransfer(Address(fromBase58String(nfT1[4])), royalityAmount, unit), ScriptTransfer(Address(fromBase58String(nfT2[1])), lastCost1, unit), ScriptTransfer(Address(fromBase58String(nfT2[4])), royalityAmount1, unit), ScriptTransfer(Address(fromBase58String(nfT3[1])), lastCost2, unit), ScriptTransfer(Address(fromBase58String(nfT3[4])), royalityAmount2, unit)] |
---|
357 | | - | else if ((size(nftInfo) == 4)) |
---|
358 | | - | 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])), lastCost, unit), ScriptTransfer(Address(fromBase58String(nfT1[4])), royalityAmount, unit), ScriptTransfer(Address(fromBase58String(nfT2[1])), lastCost1, unit), ScriptTransfer(Address(fromBase58String(nfT2[4])), royalityAmount1, unit), ScriptTransfer(Address(fromBase58String(nfT3[1])), lastCost2, unit), ScriptTransfer(Address(fromBase58String(nfT3[4])), royalityAmount2, unit), ScriptTransfer(Address(fromBase58String(nfT4[1])), lastCost3, unit), ScriptTransfer(Address(fromBase58String(nfT4[4])), royalityAmount3, unit)] |
---|
359 | | - | else if ((size(nftInfo) == 5)) |
---|
360 | | - | 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])), lastCost, unit), ScriptTransfer(Address(fromBase58String(nfT1[4])), royalityAmount, unit), ScriptTransfer(Address(fromBase58String(nfT2[1])), lastCost1, unit), ScriptTransfer(Address(fromBase58String(nfT2[4])), royalityAmount1, unit), ScriptTransfer(Address(fromBase58String(nfT3[1])), lastCost2, unit), ScriptTransfer(Address(fromBase58String(nfT3[4])), royalityAmount2, unit), ScriptTransfer(Address(fromBase58String(nfT4[1])), lastCost3, unit), ScriptTransfer(Address(fromBase58String(nfT4[4])), royalityAmount3, unit), ScriptTransfer(Address(fromBase58String(nfT5[1])), lastCost4, unit), ScriptTransfer(Address(fromBase58String(nfT5[4])), royalityAmount4, unit)] |
---|
361 | | - | else if ((size(nftInfo) > 5)) |
---|
362 | | - | then throw("sorry! maximum limit of your cart is 5 items") |
---|
363 | | - | else nil |
---|
364 | | - | } |
---|
365 | | - | |
---|
366 | | - | |
---|
367 | | - | |
---|
368 | | - | @Callable(i) |
---|
369 | | - | func withdrawEarnAsimi (platformFee,amount) = { |
---|
370 | | - | let ownerAddress = base58'3MuehcPaJCUy5asSiT8XX1pwwz9Tj4J9SDS' |
---|
371 | | - | if ((i.caller.bytes != ownerAddress)) |
---|
372 | | - | then throw("sorry you have no access") |
---|
373 | | - | else if (if ((platformFee >= 0)) |
---|
374 | | - | then (platformFee >= amount) |
---|
375 | | - | else false) |
---|
376 | | - | then [ScriptTransfer(i.caller, (amount * 100), teams)] |
---|
377 | | - | else nil |
---|
378 | | - | } |
---|
379 | | - | |
---|
380 | | - | |
---|
381 | | - | |
---|
382 | | - | @Callable(i) |
---|
383 | | - | func withdrawEarnWaves (platformFee,amount) = { |
---|
384 | | - | let ownerAddress = base58'3MuehcPaJCUy5asSiT8XX1pwwz9Tj4J9SDS' |
---|
385 | | - | if ((i.caller.bytes != ownerAddress)) |
---|
386 | | - | then throw("sorry you have no access") |
---|
387 | | - | else if (if ((platformFee >= 0)) |
---|
388 | | - | then (platformFee >= amount) |
---|
389 | | - | else false) |
---|
390 | | - | then [ScriptTransfer(i.caller, (amount * 100000000), unit)] |
---|
391 | | - | else nil |
---|
392 | | - | } |
---|
393 | | - | |
---|
394 | | - | |
---|
395 | | - | @Verifier(tx) |
---|
396 | | - | func verify () = match tx { |
---|
397 | | - | case setScriptTx: SetScriptTransaction => |
---|
398 | | - | true |
---|
399 | | - | case _ => |
---|
400 | | - | false |
---|
401 | | - | } |
---|