tx · J1yu5iTdahLA9Uo5ZUwXDVsxwhffx9hVUUZ7M8LdLYZp

3N8y4wxX3JC4TdrCJBXX16SjWf6X256hrep:  -0.01000000 Waves

2022.12.12 14:18 [2357046] smart account 3N8y4wxX3JC4TdrCJBXX16SjWf6X256hrep > SELF 0.00000000 Waves

{ "type": 13, "id": "J1yu5iTdahLA9Uo5ZUwXDVsxwhffx9hVUUZ7M8LdLYZp", "fee": 1000000, "feeAssetId": null, "timestamp": 1670844008042, "version": 2, "chainId": 84, "sender": "3N8y4wxX3JC4TdrCJBXX16SjWf6X256hrep", "senderPublicKey": "7v5L7QkXxfkirALdyqmox38QCsa9jtfAtgUfHTh34eWq", "proofs": [ "3AeNHx4bnpLWuTzxmbPBs9HfDU4WnwM9Gt99UGyQcBajTJZLbUUSh45diqVWYuJWc8Gz8kANmcUK8qpdUFBtmcde" ], "script": "base64:BgIPCAISBQoDAQEBEgQKAhERGQAFTVVMVDYAwIQ9AAVNVUxUOACAwtcvAAVjaGFpbgkAsAkBCQDJAQIJAMoBAggFBHRoaXMFYnl0ZXMAAQABAAt1c2RuQXNzZXRJZAQHJG1hdGNoMAUFY2hhaW4DCQAAAgIBVwUHJG1hdGNoMAEgtiYpwwT1zlORpA5LdSQvZIxRsfrfr1QpvUjSHSqyqtEDCQAAAgIBVAUHJG1hdGNoMAEg93bq9/eDymXbbhPuAjvPWCmVqcHRjfJL2mzYHWKAyN4JAAIBAg1Vbmtub3duIGNoYWluAA9zdGFraW5nQ29udHJhY3QJARFAZXh0ck5hdGl2ZSgxMDYyKQEEByRtYXRjaDAFBWNoYWluAwkAAAICAVcFByRtYXRjaDACIzNQTG5jWHRTMVU4M0Q2Y1FiRkQzSDhyQkhQTGd6eFNGS1oxAwkAAAICAVQFByRtYXRjaDACIzNOREN5Qkc1cTg1SnVhUmlpZ1VlRXRhaW55akNRVDNYcFptCQACAQINVW5rbm93biBjaGFpbgAPREVGQVVMVExPQ0FUSU9OAg9BZnJpY2FfRl9BZnJpY2E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ZHVja0Fzc2V0SWQJAMwIAgUHbmV3UGFjawUDbmlsBQNuaWwJAJQKAgkAzQgCCAUGbWVyZ2VkAl8xCQEOU2NyaXB0VHJhbnNmZXIDCAUBaQZjYWxsZXIIBQZtZXJnZWQCXzMFC3VzZG5Bc3NldElkBQZyZXN1bHQAUIDrLA==", "height": 2357046, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4Hnti9WWrSuYW1HSCA4oEe56WNH1B6bU9ZB1tAY6CpM7 Next: GWecBuefRy863qXkyR1zwKtQE3w1fyEKp1SyNcxEnAC4 Diff:
OldNewDifferences
55
66 let b = 100000000
77
8-let c = base58'HezsdQuRDtzksAYUy97gfhKy7Z1NW2uXYSHA3bgqenNZ'
8+let c = toUtf8String(take(drop(this.bytes, 1), 1))
99
10-let d = addressFromStringValue("3N5SpX21R3R75Qo4eb3MwFFvW7TUzyhvavv")
10+let d = {
11+ let e = c
12+ if (("W" == e))
13+ then base58'DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p'
14+ else if (("T" == e))
15+ then base58'HezsdQuRDtzksAYUy97gfhKy7Z1NW2uXYSHA3bgqenNZ'
16+ else throw("Unknown chain")
17+ }
1118
12-let e = addressFromStringValue("3NDCyBG5q85JuaRiigUeEtainyjCQT3XpZm")
19+let f = addressFromStringValue({
20+ let e = c
21+ if (("W" == e))
22+ then "3PLncXtS1U83D6cQbFD3H8rBHPLgzxSFKZ1"
23+ else if (("T" == e))
24+ then "3NDCyBG5q85JuaRiigUeEtainyjCQT3XpZm"
25+ else throw("Unknown chain")
26+ })
1327
14-let f = "Africa_F_Africa"
28+let g = "Africa_F_Africa"
1529
16-let g = 6
30+let h = 6
1731
18-let h = 10000000000
32+let i = 10000000000
1933
20-let i = 158549
34+let j = 158549
2135
22-let j = ["Oil", "Ore", "Wood", "Sand", "Clay", "Organic"]
36+let k = ["Oil", "Ore", "Wood", "Sand", "Clay", "Organic"]
2337
24-let k = ["Americas", "Europe", "Asia", "Africa", "Oceania"]
38+let l = ["Americas", "Europe", "Asia", "Africa", "Oceania"]
2539
26-func l (m,n) = ((("factoryWhByContinentAndRes_" + m) + "_") + toString(n))
40+func m (n,o) = ((("factoryWhByContinentAndRes_" + n) + "_") + toString(o))
2741
2842
29-func o (p) = ("nftOwner_" + p)
43+func p (q) = ("stakedDuckByOwner_" + q)
3044
3145
32-func q (p) = ("stakedTime_" + p)
46+func r (s) = ("backPack_" + s)
3347
3448
35-func r (s) = ("stakedDuckByOwner_" + s)
49+func t (s) = ("duckLocation_" + s)
3650
3751
38-func t (u) = ("backPack_" + u)
52+let u = 0
3953
54+let v = 1
4055
41-func v (u) = ("duckLocation_" + u)
56+let w = 2
4257
58+let x = 0
4359
44-let w = 0
60+let y = 1
4561
46-let x = 1
62+let z = 2
4763
48-let y = 2
64+let A = 3
4965
50-let z = 0
51-
52-let A = 1
53-
54-let B = 2
55-
56-let C = 0
57-
58-let D = 1
59-
60-let E = 2
61-
62-let F = 3
63-
64-func G (H) = {
65- let I = H
66- if ($isInstanceOf(I, "String"))
66+func B (C) = {
67+ let e = C
68+ if ($isInstanceOf(e, "String"))
6769 then {
68- let J = I
69- J
70+ let D = e
71+ D
7072 }
7173 else throw("fail to cast into String")
7274 }
7375
7476
75-func K (L,n,M) = {
76- func N (O,P) = (O :+ (if ((P == n))
77- then toString((parseIntValue(L[P]) - M))
78- else L[P]))
77+func E (F,o,G) = {
78+ func H (I,J) = (I :+ (if ((J == o))
79+ then toString((parseIntValue(F[J]) - G))
80+ else F[J]))
7981
80- let Q = {
81- let R = [0, 1, 2, 3, 4, 5]
82- let S = size(R)
83- let T = nil
84- func U (V,W) = if ((W >= S))
85- then V
86- else N(V, R[W])
82+ let K = {
83+ let L = [0, 1, 2, 3, 4, 5]
84+ let M = size(L)
85+ let N = nil
86+ func O (P,Q) = if ((Q >= M))
87+ then P
88+ else H(P, L[Q])
8789
88- func X (V,W) = if ((W >= S))
89- then V
90+ func R (P,Q) = if ((Q >= M))
91+ then P
9092 else throw("List size exceeds 6")
9193
92- X(U(U(U(U(U(U(T, 0), 1), 2), 3), 4), 5), 6)
94+ R(O(O(O(O(O(O(N, 0), 1), 2), 3), 4), 5), 6)
9395 }
94- makeString(Q, "_")
96+ makeString(K, "_")
9597 }
9698
9799
98-func Y (Z,n,M,aa) = {
99- let ab = l(Z, n)
100- let ac = valueOrElse(getInteger(ab), 0)
101- let ad = if ((ac > h))
100+func S (T,o,G,U) = {
101+ let V = m(T, o)
102+ let W = valueOrElse(getInteger(V), 0)
103+ let X = if ((W > i))
102104 then 0
103- else if (((ac + M) > h))
104- then (h - ac)
105- else M
106- let ae = (fraction(ad, ((2 * i) - fraction((ac + (ad / 2)), i, h)), b) + fraction((M - ad), i, b))
107- let af = (aa - (aa / 100))
108- if (((af * M) > (ae * b)))
109- then throw((((((((((("Actual price = " + toString(ae)) + " / ") + toString(M)) + " < minPrice = ") + toString(aa)) + ", (") + Z) + ", ") + j[n]) + ")"))
110- else $Tuple2(IntegerEntry(ab, (ac + M)), ae)
105+ else if (((W + G) > i))
106+ then (i - W)
107+ else G
108+ let Y = (fraction(X, ((2 * j) - fraction((W + (X / 2)), j, i)), b) + fraction((G - X), j, b))
109+ let Z = (U - (U / 100))
110+ if (((Z * G) > (Y * b)))
111+ then throw((((((((((("Actual price = " + toString(Y)) + " / ") + toString(G)) + " < minPrice = ") + toString(U)) + ", (") + T) + ", ") + k[o]) + ")"))
112+ else $Tuple2(IntegerEntry(V, (W + G)), Y)
111113 }
112114
113115
114-@Callable(P)
115-func sellResource (n,M,aa) = if (if ((0 > n))
116+@Callable(J)
117+func sellResource (o,G,U) = if (if ((0 > o))
116118 then true
117- else (n >= g))
118- then throw(("Unknown resource: " + toString(n)))
119- else if ((0 >= M))
120- then throw(("Amount should be positive! " + toString(M)))
119+ else (o >= h))
120+ then throw(("Unknown resource: " + toString(o)))
121+ else if ((0 >= G))
122+ then throw(("Amount should be positive! " + toString(G)))
121123 else {
122- let u = valueOrErrorMessage(getString(e, r(toString(P.caller))), "You don't have a duck staked")
123- if ((size(P.payments) != 0))
124+ let s = valueOrErrorMessage(getString(f, p(toString(J.caller))), "You don't have a duck staked")
125+ if ((size(J.payments) != 0))
124126 then throw("sellResources doesn't require any payments")
125127 else {
126- let ag = split(valueOrElse(getString(e, v(u)), f), "_")
127- if ((ag[A] != "F"))
128- then throw(("Duck location type should be Factory, but is " + ag[A]))
128+ let aa = split(valueOrElse(getString(f, t(s)), g), "_")
129+ if ((aa[v] != "F"))
130+ then throw(("Duck location type should be Factory, but is " + aa[v]))
129131 else {
130- let ah = split(valueOrElse(getString(e, t(u)), "0:0_0_0_0_0_0::"), ":")
131- let L = split(ah[D], "_")
132- let ai = parseIntValue(L[n])
133- if ((M > ai))
134- then throw(((((("You have " + toString(ai)) + " of ") + j[n]) + " in backpack, but tried to sell ") + toString(M)))
132+ let ab = split(valueOrElse(getString(f, r(s)), "0:0_0_0_0_0_0::"), ":")
133+ let F = split(ab[y], "_")
134+ let ac = parseIntValue(F[o])
135+ if ((G > ac))
136+ then throw(((((("You have " + toString(ac)) + " of ") + k[o]) + " in backpack, but tried to sell ") + toString(G)))
135137 else {
136- let aj = Y(ag[B], n, M, aa)
137- let ak = K(L, n, M)
138- let al = makeString([ah[C], ak, ah[E], ah[F]], ":")
139- let am = G(invoke(e, "updateBackpack", [u, al], nil))
140- $Tuple2([aj._1, ScriptTransfer(P.caller, aj._2, c)], am)
138+ let ad = S(aa[w], o, G, U)
139+ let ae = E(F, o, G)
140+ let af = makeString([ab[x], ae, ab[z], ab[A]], ":")
141+ let ag = B(invoke(f, "updateBackpack", [s, af], nil))
142+ $Tuple2([ad._1, ScriptTransfer(J.caller, ad._2, d)], ag)
141143 }
142144 }
143145 }
145147
146148
147149
148-@Callable(P)
149-func sellResources (j,an) = {
150- let u = valueOrErrorMessage(getString(e, r(toString(P.caller))), "You don't have a duck staked")
151- if ((size(P.payments) != 0))
150+@Callable(J)
151+func sellResources (k,ah) = {
152+ let s = valueOrErrorMessage(getString(f, p(toString(J.caller))), "You don't have a duck staked")
153+ if ((size(J.payments) != 0))
152154 then throw("sellResources doesn't require any payments")
153155 else {
154- let ag = split(valueOrElse(getString(e, v(u)), f), "_")
155- if ((ag[A] != "F"))
156- then throw(("Duck location type should be Factory, but is " + ag[A]))
156+ let aa = split(valueOrElse(getString(f, t(s)), g), "_")
157+ if ((aa[v] != "F"))
158+ then throw(("Duck location type should be Factory, but is " + aa[v]))
157159 else {
158- let Z = ag[B]
159- let ah = split(valueOrElse(getString(e, t(u)), "0:0_0_0_0_0_0::"), ":")
160- let L = split(ah[D], "_")
161- func ao (O,ap) = {
162- let aq = indexOf(j, ap)
163- if (isDefined(aq))
160+ let T = aa[w]
161+ let ab = split(valueOrElse(getString(f, r(s)), "0:0_0_0_0_0_0::"), ":")
162+ let F = split(ab[y], "_")
163+ func ai (I,aj) = {
164+ let ak = indexOf(k, aj)
165+ if (isDefined(ak))
164166 then {
165- let aj = Y(Z, ap, parseIntValue(L[ap]), an[value(aq)])
166- $Tuple3((O._1 :+ aj._1), (O._2 :+ "0"), (O._3 + aj._2))
167+ let ad = S(T, aj, parseIntValue(F[aj]), ah[value(ak)])
168+ $Tuple3((I._1 :+ ad._1), (I._2 :+ "0"), (I._3 + ad._2))
167169 }
168- else $Tuple3(O._1, (O._2 :+ L[ap]), O._3)
170+ else $Tuple3(I._1, (I._2 :+ F[aj]), I._3)
169171 }
170172
171- let ar = {
172- let R = [0, 1, 2, 3, 4, 5]
173- let S = size(R)
174- let T = $Tuple3(nil, nil, 0)
175- func U (V,W) = if ((W >= S))
176- then V
177- else ao(V, R[W])
173+ let al = {
174+ let L = [0, 1, 2, 3, 4, 5]
175+ let M = size(L)
176+ let N = $Tuple3(nil, nil, 0)
177+ func O (P,Q) = if ((Q >= M))
178+ then P
179+ else ai(P, L[Q])
178180
179- func X (V,W) = if ((W >= S))
180- then V
181+ func R (P,Q) = if ((Q >= M))
182+ then P
181183 else throw("List size exceeds 6")
182184
183- X(U(U(U(U(U(U(T, 0), 1), 2), 3), 4), 5), 6)
185+ R(O(O(O(O(O(O(N, 0), 1), 2), 3), 4), 5), 6)
184186 }
185- let al = makeString([ah[C], makeString(ar._2, "_"), ah[E], ah[F]], ":")
186- let am = G(invoke(e, "updateBackpack", [u, al], nil))
187- $Tuple2((ar._1 :+ ScriptTransfer(P.caller, ar._3, c)), am)
187+ let af = makeString([ab[x], makeString(al._2, "_"), ab[z], ab[A]], ":")
188+ let ag = B(invoke(f, "updateBackpack", [s, af], nil))
189+ $Tuple2((al._1 :+ ScriptTransfer(J.caller, al._3, d)), ag)
188190 }
189191 }
190192 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let a = 1000000
55
66 let b = 100000000
77
8-let c = base58'HezsdQuRDtzksAYUy97gfhKy7Z1NW2uXYSHA3bgqenNZ'
8+let c = toUtf8String(take(drop(this.bytes, 1), 1))
99
10-let d = addressFromStringValue("3N5SpX21R3R75Qo4eb3MwFFvW7TUzyhvavv")
10+let d = {
11+ let e = c
12+ if (("W" == e))
13+ then base58'DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p'
14+ else if (("T" == e))
15+ then base58'HezsdQuRDtzksAYUy97gfhKy7Z1NW2uXYSHA3bgqenNZ'
16+ else throw("Unknown chain")
17+ }
1118
12-let e = addressFromStringValue("3NDCyBG5q85JuaRiigUeEtainyjCQT3XpZm")
19+let f = addressFromStringValue({
20+ let e = c
21+ if (("W" == e))
22+ then "3PLncXtS1U83D6cQbFD3H8rBHPLgzxSFKZ1"
23+ else if (("T" == e))
24+ then "3NDCyBG5q85JuaRiigUeEtainyjCQT3XpZm"
25+ else throw("Unknown chain")
26+ })
1327
14-let f = "Africa_F_Africa"
28+let g = "Africa_F_Africa"
1529
16-let g = 6
30+let h = 6
1731
18-let h = 10000000000
32+let i = 10000000000
1933
20-let i = 158549
34+let j = 158549
2135
22-let j = ["Oil", "Ore", "Wood", "Sand", "Clay", "Organic"]
36+let k = ["Oil", "Ore", "Wood", "Sand", "Clay", "Organic"]
2337
24-let k = ["Americas", "Europe", "Asia", "Africa", "Oceania"]
38+let l = ["Americas", "Europe", "Asia", "Africa", "Oceania"]
2539
26-func l (m,n) = ((("factoryWhByContinentAndRes_" + m) + "_") + toString(n))
40+func m (n,o) = ((("factoryWhByContinentAndRes_" + n) + "_") + toString(o))
2741
2842
29-func o (p) = ("nftOwner_" + p)
43+func p (q) = ("stakedDuckByOwner_" + q)
3044
3145
32-func q (p) = ("stakedTime_" + p)
46+func r (s) = ("backPack_" + s)
3347
3448
35-func r (s) = ("stakedDuckByOwner_" + s)
49+func t (s) = ("duckLocation_" + s)
3650
3751
38-func t (u) = ("backPack_" + u)
52+let u = 0
3953
54+let v = 1
4055
41-func v (u) = ("duckLocation_" + u)
56+let w = 2
4257
58+let x = 0
4359
44-let w = 0
60+let y = 1
4561
46-let x = 1
62+let z = 2
4763
48-let y = 2
64+let A = 3
4965
50-let z = 0
51-
52-let A = 1
53-
54-let B = 2
55-
56-let C = 0
57-
58-let D = 1
59-
60-let E = 2
61-
62-let F = 3
63-
64-func G (H) = {
65- let I = H
66- if ($isInstanceOf(I, "String"))
66+func B (C) = {
67+ let e = C
68+ if ($isInstanceOf(e, "String"))
6769 then {
68- let J = I
69- J
70+ let D = e
71+ D
7072 }
7173 else throw("fail to cast into String")
7274 }
7375
7476
75-func K (L,n,M) = {
76- func N (O,P) = (O :+ (if ((P == n))
77- then toString((parseIntValue(L[P]) - M))
78- else L[P]))
77+func E (F,o,G) = {
78+ func H (I,J) = (I :+ (if ((J == o))
79+ then toString((parseIntValue(F[J]) - G))
80+ else F[J]))
7981
80- let Q = {
81- let R = [0, 1, 2, 3, 4, 5]
82- let S = size(R)
83- let T = nil
84- func U (V,W) = if ((W >= S))
85- then V
86- else N(V, R[W])
82+ let K = {
83+ let L = [0, 1, 2, 3, 4, 5]
84+ let M = size(L)
85+ let N = nil
86+ func O (P,Q) = if ((Q >= M))
87+ then P
88+ else H(P, L[Q])
8789
88- func X (V,W) = if ((W >= S))
89- then V
90+ func R (P,Q) = if ((Q >= M))
91+ then P
9092 else throw("List size exceeds 6")
9193
92- X(U(U(U(U(U(U(T, 0), 1), 2), 3), 4), 5), 6)
94+ R(O(O(O(O(O(O(N, 0), 1), 2), 3), 4), 5), 6)
9395 }
94- makeString(Q, "_")
96+ makeString(K, "_")
9597 }
9698
9799
98-func Y (Z,n,M,aa) = {
99- let ab = l(Z, n)
100- let ac = valueOrElse(getInteger(ab), 0)
101- let ad = if ((ac > h))
100+func S (T,o,G,U) = {
101+ let V = m(T, o)
102+ let W = valueOrElse(getInteger(V), 0)
103+ let X = if ((W > i))
102104 then 0
103- else if (((ac + M) > h))
104- then (h - ac)
105- else M
106- let ae = (fraction(ad, ((2 * i) - fraction((ac + (ad / 2)), i, h)), b) + fraction((M - ad), i, b))
107- let af = (aa - (aa / 100))
108- if (((af * M) > (ae * b)))
109- then throw((((((((((("Actual price = " + toString(ae)) + " / ") + toString(M)) + " < minPrice = ") + toString(aa)) + ", (") + Z) + ", ") + j[n]) + ")"))
110- else $Tuple2(IntegerEntry(ab, (ac + M)), ae)
105+ else if (((W + G) > i))
106+ then (i - W)
107+ else G
108+ let Y = (fraction(X, ((2 * j) - fraction((W + (X / 2)), j, i)), b) + fraction((G - X), j, b))
109+ let Z = (U - (U / 100))
110+ if (((Z * G) > (Y * b)))
111+ then throw((((((((((("Actual price = " + toString(Y)) + " / ") + toString(G)) + " < minPrice = ") + toString(U)) + ", (") + T) + ", ") + k[o]) + ")"))
112+ else $Tuple2(IntegerEntry(V, (W + G)), Y)
111113 }
112114
113115
114-@Callable(P)
115-func sellResource (n,M,aa) = if (if ((0 > n))
116+@Callable(J)
117+func sellResource (o,G,U) = if (if ((0 > o))
116118 then true
117- else (n >= g))
118- then throw(("Unknown resource: " + toString(n)))
119- else if ((0 >= M))
120- then throw(("Amount should be positive! " + toString(M)))
119+ else (o >= h))
120+ then throw(("Unknown resource: " + toString(o)))
121+ else if ((0 >= G))
122+ then throw(("Amount should be positive! " + toString(G)))
121123 else {
122- let u = valueOrErrorMessage(getString(e, r(toString(P.caller))), "You don't have a duck staked")
123- if ((size(P.payments) != 0))
124+ let s = valueOrErrorMessage(getString(f, p(toString(J.caller))), "You don't have a duck staked")
125+ if ((size(J.payments) != 0))
124126 then throw("sellResources doesn't require any payments")
125127 else {
126- let ag = split(valueOrElse(getString(e, v(u)), f), "_")
127- if ((ag[A] != "F"))
128- then throw(("Duck location type should be Factory, but is " + ag[A]))
128+ let aa = split(valueOrElse(getString(f, t(s)), g), "_")
129+ if ((aa[v] != "F"))
130+ then throw(("Duck location type should be Factory, but is " + aa[v]))
129131 else {
130- let ah = split(valueOrElse(getString(e, t(u)), "0:0_0_0_0_0_0::"), ":")
131- let L = split(ah[D], "_")
132- let ai = parseIntValue(L[n])
133- if ((M > ai))
134- then throw(((((("You have " + toString(ai)) + " of ") + j[n]) + " in backpack, but tried to sell ") + toString(M)))
132+ let ab = split(valueOrElse(getString(f, r(s)), "0:0_0_0_0_0_0::"), ":")
133+ let F = split(ab[y], "_")
134+ let ac = parseIntValue(F[o])
135+ if ((G > ac))
136+ then throw(((((("You have " + toString(ac)) + " of ") + k[o]) + " in backpack, but tried to sell ") + toString(G)))
135137 else {
136- let aj = Y(ag[B], n, M, aa)
137- let ak = K(L, n, M)
138- let al = makeString([ah[C], ak, ah[E], ah[F]], ":")
139- let am = G(invoke(e, "updateBackpack", [u, al], nil))
140- $Tuple2([aj._1, ScriptTransfer(P.caller, aj._2, c)], am)
138+ let ad = S(aa[w], o, G, U)
139+ let ae = E(F, o, G)
140+ let af = makeString([ab[x], ae, ab[z], ab[A]], ":")
141+ let ag = B(invoke(f, "updateBackpack", [s, af], nil))
142+ $Tuple2([ad._1, ScriptTransfer(J.caller, ad._2, d)], ag)
141143 }
142144 }
143145 }
144146 }
145147
146148
147149
148-@Callable(P)
149-func sellResources (j,an) = {
150- let u = valueOrErrorMessage(getString(e, r(toString(P.caller))), "You don't have a duck staked")
151- if ((size(P.payments) != 0))
150+@Callable(J)
151+func sellResources (k,ah) = {
152+ let s = valueOrErrorMessage(getString(f, p(toString(J.caller))), "You don't have a duck staked")
153+ if ((size(J.payments) != 0))
152154 then throw("sellResources doesn't require any payments")
153155 else {
154- let ag = split(valueOrElse(getString(e, v(u)), f), "_")
155- if ((ag[A] != "F"))
156- then throw(("Duck location type should be Factory, but is " + ag[A]))
156+ let aa = split(valueOrElse(getString(f, t(s)), g), "_")
157+ if ((aa[v] != "F"))
158+ then throw(("Duck location type should be Factory, but is " + aa[v]))
157159 else {
158- let Z = ag[B]
159- let ah = split(valueOrElse(getString(e, t(u)), "0:0_0_0_0_0_0::"), ":")
160- let L = split(ah[D], "_")
161- func ao (O,ap) = {
162- let aq = indexOf(j, ap)
163- if (isDefined(aq))
160+ let T = aa[w]
161+ let ab = split(valueOrElse(getString(f, r(s)), "0:0_0_0_0_0_0::"), ":")
162+ let F = split(ab[y], "_")
163+ func ai (I,aj) = {
164+ let ak = indexOf(k, aj)
165+ if (isDefined(ak))
164166 then {
165- let aj = Y(Z, ap, parseIntValue(L[ap]), an[value(aq)])
166- $Tuple3((O._1 :+ aj._1), (O._2 :+ "0"), (O._3 + aj._2))
167+ let ad = S(T, aj, parseIntValue(F[aj]), ah[value(ak)])
168+ $Tuple3((I._1 :+ ad._1), (I._2 :+ "0"), (I._3 + ad._2))
167169 }
168- else $Tuple3(O._1, (O._2 :+ L[ap]), O._3)
170+ else $Tuple3(I._1, (I._2 :+ F[aj]), I._3)
169171 }
170172
171- let ar = {
172- let R = [0, 1, 2, 3, 4, 5]
173- let S = size(R)
174- let T = $Tuple3(nil, nil, 0)
175- func U (V,W) = if ((W >= S))
176- then V
177- else ao(V, R[W])
173+ let al = {
174+ let L = [0, 1, 2, 3, 4, 5]
175+ let M = size(L)
176+ let N = $Tuple3(nil, nil, 0)
177+ func O (P,Q) = if ((Q >= M))
178+ then P
179+ else ai(P, L[Q])
178180
179- func X (V,W) = if ((W >= S))
180- then V
181+ func R (P,Q) = if ((Q >= M))
182+ then P
181183 else throw("List size exceeds 6")
182184
183- X(U(U(U(U(U(U(T, 0), 1), 2), 3), 4), 5), 6)
185+ R(O(O(O(O(O(O(N, 0), 1), 2), 3), 4), 5), 6)
184186 }
185- let al = makeString([ah[C], makeString(ar._2, "_"), ah[E], ah[F]], ":")
186- let am = G(invoke(e, "updateBackpack", [u, al], nil))
187- $Tuple2((ar._1 :+ ScriptTransfer(P.caller, ar._3, c)), am)
187+ let af = makeString([ab[x], makeString(al._2, "_"), ab[z], ab[A]], ":")
188+ let ag = B(invoke(f, "updateBackpack", [s, af], nil))
189+ $Tuple2((al._1 :+ ScriptTransfer(J.caller, al._3, d)), ag)
188190 }
189191 }
190192 }
191193
192194

github/deemru/w8io/169f3d6 
102.76 ms