tx · G7pT9pBJ4LG7FMkT6rUYr3ou9jvsUetXM27REm4w9iXW

3N3nfqFcxXfd3T18V9icDdh58MJ9wQ2k2xx:  -0.00600000 Waves

2024.12.14 22:40 [3414697] smart account 3N3nfqFcxXfd3T18V9icDdh58MJ9wQ2k2xx > SELF 0.00000000 Waves

{ "type": 13, "id": "G7pT9pBJ4LG7FMkT6rUYr3ou9jvsUetXM27REm4w9iXW", "fee": 600000, "feeAssetId": null, "timestamp": 1734205235950, "version": 2, "chainId": 84, "sender": "3N3nfqFcxXfd3T18V9icDdh58MJ9wQ2k2xx", "senderPublicKey": "UGqkWsCpv7xRVXkQRXyLd6pWPDtYGXmPip7FxSd1pAu", "proofs": [ "4kS2ZpNCcK9U6phkwEFbPijhRm6PexhN1KTMU65HqVL6TAfemoGsjoW6HFzLPxgvb7HzdLvCRztYnJxWocZGUzKF" ], "script": "base64:BgIWCAISAwoBCBIDCgEBEgMKAQgSAwoBCBcAA1NFUAICX18ABWNoYWluCQDJAQIJAMoBAggFBHRoaXMFYnl0ZXMAAQABABZkZWZhdWx0UmVzdDJBZGRyZXNzU3RyBAckbWF0Y2gwBQVjaGFpbgMJAAACAQFXBQckbWF0Y2gwAiMzUEZ3WXRhOGJpRXozMXpwZUZlNURKSzh3RTV0clNwUVZGOAMJAAACAQFUBQckbWF0Y2gwAiMzTjdVdVlhcjYyNjRQNThGQmhWV0tQUUFoNFl1YTJoZ25ndgkAAgECDVVua25vd24gY2hhaW4BD2dldFN0cmluZ09yRmFpbAIHYWRkcmVzcwNrZXkJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkAnQgCBQdhZGRyZXNzBQNrZXkJALkJAgkAzAgCAgptYW5kYXRvcnkgCQDMCAIJAKUIAQUHYWRkcmVzcwkAzAgCAgEuCQDMCAIFA2tleQkAzAgCAg8gaXMgbm90IGRlZmluZWQFA25pbAIAABBJZHhDZmdBY3JlczJEYXBwAAEADUlkeENmZ1dsZ0RhcHAAAgEKa2V5UmVzdENmZwAC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| compacted Prev: 8gHkNkGLT1BJLFhdMqDk2sNaz4oEQ82wuM8K85ewycDE Next: C3sLkjhp4nMZh5gCsKeL1pVwqYh25fQmjPwYx8CnUqKM Diff:
OldNewDifferences
9191 if ((O == O))
9292 then if ((0 >= N))
9393 then throw("Price should be positive")
94- else if ((size(L.payments) != 2))
95- then throw("Exactly 2 payments required: NFT and 5% fee in WLGOLD")
94+ else if ((size(L.payments) != 1))
95+ then throw("Exactly 1 payment required")
9696 else {
9797 let P = value(L.payments[0])
9898 if ((P.amount != 1))
9999 then throw("NFT token should be attached as 1st payment")
100100 else {
101- let Q = value(L.payments[1])
102- let R = valueOrErrorMessage(Q.assetId, "No WAVES payments allowed")
103- if ((R != u))
104- then throw("Only WLGOLD payments are accepted as 2nd payment")
101+ let w = valueOrErrorMessage(P.assetId, "No WAVES payments allowed")
102+ let Q = value(assetInfo(w))
103+ let R = toBase58String(w)
104+ let z = toString(L.caller)
105+ if ((Q.issuer != r))
106+ then throw("Only WavesLands NFT tokens are accepted")
105107 else {
106- let S = (Q.amount - (N / 20))
107- if ((0 > S))
108- then throw("5% fee should be attached as 2nd payment")
109- else {
110- let T = if ((S > 0))
111- then [ScriptTransfer(L.caller, S, u)]
112- else nil
113- let w = valueOrErrorMessage(P.assetId, "No WAVES payments allowed")
114- let U = value(assetInfo(w))
115- let V = toBase58String(w)
116- let z = toString(L.caller)
117- if ((U.issuer != r))
118- then throw("Only WavesLands NFT tokens are accepted")
119- else {
120- let W = y(z)
121- let X = valueOrElse(getString(W), "")
122- let Y = if ((X != ""))
123- then split_51C(value(X), "_")
124- else nil
125- $Tuple2(([IntegerEntry(x(V), N), StringEntry(v(V), z), StringEntry(W, makeString_11C((Y :+ V), "_"))] ++ T), O)
126- }
127- }
108+ let S = y(z)
109+ let T = valueOrElse(getString(S), "")
110+ let U = if ((T != ""))
111+ then split_51C(value(T), "_")
112+ else nil
113+ $Tuple2([IntegerEntry(x(R), N), StringEntry(v(R), z), StringEntry(S, makeString_11C((U :+ R), "_"))], O)
128114 }
129115 }
130116 }
134120
135121
136122 @Callable(L)
137-func cancelSellOrder (V) = {
123+func cancelSellOrder (R) = {
138124 let O = K()
139125 if ((O == O))
140126 then {
141127 let z = toString(L.caller)
142- let W = y(z)
143- let X = valueOrElse(getString(W), "")
144- let Y = if ((X != ""))
145- then split_51C(value(X), "_")
128+ let S = y(z)
129+ let T = valueOrElse(getString(S), "")
130+ let U = if ((T != ""))
131+ then split_51C(value(T), "_")
146132 else nil
147- let p = indexOf(Y, V)
133+ let p = indexOf(U, R)
148134 if (!(isDefined(p)))
149- then throw(("Your don't have sell order for " + V))
135+ then throw(("Your don't have sell order for " + R))
150136 else {
151- let Z = if ((size(Y) > 1))
152- then StringEntry(W, makeString_11C(removeByIndex(Y, value(p)), "_"))
153- else DeleteEntry(W)
154- let N = valueOrErrorMessage(getInteger(x(V)), ("You don't have sell order for " + V))
155- $Tuple2([Z, DeleteEntry(v(V)), DeleteEntry(x(V)), ScriptTransfer(L.caller, 1, fromBase58String(V)), ScriptTransfer(L.caller, (N / 20), u)], O)
137+ let V = if ((size(U) > 1))
138+ then StringEntry(S, makeString_11C(removeByIndex(U, value(p)), "_"))
139+ else DeleteEntry(S)
140+ let N = valueOrErrorMessage(getInteger(x(R)), ("You don't have sell order for " + R))
141+ $Tuple2([V, DeleteEntry(v(R)), DeleteEntry(x(R)), ScriptTransfer(L.caller, 1, fromBase58String(R))], O)
156142 }
157143 }
158144 else throw("Strict value is not equal to itself.")
161147
162148
163149 @Callable(L)
164-func acceptSellOrder (V) = {
150+func acceptSellOrder (R) = {
165151 let O = K()
166152 if ((O == O))
167153 then if ((size(L.payments) != 1))
173159 else (value(P.assetId) != u))
174160 then throw("WLGOLD payments only!")
175161 else {
176- let N = valueOrErrorMessage(getInteger(x(V)), (("NFT " + V) + " is not selling"))
177- let S = (P.amount - N)
178- if ((0 > S))
162+ let N = valueOrErrorMessage(getInteger(x(R)), (("NFT " + R) + " is not selling"))
163+ let W = (P.amount - N)
164+ if ((0 > W))
179165 then throw((("Payment attached doesn't cover sell price of " + D(N, 8)) + " WLGOLD"))
180166 else {
181- let T = if ((S > 0))
182- then [ScriptTransfer(L.caller, S, u)]
167+ let X = if ((W > 0))
168+ then [ScriptTransfer(L.caller, W, u)]
183169 else nil
184- let aa = valueOrErrorMessage(getString(v(V)), (("NFT " + V) + " is not selling"))
185- let W = y(aa)
186- let X = valueOrElse(getString(W), "")
187- let Y = if ((X != ""))
188- then split_51C(value(X), "_")
170+ let Y = valueOrErrorMessage(getString(v(R)), (("NFT " + R) + " is not selling"))
171+ let S = y(Y)
172+ let T = valueOrElse(getString(S), "")
173+ let U = if ((T != ""))
174+ then split_51C(value(T), "_")
189175 else nil
190- let p = indexOf(Y, V)
176+ let p = indexOf(U, R)
191177 if (!(isDefined(p)))
192- then throw(("Seller don't have sell order for " + V))
178+ then throw(("Seller don't have sell order for " + R))
193179 else {
194- let Z = if ((size(Y) > 1))
195- then StringEntry(W, makeString_11C(removeByIndex(Y, value(p)), "_"))
196- else DeleteEntry(W)
197- let ab = (N / 20)
198- let ac = (ab / 2)
199- let ad = A(invoke(s, "burnWlgold", [(ab - ac)], nil))
200- $Tuple2(([Z, DeleteEntry(v(V)), DeleteEntry(x(V)), ScriptTransfer(addressFromStringValue(aa), N, u), ScriptTransfer(addressFromStringValue(getStringValue(s, J)), ac, u), ScriptTransfer(L.caller, 1, fromBase58String(V))] ++ T), O)
180+ let V = if ((size(U) > 1))
181+ then StringEntry(S, makeString_11C(removeByIndex(U, value(p)), "_"))
182+ else DeleteEntry(S)
183+ let Z = (N / 20)
184+ let aa = (Z / 2)
185+ let ab = A(invoke(s, "burnWlgold", [(Z - aa)], nil))
186+ $Tuple2(([V, DeleteEntry(v(R)), DeleteEntry(x(R)), ScriptTransfer(addressFromStringValue(Y), (N - Z), u), ScriptTransfer(addressFromStringValue(getStringValue(s, J)), aa, u), ScriptTransfer(L.caller, 1, fromBase58String(R))] ++ X), O)
201187 }
202188 }
203189 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let a = "__"
55
66 let b = take(drop(this.bytes, 1), 1)
77
88 let c = {
99 let d = b
1010 if ((base58'2W' == d))
1111 then "3PFwYta8biEz31zpeFe5DJK8wE5trSpQVF8"
1212 else if ((base58'2T' == d))
1313 then "3N7UuYar6264P58FBhVWKPQAh4Yua2hgngv"
1414 else throw("Unknown chain")
1515 }
1616
1717 func e (f,g) = valueOrErrorMessage(getString(f, g), makeString(["mandatory ", toString(f), ".", g, " is not defined"], ""))
1818
1919
2020 let h = 1
2121
2222 let i = 2
2323
2424 func j () = "%s__restConfig"
2525
2626
2727 func k () = "%s__rest2Addr"
2828
2929
3030 func l (m) = split_4C(e(m, j()), a)
3131
3232
3333 func n (o,p) = valueOrErrorMessage(addressFromString(o[p]), ("Rest cfg doesn't contain address at index " + toString(p)))
3434
3535
3636 let q = addressFromStringValue(valueOrElse(getString(this, k()), c))
3737
3838 let o = l(q)
3939
4040 let r = n(o, h)
4141
4242 let s = n(o, i)
4343
4444 let t = "wlg_assetId"
4545
4646 let u = valueOrErrorMessage(getBinary(s, t), "WLGOLD is not issued yet")
4747
4848 func v (w) = ("seller_" + w)
4949
5050
5151 func x (w) = ("price_" + w)
5252
5353
5454 func y (z) = ("assetIds_" + z)
5555
5656
5757 func A (B) = {
5858 let d = B
5959 if ($isInstanceOf(d, "Int"))
6060 then {
6161 let C = d
6262 C
6363 }
6464 else throw("fail to cast into Int")
6565 }
6666
6767
6868 func D (E,F) = {
6969 let G = pow(10, 0, F, 0, 0, DOWN)
7070 let H = toString((E % G))
7171 let I = drop(toString(G), (1 + size(H)))
7272 (((toString((E / G)) + ".") + I) + H)
7373 }
7474
7575
7676 let J = "teamAddr"
7777
7878 func K () = A(reentrantInvoke(r, "saveLastTx", nil, nil))
7979
8080
8181 @Callable(L)
8282 func constructorV1 (M) = if ((L.caller != this))
8383 then throw("Permission denied")
8484 else [StringEntry(k(), M)]
8585
8686
8787
8888 @Callable(L)
8989 func placeSellOrder (N) = {
9090 let O = K()
9191 if ((O == O))
9292 then if ((0 >= N))
9393 then throw("Price should be positive")
94- else if ((size(L.payments) != 2))
95- then throw("Exactly 2 payments required: NFT and 5% fee in WLGOLD")
94+ else if ((size(L.payments) != 1))
95+ then throw("Exactly 1 payment required")
9696 else {
9797 let P = value(L.payments[0])
9898 if ((P.amount != 1))
9999 then throw("NFT token should be attached as 1st payment")
100100 else {
101- let Q = value(L.payments[1])
102- let R = valueOrErrorMessage(Q.assetId, "No WAVES payments allowed")
103- if ((R != u))
104- then throw("Only WLGOLD payments are accepted as 2nd payment")
101+ let w = valueOrErrorMessage(P.assetId, "No WAVES payments allowed")
102+ let Q = value(assetInfo(w))
103+ let R = toBase58String(w)
104+ let z = toString(L.caller)
105+ if ((Q.issuer != r))
106+ then throw("Only WavesLands NFT tokens are accepted")
105107 else {
106- let S = (Q.amount - (N / 20))
107- if ((0 > S))
108- then throw("5% fee should be attached as 2nd payment")
109- else {
110- let T = if ((S > 0))
111- then [ScriptTransfer(L.caller, S, u)]
112- else nil
113- let w = valueOrErrorMessage(P.assetId, "No WAVES payments allowed")
114- let U = value(assetInfo(w))
115- let V = toBase58String(w)
116- let z = toString(L.caller)
117- if ((U.issuer != r))
118- then throw("Only WavesLands NFT tokens are accepted")
119- else {
120- let W = y(z)
121- let X = valueOrElse(getString(W), "")
122- let Y = if ((X != ""))
123- then split_51C(value(X), "_")
124- else nil
125- $Tuple2(([IntegerEntry(x(V), N), StringEntry(v(V), z), StringEntry(W, makeString_11C((Y :+ V), "_"))] ++ T), O)
126- }
127- }
108+ let S = y(z)
109+ let T = valueOrElse(getString(S), "")
110+ let U = if ((T != ""))
111+ then split_51C(value(T), "_")
112+ else nil
113+ $Tuple2([IntegerEntry(x(R), N), StringEntry(v(R), z), StringEntry(S, makeString_11C((U :+ R), "_"))], O)
128114 }
129115 }
130116 }
131117 else throw("Strict value is not equal to itself.")
132118 }
133119
134120
135121
136122 @Callable(L)
137-func cancelSellOrder (V) = {
123+func cancelSellOrder (R) = {
138124 let O = K()
139125 if ((O == O))
140126 then {
141127 let z = toString(L.caller)
142- let W = y(z)
143- let X = valueOrElse(getString(W), "")
144- let Y = if ((X != ""))
145- then split_51C(value(X), "_")
128+ let S = y(z)
129+ let T = valueOrElse(getString(S), "")
130+ let U = if ((T != ""))
131+ then split_51C(value(T), "_")
146132 else nil
147- let p = indexOf(Y, V)
133+ let p = indexOf(U, R)
148134 if (!(isDefined(p)))
149- then throw(("Your don't have sell order for " + V))
135+ then throw(("Your don't have sell order for " + R))
150136 else {
151- let Z = if ((size(Y) > 1))
152- then StringEntry(W, makeString_11C(removeByIndex(Y, value(p)), "_"))
153- else DeleteEntry(W)
154- let N = valueOrErrorMessage(getInteger(x(V)), ("You don't have sell order for " + V))
155- $Tuple2([Z, DeleteEntry(v(V)), DeleteEntry(x(V)), ScriptTransfer(L.caller, 1, fromBase58String(V)), ScriptTransfer(L.caller, (N / 20), u)], O)
137+ let V = if ((size(U) > 1))
138+ then StringEntry(S, makeString_11C(removeByIndex(U, value(p)), "_"))
139+ else DeleteEntry(S)
140+ let N = valueOrErrorMessage(getInteger(x(R)), ("You don't have sell order for " + R))
141+ $Tuple2([V, DeleteEntry(v(R)), DeleteEntry(x(R)), ScriptTransfer(L.caller, 1, fromBase58String(R))], O)
156142 }
157143 }
158144 else throw("Strict value is not equal to itself.")
159145 }
160146
161147
162148
163149 @Callable(L)
164-func acceptSellOrder (V) = {
150+func acceptSellOrder (R) = {
165151 let O = K()
166152 if ((O == O))
167153 then if ((size(L.payments) != 1))
168154 then throw("exactly 1 payment must be attached")
169155 else {
170156 let P = L.payments[0]
171157 if (if (!(isDefined(P.assetId)))
172158 then true
173159 else (value(P.assetId) != u))
174160 then throw("WLGOLD payments only!")
175161 else {
176- let N = valueOrErrorMessage(getInteger(x(V)), (("NFT " + V) + " is not selling"))
177- let S = (P.amount - N)
178- if ((0 > S))
162+ let N = valueOrErrorMessage(getInteger(x(R)), (("NFT " + R) + " is not selling"))
163+ let W = (P.amount - N)
164+ if ((0 > W))
179165 then throw((("Payment attached doesn't cover sell price of " + D(N, 8)) + " WLGOLD"))
180166 else {
181- let T = if ((S > 0))
182- then [ScriptTransfer(L.caller, S, u)]
167+ let X = if ((W > 0))
168+ then [ScriptTransfer(L.caller, W, u)]
183169 else nil
184- let aa = valueOrErrorMessage(getString(v(V)), (("NFT " + V) + " is not selling"))
185- let W = y(aa)
186- let X = valueOrElse(getString(W), "")
187- let Y = if ((X != ""))
188- then split_51C(value(X), "_")
170+ let Y = valueOrErrorMessage(getString(v(R)), (("NFT " + R) + " is not selling"))
171+ let S = y(Y)
172+ let T = valueOrElse(getString(S), "")
173+ let U = if ((T != ""))
174+ then split_51C(value(T), "_")
189175 else nil
190- let p = indexOf(Y, V)
176+ let p = indexOf(U, R)
191177 if (!(isDefined(p)))
192- then throw(("Seller don't have sell order for " + V))
178+ then throw(("Seller don't have sell order for " + R))
193179 else {
194- let Z = if ((size(Y) > 1))
195- then StringEntry(W, makeString_11C(removeByIndex(Y, value(p)), "_"))
196- else DeleteEntry(W)
197- let ab = (N / 20)
198- let ac = (ab / 2)
199- let ad = A(invoke(s, "burnWlgold", [(ab - ac)], nil))
200- $Tuple2(([Z, DeleteEntry(v(V)), DeleteEntry(x(V)), ScriptTransfer(addressFromStringValue(aa), N, u), ScriptTransfer(addressFromStringValue(getStringValue(s, J)), ac, u), ScriptTransfer(L.caller, 1, fromBase58String(V))] ++ T), O)
180+ let V = if ((size(U) > 1))
181+ then StringEntry(S, makeString_11C(removeByIndex(U, value(p)), "_"))
182+ else DeleteEntry(S)
183+ let Z = (N / 20)
184+ let aa = (Z / 2)
185+ let ab = A(invoke(s, "burnWlgold", [(Z - aa)], nil))
186+ $Tuple2(([V, DeleteEntry(v(R)), DeleteEntry(x(R)), ScriptTransfer(addressFromStringValue(Y), (N - Z), u), ScriptTransfer(addressFromStringValue(getStringValue(s, J)), aa, u), ScriptTransfer(L.caller, 1, fromBase58String(R))] ++ X), O)
201187 }
202188 }
203189 }
204190 }
205191 else throw("Strict value is not equal to itself.")
206192 }
207193
208194

github/deemru/w8io/169f3d6 
49.09 ms