tx · 3cJoW2DCyC8FA2cnPNw97txofMx188vqdkHWrEgK1oLs 3N9cKCHp6ZLMgz7rRgF8Q8DEt8zbtd1Ht7F: -0.01000000 Waves 2022.12.13 12:36 [2358375] smart account 3N9cKCHp6ZLMgz7rRgF8Q8DEt8zbtd1Ht7F > SELF 0.00000000 Waves
{ "type": 13, "id": "3cJoW2DCyC8FA2cnPNw97txofMx188vqdkHWrEgK1oLs", "fee": 1000000, "feeAssetId": null, "timestamp": 1670924286072, "version": 2, "chainId": 84, "sender": "3N9cKCHp6ZLMgz7rRgF8Q8DEt8zbtd1Ht7F", "senderPublicKey": "3V22YUj3GF4AeBxdWx8rgGdG4groE4W6P2s4sAkshe7R", "proofs": [ "4Aahrh6fsksG7JQBsSFRqsomTAwNptpmeeCf3axkxCNaoJyYo4e1G8odeHMceoMYt9pGtaovD2d9Vm5KhtQLPm1U" ], "script": "base64:BgIZCAISCwoJCAgICAgBCAgIEgMKAQESAwoBCAkACXNlcGFyYXRvcgIBXwAEa0J1eQIDYnV5AAZrUHJpY2UCBXByaWNlAAVrU2VsbAIEc2VsbAASbWF4QXVjdGlvbkR1cmF0aW9uAAcABGtCaWQCA2JpZAAMc3RhdHVzRm9yTkZUCQCWCgQCBE9QRU4CBkNMT1NFRAIIUkVXQVJERUQCCENBTkNFTEVEAAtkQXBwQWRkcmVzcwEaAVRKuE9s3sLak+30julKNvjVT3+V1VVbXaABBWlzTmZ0AQdhc3NldElkBAckbWF0Y2gwCQDsBwEFB2Fzc2V0SWQDCQABAgUHJG1hdGNoMAIFQXNzZXQEBXRva2VuBQckbWF0Y2gwAwMJAAACCAUFdG9rZW4IZGVjaW1hbHMAAAkAAAIIBQV0b2tlbghxdWFudGl0eQABBwkAAAIIBQV0b2tlbgpyZWlzc3VhYmxlBwcHAwFpAQljcmVhdGVOZnQJCG5mdF9uYW1lCW5mdF9vd25lcg9uZnRfZEFwcEFkZHJlc3MIbmZ0X3R5cGUIbmZ0X3RhZ3MRbmZ0X3NlbG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pdmUoMTA1OCkBCQCsAgIJAKwCAgkArAICCQCsAgIFBmtQcmljZQUJc2VwYXJhdG9yBQVuZnRJRAIBXwUFb3duZXIEDWN1cnJlbnRfb3duZXIJARFAZXh0ck5hdGl2ZSgxMDU4KQEJAKwCAgkArAICBQVuZnRJRAUJc2VwYXJhdG9yAgVPd25lcgMJAQIhPQIICQCRAwIIBQFpCHBheW1lbnRzAAAHYXNzZXRJZAUEdW5pdAkAAgECDFBheSBpbiB3YXZlcwMJAAACBRBjaGVja093bmVySXNTYW1lCQClCAEIBQFpBmNhbGxlcgkAAgECIU93bmVyIG9mIE5GVCBub3QgYWJsZSB0byBwdXJjaGFzZQkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCAUBaQZjYWxsZXIAAQUHYXNzZXRJZAkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCQEHQWRkcmVzcwEJANkEAQUFb3duZXIFBmFtb3VudAUEdW5pdAkAzAgCCQELU3RyaW5nRW50cnkCCQCsAgIJAKwCAgkApQgBCAUBaQZjYWxsZXIFCXNlcGFyYXRvcgUEa0J1eQkArAICCQCsAgIFBW5mdElEBQlzZXBhcmF0b3IJAKQDAQUGYW1vdW50CQDMCAIJAQtEZWxldGVFbnRyeQEJAKwCAgkArAICAgRuZnRfBQVvd25lcgIGX293bmVyBQNuaWwApa8dLg==", "height": 2358375, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: AuQwCUh6gu1EZfFDGtCb29Kd8P79YTWmWcebcYgpPb1f Next: 84UjADZjRJRewB83SCYu1bSzcG5GYU3WbA3Zpc37ZPxg Diff:
Old | New | Differences | |
---|---|---|---|
57 | 57 | ||
58 | 58 | ||
59 | 59 | @Callable(m) | |
60 | - | func buyNFT (E | |
60 | + | func buyNFT (E) = { | |
61 | 61 | let j = fromBase58String(E) | |
62 | + | let F = getStringValue(((E + a) + "Owner")) | |
62 | 63 | let G = value(m.payments[0].amount) | |
63 | 64 | let H = { | |
64 | 65 | let k = getString(this, (("nft_" + F) + "_owner")) | |
70 | 71 | else false | |
71 | 72 | } | |
72 | 73 | let z = getStringValue(((((c + a) + E) + "_") + F)) | |
73 | - | let J = | |
74 | + | let J = getStringValue(((E + a) + "Owner")) | |
74 | 75 | if ((m.payments[0].assetId != unit)) | |
75 | 76 | then throw("Pay in waves") | |
76 | 77 | else if ((H == toString(m.caller))) | |
77 | 78 | then throw("Owner of NFT not able to purchase") | |
78 | - | else [ScriptTransfer(m.caller, 1, j), ScriptTransfer(Address(fromBase58String( | |
79 | + | else [ScriptTransfer(m.caller, 1, j), ScriptTransfer(Address(fromBase58String(F)), G, unit), StringEntry(((toString(m.caller) + a) + b), ((E + a) + toString(G))), DeleteEntry((("nft_" + F) + "_owner"))] | |
79 | 80 | } | |
80 | - | ||
81 | - | ||
82 | - | ||
83 | - | @Callable(m) | |
84 | - | func addAuction (K,L,M,N) = { | |
85 | - | let y = toBase58String(m.transactionId) | |
86 | - | let O = value(m.payments[0].assetId) | |
87 | - | let z = value(M) | |
88 | - | let P = (lastBlock.height + N) | |
89 | - | let Q = m.caller.bytes | |
90 | - | let R = { | |
91 | - | let k = getString(this, (((toBase58String(O) + a) + "nft_status_") + toBase58String(Q))) | |
92 | - | if ($isInstanceOf(k, "String")) | |
93 | - | then { | |
94 | - | let I = k | |
95 | - | true | |
96 | - | } | |
97 | - | else false | |
98 | - | } | |
99 | - | if ((m.payments[0].assetId == unit)) | |
100 | - | then throw("NFT not attached") | |
101 | - | else if ((R == true)) | |
102 | - | then throw("Already in auction list") | |
103 | - | else if ((N > e)) | |
104 | - | then throw(("Duration is too long. Must be less than or equal to 7 " + toString(e))) | |
105 | - | else [StringEntry(((y + "_nft_start_auction_date_") + toBase58String(Q)), K), StringEntry(((y + "_nft_end_auction_date_") + toBase58String(Q)), L), StringEntry((y + "_nft_start_price"), M), StringEntry((y + "_nft_owner"), toString(m.caller)), StringEntry((y + "_nft_on_auction"), toBase58String(O)), StringEntry((y + "_previous_bidder"), "none"), StringEntry((y + "_highest_bid"), "0"), StringEntry((y + "_winner_of_nft"), "0"), StringEntry((y + "_bidder_count"), "0"), StringEntry((y + "_nft_status"), "OPEN")] | |
106 | - | } | |
107 | - | ||
108 | - | ||
109 | - | ||
110 | - | @Callable(m) | |
111 | - | func placeBid (S,O,o,T) = { | |
112 | - | let y = toBase58String(m.transactionId) | |
113 | - | let Q = m.caller.bytes | |
114 | - | let j = fromBase58String(O) | |
115 | - | let U = m.payments[0].amount | |
116 | - | let V = getStringValue(this, (S + "_highest_bid")) | |
117 | - | let W = getString(this, (S + "_previous_bidder")) | |
118 | - | let X = getStringValue(this, (S + "_bidder_count")) | |
119 | - | let Y = getStringValue(this, (S + "_winner_of_nft")) | |
120 | - | let R = getStringValue(this, (S + "_nft_status")) | |
121 | - | if ((m.payments[0].assetId != unit)) | |
122 | - | then throw("Pay in waves") | |
123 | - | else if ((R != "OPEN")) | |
124 | - | then throw("Not open for auction") | |
125 | - | else if ((parseIntValue(V) >= U)) | |
126 | - | then throw("Bid is less then starting/highest Bid") | |
127 | - | else if ((V == "0")) | |
128 | - | then [StringEntry((S + "_highest_bid"), toString(U)), StringEntry((S + "_winner_of_nft"), toBase58String(m.caller.bytes)), StringEntry((S + "_bidder_count"), toString((parseIntValue(X) + 1))), StringEntry((S + "_nft_id"), toBase58String(j)), StringEntry((S + "_nft_owner"), o), StringEntry((((y + "_") + S) + "_highest_bid"), toString(U)), StringEntry((((y + "_") + S) + "_winner"), toBase58String(m.caller.bytes)), StringEntry((((y + "_") + S) + "_bidder_count"), toString((parseIntValue(X) + 1))), StringEntry((((y + "_") + S) + "_nft_id"), toBase58String(j)), StringEntry((((y + "_") + S) + "_nft_owner"), o), StringEntry((y + "_bid_for_nft_by"), toBase58String(Q)), StringEntry((y + "_bid_price_place"), T), StringEntry((y + "_previous_bid_amount_refund_to_address"), Y), StringEntry((y + "_prevoius_bid_amount_refund"), V)] | |
129 | - | else [StringEntry((S + "_highest_bid"), toString(U)), StringEntry((S + "_winner_of_nft"), toBase58String(m.caller.bytes)), StringEntry((S + "_bidder_count"), toString((parseIntValue(X) + 1))), StringEntry((S + "_nft_id"), toBase58String(j)), StringEntry((S + "_nft_owner"), o), StringEntry((((y + "_") + S) + "_highest_bid"), toString(U)), StringEntry((((y + "_") + S) + "_winner"), toBase58String(m.caller.bytes)), StringEntry((((y + "_") + S) + "_bidder_count"), toString((parseIntValue(X) + 1))), StringEntry((((y + "_") + S) + "_nft_id"), toBase58String(j)), StringEntry((((y + "_") + S) + "_nft_owner"), o), StringEntry((y + "_bid_for_nft_by"), toBase58String(Q)), StringEntry((y + "_bid_price_place"), T), StringEntry((y + "_previous_bid_amount_refund_to_address"), Y), StringEntry((y + "_prevoius_bid_amount_refund"), V), ScriptTransfer(Address(fromBase58String(Y)), parseIntValue(V), unit)] | |
130 | - | } | |
131 | - | ||
132 | - | ||
133 | - | ||
134 | - | @Callable(m) | |
135 | - | func acceptBidOffer (S,O,Z) = { | |
136 | - | let y = toBase58String(m.transactionId) | |
137 | - | let Q = m.caller.bytes | |
138 | - | let j = fromBase58String(O) | |
139 | - | let aa = getStringValue(this, (S + "_highest_bid")) | |
140 | - | let ab = getStringValue(this, (S + "_winner_of_nft")) | |
141 | - | [ScriptTransfer(Address(Q), parseIntValue(aa), unit), ScriptTransfer(Address(fromBase58String(ab)), 1, j), StringEntry((y + "_amount_paid_to_owner"), aa), StringEntry((y + "_nft_transfer_to"), ab), StringEntry((y + "_nft_status"), "REWARDED"), StringEntry((S + "_amount_paid_to_owner"), aa), StringEntry((S + "_nft_transfer_to"), ab), StringEntry((S + "_nft_status"), "REWARDED")] | |
142 | - | } | |
143 | - | ||
144 | - | ||
145 | - | ||
146 | - | @Callable(m) | |
147 | - | func cancelAuction (S) = { | |
148 | - | let y = toBase58String(m.transactionId) | |
149 | - | let Q = m.caller.bytes | |
150 | - | let ac = getStringValue(this, (S + "_nft_status")) | |
151 | - | let ad = getStringValue(this, (S + "_winner_of_nft")) | |
152 | - | let ae = getStringValue(this, (S + "_nft_owner")) | |
153 | - | let O = getStringValue(this, (S + "_nft_on_auction")) | |
154 | - | let af = getStringValue(this, (S + "_highest_bid")) | |
155 | - | if ((ad == "0")) | |
156 | - | then [StringEntry(((y + S) + "_nft_status"), "CANCELED"), ScriptTransfer(Address(fromBase58String(ae)), 1, fromBase58String(O))] | |
157 | - | else [StringEntry((S + "_nft_status"), "CANCELED"), StringEntry((S + "_previous_bid_amount_refund_to_address"), ad), StringEntry((S + "_prevoius_bid_amount_refund"), af), StringEntry((y + "_nft_status"), "CANCELED"), StringEntry((y + "_previous_bid_amount_refund_to_address"), ad), StringEntry((y + "_prevoius_bid_amount_refund"), af), ScriptTransfer(Address(fromBase58String(ae)), 1, fromBase58String(O)), ScriptTransfer(Address(fromBase58String(ad)), parseIntValue(af), unit)] | |
158 | - | } | |
159 | - | ||
160 | - | ||
161 | - | ||
162 | - | @Callable(m) | |
163 | - | func withdrawBid (ag) = { | |
164 | - | let Q = m.caller.bytes | |
165 | - | let ah = getStringValue(this, (ag + "_highest_bid")) | |
166 | - | let ai = getStringValue(this, (ag + "_winner")) | |
167 | - | let aj = getStringValue(this, (ag + "_nft_id")) | |
168 | - | if ((toBase58String(Q) != ai)) | |
169 | - | then throw("No bid") | |
170 | - | else [StringEntry((ag + "_nft_bid"), "WITHDRAW"), StringEntry((ag + "_nft_id"), aj), StringEntry((ag + "_bidding_price_refund_amount"), ah), ScriptTransfer(m.caller, parseIntValue(ah), unit)] | |
171 | - | } | |
172 | - | ||
173 | - | ||
174 | - | ||
175 | - | @Callable(m) | |
176 | - | func testBid (ak) = [StringEntry("E8kkFBYCy44JJaq6pAZ6KizsuResi5UKNhbD1WNZwhhY_highest_bid", "0")] | |
177 | 81 | ||
178 | 82 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = "_" | |
5 | 5 | ||
6 | 6 | let b = "buy" | |
7 | 7 | ||
8 | 8 | let c = "price" | |
9 | 9 | ||
10 | 10 | let d = "sell" | |
11 | 11 | ||
12 | 12 | let e = 7 | |
13 | 13 | ||
14 | 14 | let f = "bid" | |
15 | 15 | ||
16 | 16 | let g = $Tuple4("OPEN", "CLOSED", "REWARDED", "CANCELED") | |
17 | 17 | ||
18 | 18 | let h = base58'3MvjAaDYHpS4A5K4CV3kZMMEH9m9JdBSvbq' | |
19 | 19 | ||
20 | 20 | func i (j) = { | |
21 | 21 | let k = assetInfo(j) | |
22 | 22 | if ($isInstanceOf(k, "Asset")) | |
23 | 23 | then { | |
24 | 24 | let l = k | |
25 | 25 | if (if ((l.decimals == 0)) | |
26 | 26 | then (l.quantity == 1) | |
27 | 27 | else false) | |
28 | 28 | then (l.reissuable == false) | |
29 | 29 | else false | |
30 | 30 | } | |
31 | 31 | else false | |
32 | 32 | } | |
33 | 33 | ||
34 | 34 | ||
35 | 35 | @Callable(m) | |
36 | 36 | func createNft (n,o,p,q,r,s,t,u,v) = { | |
37 | 37 | let w = Issue(n, t, 1, 0, false) | |
38 | 38 | let x = calculateAssetId(w) | |
39 | 39 | let y = m.transactionId | |
40 | 40 | [w, ScriptTransfer(m.caller, 1, x), StringEntry(((toBase58String(x) + a) + "Owner"), toString(m.caller)), StringEntry(((toBase58String(x) + a) + "nft_type"), q), StringEntry(((toBase58String(x) + a) + "nft_tags"), r), StringEntry(((toBase58String(x) + a) + "nft_dAppAddress"), p), IntegerEntry(((toBase58String(x) + a) + "nft_selling_price"), s), StringEntry(((toBase58String(x) + a) + "nft_onSell"), u), StringEntry(((toBase58String(x) + a) + "nft_data"), v), StringEntry(((toBase58String(y) + a) + "issue_nft"), toBase58String(x))] | |
41 | 41 | } | |
42 | 42 | ||
43 | 43 | ||
44 | 44 | ||
45 | 45 | @Callable(m) | |
46 | 46 | func sellNFT (z) = { | |
47 | 47 | let y = m.transactionId | |
48 | 48 | let A = m.caller.bytes | |
49 | 49 | let B = $Tuple2(value(m.payments[0].assetId), value(m.payments[0].amount)) | |
50 | 50 | let C = B._1 | |
51 | 51 | let D = B._2 | |
52 | 52 | if (!(i(C))) | |
53 | 53 | then throw("Token is not NFT") | |
54 | 54 | else [StringEntry(((c + a) + toBase58String(value(m.payments[0].assetId))), toString(z)), StringEntry(((toString(m.caller) + a) + d), ((toBase58String(C) + a) + toString(D)))] | |
55 | 55 | } | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | ||
59 | 59 | @Callable(m) | |
60 | - | func buyNFT (E | |
60 | + | func buyNFT (E) = { | |
61 | 61 | let j = fromBase58String(E) | |
62 | + | let F = getStringValue(((E + a) + "Owner")) | |
62 | 63 | let G = value(m.payments[0].amount) | |
63 | 64 | let H = { | |
64 | 65 | let k = getString(this, (("nft_" + F) + "_owner")) | |
65 | 66 | if ($isInstanceOf(k, "String")) | |
66 | 67 | then { | |
67 | 68 | let I = k | |
68 | 69 | I | |
69 | 70 | } | |
70 | 71 | else false | |
71 | 72 | } | |
72 | 73 | let z = getStringValue(((((c + a) + E) + "_") + F)) | |
73 | - | let J = | |
74 | + | let J = getStringValue(((E + a) + "Owner")) | |
74 | 75 | if ((m.payments[0].assetId != unit)) | |
75 | 76 | then throw("Pay in waves") | |
76 | 77 | else if ((H == toString(m.caller))) | |
77 | 78 | then throw("Owner of NFT not able to purchase") | |
78 | - | else [ScriptTransfer(m.caller, 1, j), ScriptTransfer(Address(fromBase58String( | |
79 | + | else [ScriptTransfer(m.caller, 1, j), ScriptTransfer(Address(fromBase58String(F)), G, unit), StringEntry(((toString(m.caller) + a) + b), ((E + a) + toString(G))), DeleteEntry((("nft_" + F) + "_owner"))] | |
79 | 80 | } | |
80 | - | ||
81 | - | ||
82 | - | ||
83 | - | @Callable(m) | |
84 | - | func addAuction (K,L,M,N) = { | |
85 | - | let y = toBase58String(m.transactionId) | |
86 | - | let O = value(m.payments[0].assetId) | |
87 | - | let z = value(M) | |
88 | - | let P = (lastBlock.height + N) | |
89 | - | let Q = m.caller.bytes | |
90 | - | let R = { | |
91 | - | let k = getString(this, (((toBase58String(O) + a) + "nft_status_") + toBase58String(Q))) | |
92 | - | if ($isInstanceOf(k, "String")) | |
93 | - | then { | |
94 | - | let I = k | |
95 | - | true | |
96 | - | } | |
97 | - | else false | |
98 | - | } | |
99 | - | if ((m.payments[0].assetId == unit)) | |
100 | - | then throw("NFT not attached") | |
101 | - | else if ((R == true)) | |
102 | - | then throw("Already in auction list") | |
103 | - | else if ((N > e)) | |
104 | - | then throw(("Duration is too long. Must be less than or equal to 7 " + toString(e))) | |
105 | - | else [StringEntry(((y + "_nft_start_auction_date_") + toBase58String(Q)), K), StringEntry(((y + "_nft_end_auction_date_") + toBase58String(Q)), L), StringEntry((y + "_nft_start_price"), M), StringEntry((y + "_nft_owner"), toString(m.caller)), StringEntry((y + "_nft_on_auction"), toBase58String(O)), StringEntry((y + "_previous_bidder"), "none"), StringEntry((y + "_highest_bid"), "0"), StringEntry((y + "_winner_of_nft"), "0"), StringEntry((y + "_bidder_count"), "0"), StringEntry((y + "_nft_status"), "OPEN")] | |
106 | - | } | |
107 | - | ||
108 | - | ||
109 | - | ||
110 | - | @Callable(m) | |
111 | - | func placeBid (S,O,o,T) = { | |
112 | - | let y = toBase58String(m.transactionId) | |
113 | - | let Q = m.caller.bytes | |
114 | - | let j = fromBase58String(O) | |
115 | - | let U = m.payments[0].amount | |
116 | - | let V = getStringValue(this, (S + "_highest_bid")) | |
117 | - | let W = getString(this, (S + "_previous_bidder")) | |
118 | - | let X = getStringValue(this, (S + "_bidder_count")) | |
119 | - | let Y = getStringValue(this, (S + "_winner_of_nft")) | |
120 | - | let R = getStringValue(this, (S + "_nft_status")) | |
121 | - | if ((m.payments[0].assetId != unit)) | |
122 | - | then throw("Pay in waves") | |
123 | - | else if ((R != "OPEN")) | |
124 | - | then throw("Not open for auction") | |
125 | - | else if ((parseIntValue(V) >= U)) | |
126 | - | then throw("Bid is less then starting/highest Bid") | |
127 | - | else if ((V == "0")) | |
128 | - | then [StringEntry((S + "_highest_bid"), toString(U)), StringEntry((S + "_winner_of_nft"), toBase58String(m.caller.bytes)), StringEntry((S + "_bidder_count"), toString((parseIntValue(X) + 1))), StringEntry((S + "_nft_id"), toBase58String(j)), StringEntry((S + "_nft_owner"), o), StringEntry((((y + "_") + S) + "_highest_bid"), toString(U)), StringEntry((((y + "_") + S) + "_winner"), toBase58String(m.caller.bytes)), StringEntry((((y + "_") + S) + "_bidder_count"), toString((parseIntValue(X) + 1))), StringEntry((((y + "_") + S) + "_nft_id"), toBase58String(j)), StringEntry((((y + "_") + S) + "_nft_owner"), o), StringEntry((y + "_bid_for_nft_by"), toBase58String(Q)), StringEntry((y + "_bid_price_place"), T), StringEntry((y + "_previous_bid_amount_refund_to_address"), Y), StringEntry((y + "_prevoius_bid_amount_refund"), V)] | |
129 | - | else [StringEntry((S + "_highest_bid"), toString(U)), StringEntry((S + "_winner_of_nft"), toBase58String(m.caller.bytes)), StringEntry((S + "_bidder_count"), toString((parseIntValue(X) + 1))), StringEntry((S + "_nft_id"), toBase58String(j)), StringEntry((S + "_nft_owner"), o), StringEntry((((y + "_") + S) + "_highest_bid"), toString(U)), StringEntry((((y + "_") + S) + "_winner"), toBase58String(m.caller.bytes)), StringEntry((((y + "_") + S) + "_bidder_count"), toString((parseIntValue(X) + 1))), StringEntry((((y + "_") + S) + "_nft_id"), toBase58String(j)), StringEntry((((y + "_") + S) + "_nft_owner"), o), StringEntry((y + "_bid_for_nft_by"), toBase58String(Q)), StringEntry((y + "_bid_price_place"), T), StringEntry((y + "_previous_bid_amount_refund_to_address"), Y), StringEntry((y + "_prevoius_bid_amount_refund"), V), ScriptTransfer(Address(fromBase58String(Y)), parseIntValue(V), unit)] | |
130 | - | } | |
131 | - | ||
132 | - | ||
133 | - | ||
134 | - | @Callable(m) | |
135 | - | func acceptBidOffer (S,O,Z) = { | |
136 | - | let y = toBase58String(m.transactionId) | |
137 | - | let Q = m.caller.bytes | |
138 | - | let j = fromBase58String(O) | |
139 | - | let aa = getStringValue(this, (S + "_highest_bid")) | |
140 | - | let ab = getStringValue(this, (S + "_winner_of_nft")) | |
141 | - | [ScriptTransfer(Address(Q), parseIntValue(aa), unit), ScriptTransfer(Address(fromBase58String(ab)), 1, j), StringEntry((y + "_amount_paid_to_owner"), aa), StringEntry((y + "_nft_transfer_to"), ab), StringEntry((y + "_nft_status"), "REWARDED"), StringEntry((S + "_amount_paid_to_owner"), aa), StringEntry((S + "_nft_transfer_to"), ab), StringEntry((S + "_nft_status"), "REWARDED")] | |
142 | - | } | |
143 | - | ||
144 | - | ||
145 | - | ||
146 | - | @Callable(m) | |
147 | - | func cancelAuction (S) = { | |
148 | - | let y = toBase58String(m.transactionId) | |
149 | - | let Q = m.caller.bytes | |
150 | - | let ac = getStringValue(this, (S + "_nft_status")) | |
151 | - | let ad = getStringValue(this, (S + "_winner_of_nft")) | |
152 | - | let ae = getStringValue(this, (S + "_nft_owner")) | |
153 | - | let O = getStringValue(this, (S + "_nft_on_auction")) | |
154 | - | let af = getStringValue(this, (S + "_highest_bid")) | |
155 | - | if ((ad == "0")) | |
156 | - | then [StringEntry(((y + S) + "_nft_status"), "CANCELED"), ScriptTransfer(Address(fromBase58String(ae)), 1, fromBase58String(O))] | |
157 | - | else [StringEntry((S + "_nft_status"), "CANCELED"), StringEntry((S + "_previous_bid_amount_refund_to_address"), ad), StringEntry((S + "_prevoius_bid_amount_refund"), af), StringEntry((y + "_nft_status"), "CANCELED"), StringEntry((y + "_previous_bid_amount_refund_to_address"), ad), StringEntry((y + "_prevoius_bid_amount_refund"), af), ScriptTransfer(Address(fromBase58String(ae)), 1, fromBase58String(O)), ScriptTransfer(Address(fromBase58String(ad)), parseIntValue(af), unit)] | |
158 | - | } | |
159 | - | ||
160 | - | ||
161 | - | ||
162 | - | @Callable(m) | |
163 | - | func withdrawBid (ag) = { | |
164 | - | let Q = m.caller.bytes | |
165 | - | let ah = getStringValue(this, (ag + "_highest_bid")) | |
166 | - | let ai = getStringValue(this, (ag + "_winner")) | |
167 | - | let aj = getStringValue(this, (ag + "_nft_id")) | |
168 | - | if ((toBase58String(Q) != ai)) | |
169 | - | then throw("No bid") | |
170 | - | else [StringEntry((ag + "_nft_bid"), "WITHDRAW"), StringEntry((ag + "_nft_id"), aj), StringEntry((ag + "_bidding_price_refund_amount"), ah), ScriptTransfer(m.caller, parseIntValue(ah), unit)] | |
171 | - | } | |
172 | - | ||
173 | - | ||
174 | - | ||
175 | - | @Callable(m) | |
176 | - | func testBid (ak) = [StringEntry("E8kkFBYCy44JJaq6pAZ6KizsuResi5UKNhbD1WNZwhhY_highest_bid", "0")] | |
177 | 81 | ||
178 | 82 |
github/deemru/w8io/169f3d6 115.72 ms ◑