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+4CO89YKZWpwdGN8kvabNgdYoDI3gkAAgECDVVua25vd24gY2hhaW4ADWluY3ViYXRvckFkZHIEByRtYXRjaDAFBWNoYWluAwkAAAICAVcFByRtYXRjaDAJARFAZXh0ck5hdGl2ZSgxMDYyKQECIzNQRWt0VnV4MlJoY2hTTjYzRHNEbzRiNG16NFFxektTZUR2AwkAAAICAVQFByRtYXRjaDAFBHRoaXMJAAIBAg1Vbmtub3duIGNoYWluAAticmVlZGVyQWRkcgQHJG1hdGNoMAUFY2hhaW4DCQAAAgIBVwUHJG1hdGNoMAkBEUBleHRyTmF0aXZlKDEwNjIpAQIjM1BEVnVVNDVIN0VoNWRt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3VycmVudFBhY2sFCWJwSWR4UHJvZAUDbmlsAgE6BQNuaWwBaQEOdXBkYXRlQmFja3BhY2sCC2R1Y2tBc3NldElkB25ld1BhY2sDCQECIT0CCAUBaQZjYWxsZXIFC2Vjb25vbXlBZGRyCQACAQIRcGVybWlzc2lvbiBkZW5pZWQJAJQKAgkAzAgCCQELU3RyaW5nRW50cnkCCQERa2V5QmFja3BhY2tCeUR1Y2sBBQtkdWNrQXNzZXRJZAUHbmV3UGFjawUDbmlsBQduZXdQYWNrAFvgcgw=", "height": 2360705, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GULLEXUBbfTbErtqqDXY8KNzgMdavh3myzqQFFKGkLH2 Next: EJUih26gnK7JcrYUpLPafmH4zxkW3wVuFYk7k8rQG4x6 Diff:
Old | New | Differences | |
---|---|---|---|
408 | 408 | ||
409 | 409 | ||
410 | 410 | @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)] | |
418 | 416 | ||
419 | 417 | ||
420 | 418 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let chain = toUtf8String(take(drop(this.bytes, 1), 1)) | |
5 | 5 | ||
6 | 6 | let usdnAssetId = match chain { | |
7 | 7 | case _ => | |
8 | 8 | if (("W" == $match0)) | |
9 | 9 | then base58'DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p' | |
10 | 10 | else if (("T" == $match0)) | |
11 | 11 | then base58'HezsdQuRDtzksAYUy97gfhKy7Z1NW2uXYSHA3bgqenNZ' | |
12 | 12 | else throw("Unknown chain") | |
13 | 13 | } | |
14 | 14 | ||
15 | 15 | let incubatorAddr = match chain { | |
16 | 16 | case _ => | |
17 | 17 | if (("W" == $match0)) | |
18 | 18 | then addressFromStringValue("3PEktVux2RhchSN63DsDo4b4mz4QqzKSeDv") | |
19 | 19 | else if (("T" == $match0)) | |
20 | 20 | then this | |
21 | 21 | else throw("Unknown chain") | |
22 | 22 | } | |
23 | 23 | ||
24 | 24 | let breederAddr = match chain { | |
25 | 25 | case _ => | |
26 | 26 | if (("W" == $match0)) | |
27 | 27 | then addressFromStringValue("3PDVuU45H7Eh5dmtNbnRNRStGwULA7NY6Hb") | |
28 | 28 | else if (("T" == $match0)) | |
29 | 29 | then this | |
30 | 30 | else throw("Unknown chain") | |
31 | 31 | } | |
32 | 32 | ||
33 | 33 | let economyAddr = match chain { | |
34 | 34 | case _ => | |
35 | 35 | if (("W" == $match0)) | |
36 | 36 | then addressFromStringValue("3P2sk1KncSxRaZs8b4CWGPw2jkvvav74u4D") | |
37 | 37 | else if (("T" == $match0)) | |
38 | 38 | then addressFromStringValue("3N8y4wxX3JC4TdrCJBXX16SjWf6X256hrep") | |
39 | 39 | else throw("Unknown chain") | |
40 | 40 | } | |
41 | 41 | ||
42 | 42 | let pub = base58'6LfPuKJjLgekmncBhMg2LZyMTNVzZBccXR28ySXm9uXD' | |
43 | 43 | ||
44 | 44 | let HEALCOST = 10000 | |
45 | 45 | ||
46 | 46 | let LANDPREFIX = "LAND" | |
47 | 47 | ||
48 | 48 | let DUCKPREFIX = "DUCK" | |
49 | 49 | ||
50 | 50 | let DEFAULTLOCATION = "Africa_F_Africa" | |
51 | 51 | ||
52 | 52 | let NUMRES = 6 | |
53 | 53 | ||
54 | 54 | let DAILYRESBYPIECE = 3456000 | |
55 | 55 | ||
56 | 56 | let DAYMILLIS = 86400000 | |
57 | 57 | ||
58 | 58 | let FIVEMINUTESMILLIS = 300000 | |
59 | 59 | ||
60 | 60 | let matTypes = ["Fuel", "Metal", "Plank", "Glass", "Plastic", "Protein"] | |
61 | 61 | ||
62 | 62 | func keyAssetIdToOwner (assetId) = ("nftOwner_" + assetId) | |
63 | 63 | ||
64 | 64 | ||
65 | 65 | func keyDuckIdToOwner (assetId) = ("duckOwner_" + assetId) | |
66 | 66 | ||
67 | 67 | ||
68 | 68 | func keyStakedTimeByAssetId (assetId) = ("stakedTime_" + assetId) | |
69 | 69 | ||
70 | 70 | ||
71 | 71 | func keyStakedDuckByOwner (ownerAddr) = ("stakedDuckByOwner_" + ownerAddr) | |
72 | 72 | ||
73 | 73 | ||
74 | 74 | func keyStakedTimeByTypeAssetIdAndOwner (nftType,assetId,ownerAddr) = ((((("stakedTimeByTypeAssetIdAndOwner_" + nftType) + "_") + assetId) + "_") + ownerAddr) | |
75 | 75 | ||
76 | 76 | ||
77 | 77 | func keyLandToOwner (landNum) = ("landOwner_" + landNum) | |
78 | 78 | ||
79 | 79 | ||
80 | 80 | func keyBackpackByDuck (duckAssetId) = ("backPack_" + duckAssetId) | |
81 | 81 | ||
82 | 82 | ||
83 | 83 | func keyDuckLocation (duckAssetId) = ("duckLocation_" + duckAssetId) | |
84 | 84 | ||
85 | 85 | ||
86 | 86 | func keyDuckHealth (duckAssetId) = ("duckHealth_" + duckAssetId) | |
87 | 87 | ||
88 | 88 | ||
89 | 89 | let recLandNum = 0 | |
90 | 90 | ||
91 | 91 | let recLandSize = 1 | |
92 | 92 | ||
93 | 93 | let recTerrains = 2 | |
94 | 94 | ||
95 | 95 | let recContinent = 3 | |
96 | 96 | ||
97 | 97 | let locIdxContinent = 0 | |
98 | 98 | ||
99 | 99 | let locIdxType = 1 | |
100 | 100 | ||
101 | 101 | let locIdxId = 2 | |
102 | 102 | ||
103 | 103 | let bpIdxLevel = 0 | |
104 | 104 | ||
105 | 105 | let bpIdxRes = 1 | |
106 | 106 | ||
107 | 107 | let bpIdxMat = 2 | |
108 | 108 | ||
109 | 109 | let bpIdxProd = 3 | |
110 | 110 | ||
111 | 111 | 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)] | |
112 | 112 | ||
113 | 113 | ||
114 | 114 | func numPiecesBySize (landSize) = match landSize { | |
115 | 115 | case _ => | |
116 | 116 | if (("S" == $match0)) | |
117 | 117 | then 25 | |
118 | 118 | else if (("M" == $match0)) | |
119 | 119 | then 100 | |
120 | 120 | else if (("L" == $match0)) | |
121 | 121 | then 225 | |
122 | 122 | else if (("XL" == $match0)) | |
123 | 123 | then 400 | |
124 | 124 | else if (("XXL" == $match0)) | |
125 | 125 | then 625 | |
126 | 126 | else throw("Unknown land size") | |
127 | 127 | } | |
128 | 128 | ||
129 | 129 | ||
130 | 130 | func subOneInList (aList,idx,amount) = { | |
131 | 131 | func subber (acc,i) = (acc :+ (if ((i == idx)) | |
132 | 132 | then toString((parseIntValue(aList[i]) - amount)) | |
133 | 133 | else aList[i])) | |
134 | 134 | ||
135 | 135 | let r = { | |
136 | 136 | let $l = [0, 1, 2, 3, 4, 5] | |
137 | 137 | let $s = size($l) | |
138 | 138 | let $acc0 = nil | |
139 | 139 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
140 | 140 | then $a | |
141 | 141 | else subber($a, $l[$i]) | |
142 | 142 | ||
143 | 143 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
144 | 144 | then $a | |
145 | 145 | else throw("List size exceeds 6") | |
146 | 146 | ||
147 | 147 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
148 | 148 | } | |
149 | 149 | makeString(r, "_") | |
150 | 150 | } | |
151 | 151 | ||
152 | 152 | ||
153 | 153 | func addRes (currentRes,terrainCounts,deltaTime,landSizeIndex) = { | |
154 | 154 | func adder (acc,i) = { | |
155 | 155 | let resOfType = ((fraction(deltaTime, DAILYRESBYPIECE, DAYMILLIS) * terrainCounts[i]) * landSizeIndex) | |
156 | 156 | (acc :+ toString((parseIntValue(currentRes[i]) + resOfType))) | |
157 | 157 | } | |
158 | 158 | ||
159 | 159 | let r = { | |
160 | 160 | let $l = [0, 1, 2, 3, 4, 5] | |
161 | 161 | let $s = size($l) | |
162 | 162 | let $acc0 = nil | |
163 | 163 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
164 | 164 | then $a | |
165 | 165 | else adder($a, $l[$i]) | |
166 | 166 | ||
167 | 167 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
168 | 168 | then $a | |
169 | 169 | else throw("List size exceeds 6") | |
170 | 170 | ||
171 | 171 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
172 | 172 | } | |
173 | 173 | makeString(r, "_") | |
174 | 174 | } | |
175 | 175 | ||
176 | 176 | ||
177 | 177 | @Callable(i) | |
178 | 178 | func stakeLand () = { | |
179 | 179 | let pmt = value(i.payments[0]) | |
180 | 180 | let assetId = value(pmt.assetId) | |
181 | 181 | let address = toString(i.caller) | |
182 | 182 | if ((pmt.amount != 1)) | |
183 | 183 | then throw((("NFT " + LANDPREFIX) + " token should be attached as payment")) | |
184 | 184 | else { | |
185 | 185 | let asset = value(assetInfo(assetId)) | |
186 | 186 | if ((asset.issuer != this)) | |
187 | 187 | then throw("Unknown issuer of token") | |
188 | 188 | else if (!(contains(asset.name, LANDPREFIX))) | |
189 | 189 | then throw((("Only NFT " + LANDPREFIX) + " tokens are accepted")) | |
190 | 190 | else { | |
191 | 191 | let landNumSize = drop(asset.name, 4) | |
192 | 192 | let landNum = if (contains(landNumSize, "XXL")) | |
193 | 193 | then dropRight(landNumSize, 3) | |
194 | 194 | else if (contains(landNumSize, "XL")) | |
195 | 195 | then dropRight(landNumSize, 2) | |
196 | 196 | else dropRight(landNumSize, 1) | |
197 | 197 | if (!(isDefined(parseInt(landNum)))) | |
198 | 198 | then throw(("Cannot parse land number from " + asset.name)) | |
199 | 199 | else { | |
200 | 200 | let timeKey = keyStakedTimeByAssetId(toBase58String(assetId)) | |
201 | 201 | if (isDefined(getInteger(timeKey))) | |
202 | 202 | then throw((("NFT " + asset.name) + " is already staked")) | |
203 | 203 | else [IntegerEntry(timeKey, lastBlock.timestamp), IntegerEntry(keyStakedTimeByTypeAssetIdAndOwner(LANDPREFIX, toBase58String(assetId), address), lastBlock.timestamp), StringEntry(keyAssetIdToOwner(toBase58String(assetId)), address), StringEntry(keyLandToOwner(landNum), address)] | |
204 | 204 | } | |
205 | 205 | } | |
206 | 206 | } | |
207 | 207 | } | |
208 | 208 | ||
209 | 209 | ||
210 | 210 | ||
211 | 211 | @Callable(i) | |
212 | 212 | func unstakeLand (landAssetId) = if ((size(i.payments) != 0)) | |
213 | 213 | then throw("unstake doesn't require any payments") | |
214 | 214 | else { | |
215 | 215 | let assetId = fromBase58String(landAssetId) | |
216 | 216 | let address = toString(i.caller) | |
217 | 217 | let asset = value(assetInfo(assetId)) | |
218 | 218 | if ((asset.issuer != this)) | |
219 | 219 | then throw("Unknown issuer of token") | |
220 | 220 | else if (!(contains(asset.name, LANDPREFIX))) | |
221 | 221 | then throw((("Only NFT " + LANDPREFIX) + " tokens can be unstaked")) | |
222 | 222 | else { | |
223 | 223 | let timeKey = keyStakedTimeByAssetId(landAssetId) | |
224 | 224 | if (!(isDefined(timeKey))) | |
225 | 225 | then throw((("NFT " + asset.name) + " is not staked")) | |
226 | 226 | else { | |
227 | 227 | let owner = valueOrErrorMessage(getString(keyAssetIdToOwner(landAssetId)), (("NFT " + asset.name) + " is orphaned")) | |
228 | 228 | if ((owner != address)) | |
229 | 229 | then throw("Staked NFT is not yours") | |
230 | 230 | else [ScriptTransfer(i.caller, 1, assetId), DeleteEntry(timeKey), DeleteEntry(keyStakedTimeByTypeAssetIdAndOwner(LANDPREFIX, landAssetId, address))] | |
231 | 231 | } | |
232 | 232 | } | |
233 | 233 | } | |
234 | 234 | ||
235 | 235 | ||
236 | 236 | ||
237 | 237 | @Callable(i) | |
238 | 238 | func stakeDuck () = { | |
239 | 239 | let pmt = value(i.payments[0]) | |
240 | 240 | let assetId = value(pmt.assetId) | |
241 | 241 | let address = toString(i.caller) | |
242 | 242 | if ((pmt.amount != 1)) | |
243 | 243 | then throw((("NFT " + DUCKPREFIX) + " token should be attached as payment")) | |
244 | 244 | else { | |
245 | 245 | let asset = value(assetInfo(assetId)) | |
246 | 246 | if (if ((asset.issuer != incubatorAddr)) | |
247 | 247 | then (asset.issuer != breederAddr) | |
248 | 248 | else false) | |
249 | 249 | then throw((("Unknown issuer of " + DUCKPREFIX) + " token")) | |
250 | 250 | else if (!(contains(asset.name, DUCKPREFIX))) | |
251 | 251 | then throw((("Only NFT " + DUCKPREFIX) + " tokens are accepted")) | |
252 | 252 | else { | |
253 | 253 | let assetIdStr = toBase58String(assetId) | |
254 | 254 | let timeKey = keyStakedTimeByAssetId(assetIdStr) | |
255 | 255 | if (isDefined(getInteger(timeKey))) | |
256 | 256 | then throw((("NFT " + asset.name) + " is already staked")) | |
257 | 257 | else if (isDefined(getString(keyStakedDuckByOwner(address)))) | |
258 | 258 | then throw(("You already staked one duck: " + asset.name)) | |
259 | 259 | else { | |
260 | 260 | let locKey = keyDuckLocation(assetIdStr) | |
261 | 261 | let location = getString(locKey) | |
262 | 262 | let keyHealth = keyDuckHealth(assetIdStr) | |
263 | 263 | let health = getInteger(keyHealth) | |
264 | 264 | let bpKey = keyBackpackByDuck(assetIdStr) | |
265 | 265 | let backpack = getString(bpKey) | |
266 | 266 | ([IntegerEntry(timeKey, lastBlock.timestamp), IntegerEntry(keyStakedTimeByTypeAssetIdAndOwner(DUCKPREFIX, toBase58String(assetId), address), lastBlock.timestamp), StringEntry(keyDuckIdToOwner(assetIdStr), address), StringEntry(keyStakedDuckByOwner(address), assetIdStr)] ++ (if (isDefined(location)) | |
267 | 267 | then nil | |
268 | 268 | else ([StringEntry(locKey, DEFAULTLOCATION)] ++ (if (isDefined(health)) | |
269 | 269 | then nil | |
270 | 270 | else ([IntegerEntry(keyHealth, 100)] ++ (if (isDefined(backpack)) | |
271 | 271 | then nil | |
272 | 272 | else [StringEntry(bpKey, "0:0_0_0_0_0_0:0_0_0_0_0_0:")])))))) | |
273 | 273 | } | |
274 | 274 | } | |
275 | 275 | } | |
276 | 276 | } | |
277 | 277 | ||
278 | 278 | ||
279 | 279 | ||
280 | 280 | @Callable(i) | |
281 | 281 | func unstakeDuck (assetIdStr) = if ((size(i.payments) != 0)) | |
282 | 282 | then throw("unstake doesn't require any payments") | |
283 | 283 | else { | |
284 | 284 | let assetId = fromBase58String(assetIdStr) | |
285 | 285 | let address = toString(i.caller) | |
286 | 286 | let asset = value(assetInfo(assetId)) | |
287 | 287 | if (if ((asset.issuer != incubatorAddr)) | |
288 | 288 | then (asset.issuer != breederAddr) | |
289 | 289 | else false) | |
290 | 290 | then throw((("Unknown issuer of " + DUCKPREFIX) + " token")) | |
291 | 291 | else if (!(contains(asset.name, DUCKPREFIX))) | |
292 | 292 | then throw((("Only NFT " + DUCKPREFIX) + " tokens can be unstaked")) | |
293 | 293 | else { | |
294 | 294 | let timeKey = keyStakedTimeByAssetId(toBase58String(assetId)) | |
295 | 295 | if (!(isDefined(timeKey))) | |
296 | 296 | then throw((("NFT " + asset.name) + " is not staked")) | |
297 | 297 | else if (!(isDefined(keyStakedDuckByOwner(address)))) | |
298 | 298 | then throw((("The duck " + asset.name) + " is not staked")) | |
299 | 299 | else { | |
300 | 300 | let owner = valueOrErrorMessage(getString(keyDuckIdToOwner(toBase58String(assetId))), (("NFT " + asset.name) + " is orphaned")) | |
301 | 301 | if ((owner != address)) | |
302 | 302 | then throw("Staked NFT is not yours") | |
303 | 303 | else [ScriptTransfer(i.caller, 1, assetId), DeleteEntry(timeKey), DeleteEntry(keyDuckLocation(assetIdStr)), DeleteEntry(keyStakedTimeByTypeAssetIdAndOwner(DUCKPREFIX, assetIdStr, address)), DeleteEntry(keyStakedDuckByOwner(address))] | |
304 | 304 | } | |
305 | 305 | } | |
306 | 306 | } | |
307 | 307 | ||
308 | 308 | ||
309 | 309 | ||
310 | 310 | @Callable(i) | |
311 | 311 | func claimRes (amount,landAssetId) = if ((size(i.payments) != 0)) | |
312 | 312 | then throw("claimRes doesn't require any payments") | |
313 | 313 | else { | |
314 | 314 | let addr = toString(i.caller) | |
315 | 315 | let asset = value(assetInfo(fromBase58String(landAssetId))) | |
316 | 316 | if (!(contains(asset.name, LANDPREFIX))) | |
317 | 317 | then throw((("NFT " + LANDPREFIX) + " token should be passed as param")) | |
318 | 318 | else { | |
319 | 319 | let timeKey = keyStakedTimeByAssetId(landAssetId) | |
320 | 320 | let savedTime = getInteger(timeKey) | |
321 | 321 | if (!(isDefined(savedTime))) | |
322 | 322 | then throw((("NFT " + asset.name) + " is not staked")) | |
323 | 323 | else { | |
324 | 324 | let owner = getStringValue(keyAssetIdToOwner(landAssetId)) | |
325 | 325 | if ((owner != addr)) | |
326 | 326 | then throw((LANDPREFIX + " is not yours")) | |
327 | 327 | else { | |
328 | 328 | let d = split(asset.description, "_") | |
329 | 329 | let landSize = d[recLandSize] | |
330 | 330 | let terrainCounts = countTerrains(d[recTerrains]) | |
331 | 331 | let duck = getString(keyStakedDuckByOwner(addr)) | |
332 | 332 | if (!(isDefined(duck))) | |
333 | 333 | then throw("You don't have a duck staked") | |
334 | 334 | else { | |
335 | 335 | let duckAssetIdStr = value(duck) | |
336 | 336 | let curLocation = valueOrElse(getString(keyDuckLocation(duckAssetIdStr)), DEFAULTLOCATION) | |
337 | 337 | let loc = split(value(curLocation), "_") | |
338 | 338 | if ((loc[locIdxType] != "L")) | |
339 | 339 | then throw((("Duck location type is " + loc[locIdxType]) + ", but should be L")) | |
340 | 340 | else if ((loc[locIdxId] != landAssetId)) | |
341 | 341 | then throw(((("Duck location id is " + loc[locIdxId]) + ", but should be ") + landAssetId)) | |
342 | 342 | else { | |
343 | 343 | let deltaTime = (lastBlock.timestamp - value(savedTime)) | |
344 | 344 | if ((0 > deltaTime)) | |
345 | 345 | then throw(((("Saved timestamp is in future, saved = " + toString(value(savedTime))) + ", current = ") + toString(lastBlock.timestamp))) | |
346 | 346 | else { | |
347 | 347 | let pieces = numPiecesBySize(landSize) | |
348 | 348 | let availRes = (fraction(deltaTime, DAILYRESBYPIECE, DAYMILLIS) * pieces) | |
349 | 349 | if ((amount > availRes)) | |
350 | 350 | then throw(((("Not enough resources, available = " + toString(availRes)) + ", requested = ") + toString(amount))) | |
351 | 351 | else { | |
352 | 352 | let newDeltaTime = fraction((availRes - amount), DAYMILLIS, (pieces * DAILYRESBYPIECE)) | |
353 | 353 | let newTimestamp = (lastBlock.timestamp - newDeltaTime) | |
354 | 354 | let bpKey = keyBackpackByDuck(duckAssetIdStr) | |
355 | 355 | let currentPack = split(valueOrElse(getString(bpKey), "0:0_0_0_0_0_0:0_0_0_0_0_0:"), ":") | |
356 | 356 | let currentRes = split(currentPack[bpIdxRes], "_") | |
357 | 357 | let bpRes = addRes(currentRes, terrainCounts, (deltaTime - newDeltaTime), (pieces / 25)) | |
358 | 358 | let newPack = makeString([currentPack[bpIdxLevel], bpRes, currentPack[bpIdxMat], currentPack[bpIdxProd]], ":") | |
359 | 359 | $Tuple2([StringEntry(bpKey, newPack), IntegerEntry(timeKey, newTimestamp), IntegerEntry(keyStakedTimeByTypeAssetIdAndOwner(LANDPREFIX, landAssetId, owner), newTimestamp)], unit) | |
360 | 360 | } | |
361 | 361 | } | |
362 | 362 | } | |
363 | 363 | } | |
364 | 364 | } | |
365 | 365 | } | |
366 | 366 | } | |
367 | 367 | } | |
368 | 368 | ||
369 | 369 | ||
370 | 370 | ||
371 | 371 | @Callable(i) | |
372 | 372 | func flight (message,sig) = if (!(sigVerify_8Kb(message, sig, pub))) | |
373 | 373 | then throw("signature does not match") | |
374 | 374 | else if ((size(i.payments) != 0)) | |
375 | 375 | then throw("flight doesn't require any payments") | |
376 | 376 | else { | |
377 | 377 | let parts = split(toUtf8String(message), ";") | |
378 | 378 | let hp = split(split(parts[0], "|")[0], "_") | |
379 | 379 | let curHP = parseIntValue(hp[0]) | |
380 | 380 | let newHP = parseIntValue(hp[1]) | |
381 | 381 | let newLocAndTime = split(parts[1], ":") | |
382 | 382 | let newLocation = newLocAndTime[0] | |
383 | 383 | let time = parseIntValue(newLocAndTime[1]) | |
384 | 384 | if (if ((time > (lastBlock.timestamp + FIVEMINUTESMILLIS))) | |
385 | 385 | then true | |
386 | 386 | else ((lastBlock.timestamp - FIVEMINUTESMILLIS) > time)) | |
387 | 387 | then throw("signature outdated") | |
388 | 388 | else { | |
389 | 389 | let duckAssetId = valueOrErrorMessage(getString(keyStakedDuckByOwner(toString(i.caller))), "You don't have a duck staked") | |
390 | 390 | let keyHealth = keyDuckHealth(duckAssetId) | |
391 | 391 | let oldFromState = valueOrElse(getInteger(keyHealth), 100) | |
392 | 392 | if ((oldFromState != curHP)) | |
393 | 393 | then throw(((("oldHealth=" + toString(valueOrElse(getInteger(keyHealth), 100))) + " from state does not match one from flight log=") + toString(curHP))) | |
394 | 394 | else if ((0 >= curHP)) | |
395 | 395 | then throw("You can't fly with zero health") | |
396 | 396 | else { | |
397 | 397 | let locKey = keyDuckLocation(duckAssetId) | |
398 | 398 | let curLocation = valueOrElse(getString(locKey), DEFAULTLOCATION) | |
399 | 399 | if ((newLocation == curLocation)) | |
400 | 400 | then throw("You can't fly to the same location") | |
401 | 401 | else $Tuple2([StringEntry(locKey, if ((newHP > 0)) | |
402 | 402 | then newLocation | |
403 | 403 | else curLocation), IntegerEntry(keyHealth, newHP)], unit) | |
404 | 404 | } | |
405 | 405 | } | |
406 | 406 | } | |
407 | 407 | ||
408 | 408 | ||
409 | 409 | ||
410 | 410 | @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)] | |
418 | 416 | ||
419 | 417 | ||
420 | 418 | ||
421 | 419 | @Callable(i) | |
422 | 420 | func heal (matType,amount) = if (if ((0 > matType)) | |
423 | 421 | then true | |
424 | 422 | else (matType >= NUMRES)) | |
425 | 423 | then throw(("Unknown material: " + toString(matType))) | |
426 | 424 | else if ((0 >= amount)) | |
427 | 425 | then throw(("Amount should be positive! " + toString(amount))) | |
428 | 426 | else { | |
429 | 427 | let duckAssetId = valueOrErrorMessage(getString(keyStakedDuckByOwner(toString(i.caller))), "You don't have a duck staked") | |
430 | 428 | let keyHealth = keyDuckHealth(duckAssetId) | |
431 | 429 | let oldHealth = valueOrElse(getInteger(keyHealth), 100) | |
432 | 430 | if ((oldHealth >= 100)) | |
433 | 431 | then throw("HP should be < 100 to heal") | |
434 | 432 | else { | |
435 | 433 | let bpKey = keyBackpackByDuck(duckAssetId) | |
436 | 434 | let currentPack = split(valueOrElse(getString(bpKey), "0:0_0_0_0_0_0:0_0_0_0_0_0:"), ":") | |
437 | 435 | let matList = split(currentPack[bpIdxMat], "_") | |
438 | 436 | let mList = if ((size(matList) != NUMRES)) | |
439 | 437 | then ["0", "0", "0", "0", "0", "0"] | |
440 | 438 | else matList | |
441 | 439 | let currentAmount = parseIntValue(mList[matType]) | |
442 | 440 | let deltaHealth = min([(amount / HEALCOST), (100 - oldHealth)]) | |
443 | 441 | let spendAmount = (deltaHealth * HEALCOST) | |
444 | 442 | if ((spendAmount > currentAmount)) | |
445 | 443 | then throw(((((("You need " + toString(spendAmount)) + " of ") + matTypes[matType]) + " to heal, but you backpack contains ") + toString(currentAmount))) | |
446 | 444 | else { | |
447 | 445 | let newMat = subOneInList(mList, matType, spendAmount) | |
448 | 446 | [IntegerEntry(keyHealth, (oldHealth + deltaHealth)), StringEntry(bpKey, makeString([currentPack[bpIdxLevel], currentPack[bpIdxRes], newMat, currentPack[bpIdxProd]], ":"))] | |
449 | 447 | } | |
450 | 448 | } | |
451 | 449 | } | |
452 | 450 | ||
453 | 451 | ||
454 | 452 | ||
455 | 453 | @Callable(i) | |
456 | 454 | func updateBackpack (duckAssetId,newPack) = if ((i.caller != economyAddr)) | |
457 | 455 | then throw("permission denied") | |
458 | 456 | else $Tuple2([StringEntry(keyBackpackByDuck(duckAssetId), newPack)], newPack) | |
459 | 457 | ||
460 | 458 |
github/deemru/w8io/169f3d6 76.36 ms ◑