41 | | - | @Callable(p) |
---|
42 | | - | func setPaused (q) = { |
---|
43 | | - | let r = p.caller.bytes |
---|
44 | | - | if ((q == "true")) |
---|
45 | | - | then [StringEntry(q, ("true" + q))] |
---|
46 | | - | else if ((i == false)) |
---|
47 | | - | then [StringEntry(q, ("false" + q))] |
---|
48 | | - | else nil |
---|
49 | | - | } |
---|
50 | | - | |
---|
51 | | - | |
---|
52 | | - | |
---|
53 | | - | @Callable(p) |
---|
54 | | - | func createNft (q,s,t,u,v,w,x,y,z,A) = { |
---|
55 | | - | let B = Issue(s, y, 1, 0, false) |
---|
56 | | - | let C = calculateAssetId(B) |
---|
57 | | - | let D = p.transactionId |
---|
58 | | - | if ((q == "true")) |
---|
59 | | - | then throw("function is paused for sometimes") |
---|
60 | | - | else [B, ScriptTransfer(p.caller, 1, C), StringEntry(((toBase58String(C) + a) + "Owner"), toString(p.caller)), StringEntry(((toBase58String(C) + a) + "nft_type"), v), StringEntry(((toBase58String(C) + a) + "nft_tags"), w), StringEntry(((toBase58String(C) + a) + "nft_dAppAddress"), u), IntegerEntry(((toBase58String(C) + a) + "nft_selling_price"), x), StringEntry(((toBase58String(C) + a) + "nft_onSell"), z), StringEntry(((toBase58String(C) + a) + "nft_data"), A), StringEntry(((toBase58String(D) + a) + "issue_nft"), toBase58String(C))] |
---|
61 | | - | } |
---|
62 | | - | |
---|
63 | | - | |
---|
64 | | - | |
---|
65 | | - | @Callable(p) |
---|
66 | | - | func sellNFT (E,F) = { |
---|
67 | | - | let D = p.transactionId |
---|
68 | | - | let G = p.caller.bytes |
---|
69 | | - | let H = $Tuple2(value(p.payments[0].assetId), value(p.payments[0].amount)) |
---|
70 | | - | let I = H._1 |
---|
71 | | - | let J = H._2 |
---|
72 | | - | if (!(l(I))) |
---|
73 | | - | then throw("Token is not NFT") |
---|
74 | | - | else [StringEntry(((c + a) + toBase58String(value(p.payments[0].assetId))), E), StringEntry(((toString(p.caller) + a) + d), (((toBase58String(I) + a) + toString(J)) + F))] |
---|
75 | | - | } |
---|
76 | | - | |
---|
77 | | - | |
---|
78 | | - | |
---|
79 | | - | @Callable(p) |
---|
80 | | - | func buyNFT (K,L) = { |
---|
81 | | - | let m = fromBase58String(K) |
---|
82 | | - | let M = value(p.payments[0].amount) |
---|
83 | | - | let N = { |
---|
84 | | - | let n = getString(this, (("nft_" + L) + "_owner")) |
---|
85 | | - | if ($isInstanceOf(n, "String")) |
---|
86 | | - | then { |
---|
87 | | - | let O = n |
---|
88 | | - | O |
---|
89 | | - | } |
---|
90 | | - | else false |
---|
91 | | - | } |
---|
92 | | - | let E = getStringValue(((((c + a) + K) + "_") + L)) |
---|
93 | | - | let P = ((M / 1000) * 975) |
---|
94 | | - | let Q = ((M / 1000) * 25) |
---|
95 | | - | if ((L == toString(p.caller))) |
---|
96 | | - | then throw("current Owner of NFT not able to purchase") |
---|
97 | | - | else if ((p.payments[0].assetId == f)) |
---|
98 | | - | then [ScriptTransfer(p.caller, 1, m), ScriptTransfer(Address(fromBase58String(L)), P, f), StringEntry((("nft_" + K) + "platform_fee"), toString(Q)), StringEntry(((toString(p.caller) + a) + b), ((K + a) + toString(M))), DeleteEntry((("nft_" + L) + "_owner")), StringEntry((("nft_" + L) + "_owner"), toString(p.caller)), StringEntry(((K + a) + "_owner"), toString(p.caller))] |
---|
99 | | - | else if ((p.payments[0].assetId == unit)) |
---|
100 | | - | then [ScriptTransfer(p.caller, 1, m), ScriptTransfer(Address(fromBase58String(L)), P, unit), StringEntry((("nft_" + K) + "platform_fee"), toString(Q)), StringEntry(((toString(p.caller) + a) + b), ((K + a) + toString(M))), DeleteEntry((("nft_" + L) + "_owner")), StringEntry((("nft_" + L) + "_owner"), toString(p.caller)), StringEntry(((K + a) + "_owner"), toString(p.caller))] |
---|
101 | | - | else nil |
---|
102 | | - | } |
---|
103 | | - | |
---|
104 | | - | |
---|
105 | | - | |
---|
106 | | - | @Callable(p) |
---|
107 | | - | func cancelSell (R) = { |
---|
108 | | - | let D = toBase58String(p.transactionId) |
---|
109 | | - | let G = p.caller.bytes |
---|
110 | | - | [StringEntry(((D + R) + "_nft_status"), "CANCELED"), ScriptTransfer(Address(G), 1, fromBase58String(R))] |
---|
111 | | - | } |
---|
112 | | - | |
---|
113 | | - | |
---|
114 | | - | |
---|
115 | | - | @Callable(p) |
---|
116 | | - | func addAuction (S,T,U,V,F) = { |
---|
117 | | - | let D = toBase58String(p.transactionId) |
---|
118 | | - | let R = value(p.payments[0].assetId) |
---|
119 | | - | let E = value(U) |
---|
120 | | - | let W = (lastBlock.height + V) |
---|
121 | | - | let r = p.caller.bytes |
---|
122 | | - | let X = { |
---|
123 | | - | let n = getString(this, (((toBase58String(R) + a) + "nft_status_") + toBase58String(r))) |
---|
124 | | - | if ($isInstanceOf(n, "String")) |
---|
125 | | - | then { |
---|
126 | | - | let O = n |
---|
127 | | - | true |
---|
128 | | - | } |
---|
129 | | - | else false |
---|
130 | | - | } |
---|
131 | | - | if ((X == true)) |
---|
132 | | - | then throw("Already in auction list") |
---|
133 | | - | else if ((V > e)) |
---|
134 | | - | then throw(("Duration is too long. Must be less than or equal to 30 " + toString(e))) |
---|
135 | | - | else if ((p.payments[0].assetId == unit)) |
---|
136 | | - | then throw("NFT not attached") |
---|
137 | | - | else if ((p.payments[0].assetId == f)) |
---|
138 | | - | then throw("NFT not attached") |
---|
139 | | - | else [StringEntry(((D + "nft_start_auction_date") + toBase58String(r)), S), StringEntry(((D + "nft_end_auction_date") + toBase58String(r)), T), StringEntry((D + "_nft_start_price"), U), StringEntry((D + "_nft_owner"), toString(p.caller)), StringEntry((D + "_nft_on_auction"), toBase58String(R)), 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")] |
---|
140 | | - | } |
---|
141 | | - | |
---|
142 | | - | |
---|
143 | | - | |
---|
144 | | - | @Callable(p) |
---|
145 | | - | func placeBid (Y,R,t,Z,aa) = { |
---|
146 | | - | let D = toBase58String(p.transactionId) |
---|
147 | | - | let r = p.caller.bytes |
---|
148 | | - | let m = fromBase58String(R) |
---|
149 | | - | let ab = p.payments[0].assetId |
---|
150 | | - | let ac = p.payments[0].amount |
---|
151 | | - | let ad = getStringValue(this, (Y + "_highest_bid")) |
---|
152 | | - | let ae = getString(this, (Y + "_previous_bidder")) |
---|
153 | | - | let af = getStringValue(this, (Y + "_bidder_count")) |
---|
154 | | - | let ag = getStringValue(this, (Y + "_winner_of_nft")) |
---|
155 | | - | let X = getStringValue(this, (Y + "_nft_status")) |
---|
156 | | - | if ((X != "OPEN")) |
---|
157 | | - | then throw("Not open for auction") |
---|
158 | | - | else if ((parseIntValue(ad) >= ac)) |
---|
159 | | - | then throw("Bid is less then starting/highest Bid") |
---|
160 | | - | else if ((ad == "0")) |
---|
161 | | - | then [StringEntry((Y + "_highest_bid"), toString(ac)), StringEntry((Y + "_winner_of_nft"), toBase58String(p.caller.bytes)), StringEntry((Y + "_bidder_count"), toString((parseIntValue(af) + 1))), StringEntry((Y + "_nft_id"), toBase58String(m)), StringEntry((Y + "_nft_owner"), t), StringEntry((((D + "_") + Y) + "_highest_bid"), toString(ac)), StringEntry((((D + "_") + Y) + "_winner"), toBase58String(p.caller.bytes)), StringEntry((((D + "_") + Y) + "_bidder_count"), toString((parseIntValue(af) + 1))), StringEntry((((D + "_") + Y) + "_nft_id"), toBase58String(m)), StringEntry((((D + "_") + Y) + "_nft_owner"), t), StringEntry((D + "_bid_for_nft_by"), toBase58String(r)), StringEntry((D + "_bid_price_place"), Z), StringEntry((D + "_previous_bid_amount_refund_to_address"), ag), StringEntry((D + "_prevoius_bid_amount_refund"), ad)] |
---|
162 | | - | else if ((ad != "0")) |
---|
163 | | - | then [ScriptTransfer(Address(fromBase58String(ag)), parseIntValue(ad), ab), StringEntry((D + "_previous_bid_amount_refund_to_address"), ag), StringEntry((D + "_prevoius_bid_amount_refund"), ad), StringEntry((Y + "_bidder_count"), toString((parseIntValue(af) + 1))), StringEntry((Y + "_highest_bid"), toString(ac)), StringEntry((Y + "_winner_of_nft"), toBase58String(p.caller.bytes)), StringEntry((Y + "_nft_id"), toBase58String(m)), StringEntry((Y + "_nft_owner"), t), StringEntry((((D + "_") + Y) + "_highest_bid"), toString(ac)), StringEntry((((D + "_") + Y) + "_winner"), toBase58String(p.caller.bytes)), StringEntry((((D + "_") + Y) + "_bidder_count"), toString((parseIntValue(af) + 1))), StringEntry((((D + "_") + Y) + "_nft_id"), toBase58String(m)), StringEntry((((D + "_") + Y) + "_nft_owner"), t), StringEntry((D + "_bid_for_nft_by"), toBase58String(r)), StringEntry((D + "_bid_price_place"), Z)] |
---|
164 | | - | else nil |
---|
165 | | - | } |
---|
166 | | - | |
---|
167 | | - | |
---|
168 | | - | |
---|
169 | | - | @Callable(p) |
---|
170 | | - | func acceptBidOffer (Y,R,ah,aa) = { |
---|
171 | | - | let ai = "9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq" |
---|
172 | | - | let D = toBase58String(p.transactionId) |
---|
173 | | - | let aj = fromBase58String(aa) |
---|
174 | | - | let r = p.caller.bytes |
---|
175 | | - | let m = fromBase58String(R) |
---|
176 | | - | let ak = getStringValue(this, (Y + "_highest_bid")) |
---|
177 | | - | let al = ((parseIntValue(ak) / 1000) * 975) |
---|
178 | | - | let Q = ((parseIntValue(ak) / 1000) * 25) |
---|
179 | | - | let am = getStringValue(this, (Y + "_winner_of_nft")) |
---|
180 | | - | if ((aa == ai)) |
---|
181 | | - | then [ScriptTransfer(Address(r), al, aj), ScriptTransfer(Address(fromBase58String(am)), 1, m), StringEntry("platform_fee", toString(Q)), StringEntry((D + "_amount_paid_to_owner"), ak), StringEntry((D + "_nft_transfer_to"), am), StringEntry((D + "_nft_status"), "REWARDED"), StringEntry((Y + "_amount_paid_to_owner"), ak), StringEntry((Y + "_nft_transfer_to"), am), StringEntry((Y + "_nft_status"), "REWARDED")] |
---|
182 | | - | else if ((aa == "WAVES")) |
---|
183 | | - | then [ScriptTransfer(Address(r), al, unit), ScriptTransfer(Address(fromBase58String(am)), 1, m), StringEntry("platform_fee", toString(Q)), StringEntry((D + "_amount_paid_to_owner"), ak), StringEntry((D + "_nft_transfer_to"), am), StringEntry((D + "_nft_status"), "REWARDED"), StringEntry((Y + "_amount_paid_to_owner"), ak), StringEntry((Y + "_nft_transfer_to"), am), StringEntry((Y + "_nft_status"), "REWARDED")] |
---|
184 | | - | else nil |
---|
185 | | - | } |
---|
186 | | - | |
---|
187 | | - | |
---|
188 | | - | |
---|
189 | | - | @Callable(p) |
---|
190 | | - | func cancelAuction (Y,aa) = { |
---|
191 | | - | let D = toBase58String(p.transactionId) |
---|
192 | | - | let r = p.caller.bytes |
---|
193 | | - | let an = getStringValue(this, (Y + "_nft_status")) |
---|
194 | | - | let ao = getStringValue(this, (Y + "_winner_of_nft")) |
---|
195 | | - | let ap = getStringValue(this, (Y + "_nft_owner")) |
---|
196 | | - | let R = getStringValue(this, (Y + "_nft_on_auction")) |
---|
197 | | - | let aq = getStringValue(this, (Y + "_highest_bid")) |
---|
198 | | - | if ((ao == "0")) |
---|
199 | | - | then [StringEntry(((D + Y) + "_nft_status"), "CANCELED"), ScriptTransfer(Address(fromBase58String(ap)), 1, fromBase58String(R))] |
---|
200 | | - | else if ((ao != "0")) |
---|
201 | | - | then throw("soory you can't cancel it because already auction placed by someone") |
---|
202 | | - | else nil |
---|
203 | | - | } |
---|
204 | | - | |
---|
205 | | - | |
---|
206 | | - | |
---|
207 | | - | @Callable(p) |
---|
208 | | - | func manualFundTransfer (ar,as) = { |
---|
209 | | - | let r = p.caller.bytes |
---|
210 | | - | let at = fromBase58String(ar) |
---|
211 | | - | let M = p.payments[0].amount |
---|
212 | | - | let au = ((M / 1000) * 975) |
---|
213 | | - | let Q = ((M / 1000) * 25) |
---|
214 | | - | if ((p.payments[0].assetId == unit)) |
---|
215 | | - | then [IntegerEntry((toBase58String(r) + "_transfer"), M), StringEntry("platform_fee", toString(Q)), StringEntry((toBase58String(r) + "_transfer_to"), ar), ScriptTransfer(Address(at), au, unit)] |
---|
216 | | - | else if ((p.payments[0].assetId == f)) |
---|
217 | | - | then [IntegerEntry((toBase58String(r) + "_transfer"), M), StringEntry("platform_fee", toString(Q)), StringEntry((toBase58String(r) + "_transfer_to"), ar), ScriptTransfer(Address(at), au, f)] |
---|
218 | | - | else nil |
---|
219 | | - | } |
---|
220 | | - | |
---|
221 | | - | |
---|
222 | | - | |
---|
223 | | - | @Callable(p) |
---|
224 | | - | func backValue (Y) = { |
---|
225 | | - | let r = p.caller.bytes |
---|
226 | | - | let R = getStringValue(this, (Y + "_nft_on_auction")) |
---|
227 | | - | let ap = getStringValue(this, (Y + "_nft_owner")) |
---|
228 | | - | [StringEntry((Y + "_nft_status"), "Auction_time over"), ScriptTransfer(Address(fromBase58String(ap)), 1, fromBase58String(R))] |
---|
229 | | - | } |
---|
230 | | - | |
---|
231 | | - | |
---|
232 | | - | |
---|
233 | | - | @Callable(p) |
---|
234 | | - | func withdrawBid (av,aa) = { |
---|
235 | | - | let r = p.caller.bytes |
---|
236 | | - | let ai = "9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq" |
---|
237 | | - | let D = toBase58String(p.transactionId) |
---|
238 | | - | let aj = fromBase58String(aa) |
---|
239 | | - | let aw = getStringValue(this, (av + "_highest_bid")) |
---|
240 | | - | let ax = getStringValue(this, (av + "_winner")) |
---|
241 | | - | let ay = getStringValue(this, (av + "_nft_id")) |
---|
242 | | - | if ((aa == ai)) |
---|
243 | | - | then [StringEntry((av + "_nft_bid"), "WITHDRAW"), StringEntry((av + "_nft_id"), ay), StringEntry((av + "_bidding_price_refund_amount"), aw), ScriptTransfer(p.caller, parseIntValue(aw), aj)] |
---|
244 | | - | else if ((aa == "WAVES")) |
---|
245 | | - | then [StringEntry((av + "_nft_bid"), "WITHDRAW"), StringEntry((av + "_nft_id"), ay), StringEntry((av + "_bidding_price_refund_amount"), aw), ScriptTransfer(p.caller, parseIntValue(aw), unit)] |
---|
246 | | - | else nil |
---|
247 | | - | } |
---|
248 | | - | |
---|
249 | | - | |
---|
250 | | - | |
---|
251 | | - | @Callable(p) |
---|
252 | | - | func automateFunction (Y,aa) = { |
---|
253 | | - | let r = p.caller.bytes |
---|
254 | | - | let R = getStringValue(this, (Y + "_nft_on_auction")) |
---|
255 | | - | let ap = getStringValue(this, (Y + "_nft_owner")) |
---|
256 | | - | let ai = "9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq" |
---|
257 | | - | let aj = fromBase58String(aa) |
---|
258 | | - | let ad = getStringValue(this, (Y + "_highest_bid")) |
---|
259 | | - | let ag = getStringValue(this, (Y + "_winner_of_nft")) |
---|
260 | | - | let ao = getStringValue(this, (Y + "_winner_of_nft")) |
---|
261 | | - | if ((ao == "0")) |
---|
262 | | - | then [ScriptTransfer(Address(fromBase58String(ap)), 1, fromBase58String(R))] |
---|
263 | | - | else if (if ((ao != "0")) |
---|
264 | | - | then (aa == ai) |
---|
265 | | - | else false) |
---|
266 | | - | then [ScriptTransfer(Address(fromBase58String(ap)), 1, fromBase58String(R)), ScriptTransfer(Address(fromBase58String(ag)), parseIntValue(ad), aj)] |
---|
267 | | - | else if (if ((ao != "0")) |
---|
268 | | - | then (aa == "WAVES") |
---|
269 | | - | else false) |
---|
270 | | - | then [ScriptTransfer(Address(fromBase58String(ap)), 1, fromBase58String(R)), ScriptTransfer(Address(fromBase58String(ag)), parseIntValue(ad), unit)] |
---|
271 | | - | else nil |
---|
| 6 | + | @Callable(a) |
---|
| 7 | + | func mintNft (b,c,d) = { |
---|
| 8 | + | let e = a.caller |
---|
| 9 | + | let f = Issue(c, d, 1, 0, false) |
---|
| 10 | + | let g = calculateAssetId(f) |
---|
| 11 | + | let h = Issue(c, d, 1, 0, false) |
---|
| 12 | + | let i = calculateAssetId(h) |
---|
| 13 | + | [f, h, ScriptTransfer(e, 1, g), ScriptTransfer(e, 1, i)] |
---|