tx · 9wuEB5QZmcXQ8SjdzgfbM9CzXd9dhyYq1TAbJodqZ3TR

3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H:  -0.01000000 Waves

2022.11.08 14:16 [2308094] smart account 3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H > SELF 0.00000000 Waves

{ "type": 13, "id": "9wuEB5QZmcXQ8SjdzgfbM9CzXd9dhyYq1TAbJodqZ3TR", "fee": 1000000, "feeAssetId": null, "timestamp": 1667906210685, "version": 2, "chainId": 84, "sender": "3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H", "senderPublicKey": "BDeCphaaC4MZvfmbJqQZ78EvuEBZTJ1VEW7fbxue8BUu", "proofs": [ "3FNkFJCywAbHG2hLrzAWSXobCBCq1ZbD1mnMsP6M6ABELeXSReQKmhRVjFSV966qc5VM4iXfLiRbQy9bVi3gJUam" ], "script": "base64:BgIQCAISBQoDCAgBEgMKAQgSAAUACXNlcGFyYXRvcgIBXwAEa0J1eQIDYnV5AAVrU2VsbAIEc2VsbAAGa1ByaWNlAgVwcmljZQEFaXNOZnQBB2Fzc2V0SWQEByRtYXRjaDAJAOwHAQUHYXNzZXRJZAMJAAECBQckbWF0Y2gwAgVBc3NldAQFdG9rZW4FByRtYXRjaDADAwkAAAIIBQV0b2tlbghkZWNpbWFscwAACQAAAggFBXRva2VuCHF1YW50aXR5AAEHCQAAAggFBXRva2VuCnJlaXNzdWFibGUHBwcDAWkBCGlzc3VlTmZ0AwRuYW1lBG1ldGEFcHJpY2UECG5ld1Rva2VuCQDCCAUFBG5hbWUFBG1ldGEAAQAABwQHaXNzdWVJZAkAuAgBBQhuZXdUb2tlbgkAzAgCBQhuZXdUb2tlbgkAzAgCCQELU3RyaW5nRW50cnkCCQCsAgIJAKwCAgUGa1ByaWNlBQlzZXBhcmF0b3IJANgEAQUHaXNzdWVJZAkApAMBBQVwcmljZQUDbmlsAWkBBmJ1eU5GVAEFbmZ0SUQEB2Fzc2V0SWQJANkEAQUFbm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cHJpY2UFBHVuaXQJAMwIAgkBC1N0cmluZ0VudHJ5AgkArAICCQCsAgIJAKUIAQgFAWkGY2FsbGVyBQlzZXBhcmF0b3IFBWtTZWxsCQCsAgIJAKwCAgkA2AQBBQZ0b2tlbjAFCXNlcGFyYXRvcgkApAMBBQdhbW91bnQwBQNuaWwAkvj1WQ==", "height": 2308094, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DyCbjGcAJwMHyz1FMLjUHGm493mA17Rw6QWrtYYNKF33 Next: BEZat7kRqHYX2wbpznW5M8nPUswcc3JpodCd35stevgG 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 issueNft (j,k,l) = {
29+ let m = Issue(j, k, 1, 0, false)
30+ let n = calculateAssetId(m)
31+[m, StringEntry(((d + a) + toBase58String(n)), toString(l))]
26732 }
26833
26934
27035
271-@Callable(aF)
272-func addAuction (K,L,M,N) = {
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)])
36+@Callable(i)
37+func buyNFT (o) = {
38+ let f = fromBase58String(o)
39+ let p = value(i.payments[0].amount)
40+ let l = valueOrErrorMessage(getString(((d + a) + o)), "There is no price for this NFT")
41+ if ((i.payments[0].assetId != unit))
42+ then throw("Pay in waves")
43+ else if ((parseIntValue(l) > p))
44+ then throw("Invalid payment")
45+ else [ScriptTransfer(i.caller, 1, f), StringEntry(((toString(i.caller) + a) + b), ((o + a) + toString(p)))]
27946 }
28047
28148
28249
283-@Callable(aF)
284-func buyFromSlot (h) = {
285- let aG = $Tuple2(aF.payments[0].assetId, value(aF.payments[0].amount))
286- let ax = aG._1
287- let ay = aG._2
288- let U = fromBase58String(h)
289- let aH = aE(U)
290- let aI = aH._1
291- let B = aH._2
292- let aJ = [ScriptTransfer(aF.caller, 1, U), DeleteEntry(f(aI, U))]
293- if ((aI == c))
294- then {
295- let aK = D(B)
296- let J = aK._1
297- let aL = aK._2
298- valueOrElse(aw(ax, ay, aL), {
299- let aM = aB(ag(U), ay, aL)
300- let aN = aM._1
301- let aO = aM._2
302- let aP = (aJ ++ [ScriptTransfer(J, aN, unit)])
303- if ((aO > 0))
304- then (aP ++ [ScriptTransfer(aF.caller, aO, unit)])
305- else aP
306- })
307- }
308- else {
309- let aQ = T(U, height)
310- let J = aQ._1
311- let aD = aQ._2
312- valueOrElse(aw(ax, ay, aD), {
313- let aR = aB(ag(U), ay, aD)
314- let aN = aR._1
315- let aO = aR._2
316- let aP = (aJ ++ [ScriptTransfer(J, aN, unit)])
317- if ((aO > 0))
318- then (aP ++ [ScriptTransfer(aF.caller, aO, unit)])
319- else aP
320- })
321- }
322- }
323-
324-
325-
326-@Callable(aF)
327-func declineSlot (h) = {
328- let U = fromBase58String(h)
329- let aS = aE(U)
330- let aI = aS._1
331- let B = aS._2
332- let aJ = [DeleteEntry(f(aI, U))]
333- if ((aI == c))
334- then {
335- let aT = D(B)
336- let J = aT._1
337- let aL = aT._2
338- if (!(ao(aF.caller, J)))
339- then throw("Invalid caller")
340- else (aJ ++ [ScriptTransfer(J, 1, U)])
341- }
342- else {
343- let aU = A(B)
344- let J = aU._1
345- let X = aU._2
346- let Y = aU._3
347- let Z = aU._4
348- let aa = aU._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 (aJ ++ [ScriptTransfer(J, 1, U)])
354- }
355- }
356-
357-
358-
359-@Callable(aF)
360-func setTrustedIssuer (aV) = if (!(am(aF.caller)))
361- then throw("Only admin")
362- else [BooleanEntry(l(addressFromStringValue(aV)), true)]
363-
364-
365-
366-@Callable(aF)
367-func getPriceAtCurrentMoment (h,V) = {
368- let U = fromBase58String(h)
369- let aW = T(U, V)
370- let J = aW._1
371- let Q = aW._2
372-[IntegerEntry(i(U), Q)]
50+@Callable(i)
51+func sellNFT () = {
52+ let q = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount))
53+ let r = q._1
54+ let s = q._2
55+ let l = getStringValue(((d + a) + valueOrErrorMessage(toBase58String(r), "There is no price for this NFT")))
56+ if (!(e(r)))
57+ then throw("Token is not NFT")
58+ else [ScriptTransfer(i.caller, parseIntValue(l), unit), StringEntry(((toString(i.caller) + a) + c), ((toBase58String(r) + a) + toString(s)))]
37359 }
37460
37561

github/deemru/w8io/169f3d6 
47.01 ms