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