tx · GWecBuefRy863qXkyR1zwKtQE3w1fyEKp1SyNcxEnAC4

3N8y4wxX3JC4TdrCJBXX16SjWf6X256hrep:  -0.01000000 Waves

2022.12.14 23:12 [2360451] smart account 3N8y4wxX3JC4TdrCJBXX16SjWf6X256hrep > SELF 0.00000000 Waves

{ "type": 13, "id": "GWecBuefRy863qXkyR1zwKtQE3w1fyEKp1SyNcxEnAC4", "fee": 1000000, "feeAssetId": null, "timestamp": 1671048778004, "version": 2, "chainId": 84, "sender": "3N8y4wxX3JC4TdrCJBXX16SjWf6X256hrep", "senderPublicKey": "7v5L7QkXxfkirALdyqmox38QCsa9jtfAtgUfHTh34eWq", "proofs": [ "LevTmvy5pUDacuz3P7gs8c4Diy6HrCk7gBeXeBrs3LtZxR2bJ92SSMMhzJZLFW2X1U9CQyN3N31u3JxE7BDZSEP" ], "script": "base64:BgIWCAISBQoDAQEBEgQKAhEREgUKAwEBAR0ABU1VTFQ2AMCEPQAFTVVMVDgAgMLXLwAFY2hhaW4JALAJAQkAyQECCQDKAQIIBQR0aGlzBWJ5dGVzAAEAAQALdXNkbkFzc2V0SWQEByRtYXRjaDAFBWNoYWluAwkAAAICAVcFByRtYXRjaDABILYmKcME9c5TkaQOS3UkL2SMUbH6369UKb1I0h0qsqrRAwkAAAICAVQFByRtYXRjaDABIPd26vf3g8pl224T7gI7z1gplanB0Y3yS9ps2B1igMjeCQACAQINVW5rbm93biBjaGFpbgAPc3Rha2luZ0NvbnRyYWN0CQERQGV4dHJOYXRpdmUoMTA2MikBBAckbWF0Y2gwBQVjaGFpbgMJAAACAgFXBQckbWF0Y2gwAiMzUExuY1h0UzFVODNENmNRYkZEM0g4ckJIUExnenhTRktaMQMJAAACAgFUBQckbWF0Y2gwAiMzTkRDeUJHNXE4NUp1YVJpaWdVZUV0YWlueWpDUVQzWHBabQkAAgECDVVua25vd24gY2hhaW4AD0RFRkFVTFRMT0NBVElPTgIPQWZyaWNhX0ZfQWZyaWNhAAZOVU1SRVMABgATRkFD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YWxsZXIJAGUCBQNhbXQIBQFiAl8yBQt1c2RuQXNzZXRJZAUDbmlsBQNuaWwJAJQKAgkAzQgCBQRyZXN0CAUBYgJfMQUGcmVzdWx0AAFuWXo=", "height": 2360451, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: J1yu5iTdahLA9Uo5ZUwXDVsxwhffx9hVUUZ7M8LdLYZp Next: B9qtHUB1u6bPNGS6AyHsk1ZYCRaK5Yx1o82XvZ5ZsAVd Diff:
OldNewDifferences
3333
3434 let RESOURCEPRICEMIN = 158549
3535
36+let MINPAYMENT = 10000
37+
3638 let resTypes = ["Oil", "Ore", "Wood", "Sand", "Clay", "Organic"]
39+
40+let matTypes = ["Fuel", "Metal", "Plank", "Glass", "Plastic", "Protein"]
3741
3842 let continents = ["Americas", "Europe", "Asia", "Africa", "Oceania"]
3943
9498 }
9599
96100
97-func buyInternal (locId,resType,amount,minPrice) = {
101+func addMat (matList,matType,amount) = {
102+ func increaser (acc,i) = (acc :+ (if ((i == matType))
103+ then toString((parseIntValue(matList[i]) + amount))
104+ else matList[i]))
105+
106+ let m = {
107+ let $l = [0, 1, 2, 3, 4, 5]
108+ let $s = size($l)
109+ let $acc0 = nil
110+ func $f0_1 ($a,$i) = if (($i >= $s))
111+ then $a
112+ else increaser($a, $l[$i])
113+
114+ func $f0_2 ($a,$i) = if (($i >= $s))
115+ then $a
116+ else throw("List size exceeds 6")
117+
118+ $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6)
119+ }
120+ makeString(m, "_")
121+ }
122+
123+
124+func sellInternal (locId,resType,amount,minPrice) = {
98125 let whKey = keyFactoryWarehouseByIdAndType(locId, resType)
99126 let w0 = valueOrElse(getInteger(whKey), 0)
100127 let r0 = if ((w0 > FACTORYMAXWAREHOUSE))
107134 if (((min99 * amount) > (usdnReceived * MULT8)))
108135 then throw((((((((((("Actual price = " + toString(usdnReceived)) + " / ") + toString(amount)) + " < minPrice = ") + toString(minPrice)) + ", (") + locId) + ", ") + resTypes[resType]) + ")"))
109136 else $Tuple2(IntegerEntry(whKey, (w0 + amount)), usdnReceived)
137+ }
138+
139+
140+func buyInternal (locId,matType,amount,maxPrice) = {
141+ let whKey = keyFactoryWarehouseByIdAndType(locId, matType)
142+ let w0 = valueOrElse(getInteger(whKey), 0)
143+ let m1 = if ((w0 > FACTORYMAXWAREHOUSE))
144+ then min([amount, (w0 - FACTORYMAXWAREHOUSE)])
145+ else 0
146+ let m0 = min([w0, (amount - m1)])
147+ let m = (m0 + m1)
148+ let usdnSpent = (fraction(m0, ((3 * RESOURCEPRICEMIN) - fraction((w0 - (m0 / 2)), RESOURCEPRICEMIN, FACTORYMAXWAREHOUSE)), MULT8) + fraction(m1, (2 * RESOURCEPRICEMIN), MULT8))
149+ let max101 = (maxPrice + (maxPrice / 100))
150+ if (((usdnSpent * MULT8) > (max101 * m)))
151+ then throw((((((((((("Actual price = " + toString(usdnSpent)) + " / ") + toString(m)) + " > maxPrice = ") + toString(maxPrice)) + ", (") + locId) + ", ") + matTypes[matType]) + ")"))
152+ else $Tuple3(IntegerEntry(whKey, (w0 - m)), usdnSpent, m)
110153 }
111154
112155
126169 if ((curLocation[locIdxType] != "F"))
127170 then throw(("Duck location type should be Factory, but is " + curLocation[locIdxType]))
128171 else {
129- let currentPack = split(valueOrElse(getString(stakingContract, keyBackpackByDuck(duckAssetId)), "0:0_0_0_0_0_0::"), ":")
172+ let currentPack = split(valueOrElse(getString(stakingContract, keyBackpackByDuck(duckAssetId)), "0:0_0_0_0_0_0:0_0_0_0_0_0:"), ":")
130173 let resList = split(currentPack[bpIdxRes], "_")
131174 let currentRes = parseIntValue(resList[resType])
132175 if ((amount > currentRes))
133176 then throw(((((("You have " + toString(currentRes)) + " of ") + resTypes[resType]) + " in backpack, but tried to sell ") + toString(amount)))
134177 else {
135- let b = buyInternal(curLocation[locIdxId], resType, amount, minPrice)
178+ let b = sellInternal(curLocation[locIdxId], resType, amount, minPrice)
136179 let bpRes = subRes(resList, resType, amount)
137180 let newPack = makeString([currentPack[bpIdxLevel], bpRes, currentPack[bpIdxMat], currentPack[bpIdxProd]], ":")
138181 let result = asString(invoke(stakingContract, "updateBackpack", [duckAssetId, newPack], nil))
155198 then throw(("Duck location type should be Factory, but is " + curLocation[locIdxType]))
156199 else {
157200 let locId = curLocation[locIdxId]
158- let currentPack = split(valueOrElse(getString(stakingContract, keyBackpackByDuck(duckAssetId)), "0:0_0_0_0_0_0::"), ":")
201+ let currentPack = split(valueOrElse(getString(stakingContract, keyBackpackByDuck(duckAssetId)), "0:0_0_0_0_0_0:0_0_0_0_0_0:"), ":")
159202 let resList = split(currentPack[bpIdxRes], "_")
160203 func adder (acc,idx) = {
161204 let j = indexOf(resTypes, idx)
162205 if (isDefined(j))
163206 then {
164- let b = buyInternal(locId, idx, parseIntValue(resList[idx]), minPrices[value(j)])
207+ let b = sellInternal(locId, idx, parseIntValue(resList[idx]), minPrices[value(j)])
165208 $Tuple3((acc._1 :+ b._1), (acc._2 :+ "0"), (acc._3 + b._2))
166209 }
167210 else $Tuple3(acc._1, (acc._2 :+ resList[idx]), acc._3)
189232 }
190233
191234
235+
236+@Callable(i)
237+func buyMaterial (matType,amount,maxPrice) = if (if ((0 > matType))
238+ then true
239+ else (matType >= NUMRES))
240+ then throw(("Unknown material: " + toString(matType)))
241+ else if ((0 >= amount))
242+ then throw(("Amount should be positive! " + toString(amount)))
243+ else {
244+ let duckAssetId = valueOrErrorMessage(getString(stakingContract, keyStakedDuckByOwner(toString(i.caller))), "You don't have a duck staked")
245+ if ((size(i.payments) != 1))
246+ then throw("exactly 1 payment must be attached")
247+ else {
248+ let pmt = i.payments[0]
249+ let amt = pmt.amount
250+ let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WAVES can't be used as payment")
251+ if ((pmtAssetId != usdnAssetId))
252+ then throw("USDN payments only!")
253+ else {
254+ let curLocation = split(valueOrElse(getString(stakingContract, keyDuckLocation(duckAssetId)), DEFAULTLOCATION), "_")
255+ if ((curLocation[locIdxType] != "F"))
256+ then throw(("Duck location type should be Factory, but is " + curLocation[locIdxType]))
257+ else {
258+ let currentPack = split(valueOrElse(getString(stakingContract, keyBackpackByDuck(duckAssetId)), "0:0_0_0_0_0_0:0_0_0_0_0_0:"), ":")
259+ let matList = split(currentPack[bpIdxMat], "_")
260+ let currentMat = parseIntValue(matList[matType])
261+ let b = buyInternal(curLocation[locIdxId], matType, amount, maxPrice)
262+ if ((b._2 > amt))
263+ then throw(((((((("Your spending = " + toString(b._2)) + " USDN for ") + toString(b._3)) + " of ") + matTypes[matType]) + " is > attached payment = ") + toString(amt)))
264+ else if ((MINPAYMENT > b._2))
265+ then throw(((((((("Your spending = " + toString(b._2)) + " USDN for ") + toString(b._3)) + " of ") + matTypes[matType]) + " is < minimal = ") + toString(MINPAYMENT)))
266+ else {
267+ let bpMat = addMat(matList, matType, b._3)
268+ let newPack = makeString([currentPack[bpIdxLevel], currentPack[bpIdxRes], bpMat, currentPack[bpIdxProd]], ":")
269+ let result = asString(invoke(stakingContract, "updateBackpack", [duckAssetId, newPack], nil))
270+ let rest = if (((amt - b._2) > 0))
271+ then [ScriptTransfer(i.caller, (amt - b._2), usdnAssetId)]
272+ else nil
273+ $Tuple2((rest :+ b._1), result)
274+ }
275+ }
276+ }
277+ }
278+ }
279+
280+
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let MULT6 = 1000000
55
66 let MULT8 = 100000000
77
88 let chain = toUtf8String(take(drop(this.bytes, 1), 1))
99
1010 let usdnAssetId = match chain {
1111 case _ =>
1212 if (("W" == $match0))
1313 then base58'DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p'
1414 else if (("T" == $match0))
1515 then base58'HezsdQuRDtzksAYUy97gfhKy7Z1NW2uXYSHA3bgqenNZ'
1616 else throw("Unknown chain")
1717 }
1818
1919 let stakingContract = addressFromStringValue(match chain {
2020 case _ =>
2121 if (("W" == $match0))
2222 then "3PLncXtS1U83D6cQbFD3H8rBHPLgzxSFKZ1"
2323 else if (("T" == $match0))
2424 then "3NDCyBG5q85JuaRiigUeEtainyjCQT3XpZm"
2525 else throw("Unknown chain")
2626 })
2727
2828 let DEFAULTLOCATION = "Africa_F_Africa"
2929
3030 let NUMRES = 6
3131
3232 let FACTORYMAXWAREHOUSE = 10000000000
3333
3434 let RESOURCEPRICEMIN = 158549
3535
36+let MINPAYMENT = 10000
37+
3638 let resTypes = ["Oil", "Ore", "Wood", "Sand", "Clay", "Organic"]
39+
40+let matTypes = ["Fuel", "Metal", "Plank", "Glass", "Plastic", "Protein"]
3741
3842 let continents = ["Americas", "Europe", "Asia", "Africa", "Oceania"]
3943
4044 func keyFactoryWarehouseByIdAndType (factoryId,resType) = ((("factoryWhByContinentAndRes_" + factoryId) + "_") + toString(resType))
4145
4246
4347 func keyStakedDuckByOwner (ownerAddr) = ("stakedDuckByOwner_" + ownerAddr)
4448
4549
4650 func keyBackpackByDuck (duckAssetId) = ("backPack_" + duckAssetId)
4751
4852
4953 func keyDuckLocation (duckAssetId) = ("duckLocation_" + duckAssetId)
5054
5155
5256 let locIdxContinent = 0
5357
5458 let locIdxType = 1
5559
5660 let locIdxId = 2
5761
5862 let bpIdxLevel = 0
5963
6064 let bpIdxRes = 1
6165
6266 let bpIdxMat = 2
6367
6468 let bpIdxProd = 3
6569
6670 func asString (v) = match v {
6771 case s: String =>
6872 s
6973 case _ =>
7074 throw("fail to cast into String")
7175 }
7276
7377
7478 func subRes (resList,resType,amount) = {
7579 func subber (acc,i) = (acc :+ (if ((i == resType))
7680 then toString((parseIntValue(resList[i]) - amount))
7781 else resList[i]))
7882
7983 let r = {
8084 let $l = [0, 1, 2, 3, 4, 5]
8185 let $s = size($l)
8286 let $acc0 = nil
8387 func $f0_1 ($a,$i) = if (($i >= $s))
8488 then $a
8589 else subber($a, $l[$i])
8690
8791 func $f0_2 ($a,$i) = if (($i >= $s))
8892 then $a
8993 else throw("List size exceeds 6")
9094
9195 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6)
9296 }
9397 makeString(r, "_")
9498 }
9599
96100
97-func buyInternal (locId,resType,amount,minPrice) = {
101+func addMat (matList,matType,amount) = {
102+ func increaser (acc,i) = (acc :+ (if ((i == matType))
103+ then toString((parseIntValue(matList[i]) + amount))
104+ else matList[i]))
105+
106+ let m = {
107+ let $l = [0, 1, 2, 3, 4, 5]
108+ let $s = size($l)
109+ let $acc0 = nil
110+ func $f0_1 ($a,$i) = if (($i >= $s))
111+ then $a
112+ else increaser($a, $l[$i])
113+
114+ func $f0_2 ($a,$i) = if (($i >= $s))
115+ then $a
116+ else throw("List size exceeds 6")
117+
118+ $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6)
119+ }
120+ makeString(m, "_")
121+ }
122+
123+
124+func sellInternal (locId,resType,amount,minPrice) = {
98125 let whKey = keyFactoryWarehouseByIdAndType(locId, resType)
99126 let w0 = valueOrElse(getInteger(whKey), 0)
100127 let r0 = if ((w0 > FACTORYMAXWAREHOUSE))
101128 then 0
102129 else if (((w0 + amount) > FACTORYMAXWAREHOUSE))
103130 then (FACTORYMAXWAREHOUSE - w0)
104131 else amount
105132 let usdnReceived = (fraction(r0, ((2 * RESOURCEPRICEMIN) - fraction((w0 + (r0 / 2)), RESOURCEPRICEMIN, FACTORYMAXWAREHOUSE)), MULT8) + fraction((amount - r0), RESOURCEPRICEMIN, MULT8))
106133 let min99 = (minPrice - (minPrice / 100))
107134 if (((min99 * amount) > (usdnReceived * MULT8)))
108135 then throw((((((((((("Actual price = " + toString(usdnReceived)) + " / ") + toString(amount)) + " < minPrice = ") + toString(minPrice)) + ", (") + locId) + ", ") + resTypes[resType]) + ")"))
109136 else $Tuple2(IntegerEntry(whKey, (w0 + amount)), usdnReceived)
137+ }
138+
139+
140+func buyInternal (locId,matType,amount,maxPrice) = {
141+ let whKey = keyFactoryWarehouseByIdAndType(locId, matType)
142+ let w0 = valueOrElse(getInteger(whKey), 0)
143+ let m1 = if ((w0 > FACTORYMAXWAREHOUSE))
144+ then min([amount, (w0 - FACTORYMAXWAREHOUSE)])
145+ else 0
146+ let m0 = min([w0, (amount - m1)])
147+ let m = (m0 + m1)
148+ let usdnSpent = (fraction(m0, ((3 * RESOURCEPRICEMIN) - fraction((w0 - (m0 / 2)), RESOURCEPRICEMIN, FACTORYMAXWAREHOUSE)), MULT8) + fraction(m1, (2 * RESOURCEPRICEMIN), MULT8))
149+ let max101 = (maxPrice + (maxPrice / 100))
150+ if (((usdnSpent * MULT8) > (max101 * m)))
151+ then throw((((((((((("Actual price = " + toString(usdnSpent)) + " / ") + toString(m)) + " > maxPrice = ") + toString(maxPrice)) + ", (") + locId) + ", ") + matTypes[matType]) + ")"))
152+ else $Tuple3(IntegerEntry(whKey, (w0 - m)), usdnSpent, m)
110153 }
111154
112155
113156 @Callable(i)
114157 func sellResource (resType,amount,minPrice) = if (if ((0 > resType))
115158 then true
116159 else (resType >= NUMRES))
117160 then throw(("Unknown resource: " + toString(resType)))
118161 else if ((0 >= amount))
119162 then throw(("Amount should be positive! " + toString(amount)))
120163 else {
121164 let duckAssetId = valueOrErrorMessage(getString(stakingContract, keyStakedDuckByOwner(toString(i.caller))), "You don't have a duck staked")
122165 if ((size(i.payments) != 0))
123166 then throw("sellResources doesn't require any payments")
124167 else {
125168 let curLocation = split(valueOrElse(getString(stakingContract, keyDuckLocation(duckAssetId)), DEFAULTLOCATION), "_")
126169 if ((curLocation[locIdxType] != "F"))
127170 then throw(("Duck location type should be Factory, but is " + curLocation[locIdxType]))
128171 else {
129- let currentPack = split(valueOrElse(getString(stakingContract, keyBackpackByDuck(duckAssetId)), "0:0_0_0_0_0_0::"), ":")
172+ let currentPack = split(valueOrElse(getString(stakingContract, keyBackpackByDuck(duckAssetId)), "0:0_0_0_0_0_0:0_0_0_0_0_0:"), ":")
130173 let resList = split(currentPack[bpIdxRes], "_")
131174 let currentRes = parseIntValue(resList[resType])
132175 if ((amount > currentRes))
133176 then throw(((((("You have " + toString(currentRes)) + " of ") + resTypes[resType]) + " in backpack, but tried to sell ") + toString(amount)))
134177 else {
135- let b = buyInternal(curLocation[locIdxId], resType, amount, minPrice)
178+ let b = sellInternal(curLocation[locIdxId], resType, amount, minPrice)
136179 let bpRes = subRes(resList, resType, amount)
137180 let newPack = makeString([currentPack[bpIdxLevel], bpRes, currentPack[bpIdxMat], currentPack[bpIdxProd]], ":")
138181 let result = asString(invoke(stakingContract, "updateBackpack", [duckAssetId, newPack], nil))
139182 $Tuple2([b._1, ScriptTransfer(i.caller, b._2, usdnAssetId)], result)
140183 }
141184 }
142185 }
143186 }
144187
145188
146189
147190 @Callable(i)
148191 func sellResources (resTypes,minPrices) = {
149192 let duckAssetId = valueOrErrorMessage(getString(stakingContract, keyStakedDuckByOwner(toString(i.caller))), "You don't have a duck staked")
150193 if ((size(i.payments) != 0))
151194 then throw("sellResources doesn't require any payments")
152195 else {
153196 let curLocation = split(valueOrElse(getString(stakingContract, keyDuckLocation(duckAssetId)), DEFAULTLOCATION), "_")
154197 if ((curLocation[locIdxType] != "F"))
155198 then throw(("Duck location type should be Factory, but is " + curLocation[locIdxType]))
156199 else {
157200 let locId = curLocation[locIdxId]
158- let currentPack = split(valueOrElse(getString(stakingContract, keyBackpackByDuck(duckAssetId)), "0:0_0_0_0_0_0::"), ":")
201+ let currentPack = split(valueOrElse(getString(stakingContract, keyBackpackByDuck(duckAssetId)), "0:0_0_0_0_0_0:0_0_0_0_0_0:"), ":")
159202 let resList = split(currentPack[bpIdxRes], "_")
160203 func adder (acc,idx) = {
161204 let j = indexOf(resTypes, idx)
162205 if (isDefined(j))
163206 then {
164- let b = buyInternal(locId, idx, parseIntValue(resList[idx]), minPrices[value(j)])
207+ let b = sellInternal(locId, idx, parseIntValue(resList[idx]), minPrices[value(j)])
165208 $Tuple3((acc._1 :+ b._1), (acc._2 :+ "0"), (acc._3 + b._2))
166209 }
167210 else $Tuple3(acc._1, (acc._2 :+ resList[idx]), acc._3)
168211 }
169212
170213 let merged = {
171214 let $l = [0, 1, 2, 3, 4, 5]
172215 let $s = size($l)
173216 let $acc0 = $Tuple3(nil, nil, 0)
174217 func $f0_1 ($a,$i) = if (($i >= $s))
175218 then $a
176219 else adder($a, $l[$i])
177220
178221 func $f0_2 ($a,$i) = if (($i >= $s))
179222 then $a
180223 else throw("List size exceeds 6")
181224
182225 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6)
183226 }
184227 let newPack = makeString([currentPack[bpIdxLevel], makeString(merged._2, "_"), currentPack[bpIdxMat], currentPack[bpIdxProd]], ":")
185228 let result = asString(invoke(stakingContract, "updateBackpack", [duckAssetId, newPack], nil))
186229 $Tuple2((merged._1 :+ ScriptTransfer(i.caller, merged._3, usdnAssetId)), result)
187230 }
188231 }
189232 }
190233
191234
235+
236+@Callable(i)
237+func buyMaterial (matType,amount,maxPrice) = if (if ((0 > matType))
238+ then true
239+ else (matType >= NUMRES))
240+ then throw(("Unknown material: " + toString(matType)))
241+ else if ((0 >= amount))
242+ then throw(("Amount should be positive! " + toString(amount)))
243+ else {
244+ let duckAssetId = valueOrErrorMessage(getString(stakingContract, keyStakedDuckByOwner(toString(i.caller))), "You don't have a duck staked")
245+ if ((size(i.payments) != 1))
246+ then throw("exactly 1 payment must be attached")
247+ else {
248+ let pmt = i.payments[0]
249+ let amt = pmt.amount
250+ let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WAVES can't be used as payment")
251+ if ((pmtAssetId != usdnAssetId))
252+ then throw("USDN payments only!")
253+ else {
254+ let curLocation = split(valueOrElse(getString(stakingContract, keyDuckLocation(duckAssetId)), DEFAULTLOCATION), "_")
255+ if ((curLocation[locIdxType] != "F"))
256+ then throw(("Duck location type should be Factory, but is " + curLocation[locIdxType]))
257+ else {
258+ let currentPack = split(valueOrElse(getString(stakingContract, keyBackpackByDuck(duckAssetId)), "0:0_0_0_0_0_0:0_0_0_0_0_0:"), ":")
259+ let matList = split(currentPack[bpIdxMat], "_")
260+ let currentMat = parseIntValue(matList[matType])
261+ let b = buyInternal(curLocation[locIdxId], matType, amount, maxPrice)
262+ if ((b._2 > amt))
263+ then throw(((((((("Your spending = " + toString(b._2)) + " USDN for ") + toString(b._3)) + " of ") + matTypes[matType]) + " is > attached payment = ") + toString(amt)))
264+ else if ((MINPAYMENT > b._2))
265+ then throw(((((((("Your spending = " + toString(b._2)) + " USDN for ") + toString(b._3)) + " of ") + matTypes[matType]) + " is < minimal = ") + toString(MINPAYMENT)))
266+ else {
267+ let bpMat = addMat(matList, matType, b._3)
268+ let newPack = makeString([currentPack[bpIdxLevel], currentPack[bpIdxRes], bpMat, currentPack[bpIdxProd]], ":")
269+ let result = asString(invoke(stakingContract, "updateBackpack", [duckAssetId, newPack], nil))
270+ let rest = if (((amt - b._2) > 0))
271+ then [ScriptTransfer(i.caller, (amt - b._2), usdnAssetId)]
272+ else nil
273+ $Tuple2((rest :+ b._1), result)
274+ }
275+ }
276+ }
277+ }
278+ }
279+
280+

github/deemru/w8io/169f3d6 
74.07 ms