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