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/eDymXbbhPuAjvPWCmVqcHRjfJL2mzYHWKAyN4JAAIBAg1Vbmtub3duIGNoYWluAA9zdGFraW5nQ29udHJhY3QJARFAZXh0ck5hdGl2ZSgxMDYyKQEEByRtYXRjaDAFBWNoYWluAwkAAAICAVcFByRtYXRjaDACIzNQTG5jWHRTMVU4M0Q2Y1FiRkQzSDhyQkhQTGd6eFNGS1oxAwkAAAICAVQFByRtYXRjaDACIzNOREN5Qkc1cTg1SnVhUmlpZ1VlRXRhaW55akNRVDNYcFptCQACAQINVW5rbm93biBjaGFpbgAPREVGQVVMVExPQ0FUSU9OAg9BZnJpY2FfRl9BZnJpY2EAB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HVja0Fzc2V0SWQJAMwIAgUHbmV3UGFjawUDbmlsBQNuaWwJAJQKAgkAzQgCCAUGbWVyZ2VkAl8xCQEOU2NyaXB0VHJhbnNmZXIDCAUBaQZjYWxsZXIIBQZtZXJnZWQCXzMFC3VzZG5Bc3NldElkBQZyZXN1bHQAUIDrLA==", "height": 2357046, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4Hnti9WWrSuYW1HSCA4oEe56WNH1B6bU9ZB1tAY6CpM7 Next: GWecBuefRy863qXkyR1zwKtQE3w1fyEKp1SyNcxEnAC4 Diff:
Old | New | Differences | |
---|---|---|---|
5 | 5 | ||
6 | 6 | let b = 100000000 | |
7 | 7 | ||
8 | - | let c = | |
8 | + | let c = toUtf8String(take(drop(this.bytes, 1), 1)) | |
9 | 9 | ||
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 | + | } | |
11 | 18 | ||
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 | + | }) | |
13 | 27 | ||
14 | - | let | |
28 | + | let g = "Africa_F_Africa" | |
15 | 29 | ||
16 | - | let | |
30 | + | let h = 6 | |
17 | 31 | ||
18 | - | let | |
32 | + | let i = 10000000000 | |
19 | 33 | ||
20 | - | let | |
34 | + | let j = 158549 | |
21 | 35 | ||
22 | - | let | |
36 | + | let k = ["Oil", "Ore", "Wood", "Sand", "Clay", "Organic"] | |
23 | 37 | ||
24 | - | let | |
38 | + | let l = ["Americas", "Europe", "Asia", "Africa", "Oceania"] | |
25 | 39 | ||
26 | - | func | |
40 | + | func m (n,o) = ((("factoryWhByContinentAndRes_" + n) + "_") + toString(o)) | |
27 | 41 | ||
28 | 42 | ||
29 | - | func | |
43 | + | func p (q) = ("stakedDuckByOwner_" + q) | |
30 | 44 | ||
31 | 45 | ||
32 | - | func | |
46 | + | func r (s) = ("backPack_" + s) | |
33 | 47 | ||
34 | 48 | ||
35 | - | func | |
49 | + | func t (s) = ("duckLocation_" + s) | |
36 | 50 | ||
37 | 51 | ||
38 | - | ||
52 | + | let u = 0 | |
39 | 53 | ||
54 | + | let v = 1 | |
40 | 55 | ||
41 | - | ||
56 | + | let w = 2 | |
42 | 57 | ||
58 | + | let x = 0 | |
43 | 59 | ||
44 | - | let | |
60 | + | let y = 1 | |
45 | 61 | ||
46 | - | let | |
62 | + | let z = 2 | |
47 | 63 | ||
48 | - | let | |
64 | + | let A = 3 | |
49 | 65 | ||
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")) | |
67 | 69 | then { | |
68 | - | let | |
69 | - | | |
70 | + | let D = e | |
71 | + | D | |
70 | 72 | } | |
71 | 73 | else throw("fail to cast into String") | |
72 | 74 | } | |
73 | 75 | ||
74 | 76 | ||
75 | - | func | |
76 | - | func | |
77 | - | then toString((parseIntValue( | |
78 | - | else | |
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])) | |
79 | 81 | ||
80 | - | let | |
81 | - | let | |
82 | - | let | |
83 | - | let | |
84 | - | func | |
85 | - | then | |
86 | - | else | |
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]) | |
87 | 89 | ||
88 | - | func | |
89 | - | then | |
90 | + | func R (P,Q) = if ((Q >= M)) | |
91 | + | then P | |
90 | 92 | else throw("List size exceeds 6") | |
91 | 93 | ||
92 | - | | |
94 | + | R(O(O(O(O(O(O(N, 0), 1), 2), 3), 4), 5), 6) | |
93 | 95 | } | |
94 | - | makeString( | |
96 | + | makeString(K, "_") | |
95 | 97 | } | |
96 | 98 | ||
97 | 99 | ||
98 | - | func | |
99 | - | let | |
100 | - | let | |
101 | - | let | |
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)) | |
102 | 104 | then 0 | |
103 | - | else if ((( | |
104 | - | then ( | |
105 | - | else | |
106 | - | let | |
107 | - | let | |
108 | - | if ((( | |
109 | - | then throw((((((((((("Actual price = " + toString( | |
110 | - | else $Tuple2(IntegerEntry( | |
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) | |
111 | 113 | } | |
112 | 114 | ||
113 | 115 | ||
114 | - | @Callable( | |
115 | - | func sellResource ( | |
116 | + | @Callable(J) | |
117 | + | func sellResource (o,G,U) = if (if ((0 > o)) | |
116 | 118 | then true | |
117 | - | else ( | |
118 | - | then throw(("Unknown resource: " + toString( | |
119 | - | else if ((0 >= | |
120 | - | then throw(("Amount should be positive! " + toString( | |
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))) | |
121 | 123 | else { | |
122 | - | let | |
123 | - | if ((size( | |
124 | + | let s = valueOrErrorMessage(getString(f, p(toString(J.caller))), "You don't have a duck staked") | |
125 | + | if ((size(J.payments) != 0)) | |
124 | 126 | then throw("sellResources doesn't require any payments") | |
125 | 127 | else { | |
126 | - | let | |
127 | - | if (( | |
128 | - | then throw(("Duck location type should be Factory, but is " + | |
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])) | |
129 | 131 | else { | |
130 | - | let | |
131 | - | let | |
132 | - | let | |
133 | - | if (( | |
134 | - | then throw(((((("You have " + toString( | |
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))) | |
135 | 137 | else { | |
136 | - | let | |
137 | - | let | |
138 | - | let | |
139 | - | let | |
140 | - | $Tuple2([ | |
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) | |
141 | 143 | } | |
142 | 144 | } | |
143 | 145 | } | |
145 | 147 | ||
146 | 148 | ||
147 | 149 | ||
148 | - | @Callable( | |
149 | - | func sellResources ( | |
150 | - | let | |
151 | - | if ((size( | |
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)) | |
152 | 154 | then throw("sellResources doesn't require any payments") | |
153 | 155 | else { | |
154 | - | let | |
155 | - | if (( | |
156 | - | then throw(("Duck location type should be Factory, but is " + | |
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])) | |
157 | 159 | else { | |
158 | - | let | |
159 | - | let | |
160 | - | let | |
161 | - | func | |
162 | - | let | |
163 | - | if (isDefined( | |
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)) | |
164 | 166 | then { | |
165 | - | let | |
166 | - | $Tuple3(( | |
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)) | |
167 | 169 | } | |
168 | - | else $Tuple3( | |
170 | + | else $Tuple3(I._1, (I._2 :+ F[aj]), I._3) | |
169 | 171 | } | |
170 | 172 | ||
171 | - | let | |
172 | - | let | |
173 | - | let | |
174 | - | let | |
175 | - | func | |
176 | - | then | |
177 | - | else | |
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]) | |
178 | 180 | ||
179 | - | func | |
180 | - | then | |
181 | + | func R (P,Q) = if ((Q >= M)) | |
182 | + | then P | |
181 | 183 | else throw("List size exceeds 6") | |
182 | 184 | ||
183 | - | | |
185 | + | R(O(O(O(O(O(O(N, 0), 1), 2), 3), 4), 5), 6) | |
184 | 186 | } | |
185 | - | let | |
186 | - | let | |
187 | - | $Tuple2(( | |
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) | |
188 | 190 | } | |
189 | 191 | } | |
190 | 192 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = 1000000 | |
5 | 5 | ||
6 | 6 | let b = 100000000 | |
7 | 7 | ||
8 | - | let c = | |
8 | + | let c = toUtf8String(take(drop(this.bytes, 1), 1)) | |
9 | 9 | ||
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 | + | } | |
11 | 18 | ||
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 | + | }) | |
13 | 27 | ||
14 | - | let | |
28 | + | let g = "Africa_F_Africa" | |
15 | 29 | ||
16 | - | let | |
30 | + | let h = 6 | |
17 | 31 | ||
18 | - | let | |
32 | + | let i = 10000000000 | |
19 | 33 | ||
20 | - | let | |
34 | + | let j = 158549 | |
21 | 35 | ||
22 | - | let | |
36 | + | let k = ["Oil", "Ore", "Wood", "Sand", "Clay", "Organic"] | |
23 | 37 | ||
24 | - | let | |
38 | + | let l = ["Americas", "Europe", "Asia", "Africa", "Oceania"] | |
25 | 39 | ||
26 | - | func | |
40 | + | func m (n,o) = ((("factoryWhByContinentAndRes_" + n) + "_") + toString(o)) | |
27 | 41 | ||
28 | 42 | ||
29 | - | func | |
43 | + | func p (q) = ("stakedDuckByOwner_" + q) | |
30 | 44 | ||
31 | 45 | ||
32 | - | func | |
46 | + | func r (s) = ("backPack_" + s) | |
33 | 47 | ||
34 | 48 | ||
35 | - | func | |
49 | + | func t (s) = ("duckLocation_" + s) | |
36 | 50 | ||
37 | 51 | ||
38 | - | ||
52 | + | let u = 0 | |
39 | 53 | ||
54 | + | let v = 1 | |
40 | 55 | ||
41 | - | ||
56 | + | let w = 2 | |
42 | 57 | ||
58 | + | let x = 0 | |
43 | 59 | ||
44 | - | let | |
60 | + | let y = 1 | |
45 | 61 | ||
46 | - | let | |
62 | + | let z = 2 | |
47 | 63 | ||
48 | - | let | |
64 | + | let A = 3 | |
49 | 65 | ||
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")) | |
67 | 69 | then { | |
68 | - | let | |
69 | - | | |
70 | + | let D = e | |
71 | + | D | |
70 | 72 | } | |
71 | 73 | else throw("fail to cast into String") | |
72 | 74 | } | |
73 | 75 | ||
74 | 76 | ||
75 | - | func | |
76 | - | func | |
77 | - | then toString((parseIntValue( | |
78 | - | else | |
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])) | |
79 | 81 | ||
80 | - | let | |
81 | - | let | |
82 | - | let | |
83 | - | let | |
84 | - | func | |
85 | - | then | |
86 | - | else | |
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]) | |
87 | 89 | ||
88 | - | func | |
89 | - | then | |
90 | + | func R (P,Q) = if ((Q >= M)) | |
91 | + | then P | |
90 | 92 | else throw("List size exceeds 6") | |
91 | 93 | ||
92 | - | | |
94 | + | R(O(O(O(O(O(O(N, 0), 1), 2), 3), 4), 5), 6) | |
93 | 95 | } | |
94 | - | makeString( | |
96 | + | makeString(K, "_") | |
95 | 97 | } | |
96 | 98 | ||
97 | 99 | ||
98 | - | func | |
99 | - | let | |
100 | - | let | |
101 | - | let | |
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)) | |
102 | 104 | then 0 | |
103 | - | else if ((( | |
104 | - | then ( | |
105 | - | else | |
106 | - | let | |
107 | - | let | |
108 | - | if ((( | |
109 | - | then throw((((((((((("Actual price = " + toString( | |
110 | - | else $Tuple2(IntegerEntry( | |
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) | |
111 | 113 | } | |
112 | 114 | ||
113 | 115 | ||
114 | - | @Callable( | |
115 | - | func sellResource ( | |
116 | + | @Callable(J) | |
117 | + | func sellResource (o,G,U) = if (if ((0 > o)) | |
116 | 118 | then true | |
117 | - | else ( | |
118 | - | then throw(("Unknown resource: " + toString( | |
119 | - | else if ((0 >= | |
120 | - | then throw(("Amount should be positive! " + toString( | |
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))) | |
121 | 123 | else { | |
122 | - | let | |
123 | - | if ((size( | |
124 | + | let s = valueOrErrorMessage(getString(f, p(toString(J.caller))), "You don't have a duck staked") | |
125 | + | if ((size(J.payments) != 0)) | |
124 | 126 | then throw("sellResources doesn't require any payments") | |
125 | 127 | else { | |
126 | - | let | |
127 | - | if (( | |
128 | - | then throw(("Duck location type should be Factory, but is " + | |
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])) | |
129 | 131 | else { | |
130 | - | let | |
131 | - | let | |
132 | - | let | |
133 | - | if (( | |
134 | - | then throw(((((("You have " + toString( | |
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))) | |
135 | 137 | else { | |
136 | - | let | |
137 | - | let | |
138 | - | let | |
139 | - | let | |
140 | - | $Tuple2([ | |
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) | |
141 | 143 | } | |
142 | 144 | } | |
143 | 145 | } | |
144 | 146 | } | |
145 | 147 | ||
146 | 148 | ||
147 | 149 | ||
148 | - | @Callable( | |
149 | - | func sellResources ( | |
150 | - | let | |
151 | - | if ((size( | |
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)) | |
152 | 154 | then throw("sellResources doesn't require any payments") | |
153 | 155 | else { | |
154 | - | let | |
155 | - | if (( | |
156 | - | then throw(("Duck location type should be Factory, but is " + | |
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])) | |
157 | 159 | else { | |
158 | - | let | |
159 | - | let | |
160 | - | let | |
161 | - | func | |
162 | - | let | |
163 | - | if (isDefined( | |
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)) | |
164 | 166 | then { | |
165 | - | let | |
166 | - | $Tuple3(( | |
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)) | |
167 | 169 | } | |
168 | - | else $Tuple3( | |
170 | + | else $Tuple3(I._1, (I._2 :+ F[aj]), I._3) | |
169 | 171 | } | |
170 | 172 | ||
171 | - | let | |
172 | - | let | |
173 | - | let | |
174 | - | let | |
175 | - | func | |
176 | - | then | |
177 | - | else | |
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]) | |
178 | 180 | ||
179 | - | func | |
180 | - | then | |
181 | + | func R (P,Q) = if ((Q >= M)) | |
182 | + | then P | |
181 | 183 | else throw("List size exceeds 6") | |
182 | 184 | ||
183 | - | | |
185 | + | R(O(O(O(O(O(O(N, 0), 1), 2), 3), 4), 5), 6) | |
184 | 186 | } | |
185 | - | let | |
186 | - | let | |
187 | - | $Tuple2(( | |
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) | |
188 | 190 | } | |
189 | 191 | } | |
190 | 192 | } | |
191 | 193 | ||
192 | 194 |
github/deemru/w8io/169f3d6 102.76 ms ◑