60 | | - | |
---|
61 | | - | |
---|
62 | | - | @Callable(p) |
---|
63 | | - | func sellNFT (F,G) = { |
---|
64 | | - | let D = p.transactionId |
---|
65 | | - | let H = p.caller.bytes |
---|
66 | | - | let I = $Tuple2(value(p.payments[0].assetId), value(p.payments[0].amount)) |
---|
67 | | - | let J = I._1 |
---|
68 | | - | let K = I._2 |
---|
69 | | - | if (!(k(J))) |
---|
70 | | - | then throw("Token is not NFT") |
---|
71 | | - | else [StringEntry(((c + a) + toBase58String(value(p.payments[0].assetId))), F), StringEntry(((toString(p.caller) + a) + d), (((toBase58String(J) + a) + toString(K)) + G))] |
---|
72 | | - | } |
---|
73 | | - | |
---|
74 | | - | |
---|
75 | | - | |
---|
76 | | - | @Callable(p) |
---|
77 | | - | func buyNFT (L,M,N,x) = { |
---|
78 | | - | let l = fromBase58String(L) |
---|
79 | | - | let O = { |
---|
80 | | - | let m = getString(this, (("nft_" + M) + "_owner")) |
---|
81 | | - | if ($isInstanceOf(m, "String")) |
---|
82 | | - | then { |
---|
83 | | - | let P = m |
---|
84 | | - | P |
---|
85 | | - | } |
---|
86 | | - | else false |
---|
87 | | - | } |
---|
88 | | - | let F = getStringValue(((((c + a) + L) + "_") + M)) |
---|
89 | | - | let Q = value(p.payments[0].amount) |
---|
90 | | - | let R = (Q - ((Q / 1000) * 25)) |
---|
91 | | - | let S = (Q - R) |
---|
92 | | - | let T = x |
---|
93 | | - | let U = ((Q * parseIntValue(T)) / 100) |
---|
94 | | - | let V = (Q - (U + S)) |
---|
95 | | - | if ((M == toString(p.caller))) |
---|
96 | | - | then throw("current Owner of NFT not able to purchase") |
---|
97 | | - | else if (if ((p.payments[0].assetId == f)) |
---|
98 | | - | then (N != M) |
---|
99 | | - | else false) |
---|
100 | | - | then [ScriptTransfer(p.caller, 1, l), ScriptTransfer(Address(fromBase58String(M)), V, f), ScriptTransfer(Address(fromBase58String(N)), U, f), IntegerEntry((("nft_" + L) + "platform_fee"), S), StringEntry(((toString(p.caller) + a) + b), ((L + a) + toString(Q))), DeleteEntry((("nft_" + M) + "_owner")), StringEntry((("nft_" + M) + "_owner"), toString(p.caller)), StringEntry(((L + a) + "_owner"), toString(p.caller))] |
---|
101 | | - | else if (if ((p.payments[0].assetId == f)) |
---|
102 | | - | then (N == M) |
---|
103 | | - | else false) |
---|
104 | | - | then [ScriptTransfer(p.caller, 1, l), ScriptTransfer(Address(fromBase58String(M)), R, f), StringEntry((("nft_" + L) + "platform_fee"), toString(S)), StringEntry(((toString(p.caller) + a) + b), ((L + a) + toString(Q))), DeleteEntry((("nft_" + M) + "_owner")), StringEntry((("nft_" + M) + "_owner"), toString(p.caller)), StringEntry(((L + a) + "_owner"), toString(p.caller))] |
---|
105 | | - | else if (if ((p.payments[0].assetId == unit)) |
---|
106 | | - | then (N != M) |
---|
107 | | - | else false) |
---|
108 | | - | then [ScriptTransfer(p.caller, 1, l), ScriptTransfer(Address(fromBase58String(M)), V, unit), ScriptTransfer(Address(fromBase58String(N)), U, unit), StringEntry((("nft_" + L) + "platform_fee"), toString(S)), StringEntry(((toString(p.caller) + a) + b), ((L + a) + toString(Q))), DeleteEntry((("nft_" + M) + "_owner")), StringEntry((("nft_" + M) + "_owner"), toString(p.caller)), StringEntry(((L + a) + "_owner"), toString(p.caller))] |
---|
109 | | - | else if (if ((p.payments[0].assetId == unit)) |
---|
110 | | - | then (N == M) |
---|
111 | | - | else false) |
---|
112 | | - | then [ScriptTransfer(p.caller, 1, l), ScriptTransfer(Address(fromBase58String(M)), R, unit), StringEntry((("nft_" + L) + "platform_fee"), toString(S)), StringEntry(((toString(p.caller) + a) + b), ((L + a) + toString(Q))), DeleteEntry((("nft_" + M) + "_owner")), StringEntry((("nft_" + M) + "_owner"), toString(p.caller)), StringEntry(((L + a) + "_owner"), toString(p.caller))] |
---|
113 | | - | else nil |
---|
114 | | - | } |
---|
115 | | - | |
---|
116 | | - | |
---|
117 | | - | |
---|
118 | | - | @Callable(p) |
---|
119 | | - | func cancelSell (W) = { |
---|
120 | | - | let D = toBase58String(p.transactionId) |
---|
121 | | - | let H = p.caller.bytes |
---|
122 | | - | [StringEntry(((D + W) + "_nft_status"), "CANCELED"), ScriptTransfer(Address(H), 1, fromBase58String(W))] |
---|
123 | | - | } |
---|
124 | | - | |
---|
125 | | - | |
---|
126 | | - | |
---|
127 | | - | @Callable(p) |
---|
128 | | - | func addAuction (X,Y,Z,aa,G) = { |
---|
129 | | - | let D = toBase58String(p.transactionId) |
---|
130 | | - | let W = value(p.payments[0].assetId) |
---|
131 | | - | let F = value(Z) |
---|
132 | | - | let ab = (lastBlock.height + aa) |
---|
133 | | - | let q = p.caller.bytes |
---|
134 | | - | let ac = { |
---|
135 | | - | let m = getString(this, (((toBase58String(W) + a) + "nft_status_") + toBase58String(q))) |
---|
136 | | - | if ($isInstanceOf(m, "String")) |
---|
137 | | - | then { |
---|
138 | | - | let P = m |
---|
139 | | - | true |
---|
140 | | - | } |
---|
141 | | - | else false |
---|
142 | | - | } |
---|
143 | | - | if ((ac == true)) |
---|
144 | | - | then throw("Already in auction list") |
---|
145 | | - | else if ((aa > e)) |
---|
146 | | - | then throw(("Duration is too long. Must be less than or equal to 30 " + toString(e))) |
---|
147 | | - | else if ((p.payments[0].assetId == unit)) |
---|
148 | | - | then throw("NFT not attached") |
---|
149 | | - | else if ((p.payments[0].assetId == f)) |
---|
150 | | - | then throw("NFT not attached") |
---|
151 | | - | else [StringEntry(((D + "nft_start_auction_date") + toBase58String(q)), X), StringEntry(((D + "nft_end_auction_date") + toBase58String(q)), Y), StringEntry((D + "_nft_start_price"), Z), StringEntry((D + "_nft_owner"), toString(p.caller)), StringEntry((D + "_nft_on_auction"), toBase58String(W)), StringEntry((D + "_previous_bidder"), "none"), StringEntry((D + "_highest_bid"), "0"), StringEntry((D + "_winner_of_nft"), "0"), StringEntry((D + "_bidder_count"), "0"), StringEntry((D + "_nft_status"), "OPEN")] |
---|
152 | | - | } |
---|
153 | | - | |
---|
154 | | - | |
---|
155 | | - | |
---|
156 | | - | @Callable(p) |
---|
157 | | - | func placeBid (ad,W,s,ae,af) = { |
---|
158 | | - | let D = toBase58String(p.transactionId) |
---|
159 | | - | let q = p.caller.bytes |
---|
160 | | - | let l = fromBase58String(W) |
---|
161 | | - | let ag = p.payments[0].assetId |
---|
162 | | - | let ah = p.payments[0].amount |
---|
163 | | - | let ai = getStringValue(this, (ad + "_highest_bid")) |
---|
164 | | - | let aj = getString(this, (ad + "_previous_bidder")) |
---|
165 | | - | let ak = getStringValue(this, (ad + "_bidder_count")) |
---|
166 | | - | let al = getStringValue(this, (ad + "_winner_of_nft")) |
---|
167 | | - | let ac = getStringValue(this, (ad + "_nft_status")) |
---|
168 | | - | if ((ac != "OPEN")) |
---|
169 | | - | then throw("Not open for auction") |
---|
170 | | - | else if ((parseIntValue(ai) >= ah)) |
---|
171 | | - | then throw("Bid is less then starting/highest Bid") |
---|
172 | | - | else if ((ai == "0")) |
---|
173 | | - | then [StringEntry((ad + "_highest_bid"), toString(ah)), StringEntry((ad + "_winner_of_nft"), toBase58String(p.caller.bytes)), StringEntry((ad + "_bidder_count"), toString((parseIntValue(ak) + 1))), StringEntry((ad + "_nft_id"), toBase58String(l)), StringEntry((ad + "_nft_owner"), s), StringEntry((((D + "_") + ad) + "_highest_bid"), toString(ah)), StringEntry((((D + "_") + ad) + "_winner"), toBase58String(p.caller.bytes)), StringEntry((((D + "_") + ad) + "_bidder_count"), toString((parseIntValue(ak) + 1))), StringEntry((((D + "_") + ad) + "_nft_id"), toBase58String(l)), StringEntry((((D + "_") + ad) + "_nft_owner"), s), StringEntry((D + "_bid_for_nft_by"), toBase58String(q)), StringEntry((D + "_bid_price_place"), ae), StringEntry((D + "_previous_bid_amount_refund_to_address"), al), StringEntry((D + "_prevoius_bid_amount_refund"), ai)] |
---|
174 | | - | else if ((ai != "0")) |
---|
175 | | - | then [ScriptTransfer(Address(fromBase58String(al)), parseIntValue(ai), ag), StringEntry((D + "_previous_bid_amount_refund_to_address"), al), StringEntry((D + "_prevoius_bid_amount_refund"), ai), StringEntry((ad + "_bidder_count"), toString((parseIntValue(ak) + 1))), StringEntry((ad + "_highest_bid"), toString(ah)), StringEntry((ad + "_winner_of_nft"), toBase58String(p.caller.bytes)), StringEntry((ad + "_nft_id"), toBase58String(l)), StringEntry((ad + "_nft_owner"), s), StringEntry((((D + "_") + ad) + "_highest_bid"), toString(ah)), StringEntry((((D + "_") + ad) + "_winner"), toBase58String(p.caller.bytes)), StringEntry((((D + "_") + ad) + "_bidder_count"), toString((parseIntValue(ak) + 1))), StringEntry((((D + "_") + ad) + "_nft_id"), toBase58String(l)), StringEntry((((D + "_") + ad) + "_nft_owner"), s), StringEntry((D + "_bid_for_nft_by"), toBase58String(q)), StringEntry((D + "_bid_price_place"), ae)] |
---|
176 | | - | else nil |
---|
177 | | - | } |
---|
178 | | - | |
---|
179 | | - | |
---|
180 | | - | |
---|
181 | | - | @Callable(p) |
---|
182 | | - | func acceptBidOffer (ad,W,am,M,N,x,af) = { |
---|
183 | | - | let an = "9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq" |
---|
184 | | - | let D = toBase58String(p.transactionId) |
---|
185 | | - | let ao = fromBase58String(af) |
---|
186 | | - | let q = p.caller.bytes |
---|
187 | | - | let l = fromBase58String(W) |
---|
188 | | - | let ap = getStringValue(this, (ad + "_highest_bid")) |
---|
189 | | - | let aq = ((parseIntValue(ap) / 1000) * 975) |
---|
190 | | - | let S = ((parseIntValue(ap) / 1000) * 25) |
---|
191 | | - | let U = ((parseIntValue(ap) * parseIntValue(x)) / 100) |
---|
192 | | - | let ar = (parseIntValue(ap) - (U + S)) |
---|
193 | | - | let as = getStringValue(this, (ad + "_winner_of_nft")) |
---|
194 | | - | if (if ((af == an)) |
---|
195 | | - | then (N != M) |
---|
196 | | - | else false) |
---|
197 | | - | then [ScriptTransfer(Address(q), ar, ao), ScriptTransfer(Address(fromBase58String(as)), 1, l), ScriptTransfer(Address(fromBase58String(N)), U, ao), StringEntry((D + "_amount_paid_to_owner"), ap), StringEntry((D + "_nft_transfer_to"), as), StringEntry((D + "_nft_status"), "REWARDED"), StringEntry((ad + "_amount_paid_to_owner"), ap), StringEntry((ad + "_nft_transfer_to"), as), StringEntry((ad + "_nft_status"), "REWARDED")] |
---|
198 | | - | else if (if ((af == an)) |
---|
199 | | - | then (N == M) |
---|
200 | | - | else false) |
---|
201 | | - | then [ScriptTransfer(Address(q), aq, ao), ScriptTransfer(Address(fromBase58String(as)), 1, l), StringEntry((D + "_amount_paid_to_owner"), ap), StringEntry((D + "_nft_transfer_to"), as), StringEntry((D + "_nft_status"), "REWARDED"), StringEntry((ad + "_amount_paid_to_owner"), ap), StringEntry((ad + "_nft_transfer_to"), as), StringEntry((ad + "_nft_status"), "REWARDED")] |
---|
202 | | - | else if (if ((af == "WAVES")) |
---|
203 | | - | then (N != M) |
---|
204 | | - | else false) |
---|
205 | | - | then [ScriptTransfer(Address(q), ar, unit), ScriptTransfer(Address(fromBase58String(as)), 1, l), ScriptTransfer(Address(fromBase58String(N)), U, unit), StringEntry("platform_fee", toString(S)), StringEntry((D + "_amount_paid_to_owner"), ap), StringEntry((D + "_nft_transfer_to"), as), StringEntry((D + "_nft_status"), "REWARDED"), StringEntry((ad + "_amount_paid_to_owner"), ap), StringEntry((ad + "_nft_transfer_to"), as), StringEntry((ad + "_nft_status"), "REWARDED")] |
---|
206 | | - | else if (if ((af == "WAVES")) |
---|
207 | | - | then (N == M) |
---|
208 | | - | else false) |
---|
209 | | - | then [ScriptTransfer(Address(q), aq, unit), ScriptTransfer(Address(fromBase58String(as)), 1, l), StringEntry((D + "_amount_paid_to_owner"), ap), StringEntry((D + "_nft_transfer_to"), as), StringEntry((D + "_nft_status"), "REWARDED"), StringEntry((ad + "_amount_paid_to_owner"), ap), StringEntry((ad + "_nft_transfer_to"), as), StringEntry((ad + "_nft_status"), "REWARDED")] |
---|
210 | | - | else nil |
---|
211 | | - | } |
---|
212 | | - | |
---|
213 | | - | |
---|
214 | | - | |
---|
215 | | - | @Callable(p) |
---|
216 | | - | func cancelAuction (ad) = { |
---|
217 | | - | let D = toBase58String(p.transactionId) |
---|
218 | | - | let q = p.caller.bytes |
---|
219 | | - | let at = getStringValue(this, (ad + "_nft_status")) |
---|
220 | | - | let au = getStringValue(this, (ad + "_winner_of_nft")) |
---|
221 | | - | let av = getStringValue(this, (ad + "_nft_owner")) |
---|
222 | | - | let W = getStringValue(this, (ad + "_nft_on_auction")) |
---|
223 | | - | let aw = getStringValue(this, (ad + "_highest_bid")) |
---|
224 | | - | if ((au == "0")) |
---|
225 | | - | then [StringEntry(((D + ad) + "_nft_status"), "CANCELED"), ScriptTransfer(Address(fromBase58String(av)), 1, fromBase58String(W))] |
---|
226 | | - | else if ((au != "0")) |
---|
227 | | - | then throw("sorry! you can't cancel it because already auction placed by someone") |
---|
228 | | - | else nil |
---|
229 | | - | } |
---|
230 | | - | |
---|
231 | | - | |
---|
232 | | - | |
---|
233 | | - | @Callable(p) |
---|
234 | | - | func manualFundTransfer (ax) = { |
---|
235 | | - | let ay = p.caller.bytes |
---|
236 | | - | let az = fromBase58String(ax) |
---|
237 | | - | let Q = p.payments[0].amount |
---|
238 | | - | if ((p.payments[0].assetId == unit)) |
---|
239 | | - | then [IntegerEntry((toBase58String(ay) + "_transfer"), Q), StringEntry((toBase58String(ay) + "_transfer_to"), ax), ScriptTransfer(Address(az), Q, unit)] |
---|
240 | | - | else if ((p.payments[0].assetId == f)) |
---|
241 | | - | then [IntegerEntry((toBase58String(ay) + "_transfer"), Q), StringEntry((toBase58String(ay) + "_transfer_to"), ax), ScriptTransfer(Address(az), Q, f)] |
---|
242 | | - | else nil |
---|
243 | | - | } |
---|
244 | | - | |
---|
245 | | - | |
---|
246 | | - | |
---|
247 | | - | @Callable(p) |
---|
248 | | - | func nftback (ad) = { |
---|
249 | | - | let q = p.caller.bytes |
---|
250 | | - | let W = getStringValue(this, (ad + "_nft_on_auction")) |
---|
251 | | - | let av = getStringValue(this, (ad + "_nft_owner")) |
---|
252 | | - | [StringEntry((ad + "_nft_status"), "Auction_time over"), ScriptTransfer(Address(fromBase58String(av)), 1, fromBase58String(W))] |
---|
253 | | - | } |
---|
254 | | - | |
---|
255 | | - | |
---|
256 | | - | |
---|
257 | | - | @Callable(p) |
---|
258 | | - | func withdrawMoney (ad,af) = { |
---|
259 | | - | let q = p.caller.bytes |
---|
260 | | - | let an = "9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq" |
---|
261 | | - | let D = toBase58String(p.transactionId) |
---|
262 | | - | let ao = fromBase58String(af) |
---|
263 | | - | let aA = getStringValue(this, (ad + "_highest_bid")) |
---|
264 | | - | let aB = getStringValue(this, (ad + "_winner")) |
---|
265 | | - | let aC = getStringValue(this, (ad + "_nft_id")) |
---|
266 | | - | if ((af == an)) |
---|
267 | | - | then [StringEntry((ad + "_nft_bid"), "WITHDRAW"), StringEntry((ad + "_nft_id"), aC), StringEntry((ad + "_bidding_price_refund_amount"), aA), ScriptTransfer(p.caller, parseIntValue(aA), ao)] |
---|
268 | | - | else if ((af == "WAVES")) |
---|
269 | | - | then [StringEntry((ad + "_nft_bid"), "WITHDRAW"), StringEntry((ad + "_nft_id"), aC), StringEntry((ad + "_bidding_price_refund_amount"), aA), ScriptTransfer(p.caller, parseIntValue(aA), unit)] |
---|
270 | | - | else nil |
---|
271 | | - | } |
---|
272 | | - | |
---|
273 | | - | |
---|
274 | | - | |
---|
275 | | - | @Callable(p) |
---|
276 | | - | func buyAllProducts_asimi (aD) = { |
---|
277 | | - | let aE = p.caller |
---|
278 | | - | let aF = assetBalance(aE, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq') |
---|
279 | | - | let aG = split(aD[0], "_") |
---|
280 | | - | let aH = split(aD[1], "_") |
---|
281 | | - | let aI = split(aD[2], "_") |
---|
282 | | - | let aJ = split(aD[3], "_") |
---|
283 | | - | let aK = split(aD[4], "_") |
---|
284 | | - | let Q = value(p.payments[0].amount) |
---|
285 | | - | let aL = (Q - ((Q / 1000) * 25)) |
---|
286 | | - | let aM = (Q - aL) |
---|
287 | | - | let U = ((Q / 100) * parseIntValue(aG[3])) |
---|
288 | | - | let aN = (Q - (U + aM)) |
---|
289 | | - | let aO = value(p.payments[1].amount) |
---|
290 | | - | let aP = (aO - ((aO / 1000) * 25)) |
---|
291 | | - | let aQ = (aO - aP) |
---|
292 | | - | let aR = ((aO / 100) * parseIntValue(aH[3])) |
---|
293 | | - | let aS = (aO - (aR + aQ)) |
---|
294 | | - | let aT = value(p.payments[2].amount) |
---|
295 | | - | let aU = (aT - ((aT / 1000) * 25)) |
---|
296 | | - | let aV = (aT - aU) |
---|
297 | | - | let aW = ((aT / 100) * parseIntValue(aI[3])) |
---|
298 | | - | let aX = (aT - (aW + aV)) |
---|
299 | | - | let aY = value(p.payments[3].amount) |
---|
300 | | - | let aZ = (aY - ((aY / 1000) * 25)) |
---|
301 | | - | let ba = (aY - aZ) |
---|
302 | | - | let bb = ((aY / 100) * parseIntValue(aJ[3])) |
---|
303 | | - | let bc = (aY - (bb + ba)) |
---|
304 | | - | let bd = value(p.payments[4].amount) |
---|
305 | | - | let be = (bd - ((bd / 1000) * 25)) |
---|
306 | | - | let bf = (bd - be) |
---|
307 | | - | let bg = ((bd / 100) * parseIntValue(aK[3])) |
---|
308 | | - | let bh = (bd - (bg + bf)) |
---|
309 | | - | if ((size(aD) == 1)) |
---|
310 | | - | then [StringEntry((((((("first_nft_Info=" + "nftId") + aG[0]) + "creator") + aG[4]) + "royalitypercent") + aG[3]), ("buyer" + toString(aE))), StringEntry((("first_nft_Info=" + "seller_address") + aG[1]), ("price" + aG[2])), ScriptTransfer(aE, 1, fromBase58String(aG[0])), ScriptTransfer(Address(fromBase58String(aG[1])), aN, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aG[4])), U, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq')] |
---|
311 | | - | else if ((size(aD) == 2)) |
---|
312 | | - | then [StringEntry((((((("first_nft_Info=" + "nftId") + aG[0]) + "seller_address") + aG[1]) + "price") + aG[2]), ("buyer" + toString(aE))), StringEntry((((((("second_nft_Info=" + "nftId") + aH[0]) + "seller_address") + aH[1]) + "price") + aH[2]), ("buyer" + toString(aE))), ScriptTransfer(aE, 1, fromBase58String(aG[0])), ScriptTransfer(aE, 1, fromBase58String(aH[0])), ScriptTransfer(Address(fromBase58String(aG[1])), aN, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aG[4])), U, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aH[1])), aS, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aH[4])), aR, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq')] |
---|
313 | | - | else if ((size(aD) == 3)) |
---|
314 | | - | then [StringEntry((((((("first_nft_Info=" + "nftId") + aG[0]) + "seller_address") + aG[1]) + "price") + aG[2]), ("buyer" + toString(aE))), StringEntry((((((("second_nft_Info=" + "nftId") + aH[0]) + "seller_address") + aH[1]) + "price") + aH[2]), ("buyer" + toString(aE))), StringEntry((((((("third_nft_Info=" + "nftId") + aI[0]) + "seller_address") + aI[1]) + "price") + aI[2]), ("buyer" + toString(aE))), ScriptTransfer(aE, 1, fromBase58String(aG[0])), ScriptTransfer(aE, 1, fromBase58String(aH[0])), ScriptTransfer(aE, 1, fromBase58String(aI[0])), ScriptTransfer(Address(fromBase58String(aG[1])), aN, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aG[4])), U, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aH[1])), aS, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aH[4])), aR, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aI[1])), aX, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aI[4])), aW, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq')] |
---|
315 | | - | else if ((size(aD) == 4)) |
---|
316 | | - | then [StringEntry((((((("first_nft_Info=" + "nftId") + aG[0]) + "seller_address") + aG[1]) + "price") + aG[2]), ("buyer" + toString(aE))), StringEntry((((((("second_nft_Info=" + "nftId") + aH[0]) + "seller_address") + aH[1]) + "price") + aH[2]), ("buyer" + toString(aE))), StringEntry((((((("third_nft_Info=" + "nftId") + aI[0]) + "seller_address") + aI[1]) + "price") + aI[2]), ("buyer" + toString(aE))), StringEntry((((((("fourth_nft_Info=" + "nftId") + aJ[0]) + "seller_address") + aJ[1]) + "price") + aJ[2]), ("buyer" + toString(aE))), ScriptTransfer(aE, 1, fromBase58String(aG[0])), ScriptTransfer(aE, 1, fromBase58String(aH[0])), ScriptTransfer(aE, 1, fromBase58String(aI[0])), ScriptTransfer(aE, 1, fromBase58String(aJ[0])), ScriptTransfer(Address(fromBase58String(aG[1])), aN, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aG[4])), U, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aH[1])), aS, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aH[4])), aR, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aI[1])), aX, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aI[4])), aW, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aJ[1])), bc, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aJ[4])), bb, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq')] |
---|
317 | | - | else if ((size(aD) == 5)) |
---|
318 | | - | then [StringEntry((((((("first_nft_Info=" + "nftId") + aG[0]) + "seller_address") + aG[1]) + "price") + aG[2]), ("buyer" + toString(aE))), StringEntry((((((("second_nft_Info=" + "nftId") + aH[0]) + "seller_address") + aH[1]) + "price") + aH[2]), ("buyer" + toString(aE))), StringEntry((((((("third_nft_Info=" + "nftId") + aI[0]) + "seller_address") + aI[1]) + "price") + aI[2]), ("buyer" + toString(aE))), StringEntry((((((("fourth_nft_Info=" + "nftId") + aJ[0]) + "seller_address") + aJ[1]) + "price") + aJ[2]), ("buyer" + toString(aE))), StringEntry((((((("fifth_nft_Info=" + "nftId") + aK[0]) + "seller_address") + aK[1]) + "price") + aK[2]), ("buyer" + toString(aE))), ScriptTransfer(aE, 1, fromBase58String(aG[0])), ScriptTransfer(aE, 1, fromBase58String(aH[0])), ScriptTransfer(aE, 1, fromBase58String(aI[0])), ScriptTransfer(aE, 1, fromBase58String(aJ[0])), ScriptTransfer(aE, 1, fromBase58String(aK[0])), ScriptTransfer(Address(fromBase58String(aG[1])), aN, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aG[4])), U, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aH[1])), aS, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aH[4])), aR, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aI[1])), aX, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aI[4])), aW, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aJ[1])), bc, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aJ[4])), bb, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aK[1])), bh, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aK[4])), bg, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq')] |
---|
319 | | - | else if ((size(aD) > 5)) |
---|
320 | | - | then throw("sorry! maximum limit of your cart is 5 items") |
---|
321 | | - | else nil |
---|
322 | | - | } |
---|
323 | | - | |
---|
324 | | - | |
---|
325 | | - | |
---|
326 | | - | @Callable(p) |
---|
327 | | - | func buyAllProducts_waves (aD) = { |
---|
328 | | - | let aE = p.caller |
---|
329 | | - | let aF = assetBalance(aE, g) |
---|
330 | | - | let aG = split(aD[0], "_") |
---|
331 | | - | let aH = split(aD[1], "_") |
---|
332 | | - | let aI = split(aD[2], "_") |
---|
333 | | - | let aJ = split(aD[3], "_") |
---|
334 | | - | let aK = split(aD[4], "_") |
---|
335 | | - | let Q = value(p.payments[0].amount) |
---|
336 | | - | let aL = (Q - ((Q / 1000) * 25)) |
---|
337 | | - | let aM = (Q - aL) |
---|
338 | | - | let U = ((Q / 100) * parseIntValue(aG[3])) |
---|
339 | | - | let aN = (Q - (U + aM)) |
---|
340 | | - | let aO = value(p.payments[1].amount) |
---|
341 | | - | let aP = (aO - ((aO / 1000) * 25)) |
---|
342 | | - | let aQ = (aO - aP) |
---|
343 | | - | let aR = ((aO / 100) * parseIntValue(aH[3])) |
---|
344 | | - | let aS = (aO - (aR + aQ)) |
---|
345 | | - | let aT = value(p.payments[2].amount) |
---|
346 | | - | let aU = (aT - ((aT / 1000) * 25)) |
---|
347 | | - | let aV = (aT - aU) |
---|
348 | | - | let aW = ((aT / 100) * parseIntValue(aI[3])) |
---|
349 | | - | let aX = (aT - (aW + aV)) |
---|
350 | | - | let aY = value(p.payments[3].amount) |
---|
351 | | - | let aZ = (aY - ((aY / 1000) * 25)) |
---|
352 | | - | let ba = (aY - aZ) |
---|
353 | | - | let bb = ((aY / 100) * parseIntValue(aJ[3])) |
---|
354 | | - | let bc = (aY - (bb + ba)) |
---|
355 | | - | let bd = value(p.payments[4].amount) |
---|
356 | | - | let be = (bd - ((bd / 1000) * 25)) |
---|
357 | | - | let bf = (bd - be) |
---|
358 | | - | let bg = ((bd / 100) * parseIntValue(aK[3])) |
---|
359 | | - | let bh = (bd - (bg + bf)) |
---|
360 | | - | if ((size(aD) == 1)) |
---|
361 | | - | then [StringEntry((((((("first_nft_Info=" + "nftId") + aG[0]) + "seller_address") + aG[1]) + "price") + aG[2]), ("buyer" + toString(aE))), ScriptTransfer(aE, 1, fromBase58String(aG[0])), ScriptTransfer(Address(fromBase58String(aG[1])), aN, unit), ScriptTransfer(Address(fromBase58String(aG[4])), U, unit)] |
---|
362 | | - | else if ((size(aD) == 2)) |
---|
363 | | - | then [StringEntry((((((("first_nft_Info=" + "nftId") + aG[0]) + "seller_address") + aG[1]) + "price") + aG[2]), ("buyer" + toString(aE))), StringEntry((((((("second_nft_Info=" + "nftId") + aH[0]) + "seller_address") + aH[1]) + "price") + aH[2]), ("buyer" + toString(aE))), ScriptTransfer(aE, 1, fromBase58String(aG[0])), ScriptTransfer(aE, 1, fromBase58String(aH[0])), ScriptTransfer(Address(fromBase58String(aG[1])), aN, unit), ScriptTransfer(Address(fromBase58String(aG[4])), U, unit), ScriptTransfer(Address(fromBase58String(aH[1])), aS, unit), ScriptTransfer(Address(fromBase58String(aH[4])), aR, unit)] |
---|
364 | | - | else if ((size(aD) == 3)) |
---|
365 | | - | then [StringEntry((((((("first_nft_Info=" + "nftId") + aG[0]) + "seller_address") + aG[1]) + "price") + aG[2]), ("buyer" + toString(aE))), StringEntry((((((("second_nft_Info=" + "nftId") + aH[0]) + "seller_address") + aH[1]) + "price") + aH[2]), ("buyer" + toString(aE))), StringEntry((((((("third_nft_Info=" + "nftId") + aI[0]) + "seller_address") + aI[1]) + "price") + aI[2]), ("buyer" + toString(aE))), ScriptTransfer(aE, 1, fromBase58String(aG[0])), ScriptTransfer(aE, 1, fromBase58String(aH[0])), ScriptTransfer(aE, 1, fromBase58String(aI[0])), ScriptTransfer(Address(fromBase58String(aG[1])), aN, unit), ScriptTransfer(Address(fromBase58String(aG[4])), U, unit), ScriptTransfer(Address(fromBase58String(aH[1])), aS, unit), ScriptTransfer(Address(fromBase58String(aH[4])), aR, unit), ScriptTransfer(Address(fromBase58String(aI[1])), aX, unit), ScriptTransfer(Address(fromBase58String(aI[4])), aW, unit)] |
---|
366 | | - | else if ((size(aD) == 4)) |
---|
367 | | - | then [StringEntry((((((("first_nft_Info=" + "nftId") + aG[0]) + "seller_address") + aG[1]) + "price") + aG[2]), ("buyer" + toString(aE))), StringEntry((((((("second_nft_Info=" + "nftId") + aH[0]) + "seller_address") + aH[1]) + "price") + aH[2]), ("buyer" + toString(aE))), StringEntry((((((("third_nft_Info=" + "nftId") + aI[0]) + "seller_address") + aI[1]) + "price") + aI[2]), ("buyer" + toString(aE))), StringEntry((((((("fourth_nft_Info=" + "nftId") + aJ[0]) + "seller_address") + aJ[1]) + "price") + aJ[2]), ("buyer" + toString(aE))), ScriptTransfer(aE, 1, fromBase58String(aG[0])), ScriptTransfer(aE, 1, fromBase58String(aH[0])), ScriptTransfer(aE, 1, fromBase58String(aI[0])), ScriptTransfer(aE, 1, fromBase58String(aJ[0])), ScriptTransfer(Address(fromBase58String(aG[1])), aN, unit), ScriptTransfer(Address(fromBase58String(aG[4])), U, unit), ScriptTransfer(Address(fromBase58String(aH[1])), aS, unit), ScriptTransfer(Address(fromBase58String(aH[4])), aR, unit), ScriptTransfer(Address(fromBase58String(aI[1])), aX, unit), ScriptTransfer(Address(fromBase58String(aI[4])), aW, unit), ScriptTransfer(Address(fromBase58String(aJ[1])), bc, unit), ScriptTransfer(Address(fromBase58String(aJ[4])), bb, unit)] |
---|
368 | | - | else if ((size(aD) == 5)) |
---|
369 | | - | then [StringEntry((((((("first_nft_Info=" + "nftId") + aG[0]) + "seller_address") + aG[1]) + "price") + aG[2]), ("buyer" + toString(aE))), StringEntry((((((("second_nft_Info=" + "nftId") + aH[0]) + "seller_address") + aH[1]) + "price") + aH[2]), ("buyer" + toString(aE))), StringEntry((((((("third_nft_Info=" + "nftId") + aI[0]) + "seller_address") + aI[1]) + "price") + aI[2]), ("buyer" + toString(aE))), StringEntry((((((("fourth_nft_Info=" + "nftId") + aJ[0]) + "seller_address") + aJ[1]) + "price") + aJ[2]), ("buyer" + toString(aE))), StringEntry((((((("fifth_nft_Info=" + "nftId") + aK[0]) + "seller_address") + aK[1]) + "price") + aK[2]), ("buyer" + toString(aE))), ScriptTransfer(aE, 1, fromBase58String(aG[0])), ScriptTransfer(aE, 1, fromBase58String(aH[0])), ScriptTransfer(aE, 1, fromBase58String(aI[0])), ScriptTransfer(aE, 1, fromBase58String(aJ[0])), ScriptTransfer(aE, 1, fromBase58String(aK[0])), ScriptTransfer(Address(fromBase58String(aG[1])), aN, unit), ScriptTransfer(Address(fromBase58String(aG[4])), U, unit), ScriptTransfer(Address(fromBase58String(aH[1])), aS, unit), ScriptTransfer(Address(fromBase58String(aH[4])), aR, unit), ScriptTransfer(Address(fromBase58String(aI[1])), aX, unit), ScriptTransfer(Address(fromBase58String(aI[4])), aW, unit), ScriptTransfer(Address(fromBase58String(aJ[1])), bc, unit), ScriptTransfer(Address(fromBase58String(aJ[4])), bb, unit), ScriptTransfer(Address(fromBase58String(aK[1])), bh, unit), ScriptTransfer(Address(fromBase58String(aK[4])), bg, unit)] |
---|
370 | | - | else if ((size(aD) > 5)) |
---|
371 | | - | then throw("sorry! maximum limit of your cart is 5 items") |
---|
372 | | - | else nil |
---|
373 | | - | } |
---|
374 | | - | |
---|
375 | | - | |
---|
376 | | - | |
---|
377 | | - | @Callable(p) |
---|
378 | | - | func withdrawEarnAsimi (bi,Q) = { |
---|
379 | | - | let bj = base58'3MuehcPaJCUy5asSiT8XX1pwwz9Tj4J9SDS' |
---|
380 | | - | if ((p.caller.bytes != bj)) |
---|
381 | | - | then throw("sorry you have no access") |
---|
382 | | - | else if (if ((bi >= 0)) |
---|
383 | | - | then (bi >= Q) |
---|
384 | | - | else false) |
---|
385 | | - | then [ScriptTransfer(p.caller, (Q * 100), f)] |
---|
386 | | - | else nil |
---|
387 | | - | } |
---|
388 | | - | |
---|
389 | | - | |
---|
390 | | - | |
---|
391 | | - | @Callable(p) |
---|
392 | | - | func withdrawEarnWaves (bi,Q) = { |
---|
393 | | - | let bj = base58'3MuehcPaJCUy5asSiT8XX1pwwz9Tj4J9SDS' |
---|
394 | | - | if ((p.caller.bytes != bj)) |
---|
395 | | - | then throw("sorry you have no access") |
---|
396 | | - | else if (if ((bi >= 0)) |
---|
397 | | - | then (bi >= Q) |
---|
398 | | - | else false) |
---|
399 | | - | then [ScriptTransfer(p.caller, (Q * 100000000), unit)] |
---|
400 | | - | else nil |
---|
401 | | - | } |
---|
402 | | - | |
---|
403 | | - | |
---|
404 | | - | @Verifier(bk) |
---|
405 | | - | func bl () = { |
---|
406 | | - | let m = bk |
---|
407 | | - | if ($isInstanceOf(m, "SetScriptTransaction")) |
---|
408 | | - | then { |
---|
409 | | - | let bm = m |
---|
410 | | - | true |
---|
411 | | - | } |
---|
412 | | - | else false |
---|
413 | | - | } |
---|