8 | | - | let c = "price" |
---|
9 | | - | |
---|
10 | | - | let d = "sell" |
---|
11 | | - | |
---|
12 | | - | let e = 30 |
---|
13 | | - | |
---|
14 | | - | let f = base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq' |
---|
15 | | - | |
---|
16 | | - | let g = base58'' |
---|
17 | | - | |
---|
18 | | - | let h = "bid" |
---|
19 | | - | |
---|
20 | | - | let i = true |
---|
21 | | - | |
---|
22 | | - | let j = $Tuple4("OPEN", "CLOSED", "REWARDED", "CANCELED") |
---|
23 | | - | |
---|
24 | | - | let k = base58'3MvjAaDYHpS4A5K4CV3kZMMEH9m9JdBSvbq' |
---|
25 | | - | |
---|
26 | | - | func l (m) = { |
---|
27 | | - | let n = assetInfo(m) |
---|
28 | | - | if ($isInstanceOf(n, "Asset")) |
---|
29 | | - | then { |
---|
30 | | - | let o = n |
---|
31 | | - | if (if ((o.decimals == 0)) |
---|
32 | | - | then (o.quantity == 1) |
---|
33 | | - | else false) |
---|
34 | | - | then (o.reissuable == false) |
---|
35 | | - | else false |
---|
36 | | - | } |
---|
37 | | - | else false |
---|
38 | | - | } |
---|
39 | | - | |
---|
40 | | - | |
---|
41 | | - | @Callable(p) |
---|
42 | | - | func createNft (q,r,s,t,u,v,w,x,y,z) = { |
---|
43 | | - | let A = Issue(q, x, 1, 0, false) |
---|
44 | | - | let B = calculateAssetId(A) |
---|
45 | | - | let C = p.transactionId |
---|
46 | | - | [A, ScriptTransfer(p.caller, 1, B), StringEntry(((toBase58String(B) + a) + "Owner"), toString(p.caller)), StringEntry(((toBase58String(B) + a) + "nft_type"), t), StringEntry(((toBase58String(B) + a) + "nft_tags"), u), StringEntry(((toBase58String(B) + a) + "nft_dAppAddress"), s), StringEntry(((toBase58String(C) + a) + "royaltyPercentage"), w), IntegerEntry(((toBase58String(B) + a) + "nft_selling_price"), v), StringEntry(((toBase58String(B) + a) + "nft_onSell"), y), StringEntry(((toBase58String(B) + a) + "nft_data"), z), StringEntry(((toBase58String(C) + a) + "issue_nft"), toBase58String(B))] |
---|
47 | | - | } |
---|
48 | | - | |
---|
49 | | - | |
---|
50 | | - | |
---|
51 | | - | @Callable(p) |
---|
52 | | - | func sellNFT (D,E) = { |
---|
53 | | - | let C = p.transactionId |
---|
54 | | - | let F = p.caller.bytes |
---|
55 | | - | let G = $Tuple2(value(p.payments[0].assetId), value(p.payments[0].amount)) |
---|
56 | | - | let H = G._1 |
---|
57 | | - | let I = G._2 |
---|
58 | | - | if (!(l(H))) |
---|
59 | | - | then throw("Token is not NFT") |
---|
60 | | - | else [StringEntry(((c + a) + toBase58String(value(p.payments[0].assetId))), D), StringEntry(((toString(p.caller) + a) + d), (((toBase58String(H) + a) + toString(I)) + E))] |
---|
61 | | - | } |
---|
62 | | - | |
---|
63 | | - | |
---|
64 | | - | |
---|
65 | | - | @Callable(p) |
---|
66 | | - | func buyNFT (J,K,L,w) = { |
---|
67 | | - | let m = fromBase58String(J) |
---|
68 | | - | let M = { |
---|
69 | | - | let n = getString(this, (("nft_" + K) + "_owner")) |
---|
70 | | - | if ($isInstanceOf(n, "String")) |
---|
71 | | - | then { |
---|
72 | | - | let N = n |
---|
73 | | - | N |
---|
74 | | - | } |
---|
75 | | - | else false |
---|
76 | | - | } |
---|
77 | | - | let D = getStringValue(((((c + a) + J) + "_") + K)) |
---|
78 | | - | let O = value(p.payments[0].amount) |
---|
79 | | - | let P = (O - ((O / 1000) * 25)) |
---|
80 | | - | let Q = (O - P) |
---|
81 | | - | let R = w |
---|
82 | | - | let S = ((O * parseIntValue(R)) / 100) |
---|
83 | | - | let T = (O - (S + Q)) |
---|
84 | | - | if ((K == toString(p.caller))) |
---|
85 | | - | then throw("current Owner of NFT not able to purchase") |
---|
86 | | - | else if (if ((p.payments[0].assetId == f)) |
---|
87 | | - | then (L != K) |
---|
88 | | - | else false) |
---|
89 | | - | then [ScriptTransfer(p.caller, 1, m), ScriptTransfer(Address(fromBase58String(K)), T, f), ScriptTransfer(Address(fromBase58String(L)), S, f), IntegerEntry((("nft_" + J) + "platform_fee"), Q), StringEntry(((toString(p.caller) + a) + b), ((J + a) + toString(O))), DeleteEntry((("nft_" + K) + "_owner")), StringEntry((("nft_" + K) + "_owner"), toString(p.caller)), StringEntry(((J + a) + "_owner"), toString(p.caller))] |
---|
90 | | - | else if (if ((p.payments[0].assetId == f)) |
---|
91 | | - | then (L == K) |
---|
92 | | - | else false) |
---|
93 | | - | then [ScriptTransfer(p.caller, 1, m), ScriptTransfer(Address(fromBase58String(K)), P, f), StringEntry((("nft_" + J) + "platform_fee"), toString(Q)), StringEntry(((toString(p.caller) + a) + b), ((J + a) + toString(O))), DeleteEntry((("nft_" + K) + "_owner")), StringEntry((("nft_" + K) + "_owner"), toString(p.caller)), StringEntry(((J + a) + "_owner"), toString(p.caller))] |
---|
94 | | - | else if (if ((p.payments[0].assetId == unit)) |
---|
95 | | - | then (L != K) |
---|
96 | | - | else false) |
---|
97 | | - | then [ScriptTransfer(p.caller, 1, m), ScriptTransfer(Address(fromBase58String(K)), T, unit), ScriptTransfer(Address(fromBase58String(L)), S, unit), StringEntry((("nft_" + J) + "platform_fee"), toString(Q)), StringEntry(((toString(p.caller) + a) + b), ((J + a) + toString(O))), DeleteEntry((("nft_" + K) + "_owner")), StringEntry((("nft_" + K) + "_owner"), toString(p.caller)), StringEntry(((J + a) + "_owner"), toString(p.caller))] |
---|
98 | | - | else if (if ((p.payments[0].assetId == unit)) |
---|
99 | | - | then (L == K) |
---|
100 | | - | else false) |
---|
101 | | - | then [ScriptTransfer(p.caller, 1, m), ScriptTransfer(Address(fromBase58String(K)), P, unit), StringEntry((("nft_" + J) + "platform_fee"), toString(Q)), StringEntry(((toString(p.caller) + a) + b), ((J + a) + toString(O))), DeleteEntry((("nft_" + K) + "_owner")), StringEntry((("nft_" + K) + "_owner"), toString(p.caller)), StringEntry(((J + a) + "_owner"), toString(p.caller))] |
---|
102 | | - | else nil |
---|
103 | | - | } |
---|
104 | | - | |
---|
105 | | - | |
---|
106 | | - | |
---|
107 | | - | @Callable(p) |
---|
108 | | - | func cancelSell (U) = { |
---|
109 | | - | let C = toBase58String(p.transactionId) |
---|
110 | | - | let F = p.caller.bytes |
---|
111 | | - | [StringEntry(((C + U) + "_nft_status"), "CANCELED"), ScriptTransfer(Address(F), 1, fromBase58String(U))] |
---|
112 | | - | } |
---|
113 | | - | |
---|
114 | | - | |
---|
115 | | - | |
---|
116 | | - | @Callable(p) |
---|
117 | | - | func addAuction (V,W,X,Y,E) = { |
---|
118 | | - | let C = toBase58String(p.transactionId) |
---|
119 | | - | let U = value(p.payments[0].assetId) |
---|
120 | | - | let D = value(X) |
---|
121 | | - | let Z = (lastBlock.height + Y) |
---|
122 | | - | let aa = p.caller.bytes |
---|
123 | | - | let ab = { |
---|
124 | | - | let n = getString(this, (((toBase58String(U) + a) + "nft_status_") + toBase58String(aa))) |
---|
125 | | - | if ($isInstanceOf(n, "String")) |
---|
126 | | - | then { |
---|
127 | | - | let N = n |
---|
128 | | - | true |
---|
129 | | - | } |
---|
130 | | - | else false |
---|
131 | | - | } |
---|
132 | | - | if ((ab == true)) |
---|
133 | | - | then throw("Already in auction list") |
---|
134 | | - | else if ((Y > e)) |
---|
135 | | - | then throw(("Duration is too long. Must be less than or equal to 30 " + toString(e))) |
---|
136 | | - | else if ((p.payments[0].assetId == unit)) |
---|
137 | | - | then throw("NFT not attached") |
---|
138 | | - | else if ((p.payments[0].assetId == f)) |
---|
139 | | - | then throw("NFT not attached") |
---|
140 | | - | else [StringEntry(((C + "nft_start_auction_date") + toBase58String(aa)), V), StringEntry(((C + "nft_end_auction_date") + toBase58String(aa)), W), StringEntry((C + "_nft_start_price"), X), StringEntry((C + "_nft_owner"), toString(p.caller)), StringEntry((C + "_nft_on_auction"), toBase58String(U)), StringEntry((C + "_previous_bidder"), "none"), StringEntry((C + "_highest_bid"), "0"), StringEntry((C + "_winner_of_nft"), "0"), StringEntry((C + "_bidder_count"), "0"), StringEntry((C + "_nft_status"), "OPEN")] |
---|
141 | | - | } |
---|
142 | | - | |
---|
143 | | - | |
---|
144 | | - | |
---|
145 | | - | @Callable(p) |
---|
146 | | - | func placeBid (ac,U,r,ad,ae) = { |
---|
147 | | - | let C = toBase58String(p.transactionId) |
---|
148 | | - | let aa = p.caller.bytes |
---|
149 | | - | let m = fromBase58String(U) |
---|
150 | | - | let af = p.payments[0].assetId |
---|
151 | | - | let ag = p.payments[0].amount |
---|
152 | | - | let ah = getStringValue(this, (ac + "_highest_bid")) |
---|
153 | | - | let ai = getString(this, (ac + "_previous_bidder")) |
---|
154 | | - | let aj = getStringValue(this, (ac + "_bidder_count")) |
---|
155 | | - | let ak = getStringValue(this, (ac + "_winner_of_nft")) |
---|
156 | | - | let ab = getStringValue(this, (ac + "_nft_status")) |
---|
157 | | - | if ((ab != "OPEN")) |
---|
158 | | - | then throw("Not open for auction") |
---|
159 | | - | else if ((parseIntValue(ah) >= ag)) |
---|
160 | | - | then throw("Bid is less then starting/highest Bid") |
---|
161 | | - | else if ((ah == "0")) |
---|
162 | | - | then [StringEntry((ac + "_highest_bid"), toString(ag)), StringEntry((ac + "_winner_of_nft"), toBase58String(p.caller.bytes)), StringEntry((ac + "_bidder_count"), toString((parseIntValue(aj) + 1))), StringEntry((ac + "_nft_id"), toBase58String(m)), StringEntry((ac + "_nft_owner"), r), StringEntry((((C + "_") + ac) + "_highest_bid"), toString(ag)), StringEntry((((C + "_") + ac) + "_winner"), toBase58String(p.caller.bytes)), StringEntry((((C + "_") + ac) + "_bidder_count"), toString((parseIntValue(aj) + 1))), StringEntry((((C + "_") + ac) + "_nft_id"), toBase58String(m)), StringEntry((((C + "_") + ac) + "_nft_owner"), r), StringEntry((C + "_bid_for_nft_by"), toBase58String(aa)), StringEntry((C + "_bid_price_place"), ad), StringEntry((C + "_previous_bid_amount_refund_to_address"), ak), StringEntry((C + "_prevoius_bid_amount_refund"), ah)] |
---|
163 | | - | else if ((ah != "0")) |
---|
164 | | - | then [ScriptTransfer(Address(fromBase58String(ak)), parseIntValue(ah), af), StringEntry((C + "_previous_bid_amount_refund_to_address"), ak), StringEntry((C + "_prevoius_bid_amount_refund"), ah), StringEntry((ac + "_bidder_count"), toString((parseIntValue(aj) + 1))), StringEntry((ac + "_highest_bid"), toString(ag)), StringEntry((ac + "_winner_of_nft"), toBase58String(p.caller.bytes)), StringEntry((ac + "_nft_id"), toBase58String(m)), StringEntry((ac + "_nft_owner"), r), StringEntry((((C + "_") + ac) + "_highest_bid"), toString(ag)), StringEntry((((C + "_") + ac) + "_winner"), toBase58String(p.caller.bytes)), StringEntry((((C + "_") + ac) + "_bidder_count"), toString((parseIntValue(aj) + 1))), StringEntry((((C + "_") + ac) + "_nft_id"), toBase58String(m)), StringEntry((((C + "_") + ac) + "_nft_owner"), r), StringEntry((C + "_bid_for_nft_by"), toBase58String(aa)), StringEntry((C + "_bid_price_place"), ad)] |
---|
165 | | - | else nil |
---|
166 | | - | } |
---|
167 | | - | |
---|
168 | | - | |
---|
169 | | - | |
---|
170 | | - | @Callable(p) |
---|
171 | | - | func acceptBidOffer (ac,U,al,L,w,ae) = { |
---|
172 | | - | let am = "9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq" |
---|
173 | | - | let C = toBase58String(p.transactionId) |
---|
174 | | - | let an = fromBase58String(ae) |
---|
175 | | - | let aa = p.caller.bytes |
---|
176 | | - | let m = fromBase58String(U) |
---|
177 | | - | let ao = getStringValue(this, (ac + "_highest_bid")) |
---|
178 | | - | let ap = ((parseIntValue(ao) / 1000) * 975) |
---|
179 | | - | let Q = ((parseIntValue(ao) / 1000) * 25) |
---|
180 | | - | let S = ((parseIntValue(ao) / 100) * parseIntValue(w)) |
---|
181 | | - | let aq = (parseIntValue(ao) - (S + Q)) |
---|
182 | | - | let ar = getStringValue(this, (ac + "_winner_of_nft")) |
---|
183 | | - | if (if ((ae == am)) |
---|
184 | | - | then (toUtf8String(aa) == L) |
---|
185 | | - | else false) |
---|
186 | | - | then [ScriptTransfer(Address(aa), ap, an), ScriptTransfer(Address(fromBase58String(ar)), 1, m), StringEntry((C + "_amount_paid_to_owner"), ao), StringEntry((C + "_nft_transfer_to"), ar), StringEntry((C + "_nft_status"), "REWARDED"), StringEntry((ac + "_amount_paid_to_owner"), ao), StringEntry((ac + "_nft_transfer_to"), ar), StringEntry((ac + "_nft_status"), "REWARDED")] |
---|
187 | | - | else if (if ((ae == am)) |
---|
188 | | - | then (toUtf8String(aa) != L) |
---|
189 | | - | else false) |
---|
190 | | - | then [ScriptTransfer(Address(aa), ap, an), ScriptTransfer(Address(fromBase58String(ar)), 1, m), ScriptTransfer(Address(fromBase58String(L)), aq, an), StringEntry((C + "_amount_paid_to_owner"), ao), StringEntry((C + "_nft_transfer_to"), ar), StringEntry((C + "_nft_status"), "REWARDED"), StringEntry((ac + "_amount_paid_to_owner"), ao), StringEntry((ac + "_nft_transfer_to"), ar), StringEntry((ac + "_nft_status"), "REWARDED")] |
---|
191 | | - | else if (if ((ae == "WAVES")) |
---|
192 | | - | then (toUtf8String(aa) == L) |
---|
193 | | - | else false) |
---|
194 | | - | then [ScriptTransfer(Address(aa), ap, unit), ScriptTransfer(Address(fromBase58String(ar)), 1, m), StringEntry((C + "_amount_paid_to_owner"), ao), StringEntry((C + "_nft_transfer_to"), ar), StringEntry((C + "_nft_status"), "REWARDED"), StringEntry((ac + "_amount_paid_to_owner"), ao), StringEntry((ac + "_nft_transfer_to"), ar), StringEntry((ac + "_nft_status"), "REWARDED")] |
---|
195 | | - | else if (if ((ae == "WAVES")) |
---|
196 | | - | then (toUtf8String(aa) != L) |
---|
197 | | - | else false) |
---|
198 | | - | then [ScriptTransfer(Address(aa), ap, unit), ScriptTransfer(Address(fromBase58String(ar)), 1, m), ScriptTransfer(Address(fromBase58String(L)), aq, unit), StringEntry((C + "_amount_paid_to_owner"), ao), StringEntry((C + "_nft_transfer_to"), ar), StringEntry((C + "_nft_status"), "REWARDED"), StringEntry((ac + "_amount_paid_to_owner"), ao), StringEntry((ac + "_nft_transfer_to"), ar), StringEntry((ac + "_nft_status"), "REWARDED")] |
---|
199 | | - | else nil |
---|
200 | | - | } |
---|
201 | | - | |
---|
202 | | - | |
---|
203 | | - | |
---|
204 | | - | @Callable(p) |
---|
205 | | - | func cancelAuction (ac) = { |
---|
206 | | - | let C = toBase58String(p.transactionId) |
---|
207 | | - | let aa = p.caller.bytes |
---|
208 | | - | let as = getStringValue(this, (ac + "_nft_status")) |
---|
209 | | - | let at = getStringValue(this, (ac + "_winner_of_nft")) |
---|
210 | | - | let au = getStringValue(this, (ac + "_nft_owner")) |
---|
211 | | - | let U = getStringValue(this, (ac + "_nft_on_auction")) |
---|
212 | | - | let av = getStringValue(this, (ac + "_highest_bid")) |
---|
213 | | - | if ((at == "0")) |
---|
214 | | - | then [StringEntry(((C + ac) + "_nft_status"), "CANCELED"), ScriptTransfer(Address(fromBase58String(au)), 1, fromBase58String(U))] |
---|
215 | | - | else if ((at != "0")) |
---|
216 | | - | then throw("soory you can't cancel it because already auction placed by someone") |
---|
217 | | - | else nil |
---|
218 | | - | } |
---|
219 | | - | |
---|
220 | | - | |
---|
221 | | - | |
---|
222 | | - | @Callable(p) |
---|
223 | | - | func manualFundTransfer (aw,ax) = { |
---|
224 | | - | let ay = p.caller.bytes |
---|
225 | | - | let az = fromBase58String(aw) |
---|
226 | | - | let O = p.payments[0].amount |
---|
227 | | - | let Q = ((O / 1000) * 25) |
---|
228 | | - | let aA = (O - Q) |
---|
229 | | - | if ((p.payments[0].assetId == unit)) |
---|
230 | | - | then [IntegerEntry((toBase58String(ay) + "_transfer"), O), StringEntry("platform_fee", toString(Q)), StringEntry((toBase58String(ay) + "_transfer_to"), aw), ScriptTransfer(Address(az), aA, unit)] |
---|
231 | | - | else if ((p.payments[0].assetId == f)) |
---|
232 | | - | then [IntegerEntry((toBase58String(ay) + "_transfer"), O), IntegerEntry("platform_fee", Q), StringEntry((toBase58String(ay) + "_transfer_to"), aw), ScriptTransfer(Address(az), aA, f)] |
---|
233 | | - | else nil |
---|
234 | | - | } |
---|
235 | | - | |
---|
236 | | - | |
---|
237 | | - | |
---|
238 | | - | @Callable(p) |
---|
239 | | - | func nftback (ac) = { |
---|
240 | | - | let aa = p.caller.bytes |
---|
241 | | - | let U = getStringValue(this, (ac + "_nft_on_auction")) |
---|
242 | | - | let au = getStringValue(this, (ac + "_nft_owner")) |
---|
243 | | - | [StringEntry((ac + "_nft_status"), "Auction_time over"), ScriptTransfer(Address(fromBase58String(au)), 1, fromBase58String(U))] |
---|
244 | | - | } |
---|
245 | | - | |
---|
246 | | - | |
---|
247 | | - | |
---|
248 | | - | @Callable(p) |
---|
249 | | - | func withdrawMoney (ac,ae) = { |
---|
250 | | - | let aa = p.caller.bytes |
---|
251 | | - | let am = "9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq" |
---|
252 | | - | let C = toBase58String(p.transactionId) |
---|
253 | | - | let an = fromBase58String(ae) |
---|
254 | | - | let aB = getStringValue(this, (ac + "_highest_bid")) |
---|
255 | | - | let aC = getStringValue(this, (ac + "_winner")) |
---|
256 | | - | let aD = getStringValue(this, (ac + "_nft_id")) |
---|
257 | | - | if ((ae == am)) |
---|
258 | | - | then [StringEntry((ac + "_nft_bid"), "WITHDRAW"), StringEntry((ac + "_nft_id"), aD), StringEntry((ac + "_bidding_price_refund_amount"), aB), ScriptTransfer(p.caller, parseIntValue(aB), an)] |
---|
259 | | - | else if ((ae == "WAVES")) |
---|
260 | | - | then [StringEntry((ac + "_nft_bid"), "WITHDRAW"), StringEntry((ac + "_nft_id"), aD), StringEntry((ac + "_bidding_price_refund_amount"), aB), ScriptTransfer(p.caller, parseIntValue(aB), unit)] |
---|
261 | | - | else nil |
---|
262 | | - | } |
---|
263 | | - | |
---|
264 | | - | |
---|
265 | | - | |
---|
266 | | - | @Callable(p) |
---|
267 | | - | func buyAllProducts_asimi (aE) = { |
---|
268 | | - | let aF = p.caller |
---|
269 | | - | let aG = assetBalance(aF, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq') |
---|
270 | | - | let aH = split(aE[0], "_") |
---|
271 | | - | let aI = split(aE[1], "_") |
---|
272 | | - | let aJ = split(aE[2], "_") |
---|
273 | | - | let aK = split(aE[3], "_") |
---|
274 | | - | let aL = split(aE[4], "_") |
---|
275 | | - | let O = value(p.payments[0].amount) |
---|
276 | | - | let aM = (O - ((O / 1000) * 25)) |
---|
277 | | - | let aN = (O - aM) |
---|
278 | | - | let S = ((O / 100) * parseIntValue(aH[3])) |
---|
279 | | - | let aO = (O - (S + aN)) |
---|
280 | | - | let aP = value(p.payments[1].amount) |
---|
281 | | - | let aQ = (aP - ((aP / 1000) * 25)) |
---|
282 | | - | let aR = (aP - aQ) |
---|
283 | | - | let aS = ((aP / 100) * parseIntValue(aI[3])) |
---|
284 | | - | let aT = (aP - (aS + aR)) |
---|
285 | | - | let aU = value(p.payments[2].amount) |
---|
286 | | - | let aV = (aU - ((aU / 1000) * 25)) |
---|
287 | | - | let aW = (aU - aV) |
---|
288 | | - | let aX = ((aU / 100) * parseIntValue(aJ[3])) |
---|
289 | | - | let aY = (aU - (aX + aW)) |
---|
290 | | - | let aZ = value(p.payments[3].amount) |
---|
291 | | - | let ba = (aZ - ((aZ / 1000) * 25)) |
---|
292 | | - | let bb = (aZ - ba) |
---|
293 | | - | let bc = ((aZ / 100) * parseIntValue(aK[3])) |
---|
294 | | - | let bd = (aZ - (bc + bb)) |
---|
295 | | - | let be = value(p.payments[4].amount) |
---|
296 | | - | let bf = (be - ((be / 1000) * 25)) |
---|
297 | | - | let bg = (be - bf) |
---|
298 | | - | let bh = ((be / 100) * parseIntValue(aL[3])) |
---|
299 | | - | let bi = (be - (bh + bg)) |
---|
300 | | - | if ((O > aG)) |
---|
301 | | - | then throw("Buyer does not have enough funds to complete the purchase.") |
---|
302 | | - | else if ((size(aE) == 1)) |
---|
303 | | - | then [StringEntry((((("first_nft_Info=" + "nftId") + aH[0]) + "creator") + aH[4]), ("buyer" + toString(aF))), StringEntry((("first_nft_Info=" + "seller_address") + aH[1]), ("price" + aH[2])), ScriptTransfer(aF, 1, fromBase58String(aH[0])), ScriptTransfer(Address(fromBase58String(aH[1])), aO, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aH[4])), S, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq')] |
---|
304 | | - | else if ((size(aE) == 2)) |
---|
305 | | - | then [StringEntry((((((("first_nft_Info=" + "nftId") + aH[0]) + "seller_address") + aH[1]) + "price") + aH[2]), ("buyer" + toString(aF))), StringEntry((((((("second_nft_Info=" + "nftId") + aI[0]) + "seller_address") + aI[1]) + "price") + aI[2]), ("buyer" + toString(aF))), ScriptTransfer(aF, 1, fromBase58String(aH[0])), ScriptTransfer(aF, 1, fromBase58String(aI[0])), ScriptTransfer(Address(fromBase58String(aH[1])), aO, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aH[4])), S, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aI[1])), aT, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aI[4])), aS, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq')] |
---|
306 | | - | else if ((size(aE) == 3)) |
---|
307 | | - | then [StringEntry((((((("first_nft_Info=" + "nftId") + aH[0]) + "seller_address") + aH[1]) + "price") + aH[2]), ("buyer" + toString(aF))), StringEntry((((((("second_nft_Info=" + "nftId") + aI[0]) + "seller_address") + aI[1]) + "price") + aI[2]), ("buyer" + toString(aF))), StringEntry((((((("third_nft_Info=" + "nftId") + aJ[0]) + "seller_address") + aJ[1]) + "price") + aJ[2]), ("buyer" + toString(aF))), ScriptTransfer(aF, 1, fromBase58String(aH[0])), ScriptTransfer(aF, 1, fromBase58String(aI[0])), ScriptTransfer(aF, 1, fromBase58String(aJ[0])), ScriptTransfer(Address(fromBase58String(aH[1])), aO, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aH[4])), S, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aI[1])), aT, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aI[4])), aS, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aJ[1])), aY, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aJ[4])), aX, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq')] |
---|
308 | | - | else if ((size(aE) == 4)) |
---|
309 | | - | then [StringEntry((((((("first_nft_Info=" + "nftId") + aH[0]) + "seller_address") + aH[1]) + "price") + aH[2]), ("buyer" + toString(aF))), StringEntry((((((("second_nft_Info=" + "nftId") + aI[0]) + "seller_address") + aI[1]) + "price") + aI[2]), ("buyer" + toString(aF))), StringEntry((((((("third_nft_Info=" + "nftId") + aJ[0]) + "seller_address") + aJ[1]) + "price") + aJ[2]), ("buyer" + toString(aF))), StringEntry((((((("fourth_nft_Info=" + "nftId") + aK[0]) + "seller_address") + aK[1]) + "price") + aK[2]), ("buyer" + toString(aF))), ScriptTransfer(aF, 1, fromBase58String(aH[0])), ScriptTransfer(aF, 1, fromBase58String(aI[0])), ScriptTransfer(aF, 1, fromBase58String(aJ[0])), ScriptTransfer(aF, 1, fromBase58String(aK[0])), ScriptTransfer(Address(fromBase58String(aH[1])), aO, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aH[4])), S, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aI[1])), aT, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aI[4])), aS, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aJ[1])), aY, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aJ[4])), aX, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aK[1])), bd, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aK[4])), bc, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq')] |
---|
310 | | - | else if ((size(aE) == 5)) |
---|
311 | | - | then [StringEntry((((((("first_nft_Info=" + "nftId") + aH[0]) + "seller_address") + aH[1]) + "price") + aH[2]), ("buyer" + toString(aF))), StringEntry((((((("second_nft_Info=" + "nftId") + aI[0]) + "seller_address") + aI[1]) + "price") + aI[2]), ("buyer" + toString(aF))), StringEntry((((((("third_nft_Info=" + "nftId") + aJ[0]) + "seller_address") + aJ[1]) + "price") + aJ[2]), ("buyer" + toString(aF))), StringEntry((((((("fourth_nft_Info=" + "nftId") + aK[0]) + "seller_address") + aK[1]) + "price") + aK[2]), ("buyer" + toString(aF))), StringEntry((((((("fifth_nft_Info=" + "nftId") + aL[0]) + "seller_address") + aL[1]) + "price") + aL[2]), ("buyer" + toString(aF))), ScriptTransfer(aF, 1, fromBase58String(aH[0])), ScriptTransfer(aF, 1, fromBase58String(aI[0])), ScriptTransfer(aF, 1, fromBase58String(aJ[0])), ScriptTransfer(aF, 1, fromBase58String(aK[0])), ScriptTransfer(aF, 1, fromBase58String(aL[0])), ScriptTransfer(Address(fromBase58String(aH[1])), aO, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aH[4])), S, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aI[1])), aT, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aI[4])), aS, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aJ[1])), aY, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aJ[4])), aX, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aK[1])), bd, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aK[4])), bc, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aL[1])), bi, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(aL[4])), bh, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq')] |
---|
312 | | - | else if ((size(aE) > 5)) |
---|
313 | | - | then throw("sorry! maximum limit of your cart is 5 items") |
---|
314 | | - | else nil |
---|
315 | | - | } |
---|
316 | | - | |
---|
317 | | - | |
---|
318 | | - | |
---|
319 | | - | @Callable(p) |
---|
320 | | - | func buyAllProducts_waves (aE) = { |
---|
321 | | - | let aF = p.caller |
---|
322 | | - | let aG = assetBalance(aF, g) |
---|
323 | | - | let aH = split(aE[0], "_") |
---|
324 | | - | let aI = split(aE[1], "_") |
---|
325 | | - | let aJ = split(aE[2], "_") |
---|
326 | | - | let aK = split(aE[3], "_") |
---|
327 | | - | let aL = split(aE[4], "_") |
---|
328 | | - | let O = value(p.payments[0].amount) |
---|
329 | | - | let aM = (O - ((O / 1000) * 25)) |
---|
330 | | - | let aN = (O - aM) |
---|
331 | | - | let S = ((O / 100) * parseIntValue(aH[3])) |
---|
332 | | - | let aO = (O - (S + aN)) |
---|
333 | | - | let aP = value(p.payments[1].amount) |
---|
334 | | - | let aQ = (aP - ((aP / 1000) * 25)) |
---|
335 | | - | let aR = (aP - aQ) |
---|
336 | | - | let aS = ((aP / 100) * parseIntValue(aI[3])) |
---|
337 | | - | let aT = (aP - (aS + aR)) |
---|
338 | | - | let aU = value(p.payments[2].amount) |
---|
339 | | - | let aV = (aU - ((aU / 1000) * 25)) |
---|
340 | | - | let aW = (aU - aV) |
---|
341 | | - | let aX = ((aU / 100) * parseIntValue(aJ[3])) |
---|
342 | | - | let aY = (aU - (aX + aW)) |
---|
343 | | - | let aZ = value(p.payments[3].amount) |
---|
344 | | - | let ba = (aZ - ((aZ / 1000) * 25)) |
---|
345 | | - | let bb = (aZ - ba) |
---|
346 | | - | let bc = ((aZ / 100) * parseIntValue(aK[3])) |
---|
347 | | - | let bd = (aZ - (bc + bb)) |
---|
348 | | - | let be = value(p.payments[4].amount) |
---|
349 | | - | let bf = (be - ((be / 1000) * 25)) |
---|
350 | | - | let bg = (be - bf) |
---|
351 | | - | let bh = ((be / 100) * parseIntValue(aL[3])) |
---|
352 | | - | let bi = (be - (bh + bg)) |
---|
353 | | - | if ((O > aG)) |
---|
354 | | - | then throw("Buyer does not have enough funds to complete the purchase.") |
---|
355 | | - | else if ((size(aE) == 1)) |
---|
356 | | - | then [StringEntry((((((("first_nft_Info=" + "nftId") + aH[0]) + "seller_address") + aH[1]) + "price") + aH[2]), ("buyer" + toString(aF))), ScriptTransfer(aF, 1, fromBase58String(aH[0])), ScriptTransfer(Address(fromBase58String(aH[1])), aO, unit), ScriptTransfer(Address(fromBase58String(aH[4])), S, unit)] |
---|
357 | | - | else if ((size(aE) == 2)) |
---|
358 | | - | then [StringEntry((((((("first_nft_Info=" + "nftId") + aH[0]) + "seller_address") + aH[1]) + "price") + aH[2]), ("buyer" + toString(aF))), StringEntry((((((("second_nft_Info=" + "nftId") + aI[0]) + "seller_address") + aI[1]) + "price") + aI[2]), ("buyer" + toString(aF))), ScriptTransfer(aF, 1, fromBase58String(aH[0])), ScriptTransfer(aF, 1, fromBase58String(aI[0])), ScriptTransfer(Address(fromBase58String(aH[1])), aO, unit), ScriptTransfer(Address(fromBase58String(aH[4])), S, unit), ScriptTransfer(Address(fromBase58String(aI[1])), aT, unit), ScriptTransfer(Address(fromBase58String(aI[4])), aS, unit)] |
---|
359 | | - | else if ((size(aE) == 3)) |
---|
360 | | - | then [StringEntry((((((("first_nft_Info=" + "nftId") + aH[0]) + "seller_address") + aH[1]) + "price") + aH[2]), ("buyer" + toString(aF))), StringEntry((((((("second_nft_Info=" + "nftId") + aI[0]) + "seller_address") + aI[1]) + "price") + aI[2]), ("buyer" + toString(aF))), StringEntry((((((("third_nft_Info=" + "nftId") + aJ[0]) + "seller_address") + aJ[1]) + "price") + aJ[2]), ("buyer" + toString(aF))), ScriptTransfer(aF, 1, fromBase58String(aH[0])), ScriptTransfer(aF, 1, fromBase58String(aI[0])), ScriptTransfer(aF, 1, fromBase58String(aJ[0])), ScriptTransfer(Address(fromBase58String(aH[1])), aO, unit), ScriptTransfer(Address(fromBase58String(aH[4])), S, unit), ScriptTransfer(Address(fromBase58String(aI[1])), aT, unit), ScriptTransfer(Address(fromBase58String(aI[4])), aS, unit), ScriptTransfer(Address(fromBase58String(aJ[1])), aY, unit), ScriptTransfer(Address(fromBase58String(aJ[4])), aX, unit)] |
---|
361 | | - | else if ((size(aE) == 4)) |
---|
362 | | - | then [StringEntry((((((("first_nft_Info=" + "nftId") + aH[0]) + "seller_address") + aH[1]) + "price") + aH[2]), ("buyer" + toString(aF))), StringEntry((((((("second_nft_Info=" + "nftId") + aI[0]) + "seller_address") + aI[1]) + "price") + aI[2]), ("buyer" + toString(aF))), StringEntry((((((("third_nft_Info=" + "nftId") + aJ[0]) + "seller_address") + aJ[1]) + "price") + aJ[2]), ("buyer" + toString(aF))), StringEntry((((((("fourth_nft_Info=" + "nftId") + aK[0]) + "seller_address") + aK[1]) + "price") + aK[2]), ("buyer" + toString(aF))), ScriptTransfer(aF, 1, fromBase58String(aH[0])), ScriptTransfer(aF, 1, fromBase58String(aI[0])), ScriptTransfer(aF, 1, fromBase58String(aJ[0])), ScriptTransfer(aF, 1, fromBase58String(aK[0])), ScriptTransfer(Address(fromBase58String(aH[1])), aO, unit), ScriptTransfer(Address(fromBase58String(aH[4])), S, unit), ScriptTransfer(Address(fromBase58String(aI[1])), aT, unit), ScriptTransfer(Address(fromBase58String(aI[4])), aS, unit), ScriptTransfer(Address(fromBase58String(aJ[1])), aY, unit), ScriptTransfer(Address(fromBase58String(aJ[4])), aX, unit), ScriptTransfer(Address(fromBase58String(aK[1])), bd, unit), ScriptTransfer(Address(fromBase58String(aK[4])), bc, unit)] |
---|
363 | | - | else if ((size(aE) == 5)) |
---|
364 | | - | then [StringEntry((((((("first_nft_Info=" + "nftId") + aH[0]) + "seller_address") + aH[1]) + "price") + aH[2]), ("buyer" + toString(aF))), StringEntry((((((("second_nft_Info=" + "nftId") + aI[0]) + "seller_address") + aI[1]) + "price") + aI[2]), ("buyer" + toString(aF))), StringEntry((((((("third_nft_Info=" + "nftId") + aJ[0]) + "seller_address") + aJ[1]) + "price") + aJ[2]), ("buyer" + toString(aF))), StringEntry((((((("fourth_nft_Info=" + "nftId") + aK[0]) + "seller_address") + aK[1]) + "price") + aK[2]), ("buyer" + toString(aF))), StringEntry((((((("fifth_nft_Info=" + "nftId") + aL[0]) + "seller_address") + aL[1]) + "price") + aL[2]), ("buyer" + toString(aF))), ScriptTransfer(aF, 1, fromBase58String(aH[0])), ScriptTransfer(aF, 1, fromBase58String(aI[0])), ScriptTransfer(aF, 1, fromBase58String(aJ[0])), ScriptTransfer(aF, 1, fromBase58String(aK[0])), ScriptTransfer(aF, 1, fromBase58String(aL[0])), ScriptTransfer(Address(fromBase58String(aH[1])), aO, unit), ScriptTransfer(Address(fromBase58String(aH[4])), S, unit), ScriptTransfer(Address(fromBase58String(aI[1])), aT, unit), ScriptTransfer(Address(fromBase58String(aI[4])), aS, unit), ScriptTransfer(Address(fromBase58String(aJ[1])), aY, unit), ScriptTransfer(Address(fromBase58String(aJ[4])), aX, unit), ScriptTransfer(Address(fromBase58String(aK[1])), bd, unit), ScriptTransfer(Address(fromBase58String(aK[4])), bc, unit), ScriptTransfer(Address(fromBase58String(aL[1])), bi, unit), ScriptTransfer(Address(fromBase58String(aL[4])), bh, unit)] |
---|
365 | | - | else if ((size(aE) > 5)) |
---|
366 | | - | then throw("sorry! maximum limit of your cart is 5 items") |
---|
367 | | - | else nil |
---|
| 8 | + | @Callable(c) |
---|
| 9 | + | func asimiTransfer (d) = { |
---|
| 10 | + | let e = c.caller.bytes |
---|
| 11 | + | let f = fromBase58String(d) |
---|
| 12 | + | let g = c.payments[0].amount |
---|
| 13 | + | let h = assetBalance(c.caller, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq') |
---|
| 14 | + | if ((c.payments[0].assetId == a)) |
---|
| 15 | + | then [ScriptTransfer(Address(f), g, a), IntegerEntry((toBase58String(e) + "_transfer"), g), StringEntry((toBase58String(e) + "_transfer_to"), d)] |
---|
| 16 | + | else nil |
---|