tx · FDvhiVprdEeEKCffhSYZyMUr4CTr5yJisyZNVuAqfcFb

3N85YW6NZ9pLYvSdt1ASMQTGxvncnU1vUNx:  -0.01000000 Waves

2022.11.17 12:54 [2320954] smart account 3N85YW6NZ9pLYvSdt1ASMQTGxvncnU1vUNx > SELF 0.00000000 Waves

{ "type": 13, "id": "FDvhiVprdEeEKCffhSYZyMUr4CTr5yJisyZNVuAqfcFb", "fee": 1000000, "feeAssetId": null, "timestamp": 1668678866768, "version": 2, "chainId": 84, "sender": "3N85YW6NZ9pLYvSdt1ASMQTGxvncnU1vUNx", "senderPublicKey": "EKZmHJ5bK3qKKgRdq8rAamt9qrDbVMLARzRqXoQW258v", "proofs": [ "2doj9vqeA758S68VRssrzBfMRHfj2pShj4i9FUDtoCLSD2oxiKdTKcHNQ4monF1ELHk4Yxv7u3hECo6aNvNBCtvV" ], "script": "base64:BgIfCAISCwoJCAgICAgBCAgIEgQKAggIEgMKAQgSAwoBAQUACXNlcGFyYXRvcgIBXwAEa0J1eQIDYnV5AAVrU2VsbAIEc2VsbAAGa1ByaWNlAgVwcmljZQEFaXNOZnQBB2Fzc2V0SWQEByRtYXRjaDAJAOwHAQUHYXNzZXRJZAMJAAECBQckbWF0Y2gwAgVBc3NldAQFdG9rZW4FByRtYXRjaDADAwkAAAIIBQV0b2tlbghkZWNpbWFscwAACQAAAggFBXRva2VuCHF1YW50aXR5AAEHCQAAAggFBXRva2VuCnJlaXNzdWFibGUHBwcEAWkBCWNyZWF0ZU5mdAkIbmZ0X25hbWUJbmZ0X293bmVyD25mdF9kQXBwQWRkcmVzcwhuZnRfdHlwZQhuZnRfdGFncxFuZnRfc2VsbGluZ19wcmljZQ9uZnRfZGVzY3JpcHRpb24KbmZ0X29uU2VsbAhuZnRfZGF0YQQIbmV3VG9rZW4JAMIIBQUIbmZ0X25hbWUFD25mdF9kZXNjcmlwdGlvbgABAAAHBAdpc3N1ZUlkCQC4CAEFCG5ld1Rva2VuCQDMCAIFCG5ld1Rva2V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QGdG9rZW4wCAULJHQwMjM2OTI0NTQCXzEEB2Ftb3VudDAIBQskdDAyMzY5MjQ1NAJfMgMJAQEhAQkBBWlzTmZ0AQUGdG9rZW4wCQACAQIQVG9rZW4gaXMgbm90IE5GVAkAzAgCCQELU3RyaW5nRW50cnkCCQCsAgIJAKwCAgUGa1ByaWNlBQlzZXBhcmF0b3IJANgEAQkBBXZhbHVlAQgJAJEDAggFAWkIcGF5bWVudHMAAAdhc3NldElkCQCkAwEFBXByaWNlCQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgkArAICCQClCAEIBQFpBmNhbGxlcgUJc2VwYXJhdG9yBQVrU2VsbAkArAICCQCsAgIJANgEAQUGdG9rZW4wBQlzZXBhcmF0b3IJAKQDAQUHYW1vdW50MAUDbmlsACX1Oo8=", "height": 2320954, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HmKfbACExQCRxwWdmXLsbRW4qoAFaNPEK9wA4kZzKkca Next: AFZHWFFWCYh2mHjGGRdMnEdvyLM4Ep3roPXHeEX3HkkW Full:
OldNewDifferences
1-{-# STDLIB_VERSION 5 #-}
1+{-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let a = "_"
55
6-let b = "auction"
6+let b = "buy"
77
88 let c = "sell"
99
10-let d = "trusted"
10+let d = "price"
1111
12-let e = "price"
13-
14-func f (g,h) = ((g + a) + toBase58String(h))
15-
16-
17-func i (h) = ((e + a) + toBase58String(h))
18-
19-
20-func j (h) = ((c + a) + toBase58String(h))
21-
22-
23-func k (h) = ((b + a) + toBase58String(h))
24-
25-
26-func l (m) = ((d + a) + toString(m))
27-
28-
29-func n (o,p) = (o ++ [p])
30-
31-
32-func q (r) = {
33- let s = size(r)
34- if ((s == 0))
35- then throw("Empty params")
36- else if ((s == 1))
37- then makeString({
38- let t = r
39- let u = size(t)
40- let v = nil
41- func w (x,y) = if ((y >= u))
42- then x
43- else n(x, t[y])
44-
45- func z (x,y) = if ((y >= u))
46- then x
47- else throw("List size exceeds 1")
48-
49- z(w(v, 0), 1)
50- }, a)
51- else if ((s == 2))
52- then makeString({
53- let t = r
54- let u = size(t)
55- let v = nil
56- func w (x,y) = if ((y >= u))
57- then x
58- else n(x, t[y])
59-
60- func z (x,y) = if ((y >= u))
61- then x
62- else throw("List size exceeds 2")
63-
64- z(w(w(v, 0), 1), 2)
65- }, a)
66- else if ((s == 3))
67- then makeString({
68- let t = r
69- let u = size(t)
70- let v = nil
71- func w (x,y) = if ((y >= u))
72- then x
73- else n(x, t[y])
74-
75- func z (x,y) = if ((y >= u))
76- then x
77- else throw("List size exceeds 3")
78-
79- z(w(w(w(v, 0), 1), 2), 3)
80- }, a)
81- else if ((s == 4))
82- then makeString({
83- let t = r
84- let u = size(t)
85- let v = nil
86- func w (x,y) = if ((y >= u))
87- then x
88- else n(x, t[y])
89-
90- func z (x,y) = if ((y >= u))
91- then x
92- else throw("List size exceeds 4")
93-
94- z(w(w(w(w(v, 0), 1), 2), 3), 4)
95- }, a)
96- else if ((s == 5))
97- then makeString({
98- let t = r
99- let u = size(t)
100- let v = nil
101- func w (x,y) = if ((y >= u))
102- then x
103- else n(x, t[y])
104-
105- func z (x,y) = if ((y >= u))
106- then x
107- else throw("List size exceeds 5")
108-
109- z(w(w(w(w(w(v, 0), 1), 2), 3), 4), 5)
110- }, a)
111- else throw("Max number of parameters exceeded")
112- }
113-
114-
115-func A (B) = {
116- let C = split(B, a)
117- $Tuple5(addressFromStringValue(C[0]), parseIntValue(C[1]), parseIntValue(C[2]), parseIntValue(C[3]), parseIntValue(C[4]))
118- }
119-
120-
121-func D (B) = {
122- let C = split(B, a)
123- $Tuple2(addressFromStringValue(C[0]), parseIntValue(C[1]))
124- }
125-
126-
127-func E (r) = {
128- let F = r
129- if ($isInstanceOf(F, "(Address, Int, Int, Int, Int)"))
12+func e (f) = {
13+ let g = assetInfo(f)
14+ if ($isInstanceOf(g, "Asset"))
13015 then {
131- let G = F
132- q([toString(G._1), toString(G._2), toString(G._3), toString(G._4), toString(G._5)])
133- }
134- else if ($isInstanceOf(F, "(Address, Int)"))
135- then {
136- let H = F
137- q([toString(H._1), toString(H._2)])
138- }
139- else throw("Wrong params tupple")
140- }
141-
142-
143-func I (J,h,K,L,M,N) = StringEntry(k(h), E($Tuple5(J, K, L, M, N)))
144-
145-
146-func O (h,P,Q) = StringEntry(j(h), E($Tuple2(P, Q)))
147-
148-
149-func R (h) = value(getString(this, k(h)))
150-
151-
152-func S (h) = value(getString(this, j(h)))
153-
154-
155-func T (U,V) = {
156- let B = R(U)
157- let W = A(B)
158- let J = W._1
159- let X = W._2
160- let Y = W._3
161- let Z = W._4
162- let aa = W._5
163- if ((V >= aa))
164- then $Tuple2(J, Y)
165- else {
166- let ab = (X - Y)
167- let ac = (aa - Z)
168- let ad = (V - Z)
169- $Tuple2(J, (X - fraction(ad, ab, ac)))
170- }
171- }
172-
173-
174-func ae (U) = {
175- let F = assetInfo(U)
176- if ($isInstanceOf(F, "Asset"))
177- then {
178- let af = F
179- if (if ((af.decimals == 0))
180- then (af.quantity == 1)
16+ let h = g
17+ if (if ((h.decimals == 0))
18+ then (h.quantity == 1)
18119 else false)
182- then (af.reissuable == false)
20+ then (h.reissuable == false)
18321 else false
18422 }
18523 else false
18624 }
18725
18826
189-func ag (U) = {
190- let m = value(assetInfo(U)).issuer
191- valueOrElse(getBoolean(this, l(m)), false)
192- }
193-
194-
195-func ah (U) = isDefined(getString(this, j(U)))
196-
197-
198-func ai (U) = isDefined(getString(this, k(U)))
199-
200-
201-func aj (Q) = (Q > 0)
202-
203-
204-func ak (M,N) = (N > M)
205-
206-
207-func al (K,L) = (K > L)
208-
209-
210-func am (an) = (an == this)
211-
212-
213-func ao (an,J) = if ((an == this))
214- then true
215- else (an == J)
216-
217-
218-func ap (aq,N) = (aq > N)
219-
220-
221-func ar (as,at) = (as >= at)
222-
223-
224-func au (U) = (U == unit)
225-
226-
227-func av (h) = if (!(ae(h)))
228- then throw("Token is not Nft")
229- else if (ah(h))
230- then throw("Sell already exists")
231- else if (ai(h))
232- then throw("Auction already exists")
233- else unit
234-
235-
236-func aw (ax,ay,Q) = if (!(au(ax)))
237- then throw("Payment must be at WAVES")
238- else if (!(ar(ay, Q)))
239- then throw("Not enough funds")
240- else unit
241-
242-
243-func az () = 0
244-
245-
246-func aA () = 0
247-
248-
249-func aB (aC,ay,aD) = if (aC)
250- then $Tuple2((aD - aA()), (ay - aD))
251- else $Tuple2((aD - az()), (ay - aD))
252-
253-
254-func aE (h) = if (ah(h))
255- then $Tuple2(c, S(h))
256- else if (ai(h))
257- then $Tuple2(b, R(h))
258- else throw("Slot doesn`t exist")
259-
260-
261-@Callable(aF)
262-func addSell (Q) = {
263- let h = value(aF.payments[0].assetId)
264- valueOrElse(av(h), if (!(aj(Q)))
265- then throw("Price must be > 0")
266- else [O(h, aF.caller, Q)])
27+@Callable(i)
28+func createNft (j,k,l,m,n,o,p,q,r) = {
29+ let s = Issue(j, p, 1, 0, false)
30+ let t = calculateAssetId(s)
31+[s, ScriptTransfer(i.caller, 1, t), StringEntry(((toBase58String(t) + a) + "Owner"), toString(i.caller)), StringEntry(((toBase58String(t) + a) + "nft_type"), m), StringEntry(((toBase58String(t) + a) + "nft_tags"), n), StringEntry(((toBase58String(t) + a) + "nft_dAppAddress"), l), IntegerEntry(((toBase58String(t) + a) + "nft_selling_price"), o), StringEntry(((toBase58String(t) + a) + "nft_onSell"), q), StringEntry(((toBase58String(t) + a) + "nft_data"), r)]
26732 }
26833
26934
27035
271-@Callable(aF)
272-func addAuction (K,L,M,N,aG,aH,aI,aJ,aK,aL,aM,aN,aO) = {
273- let h = value(aF.payments[0].assetId)
274- valueOrElse(av(h), if (!(ak(M, N)))
275- then throw("Period is not correct")
276- else if (!(al(K, L)))
277- then throw("Start price must be > endPrice")
278- else [I(aF.caller, h, K, L, M, N), StringEntry(((toBase58String(h) + a) + "nft_owner"), toString(aF.caller)), StringEntry(((toBase58String(h) + a) + "nft_type"), aJ), StringEntry(((toBase58String(h) + a) + "nft_tags"), aK), StringEntry(((toBase58String(h) + a) + "nft_dAppAddress"), aI), IntegerEntry(((toBase58String(h) + a) + "nft_selling_price"), aL), StringEntry(((toBase58String(h) + a) + "nft_onSell"), aN), StringEntry(((toBase58String(h) + a) + "nft_data"), aO)])
36+@Callable(i)
37+func issueNft (u,v) = {
38+ let s = Issue(u, v, 1, 0, false)
39+ let t = calculateAssetId(s)
40+[s, ScriptTransfer(i.caller, 1, t), StringEntry(((toBase58String(t) + a) + "Owner"), toString(i.caller))]
27941 }
28042
28143
28244
283-@Callable(aF)
284-func buyFromSlot (h) = {
285- let aP = $Tuple2(aF.payments[0].assetId, value(aF.payments[0].amount))
286- let ax = aP._1
287- let ay = aP._2
288- let U = fromBase58String(h)
289- let aQ = aE(U)
290- let aR = aQ._1
291- let B = aQ._2
292- let aS = [ScriptTransfer(aF.caller, 1, U), DeleteEntry(f(aR, U))]
293- if ((aR == c))
294- then {
295- let aT = D(B)
296- let J = aT._1
297- let aU = aT._2
298- valueOrElse(aw(ax, ay, aU), {
299- let aV = aB(ag(U), ay, aU)
300- let aW = aV._1
301- let aX = aV._2
302- let aY = (aS ++ [ScriptTransfer(J, aW, unit)])
303- if ((aX > 0))
304- then (aY ++ [ScriptTransfer(aF.caller, aX, unit)])
305- else aY
306- })
307- }
308- else {
309- let aZ = T(U, height)
310- let J = aZ._1
311- let aD = aZ._2
312- valueOrElse(aw(ax, ay, aD), {
313- let ba = aB(ag(U), ay, aD)
314- let aW = ba._1
315- let aX = ba._2
316- let aY = (aS ++ [ScriptTransfer(J, aW, unit)])
317- if ((aX > 0))
318- then (aY ++ [ScriptTransfer(aF.caller, aX, unit)])
319- else aY
320- })
321- }
45+@Callable(i)
46+func buyNFT (w) = {
47+ let f = fromBase58String(w)
48+ let x = value(i.payments[0].amount)
49+ let y = valueOrErrorMessage(getString(((d + a) + w)), "There is no price for this NFT")
50+ let z = valueOrErrorMessage(getStringValue(((w + a) + "Owner")), "No owner")
51+ if ((i.payments[0].assetId != unit))
52+ then throw("Pay in waves")
53+ else if ((parseIntValue(y) > x))
54+ then throw("Invalid payment")
55+ else [ScriptTransfer(i.caller, 1, f), ScriptTransfer(value(addressFromString(z)), parseIntValue(y), unit), StringEntry(((toString(i.caller) + a) + b), ((w + a) + toString(x)))]
32256 }
32357
32458
32559
326-@Callable(aF)
327-func declineSlot (h) = {
328- let U = fromBase58String(h)
329- let bb = aE(U)
330- let aR = bb._1
331- let B = bb._2
332- let aS = [DeleteEntry(f(aR, U))]
333- if ((aR == c))
334- then {
335- let bc = D(B)
336- let J = bc._1
337- let aU = bc._2
338- if (!(ao(aF.caller, J)))
339- then throw("Invalid caller")
340- else (aS ++ [ScriptTransfer(J, 1, U)])
341- }
342- else {
343- let bd = A(B)
344- let J = bd._1
345- let X = bd._2
346- let Y = bd._3
347- let Z = bd._4
348- let aa = bd._5
349- if (!(ao(aF.caller, J)))
350- then throw("Invalid caller")
351- else if (!(ap(height, aa)))
352- then throw("Wait for end of auction")
353- else (aS ++ [ScriptTransfer(J, 1, U)])
354- }
355- }
356-
357-
358-
359-@Callable(aF)
360-func setTrustedIssuer (be) = if (!(am(aF.caller)))
361- then throw("Only admin")
362- else [BooleanEntry(l(addressFromStringValue(be)), true)]
363-
364-
365-
366-@Callable(aF)
367-func getPriceAtCurrentMoment (h,V) = {
368- let U = fromBase58String(h)
369- let bf = T(U, V)
370- let J = bf._1
371- let Q = bf._2
372-[IntegerEntry(i(U), Q)]
60+@Callable(i)
61+func sellNFT (y) = {
62+ let A = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount))
63+ let B = A._1
64+ let C = A._2
65+ if (!(e(B)))
66+ then throw("Token is not NFT")
67+ else [StringEntry(((d + a) + toBase58String(value(i.payments[0].assetId))), toString(y)), StringEntry(((toString(i.caller) + a) + c), ((toBase58String(B) + a) + toString(C)))]
37368 }
37469
37570

github/deemru/w8io/169f3d6 
52.72 ms