39 | | - | @Callable(o) |
---|
40 | | - | func createNft (p,q,r,s,t,u,v,w,x) = { |
---|
41 | | - | let y = Issue(p, v, 1, 0, false) |
---|
42 | | - | let z = calculateAssetId(y) |
---|
43 | | - | let A = o.transactionId |
---|
44 | | - | [y, ScriptTransfer(o.caller, 1, z), StringEntry(((toBase58String(z) + a) + "Owner"), toString(o.caller)), StringEntry(((toBase58String(z) + a) + "nft_type"), s), StringEntry(((toBase58String(z) + a) + "nft_tags"), t), StringEntry(((toBase58String(z) + a) + "nft_dAppAddress"), r), IntegerEntry(((toBase58String(z) + a) + "nft_selling_price"), u), StringEntry(((toBase58String(z) + a) + "nft_onSell"), w), StringEntry(((toBase58String(z) + a) + "nft_data"), x), StringEntry(((toBase58String(A) + a) + "issue_nft"), toBase58String(z))] |
---|
| 6 | + | @Callable(a) |
---|
| 7 | + | func mintNft (b) = { |
---|
| 8 | + | let c = a.caller |
---|
| 9 | + | let d = Issue("aaaaa", "swsdsds", 1, 0, false) |
---|
| 10 | + | let e = calculateAssetId(d) |
---|
| 11 | + | let f = Issue("bbbbb", "sdfdsfdsfdsfd", 1, 0, false) |
---|
| 12 | + | let g = calculateAssetId(f) |
---|
| 13 | + | let h = Issue("cccc", "sdfdsfdsfdsfd", 1, 0, false) |
---|
| 14 | + | let i = calculateAssetId(f) |
---|
| 15 | + | let j = Issue("ddddd", "sdfdsfdsfdsfd", 1, 0, false) |
---|
| 16 | + | let k = calculateAssetId(f) |
---|
| 17 | + | let l = Issue("eeeee", "sdfdsfdsfdsfd", 1, 0, false) |
---|
| 18 | + | let m = calculateAssetId(f) |
---|
| 19 | + | let n = Issue("ffff", "sdfdsfdsfdsfd", 1, 0, false) |
---|
| 20 | + | let o = calculateAssetId(f) |
---|
| 21 | + | [d, f, h, j, l, n, StringEntry((toBase58String(e) + "_ipfs"), b), StringEntry((toBase58String(g) + "_ipfs"), b), ScriptTransfer(c, 1, e), ScriptTransfer(c, 1, g), StringEntry((toBase58String(i) + "_ipfs"), b), StringEntry((toBase58String(k) + "_ipfs"), b), ScriptTransfer(c, 1, i), ScriptTransfer(c, 1, k), StringEntry((toBase58String(m) + "_ipfs"), b), StringEntry((toBase58String(o) + "_ipfs"), b), ScriptTransfer(c, 1, m), ScriptTransfer(c, 1, o)] |
---|
46 | | - | |
---|
47 | | - | |
---|
48 | | - | |
---|
49 | | - | @Callable(o) |
---|
50 | | - | func sellNFT (B) = { |
---|
51 | | - | let A = o.transactionId |
---|
52 | | - | let C = o.caller.bytes |
---|
53 | | - | let D = $Tuple2(value(o.payments[0].assetId), value(o.payments[0].amount)) |
---|
54 | | - | let E = D._1 |
---|
55 | | - | let F = D._2 |
---|
56 | | - | if (!(k(E))) |
---|
57 | | - | then throw("Token is not NFT") |
---|
58 | | - | else [StringEntry(((c + a) + toBase58String(value(o.payments[0].assetId))), B), StringEntry(((toString(o.caller) + a) + d), ((toBase58String(E) + a) + toString(F)))] |
---|
59 | | - | } |
---|
60 | | - | |
---|
61 | | - | |
---|
62 | | - | |
---|
63 | | - | @Callable(o) |
---|
64 | | - | func buyNFT (G,H) = { |
---|
65 | | - | let l = fromBase58String(G) |
---|
66 | | - | let I = value(o.payments[0].amount) |
---|
67 | | - | let J = { |
---|
68 | | - | let m = getString(this, (("nft_" + H) + "_owner")) |
---|
69 | | - | if ($isInstanceOf(m, "String")) |
---|
70 | | - | then { |
---|
71 | | - | let K = m |
---|
72 | | - | K |
---|
73 | | - | } |
---|
74 | | - | else false |
---|
75 | | - | } |
---|
76 | | - | let B = getStringValue(((((c + a) + G) + "_") + H)) |
---|
77 | | - | if ((H == toString(o.caller))) |
---|
78 | | - | then throw("current Owner of NFT not able to purchase") |
---|
79 | | - | else if ((o.payments[0].assetId == f)) |
---|
80 | | - | then [ScriptTransfer(o.caller, 1, l), ScriptTransfer(Address(fromBase58String(H)), I, f), StringEntry(((toString(o.caller) + a) + b), ((G + a) + toString(I))), DeleteEntry((("nft_" + H) + "_owner")), StringEntry((("nft_" + H) + "_owner"), toString(o.caller)), StringEntry(((G + a) + "_owner"), toString(o.caller))] |
---|
81 | | - | else if ((o.payments[0].assetId == unit)) |
---|
82 | | - | then [ScriptTransfer(o.caller, 1, l), ScriptTransfer(Address(fromBase58String(H)), I, unit), StringEntry(((toString(o.caller) + a) + b), ((G + a) + toString(I))), DeleteEntry((("nft_" + H) + "_owner")), StringEntry((("nft_" + H) + "_owner"), toString(o.caller)), StringEntry(((G + a) + "_owner"), toString(o.caller))] |
---|
83 | | - | else nil |
---|
84 | | - | } |
---|
85 | | - | |
---|
86 | | - | |
---|
87 | | - | |
---|
88 | | - | @Callable(o) |
---|
89 | | - | func cancelSell (L) = { |
---|
90 | | - | let A = toBase58String(o.transactionId) |
---|
91 | | - | let C = o.caller.bytes |
---|
92 | | - | [StringEntry(((A + L) + "_nft_status"), "CANCELED"), ScriptTransfer(Address(C), 1, fromBase58String(L))] |
---|
93 | | - | } |
---|
94 | | - | |
---|
95 | | - | |
---|
96 | | - | |
---|
97 | | - | @Callable(o) |
---|
98 | | - | func addAuction (M,N,O,P) = { |
---|
99 | | - | let A = toBase58String(o.transactionId) |
---|
100 | | - | let L = value(o.payments[0].assetId) |
---|
101 | | - | let B = value(O) |
---|
102 | | - | let Q = (lastBlock.height + P) |
---|
103 | | - | let R = o.caller.bytes |
---|
104 | | - | let S = { |
---|
105 | | - | let m = getString(this, (((toBase58String(L) + a) + "nft_status_") + toBase58String(R))) |
---|
106 | | - | if ($isInstanceOf(m, "String")) |
---|
107 | | - | then { |
---|
108 | | - | let K = m |
---|
109 | | - | true |
---|
110 | | - | } |
---|
111 | | - | else false |
---|
112 | | - | } |
---|
113 | | - | if ((S == true)) |
---|
114 | | - | then throw("Already in auction list") |
---|
115 | | - | else if ((P > e)) |
---|
116 | | - | then throw(("Duration is too long. Must be less than or equal to 7 " + toString(e))) |
---|
117 | | - | else if ((o.payments[0].assetId == unit)) |
---|
118 | | - | then throw("NFT not attached") |
---|
119 | | - | else if ((o.payments[0].assetId == f)) |
---|
120 | | - | then throw("NFT not attached") |
---|
121 | | - | else [StringEntry(((A + "nft_start_auction_date") + toBase58String(R)), M), StringEntry(((A + "nft_end_auction_date") + toBase58String(R)), N), StringEntry((A + "_nft_start_price"), O), StringEntry((A + "_nft_owner"), toString(o.caller)), StringEntry((A + "_nft_on_auction"), toBase58String(L)), StringEntry((A + "_previous_bidder"), "none"), StringEntry((A + "_highest_bid"), "0"), StringEntry((A + "_winner_of_nft"), "0"), StringEntry((A + "_bidder_count"), "0"), StringEntry((A + "_nft_status"), "OPEN")] |
---|
122 | | - | } |
---|
123 | | - | |
---|
124 | | - | |
---|
125 | | - | |
---|
126 | | - | @Callable(o) |
---|
127 | | - | func placeBid (T,L,q,U) = { |
---|
128 | | - | let A = toBase58String(o.transactionId) |
---|
129 | | - | let R = o.caller.bytes |
---|
130 | | - | let l = fromBase58String(L) |
---|
131 | | - | let V = o.payments[0].amount |
---|
132 | | - | let W = getStringValue(this, (T + "_highest_bid")) |
---|
133 | | - | let X = getString(this, (T + "_previous_bidder")) |
---|
134 | | - | let Y = getStringValue(this, (T + "_bidder_count")) |
---|
135 | | - | let Z = getStringValue(this, (T + "_winner_of_nft")) |
---|
136 | | - | let S = getStringValue(this, (T + "_nft_status")) |
---|
137 | | - | if ((S != "OPEN")) |
---|
138 | | - | then throw("Not open for auction") |
---|
139 | | - | else if ((parseIntValue(W) >= V)) |
---|
140 | | - | then throw("Bid is less then starting/highest Bid") |
---|
141 | | - | else if ((W == "0")) |
---|
142 | | - | then [StringEntry((T + "_highest_bid"), toString(V)), StringEntry((T + "_winner_of_nft"), toBase58String(o.caller.bytes)), StringEntry((T + "_bidder_count"), toString((parseIntValue(Y) + 1))), StringEntry((T + "_nft_id"), toBase58String(l)), StringEntry((T + "_nft_owner"), q), StringEntry((((A + "_") + T) + "_highest_bid"), toString(V)), StringEntry((((A + "_") + T) + "_winner"), toBase58String(o.caller.bytes)), StringEntry((((A + "_") + T) + "_bidder_count"), toString((parseIntValue(Y) + 1))), StringEntry((((A + "_") + T) + "_nft_id"), toBase58String(l)), StringEntry((((A + "_") + T) + "_nft_owner"), q), StringEntry((A + "_bid_for_nft_by"), toBase58String(R)), StringEntry((A + "_bid_price_place"), U), StringEntry((A + "_previous_bid_amount_refund_to_address"), Z), StringEntry((A + "_prevoius_bid_amount_refund"), W)] |
---|
143 | | - | else if ((o.payments[0].assetId == unit)) |
---|
144 | | - | then [StringEntry((T + "_highest_bid"), toString(V)), StringEntry((T + "_winner_of_nft"), toBase58String(o.caller.bytes)), StringEntry((T + "_bidder_count"), toString((parseIntValue(Y) + 1))), StringEntry((T + "_nft_id"), toBase58String(l)), StringEntry((T + "_nft_owner"), q), StringEntry((((A + "_") + T) + "_highest_bid"), toString(V)), StringEntry((((A + "_") + T) + "_winner"), toBase58String(o.caller.bytes)), StringEntry((((A + "_") + T) + "_bidder_count"), toString((parseIntValue(Y) + 1))), StringEntry((((A + "_") + T) + "_nft_id"), toBase58String(l)), StringEntry((((A + "_") + T) + "_nft_owner"), q), StringEntry((A + "_bid_for_nft_by"), toBase58String(R)), StringEntry((A + "_bid_price_place"), U), StringEntry((A + "_previous_bid_amount_refund_to_address"), Z), StringEntry((A + "_prevoius_bid_amount_refund"), W), ScriptTransfer(Address(fromBase58String(Z)), parseIntValue(W), unit)] |
---|
145 | | - | else if ((o.payments[0].assetId == f)) |
---|
146 | | - | then [StringEntry((T + "_highest_bid"), toString(V)), StringEntry((T + "_winner_of_nft"), toBase58String(o.caller.bytes)), StringEntry((T + "_bidder_count"), toString((parseIntValue(Y) + 1))), StringEntry((T + "_nft_id"), toBase58String(l)), StringEntry((T + "_nft_owner"), q), StringEntry((((A + "_") + T) + "_highest_bid"), toString(V)), StringEntry((((A + "_") + T) + "_winner"), toBase58String(o.caller.bytes)), StringEntry((((A + "_") + T) + "_bidder_count"), toString((parseIntValue(Y) + 1))), StringEntry((((A + "_") + T) + "_nft_id"), toBase58String(l)), StringEntry((((A + "_") + T) + "_nft_owner"), q), StringEntry((A + "_bid_for_nft_by"), toBase58String(R)), StringEntry((A + "_bid_price_place"), U), StringEntry((A + "_previous_bid_amount_refund_to_address"), Z), StringEntry((A + "_prevoius_bid_amount_refund"), W), ScriptTransfer(Address(fromBase58String(Z)), parseIntValue(W), f)] |
---|
147 | | - | else nil |
---|
148 | | - | } |
---|
149 | | - | |
---|
150 | | - | |
---|
151 | | - | |
---|
152 | | - | @Callable(o) |
---|
153 | | - | func acceptBidOffer (T,L,aa) = { |
---|
154 | | - | let A = toBase58String(o.transactionId) |
---|
155 | | - | let R = o.caller.bytes |
---|
156 | | - | let l = fromBase58String(L) |
---|
157 | | - | let ab = getStringValue(this, (T + "_highest_bid")) |
---|
158 | | - | let ac = getStringValue(this, (T + "_winner_of_nft")) |
---|
159 | | - | if ((o.payments[0].assetId == f)) |
---|
160 | | - | then [ScriptTransfer(Address(R), parseIntValue(ab), f), ScriptTransfer(Address(fromBase58String(ac)), 1, l), StringEntry((A + "_amount_paid_to_owner"), ab), StringEntry((A + "_nft_transfer_to"), ac), StringEntry((A + "_nft_status"), "REWARDED"), StringEntry((T + "_amount_paid_to_owner"), ab), StringEntry((T + "_nft_transfer_to"), ac), StringEntry((T + "_nft_status"), "REWARDED")] |
---|
161 | | - | else if ((o.payments[0].assetId == unit)) |
---|
162 | | - | then [ScriptTransfer(Address(R), parseIntValue(ab), unit), ScriptTransfer(Address(fromBase58String(ac)), 1, l), StringEntry((A + "_amount_paid_to_owner"), ab), StringEntry((A + "_nft_transfer_to"), ac), StringEntry((A + "_nft_status"), "REWARDED"), StringEntry((T + "_amount_paid_to_owner"), ab), StringEntry((T + "_nft_transfer_to"), ac), StringEntry((T + "_nft_status"), "REWARDED")] |
---|
163 | | - | else nil |
---|
164 | | - | } |
---|
165 | | - | |
---|
166 | | - | |
---|
167 | | - | |
---|
168 | | - | @Callable(o) |
---|
169 | | - | func cancelAuction (T) = { |
---|
170 | | - | let A = toBase58String(o.transactionId) |
---|
171 | | - | let R = o.caller.bytes |
---|
172 | | - | let ad = getStringValue(this, (T + "_nft_status")) |
---|
173 | | - | let ae = getStringValue(this, (T + "_winner_of_nft")) |
---|
174 | | - | let af = getStringValue(this, (T + "_nft_owner")) |
---|
175 | | - | let L = getStringValue(this, (T + "_nft_on_auction")) |
---|
176 | | - | let ag = getStringValue(this, (T + "_highest_bid")) |
---|
177 | | - | if ((ae == "0")) |
---|
178 | | - | then [StringEntry(((A + T) + "_nft_status"), "CANCELED"), ScriptTransfer(Address(fromBase58String(af)), 1, fromBase58String(L))] |
---|
179 | | - | else if ((o.payments[0].assetId == unit)) |
---|
180 | | - | then [StringEntry((T + "_nft_status"), "CANCELED"), StringEntry((T + "_previous_bid_amount_refund_to_address"), ae), StringEntry((T + "_prevoius_bid_amount_refund"), ag), StringEntry((A + "_nft_status"), "CANCELED"), StringEntry((A + "_previous_bid_amount_refund_to_address"), ae), StringEntry((A + "_prevoius_bid_amount_refund"), ag), ScriptTransfer(Address(fromBase58String(af)), 1, fromBase58String(L)), ScriptTransfer(Address(fromBase58String(ae)), parseIntValue(ag), unit)] |
---|
181 | | - | else if ((o.payments[0].assetId == f)) |
---|
182 | | - | then [StringEntry((T + "_nft_status"), "CANCELED"), StringEntry((T + "_previous_bid_amount_refund_to_address"), ae), StringEntry((T + "_prevoius_bid_amount_refund"), ag), StringEntry((A + "_nft_status"), "CANCELED"), StringEntry((A + "_previous_bid_amount_refund_to_address"), ae), StringEntry((A + "_prevoius_bid_amount_refund"), ag), ScriptTransfer(Address(fromBase58String(af)), 1, fromBase58String(L)), ScriptTransfer(Address(fromBase58String(ae)), parseIntValue(ag), f)] |
---|
183 | | - | else nil |
---|
184 | | - | } |
---|
185 | | - | |
---|
186 | | - | |
---|
187 | | - | |
---|
188 | | - | @Callable(o) |
---|
189 | | - | func withdrawBid (ah) = { |
---|
190 | | - | let R = o.caller.bytes |
---|
191 | | - | let ai = getStringValue(this, (ah + "_highest_bid")) |
---|
192 | | - | let aj = getStringValue(this, (ah + "_winner")) |
---|
193 | | - | let ak = getStringValue(this, (ah + "_nft_id")) |
---|
194 | | - | if ((toBase58String(R) != aj)) |
---|
195 | | - | then throw("No bid") |
---|
196 | | - | else [StringEntry((ah + "_nft_bid"), "WITHDRAW"), StringEntry((ah + "_nft_id"), ak), StringEntry((ah + "_bidding_price_refund_amount"), ai), ScriptTransfer(o.caller, parseIntValue(ai), unit)] |
---|
197 | | - | } |
---|
198 | | - | |
---|
199 | | - | |
---|
200 | | - | |
---|
201 | | - | @Callable(o) |
---|
202 | | - | func manualFundTransfer (al,am) = { |
---|
203 | | - | let R = o.caller.bytes |
---|
204 | | - | let an = fromBase58String(al) |
---|
205 | | - | let I = o.payments[0].amount |
---|
206 | | - | if ((o.payments[0].assetId == unit)) |
---|
207 | | - | then [IntegerEntry((toBase58String(R) + "_transfer"), I), StringEntry((toBase58String(R) + "_transfer_to"), al), ScriptTransfer(Address(an), I, unit)] |
---|
208 | | - | else if ((o.payments[0].assetId == f)) |
---|
209 | | - | then [IntegerEntry((toBase58String(R) + "_transfer"), I), StringEntry((toBase58String(R) + "_transfer_to"), al), ScriptTransfer(Address(an), I, f)] |
---|
210 | | - | else nil |
---|
211 | | - | } |
---|
212 | | - | |
---|
213 | | - | |
---|
214 | | - | |
---|
215 | | - | @Callable(o) |
---|
216 | | - | func testBid (ao) = [StringEntry("E8kkFBYCy44JJaq6pAZ6KizsuResi5UKNhbD1WNZwhhY_highest_bid", "0")] |
---|