tx · 7wP2j5BUYgypJyKj5Jfj2m6vHu2X8fzCScUFfYcwZnES

3NDCyBG5q85JuaRiigUeEtainyjCQT3XpZm:  -0.01300000 Waves

2022.12.15 03:33 [2360705] smart account 3NDCyBG5q85JuaRiigUeEtainyjCQT3XpZm > SELF 0.00000000 Waves

{ "type": 13, "id": "7wP2j5BUYgypJyKj5Jfj2m6vHu2X8fzCScUFfYcwZnES", "fee": 1300000, "feeAssetId": null, "timestamp": 1671064404898, "version": 2, "chainId": 84, "sender": "3NDCyBG5q85JuaRiigUeEtainyjCQT3XpZm", "senderPublicKey": "EVooykMNV691Venwp1dHUTBd7KWequzUcda57Wd3LQEX", "proofs": [ "4ai2tU4qUwbVzKtDLXUMRRTLcMxZ7RpUofLrBB6HsGDq2FwadEJgjTDNSzZ2a32iR12FKwXkPJyxCaNCwiXyKXRF" ], "script": "base64:BgIuCAISABIDCgEIEgASAwoBCBIECgIBCBIECgICAhIECgIBCBIECgIBARIECgIICCcABWNoYWluCQCwCQEJAMkBAgkAygECCAUEdGhpcwVieXRlcwABAAEAC3VzZG5Bc3NldElkBAckbWF0Y2gwBQVjaGFpbgMJAAACAgFXBQckbWF0Y2gwASC2JinDBPXOU5GkDkt1JC9kjFGx+t+vVCm9SNIdKrKq0QMJAAACAgFUBQckbWF0Y2gwASD3dur394PKZdtuE+4CO89YKZWpwdGN8kvabNgdYoDI3gkAAgECDVVua25vd24gY2hhaW4ADWluY3ViYXRvckFkZHIEByRtYXRjaDAFBWNoYWluAwkAAAICAVcFByRtYXRjaDAJARFAZXh0ck5hdGl2ZSgxMDYyKQECIzNQRWt0VnV4MlJoY2hTTjYzRHNEbzRiNG16NFFxektTZUR2AwkAAAICAVQFByRtYXRjaDAFBHRoaXMJAAIBAg1Vbmtub3duIGNoYWluAAticmVlZGVyQWRkcgQHJG1hdGNoMAUFY2hhaW4DCQAAAgIBVwUHJG1hdGNoMAkBEUBleHRyTmF0aXZlKDEwNjIpAQIjM1BEVnVVNDVIN0VoNWR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Y3VycmVudFBhY2sFCWJwSWR4UHJvZAUDbmlsAgE6BQNuaWwBaQEOdXBkYXRlQmFja3BhY2sCC2R1Y2tBc3NldElkB25ld1BhY2sDCQECIT0CCAUBaQZjYWxsZXIFC2Vjb25vbXlBZGRyCQACAQIRcGVybWlzc2lvbiBkZW5pZWQJAJQKAgkAzAgCCQELU3RyaW5nRW50cnkCCQERa2V5QmFja3BhY2tCeUR1Y2sBBQtkdWNrQXNzZXRJZAUHbmV3UGFjawUDbmlsBQduZXdQYWNrAFvgcgw=", "height": 2360705, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GULLEXUBbfTbErtqqDXY8KNzgMdavh3myzqQFFKGkLH2 Next: EJUih26gnK7JcrYUpLPafmH4zxkW3wVuFYk7k8rQG4x6 Diff:
OldNewDifferences
408408
409409
410410 @Callable(i)
411-func setHealth (health,duckAssetId) = if ((i.caller != this))
412- then throw("permission denied")
413- else if (if ((0 > health))
414- then true
415- else (health > 100))
416- then throw("HP should be within 0..100")
417- else [IntegerEntry(keyDuckHealth(duckAssetId), health)]
411+func setHealth (health,duckAssetId) = if (if ((0 > health))
412+ then true
413+ else (health > 100))
414+ then throw("HP should be within 0..100")
415+ else [IntegerEntry(keyDuckHealth(duckAssetId), health)]
418416
419417
420418
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let chain = toUtf8String(take(drop(this.bytes, 1), 1))
55
66 let usdnAssetId = match chain {
77 case _ =>
88 if (("W" == $match0))
99 then base58'DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p'
1010 else if (("T" == $match0))
1111 then base58'HezsdQuRDtzksAYUy97gfhKy7Z1NW2uXYSHA3bgqenNZ'
1212 else throw("Unknown chain")
1313 }
1414
1515 let incubatorAddr = match chain {
1616 case _ =>
1717 if (("W" == $match0))
1818 then addressFromStringValue("3PEktVux2RhchSN63DsDo4b4mz4QqzKSeDv")
1919 else if (("T" == $match0))
2020 then this
2121 else throw("Unknown chain")
2222 }
2323
2424 let breederAddr = match chain {
2525 case _ =>
2626 if (("W" == $match0))
2727 then addressFromStringValue("3PDVuU45H7Eh5dmtNbnRNRStGwULA7NY6Hb")
2828 else if (("T" == $match0))
2929 then this
3030 else throw("Unknown chain")
3131 }
3232
3333 let economyAddr = match chain {
3434 case _ =>
3535 if (("W" == $match0))
3636 then addressFromStringValue("3P2sk1KncSxRaZs8b4CWGPw2jkvvav74u4D")
3737 else if (("T" == $match0))
3838 then addressFromStringValue("3N8y4wxX3JC4TdrCJBXX16SjWf6X256hrep")
3939 else throw("Unknown chain")
4040 }
4141
4242 let pub = base58'6LfPuKJjLgekmncBhMg2LZyMTNVzZBccXR28ySXm9uXD'
4343
4444 let HEALCOST = 10000
4545
4646 let LANDPREFIX = "LAND"
4747
4848 let DUCKPREFIX = "DUCK"
4949
5050 let DEFAULTLOCATION = "Africa_F_Africa"
5151
5252 let NUMRES = 6
5353
5454 let DAILYRESBYPIECE = 3456000
5555
5656 let DAYMILLIS = 86400000
5757
5858 let FIVEMINUTESMILLIS = 300000
5959
6060 let matTypes = ["Fuel", "Metal", "Plank", "Glass", "Plastic", "Protein"]
6161
6262 func keyAssetIdToOwner (assetId) = ("nftOwner_" + assetId)
6363
6464
6565 func keyDuckIdToOwner (assetId) = ("duckOwner_" + assetId)
6666
6767
6868 func keyStakedTimeByAssetId (assetId) = ("stakedTime_" + assetId)
6969
7070
7171 func keyStakedDuckByOwner (ownerAddr) = ("stakedDuckByOwner_" + ownerAddr)
7272
7373
7474 func keyStakedTimeByTypeAssetIdAndOwner (nftType,assetId,ownerAddr) = ((((("stakedTimeByTypeAssetIdAndOwner_" + nftType) + "_") + assetId) + "_") + ownerAddr)
7575
7676
7777 func keyLandToOwner (landNum) = ("landOwner_" + landNum)
7878
7979
8080 func keyBackpackByDuck (duckAssetId) = ("backPack_" + duckAssetId)
8181
8282
8383 func keyDuckLocation (duckAssetId) = ("duckLocation_" + duckAssetId)
8484
8585
8686 func keyDuckHealth (duckAssetId) = ("duckHealth_" + duckAssetId)
8787
8888
8989 let recLandNum = 0
9090
9191 let recLandSize = 1
9292
9393 let recTerrains = 2
9494
9595 let recContinent = 3
9696
9797 let locIdxContinent = 0
9898
9999 let locIdxType = 1
100100
101101 let locIdxId = 2
102102
103103 let bpIdxLevel = 0
104104
105105 let bpIdxRes = 1
106106
107107 let bpIdxMat = 2
108108
109109 let bpIdxProd = 3
110110
111111 func countTerrains (terrains) = [(size(split(terrains, "A")) - 1), (size(split(terrains, "B")) - 1), (size(split(terrains, "C")) - 1), (size(split(terrains, "D")) - 1), (size(split(terrains, "E")) - 1), (size(split(terrains, "F")) - 1)]
112112
113113
114114 func numPiecesBySize (landSize) = match landSize {
115115 case _ =>
116116 if (("S" == $match0))
117117 then 25
118118 else if (("M" == $match0))
119119 then 100
120120 else if (("L" == $match0))
121121 then 225
122122 else if (("XL" == $match0))
123123 then 400
124124 else if (("XXL" == $match0))
125125 then 625
126126 else throw("Unknown land size")
127127 }
128128
129129
130130 func subOneInList (aList,idx,amount) = {
131131 func subber (acc,i) = (acc :+ (if ((i == idx))
132132 then toString((parseIntValue(aList[i]) - amount))
133133 else aList[i]))
134134
135135 let r = {
136136 let $l = [0, 1, 2, 3, 4, 5]
137137 let $s = size($l)
138138 let $acc0 = nil
139139 func $f0_1 ($a,$i) = if (($i >= $s))
140140 then $a
141141 else subber($a, $l[$i])
142142
143143 func $f0_2 ($a,$i) = if (($i >= $s))
144144 then $a
145145 else throw("List size exceeds 6")
146146
147147 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6)
148148 }
149149 makeString(r, "_")
150150 }
151151
152152
153153 func addRes (currentRes,terrainCounts,deltaTime,landSizeIndex) = {
154154 func adder (acc,i) = {
155155 let resOfType = ((fraction(deltaTime, DAILYRESBYPIECE, DAYMILLIS) * terrainCounts[i]) * landSizeIndex)
156156 (acc :+ toString((parseIntValue(currentRes[i]) + resOfType)))
157157 }
158158
159159 let r = {
160160 let $l = [0, 1, 2, 3, 4, 5]
161161 let $s = size($l)
162162 let $acc0 = nil
163163 func $f0_1 ($a,$i) = if (($i >= $s))
164164 then $a
165165 else adder($a, $l[$i])
166166
167167 func $f0_2 ($a,$i) = if (($i >= $s))
168168 then $a
169169 else throw("List size exceeds 6")
170170
171171 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6)
172172 }
173173 makeString(r, "_")
174174 }
175175
176176
177177 @Callable(i)
178178 func stakeLand () = {
179179 let pmt = value(i.payments[0])
180180 let assetId = value(pmt.assetId)
181181 let address = toString(i.caller)
182182 if ((pmt.amount != 1))
183183 then throw((("NFT " + LANDPREFIX) + " token should be attached as payment"))
184184 else {
185185 let asset = value(assetInfo(assetId))
186186 if ((asset.issuer != this))
187187 then throw("Unknown issuer of token")
188188 else if (!(contains(asset.name, LANDPREFIX)))
189189 then throw((("Only NFT " + LANDPREFIX) + " tokens are accepted"))
190190 else {
191191 let landNumSize = drop(asset.name, 4)
192192 let landNum = if (contains(landNumSize, "XXL"))
193193 then dropRight(landNumSize, 3)
194194 else if (contains(landNumSize, "XL"))
195195 then dropRight(landNumSize, 2)
196196 else dropRight(landNumSize, 1)
197197 if (!(isDefined(parseInt(landNum))))
198198 then throw(("Cannot parse land number from " + asset.name))
199199 else {
200200 let timeKey = keyStakedTimeByAssetId(toBase58String(assetId))
201201 if (isDefined(getInteger(timeKey)))
202202 then throw((("NFT " + asset.name) + " is already staked"))
203203 else [IntegerEntry(timeKey, lastBlock.timestamp), IntegerEntry(keyStakedTimeByTypeAssetIdAndOwner(LANDPREFIX, toBase58String(assetId), address), lastBlock.timestamp), StringEntry(keyAssetIdToOwner(toBase58String(assetId)), address), StringEntry(keyLandToOwner(landNum), address)]
204204 }
205205 }
206206 }
207207 }
208208
209209
210210
211211 @Callable(i)
212212 func unstakeLand (landAssetId) = if ((size(i.payments) != 0))
213213 then throw("unstake doesn't require any payments")
214214 else {
215215 let assetId = fromBase58String(landAssetId)
216216 let address = toString(i.caller)
217217 let asset = value(assetInfo(assetId))
218218 if ((asset.issuer != this))
219219 then throw("Unknown issuer of token")
220220 else if (!(contains(asset.name, LANDPREFIX)))
221221 then throw((("Only NFT " + LANDPREFIX) + " tokens can be unstaked"))
222222 else {
223223 let timeKey = keyStakedTimeByAssetId(landAssetId)
224224 if (!(isDefined(timeKey)))
225225 then throw((("NFT " + asset.name) + " is not staked"))
226226 else {
227227 let owner = valueOrErrorMessage(getString(keyAssetIdToOwner(landAssetId)), (("NFT " + asset.name) + " is orphaned"))
228228 if ((owner != address))
229229 then throw("Staked NFT is not yours")
230230 else [ScriptTransfer(i.caller, 1, assetId), DeleteEntry(timeKey), DeleteEntry(keyStakedTimeByTypeAssetIdAndOwner(LANDPREFIX, landAssetId, address))]
231231 }
232232 }
233233 }
234234
235235
236236
237237 @Callable(i)
238238 func stakeDuck () = {
239239 let pmt = value(i.payments[0])
240240 let assetId = value(pmt.assetId)
241241 let address = toString(i.caller)
242242 if ((pmt.amount != 1))
243243 then throw((("NFT " + DUCKPREFIX) + " token should be attached as payment"))
244244 else {
245245 let asset = value(assetInfo(assetId))
246246 if (if ((asset.issuer != incubatorAddr))
247247 then (asset.issuer != breederAddr)
248248 else false)
249249 then throw((("Unknown issuer of " + DUCKPREFIX) + " token"))
250250 else if (!(contains(asset.name, DUCKPREFIX)))
251251 then throw((("Only NFT " + DUCKPREFIX) + " tokens are accepted"))
252252 else {
253253 let assetIdStr = toBase58String(assetId)
254254 let timeKey = keyStakedTimeByAssetId(assetIdStr)
255255 if (isDefined(getInteger(timeKey)))
256256 then throw((("NFT " + asset.name) + " is already staked"))
257257 else if (isDefined(getString(keyStakedDuckByOwner(address))))
258258 then throw(("You already staked one duck: " + asset.name))
259259 else {
260260 let locKey = keyDuckLocation(assetIdStr)
261261 let location = getString(locKey)
262262 let keyHealth = keyDuckHealth(assetIdStr)
263263 let health = getInteger(keyHealth)
264264 let bpKey = keyBackpackByDuck(assetIdStr)
265265 let backpack = getString(bpKey)
266266 ([IntegerEntry(timeKey, lastBlock.timestamp), IntegerEntry(keyStakedTimeByTypeAssetIdAndOwner(DUCKPREFIX, toBase58String(assetId), address), lastBlock.timestamp), StringEntry(keyDuckIdToOwner(assetIdStr), address), StringEntry(keyStakedDuckByOwner(address), assetIdStr)] ++ (if (isDefined(location))
267267 then nil
268268 else ([StringEntry(locKey, DEFAULTLOCATION)] ++ (if (isDefined(health))
269269 then nil
270270 else ([IntegerEntry(keyHealth, 100)] ++ (if (isDefined(backpack))
271271 then nil
272272 else [StringEntry(bpKey, "0:0_0_0_0_0_0:0_0_0_0_0_0:")]))))))
273273 }
274274 }
275275 }
276276 }
277277
278278
279279
280280 @Callable(i)
281281 func unstakeDuck (assetIdStr) = if ((size(i.payments) != 0))
282282 then throw("unstake doesn't require any payments")
283283 else {
284284 let assetId = fromBase58String(assetIdStr)
285285 let address = toString(i.caller)
286286 let asset = value(assetInfo(assetId))
287287 if (if ((asset.issuer != incubatorAddr))
288288 then (asset.issuer != breederAddr)
289289 else false)
290290 then throw((("Unknown issuer of " + DUCKPREFIX) + " token"))
291291 else if (!(contains(asset.name, DUCKPREFIX)))
292292 then throw((("Only NFT " + DUCKPREFIX) + " tokens can be unstaked"))
293293 else {
294294 let timeKey = keyStakedTimeByAssetId(toBase58String(assetId))
295295 if (!(isDefined(timeKey)))
296296 then throw((("NFT " + asset.name) + " is not staked"))
297297 else if (!(isDefined(keyStakedDuckByOwner(address))))
298298 then throw((("The duck " + asset.name) + " is not staked"))
299299 else {
300300 let owner = valueOrErrorMessage(getString(keyDuckIdToOwner(toBase58String(assetId))), (("NFT " + asset.name) + " is orphaned"))
301301 if ((owner != address))
302302 then throw("Staked NFT is not yours")
303303 else [ScriptTransfer(i.caller, 1, assetId), DeleteEntry(timeKey), DeleteEntry(keyDuckLocation(assetIdStr)), DeleteEntry(keyStakedTimeByTypeAssetIdAndOwner(DUCKPREFIX, assetIdStr, address)), DeleteEntry(keyStakedDuckByOwner(address))]
304304 }
305305 }
306306 }
307307
308308
309309
310310 @Callable(i)
311311 func claimRes (amount,landAssetId) = if ((size(i.payments) != 0))
312312 then throw("claimRes doesn't require any payments")
313313 else {
314314 let addr = toString(i.caller)
315315 let asset = value(assetInfo(fromBase58String(landAssetId)))
316316 if (!(contains(asset.name, LANDPREFIX)))
317317 then throw((("NFT " + LANDPREFIX) + " token should be passed as param"))
318318 else {
319319 let timeKey = keyStakedTimeByAssetId(landAssetId)
320320 let savedTime = getInteger(timeKey)
321321 if (!(isDefined(savedTime)))
322322 then throw((("NFT " + asset.name) + " is not staked"))
323323 else {
324324 let owner = getStringValue(keyAssetIdToOwner(landAssetId))
325325 if ((owner != addr))
326326 then throw((LANDPREFIX + " is not yours"))
327327 else {
328328 let d = split(asset.description, "_")
329329 let landSize = d[recLandSize]
330330 let terrainCounts = countTerrains(d[recTerrains])
331331 let duck = getString(keyStakedDuckByOwner(addr))
332332 if (!(isDefined(duck)))
333333 then throw("You don't have a duck staked")
334334 else {
335335 let duckAssetIdStr = value(duck)
336336 let curLocation = valueOrElse(getString(keyDuckLocation(duckAssetIdStr)), DEFAULTLOCATION)
337337 let loc = split(value(curLocation), "_")
338338 if ((loc[locIdxType] != "L"))
339339 then throw((("Duck location type is " + loc[locIdxType]) + ", but should be L"))
340340 else if ((loc[locIdxId] != landAssetId))
341341 then throw(((("Duck location id is " + loc[locIdxId]) + ", but should be ") + landAssetId))
342342 else {
343343 let deltaTime = (lastBlock.timestamp - value(savedTime))
344344 if ((0 > deltaTime))
345345 then throw(((("Saved timestamp is in future, saved = " + toString(value(savedTime))) + ", current = ") + toString(lastBlock.timestamp)))
346346 else {
347347 let pieces = numPiecesBySize(landSize)
348348 let availRes = (fraction(deltaTime, DAILYRESBYPIECE, DAYMILLIS) * pieces)
349349 if ((amount > availRes))
350350 then throw(((("Not enough resources, available = " + toString(availRes)) + ", requested = ") + toString(amount)))
351351 else {
352352 let newDeltaTime = fraction((availRes - amount), DAYMILLIS, (pieces * DAILYRESBYPIECE))
353353 let newTimestamp = (lastBlock.timestamp - newDeltaTime)
354354 let bpKey = keyBackpackByDuck(duckAssetIdStr)
355355 let currentPack = split(valueOrElse(getString(bpKey), "0:0_0_0_0_0_0:0_0_0_0_0_0:"), ":")
356356 let currentRes = split(currentPack[bpIdxRes], "_")
357357 let bpRes = addRes(currentRes, terrainCounts, (deltaTime - newDeltaTime), (pieces / 25))
358358 let newPack = makeString([currentPack[bpIdxLevel], bpRes, currentPack[bpIdxMat], currentPack[bpIdxProd]], ":")
359359 $Tuple2([StringEntry(bpKey, newPack), IntegerEntry(timeKey, newTimestamp), IntegerEntry(keyStakedTimeByTypeAssetIdAndOwner(LANDPREFIX, landAssetId, owner), newTimestamp)], unit)
360360 }
361361 }
362362 }
363363 }
364364 }
365365 }
366366 }
367367 }
368368
369369
370370
371371 @Callable(i)
372372 func flight (message,sig) = if (!(sigVerify_8Kb(message, sig, pub)))
373373 then throw("signature does not match")
374374 else if ((size(i.payments) != 0))
375375 then throw("flight doesn't require any payments")
376376 else {
377377 let parts = split(toUtf8String(message), ";")
378378 let hp = split(split(parts[0], "|")[0], "_")
379379 let curHP = parseIntValue(hp[0])
380380 let newHP = parseIntValue(hp[1])
381381 let newLocAndTime = split(parts[1], ":")
382382 let newLocation = newLocAndTime[0]
383383 let time = parseIntValue(newLocAndTime[1])
384384 if (if ((time > (lastBlock.timestamp + FIVEMINUTESMILLIS)))
385385 then true
386386 else ((lastBlock.timestamp - FIVEMINUTESMILLIS) > time))
387387 then throw("signature outdated")
388388 else {
389389 let duckAssetId = valueOrErrorMessage(getString(keyStakedDuckByOwner(toString(i.caller))), "You don't have a duck staked")
390390 let keyHealth = keyDuckHealth(duckAssetId)
391391 let oldFromState = valueOrElse(getInteger(keyHealth), 100)
392392 if ((oldFromState != curHP))
393393 then throw(((("oldHealth=" + toString(valueOrElse(getInteger(keyHealth), 100))) + " from state does not match one from flight log=") + toString(curHP)))
394394 else if ((0 >= curHP))
395395 then throw("You can't fly with zero health")
396396 else {
397397 let locKey = keyDuckLocation(duckAssetId)
398398 let curLocation = valueOrElse(getString(locKey), DEFAULTLOCATION)
399399 if ((newLocation == curLocation))
400400 then throw("You can't fly to the same location")
401401 else $Tuple2([StringEntry(locKey, if ((newHP > 0))
402402 then newLocation
403403 else curLocation), IntegerEntry(keyHealth, newHP)], unit)
404404 }
405405 }
406406 }
407407
408408
409409
410410 @Callable(i)
411-func setHealth (health,duckAssetId) = if ((i.caller != this))
412- then throw("permission denied")
413- else if (if ((0 > health))
414- then true
415- else (health > 100))
416- then throw("HP should be within 0..100")
417- else [IntegerEntry(keyDuckHealth(duckAssetId), health)]
411+func setHealth (health,duckAssetId) = if (if ((0 > health))
412+ then true
413+ else (health > 100))
414+ then throw("HP should be within 0..100")
415+ else [IntegerEntry(keyDuckHealth(duckAssetId), health)]
418416
419417
420418
421419 @Callable(i)
422420 func heal (matType,amount) = if (if ((0 > matType))
423421 then true
424422 else (matType >= NUMRES))
425423 then throw(("Unknown material: " + toString(matType)))
426424 else if ((0 >= amount))
427425 then throw(("Amount should be positive! " + toString(amount)))
428426 else {
429427 let duckAssetId = valueOrErrorMessage(getString(keyStakedDuckByOwner(toString(i.caller))), "You don't have a duck staked")
430428 let keyHealth = keyDuckHealth(duckAssetId)
431429 let oldHealth = valueOrElse(getInteger(keyHealth), 100)
432430 if ((oldHealth >= 100))
433431 then throw("HP should be < 100 to heal")
434432 else {
435433 let bpKey = keyBackpackByDuck(duckAssetId)
436434 let currentPack = split(valueOrElse(getString(bpKey), "0:0_0_0_0_0_0:0_0_0_0_0_0:"), ":")
437435 let matList = split(currentPack[bpIdxMat], "_")
438436 let mList = if ((size(matList) != NUMRES))
439437 then ["0", "0", "0", "0", "0", "0"]
440438 else matList
441439 let currentAmount = parseIntValue(mList[matType])
442440 let deltaHealth = min([(amount / HEALCOST), (100 - oldHealth)])
443441 let spendAmount = (deltaHealth * HEALCOST)
444442 if ((spendAmount > currentAmount))
445443 then throw(((((("You need " + toString(spendAmount)) + " of ") + matTypes[matType]) + " to heal, but you backpack contains ") + toString(currentAmount)))
446444 else {
447445 let newMat = subOneInList(mList, matType, spendAmount)
448446 [IntegerEntry(keyHealth, (oldHealth + deltaHealth)), StringEntry(bpKey, makeString([currentPack[bpIdxLevel], currentPack[bpIdxRes], newMat, currentPack[bpIdxProd]], ":"))]
449447 }
450448 }
451449 }
452450
453451
454452
455453 @Callable(i)
456454 func updateBackpack (duckAssetId,newPack) = if ((i.caller != economyAddr))
457455 then throw("permission denied")
458456 else $Tuple2([StringEntry(keyBackpackByDuck(duckAssetId), newPack)], newPack)
459457
460458

github/deemru/w8io/169f3d6 
76.36 ms