tx · 4KpgZEacQWBKTx5XuKYMV8ozCx4eyjS4VDDQvRkuGtfZ 3MumkGGztCKAXpWDqxkddofqXSUbqQkvSJy: -0.04900000 Waves 2023.04.28 18:32 [2554601] smart account 3MumkGGztCKAXpWDqxkddofqXSUbqQkvSJy > SELF 0.00000000 Waves
{ "type": 13, "id": "4KpgZEacQWBKTx5XuKYMV8ozCx4eyjS4VDDQvRkuGtfZ", "fee": 4900000, "feeAssetId": null, "timestamp": 1682695943273, "version": 2, "chainId": 84, "sender": "3MumkGGztCKAXpWDqxkddofqXSUbqQkvSJy", "senderPublicKey": "C3PaRKeL8AUKbwUqdniMQtThgcTh5DYHV1777Hkxy7rp", "proofs": [ "4ab7KvAB9SDbziMD3okmZLv7tBbNTP2Yo3NMckvsoiSELByvux38kyMYuTJxd4xox7Xm38bQiVwUtvXxQYrvs5uh" ], "script": "base64:BgKCAQgCEgMKAQgSAwoBBBIAEgMKAQgSABIDCgEIEgQKAgEIEgQKAgEIEgQKAgICEgQKAgEIEgQKAgEBEgQKAggIEgASBAoCAgISAwoBCBIDCgEIEgQKAggIEgMKARgSAwoBGBIECgIICBIECgIICBIDCgEBEgUKAwEBCBIDCgEIEgMKAQiDAQAFY2hhaW4JAMkBAgkAygECCAUEdGhpcwVieXRlcwABAAEAC3VzZG5Bc3NldElkBAckbWF0Y2gwBQVjaGFpbgMJAAACAQFXBQckbWF0Y2gwASC2JinDBPXOU5GkDkt1JC9kjFGx+t+vVCm9SNIdKrKq0QMJAAACAQFUBQckbWF0Y2gwASD3dur394PKZdtuE+4CO89YKZWpwdGN8kvabNgdYoDI3gkAAgECDVVua25vd24gY2hhaW4ADWluY3ViYXRvckFkZHIEByRtYXRjaDAFBWNoYWluAwkAAAIBAVcFByRtYXRjaDAJARFAZXh0ck5hdGl2ZSgxMDYyKQECIzNQRWt0VnV4MlJoY2hTTjYzRHNEbzRiNG16NFFxektTZUR2AwkAAAIBAVQFByRtYXRjaDAFBHRoaXMJAAIBAg1Vbmtub3du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5R2xvYmFsQW5kTG9jYWxXZWlnaHRzUkVBRE9OTFkDCW1hdEFtb3VudAlyZXNBbW91bnQIdGVycmFpbnMEDXRlcnJhaW5Db3VudHMJAQ1jb3VudFRlcnJhaW5zAQUIdGVycmFpbnMJAJQKAgUDbmlsCQCUCgIJARJnZXROZWVkZWRNYXRlcmlhbHMBBQltYXRBbW91bnQJARNkaXN0cmlidXRlQnlXZWlnaHRzAgUJcmVzQW1vdW50BQ10ZXJyYWluQ291bnRzAWkBE2dldEJhY2twYWNrUkVBRE9OTFkBC2R1Y2tBc3NldElkCQCUCgIFA25pbAkAuQkCCQELZ2V0QmFja3BhY2sBCQERa2V5QmFja3BhY2tCeUR1Y2sBBQtkdWNrQXNzZXRJZAIBOgFpARRnZXRXYXJlaG91c2VSRUFET05MWQELbGFuZEFzc2V0SWQEBWFzc2V0CQEFdmFsdWUBCQDsBwEJANkEAQULbGFuZEFzc2V0SWQECWxhbmRJbmRleAkAaQIJAQ9udW1QaWVjZXNCeVNpemUBCQCRAwIJALUJAggFBWFzc2V0C2Rlc2NyaXB0aW9uAgFfBQtyZWNMYW5kU2l6ZQUFU1NJWkUECmluZnJhTGV2ZWwJAQt2YWx1ZU9yRWxzZQIJAJ8IAQkBFmtleUluZnJhTGV2ZWxCeUFzc2V0SWQBBQtsYW5kQXNzZXRJZAAACQCUCgIFA25pbAkAugkCCQEMZ2V0V2FyZWhvdXNlAwkBEmtleVdhcmVob3VzZUJ5TGFuZAEFC2xhbmRBc3NldElkBQlsYW5kSW5kZXgFCmluZnJhTGV2ZWwCAToAphZRzA==", "height": 2554601, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GMztVU1UGs47gWWrzZPHbNWT37VriqxfGne8oFTushLe Next: 7Lm3otfM7HtFLCKF4piqiXURHigf2vkmSqVAXG9787bV Diff:
Old | New | Differences | |
---|---|---|---|
12 | 12 | else throw("Unknown chain") | |
13 | 13 | } | |
14 | 14 | ||
15 | - | let | |
15 | + | let incubatorAddr = match chain { | |
16 | 16 | case _ => | |
17 | 17 | if ((base58'2W' == $match0)) | |
18 | - | then | |
18 | + | then addressFromStringValue("3PEktVux2RhchSN63DsDo4b4mz4QqzKSeDv") | |
19 | 19 | else if ((base58'2T' == $match0)) | |
20 | - | then | |
20 | + | then this | |
21 | 21 | else throw("Unknown chain") | |
22 | 22 | } | |
23 | + | ||
24 | + | let breederAddr = match chain { | |
25 | + | case _ => | |
26 | + | if ((base58'2W' == $match0)) | |
27 | + | then addressFromStringValue("3PDVuU45H7Eh5dmtNbnRNRStGwULA7NY6Hb") | |
28 | + | else if ((base58'2T' == $match0)) | |
29 | + | then this | |
30 | + | else throw("Unknown chain") | |
31 | + | } | |
32 | + | ||
33 | + | let defaultRestAddressStr = match chain { | |
34 | + | case _ => | |
35 | + | if ((base58'2W' == $match0)) | |
36 | + | then "3PQCuvFbvh4LkPUnrnU1z3jnbA1p9m3WNhv" | |
37 | + | else if ((base58'2T' == $match0)) | |
38 | + | then "3MumkGGztCKAXpWDqxkddofqXSUbqQkvSJy" | |
39 | + | else throw("Unknown chain") | |
40 | + | } | |
41 | + | ||
42 | + | let pub = base58'6LfPuKJjLgekmncBhMg2LZyMTNVzZBccXR28ySXm9uXD' | |
43 | + | ||
44 | + | let HEALCOST = 10000 | |
23 | 45 | ||
24 | 46 | let LANDPREFIX = "LAND" | |
25 | 47 | ||
26 | 48 | let DUCKPREFIX = "DUCK" | |
27 | 49 | ||
28 | - | let SEP = "__" | |
29 | - | ||
30 | - | let ARTPRESALE = "PRESALE" | |
31 | - | ||
32 | - | let DAILYRESBYPIECE = 3456000 | |
33 | - | ||
34 | - | let DAYMILLIS = 86400000 | |
50 | + | let DEFAULTLOCATION = "Africa_F_Africa" | |
35 | 51 | ||
36 | 52 | let NUMRES = 6 | |
37 | 53 | ||
45 | 61 | ||
46 | 62 | let XXLSIZE = 625 | |
47 | 63 | ||
48 | - | let | |
64 | + | let DAILYRESBYPIECE = 3456000 | |
49 | 65 | ||
50 | - | let | |
66 | + | let DAYMILLIS = 86400000 | |
51 | 67 | ||
52 | - | let | |
68 | + | let FIVEMINUTESMILLIS = 300000 | |
53 | 69 | ||
54 | - | let | |
70 | + | let RESOURCEPRICEMIN = 158549 | |
55 | 71 | ||
56 | - | let | |
72 | + | let WHMULTIPLIER = 10000000000 | |
57 | 73 | ||
58 | - | let whIdxRes = 1 | |
74 | + | let InfraUpgradeCostS = match chain { | |
75 | + | case _ => | |
76 | + | if ((base58'2W' == $match0)) | |
77 | + | then 6307198406 | |
78 | + | else if ((base58'2T' == $match0)) | |
79 | + | then 63071984 | |
80 | + | else throw("Unknown chain") | |
81 | + | } | |
59 | 82 | ||
60 | - | let whIdxMat = 2 | |
83 | + | let InfraUpgradeCostSUsdn = match chain { | |
84 | + | case _ => | |
85 | + | if ((base58'2W' == $match0)) | |
86 | + | then 40000000 | |
87 | + | else if ((base58'2T' == $match0)) | |
88 | + | then 400000 | |
89 | + | else throw("Unknown chain") | |
90 | + | } | |
61 | 91 | ||
62 | - | let whIdxProd = 3 | |
92 | + | let EXPMATERIALS = match chain { | |
93 | + | case _ => | |
94 | + | if ((base58'2W' == $match0)) | |
95 | + | then 157679960139 | |
96 | + | else if ((base58'2T' == $match0)) | |
97 | + | then 1576799601 | |
98 | + | else throw("Unknown chain") | |
99 | + | } | |
63 | 100 | ||
64 | - | let whIdxLockedVol = 4 | |
101 | + | let EXPUSDN = match chain { | |
102 | + | case _ => | |
103 | + | if ((base58'2W' == $match0)) | |
104 | + | then 1000000000 | |
105 | + | else if ((base58'2T' == $match0)) | |
106 | + | then 10000000 | |
107 | + | else throw("Unknown chain") | |
108 | + | } | |
65 | 109 | ||
66 | - | func keyRestCfg () = "%s__restConfig" | |
110 | + | let SEP = "__" | |
111 | + | ||
112 | + | let MULT6 = 1000000 | |
113 | + | ||
114 | + | let FIVEX = toBigInt(5) | |
115 | + | ||
116 | + | let TWENTYX = toBigInt(20) | |
117 | + | ||
118 | + | let TWENTY2X = toBigInt((20 * 20)) | |
119 | + | ||
120 | + | let TWENTY3X = toBigInt(((20 * 20) * 20)) | |
121 | + | ||
122 | + | let TWENTY4X = toBigInt((((20 * 20) * 20) * 20)) | |
123 | + | ||
124 | + | let TWENTY5X = toBigInt(((((20 * 20) * 20) * 20) * 20)) | |
125 | + | ||
126 | + | let matTypes = ["Fuel", "Metal", "Plank", "Glass", "Plastic", "Protein"] | |
127 | + | ||
128 | + | let continents = ["Asia", "Europe", "Americas", "Oceania", "Africa"] | |
129 | + | ||
130 | + | let ARTPRESALE = "PRESALE" | |
131 | + | ||
132 | + | let PRESALENUMLANDS = 500 | |
133 | + | ||
134 | + | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
135 | + | ||
136 | + | ||
137 | + | func getIntOrElse (key,defaultVal) = valueOrElse(getInteger(this, key), defaultVal) | |
67 | 138 | ||
68 | 139 | ||
69 | 140 | let IdxCfgStakingDapp = 1 | |
72 | 143 | ||
73 | 144 | let IdxCfgGovernanceDapp = 3 | |
74 | 145 | ||
75 | - | func | |
146 | + | func keyRestCfg () = "%s__restConfig" | |
76 | 147 | ||
77 | 148 | ||
78 | - | func readRestCfgOrFail () = split_4C(getStringOrFail(this, keyRestCfg()), SEP) | |
149 | + | func keyRestAddress () = "%s__restAddr" | |
150 | + | ||
151 | + | ||
152 | + | func readRestCfgOrFail (rest) = split_4C(getStringOrFail(rest, keyRestCfg()), SEP) | |
79 | 153 | ||
80 | 154 | ||
81 | 155 | func getContractAddressOrFail (restCfg,idx) = valueOrErrorMessage(addressFromString(restCfg[idx]), ("Rest cfg doesn't contain address at index " + toString(idx))) | |
82 | 156 | ||
83 | 157 | ||
84 | - | let | |
158 | + | let restContract = addressFromStringValue(valueOrElse(getString(this, keyRestAddress()), defaultRestAddressStr)) | |
85 | 159 | ||
86 | - | let | |
160 | + | let restCfg = readRestCfgOrFail(restContract) | |
87 | 161 | ||
88 | 162 | let economyContract = getContractAddressOrFail(restCfg, IdxCfgEconomyDapp) | |
89 | 163 | ||
90 | - | let | |
164 | + | let govContract = getContractAddressOrFail(restCfg, IdxCfgGovernanceDapp) | |
91 | 165 | ||
92 | - | func keyBlocked () = "contractsBlocked" | |
166 | + | func keyLastTxIdByUser (addr) = ("lastTxIdByUser_" + addr) | |
167 | + | ||
168 | + | ||
169 | + | func keyNextFreeLandNum () = "nextLandNum" | |
170 | + | ||
171 | + | ||
172 | + | func keyLandToAssetId (landNum) = ("landToAsset_" + landNum) | |
173 | + | ||
174 | + | ||
175 | + | func keyNftName (landNum,landSize) = ((LANDPREFIX + landNum) + landSize) | |
176 | + | ||
177 | + | ||
178 | + | func keyLandAssetIdToOwner (assetId) = ("nftOwner_" + assetId) | |
93 | 179 | ||
94 | 180 | ||
95 | 181 | func keyDuckIdToOwner (assetId) = ("duckOwner_" + assetId) | |
98 | 184 | func keyStakedTimeByAssetId (assetId) = ("stakedTime_" + assetId) | |
99 | 185 | ||
100 | 186 | ||
187 | + | func keyInfraLevelByAssetId (assetId) = ("infraLevel_" + assetId) | |
188 | + | ||
189 | + | ||
190 | + | func keyInfraLevelByAssetIdAndOwner (assetId,ownerAddr) = ((("infraLevelByAssetIdAndOwner_" + assetId) + "_") + ownerAddr) | |
191 | + | ||
192 | + | ||
193 | + | func keyPresaleArtActivatedByAssetId (assetId) = ("presaleArtActivated_" + assetId) | |
194 | + | ||
195 | + | ||
196 | + | func keyPresaleArtActivatedByAssetIdAndOwner (assetId,ownerAddr) = ((("presaleArtActivatedByAssetIdAndOwner_" + assetId) + "_") + ownerAddr) | |
197 | + | ||
198 | + | ||
199 | + | func keyLandArtStatusByTypeAndAssetId (type,assetId) = makeString(["landArtStatus", type, assetId], "_") | |
200 | + | ||
201 | + | ||
202 | + | func keyLandArtStatusByTypeAssetIdAndOwner (type,assetId,ownerAddr) = makeString(["landArtStatusByTypeAssetIdAndOwner", type, assetId, ownerAddr], "_") | |
203 | + | ||
204 | + | ||
101 | 205 | func keyStakedDuckByOwner (ownerAddr) = ("stakedDuckByOwner_" + ownerAddr) | |
102 | 206 | ||
103 | 207 | ||
104 | 208 | func keyStakedTimeByTypeAssetIdAndOwner (nftType,assetId,ownerAddr) = ((((("stakedTimeByTypeAssetIdAndOwner_" + nftType) + "_") + assetId) + "_") + ownerAddr) | |
209 | + | ||
210 | + | ||
211 | + | func keyLandNumToOwner (landNum) = ("landOwner_" + landNum) | |
105 | 212 | ||
106 | 213 | ||
107 | 214 | func keyBackpackByDuck (duckAssetId) = ("backPack_" + duckAssetId) | |
116 | 223 | func keyDuckHealth (duckAssetId) = ("duckHealth_" + duckAssetId) | |
117 | 224 | ||
118 | 225 | ||
119 | - | func keyLandAssetIdToOwner (assetId) = ("nftOwner_" + assetId) | |
120 | - | ||
121 | - | ||
122 | - | func keyInfraLevelByAssetId (assetId) = ("infraLevel_" + assetId) | |
123 | - | ||
124 | - | ||
125 | - | func keyLandArtStatusByTypeAndAssetId (type,assetId) = makeString(["landArtStatus", type, assetId], "_") | |
126 | - | ||
127 | - | ||
128 | - | func keyPresaleArtActivatedByAssetId (assetId) = ("presaleArtActivated_" + assetId) | |
226 | + | func keyResProportions () = "resTypesProportions" | |
129 | 227 | ||
130 | 228 | ||
131 | 229 | func keyStakedLandsByOwner (ownerAddr) = ("stakedLandsByOwner_" + ownerAddr) | |
132 | 230 | ||
133 | 231 | ||
134 | - | func | |
232 | + | func keyBlocked () = "contractsBlocked" | |
135 | 233 | ||
234 | + | ||
235 | + | func keyUserGwlReleaseTime (userAddr) = ("%s%s__userGwlReleaseTime__" + userAddr) | |
236 | + | ||
237 | + | ||
238 | + | let recLandNum = 0 | |
239 | + | ||
240 | + | let recLandSize = 1 | |
241 | + | ||
242 | + | let recTerrains = 2 | |
243 | + | ||
244 | + | let recContinent = 3 | |
245 | + | ||
246 | + | let locIdxContinent = 0 | |
247 | + | ||
248 | + | let locIdxType = 1 | |
249 | + | ||
250 | + | let locIdxId = 2 | |
251 | + | ||
252 | + | let bpIdxLevel = 0 | |
253 | + | ||
254 | + | let bpIdxRes = 1 | |
255 | + | ||
256 | + | let bpIdxMat = 2 | |
257 | + | ||
258 | + | let bpIdxProd = 3 | |
259 | + | ||
260 | + | let whIdxVol = 0 | |
261 | + | ||
262 | + | let whIdxRes = 1 | |
263 | + | ||
264 | + | let whIdxMat = 2 | |
265 | + | ||
266 | + | let whIdxProd = 3 | |
267 | + | ||
268 | + | let whIdxLockedVol = 4 | |
269 | + | ||
270 | + | let claimModeWh = 0 | |
271 | + | ||
272 | + | let claimModeDuck = 1 | |
273 | + | ||
274 | + | let claimModeWhThenDuck = 2 | |
136 | 275 | ||
137 | 276 | func asString (v) = match v { | |
138 | 277 | case s: String => | |
142 | 281 | } | |
143 | 282 | ||
144 | 283 | ||
145 | - | func asBoolean (v) = match v { | |
146 | - | case s: Boolean => | |
147 | - | s | |
148 | - | case _ => | |
149 | - | throw("fail to cast into Boolean") | |
150 | - | } | |
284 | + | func distributeByWeights (total,weights) = { | |
285 | + | let sum = (((((weights[0] + weights[1]) + weights[2]) + weights[3]) + weights[4]) + weights[5]) | |
286 | + | if ((0 >= sum)) | |
287 | + | then throw("Zero weights sum") | |
288 | + | else { | |
289 | + | let norm6 = fraction(total, MULT6, sum) | |
290 | + | func normalizer (acc,elem) = (acc :+ fraction(elem, norm6, MULT6)) | |
151 | 291 | ||
292 | + | let $l = weights | |
293 | + | let $s = size($l) | |
294 | + | let $acc0 = nil | |
295 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
296 | + | then $a | |
297 | + | else normalizer($a, $l[$i]) | |
152 | 298 | ||
153 | - | func asListIntCompacted (val) = match val { | |
154 | - | case valAnyList: List[Any] => | |
155 | - | if ((size(valAnyList) != NUMRES)) | |
156 | - | then throw(("Array size is " + toString(size(valAnyList)))) | |
157 | - | else { | |
158 | - | func conv (acc,item) = match item { | |
159 | - | case it: Int => | |
160 | - | (acc :+ toString(it)) | |
161 | - | case _ => | |
162 | - | throw("List type is not Int") | |
163 | - | } | |
299 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
300 | + | then $a | |
301 | + | else throw("List size exceeds 6") | |
164 | 302 | ||
165 | - | let r = { | |
166 | - | let $l = valAnyList | |
167 | - | let $s = size($l) | |
168 | - | let $acc0 = nil | |
169 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
170 | - | then $a | |
171 | - | else conv($a, $l[$i]) | |
172 | - | ||
173 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
174 | - | then $a | |
175 | - | else throw("List size exceeds 6") | |
176 | - | ||
177 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
178 | - | } | |
179 | - | makeString(r, "_") | |
180 | - | } | |
181 | - | case _ => | |
182 | - | throw("fail to cast into List") | |
183 | - | } | |
184 | - | ||
185 | - | ||
186 | - | func asSplitResult (val) = match val { | |
187 | - | case t2: (List[Any], List[Any]) => | |
188 | - | $Tuple2(asListIntCompacted(t2._1), asListIntCompacted(t2._2)) | |
189 | - | case _ => | |
190 | - | throw("fail to cast into (List, List)") | |
191 | - | } | |
192 | - | ||
193 | - | ||
194 | - | func walletInternal (userAddressOpt) = { | |
195 | - | let addr = addressFromString(userAddressOpt) | |
196 | - | let balance = if (isDefined(addr)) | |
197 | - | then wavesBalance(value(addr)) | |
198 | - | else BalanceDetails(0, 0, 0, 0) | |
199 | - | let usdnBalance = if (isDefined(addr)) | |
200 | - | then assetBalance(value(addr), usdnAssetId) | |
201 | - | else 0 | |
202 | - | makeString(["%s%d%d", "wallet", toString(balance.available), toString(usdnBalance)], SEP) | |
303 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
304 | + | } | |
203 | 305 | } | |
204 | 306 | ||
205 | 307 | ||
206 | - | func applyBonuses (landAssetId,pieces) = { | |
207 | - | let infraLevel = valueOrElse(getInteger(stakingContract, keyInfraLevelByAssetId(landAssetId)), 0) | |
208 | - | let artPieces = valueOrElse(getInteger(stakingContract, keyLandArtStatusByTypeAndAssetId(ARTPRESALE, landAssetId)), if (valueOrElse(getBoolean(stakingContract, keyPresaleArtActivatedByAssetId(landAssetId)), false)) | |
209 | - | then pieces | |
210 | - | else 0) | |
211 | - | $Tuple3(infraLevel, artPieces, ((DAILYRESBYPIECE + fraction(DAILYRESBYPIECE, infraLevel, 4)) + fraction(DAILYRESBYPIECE, (artPieces * 3), (pieces * 20)))) | |
308 | + | func getNeededMaterials (total) = { | |
309 | + | let props = split(value(getString(keyResProportions())), "_") | |
310 | + | if ((size(props) != NUMRES)) | |
311 | + | then throw("Wrong proportions data") | |
312 | + | else { | |
313 | + | let r = [parseIntValue(props[0]), parseIntValue(props[1]), parseIntValue(props[2]), parseIntValue(props[3]), parseIntValue(props[4]), parseIntValue(props[5])] | |
314 | + | distributeByWeights(total, r) | |
315 | + | } | |
212 | 316 | } | |
317 | + | ||
318 | + | ||
319 | + | func subtractMaterials (shouldUseMat,has,totalNeed) = { | |
320 | + | let need = getNeededMaterials(totalNeed) | |
321 | + | func subtractor (acc,idx) = { | |
322 | + | let result = (parseIntValue(has[idx]) - need[idx]) | |
323 | + | if ((0 > result)) | |
324 | + | then throw(((((("Not enough material idx=" + toString(idx)) + ", you have ") + has[idx]) + ", but need ") + toString(need[idx]))) | |
325 | + | else (acc :+ toString(result)) | |
326 | + | } | |
327 | + | ||
328 | + | if (shouldUseMat) | |
329 | + | then { | |
330 | + | let $l = [0, 1, 2, 3, 4, 5] | |
331 | + | let $s = size($l) | |
332 | + | let $acc0 = nil | |
333 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
334 | + | then $a | |
335 | + | else subtractor($a, $l[$i]) | |
336 | + | ||
337 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
338 | + | then $a | |
339 | + | else throw("List size exceeds 6") | |
340 | + | ||
341 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
342 | + | } | |
343 | + | else has | |
344 | + | } | |
345 | + | ||
346 | + | ||
347 | + | func updateProportionsInternal (propList,terrainCounts,landSizeIndex,sign) = if ((size(propList) != NUMRES)) | |
348 | + | then throw("Wrong proportions data") | |
349 | + | else { | |
350 | + | func updater (acc,i) = { | |
351 | + | let result = (parseIntValue(propList[i]) + ((sign * terrainCounts[i]) * landSizeIndex)) | |
352 | + | if ((0 > result)) | |
353 | + | then throw(((((((("Panic! Pieces of type=" + toString(i)) + ", sign=") + toString(sign)) + ", terrainCounts[i]=") + toString(terrainCounts[i])) + ", landSizeIndex=") + toString(landSizeIndex))) | |
354 | + | else (acc :+ toString(result)) | |
355 | + | } | |
356 | + | ||
357 | + | let r = { | |
358 | + | let $l = [0, 1, 2, 3, 4, 5] | |
359 | + | let $s = size($l) | |
360 | + | let $acc0 = nil | |
361 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
362 | + | then $a | |
363 | + | else updater($a, $l[$i]) | |
364 | + | ||
365 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
366 | + | then $a | |
367 | + | else throw("List size exceeds 6") | |
368 | + | ||
369 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
370 | + | } | |
371 | + | makeString(r, "_") | |
372 | + | } | |
373 | + | ||
374 | + | ||
375 | + | func updateProportions (terrainCounts,landSizeIndex,sign) = { | |
376 | + | let propList = split(valueOrElse(getString(keyResProportions()), "0_0_0_0_0_0"), "_") | |
377 | + | updateProportionsInternal(propList, terrainCounts, landSizeIndex, sign) | |
378 | + | } | |
379 | + | ||
380 | + | ||
381 | + | 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)] | |
213 | 382 | ||
214 | 383 | ||
215 | 384 | func numPiecesBySize (landSize) = match landSize { | |
228 | 397 | } | |
229 | 398 | ||
230 | 399 | ||
400 | + | func subOneInList (aList,idx,amount) = { | |
401 | + | func subber (acc,i) = (acc :+ (if ((i == idx)) | |
402 | + | then toString((parseIntValue(aList[i]) - amount)) | |
403 | + | else aList[i])) | |
404 | + | ||
405 | + | let r = { | |
406 | + | let $l = [0, 1, 2, 3, 4, 5] | |
407 | + | let $s = size($l) | |
408 | + | let $acc0 = nil | |
409 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
410 | + | then $a | |
411 | + | else subber($a, $l[$i]) | |
412 | + | ||
413 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
414 | + | then $a | |
415 | + | else throw("List size exceeds 6") | |
416 | + | ||
417 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
418 | + | } | |
419 | + | makeString(r, "_") | |
420 | + | } | |
421 | + | ||
422 | + | ||
423 | + | func addRes (currentRes,terrainCounts,deltaTime,landSizeIndex,dailyByPieceWithBonuses) = { | |
424 | + | func adder (acc,i) = { | |
425 | + | let resOfType = ((fraction(deltaTime, dailyByPieceWithBonuses, DAYMILLIS) * terrainCounts[i]) * landSizeIndex) | |
426 | + | (acc :+ toString((parseIntValue(currentRes[i]) + resOfType))) | |
427 | + | } | |
428 | + | ||
429 | + | let r = { | |
430 | + | let $l = [0, 1, 2, 3, 4, 5] | |
431 | + | let $s = size($l) | |
432 | + | let $acc0 = nil | |
433 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
434 | + | then $a | |
435 | + | else adder($a, $l[$i]) | |
436 | + | ||
437 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
438 | + | then $a | |
439 | + | else throw("List size exceeds 6") | |
440 | + | ||
441 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
442 | + | } | |
443 | + | makeString(r, "_") | |
444 | + | } | |
445 | + | ||
446 | + | ||
447 | + | func virtClaim (terrainCounts,deltaTime,landSizeIndex,dailyByPieceWithBonuses) = { | |
448 | + | func adder (acc,i) = { | |
449 | + | let resOfType = ((fraction(deltaTime, dailyByPieceWithBonuses, DAYMILLIS) * terrainCounts[i]) * landSizeIndex) | |
450 | + | $Tuple2((acc._1 :+ resOfType), (acc._2 + resOfType)) | |
451 | + | } | |
452 | + | ||
453 | + | let $l = [0, 1, 2, 3, 4, 5] | |
454 | + | let $s = size($l) | |
455 | + | let $acc0 = $Tuple2(nil, 0) | |
456 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
457 | + | then $a | |
458 | + | else adder($a, $l[$i]) | |
459 | + | ||
460 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
461 | + | then $a | |
462 | + | else throw("List size exceeds 6") | |
463 | + | ||
464 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
465 | + | } | |
466 | + | ||
467 | + | ||
468 | + | func distributeRes (currentWhRes,currentPackRes,resToClaim,whSpaceLeft) = { | |
469 | + | let resListToClaim = resToClaim._1 | |
470 | + | let resAmToClaim = resToClaim._2 | |
471 | + | if ((resAmToClaim == 0)) | |
472 | + | then $Tuple2(makeString(currentWhRes, "_"), makeString(currentPackRes, "_")) | |
473 | + | else if ((whSpaceLeft >= resAmToClaim)) | |
474 | + | then { | |
475 | + | func addLists (acc,i) = (acc :+ toString((parseIntValue(currentWhRes[i]) + resListToClaim[i]))) | |
476 | + | ||
477 | + | let r = { | |
478 | + | let $l = [0, 1, 2, 3, 4, 5] | |
479 | + | let $s = size($l) | |
480 | + | let $acc0 = nil | |
481 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
482 | + | then $a | |
483 | + | else addLists($a, $l[$i]) | |
484 | + | ||
485 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
486 | + | then $a | |
487 | + | else throw("List size exceeds 6") | |
488 | + | ||
489 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
490 | + | } | |
491 | + | $Tuple2(makeString(r, "_"), makeString(currentPackRes, "_")) | |
492 | + | } | |
493 | + | else { | |
494 | + | func addPartLists (acc,i) = { | |
495 | + | let whPart = fraction(resListToClaim[i], whSpaceLeft, resAmToClaim) | |
496 | + | $Tuple2((acc._1 :+ toString((parseIntValue(currentWhRes[i]) + whPart))), (acc._2 :+ toString(((parseIntValue(currentPackRes[i]) + resListToClaim[i]) - whPart)))) | |
497 | + | } | |
498 | + | ||
499 | + | let r = { | |
500 | + | let $l = [0, 1, 2, 3, 4, 5] | |
501 | + | let $s = size($l) | |
502 | + | let $acc0 = $Tuple2(nil, nil) | |
503 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
504 | + | then $a | |
505 | + | else addPartLists($a, $l[$i]) | |
506 | + | ||
507 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
508 | + | then $a | |
509 | + | else throw("List size exceeds 6") | |
510 | + | ||
511 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
512 | + | } | |
513 | + | $Tuple2(makeString(r._1, "_"), makeString(r._2, "_")) | |
514 | + | } | |
515 | + | } | |
516 | + | ||
517 | + | ||
518 | + | func abs (x) = if ((x >= toBigInt(0))) | |
519 | + | then x | |
520 | + | else -(x) | |
521 | + | ||
522 | + | ||
523 | + | let freq = [[1, 4, 9, 10, 15], [5, 8, 13, 14, 15], [6, 9, 14, 15, 16], [4, 7, 8, 13, 18], [1, 6, 7, 15, 19]] | |
524 | + | ||
525 | + | func genChar (n,freqs) = { | |
526 | + | let rem = toInt((n % TWENTYX)) | |
527 | + | let letter = if ((freqs[0] > rem)) | |
528 | + | then "A" | |
529 | + | else if ((freqs[1] > rem)) | |
530 | + | then "B" | |
531 | + | else if ((freqs[2] > rem)) | |
532 | + | then "C" | |
533 | + | else if ((freqs[3] > rem)) | |
534 | + | then "D" | |
535 | + | else if ((freqs[4] > rem)) | |
536 | + | then "E" | |
537 | + | else "F" | |
538 | + | letter | |
539 | + | } | |
540 | + | ||
541 | + | ||
542 | + | func genTerrains (seed,continentIdx) = { | |
543 | + | let f = freq[continentIdx] | |
544 | + | func terrainGenerator (acc,elem) = $Tuple2((((((acc._1 + genChar(acc._2, f)) + genChar((acc._2 / TWENTYX), f)) + genChar((acc._2 / TWENTY2X), f)) + genChar((acc._2 / TWENTY3X), f)) + genChar((acc._2 / TWENTY4X), f)), (acc._2 / TWENTY5X)) | |
545 | + | ||
546 | + | let t = { | |
547 | + | let $l = [1, 2, 3, 4, 5] | |
548 | + | let $s = size($l) | |
549 | + | let $acc0 = $Tuple2("", (seed / FIVEX)) | |
550 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
551 | + | then $a | |
552 | + | else terrainGenerator($a, $l[$i]) | |
553 | + | ||
554 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
555 | + | then $a | |
556 | + | else throw("List size exceeds 5") | |
557 | + | ||
558 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
559 | + | } | |
560 | + | t._1 | |
561 | + | } | |
562 | + | ||
563 | + | ||
564 | + | func getBackpack (bpKey) = { | |
565 | + | let p = split(valueOrElse(getString(bpKey), "0:0_0_0_0_0_0:0_0_0_0_0_0:"), ":") | |
566 | + | [toString(valueOrElse(parseInt(p[bpIdxLevel]), 0)), if ((size(split(p[bpIdxRes], "_")) == NUMRES)) | |
567 | + | then p[bpIdxRes] | |
568 | + | else "0_0_0_0_0_0", if ((size(split(p[bpIdxMat], "_")) == NUMRES)) | |
569 | + | then p[bpIdxMat] | |
570 | + | else "0_0_0_0_0_0", p[bpIdxProd]] | |
571 | + | } | |
572 | + | ||
573 | + | ||
574 | + | func getWarehouseVolume (volPrefix) = { | |
575 | + | let parts = split(volPrefix, "_") | |
576 | + | ((WHMULTIPLIER * (parseIntValue(parts[1]) + 1)) * parseIntValue(parts[0])) | |
577 | + | } | |
578 | + | ||
579 | + | ||
231 | 580 | func getWarehouse (whKey,landIndex,infraLevel) = { | |
232 | 581 | let volPrefix = ((toString(landIndex) + "_") + toString(infraLevel)) | |
233 | - | let p = split(valueOrElse(getString( | |
582 | + | let p = split(valueOrElse(getString(whKey), (volPrefix + ":0_0_0_0_0_0:0_0_0_0_0_0::0")), ":") | |
234 | 583 | [p[whIdxVol], if ((size(split(p[whIdxRes], "_")) == NUMRES)) | |
235 | 584 | then p[whIdxRes] | |
236 | 585 | else "0_0_0_0_0_0", if ((size(split(p[whIdxMat], "_")) == NUMRES)) | |
241 | 590 | } | |
242 | 591 | ||
243 | 592 | ||
244 | - | func duckInfoTuple (duckAssetId) = $Tuple5(valueOrElse(getInteger(stakingContract, keyStakedTimeByAssetId(duckAssetId)), -1), value(assetInfo(fromBase58String(duckAssetId))).name, valueOrElse(getString(stakingContract, keyDuckLocation(duckAssetId)), ""), valueOrElse(getInteger(stakingContract, keyDuckHealth(duckAssetId)), -1), asString(invoke(stakingContract, "getBackpackREADONLY", [duckAssetId], nil))) | |
593 | + | func getWarehouseCurrResVolume (currentWh) = { | |
594 | + | func sum (acc,item) = (acc + parseIntValue(item)) | |
595 | + | ||
596 | + | let $l = split(currentWh[whIdxRes], "_") | |
597 | + | let $s = size($l) | |
598 | + | let $acc0 = 0 | |
599 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
600 | + | then $a | |
601 | + | else sum($a, $l[$i]) | |
602 | + | ||
603 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
604 | + | then $a | |
605 | + | else throw("List size exceeds 6") | |
606 | + | ||
607 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
608 | + | } | |
245 | 609 | ||
246 | 610 | ||
247 | - | func duckInfoArray (duckAssetId,owner,duckInf) = [("%s%s__assetId__" + duckAssetId), ("%s%s__owner__" + owner), ("%s%d__stakedTime__" + toString(duckInf._1)), ("%s%s__name__" + duckInf._2), ("%s%s__location__" + duckInf._3), ("%s%d__health__" + toString(duckInf._4)), ("%s%s__backPack__" + duckInf._5)] | |
611 | + | func getWarehouseCurrMatVolume (currentWh) = { | |
612 | + | func sum (acc,item) = (acc + parseIntValue(item)) | |
613 | + | ||
614 | + | let $l = split(currentWh[whIdxMat], "_") | |
615 | + | let $s = size($l) | |
616 | + | let $acc0 = 0 | |
617 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
618 | + | then $a | |
619 | + | else sum($a, $l[$i]) | |
620 | + | ||
621 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
622 | + | then $a | |
623 | + | else throw("List size exceeds 6") | |
624 | + | ||
625 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
626 | + | } | |
248 | 627 | ||
249 | 628 | ||
250 | - | func landInfoArray (landAssetId,owner,stakedTime) = if ((landAssetId == "")) | |
251 | - | then throw("landAssetId is required") | |
629 | + | func getWarehouseCurrGoodsVolume (currentWh) = { | |
630 | + | let goods = currentWh[whIdxProd] | |
631 | + | if ((goods == "")) | |
632 | + | then 0 | |
633 | + | else { | |
634 | + | func sum (acc,item) = (acc + parseIntValue(item)) | |
635 | + | ||
636 | + | let $l = split_4C(goods, "_") | |
637 | + | let $s = size($l) | |
638 | + | let $acc0 = 0 | |
639 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
640 | + | then $a | |
641 | + | else sum($a, $l[$i]) | |
642 | + | ||
643 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
644 | + | then $a | |
645 | + | else throw("List size exceeds 50") | |
646 | + | ||
647 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50) | |
648 | + | } | |
649 | + | } | |
650 | + | ||
651 | + | ||
652 | + | func moveStuff (cargoParts,currentWh,currentPack) = if ((size(cargoParts) != 3)) | |
653 | + | then throw("cargoListStr should contain exactly 2 ':' separators") | |
252 | 654 | else { | |
253 | - | let a = value(assetInfo(fromBase58String(landAssetId))) | |
254 | - | let d = split(a.description, "_") | |
255 | - | let landNum = if ((a.quantity > 0)) | |
256 | - | then d[recLandNum] | |
257 | - | else ("-" + d[recLandNum]) | |
258 | - | let pieces = numPiecesBySize(d[recLandSize]) | |
259 | - | let productivity = applyBonuses(landAssetId, pieces) | |
260 | - | let deltaTime = (lastBlock.timestamp - stakedTime) | |
261 | - | let availRes = if ((stakedTime > 0)) | |
262 | - | then fraction(deltaTime, (productivity._3 * pieces), DAYMILLIS) | |
263 | - | else 0 | |
264 | - | let needMat = fraction(InfraUpgradeCostS, (pieces * (productivity._1 + 1)), SSIZE) | |
265 | - | let globalAndLocal = if ((stakedTime > 0)) | |
266 | - | then asSplitResult(invoke(stakingContract, "splitByGlobalAndLocalWeightsREADONLY", [needMat, availRes, d[recTerrains]], nil)) | |
267 | - | else $Tuple2(asListIntCompacted(invoke(stakingContract, "splitByGlobalWeightsREADONLY", [needMat], nil)), "") | |
268 | - | [("%s%s__assetId__" + landAssetId), ("%s%s__owner__" + owner), ("%s%d__stakedTime__" + toString(stakedTime)), ("%s%s__description__" + makeString([landNum, d[recLandSize], d[recTerrains], d[recContinent]], "_")), ("%s%d__infraLevel__" + toString(productivity._1)), ("%s%s__availResByType__" + globalAndLocal._2), ("%s%d__availResTotal__" + toString(availRes)), ("%s%s__needMaterial__" + globalAndLocal._1), makeString(["%s%s", "landArtefacts", ("PRESALE:" + toString(productivity._2))], SEP), ("%s%s__warehouse__" + makeString(getWarehouse(keyWarehouseByLand(landAssetId), (pieces / SSIZE), productivity._1), ":")), ("%s%s__landOrder__" + valueOrElse(getString(economyContract, keyOrderByLand(landAssetId)), "0@0_0@0_0@0_0@0_0@0_0@0:0@0_0@0_0@0_0@0_0@0_0@0:"))] | |
655 | + | let resParts = split(cargoParts[0], "_") | |
656 | + | let matParts = split(cargoParts[1], "_") | |
657 | + | let prodParts = if ((cargoParts[2] == "")) | |
658 | + | then nil | |
659 | + | else split(cargoParts[2], "_") | |
660 | + | if ((size(resParts) != NUMRES)) | |
661 | + | then throw("All 6 resources should be passed") | |
662 | + | else if ((size(matParts) != NUMRES)) | |
663 | + | then throw("All 6 materials should be passed") | |
664 | + | else { | |
665 | + | let currWhResVol = getWarehouseCurrResVolume(currentWh) | |
666 | + | let currWhMatVol = getWarehouseCurrMatVolume(currentWh) | |
667 | + | let currWhGoodsVol = getWarehouseCurrGoodsVolume(currentWh) | |
668 | + | let currWhLockedVol = parseIntValue(currentWh[whIdxLockedVol]) | |
669 | + | let whSpaceLeft = ((((getWarehouseVolume(currentWh[whIdxVol]) - currWhResVol) - currWhMatVol) - currWhGoodsVol) - currWhLockedVol) | |
670 | + | let currWhRes = split(currentWh[whIdxRes], "_") | |
671 | + | let currWhMat = split(currentWh[whIdxMat], "_") | |
672 | + | let currWhProd = if ((currentWh[whIdxProd] == "")) | |
673 | + | then nil | |
674 | + | else split(currentWh[whIdxProd], "_") | |
675 | + | let currentPackRes = split(currentPack[bpIdxRes], "_") | |
676 | + | let currentPackMat = split(currentPack[bpIdxMat], "_") | |
677 | + | let currentPackProd = if ((currentPack[bpIdxProd] == "")) | |
678 | + | then nil | |
679 | + | else split(currentPack[bpIdxProd], "_") | |
680 | + | func mvR (acc,item) = { | |
681 | + | let i = acc._1 | |
682 | + | let am = parseIntValue(item) | |
683 | + | let whr = parseIntValue(currWhRes[i]) | |
684 | + | let bpr = parseIntValue(currentPackRes[i]) | |
685 | + | if ((am == 0)) | |
686 | + | then $Tuple4((i + 1), (acc._2 :+ currWhRes[i]), (acc._3 :+ currentPackRes[i]), acc._4) | |
687 | + | else if ((am > 0)) | |
688 | + | then if ((am > bpr)) | |
689 | + | then throw((((("Attempt to take " + item) + " from backpack, but only ") + toString(bpr)) + " available")) | |
690 | + | else $Tuple4((i + 1), (acc._2 :+ toString((whr + am))), (acc._3 :+ toString((bpr - am))), (acc._4 + am)) | |
691 | + | else if ((-(am) > whr)) | |
692 | + | then throw((((("Attempt to take " + toString(-(am))) + " from warehouse, but only ") + toString(whr)) + " available")) | |
693 | + | else $Tuple4((i + 1), (acc._2 :+ toString((whr + am))), (acc._3 :+ toString((bpr - am))), (acc._4 + am)) | |
694 | + | } | |
695 | + | ||
696 | + | let r = { | |
697 | + | let $l = resParts | |
698 | + | let $s = size($l) | |
699 | + | let $acc0 = $Tuple4(0, nil, nil, 0) | |
700 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
701 | + | then $a | |
702 | + | else mvR($a, $l[$i]) | |
703 | + | ||
704 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
705 | + | then $a | |
706 | + | else throw("List size exceeds 6") | |
707 | + | ||
708 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
709 | + | } | |
710 | + | func mvM (acc,item) = { | |
711 | + | let i = acc._1 | |
712 | + | let am = parseIntValue(item) | |
713 | + | let whm = parseIntValue(currWhMat[i]) | |
714 | + | let bpm = parseIntValue(currentPackMat[i]) | |
715 | + | if ((am == 0)) | |
716 | + | then $Tuple4((i + 1), (acc._2 :+ currWhMat[i]), (acc._3 :+ currentPackMat[i]), acc._4) | |
717 | + | else if ((am > 0)) | |
718 | + | then if ((am > bpm)) | |
719 | + | then throw((((("Attempt to take " + item) + " from backpack, but only ") + toString(bpm)) + " available")) | |
720 | + | else $Tuple4((i + 1), (acc._2 :+ toString((whm + am))), (acc._3 :+ toString((bpm - am))), (acc._4 + am)) | |
721 | + | else if ((-(am) > whm)) | |
722 | + | then throw((((("Attempt to take " + toString(-(am))) + " from warehouse, but only ") + toString(whm)) + " available")) | |
723 | + | else $Tuple4((i + 1), (acc._2 :+ toString((whm + am))), (acc._3 :+ toString((bpm - am))), (acc._4 + am)) | |
724 | + | } | |
725 | + | ||
726 | + | let m = { | |
727 | + | let $l = matParts | |
728 | + | let $s = size($l) | |
729 | + | let $acc0 = $Tuple4(0, nil, nil, r._4) | |
730 | + | func $f1_1 ($a,$i) = if (($i >= $s)) | |
731 | + | then $a | |
732 | + | else mvM($a, $l[$i]) | |
733 | + | ||
734 | + | func $f1_2 ($a,$i) = if (($i >= $s)) | |
735 | + | then $a | |
736 | + | else throw("List size exceeds 6") | |
737 | + | ||
738 | + | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
739 | + | } | |
740 | + | func mvP (acc,item) = { | |
741 | + | let i = acc._1 | |
742 | + | let am = parseIntValue(item) | |
743 | + | let whp = parseIntValue(currWhProd[i]) | |
744 | + | let bpp = parseIntValue(currentPackProd[i]) | |
745 | + | if ((am == 0)) | |
746 | + | then $Tuple4((i + 1), (acc._2 :+ currWhProd[i]), (acc._3 :+ currentPackProd[i]), acc._4) | |
747 | + | else if ((am > 0)) | |
748 | + | then if ((am > bpp)) | |
749 | + | then throw((((("Attempt to take " + item) + " from backpack, but only ") + toString(bpp)) + " available")) | |
750 | + | else $Tuple4((i + 1), (acc._2 :+ toString((whp + am))), (acc._3 :+ toString((bpp - am))), (acc._4 + am)) | |
751 | + | else if ((-(am) > whp)) | |
752 | + | then throw((((("Attempt to take " + toString(-(am))) + " from warehouse, but only ") + toString(whp)) + " available")) | |
753 | + | else $Tuple4((i + 1), (acc._2 :+ toString((whp + am))), (acc._3 :+ toString((bpp - am))), (acc._4 + am)) | |
754 | + | } | |
755 | + | ||
756 | + | let p = { | |
757 | + | let $l = prodParts | |
758 | + | let $s = size($l) | |
759 | + | let $acc0 = $Tuple4(0, nil, nil, m._4) | |
760 | + | func $f2_1 ($a,$i) = if (($i >= $s)) | |
761 | + | then $a | |
762 | + | else mvP($a, $l[$i]) | |
763 | + | ||
764 | + | func $f2_2 ($a,$i) = if (($i >= $s)) | |
765 | + | then $a | |
766 | + | else throw("List size exceeds 50") | |
767 | + | ||
768 | + | $f2_2($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50) | |
769 | + | } | |
770 | + | let volSaldo = p._4 | |
771 | + | if ((volSaldo > whSpaceLeft)) | |
772 | + | then throw((((("Attempt to put total " + toString(volSaldo)) + " stuff, but only ") + toString(whSpaceLeft)) + " warehouse space left")) | |
773 | + | else $Tuple6(makeString(r._2, "_"), makeString(m._2, "_"), makeString(p._2, "_"), makeString(r._3, "_"), makeString(m._3, "_"), makeString(p._3, "_")) | |
774 | + | } | |
269 | 775 | } | |
270 | 776 | ||
271 | 777 | ||
272 | - | func landOrderInfoArray (landAssetId,owner) = if ((landAssetId == "")) | |
273 | - | then throw("landAssetId is required") | |
778 | + | func expeditionInternal (caller,txId) = { | |
779 | + | let userAddr = toString(caller) | |
780 | + | let bigNum = abs(toBigInt(txId)) | |
781 | + | let freeNum = valueOrElse(getInteger(keyNextFreeLandNum()), (PRESALENUMLANDS + 1)) | |
782 | + | let landNum = toString(freeNum) | |
783 | + | let continentIdx = toInt((bigNum % FIVEX)) | |
784 | + | let terrains = genTerrains(bigNum, continentIdx) | |
785 | + | let continent = continents[continentIdx] | |
786 | + | let issue = Issue(keyNftName(landNum, "S"), makeString([landNum, "S", terrains, continent], "_"), 1, 0, false) | |
787 | + | let assetId = calculateAssetId(issue) | |
788 | + | let id = toBase58String(assetId) | |
789 | + | $Tuple2([IntegerEntry(keyNextFreeLandNum(), (freeNum + 1)), issue, StringEntry(keyLandToAssetId(landNum), id), StringEntry(keyLandAssetIdToOwner(id), userAddr), StringEntry(keyLandNumToOwner(landNum), userAddr), IntegerEntry(keyInfraLevelByAssetId(id), 0), IntegerEntry(keyInfraLevelByAssetIdAndOwner(id, userAddr), 0), ScriptTransfer(caller, 1, assetId)], $Tuple2(id, continent)) | |
790 | + | } | |
791 | + | ||
792 | + | ||
793 | + | func expeditionCommon (shouldUseMat,caller,txId,message,sig) = if (!(sigVerify_8Kb(message, sig, pub))) | |
794 | + | then throw("signature does not match") | |
274 | 795 | else { | |
275 | - | let a = value(assetInfo(fromBase58String(landAssetId))) | |
276 | - | let d = split(a.description, "_") | |
277 | - | let pieces = numPiecesBySize(d[recLandSize]) | |
278 | - | let productivity = applyBonuses(landAssetId, pieces) | |
279 | - | [("%s%s__assetId__" + landAssetId), ("%s%s__owner__" + owner), ("%s%s__warehouse__" + makeString(getWarehouse(keyWarehouseByLand(landAssetId), (pieces / SSIZE), productivity._1), ":")), ("%s%s__landOrder__" + valueOrElse(getString(economyContract, keyOrderByLand(landAssetId)), "0@0_0@0_0@0_0@0_0@0_0@0:0@0_0@0_0@0_0@0_0@0_0@0:"))] | |
796 | + | let parts = split(toUtf8String(message), ";") | |
797 | + | let hp = split(split(parts[0], "|")[0], "_") | |
798 | + | let curHP = parseIntValue(hp[0]) | |
799 | + | let newHP = parseIntValue(hp[1]) | |
800 | + | let locAndTime = split(parts[1], ":") | |
801 | + | let targetLocation = split(locAndTime[0], "_") | |
802 | + | if ((targetLocation[1] != "E")) | |
803 | + | then throw("expedition target location type should be E") | |
804 | + | else { | |
805 | + | let time = parseIntValue(locAndTime[1]) | |
806 | + | if (if ((time > (lastBlock.timestamp + FIVEMINUTESMILLIS))) | |
807 | + | then true | |
808 | + | else ((lastBlock.timestamp - FIVEMINUTESMILLIS) > time)) | |
809 | + | then throw("signature outdated") | |
810 | + | else { | |
811 | + | let userAddr = toString(caller) | |
812 | + | let duckAssetId = valueOrErrorMessage(getString(keyStakedDuckByOwner(userAddr)), "You don't have a duck staked") | |
813 | + | let keyHealth = keyDuckHealth(duckAssetId) | |
814 | + | let oldFromState = valueOrElse(getInteger(keyHealth), 100) | |
815 | + | if ((oldFromState != curHP)) | |
816 | + | then throw(((("oldHealth=" + toString(valueOrElse(getInteger(keyHealth), 100))) + " from state does not match one from flight log=") + toString(curHP))) | |
817 | + | else if ((0 >= curHP)) | |
818 | + | then throw("You can't fly with zero health") | |
819 | + | else if ((0 >= newHP)) | |
820 | + | then $Tuple2(((if (!(shouldUseMat)) | |
821 | + | then [ScriptTransfer(caller, EXPUSDN, usdnAssetId)] | |
822 | + | else nil) :+ IntegerEntry(keyHealth, 0)), "") | |
823 | + | else { | |
824 | + | let bpKey = keyBackpackByDuck(duckAssetId) | |
825 | + | let currentPack = getBackpack(bpKey) | |
826 | + | let mList = split(currentPack[bpIdxMat], "_") | |
827 | + | let newMat = makeString(subtractMaterials(shouldUseMat, mList, EXPMATERIALS), "_") | |
828 | + | let e = expeditionInternal(caller, txId) | |
829 | + | let id = e._2._1 | |
830 | + | $Tuple2((((e._1 :+ StringEntry(keyDuckLocation(duckAssetId), makeString([e._2._2, "L", id], "_"))) :+ IntegerEntry(keyHealth, newHP)) :+ StringEntry(bpKey, makeString([currentPack[bpIdxLevel], currentPack[bpIdxRes], newMat, currentPack[bpIdxProd]], ":"))), id) | |
831 | + | } | |
832 | + | } | |
833 | + | } | |
280 | 834 | } | |
281 | 835 | ||
282 | 836 | ||
837 | + | func applyBonuses (landAssetId,pieces) = { | |
838 | + | let infraLevel = valueOrElse(getInteger(keyInfraLevelByAssetId(landAssetId)), 0) | |
839 | + | let artPieces = valueOrElse(getInteger(keyLandArtStatusByTypeAndAssetId(ARTPRESALE, landAssetId)), if (valueOrElse(getBoolean(keyPresaleArtActivatedByAssetId(landAssetId)), false)) | |
840 | + | then pieces | |
841 | + | else 0) | |
842 | + | ((DAILYRESBYPIECE + fraction(DAILYRESBYPIECE, infraLevel, 4)) + fraction(DAILYRESBYPIECE, (artPieces * 3), (pieces * 20))) | |
843 | + | } | |
844 | + | ||
845 | + | ||
846 | + | func checkClaimConditions (addr,claimMode,landAssetIdIn) = { | |
847 | + | let $t02363024169 = if ((claimMode == claimModeWh)) | |
848 | + | then $Tuple2(landAssetIdIn, valueOrElse(getString(keyStakedDuckByOwner(addr)), "")) | |
849 | + | else { | |
850 | + | let duckAssetId = valueOrErrorMessage(getString(keyStakedDuckByOwner(addr)), "You don't have a duck staked") | |
851 | + | let curLocation = valueOrElse(getString(keyDuckLocation(duckAssetId)), DEFAULTLOCATION) | |
852 | + | let loc = split(value(curLocation), "_") | |
853 | + | if ((loc[locIdxType] != "L")) | |
854 | + | then throw((("Duck location type is " + loc[locIdxType]) + ", but should be L")) | |
855 | + | else $Tuple2(loc[locIdxId], duckAssetId) | |
856 | + | } | |
857 | + | let landAssetId = $t02363024169._1 | |
858 | + | let duckId = $t02363024169._2 | |
859 | + | let asset = value(assetInfo(fromBase58String(landAssetId))) | |
860 | + | let timeKey = keyStakedTimeByAssetId(landAssetId) | |
861 | + | let savedTime = valueOrErrorMessage(getInteger(timeKey), (("Land " + asset.name) + " is not staked")) | |
862 | + | let owner = valueOrErrorMessage(getString(keyLandAssetIdToOwner(landAssetId)), (("NFT " + asset.name) + " is orphaned")) | |
863 | + | if ((owner != addr)) | |
864 | + | then throw((LANDPREFIX + " is not yours")) | |
865 | + | else { | |
866 | + | let d = split(asset.description, "_") | |
867 | + | $Tuple4(duckId, landAssetId, d, savedTime) | |
868 | + | } | |
869 | + | } | |
870 | + | ||
871 | + | ||
872 | + | func claimResInternal (addr,amount,claimMode,landAssetIdIn) = if ((0 > amount)) | |
873 | + | then throw("Negative amount") | |
874 | + | else { | |
875 | + | let c = checkClaimConditions(addr, claimMode, landAssetIdIn) | |
876 | + | let landSize = c._3[recLandSize] | |
877 | + | let terrainCounts = countTerrains(c._3[recTerrains]) | |
878 | + | let deltaTime = (lastBlock.timestamp - c._4) | |
879 | + | if ((0 > deltaTime)) | |
880 | + | then throw(((("Saved timestamp is in future, saved = " + toString(c._4)) + ", current = ") + toString(lastBlock.timestamp))) | |
881 | + | else { | |
882 | + | let pieces = numPiecesBySize(landSize) | |
883 | + | let dailyProductionByPiece = applyBonuses(c._2, pieces) | |
884 | + | let availRes = fraction(deltaTime, (dailyProductionByPiece * pieces), DAYMILLIS) | |
885 | + | if ((amount > availRes)) | |
886 | + | then throw(((("Not enough resources, available = " + toString(availRes)) + ", requested = ") + toString(amount))) | |
887 | + | else { | |
888 | + | let newDeltaTime = fraction((availRes - amount), DAYMILLIS, (dailyProductionByPiece * pieces)) | |
889 | + | let newTimestamp = (lastBlock.timestamp - newDeltaTime) | |
890 | + | let landIndex = (pieces / SSIZE) | |
891 | + | let resToClaim = virtClaim(terrainCounts, (deltaTime - newDeltaTime), landIndex, dailyProductionByPiece) | |
892 | + | let whKey = keyWarehouseByLand(c._2) | |
893 | + | let infraLevel = valueOrElse(getInteger(keyInfraLevelByAssetId(c._2)), 0) | |
894 | + | let currentWh = getWarehouse(whKey, landIndex, infraLevel) | |
895 | + | let currWhResVol = getWarehouseCurrResVolume(currentWh) | |
896 | + | let currWhMatVol = getWarehouseCurrMatVolume(currentWh) | |
897 | + | let currWhGoodsVol = getWarehouseCurrGoodsVolume(currentWh) | |
898 | + | let currWhLockedVol = parseIntValue(currentWh[whIdxLockedVol]) | |
899 | + | let whSpaceLeft = ((((getWarehouseVolume(currentWh[whIdxVol]) - currWhResVol) - currWhMatVol) - currWhGoodsVol) - currWhLockedVol) | |
900 | + | if (if ((claimMode == claimModeWh)) | |
901 | + | then (amount > whSpaceLeft) | |
902 | + | else false) | |
903 | + | then throw((("Only " + toString(whSpaceLeft)) + " space left in warehouse")) | |
904 | + | else { | |
905 | + | let bpKey = keyBackpackByDuck(c._1) | |
906 | + | let currentPack = getBackpack(bpKey) | |
907 | + | let currentPackRes = split(currentPack[bpIdxRes], "_") | |
908 | + | let currentWhRes = split(currentWh[whIdxRes], "_") | |
909 | + | let $t02681727320 = if ((claimMode == claimModeWh)) | |
910 | + | then $Tuple2(addRes(currentWhRes, terrainCounts, (deltaTime - newDeltaTime), landIndex, dailyProductionByPiece), currentPack[bpIdxRes]) | |
911 | + | else if ((claimMode == claimModeDuck)) | |
912 | + | then $Tuple2(currentWh[whIdxRes], addRes(currentPackRes, terrainCounts, (deltaTime - newDeltaTime), landIndex, dailyProductionByPiece)) | |
913 | + | else distributeRes(currentWhRes, currentPackRes, resToClaim, whSpaceLeft) | |
914 | + | let whRes = $t02681727320._1 | |
915 | + | let bpRes = $t02681727320._2 | |
916 | + | $Tuple5([IntegerEntry(keyStakedTimeByAssetId(c._2), newTimestamp), IntegerEntry(keyStakedTimeByTypeAssetIdAndOwner(LANDPREFIX, c._2, addr), newTimestamp)], bpKey, [currentPack[bpIdxLevel], bpRes, currentPack[bpIdxMat], currentPack[bpIdxProd]], whKey, [currentWh[whIdxVol], whRes, currentWh[whIdxMat], currentWh[whIdxProd], currentWh[whIdxLockedVol]]) | |
917 | + | } | |
918 | + | } | |
919 | + | } | |
920 | + | } | |
921 | + | ||
922 | + | ||
923 | + | func claimAll (addr,landAssetId,pieces,claimMode) = { | |
924 | + | let timeKey = keyStakedTimeByAssetId(landAssetId) | |
925 | + | let savedTime = value(getInteger(timeKey)) | |
926 | + | let availRes = (fraction((lastBlock.timestamp - savedTime), applyBonuses(landAssetId, pieces), DAYMILLIS) * pieces) | |
927 | + | claimResInternal(addr, availRes, claimMode, landAssetId) | |
928 | + | } | |
929 | + | ||
930 | + | ||
931 | + | func upInfraCommon (shouldUseMat,caller,paymentAmount,landAssetId) = { | |
932 | + | let addr = toString(caller) | |
933 | + | let c = checkClaimConditions(addr, claimModeWhThenDuck, landAssetId) | |
934 | + | let pieces = numPiecesBySize(c._3[recLandSize]) | |
935 | + | let infraKey = keyInfraLevelByAssetId(c._2) | |
936 | + | let curLevel = valueOrElse(getInteger(infraKey), 0) | |
937 | + | if ((curLevel >= 3)) | |
938 | + | then throw("Currently max infrastructure level = 3") | |
939 | + | else { | |
940 | + | let newLevel = (curLevel + 1) | |
941 | + | let cost = fraction(InfraUpgradeCostSUsdn, (pieces * newLevel), SSIZE) | |
942 | + | if (if (!(shouldUseMat)) | |
943 | + | then (paymentAmount != cost) | |
944 | + | else false) | |
945 | + | then throw(("Payment attached should be " + toString(cost))) | |
946 | + | else { | |
947 | + | let bpKey = keyBackpackByDuck(c._1) | |
948 | + | let currentPack = getBackpack(bpKey) | |
949 | + | let mList = split(currentPack[bpIdxMat], "_") | |
950 | + | let newMat = makeString(subtractMaterials(shouldUseMat, mList, fraction(InfraUpgradeCostS, (pieces * newLevel), SSIZE)), "_") | |
951 | + | let claimResult = claimAll(addr, c._2, pieces, claimModeWhThenDuck) | |
952 | + | let whData = claimResult._5 | |
953 | + | let newVolData = makeString([split(whData[whIdxVol], "_")[0], toString(newLevel)], "_") | |
954 | + | $Tuple2(([IntegerEntry(infraKey, newLevel), IntegerEntry(keyInfraLevelByAssetIdAndOwner(c._2, addr), newLevel), StringEntry(bpKey, makeString([currentPack[bpIdxLevel], claimResult._3[bpIdxRes], newMat, currentPack[bpIdxProd]], ":")), StringEntry(claimResult._4, makeString([newVolData, whData[whIdxRes], whData[whIdxMat], whData[whIdxProd], whData[whIdxLockedVol]], ":"))] ++ claimResult._1), newLevel) | |
955 | + | } | |
956 | + | } | |
957 | + | } | |
958 | + | ||
959 | + | ||
960 | + | func activatePresaleArt (addr,landAssetIdIn) = { | |
961 | + | let c = checkClaimConditions(addr, claimModeWhThenDuck, landAssetIdIn) | |
962 | + | let landAssetId = c._2 | |
963 | + | let activationKey = keyPresaleArtActivatedByAssetId(landAssetId) | |
964 | + | if (valueOrElse(getBoolean(activationKey), false)) | |
965 | + | then throw("Presale artifact is already activated") | |
966 | + | else if ((parseIntValue(c._3[recLandNum]) > PRESALENUMLANDS)) | |
967 | + | then throw((((LANDPREFIX + " ") + landAssetId) + " is not eligible for presale artifact")) | |
968 | + | else { | |
969 | + | let pieces = numPiecesBySize(c._3[recLandSize]) | |
970 | + | let claimResult = claimAll(addr, landAssetId, pieces, claimModeWhThenDuck) | |
971 | + | ((((((claimResult._1 :+ BooleanEntry(activationKey, true)) :+ BooleanEntry(keyPresaleArtActivatedByAssetIdAndOwner(landAssetId, addr), true)) :+ IntegerEntry(keyLandArtStatusByTypeAndAssetId(ARTPRESALE, landAssetId), pieces)) :+ IntegerEntry(keyLandArtStatusByTypeAssetIdAndOwner(ARTPRESALE, landAssetId, addr), pieces)) :+ StringEntry(claimResult._2, makeString(claimResult._3, ":"))) :+ StringEntry(claimResult._4, makeString(claimResult._5, ":"))) | |
972 | + | } | |
973 | + | } | |
974 | + | ||
975 | + | ||
976 | + | func mergeInternal (newLandSize,newLevel,formula,addr,landAssetIds,txId,needMat) = { | |
977 | + | let duckAssetId = valueOrErrorMessage(getString(keyStakedDuckByOwner(addr)), "You don't have a duck staked") | |
978 | + | func checkMerge (acc,landAssetId) = { | |
979 | + | let asset = value(assetInfo(fromBase58String(landAssetId))) | |
980 | + | let timeKey = keyStakedTimeByAssetId(landAssetId) | |
981 | + | let savedTime = valueOrErrorMessage(getInteger(timeKey), (("NFT " + asset.name) + " is not staked")) | |
982 | + | let owner = valueOrErrorMessage(getString(keyLandAssetIdToOwner(landAssetId)), (("NFT " + asset.name) + " is orphaned")) | |
983 | + | if ((owner != addr)) | |
984 | + | then throw((LANDPREFIX + " is not yours")) | |
985 | + | else { | |
986 | + | let d = split(asset.description, "_") | |
987 | + | let continent = d[recContinent] | |
988 | + | if (if ((acc._3 != "")) | |
989 | + | then (acc._3 != continent) | |
990 | + | else false) | |
991 | + | then throw("Lands should be on the same continent to merge") | |
992 | + | else { | |
993 | + | let landSize = d[recLandSize] | |
994 | + | let sizesIn = acc._1 | |
995 | + | let i = valueOrErrorMessage(indexOf(sizesIn, landSize), "You haven't passed all the lands needed") | |
996 | + | let sizesOut = (take(sizesIn, i) + drop(sizesIn, (i + 1))) | |
997 | + | let pieces = numPiecesBySize(landSize) | |
998 | + | let arts = (acc._2 + valueOrElse(getInteger(keyLandArtStatusByTypeAndAssetId(ARTPRESALE, landAssetId)), if (valueOrElse(getBoolean(keyPresaleArtActivatedByAssetId(landAssetId)), false)) | |
999 | + | then pieces | |
1000 | + | else 0)) | |
1001 | + | let infraLevel = valueOrElse(getInteger(keyInfraLevelByAssetId(landAssetId)), 0) | |
1002 | + | let reqLevel = match landSize { | |
1003 | + | case _ => | |
1004 | + | if (("S" == $match0)) | |
1005 | + | then 3 | |
1006 | + | else if (("M" == $match0)) | |
1007 | + | then 4 | |
1008 | + | else if (("L" == $match0)) | |
1009 | + | then 5 | |
1010 | + | else if (("XL" == $match0)) | |
1011 | + | then 6 | |
1012 | + | else throw("Only S, M, L, XL can merge") | |
1013 | + | } | |
1014 | + | if ((infraLevel != reqLevel)) | |
1015 | + | then throw("All lands should be maxed to merge") | |
1016 | + | else { | |
1017 | + | let landNum = d[recLandNum] | |
1018 | + | let terrainCounts = countTerrains(d[recTerrains]) | |
1019 | + | let deltaTime = (lastBlock.timestamp - savedTime) | |
1020 | + | if ((0 > deltaTime)) | |
1021 | + | then throw(((("Saved timestamp is in future, saved = " + toString(savedTime)) + ", current = ") + toString(lastBlock.timestamp))) | |
1022 | + | else { | |
1023 | + | let dailyProductionByPiece = applyBonuses(landAssetId, pieces) | |
1024 | + | let landIndex = (pieces / SSIZE) | |
1025 | + | let bpRes = addRes(split(acc._4, "_"), terrainCounts, deltaTime, landIndex, dailyProductionByPiece) | |
1026 | + | let props = updateProportionsInternal(split(acc._6, "_"), terrainCounts, landIndex, -1) | |
1027 | + | let lands = acc._7 | |
1028 | + | let idx = indexOf(lands, landAssetId) | |
1029 | + | if (!(isDefined(idx))) | |
1030 | + | then throw(("Your staked lands don't contain " + landAssetId)) | |
1031 | + | else $Tuple7(sizesOut, arts, continent, bpRes, ((((((((((((((acc._5 :+ DeleteEntry(keyStakedTimeByAssetId(landAssetId))) :+ DeleteEntry(keyStakedTimeByTypeAssetIdAndOwner(LANDPREFIX, landAssetId, addr))) :+ DeleteEntry(keyLandToAssetId(landNum))) :+ DeleteEntry(keyNftName(landNum, landSize))) :+ DeleteEntry(keyLandAssetIdToOwner(landAssetId))) :+ DeleteEntry(keyInfraLevelByAssetId(landAssetId))) :+ DeleteEntry(keyInfraLevelByAssetIdAndOwner(landAssetId, addr))) :+ DeleteEntry(keyPresaleArtActivatedByAssetId(landAssetId))) :+ DeleteEntry(keyPresaleArtActivatedByAssetIdAndOwner(landAssetId, addr))) :+ DeleteEntry(keyLandArtStatusByTypeAndAssetId(ARTPRESALE, landAssetId))) :+ DeleteEntry(keyLandArtStatusByTypeAssetIdAndOwner(ARTPRESALE, landAssetId, addr))) :+ DeleteEntry(keyLandNumToOwner(landNum))) :+ DeleteEntry(keyWarehouseByLand(landAssetId))) :+ Burn(fromBase58String(landAssetId), 1)), props, removeByIndex(lands, value(idx))) | |
1032 | + | } | |
1033 | + | } | |
1034 | + | } | |
1035 | + | } | |
1036 | + | } | |
1037 | + | ||
1038 | + | let bpKey = keyBackpackByDuck(duckAssetId) | |
1039 | + | let currentPack = getBackpack(bpKey) | |
1040 | + | let propStr = valueOrElse(getString(keyResProportions()), "0_0_0_0_0_0") | |
1041 | + | let landsKey = keyStakedLandsByOwner(addr) | |
1042 | + | let landsStr = getString(landsKey) | |
1043 | + | let landsIn = if (isDefined(landsStr)) | |
1044 | + | then split_51C(value(landsStr), "_") | |
1045 | + | else nil | |
1046 | + | let r = { | |
1047 | + | let $l = landAssetIds | |
1048 | + | let $s = size($l) | |
1049 | + | let $acc0 = $Tuple7(formula, 0, "", currentPack[bpIdxRes], nil, propStr, landsIn) | |
1050 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
1051 | + | then $a | |
1052 | + | else checkMerge($a, $l[$i]) | |
1053 | + | ||
1054 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
1055 | + | then $a | |
1056 | + | else throw("List size exceeds 5") | |
1057 | + | ||
1058 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
1059 | + | } | |
1060 | + | let continent = r._3 | |
1061 | + | let continentIdx = valueOrErrorMessage(indexOf(continents, continent), ("Unknown continent: " + continent)) | |
1062 | + | let terrains = genTerrains(abs(toBigInt(txId)), continentIdx) | |
1063 | + | let freeNum = valueOrElse(getInteger(keyNextFreeLandNum()), (PRESALENUMLANDS + 1)) | |
1064 | + | let newLandNum = toString(freeNum) | |
1065 | + | let issue = Issue(keyNftName(newLandNum, newLandSize), makeString([newLandNum, newLandSize, terrains, continent], "_"), 1, 0, false) | |
1066 | + | let assetId = calculateAssetId(issue) | |
1067 | + | let newLandAssetId = toBase58String(assetId) | |
1068 | + | let newMat = makeString(subtractMaterials((needMat > 0), split(currentPack[bpIdxMat], "_"), needMat), "_") | |
1069 | + | $Tuple2(((((((((((((((r._5 :+ (if ((size(r._7) > 0)) | |
1070 | + | then StringEntry(landsKey, makeString_11C(r._7, "_")) | |
1071 | + | else DeleteEntry(landsKey))) :+ IntegerEntry(keyNextFreeLandNum(), (freeNum + 1))) :+ issue) :+ StringEntry(keyLandToAssetId(newLandNum), newLandAssetId)) :+ StringEntry(keyLandAssetIdToOwner(newLandAssetId), addr)) :+ StringEntry(keyLandNumToOwner(newLandNum), addr)) :+ IntegerEntry(keyLandArtStatusByTypeAndAssetId(ARTPRESALE, newLandAssetId), r._2)) :+ IntegerEntry(keyLandArtStatusByTypeAssetIdAndOwner(ARTPRESALE, newLandAssetId, addr), r._2)) :+ IntegerEntry(keyInfraLevelByAssetId(newLandAssetId), newLevel)) :+ IntegerEntry(keyInfraLevelByAssetIdAndOwner(newLandAssetId, addr), newLevel)) :+ StringEntry(bpKey, makeString([currentPack[bpIdxLevel], r._4, newMat, currentPack[bpIdxProd]], ":"))) :+ StringEntry(keyResProportions(), r._6)) :+ StringEntry(keyDuckLocation(duckAssetId), makeString([continent, "L", newLandAssetId], "_"))) :+ ScriptTransfer(addressFromStringValue(addr), 1, assetId)), newLandAssetId) | |
1072 | + | } | |
1073 | + | ||
1074 | + | ||
1075 | + | func s2m (addr,landAssetIds,txId) = mergeInternal("M", 3, "SSSS", addr, landAssetIds, txId, 0) | |
1076 | + | ||
1077 | + | ||
1078 | + | func m2l (addr,landAssetIds,txId,shouldUseMat,paymentAmount) = { | |
1079 | + | let cost = (InfraUpgradeCostSUsdn * 4) | |
1080 | + | if (if (!(shouldUseMat)) | |
1081 | + | then (paymentAmount != cost) | |
1082 | + | else false) | |
1083 | + | then throw(("Payment attached should be " + toString(cost))) | |
1084 | + | else mergeInternal("L", 4, "SMM", addr, landAssetIds, txId, (InfraUpgradeCostS * 4)) | |
1085 | + | } | |
1086 | + | ||
1087 | + | ||
1088 | + | func l2xl (addr,landAssetIds,txId,shouldUseMat,paymentAmount) = { | |
1089 | + | let cost = (InfraUpgradeCostSUsdn * 47) | |
1090 | + | if (if (!(shouldUseMat)) | |
1091 | + | then (paymentAmount != cost) | |
1092 | + | else false) | |
1093 | + | then throw(("Payment attached should be " + toString(cost))) | |
1094 | + | else mergeInternal("XL", 5, "SSSML", addr, landAssetIds, txId, (InfraUpgradeCostS * 47)) | |
1095 | + | } | |
1096 | + | ||
1097 | + | ||
1098 | + | func xl2xxl (addr,landAssetIds,txId,shouldUseMat,paymentAmount) = { | |
1099 | + | let cost = (InfraUpgradeCostSUsdn * 54) | |
1100 | + | if (if (!(shouldUseMat)) | |
1101 | + | then (paymentAmount != cost) | |
1102 | + | else false) | |
1103 | + | then throw(("Payment attached should be " + toString(cost))) | |
1104 | + | else mergeInternal("XXL", 6, "LXL", addr, landAssetIds, txId, (InfraUpgradeCostS * 54)) | |
1105 | + | } | |
1106 | + | ||
1107 | + | ||
1108 | + | func mergeCommon (shouldUseMat,addr,paymentAmount,landAssetIds,txId) = { | |
1109 | + | let mergeResult = match size(landAssetIds) { | |
1110 | + | case _ => | |
1111 | + | if ((4 == $match0)) | |
1112 | + | then s2m(addr, landAssetIds, txId) | |
1113 | + | else if ((3 == $match0)) | |
1114 | + | then m2l(addr, landAssetIds, txId, shouldUseMat, paymentAmount) | |
1115 | + | else if ((5 == $match0)) | |
1116 | + | then l2xl(addr, landAssetIds, txId, shouldUseMat, paymentAmount) | |
1117 | + | else if ((2 == $match0)) | |
1118 | + | then xl2xxl(addr, landAssetIds, txId, shouldUseMat, paymentAmount) | |
1119 | + | else throw("Unknown merge") | |
1120 | + | } | |
1121 | + | mergeResult | |
1122 | + | } | |
1123 | + | ||
1124 | + | ||
1125 | + | func prolog (i) = if (if ((i.originCaller != restContract)) | |
1126 | + | then valueOrElse(getBoolean(keyBlocked()), false) | |
1127 | + | else false) | |
1128 | + | then throw("Contracts are under maintenance") | |
1129 | + | else StringEntry(keyLastTxIdByUser(toString(i.originCaller)), toBase58String(i.transactionId)) | |
1130 | + | ||
1131 | + | ||
283 | 1132 | @Callable(i) | |
284 | - | func constructorV1 ( | |
285 | - | then throw(" | |
286 | - | else [StringEntry( | |
1133 | + | func constructorV1 (restAddr) = if ((i.caller != this)) | |
1134 | + | then throw("Permission denied") | |
1135 | + | else [StringEntry(keyRestAddress(), restAddr)] | |
287 | 1136 | ||
288 | 1137 | ||
289 | 1138 | ||
290 | 1139 | @Callable(i) | |
291 | - | func walletInfoREADONLY (userAddressOpt) = $Tuple2(nil, walletInternal(userAddressOpt)) | |
1140 | + | func setBlocked (isBlocked) = if ((i.caller != this)) | |
1141 | + | then throw("permission denied") | |
1142 | + | else [BooleanEntry(keyBlocked(), isBlocked)] | |
292 | 1143 | ||
293 | 1144 | ||
294 | 1145 | ||
295 | 1146 | @Callable(i) | |
296 | - | func duckInfoREADONLY (duckAssetId,userAddressOpt) = { | |
297 | - | let addr = addressFromString(userAddressOpt) | |
298 | - | let duckAsset = fromBase58String(duckAssetId) | |
299 | - | if ((duckAssetId == "")) | |
300 | - | then throw("duckAssetId is required") | |
1147 | + | func stakeLand () = { | |
1148 | + | let prologAction = prolog(i) | |
1149 | + | if ((size(i.payments) != 1)) | |
1150 | + | then throw("Exactly one payment required") | |
301 | 1151 | else { | |
302 | - | let duckOwner = getString(stakingContract, keyDuckIdToOwner(duckAssetId)) | |
303 | - | let owner = if (isDefined(duckOwner)) | |
304 | - | then value(duckOwner) | |
305 | - | else if (if (isDefined(addr)) | |
306 | - | then (assetBalance(value(addr), duckAsset) == 1) | |
307 | - | else false) | |
308 | - | then userAddressOpt | |
309 | - | else "" | |
310 | - | $Tuple2(nil, $Tuple2(duckInfoArray(duckAssetId, owner, duckInfoTuple(duckAssetId)), walletInternal(userAddressOpt))) | |
1152 | + | let pmt = value(i.payments[0]) | |
1153 | + | let assetId = value(pmt.assetId) | |
1154 | + | let address = toString(i.caller) | |
1155 | + | if ((pmt.amount != 1)) | |
1156 | + | then throw((("NFT " + LANDPREFIX) + " token should be attached as payment")) | |
1157 | + | else { | |
1158 | + | let asset = value(assetInfo(assetId)) | |
1159 | + | if ((asset.issuer != this)) | |
1160 | + | then throw("Unknown issuer of token") | |
1161 | + | else if (!(contains(asset.name, LANDPREFIX))) | |
1162 | + | then throw((("Only NFT " + LANDPREFIX) + " tokens are accepted")) | |
1163 | + | else { | |
1164 | + | let landNumSize = drop(asset.name, 4) | |
1165 | + | let landNum = if (contains(landNumSize, "XXL")) | |
1166 | + | then dropRight(landNumSize, 3) | |
1167 | + | else if (contains(landNumSize, "XL")) | |
1168 | + | then dropRight(landNumSize, 2) | |
1169 | + | else dropRight(landNumSize, 1) | |
1170 | + | if (!(isDefined(parseInt(landNum)))) | |
1171 | + | then throw(("Cannot parse land number from " + asset.name)) | |
1172 | + | else { | |
1173 | + | let landAssetId = toBase58String(assetId) | |
1174 | + | let timeKey = keyStakedTimeByAssetId(landAssetId) | |
1175 | + | if (isDefined(getInteger(timeKey))) | |
1176 | + | then throw((("NFT " + asset.name) + " is already staked")) | |
1177 | + | else { | |
1178 | + | let d = split(asset.description, "_") | |
1179 | + | let terrainCounts = countTerrains(d[recTerrains]) | |
1180 | + | let props = updateProportions(terrainCounts, (numPiecesBySize(d[recLandSize]) / SSIZE), 1) | |
1181 | + | let landsStr = getString(keyStakedLandsByOwner(address)) | |
1182 | + | let lands = if (isDefined(landsStr)) | |
1183 | + | then split_51C(value(landsStr), "_") | |
1184 | + | else nil | |
1185 | + | if (containsElement(lands, landAssetId)) | |
1186 | + | then throw(("Your staked lands already contain " + landAssetId)) | |
1187 | + | else [IntegerEntry(timeKey, lastBlock.timestamp), IntegerEntry(keyStakedTimeByTypeAssetIdAndOwner(LANDPREFIX, landAssetId, address), lastBlock.timestamp), StringEntry(keyStakedLandsByOwner(address), makeString_11C((lands :+ landAssetId), "_")), StringEntry(keyLandAssetIdToOwner(landAssetId), address), StringEntry(keyLandNumToOwner(landNum), address), StringEntry(keyResProportions(), props), prologAction] | |
1188 | + | } | |
1189 | + | } | |
1190 | + | } | |
1191 | + | } | |
311 | 1192 | } | |
312 | 1193 | } | |
313 | 1194 | ||
314 | 1195 | ||
315 | 1196 | ||
316 | 1197 | @Callable(i) | |
317 | - | func landInfoREADONLY (landAssetId,userAddressOpt) = { | |
318 | - | let addr = addressFromString(userAddressOpt) | |
319 | - | let landAsset = fromBase58String(landAssetId) | |
320 | - | if ((landAssetId == "")) | |
321 | - | then throw("landAssetId is required") | |
1198 | + | func unstakeLand (landAssetIdIn) = { | |
1199 | + | let prologAction = prolog(i) | |
1200 | + | if ((size(i.payments) != 0)) | |
1201 | + | then throw("unstake doesn't require any payments") | |
322 | 1202 | else { | |
323 | - | let stakedTime = valueOrElse(getInteger(stakingContract, keyStakedTimeByAssetId(landAssetId)), 0) | |
324 | - | let owner = if ((stakedTime > 0)) | |
325 | - | then value(getString(stakingContract, keyLandAssetIdToOwner(landAssetId))) | |
326 | - | else if (if (isDefined(addr)) | |
327 | - | then (assetBalance(value(addr), landAsset) == 1) | |
328 | - | else false) | |
329 | - | then userAddressOpt | |
330 | - | else "" | |
331 | - | let stakedDuck = getString(stakingContract, keyStakedDuckByOwner(userAddressOpt)) | |
332 | - | let duckInf = if (if (isDefined(addr)) | |
333 | - | then isDefined(stakedDuck) | |
334 | - | else false) | |
335 | - | then { | |
336 | - | let duckAssetId = value(stakedDuck) | |
337 | - | $Tuple2(duckAssetId, duckInfoTuple(duckAssetId)) | |
1203 | + | let addr = toString(i.caller) | |
1204 | + | let c = checkClaimConditions(addr, claimModeDuck, landAssetIdIn) | |
1205 | + | let landAssetId = c._2 | |
1206 | + | let landsKey = keyStakedLandsByOwner(addr) | |
1207 | + | let terrainCounts = countTerrains(c._3[recTerrains]) | |
1208 | + | let pieces = numPiecesBySize(c._3[recLandSize]) | |
1209 | + | let props = updateProportions(terrainCounts, (pieces / SSIZE), -1) | |
1210 | + | let claimResult = claimAll(addr, landAssetId, pieces, claimModeDuck) | |
1211 | + | let lands = split_51C(valueOrElse(getString(landsKey), ""), "_") | |
1212 | + | let idx = indexOf(lands, landAssetId) | |
1213 | + | if (!(isDefined(idx))) | |
1214 | + | then throw(("Your staked lands don't contain " + landAssetId)) | |
1215 | + | else { | |
1216 | + | let t = value(blockInfoByHeight(height)).timestamp | |
1217 | + | let releaseTime = valueOrElse(getInteger(govContract, keyUserGwlReleaseTime(addr)), 0) | |
1218 | + | if ((releaseTime >= t)) | |
1219 | + | then throw(("Your gWL are taking part in voting, cannot unstake until " + toString(releaseTime))) | |
1220 | + | else [ScriptTransfer(i.caller, 1, fromBase58String(landAssetId)), DeleteEntry(keyStakedTimeByAssetId(landAssetId)), DeleteEntry(keyStakedTimeByTypeAssetIdAndOwner(LANDPREFIX, landAssetId, addr)), StringEntry(keyResProportions(), props), StringEntry(claimResult._2, makeString(claimResult._3, ":")), if ((size(lands) > 1)) | |
1221 | + | then StringEntry(landsKey, makeString_11C(removeByIndex(lands, value(idx)), "_")) | |
1222 | + | else DeleteEntry(landsKey), prologAction] | |
338 | 1223 | } | |
339 | - | else $Tuple2("", $Tuple5(-1, "", "", -1, "")) | |
340 | - | $Tuple2(nil, $Tuple3(landInfoArray(landAssetId, owner, stakedTime), duckInfoArray(duckInf._1, userAddressOpt, duckInf._2), walletInternal(userAddressOpt))) | |
341 | 1224 | } | |
342 | 1225 | } | |
343 | 1226 | ||
344 | 1227 | ||
345 | 1228 | ||
346 | 1229 | @Callable(i) | |
347 | - | func stakedLandsInfoREADONLY (myAddress,landOwnerAddress) = if ((landOwnerAddress == "")) | |
348 | - | then throw("landOwnerAddress is required") | |
349 | - | else { | |
350 | - | let myAddr = addressFromString(myAddress) | |
351 | - | let landsStr = getString(stakingContract, keyStakedLandsByOwner(landOwnerAddress)) | |
352 | - | let lands = if (isDefined(landsStr)) | |
353 | - | then split_51C(value(landsStr), "_") | |
354 | - | else nil | |
355 | - | func oneLand (acc,landAssetId) = { | |
356 | - | let landAsset = fromBase58String(landAssetId) | |
357 | - | if ((landAssetId == "")) | |
358 | - | then throw("landAssetId is required") | |
1230 | + | func stakeDuck () = { | |
1231 | + | let prologAction = prolog(i) | |
1232 | + | if ((size(i.payments) != 1)) | |
1233 | + | then throw("Exactly one payment required") | |
1234 | + | else { | |
1235 | + | let pmt = value(i.payments[0]) | |
1236 | + | let assetId = value(pmt.assetId) | |
1237 | + | let address = toString(i.caller) | |
1238 | + | if ((pmt.amount != 1)) | |
1239 | + | then throw((("NFT " + DUCKPREFIX) + " token should be attached as payment")) | |
359 | 1240 | else { | |
360 | - | let stakedTime = valueOrElse(getInteger(stakingContract, keyStakedTimeByAssetId(landAssetId)), 0) | |
361 | - | let descr = value(assetInfo(landAsset)).description | |
362 | - | let d = split(descr, "_") | |
363 | - | let pieces = numPiecesBySize(d[recLandSize]) | |
364 | - | let productivity = applyBonuses(landAssetId, pieces) | |
365 | - | let deltaTime = (lastBlock.timestamp - stakedTime) | |
366 | - | let availRes = fraction(deltaTime, (productivity._3 * pieces), DAYMILLIS) | |
367 | - | (acc :+ [("%s%s__landAssetId__" + landAssetId), ("%s%d__stakedTime__" + toString(stakedTime)), ("%s%s__description__" + descr), ("%s%d__infraLevel__" + toString(productivity._1)), makeString(["%s%s", "landArtefacts", ("PRESALE:" + toString(productivity._2))], SEP), ("%s%s__availRes__" + toString(availRes))]) | |
1241 | + | let asset = value(assetInfo(assetId)) | |
1242 | + | if (if ((asset.issuer != incubatorAddr)) | |
1243 | + | then (asset.issuer != breederAddr) | |
1244 | + | else false) | |
1245 | + | then throw((("Unknown issuer of " + DUCKPREFIX) + " token")) | |
1246 | + | else if (!(contains(asset.name, DUCKPREFIX))) | |
1247 | + | then throw((("Only NFT " + DUCKPREFIX) + " tokens are accepted")) | |
1248 | + | else { | |
1249 | + | let assetIdStr = toBase58String(assetId) | |
1250 | + | let timeKey = keyStakedTimeByAssetId(assetIdStr) | |
1251 | + | if (isDefined(getInteger(timeKey))) | |
1252 | + | then throw((("NFT " + asset.name) + " is already staked")) | |
1253 | + | else if (isDefined(getString(keyStakedDuckByOwner(address)))) | |
1254 | + | then throw(("You already staked one duck: " + asset.name)) | |
1255 | + | else { | |
1256 | + | let locKey = keyDuckLocation(assetIdStr) | |
1257 | + | let location = getString(locKey) | |
1258 | + | let bpKey = keyBackpackByDuck(assetIdStr) | |
1259 | + | let backpack = getString(bpKey) | |
1260 | + | ([IntegerEntry(timeKey, lastBlock.timestamp), IntegerEntry(keyStakedTimeByTypeAssetIdAndOwner(DUCKPREFIX, toBase58String(assetId), address), lastBlock.timestamp), StringEntry(keyDuckIdToOwner(assetIdStr), address), StringEntry(keyStakedDuckByOwner(address), assetIdStr)] ++ (if (isDefined(location)) | |
1261 | + | then nil | |
1262 | + | else ([StringEntry(locKey, DEFAULTLOCATION)] ++ (if (isDefined(backpack)) | |
1263 | + | then nil | |
1264 | + | else (([StringEntry(bpKey, "0:0_0_0_0_0_0:0_0_0_0_0_0:")] :+ IntegerEntry(keyDuckHealth(assetIdStr), 100)) :+ prologAction))))) | |
1265 | + | } | |
1266 | + | } | |
368 | 1267 | } | |
369 | 1268 | } | |
1269 | + | } | |
370 | 1270 | ||
371 | - | let r = { | |
372 | - | let $l = lands | |
373 | - | let $s = size($l) | |
374 | - | let $acc0 = nil | |
375 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
376 | - | then $a | |
377 | - | else oneLand($a, $l[$i]) | |
378 | 1271 | ||
379 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
380 | - | then $a | |
381 | - | else throw("List size exceeds 100") | |
382 | 1272 | ||
383 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50), 51), 52), 53), 54), 55), 56), 57), 58), 59), 60), 61), 62), 63), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99), 100) | |
1273 | + | @Callable(i) | |
1274 | + | func unstakeDuck (assetIdStr) = { | |
1275 | + | let prologAction = prolog(i) | |
1276 | + | if ((size(i.payments) != 0)) | |
1277 | + | then throw("unstake doesn't require any payments") | |
1278 | + | else { | |
1279 | + | let assetId = fromBase58String(assetIdStr) | |
1280 | + | let address = toString(i.caller) | |
1281 | + | let asset = value(assetInfo(assetId)) | |
1282 | + | let timeKey = keyStakedTimeByAssetId(toBase58String(assetId)) | |
1283 | + | if (!(isDefined(getInteger(timeKey)))) | |
1284 | + | then throw((("NFT " + asset.name) + " is not staked")) | |
1285 | + | else if (!(isDefined(getString(keyStakedDuckByOwner(address))))) | |
1286 | + | then throw((("The duck " + asset.name) + " is not staked")) | |
1287 | + | else { | |
1288 | + | let owner = valueOrErrorMessage(getString(keyDuckIdToOwner(toBase58String(assetId))), (("NFT " + asset.name) + " is orphaned")) | |
1289 | + | if ((owner != address)) | |
1290 | + | then throw("Staked NFT is not yours") | |
1291 | + | else { | |
1292 | + | let keyHealth = keyDuckHealth(assetIdStr) | |
1293 | + | let health = valueOrElse(getInteger(keyHealth), 100) | |
1294 | + | if ((health != 100)) | |
1295 | + | then throw("Please heal your duck before unstaking") | |
1296 | + | else [ScriptTransfer(i.caller, 1, assetId), DeleteEntry(timeKey), DeleteEntry(keyHealth), DeleteEntry(keyDuckLocation(assetIdStr)), DeleteEntry(keyDuckIdToOwner(assetIdStr)), DeleteEntry(keyStakedTimeByTypeAssetIdAndOwner(DUCKPREFIX, assetIdStr, address)), DeleteEntry(keyStakedDuckByOwner(address)), prologAction] | |
1297 | + | } | |
1298 | + | } | |
384 | 1299 | } | |
385 | - | let stakedDuck = getString(stakingContract, keyStakedDuckByOwner(myAddress)) | |
386 | - | let duckInf = if (if (isDefined(myAddr)) | |
387 | - | then isDefined(stakedDuck) | |
388 | - | else false) | |
389 | - | then { | |
390 | - | let duckAssetId = value(stakedDuck) | |
391 | - | $Tuple2(duckAssetId, duckInfoTuple(duckAssetId)) | |
1300 | + | } | |
1301 | + | ||
1302 | + | ||
1303 | + | ||
1304 | + | @Callable(i) | |
1305 | + | func claimRes (amount,landAssetIdStr) = { | |
1306 | + | let prologAction = prolog(i) | |
1307 | + | if ((size(i.payments) != 0)) | |
1308 | + | then throw("claimRes doesn't require any payments") | |
1309 | + | else { | |
1310 | + | let addr = toString(i.originCaller) | |
1311 | + | let result = claimResInternal(addr, amount, claimModeDuck, landAssetIdStr) | |
1312 | + | $Tuple2((((result._1 :+ StringEntry(result._2, makeString(result._3, ":"))) :+ StringEntry(result._4, makeString(result._5, ":"))) :+ prologAction), result._3[bpIdxRes]) | |
1313 | + | } | |
1314 | + | } | |
1315 | + | ||
1316 | + | ||
1317 | + | ||
1318 | + | @Callable(i) | |
1319 | + | func claimResToWH (amount,landAssetIdStr) = { | |
1320 | + | let prologAction = prolog(i) | |
1321 | + | if ((size(i.payments) != 0)) | |
1322 | + | then throw("claimRes doesn't require any payments") | |
1323 | + | else { | |
1324 | + | let addr = toString(i.originCaller) | |
1325 | + | let result = claimResInternal(addr, amount, claimModeWh, landAssetIdStr) | |
1326 | + | $Tuple2((((result._1 :+ StringEntry(result._2, makeString(result._3, ":"))) :+ StringEntry(result._4, makeString(result._5, ":"))) :+ prologAction), result._5[whIdxRes]) | |
1327 | + | } | |
1328 | + | } | |
1329 | + | ||
1330 | + | ||
1331 | + | ||
1332 | + | @Callable(i) | |
1333 | + | func flight (message,sig) = { | |
1334 | + | let prologAction = prolog(i) | |
1335 | + | if (!(sigVerify_8Kb(message, sig, pub))) | |
1336 | + | then throw("signature does not match") | |
1337 | + | else if ((size(i.payments) != 0)) | |
1338 | + | then throw("flight doesn't require any payments") | |
1339 | + | else { | |
1340 | + | let parts = split(toUtf8String(message), ";") | |
1341 | + | let hp = split(split(parts[0], "|")[0], "_") | |
1342 | + | let curHP = parseIntValue(hp[0]) | |
1343 | + | let newHP = parseIntValue(hp[1]) | |
1344 | + | let newLocAndTime = split(parts[1], ":") | |
1345 | + | let newLocation = newLocAndTime[0] | |
1346 | + | let time = parseIntValue(newLocAndTime[1]) | |
1347 | + | if (if ((time > (lastBlock.timestamp + FIVEMINUTESMILLIS))) | |
1348 | + | then true | |
1349 | + | else ((lastBlock.timestamp - FIVEMINUTESMILLIS) > time)) | |
1350 | + | then throw("signature outdated") | |
1351 | + | else { | |
1352 | + | let duckAssetId = valueOrErrorMessage(getString(keyStakedDuckByOwner(toString(i.caller))), "You don't have a duck staked") | |
1353 | + | let keyHealth = keyDuckHealth(duckAssetId) | |
1354 | + | let oldFromState = valueOrElse(getInteger(keyHealth), 100) | |
1355 | + | if ((oldFromState != curHP)) | |
1356 | + | then throw(((("oldHealth=" + toString(valueOrElse(getInteger(keyHealth), 100))) + " from state does not match one from flight log=") + toString(curHP))) | |
1357 | + | else if ((0 >= curHP)) | |
1358 | + | then throw("You can't fly with zero health") | |
1359 | + | else { | |
1360 | + | let locKey = keyDuckLocation(duckAssetId) | |
1361 | + | let curLocation = valueOrElse(getString(locKey), DEFAULTLOCATION) | |
1362 | + | if ((newLocation == curLocation)) | |
1363 | + | then throw("You can't fly to the same location") | |
1364 | + | else $Tuple2([StringEntry(locKey, if ((newHP > 0)) | |
1365 | + | then newLocation | |
1366 | + | else curLocation), IntegerEntry(keyHealth, newHP), prologAction], unit) | |
1367 | + | } | |
1368 | + | } | |
392 | 1369 | } | |
393 | - | else $Tuple2("", $Tuple5(-1, "", "", -1, "")) | |
394 | - | $Tuple2(nil, $Tuple3(r, duckInfoArray(duckInf._1, myAddress, duckInf._2), walletInternal(myAddress))) | |
1370 | + | } | |
1371 | + | ||
1372 | + | ||
1373 | + | ||
1374 | + | @Callable(i) | |
1375 | + | func setHealth (health,duckAssetId) = { | |
1376 | + | let prologAction = prolog(i) | |
1377 | + | if (if ((0 > health)) | |
1378 | + | then true | |
1379 | + | else (health > 100)) | |
1380 | + | then throw("HP should be within 0..100") | |
1381 | + | else [IntegerEntry(keyDuckHealth(duckAssetId), health), prologAction] | |
1382 | + | } | |
1383 | + | ||
1384 | + | ||
1385 | + | ||
1386 | + | @Callable(i) | |
1387 | + | func heal (matType,amount) = { | |
1388 | + | let prologAction = prolog(i) | |
1389 | + | if (if ((0 > matType)) | |
1390 | + | then true | |
1391 | + | else (matType >= NUMRES)) | |
1392 | + | then throw(("Unknown material: " + toString(matType))) | |
1393 | + | else if ((0 >= amount)) | |
1394 | + | then throw(("Amount should be positive! " + toString(amount))) | |
1395 | + | else { | |
1396 | + | let duckAssetId = valueOrErrorMessage(getString(keyStakedDuckByOwner(toString(i.caller))), "You don't have a duck staked") | |
1397 | + | let keyHealth = keyDuckHealth(duckAssetId) | |
1398 | + | let oldHealth = valueOrElse(getInteger(keyHealth), 100) | |
1399 | + | if ((oldHealth >= 100)) | |
1400 | + | then throw("HP should be < 100 to heal") | |
1401 | + | else { | |
1402 | + | let bpKey = keyBackpackByDuck(duckAssetId) | |
1403 | + | let currentPack = getBackpack(bpKey) | |
1404 | + | let mList = split(currentPack[bpIdxMat], "_") | |
1405 | + | let currentAmount = parseIntValue(mList[matType]) | |
1406 | + | let deltaHealth = min([(amount / HEALCOST), (100 - oldHealth)]) | |
1407 | + | let spendAmount = (deltaHealth * HEALCOST) | |
1408 | + | if ((spendAmount > currentAmount)) | |
1409 | + | then throw(((((("You need " + toString(spendAmount)) + " of ") + matTypes[matType]) + " to heal, but you backpack contains ") + toString(currentAmount))) | |
1410 | + | else { | |
1411 | + | let newMat = subOneInList(mList, matType, spendAmount) | |
1412 | + | [IntegerEntry(keyHealth, (oldHealth + deltaHealth)), StringEntry(bpKey, makeString([currentPack[bpIdxLevel], currentPack[bpIdxRes], newMat, currentPack[bpIdxProd]], ":")), prologAction] | |
1413 | + | } | |
1414 | + | } | |
1415 | + | } | |
1416 | + | } | |
1417 | + | ||
1418 | + | ||
1419 | + | ||
1420 | + | @Callable(i) | |
1421 | + | func updateBackpack (duckAssetId,newPack) = { | |
1422 | + | let prologAction = prolog(i) | |
1423 | + | if ((i.caller != economyContract)) | |
1424 | + | then throw("permission denied") | |
1425 | + | else $Tuple2([StringEntry(keyBackpackByDuck(duckAssetId), newPack), prologAction], newPack) | |
1426 | + | } | |
1427 | + | ||
1428 | + | ||
1429 | + | ||
1430 | + | @Callable(i) | |
1431 | + | func buySLand () = if ((i.caller != this)) | |
1432 | + | then throw("Permission denied") | |
1433 | + | else { | |
1434 | + | let prologAction = prolog(i) | |
1435 | + | if ((size(i.payments) != 1)) | |
1436 | + | then throw("Exactly one payment required") | |
1437 | + | else { | |
1438 | + | let pmt = value(i.payments[0]) | |
1439 | + | if ((pmt.assetId != usdnAssetId)) | |
1440 | + | then throw("Allowed USDN payment only!") | |
1441 | + | else if ((pmt.amount != EXPUSDN)) | |
1442 | + | then throw(("Payment attached should be " + toString(EXPUSDN))) | |
1443 | + | else { | |
1444 | + | let result = expeditionInternal(i.caller, i.transactionId) | |
1445 | + | $Tuple2(((result._1 :+ ScriptTransfer(economyContract, pmt.amount, usdnAssetId)) :+ prologAction), result._2._1) | |
1446 | + | } | |
1447 | + | } | |
395 | 1448 | } | |
396 | 1449 | ||
397 | 1450 | ||
398 | 1451 | ||
399 | 1452 | @Callable(i) | |
400 | - | func duckByOwnerInfoREADONLY (userAddress) = { | |
401 | - | let stakedDuck = getString(stakingContract, keyStakedDuckByOwner(userAddress)) | |
402 | - | $Tuple2(nil, if (if (isDefined(addressFromString(userAddress))) | |
403 | - | then isDefined(stakedDuck) | |
404 | - | else false) | |
405 | - | then { | |
406 | - | let duckAssetId = value(stakedDuck) | |
407 | - | duckInfoArray(duckAssetId, userAddress, duckInfoTuple(duckAssetId)) | |
1453 | + | func expedition (message,sig) = { | |
1454 | + | let prologAction = prolog(i) | |
1455 | + | if ((size(i.payments) != 0)) | |
1456 | + | then throw("expedition doesn't require any payments") | |
1457 | + | else { | |
1458 | + | let result = expeditionCommon(true, i.caller, i.transactionId, message, sig) | |
1459 | + | $Tuple2((result._1 :+ prologAction), result._2) | |
408 | 1460 | } | |
409 | - | else duckInfoArray("", userAddress, $Tuple5(-1, "", "", -1, ""))) | |
410 | 1461 | } | |
411 | 1462 | ||
412 | 1463 | ||
413 | 1464 | ||
414 | 1465 | @Callable(i) | |
415 | - | func duckByAssetIdInfoREADONLY (duckAssetId) = { | |
416 | - | let owner = getString(stakingContract, keyDuckIdToOwner(duckAssetId)) | |
417 | - | let duckInf = duckInfoTuple(duckAssetId) | |
418 | - | $Tuple2(nil, duckInfoArray(duckAssetId, if (isDefined(owner)) | |
419 | - | then value(owner) | |
420 | - | else "", duckInfoTuple(duckAssetId))) | |
1466 | + | func upgradeInfra (landAssetId) = { | |
1467 | + | let prologAction = prolog(i) | |
1468 | + | if ((size(i.payments) != 0)) | |
1469 | + | then throw("Infrastructure upgrade doesn't require any payments") | |
1470 | + | else { | |
1471 | + | let result = upInfraCommon(true, i.caller, 0, landAssetId) | |
1472 | + | $Tuple2((result._1 :+ prologAction), result._2) | |
1473 | + | } | |
421 | 1474 | } | |
422 | 1475 | ||
423 | 1476 | ||
424 | 1477 | ||
425 | 1478 | @Callable(i) | |
426 | - | func | |
427 | - | then throw(" | |
1479 | + | func upgradeInfraUsdn (landAssetId) = if ((i.caller != this)) | |
1480 | + | then throw("Permission denied") | |
428 | 1481 | else { | |
429 | - | let stakedTime = valueOrElse(getInteger(stakingContract, keyStakedTimeByAssetId(landAssetId)), -1) | |
430 | - | let owner = if ((stakedTime > 0)) | |
431 | - | then value(getString(stakingContract, keyLandAssetIdToOwner(landAssetId))) | |
432 | - | else "" | |
433 | - | $Tuple2(nil, landInfoArray(landAssetId, owner, stakedTime)) | |
1482 | + | let prologAction = prolog(i) | |
1483 | + | if ((size(i.payments) != 1)) | |
1484 | + | then throw("Exactly one payment required") | |
1485 | + | else { | |
1486 | + | let pmt = value(i.payments[0]) | |
1487 | + | if ((pmt.assetId != usdnAssetId)) | |
1488 | + | then throw("Allowed USDN payment only!") | |
1489 | + | else { | |
1490 | + | let result = upInfraCommon(false, i.caller, pmt.amount, landAssetId) | |
1491 | + | $Tuple2(((result._1 :+ ScriptTransfer(economyContract, pmt.amount, usdnAssetId)) :+ prologAction), result._2) | |
1492 | + | } | |
1493 | + | } | |
434 | 1494 | } | |
435 | 1495 | ||
436 | 1496 | ||
437 | 1497 | ||
438 | 1498 | @Callable(i) | |
439 | - | func stakedLandsByOwnerInfoREADONLY (landOwnerAddress) = if ((landOwnerAddress == "")) | |
440 | - | then throw("landOwnerAddress is required") | |
441 | - | else { | |
442 | - | let landsStr = getString(stakingContract, keyStakedLandsByOwner(landOwnerAddress)) | |
443 | - | let lands = if (isDefined(landsStr)) | |
444 | - | then split_51C(value(landsStr), "_") | |
445 | - | else nil | |
446 | - | func oneLand (acc,landAssetId) = if ((landAssetId == "")) | |
447 | - | then throw("landAssetId is required") | |
448 | - | else { | |
449 | - | let stakedTime = valueOrElse(getInteger(stakingContract, keyStakedTimeByAssetId(landAssetId)), -1) | |
450 | - | (acc :+ landInfoArray(landAssetId, landOwnerAddress, stakedTime)) | |
451 | - | } | |
452 | - | ||
453 | - | let r = { | |
454 | - | let $l = lands | |
455 | - | let $s = size($l) | |
456 | - | let $acc0 = nil | |
457 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
458 | - | then $a | |
459 | - | else oneLand($a, $l[$i]) | |
460 | - | ||
461 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
462 | - | then $a | |
463 | - | else throw("List size exceeds 100") | |
464 | - | ||
465 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50), 51), 52), 53), 54), 55), 56), 57), 58), 59), 60), 61), 62), 63), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99), 100) | |
1499 | + | func activateArtifact (artName,landAssetId) = { | |
1500 | + | let prologAction = prolog(i) | |
1501 | + | if ((size(i.payments) != 0)) | |
1502 | + | then throw("Artifact activation doesn't require any payments") | |
1503 | + | else { | |
1504 | + | let result = match artName { | |
1505 | + | case _ => | |
1506 | + | if (("PRESALE" == $match0)) | |
1507 | + | then activatePresaleArt(toString(i.caller), landAssetId) | |
1508 | + | else throw("Unknown artifact") | |
466 | 1509 | } | |
467 | - | $Tuple2(nil, r) | |
468 | - | } | |
469 | - | ||
470 | - | ||
471 | - | ||
472 | - | @Callable(i) | |
473 | - | func landsByIdsInfoREADONLY (landAssetIds) = { | |
474 | - | func oneLand (acc,landAssetId) = if ((landAssetId == "")) | |
475 | - | then throw("landAssetId is required") | |
476 | - | else { | |
477 | - | let stakedTime = valueOrElse(getInteger(stakingContract, keyStakedTimeByAssetId(landAssetId)), -1) | |
478 | - | let owner = if ((stakedTime > 0)) | |
479 | - | then value(getString(stakingContract, keyLandAssetIdToOwner(landAssetId))) | |
480 | - | else "" | |
481 | - | (acc :+ landInfoArray(landAssetId, owner, stakedTime)) | |
1510 | + | (result :+ prologAction) | |
482 | 1511 | } | |
483 | - | ||
484 | - | let r = { | |
485 | - | let $l = landAssetIds | |
486 | - | let $s = size($l) | |
487 | - | let $acc0 = nil | |
488 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
489 | - | then $a | |
490 | - | else oneLand($a, $l[$i]) | |
491 | - | ||
492 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
493 | - | then $a | |
494 | - | else throw("List size exceeds 100") | |
495 | - | ||
496 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50), 51), 52), 53), 54), 55), 56), 57), 58), 59), 60), 61), 62), 63), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99), 100) | |
497 | - | } | |
498 | - | $Tuple2(nil, r) | |
499 | 1512 | } | |
500 | 1513 | ||
501 | 1514 | ||
502 | 1515 | ||
503 | 1516 | @Callable(i) | |
504 | - | func warehouseOrderByAssetIdInfoREADONLY (landAssetId) = if ((landAssetId == "")) | |
505 | - | then throw("landAssetId is required") | |
506 | - | else { | |
507 | - | let stakedTime = valueOrElse(getInteger(stakingContract, keyStakedTimeByAssetId(landAssetId)), -1) | |
508 | - | let owner = if ((stakedTime > 0)) | |
509 | - | then value(getString(stakingContract, keyLandAssetIdToOwner(landAssetId))) | |
510 | - | else "" | |
511 | - | $Tuple2(nil, landOrderInfoArray(landAssetId, owner)) | |
512 | - | } | |
513 | - | ||
514 | - | ||
515 | - | ||
516 | - | @Callable(i) | |
517 | - | func ordersByLandIdsInfoREADONLY (landAssetIds) = { | |
518 | - | func oneLand (acc,landAssetId) = if ((landAssetId == "")) | |
519 | - | then throw("landAssetId is required") | |
1517 | + | func mergeLands (landAssetIds) = { | |
1518 | + | let prologAction = prolog(i) | |
1519 | + | if ((size(i.payments) != 0)) | |
1520 | + | then throw("Lands merging doesn't require any payments") | |
520 | 1521 | else { | |
521 | - | let stakedTime = valueOrElse(getInteger(stakingContract, keyStakedTimeByAssetId(landAssetId)), -1) | |
522 | - | let owner = if ((stakedTime > 0)) | |
523 | - | then value(getString(stakingContract, keyLandAssetIdToOwner(landAssetId))) | |
524 | - | else "" | |
525 | - | (acc :+ landOrderInfoArray(landAssetId, owner)) | |
1522 | + | let result = mergeCommon(true, toString(i.caller), 0, landAssetIds, i.transactionId) | |
1523 | + | $Tuple2((result._1 :+ prologAction), result._2) | |
526 | 1524 | } | |
527 | - | ||
528 | - | let r = { | |
529 | - | let $l = landAssetIds | |
530 | - | let $s = size($l) | |
531 | - | let $acc0 = nil | |
532 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
533 | - | then $a | |
534 | - | else oneLand($a, $l[$i]) | |
535 | - | ||
536 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
537 | - | then $a | |
538 | - | else throw("List size exceeds 100") | |
539 | - | ||
540 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50), 51), 52), 53), 54), 55), 56), 57), 58), 59), 60), 61), 62), 63), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99), 100) | |
541 | - | } | |
542 | - | $Tuple2(nil, r) | |
543 | 1525 | } | |
544 | 1526 | ||
545 | 1527 | ||
546 | 1528 | ||
547 | 1529 | @Callable(i) | |
548 | - | func cancelWarehouseOrders (landAssetIds) = if ((i.caller != this)) | |
549 | - | then throw("permission denied") | |
550 | - | else { | |
551 | - | let blocked = getBoolean(stakingContract, keyBlocked()) | |
552 | - | if (if (!(isDefined(blocked))) | |
553 | - | then true | |
554 | - | else (value(blocked) == false)) | |
555 | - | then throw("Contracts should be blocked before canceling orders") | |
556 | - | else { | |
557 | - | func oneLand (a,landAssetId) = if ((landAssetId == "")) | |
558 | - | then throw("landAssetId is required") | |
559 | - | else { | |
560 | - | let c = asBoolean(invoke(economyContract, "setWarehouseOrder", ["0@0_0@0_0@0_0@0_0@0_0@0:0@0_0@0_0@0_0@0_0@0_0@0:", landAssetId], nil)) | |
561 | - | if (if (a) | |
562 | - | then true | |
563 | - | else c) | |
564 | - | then !(if (a) | |
565 | - | then c | |
566 | - | else false) | |
567 | - | else false | |
568 | - | } | |
1530 | + | func mergeLandsUsdn (landAssetIds) = { | |
1531 | + | let prologAction = prolog(i) | |
1532 | + | if ((size(i.payments) != 1)) | |
1533 | + | then throw("Exactly one payment required") | |
1534 | + | else { | |
1535 | + | let pmt = value(i.payments[0]) | |
1536 | + | if ((pmt.assetId != usdnAssetId)) | |
1537 | + | then throw("Allowed USDN payment only!") | |
1538 | + | else { | |
1539 | + | let result = mergeCommon(false, toString(i.caller), pmt.amount, landAssetIds, i.transactionId) | |
1540 | + | $Tuple2(((result._1 :+ ScriptTransfer(economyContract, pmt.amount, usdnAssetId)) :+ prologAction), result._2) | |
1541 | + | } | |
1542 | + | } | |
1543 | + | } | |
569 | 1544 | ||
570 | - | let r = { | |
571 | - | let $l = landAssetIds | |
572 | - | let $s = size($l) | |
573 | - | let $acc0 = false | |
574 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
575 | - | then $a | |
576 | - | else oneLand($a, $l[$i]) | |
577 | 1545 | ||
578 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
579 | - | then $a | |
580 | - | else throw("List size exceeds 30") | |
581 | 1546 | ||
582 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30) | |
1547 | + | @Callable(i) | |
1548 | + | func cargoExchange (cargoListStr,landAssetId) = { | |
1549 | + | let prologAction = prolog(i) | |
1550 | + | let cargoParts = split_4C(cargoListStr, ":") | |
1551 | + | let addr = toString(i.originCaller) | |
1552 | + | let asset = value(assetInfo(fromBase58String(landAssetId))) | |
1553 | + | let timeKey = keyStakedTimeByAssetId(landAssetId) | |
1554 | + | if (!(isDefined(getInteger(timeKey)))) | |
1555 | + | then throw((asset.name + " is not staked")) | |
1556 | + | else { | |
1557 | + | let owner = valueOrErrorMessage(getString(keyLandAssetIdToOwner(landAssetId)), (("NFT " + asset.name) + " is orphaned")) | |
1558 | + | if ((owner != addr)) | |
1559 | + | then throw((LANDPREFIX + " is not yours")) | |
1560 | + | else { | |
1561 | + | let landIndex = (numPiecesBySize(split(asset.description, "_")[recLandSize]) / SSIZE) | |
1562 | + | let infraLevel = valueOrElse(getInteger(keyInfraLevelByAssetId(landAssetId)), 0) | |
1563 | + | let duckAssetId = valueOrErrorMessage(getString(keyStakedDuckByOwner(addr)), "You don't have a duck staked") | |
1564 | + | let curLocation = valueOrElse(getString(keyDuckLocation(duckAssetId)), DEFAULTLOCATION) | |
1565 | + | let loc = split(value(curLocation), "_") | |
1566 | + | if ((loc[locIdxType] != "L")) | |
1567 | + | then throw((("Duck location type is " + loc[locIdxType]) + ", but should be L")) | |
1568 | + | else if ((loc[locIdxId] != landAssetId)) | |
1569 | + | then throw(("Duck should be on the land " + landAssetId)) | |
1570 | + | else { | |
1571 | + | let whKey = keyWarehouseByLand(landAssetId) | |
1572 | + | let currentWh = getWarehouse(whKey, landIndex, infraLevel) | |
1573 | + | let bpKey = keyBackpackByDuck(duckAssetId) | |
1574 | + | let currentPack = getBackpack(bpKey) | |
1575 | + | let result = moveStuff(cargoParts, currentWh, currentPack) | |
1576 | + | [StringEntry(bpKey, makeString([currentPack[bpIdxLevel], result._4, result._5, result._6], ":")), StringEntry(whKey, makeString([currentWh[whIdxVol], result._1, result._2, result._3, currentWh[whIdxLockedVol]], ":")), prologAction] | |
1577 | + | } | |
583 | 1578 | } | |
584 | - | $Tuple2(nil, r) | |
585 | - | } | |
586 | - | } | |
1579 | + | } | |
1580 | + | } | |
1581 | + | ||
1582 | + | ||
1583 | + | ||
1584 | + | @Callable(i) | |
1585 | + | func saveWarehouse (whStr,landAssetId) = { | |
1586 | + | let prologAction = prolog(i) | |
1587 | + | if ((i.caller != economyContract)) | |
1588 | + | then throw("Access denied") | |
1589 | + | else { | |
1590 | + | let whKey = keyWarehouseByLand(landAssetId) | |
1591 | + | if ((size(split_4C(whStr, ":")) != 5)) | |
1592 | + | then throw("warehouse string should contain 4 ':' separators") | |
1593 | + | else $Tuple2([StringEntry(whKey, whStr), prologAction], whStr) | |
1594 | + | } | |
1595 | + | } | |
1596 | + | ||
1597 | + | ||
1598 | + | ||
1599 | + | @Callable(i) | |
1600 | + | func splitByGlobalWeightsREADONLY (amount) = $Tuple2(nil, getNeededMaterials(amount)) | |
1601 | + | ||
1602 | + | ||
1603 | + | ||
1604 | + | @Callable(i) | |
1605 | + | func splitByGlobalAndLocalWeightsREADONLY (matAmount,resAmount,terrains) = { | |
1606 | + | let terrainCounts = countTerrains(terrains) | |
1607 | + | $Tuple2(nil, $Tuple2(getNeededMaterials(matAmount), distributeByWeights(resAmount, terrainCounts))) | |
1608 | + | } | |
1609 | + | ||
1610 | + | ||
1611 | + | ||
1612 | + | @Callable(i) | |
1613 | + | func getBackpackREADONLY (duckAssetId) = $Tuple2(nil, makeString(getBackpack(keyBackpackByDuck(duckAssetId)), ":")) | |
1614 | + | ||
1615 | + | ||
1616 | + | ||
1617 | + | @Callable(i) | |
1618 | + | func getWarehouseREADONLY (landAssetId) = { | |
1619 | + | let asset = value(assetInfo(fromBase58String(landAssetId))) | |
1620 | + | let landIndex = (numPiecesBySize(split(asset.description, "_")[recLandSize]) / SSIZE) | |
1621 | + | let infraLevel = valueOrElse(getInteger(keyInfraLevelByAssetId(landAssetId)), 0) | |
1622 | + | $Tuple2(nil, makeString_2C(getWarehouse(keyWarehouseByLand(landAssetId), landIndex, infraLevel), ":")) | |
1623 | + | } | |
587 | 1624 | ||
588 | 1625 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let chain = take(drop(this.bytes, 1), 1) | |
5 | 5 | ||
6 | 6 | let usdnAssetId = match chain { | |
7 | 7 | case _ => | |
8 | 8 | if ((base58'2W' == $match0)) | |
9 | 9 | then base58'DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p' | |
10 | 10 | else if ((base58'2T' == $match0)) | |
11 | 11 | then base58'HezsdQuRDtzksAYUy97gfhKy7Z1NW2uXYSHA3bgqenNZ' | |
12 | 12 | else throw("Unknown chain") | |
13 | 13 | } | |
14 | 14 | ||
15 | - | let | |
15 | + | let incubatorAddr = match chain { | |
16 | 16 | case _ => | |
17 | 17 | if ((base58'2W' == $match0)) | |
18 | - | then | |
18 | + | then addressFromStringValue("3PEktVux2RhchSN63DsDo4b4mz4QqzKSeDv") | |
19 | 19 | else if ((base58'2T' == $match0)) | |
20 | - | then | |
20 | + | then this | |
21 | 21 | else throw("Unknown chain") | |
22 | 22 | } | |
23 | + | ||
24 | + | let breederAddr = match chain { | |
25 | + | case _ => | |
26 | + | if ((base58'2W' == $match0)) | |
27 | + | then addressFromStringValue("3PDVuU45H7Eh5dmtNbnRNRStGwULA7NY6Hb") | |
28 | + | else if ((base58'2T' == $match0)) | |
29 | + | then this | |
30 | + | else throw("Unknown chain") | |
31 | + | } | |
32 | + | ||
33 | + | let defaultRestAddressStr = match chain { | |
34 | + | case _ => | |
35 | + | if ((base58'2W' == $match0)) | |
36 | + | then "3PQCuvFbvh4LkPUnrnU1z3jnbA1p9m3WNhv" | |
37 | + | else if ((base58'2T' == $match0)) | |
38 | + | then "3MumkGGztCKAXpWDqxkddofqXSUbqQkvSJy" | |
39 | + | else throw("Unknown chain") | |
40 | + | } | |
41 | + | ||
42 | + | let pub = base58'6LfPuKJjLgekmncBhMg2LZyMTNVzZBccXR28ySXm9uXD' | |
43 | + | ||
44 | + | let HEALCOST = 10000 | |
23 | 45 | ||
24 | 46 | let LANDPREFIX = "LAND" | |
25 | 47 | ||
26 | 48 | let DUCKPREFIX = "DUCK" | |
27 | 49 | ||
28 | - | let SEP = "__" | |
29 | - | ||
30 | - | let ARTPRESALE = "PRESALE" | |
31 | - | ||
32 | - | let DAILYRESBYPIECE = 3456000 | |
33 | - | ||
34 | - | let DAYMILLIS = 86400000 | |
50 | + | let DEFAULTLOCATION = "Africa_F_Africa" | |
35 | 51 | ||
36 | 52 | let NUMRES = 6 | |
37 | 53 | ||
38 | 54 | let SSIZE = 25 | |
39 | 55 | ||
40 | 56 | let MSIZE = 100 | |
41 | 57 | ||
42 | 58 | let LSIZE = 225 | |
43 | 59 | ||
44 | 60 | let XLSIZE = 400 | |
45 | 61 | ||
46 | 62 | let XXLSIZE = 625 | |
47 | 63 | ||
48 | - | let | |
64 | + | let DAILYRESBYPIECE = 3456000 | |
49 | 65 | ||
50 | - | let | |
66 | + | let DAYMILLIS = 86400000 | |
51 | 67 | ||
52 | - | let | |
68 | + | let FIVEMINUTESMILLIS = 300000 | |
53 | 69 | ||
54 | - | let | |
70 | + | let RESOURCEPRICEMIN = 158549 | |
55 | 71 | ||
56 | - | let | |
72 | + | let WHMULTIPLIER = 10000000000 | |
57 | 73 | ||
58 | - | let whIdxRes = 1 | |
74 | + | let InfraUpgradeCostS = match chain { | |
75 | + | case _ => | |
76 | + | if ((base58'2W' == $match0)) | |
77 | + | then 6307198406 | |
78 | + | else if ((base58'2T' == $match0)) | |
79 | + | then 63071984 | |
80 | + | else throw("Unknown chain") | |
81 | + | } | |
59 | 82 | ||
60 | - | let whIdxMat = 2 | |
83 | + | let InfraUpgradeCostSUsdn = match chain { | |
84 | + | case _ => | |
85 | + | if ((base58'2W' == $match0)) | |
86 | + | then 40000000 | |
87 | + | else if ((base58'2T' == $match0)) | |
88 | + | then 400000 | |
89 | + | else throw("Unknown chain") | |
90 | + | } | |
61 | 91 | ||
62 | - | let whIdxProd = 3 | |
92 | + | let EXPMATERIALS = match chain { | |
93 | + | case _ => | |
94 | + | if ((base58'2W' == $match0)) | |
95 | + | then 157679960139 | |
96 | + | else if ((base58'2T' == $match0)) | |
97 | + | then 1576799601 | |
98 | + | else throw("Unknown chain") | |
99 | + | } | |
63 | 100 | ||
64 | - | let whIdxLockedVol = 4 | |
101 | + | let EXPUSDN = match chain { | |
102 | + | case _ => | |
103 | + | if ((base58'2W' == $match0)) | |
104 | + | then 1000000000 | |
105 | + | else if ((base58'2T' == $match0)) | |
106 | + | then 10000000 | |
107 | + | else throw("Unknown chain") | |
108 | + | } | |
65 | 109 | ||
66 | - | func keyRestCfg () = "%s__restConfig" | |
110 | + | let SEP = "__" | |
111 | + | ||
112 | + | let MULT6 = 1000000 | |
113 | + | ||
114 | + | let FIVEX = toBigInt(5) | |
115 | + | ||
116 | + | let TWENTYX = toBigInt(20) | |
117 | + | ||
118 | + | let TWENTY2X = toBigInt((20 * 20)) | |
119 | + | ||
120 | + | let TWENTY3X = toBigInt(((20 * 20) * 20)) | |
121 | + | ||
122 | + | let TWENTY4X = toBigInt((((20 * 20) * 20) * 20)) | |
123 | + | ||
124 | + | let TWENTY5X = toBigInt(((((20 * 20) * 20) * 20) * 20)) | |
125 | + | ||
126 | + | let matTypes = ["Fuel", "Metal", "Plank", "Glass", "Plastic", "Protein"] | |
127 | + | ||
128 | + | let continents = ["Asia", "Europe", "Americas", "Oceania", "Africa"] | |
129 | + | ||
130 | + | let ARTPRESALE = "PRESALE" | |
131 | + | ||
132 | + | let PRESALENUMLANDS = 500 | |
133 | + | ||
134 | + | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
135 | + | ||
136 | + | ||
137 | + | func getIntOrElse (key,defaultVal) = valueOrElse(getInteger(this, key), defaultVal) | |
67 | 138 | ||
68 | 139 | ||
69 | 140 | let IdxCfgStakingDapp = 1 | |
70 | 141 | ||
71 | 142 | let IdxCfgEconomyDapp = 2 | |
72 | 143 | ||
73 | 144 | let IdxCfgGovernanceDapp = 3 | |
74 | 145 | ||
75 | - | func | |
146 | + | func keyRestCfg () = "%s__restConfig" | |
76 | 147 | ||
77 | 148 | ||
78 | - | func readRestCfgOrFail () = split_4C(getStringOrFail(this, keyRestCfg()), SEP) | |
149 | + | func keyRestAddress () = "%s__restAddr" | |
150 | + | ||
151 | + | ||
152 | + | func readRestCfgOrFail (rest) = split_4C(getStringOrFail(rest, keyRestCfg()), SEP) | |
79 | 153 | ||
80 | 154 | ||
81 | 155 | func getContractAddressOrFail (restCfg,idx) = valueOrErrorMessage(addressFromString(restCfg[idx]), ("Rest cfg doesn't contain address at index " + toString(idx))) | |
82 | 156 | ||
83 | 157 | ||
84 | - | let | |
158 | + | let restContract = addressFromStringValue(valueOrElse(getString(this, keyRestAddress()), defaultRestAddressStr)) | |
85 | 159 | ||
86 | - | let | |
160 | + | let restCfg = readRestCfgOrFail(restContract) | |
87 | 161 | ||
88 | 162 | let economyContract = getContractAddressOrFail(restCfg, IdxCfgEconomyDapp) | |
89 | 163 | ||
90 | - | let | |
164 | + | let govContract = getContractAddressOrFail(restCfg, IdxCfgGovernanceDapp) | |
91 | 165 | ||
92 | - | func keyBlocked () = "contractsBlocked" | |
166 | + | func keyLastTxIdByUser (addr) = ("lastTxIdByUser_" + addr) | |
167 | + | ||
168 | + | ||
169 | + | func keyNextFreeLandNum () = "nextLandNum" | |
170 | + | ||
171 | + | ||
172 | + | func keyLandToAssetId (landNum) = ("landToAsset_" + landNum) | |
173 | + | ||
174 | + | ||
175 | + | func keyNftName (landNum,landSize) = ((LANDPREFIX + landNum) + landSize) | |
176 | + | ||
177 | + | ||
178 | + | func keyLandAssetIdToOwner (assetId) = ("nftOwner_" + assetId) | |
93 | 179 | ||
94 | 180 | ||
95 | 181 | func keyDuckIdToOwner (assetId) = ("duckOwner_" + assetId) | |
96 | 182 | ||
97 | 183 | ||
98 | 184 | func keyStakedTimeByAssetId (assetId) = ("stakedTime_" + assetId) | |
99 | 185 | ||
100 | 186 | ||
187 | + | func keyInfraLevelByAssetId (assetId) = ("infraLevel_" + assetId) | |
188 | + | ||
189 | + | ||
190 | + | func keyInfraLevelByAssetIdAndOwner (assetId,ownerAddr) = ((("infraLevelByAssetIdAndOwner_" + assetId) + "_") + ownerAddr) | |
191 | + | ||
192 | + | ||
193 | + | func keyPresaleArtActivatedByAssetId (assetId) = ("presaleArtActivated_" + assetId) | |
194 | + | ||
195 | + | ||
196 | + | func keyPresaleArtActivatedByAssetIdAndOwner (assetId,ownerAddr) = ((("presaleArtActivatedByAssetIdAndOwner_" + assetId) + "_") + ownerAddr) | |
197 | + | ||
198 | + | ||
199 | + | func keyLandArtStatusByTypeAndAssetId (type,assetId) = makeString(["landArtStatus", type, assetId], "_") | |
200 | + | ||
201 | + | ||
202 | + | func keyLandArtStatusByTypeAssetIdAndOwner (type,assetId,ownerAddr) = makeString(["landArtStatusByTypeAssetIdAndOwner", type, assetId, ownerAddr], "_") | |
203 | + | ||
204 | + | ||
101 | 205 | func keyStakedDuckByOwner (ownerAddr) = ("stakedDuckByOwner_" + ownerAddr) | |
102 | 206 | ||
103 | 207 | ||
104 | 208 | func keyStakedTimeByTypeAssetIdAndOwner (nftType,assetId,ownerAddr) = ((((("stakedTimeByTypeAssetIdAndOwner_" + nftType) + "_") + assetId) + "_") + ownerAddr) | |
209 | + | ||
210 | + | ||
211 | + | func keyLandNumToOwner (landNum) = ("landOwner_" + landNum) | |
105 | 212 | ||
106 | 213 | ||
107 | 214 | func keyBackpackByDuck (duckAssetId) = ("backPack_" + duckAssetId) | |
108 | 215 | ||
109 | 216 | ||
110 | 217 | func keyWarehouseByLand (landAssetId) = ("wareHouse_" + landAssetId) | |
111 | 218 | ||
112 | 219 | ||
113 | 220 | func keyDuckLocation (duckAssetId) = ("duckLocation_" + duckAssetId) | |
114 | 221 | ||
115 | 222 | ||
116 | 223 | func keyDuckHealth (duckAssetId) = ("duckHealth_" + duckAssetId) | |
117 | 224 | ||
118 | 225 | ||
119 | - | func keyLandAssetIdToOwner (assetId) = ("nftOwner_" + assetId) | |
120 | - | ||
121 | - | ||
122 | - | func keyInfraLevelByAssetId (assetId) = ("infraLevel_" + assetId) | |
123 | - | ||
124 | - | ||
125 | - | func keyLandArtStatusByTypeAndAssetId (type,assetId) = makeString(["landArtStatus", type, assetId], "_") | |
126 | - | ||
127 | - | ||
128 | - | func keyPresaleArtActivatedByAssetId (assetId) = ("presaleArtActivated_" + assetId) | |
226 | + | func keyResProportions () = "resTypesProportions" | |
129 | 227 | ||
130 | 228 | ||
131 | 229 | func keyStakedLandsByOwner (ownerAddr) = ("stakedLandsByOwner_" + ownerAddr) | |
132 | 230 | ||
133 | 231 | ||
134 | - | func | |
232 | + | func keyBlocked () = "contractsBlocked" | |
135 | 233 | ||
234 | + | ||
235 | + | func keyUserGwlReleaseTime (userAddr) = ("%s%s__userGwlReleaseTime__" + userAddr) | |
236 | + | ||
237 | + | ||
238 | + | let recLandNum = 0 | |
239 | + | ||
240 | + | let recLandSize = 1 | |
241 | + | ||
242 | + | let recTerrains = 2 | |
243 | + | ||
244 | + | let recContinent = 3 | |
245 | + | ||
246 | + | let locIdxContinent = 0 | |
247 | + | ||
248 | + | let locIdxType = 1 | |
249 | + | ||
250 | + | let locIdxId = 2 | |
251 | + | ||
252 | + | let bpIdxLevel = 0 | |
253 | + | ||
254 | + | let bpIdxRes = 1 | |
255 | + | ||
256 | + | let bpIdxMat = 2 | |
257 | + | ||
258 | + | let bpIdxProd = 3 | |
259 | + | ||
260 | + | let whIdxVol = 0 | |
261 | + | ||
262 | + | let whIdxRes = 1 | |
263 | + | ||
264 | + | let whIdxMat = 2 | |
265 | + | ||
266 | + | let whIdxProd = 3 | |
267 | + | ||
268 | + | let whIdxLockedVol = 4 | |
269 | + | ||
270 | + | let claimModeWh = 0 | |
271 | + | ||
272 | + | let claimModeDuck = 1 | |
273 | + | ||
274 | + | let claimModeWhThenDuck = 2 | |
136 | 275 | ||
137 | 276 | func asString (v) = match v { | |
138 | 277 | case s: String => | |
139 | 278 | s | |
140 | 279 | case _ => | |
141 | 280 | throw("fail to cast into String") | |
142 | 281 | } | |
143 | 282 | ||
144 | 283 | ||
145 | - | func asBoolean (v) = match v { | |
146 | - | case s: Boolean => | |
147 | - | s | |
148 | - | case _ => | |
149 | - | throw("fail to cast into Boolean") | |
150 | - | } | |
284 | + | func distributeByWeights (total,weights) = { | |
285 | + | let sum = (((((weights[0] + weights[1]) + weights[2]) + weights[3]) + weights[4]) + weights[5]) | |
286 | + | if ((0 >= sum)) | |
287 | + | then throw("Zero weights sum") | |
288 | + | else { | |
289 | + | let norm6 = fraction(total, MULT6, sum) | |
290 | + | func normalizer (acc,elem) = (acc :+ fraction(elem, norm6, MULT6)) | |
151 | 291 | ||
292 | + | let $l = weights | |
293 | + | let $s = size($l) | |
294 | + | let $acc0 = nil | |
295 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
296 | + | then $a | |
297 | + | else normalizer($a, $l[$i]) | |
152 | 298 | ||
153 | - | func asListIntCompacted (val) = match val { | |
154 | - | case valAnyList: List[Any] => | |
155 | - | if ((size(valAnyList) != NUMRES)) | |
156 | - | then throw(("Array size is " + toString(size(valAnyList)))) | |
157 | - | else { | |
158 | - | func conv (acc,item) = match item { | |
159 | - | case it: Int => | |
160 | - | (acc :+ toString(it)) | |
161 | - | case _ => | |
162 | - | throw("List type is not Int") | |
163 | - | } | |
299 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
300 | + | then $a | |
301 | + | else throw("List size exceeds 6") | |
164 | 302 | ||
165 | - | let r = { | |
166 | - | let $l = valAnyList | |
167 | - | let $s = size($l) | |
168 | - | let $acc0 = nil | |
169 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
170 | - | then $a | |
171 | - | else conv($a, $l[$i]) | |
172 | - | ||
173 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
174 | - | then $a | |
175 | - | else throw("List size exceeds 6") | |
176 | - | ||
177 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
178 | - | } | |
179 | - | makeString(r, "_") | |
180 | - | } | |
181 | - | case _ => | |
182 | - | throw("fail to cast into List") | |
183 | - | } | |
184 | - | ||
185 | - | ||
186 | - | func asSplitResult (val) = match val { | |
187 | - | case t2: (List[Any], List[Any]) => | |
188 | - | $Tuple2(asListIntCompacted(t2._1), asListIntCompacted(t2._2)) | |
189 | - | case _ => | |
190 | - | throw("fail to cast into (List, List)") | |
191 | - | } | |
192 | - | ||
193 | - | ||
194 | - | func walletInternal (userAddressOpt) = { | |
195 | - | let addr = addressFromString(userAddressOpt) | |
196 | - | let balance = if (isDefined(addr)) | |
197 | - | then wavesBalance(value(addr)) | |
198 | - | else BalanceDetails(0, 0, 0, 0) | |
199 | - | let usdnBalance = if (isDefined(addr)) | |
200 | - | then assetBalance(value(addr), usdnAssetId) | |
201 | - | else 0 | |
202 | - | makeString(["%s%d%d", "wallet", toString(balance.available), toString(usdnBalance)], SEP) | |
303 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
304 | + | } | |
203 | 305 | } | |
204 | 306 | ||
205 | 307 | ||
206 | - | func applyBonuses (landAssetId,pieces) = { | |
207 | - | let infraLevel = valueOrElse(getInteger(stakingContract, keyInfraLevelByAssetId(landAssetId)), 0) | |
208 | - | let artPieces = valueOrElse(getInteger(stakingContract, keyLandArtStatusByTypeAndAssetId(ARTPRESALE, landAssetId)), if (valueOrElse(getBoolean(stakingContract, keyPresaleArtActivatedByAssetId(landAssetId)), false)) | |
209 | - | then pieces | |
210 | - | else 0) | |
211 | - | $Tuple3(infraLevel, artPieces, ((DAILYRESBYPIECE + fraction(DAILYRESBYPIECE, infraLevel, 4)) + fraction(DAILYRESBYPIECE, (artPieces * 3), (pieces * 20)))) | |
308 | + | func getNeededMaterials (total) = { | |
309 | + | let props = split(value(getString(keyResProportions())), "_") | |
310 | + | if ((size(props) != NUMRES)) | |
311 | + | then throw("Wrong proportions data") | |
312 | + | else { | |
313 | + | let r = [parseIntValue(props[0]), parseIntValue(props[1]), parseIntValue(props[2]), parseIntValue(props[3]), parseIntValue(props[4]), parseIntValue(props[5])] | |
314 | + | distributeByWeights(total, r) | |
315 | + | } | |
212 | 316 | } | |
317 | + | ||
318 | + | ||
319 | + | func subtractMaterials (shouldUseMat,has,totalNeed) = { | |
320 | + | let need = getNeededMaterials(totalNeed) | |
321 | + | func subtractor (acc,idx) = { | |
322 | + | let result = (parseIntValue(has[idx]) - need[idx]) | |
323 | + | if ((0 > result)) | |
324 | + | then throw(((((("Not enough material idx=" + toString(idx)) + ", you have ") + has[idx]) + ", but need ") + toString(need[idx]))) | |
325 | + | else (acc :+ toString(result)) | |
326 | + | } | |
327 | + | ||
328 | + | if (shouldUseMat) | |
329 | + | then { | |
330 | + | let $l = [0, 1, 2, 3, 4, 5] | |
331 | + | let $s = size($l) | |
332 | + | let $acc0 = nil | |
333 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
334 | + | then $a | |
335 | + | else subtractor($a, $l[$i]) | |
336 | + | ||
337 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
338 | + | then $a | |
339 | + | else throw("List size exceeds 6") | |
340 | + | ||
341 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
342 | + | } | |
343 | + | else has | |
344 | + | } | |
345 | + | ||
346 | + | ||
347 | + | func updateProportionsInternal (propList,terrainCounts,landSizeIndex,sign) = if ((size(propList) != NUMRES)) | |
348 | + | then throw("Wrong proportions data") | |
349 | + | else { | |
350 | + | func updater (acc,i) = { | |
351 | + | let result = (parseIntValue(propList[i]) + ((sign * terrainCounts[i]) * landSizeIndex)) | |
352 | + | if ((0 > result)) | |
353 | + | then throw(((((((("Panic! Pieces of type=" + toString(i)) + ", sign=") + toString(sign)) + ", terrainCounts[i]=") + toString(terrainCounts[i])) + ", landSizeIndex=") + toString(landSizeIndex))) | |
354 | + | else (acc :+ toString(result)) | |
355 | + | } | |
356 | + | ||
357 | + | let r = { | |
358 | + | let $l = [0, 1, 2, 3, 4, 5] | |
359 | + | let $s = size($l) | |
360 | + | let $acc0 = nil | |
361 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
362 | + | then $a | |
363 | + | else updater($a, $l[$i]) | |
364 | + | ||
365 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
366 | + | then $a | |
367 | + | else throw("List size exceeds 6") | |
368 | + | ||
369 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
370 | + | } | |
371 | + | makeString(r, "_") | |
372 | + | } | |
373 | + | ||
374 | + | ||
375 | + | func updateProportions (terrainCounts,landSizeIndex,sign) = { | |
376 | + | let propList = split(valueOrElse(getString(keyResProportions()), "0_0_0_0_0_0"), "_") | |
377 | + | updateProportionsInternal(propList, terrainCounts, landSizeIndex, sign) | |
378 | + | } | |
379 | + | ||
380 | + | ||
381 | + | 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)] | |
213 | 382 | ||
214 | 383 | ||
215 | 384 | func numPiecesBySize (landSize) = match landSize { | |
216 | 385 | case _ => | |
217 | 386 | if (("S" == $match0)) | |
218 | 387 | then SSIZE | |
219 | 388 | else if (("M" == $match0)) | |
220 | 389 | then MSIZE | |
221 | 390 | else if (("L" == $match0)) | |
222 | 391 | then LSIZE | |
223 | 392 | else if (("XL" == $match0)) | |
224 | 393 | then XLSIZE | |
225 | 394 | else if (("XXL" == $match0)) | |
226 | 395 | then XXLSIZE | |
227 | 396 | else throw("Unknown land size") | |
228 | 397 | } | |
229 | 398 | ||
230 | 399 | ||
400 | + | func subOneInList (aList,idx,amount) = { | |
401 | + | func subber (acc,i) = (acc :+ (if ((i == idx)) | |
402 | + | then toString((parseIntValue(aList[i]) - amount)) | |
403 | + | else aList[i])) | |
404 | + | ||
405 | + | let r = { | |
406 | + | let $l = [0, 1, 2, 3, 4, 5] | |
407 | + | let $s = size($l) | |
408 | + | let $acc0 = nil | |
409 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
410 | + | then $a | |
411 | + | else subber($a, $l[$i]) | |
412 | + | ||
413 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
414 | + | then $a | |
415 | + | else throw("List size exceeds 6") | |
416 | + | ||
417 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
418 | + | } | |
419 | + | makeString(r, "_") | |
420 | + | } | |
421 | + | ||
422 | + | ||
423 | + | func addRes (currentRes,terrainCounts,deltaTime,landSizeIndex,dailyByPieceWithBonuses) = { | |
424 | + | func adder (acc,i) = { | |
425 | + | let resOfType = ((fraction(deltaTime, dailyByPieceWithBonuses, DAYMILLIS) * terrainCounts[i]) * landSizeIndex) | |
426 | + | (acc :+ toString((parseIntValue(currentRes[i]) + resOfType))) | |
427 | + | } | |
428 | + | ||
429 | + | let r = { | |
430 | + | let $l = [0, 1, 2, 3, 4, 5] | |
431 | + | let $s = size($l) | |
432 | + | let $acc0 = nil | |
433 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
434 | + | then $a | |
435 | + | else adder($a, $l[$i]) | |
436 | + | ||
437 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
438 | + | then $a | |
439 | + | else throw("List size exceeds 6") | |
440 | + | ||
441 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
442 | + | } | |
443 | + | makeString(r, "_") | |
444 | + | } | |
445 | + | ||
446 | + | ||
447 | + | func virtClaim (terrainCounts,deltaTime,landSizeIndex,dailyByPieceWithBonuses) = { | |
448 | + | func adder (acc,i) = { | |
449 | + | let resOfType = ((fraction(deltaTime, dailyByPieceWithBonuses, DAYMILLIS) * terrainCounts[i]) * landSizeIndex) | |
450 | + | $Tuple2((acc._1 :+ resOfType), (acc._2 + resOfType)) | |
451 | + | } | |
452 | + | ||
453 | + | let $l = [0, 1, 2, 3, 4, 5] | |
454 | + | let $s = size($l) | |
455 | + | let $acc0 = $Tuple2(nil, 0) | |
456 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
457 | + | then $a | |
458 | + | else adder($a, $l[$i]) | |
459 | + | ||
460 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
461 | + | then $a | |
462 | + | else throw("List size exceeds 6") | |
463 | + | ||
464 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
465 | + | } | |
466 | + | ||
467 | + | ||
468 | + | func distributeRes (currentWhRes,currentPackRes,resToClaim,whSpaceLeft) = { | |
469 | + | let resListToClaim = resToClaim._1 | |
470 | + | let resAmToClaim = resToClaim._2 | |
471 | + | if ((resAmToClaim == 0)) | |
472 | + | then $Tuple2(makeString(currentWhRes, "_"), makeString(currentPackRes, "_")) | |
473 | + | else if ((whSpaceLeft >= resAmToClaim)) | |
474 | + | then { | |
475 | + | func addLists (acc,i) = (acc :+ toString((parseIntValue(currentWhRes[i]) + resListToClaim[i]))) | |
476 | + | ||
477 | + | let r = { | |
478 | + | let $l = [0, 1, 2, 3, 4, 5] | |
479 | + | let $s = size($l) | |
480 | + | let $acc0 = nil | |
481 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
482 | + | then $a | |
483 | + | else addLists($a, $l[$i]) | |
484 | + | ||
485 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
486 | + | then $a | |
487 | + | else throw("List size exceeds 6") | |
488 | + | ||
489 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
490 | + | } | |
491 | + | $Tuple2(makeString(r, "_"), makeString(currentPackRes, "_")) | |
492 | + | } | |
493 | + | else { | |
494 | + | func addPartLists (acc,i) = { | |
495 | + | let whPart = fraction(resListToClaim[i], whSpaceLeft, resAmToClaim) | |
496 | + | $Tuple2((acc._1 :+ toString((parseIntValue(currentWhRes[i]) + whPart))), (acc._2 :+ toString(((parseIntValue(currentPackRes[i]) + resListToClaim[i]) - whPart)))) | |
497 | + | } | |
498 | + | ||
499 | + | let r = { | |
500 | + | let $l = [0, 1, 2, 3, 4, 5] | |
501 | + | let $s = size($l) | |
502 | + | let $acc0 = $Tuple2(nil, nil) | |
503 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
504 | + | then $a | |
505 | + | else addPartLists($a, $l[$i]) | |
506 | + | ||
507 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
508 | + | then $a | |
509 | + | else throw("List size exceeds 6") | |
510 | + | ||
511 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
512 | + | } | |
513 | + | $Tuple2(makeString(r._1, "_"), makeString(r._2, "_")) | |
514 | + | } | |
515 | + | } | |
516 | + | ||
517 | + | ||
518 | + | func abs (x) = if ((x >= toBigInt(0))) | |
519 | + | then x | |
520 | + | else -(x) | |
521 | + | ||
522 | + | ||
523 | + | let freq = [[1, 4, 9, 10, 15], [5, 8, 13, 14, 15], [6, 9, 14, 15, 16], [4, 7, 8, 13, 18], [1, 6, 7, 15, 19]] | |
524 | + | ||
525 | + | func genChar (n,freqs) = { | |
526 | + | let rem = toInt((n % TWENTYX)) | |
527 | + | let letter = if ((freqs[0] > rem)) | |
528 | + | then "A" | |
529 | + | else if ((freqs[1] > rem)) | |
530 | + | then "B" | |
531 | + | else if ((freqs[2] > rem)) | |
532 | + | then "C" | |
533 | + | else if ((freqs[3] > rem)) | |
534 | + | then "D" | |
535 | + | else if ((freqs[4] > rem)) | |
536 | + | then "E" | |
537 | + | else "F" | |
538 | + | letter | |
539 | + | } | |
540 | + | ||
541 | + | ||
542 | + | func genTerrains (seed,continentIdx) = { | |
543 | + | let f = freq[continentIdx] | |
544 | + | func terrainGenerator (acc,elem) = $Tuple2((((((acc._1 + genChar(acc._2, f)) + genChar((acc._2 / TWENTYX), f)) + genChar((acc._2 / TWENTY2X), f)) + genChar((acc._2 / TWENTY3X), f)) + genChar((acc._2 / TWENTY4X), f)), (acc._2 / TWENTY5X)) | |
545 | + | ||
546 | + | let t = { | |
547 | + | let $l = [1, 2, 3, 4, 5] | |
548 | + | let $s = size($l) | |
549 | + | let $acc0 = $Tuple2("", (seed / FIVEX)) | |
550 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
551 | + | then $a | |
552 | + | else terrainGenerator($a, $l[$i]) | |
553 | + | ||
554 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
555 | + | then $a | |
556 | + | else throw("List size exceeds 5") | |
557 | + | ||
558 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
559 | + | } | |
560 | + | t._1 | |
561 | + | } | |
562 | + | ||
563 | + | ||
564 | + | func getBackpack (bpKey) = { | |
565 | + | let p = split(valueOrElse(getString(bpKey), "0:0_0_0_0_0_0:0_0_0_0_0_0:"), ":") | |
566 | + | [toString(valueOrElse(parseInt(p[bpIdxLevel]), 0)), if ((size(split(p[bpIdxRes], "_")) == NUMRES)) | |
567 | + | then p[bpIdxRes] | |
568 | + | else "0_0_0_0_0_0", if ((size(split(p[bpIdxMat], "_")) == NUMRES)) | |
569 | + | then p[bpIdxMat] | |
570 | + | else "0_0_0_0_0_0", p[bpIdxProd]] | |
571 | + | } | |
572 | + | ||
573 | + | ||
574 | + | func getWarehouseVolume (volPrefix) = { | |
575 | + | let parts = split(volPrefix, "_") | |
576 | + | ((WHMULTIPLIER * (parseIntValue(parts[1]) + 1)) * parseIntValue(parts[0])) | |
577 | + | } | |
578 | + | ||
579 | + | ||
231 | 580 | func getWarehouse (whKey,landIndex,infraLevel) = { | |
232 | 581 | let volPrefix = ((toString(landIndex) + "_") + toString(infraLevel)) | |
233 | - | let p = split(valueOrElse(getString( | |
582 | + | let p = split(valueOrElse(getString(whKey), (volPrefix + ":0_0_0_0_0_0:0_0_0_0_0_0::0")), ":") | |
234 | 583 | [p[whIdxVol], if ((size(split(p[whIdxRes], "_")) == NUMRES)) | |
235 | 584 | then p[whIdxRes] | |
236 | 585 | else "0_0_0_0_0_0", if ((size(split(p[whIdxMat], "_")) == NUMRES)) | |
237 | 586 | then p[whIdxMat] | |
238 | 587 | else "0_0_0_0_0_0", p[whIdxProd], if ((5 > size(p))) | |
239 | 588 | then "0" | |
240 | 589 | else p[whIdxLockedVol]] | |
241 | 590 | } | |
242 | 591 | ||
243 | 592 | ||
244 | - | func duckInfoTuple (duckAssetId) = $Tuple5(valueOrElse(getInteger(stakingContract, keyStakedTimeByAssetId(duckAssetId)), -1), value(assetInfo(fromBase58String(duckAssetId))).name, valueOrElse(getString(stakingContract, keyDuckLocation(duckAssetId)), ""), valueOrElse(getInteger(stakingContract, keyDuckHealth(duckAssetId)), -1), asString(invoke(stakingContract, "getBackpackREADONLY", [duckAssetId], nil))) | |
593 | + | func getWarehouseCurrResVolume (currentWh) = { | |
594 | + | func sum (acc,item) = (acc + parseIntValue(item)) | |
595 | + | ||
596 | + | let $l = split(currentWh[whIdxRes], "_") | |
597 | + | let $s = size($l) | |
598 | + | let $acc0 = 0 | |
599 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
600 | + | then $a | |
601 | + | else sum($a, $l[$i]) | |
602 | + | ||
603 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
604 | + | then $a | |
605 | + | else throw("List size exceeds 6") | |
606 | + | ||
607 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
608 | + | } | |
245 | 609 | ||
246 | 610 | ||
247 | - | func duckInfoArray (duckAssetId,owner,duckInf) = [("%s%s__assetId__" + duckAssetId), ("%s%s__owner__" + owner), ("%s%d__stakedTime__" + toString(duckInf._1)), ("%s%s__name__" + duckInf._2), ("%s%s__location__" + duckInf._3), ("%s%d__health__" + toString(duckInf._4)), ("%s%s__backPack__" + duckInf._5)] | |
611 | + | func getWarehouseCurrMatVolume (currentWh) = { | |
612 | + | func sum (acc,item) = (acc + parseIntValue(item)) | |
613 | + | ||
614 | + | let $l = split(currentWh[whIdxMat], "_") | |
615 | + | let $s = size($l) | |
616 | + | let $acc0 = 0 | |
617 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
618 | + | then $a | |
619 | + | else sum($a, $l[$i]) | |
620 | + | ||
621 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
622 | + | then $a | |
623 | + | else throw("List size exceeds 6") | |
624 | + | ||
625 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
626 | + | } | |
248 | 627 | ||
249 | 628 | ||
250 | - | func landInfoArray (landAssetId,owner,stakedTime) = if ((landAssetId == "")) | |
251 | - | then throw("landAssetId is required") | |
629 | + | func getWarehouseCurrGoodsVolume (currentWh) = { | |
630 | + | let goods = currentWh[whIdxProd] | |
631 | + | if ((goods == "")) | |
632 | + | then 0 | |
633 | + | else { | |
634 | + | func sum (acc,item) = (acc + parseIntValue(item)) | |
635 | + | ||
636 | + | let $l = split_4C(goods, "_") | |
637 | + | let $s = size($l) | |
638 | + | let $acc0 = 0 | |
639 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
640 | + | then $a | |
641 | + | else sum($a, $l[$i]) | |
642 | + | ||
643 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
644 | + | then $a | |
645 | + | else throw("List size exceeds 50") | |
646 | + | ||
647 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50) | |
648 | + | } | |
649 | + | } | |
650 | + | ||
651 | + | ||
652 | + | func moveStuff (cargoParts,currentWh,currentPack) = if ((size(cargoParts) != 3)) | |
653 | + | then throw("cargoListStr should contain exactly 2 ':' separators") | |
252 | 654 | else { | |
253 | - | let a = value(assetInfo(fromBase58String(landAssetId))) | |
254 | - | let d = split(a.description, "_") | |
255 | - | let landNum = if ((a.quantity > 0)) | |
256 | - | then d[recLandNum] | |
257 | - | else ("-" + d[recLandNum]) | |
258 | - | let pieces = numPiecesBySize(d[recLandSize]) | |
259 | - | let productivity = applyBonuses(landAssetId, pieces) | |
260 | - | let deltaTime = (lastBlock.timestamp - stakedTime) | |
261 | - | let availRes = if ((stakedTime > 0)) | |
262 | - | then fraction(deltaTime, (productivity._3 * pieces), DAYMILLIS) | |
263 | - | else 0 | |
264 | - | let needMat = fraction(InfraUpgradeCostS, (pieces * (productivity._1 + 1)), SSIZE) | |
265 | - | let globalAndLocal = if ((stakedTime > 0)) | |
266 | - | then asSplitResult(invoke(stakingContract, "splitByGlobalAndLocalWeightsREADONLY", [needMat, availRes, d[recTerrains]], nil)) | |
267 | - | else $Tuple2(asListIntCompacted(invoke(stakingContract, "splitByGlobalWeightsREADONLY", [needMat], nil)), "") | |
268 | - | [("%s%s__assetId__" + landAssetId), ("%s%s__owner__" + owner), ("%s%d__stakedTime__" + toString(stakedTime)), ("%s%s__description__" + makeString([landNum, d[recLandSize], d[recTerrains], d[recContinent]], "_")), ("%s%d__infraLevel__" + toString(productivity._1)), ("%s%s__availResByType__" + globalAndLocal._2), ("%s%d__availResTotal__" + toString(availRes)), ("%s%s__needMaterial__" + globalAndLocal._1), makeString(["%s%s", "landArtefacts", ("PRESALE:" + toString(productivity._2))], SEP), ("%s%s__warehouse__" + makeString(getWarehouse(keyWarehouseByLand(landAssetId), (pieces / SSIZE), productivity._1), ":")), ("%s%s__landOrder__" + valueOrElse(getString(economyContract, keyOrderByLand(landAssetId)), "0@0_0@0_0@0_0@0_0@0_0@0:0@0_0@0_0@0_0@0_0@0_0@0:"))] | |
655 | + | let resParts = split(cargoParts[0], "_") | |
656 | + | let matParts = split(cargoParts[1], "_") | |
657 | + | let prodParts = if ((cargoParts[2] == "")) | |
658 | + | then nil | |
659 | + | else split(cargoParts[2], "_") | |
660 | + | if ((size(resParts) != NUMRES)) | |
661 | + | then throw("All 6 resources should be passed") | |
662 | + | else if ((size(matParts) != NUMRES)) | |
663 | + | then throw("All 6 materials should be passed") | |
664 | + | else { | |
665 | + | let currWhResVol = getWarehouseCurrResVolume(currentWh) | |
666 | + | let currWhMatVol = getWarehouseCurrMatVolume(currentWh) | |
667 | + | let currWhGoodsVol = getWarehouseCurrGoodsVolume(currentWh) | |
668 | + | let currWhLockedVol = parseIntValue(currentWh[whIdxLockedVol]) | |
669 | + | let whSpaceLeft = ((((getWarehouseVolume(currentWh[whIdxVol]) - currWhResVol) - currWhMatVol) - currWhGoodsVol) - currWhLockedVol) | |
670 | + | let currWhRes = split(currentWh[whIdxRes], "_") | |
671 | + | let currWhMat = split(currentWh[whIdxMat], "_") | |
672 | + | let currWhProd = if ((currentWh[whIdxProd] == "")) | |
673 | + | then nil | |
674 | + | else split(currentWh[whIdxProd], "_") | |
675 | + | let currentPackRes = split(currentPack[bpIdxRes], "_") | |
676 | + | let currentPackMat = split(currentPack[bpIdxMat], "_") | |
677 | + | let currentPackProd = if ((currentPack[bpIdxProd] == "")) | |
678 | + | then nil | |
679 | + | else split(currentPack[bpIdxProd], "_") | |
680 | + | func mvR (acc,item) = { | |
681 | + | let i = acc._1 | |
682 | + | let am = parseIntValue(item) | |
683 | + | let whr = parseIntValue(currWhRes[i]) | |
684 | + | let bpr = parseIntValue(currentPackRes[i]) | |
685 | + | if ((am == 0)) | |
686 | + | then $Tuple4((i + 1), (acc._2 :+ currWhRes[i]), (acc._3 :+ currentPackRes[i]), acc._4) | |
687 | + | else if ((am > 0)) | |
688 | + | then if ((am > bpr)) | |
689 | + | then throw((((("Attempt to take " + item) + " from backpack, but only ") + toString(bpr)) + " available")) | |
690 | + | else $Tuple4((i + 1), (acc._2 :+ toString((whr + am))), (acc._3 :+ toString((bpr - am))), (acc._4 + am)) | |
691 | + | else if ((-(am) > whr)) | |
692 | + | then throw((((("Attempt to take " + toString(-(am))) + " from warehouse, but only ") + toString(whr)) + " available")) | |
693 | + | else $Tuple4((i + 1), (acc._2 :+ toString((whr + am))), (acc._3 :+ toString((bpr - am))), (acc._4 + am)) | |
694 | + | } | |
695 | + | ||
696 | + | let r = { | |
697 | + | let $l = resParts | |
698 | + | let $s = size($l) | |
699 | + | let $acc0 = $Tuple4(0, nil, nil, 0) | |
700 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
701 | + | then $a | |
702 | + | else mvR($a, $l[$i]) | |
703 | + | ||
704 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
705 | + | then $a | |
706 | + | else throw("List size exceeds 6") | |
707 | + | ||
708 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
709 | + | } | |
710 | + | func mvM (acc,item) = { | |
711 | + | let i = acc._1 | |
712 | + | let am = parseIntValue(item) | |
713 | + | let whm = parseIntValue(currWhMat[i]) | |
714 | + | let bpm = parseIntValue(currentPackMat[i]) | |
715 | + | if ((am == 0)) | |
716 | + | then $Tuple4((i + 1), (acc._2 :+ currWhMat[i]), (acc._3 :+ currentPackMat[i]), acc._4) | |
717 | + | else if ((am > 0)) | |
718 | + | then if ((am > bpm)) | |
719 | + | then throw((((("Attempt to take " + item) + " from backpack, but only ") + toString(bpm)) + " available")) | |
720 | + | else $Tuple4((i + 1), (acc._2 :+ toString((whm + am))), (acc._3 :+ toString((bpm - am))), (acc._4 + am)) | |
721 | + | else if ((-(am) > whm)) | |
722 | + | then throw((((("Attempt to take " + toString(-(am))) + " from warehouse, but only ") + toString(whm)) + " available")) | |
723 | + | else $Tuple4((i + 1), (acc._2 :+ toString((whm + am))), (acc._3 :+ toString((bpm - am))), (acc._4 + am)) | |
724 | + | } | |
725 | + | ||
726 | + | let m = { | |
727 | + | let $l = matParts | |
728 | + | let $s = size($l) | |
729 | + | let $acc0 = $Tuple4(0, nil, nil, r._4) | |
730 | + | func $f1_1 ($a,$i) = if (($i >= $s)) | |
731 | + | then $a | |
732 | + | else mvM($a, $l[$i]) | |
733 | + | ||
734 | + | func $f1_2 ($a,$i) = if (($i >= $s)) | |
735 | + | then $a | |
736 | + | else throw("List size exceeds 6") | |
737 | + | ||
738 | + | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
739 | + | } | |
740 | + | func mvP (acc,item) = { | |
741 | + | let i = acc._1 | |
742 | + | let am = parseIntValue(item) | |
743 | + | let whp = parseIntValue(currWhProd[i]) | |
744 | + | let bpp = parseIntValue(currentPackProd[i]) | |
745 | + | if ((am == 0)) | |
746 | + | then $Tuple4((i + 1), (acc._2 :+ currWhProd[i]), (acc._3 :+ currentPackProd[i]), acc._4) | |
747 | + | else if ((am > 0)) | |
748 | + | then if ((am > bpp)) | |
749 | + | then throw((((("Attempt to take " + item) + " from backpack, but only ") + toString(bpp)) + " available")) | |
750 | + | else $Tuple4((i + 1), (acc._2 :+ toString((whp + am))), (acc._3 :+ toString((bpp - am))), (acc._4 + am)) | |
751 | + | else if ((-(am) > whp)) | |
752 | + | then throw((((("Attempt to take " + toString(-(am))) + " from warehouse, but only ") + toString(whp)) + " available")) | |
753 | + | else $Tuple4((i + 1), (acc._2 :+ toString((whp + am))), (acc._3 :+ toString((bpp - am))), (acc._4 + am)) | |
754 | + | } | |
755 | + | ||
756 | + | let p = { | |
757 | + | let $l = prodParts | |
758 | + | let $s = size($l) | |
759 | + | let $acc0 = $Tuple4(0, nil, nil, m._4) | |
760 | + | func $f2_1 ($a,$i) = if (($i >= $s)) | |
761 | + | then $a | |
762 | + | else mvP($a, $l[$i]) | |
763 | + | ||
764 | + | func $f2_2 ($a,$i) = if (($i >= $s)) | |
765 | + | then $a | |
766 | + | else throw("List size exceeds 50") | |
767 | + | ||
768 | + | $f2_2($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50) | |
769 | + | } | |
770 | + | let volSaldo = p._4 | |
771 | + | if ((volSaldo > whSpaceLeft)) | |
772 | + | then throw((((("Attempt to put total " + toString(volSaldo)) + " stuff, but only ") + toString(whSpaceLeft)) + " warehouse space left")) | |
773 | + | else $Tuple6(makeString(r._2, "_"), makeString(m._2, "_"), makeString(p._2, "_"), makeString(r._3, "_"), makeString(m._3, "_"), makeString(p._3, "_")) | |
774 | + | } | |
269 | 775 | } | |
270 | 776 | ||
271 | 777 | ||
272 | - | func landOrderInfoArray (landAssetId,owner) = if ((landAssetId == "")) | |
273 | - | then throw("landAssetId is required") | |
778 | + | func expeditionInternal (caller,txId) = { | |
779 | + | let userAddr = toString(caller) | |
780 | + | let bigNum = abs(toBigInt(txId)) | |
781 | + | let freeNum = valueOrElse(getInteger(keyNextFreeLandNum()), (PRESALENUMLANDS + 1)) | |
782 | + | let landNum = toString(freeNum) | |
783 | + | let continentIdx = toInt((bigNum % FIVEX)) | |
784 | + | let terrains = genTerrains(bigNum, continentIdx) | |
785 | + | let continent = continents[continentIdx] | |
786 | + | let issue = Issue(keyNftName(landNum, "S"), makeString([landNum, "S", terrains, continent], "_"), 1, 0, false) | |
787 | + | let assetId = calculateAssetId(issue) | |
788 | + | let id = toBase58String(assetId) | |
789 | + | $Tuple2([IntegerEntry(keyNextFreeLandNum(), (freeNum + 1)), issue, StringEntry(keyLandToAssetId(landNum), id), StringEntry(keyLandAssetIdToOwner(id), userAddr), StringEntry(keyLandNumToOwner(landNum), userAddr), IntegerEntry(keyInfraLevelByAssetId(id), 0), IntegerEntry(keyInfraLevelByAssetIdAndOwner(id, userAddr), 0), ScriptTransfer(caller, 1, assetId)], $Tuple2(id, continent)) | |
790 | + | } | |
791 | + | ||
792 | + | ||
793 | + | func expeditionCommon (shouldUseMat,caller,txId,message,sig) = if (!(sigVerify_8Kb(message, sig, pub))) | |
794 | + | then throw("signature does not match") | |
274 | 795 | else { | |
275 | - | let a = value(assetInfo(fromBase58String(landAssetId))) | |
276 | - | let d = split(a.description, "_") | |
277 | - | let pieces = numPiecesBySize(d[recLandSize]) | |
278 | - | let productivity = applyBonuses(landAssetId, pieces) | |
279 | - | [("%s%s__assetId__" + landAssetId), ("%s%s__owner__" + owner), ("%s%s__warehouse__" + makeString(getWarehouse(keyWarehouseByLand(landAssetId), (pieces / SSIZE), productivity._1), ":")), ("%s%s__landOrder__" + valueOrElse(getString(economyContract, keyOrderByLand(landAssetId)), "0@0_0@0_0@0_0@0_0@0_0@0:0@0_0@0_0@0_0@0_0@0_0@0:"))] | |
796 | + | let parts = split(toUtf8String(message), ";") | |
797 | + | let hp = split(split(parts[0], "|")[0], "_") | |
798 | + | let curHP = parseIntValue(hp[0]) | |
799 | + | let newHP = parseIntValue(hp[1]) | |
800 | + | let locAndTime = split(parts[1], ":") | |
801 | + | let targetLocation = split(locAndTime[0], "_") | |
802 | + | if ((targetLocation[1] != "E")) | |
803 | + | then throw("expedition target location type should be E") | |
804 | + | else { | |
805 | + | let time = parseIntValue(locAndTime[1]) | |
806 | + | if (if ((time > (lastBlock.timestamp + FIVEMINUTESMILLIS))) | |
807 | + | then true | |
808 | + | else ((lastBlock.timestamp - FIVEMINUTESMILLIS) > time)) | |
809 | + | then throw("signature outdated") | |
810 | + | else { | |
811 | + | let userAddr = toString(caller) | |
812 | + | let duckAssetId = valueOrErrorMessage(getString(keyStakedDuckByOwner(userAddr)), "You don't have a duck staked") | |
813 | + | let keyHealth = keyDuckHealth(duckAssetId) | |
814 | + | let oldFromState = valueOrElse(getInteger(keyHealth), 100) | |
815 | + | if ((oldFromState != curHP)) | |
816 | + | then throw(((("oldHealth=" + toString(valueOrElse(getInteger(keyHealth), 100))) + " from state does not match one from flight log=") + toString(curHP))) | |
817 | + | else if ((0 >= curHP)) | |
818 | + | then throw("You can't fly with zero health") | |
819 | + | else if ((0 >= newHP)) | |
820 | + | then $Tuple2(((if (!(shouldUseMat)) | |
821 | + | then [ScriptTransfer(caller, EXPUSDN, usdnAssetId)] | |
822 | + | else nil) :+ IntegerEntry(keyHealth, 0)), "") | |
823 | + | else { | |
824 | + | let bpKey = keyBackpackByDuck(duckAssetId) | |
825 | + | let currentPack = getBackpack(bpKey) | |
826 | + | let mList = split(currentPack[bpIdxMat], "_") | |
827 | + | let newMat = makeString(subtractMaterials(shouldUseMat, mList, EXPMATERIALS), "_") | |
828 | + | let e = expeditionInternal(caller, txId) | |
829 | + | let id = e._2._1 | |
830 | + | $Tuple2((((e._1 :+ StringEntry(keyDuckLocation(duckAssetId), makeString([e._2._2, "L", id], "_"))) :+ IntegerEntry(keyHealth, newHP)) :+ StringEntry(bpKey, makeString([currentPack[bpIdxLevel], currentPack[bpIdxRes], newMat, currentPack[bpIdxProd]], ":"))), id) | |
831 | + | } | |
832 | + | } | |
833 | + | } | |
280 | 834 | } | |
281 | 835 | ||
282 | 836 | ||
837 | + | func applyBonuses (landAssetId,pieces) = { | |
838 | + | let infraLevel = valueOrElse(getInteger(keyInfraLevelByAssetId(landAssetId)), 0) | |
839 | + | let artPieces = valueOrElse(getInteger(keyLandArtStatusByTypeAndAssetId(ARTPRESALE, landAssetId)), if (valueOrElse(getBoolean(keyPresaleArtActivatedByAssetId(landAssetId)), false)) | |
840 | + | then pieces | |
841 | + | else 0) | |
842 | + | ((DAILYRESBYPIECE + fraction(DAILYRESBYPIECE, infraLevel, 4)) + fraction(DAILYRESBYPIECE, (artPieces * 3), (pieces * 20))) | |
843 | + | } | |
844 | + | ||
845 | + | ||
846 | + | func checkClaimConditions (addr,claimMode,landAssetIdIn) = { | |
847 | + | let $t02363024169 = if ((claimMode == claimModeWh)) | |
848 | + | then $Tuple2(landAssetIdIn, valueOrElse(getString(keyStakedDuckByOwner(addr)), "")) | |
849 | + | else { | |
850 | + | let duckAssetId = valueOrErrorMessage(getString(keyStakedDuckByOwner(addr)), "You don't have a duck staked") | |
851 | + | let curLocation = valueOrElse(getString(keyDuckLocation(duckAssetId)), DEFAULTLOCATION) | |
852 | + | let loc = split(value(curLocation), "_") | |
853 | + | if ((loc[locIdxType] != "L")) | |
854 | + | then throw((("Duck location type is " + loc[locIdxType]) + ", but should be L")) | |
855 | + | else $Tuple2(loc[locIdxId], duckAssetId) | |
856 | + | } | |
857 | + | let landAssetId = $t02363024169._1 | |
858 | + | let duckId = $t02363024169._2 | |
859 | + | let asset = value(assetInfo(fromBase58String(landAssetId))) | |
860 | + | let timeKey = keyStakedTimeByAssetId(landAssetId) | |
861 | + | let savedTime = valueOrErrorMessage(getInteger(timeKey), (("Land " + asset.name) + " is not staked")) | |
862 | + | let owner = valueOrErrorMessage(getString(keyLandAssetIdToOwner(landAssetId)), (("NFT " + asset.name) + " is orphaned")) | |
863 | + | if ((owner != addr)) | |
864 | + | then throw((LANDPREFIX + " is not yours")) | |
865 | + | else { | |
866 | + | let d = split(asset.description, "_") | |
867 | + | $Tuple4(duckId, landAssetId, d, savedTime) | |
868 | + | } | |
869 | + | } | |
870 | + | ||
871 | + | ||
872 | + | func claimResInternal (addr,amount,claimMode,landAssetIdIn) = if ((0 > amount)) | |
873 | + | then throw("Negative amount") | |
874 | + | else { | |
875 | + | let c = checkClaimConditions(addr, claimMode, landAssetIdIn) | |
876 | + | let landSize = c._3[recLandSize] | |
877 | + | let terrainCounts = countTerrains(c._3[recTerrains]) | |
878 | + | let deltaTime = (lastBlock.timestamp - c._4) | |
879 | + | if ((0 > deltaTime)) | |
880 | + | then throw(((("Saved timestamp is in future, saved = " + toString(c._4)) + ", current = ") + toString(lastBlock.timestamp))) | |
881 | + | else { | |
882 | + | let pieces = numPiecesBySize(landSize) | |
883 | + | let dailyProductionByPiece = applyBonuses(c._2, pieces) | |
884 | + | let availRes = fraction(deltaTime, (dailyProductionByPiece * pieces), DAYMILLIS) | |
885 | + | if ((amount > availRes)) | |
886 | + | then throw(((("Not enough resources, available = " + toString(availRes)) + ", requested = ") + toString(amount))) | |
887 | + | else { | |
888 | + | let newDeltaTime = fraction((availRes - amount), DAYMILLIS, (dailyProductionByPiece * pieces)) | |
889 | + | let newTimestamp = (lastBlock.timestamp - newDeltaTime) | |
890 | + | let landIndex = (pieces / SSIZE) | |
891 | + | let resToClaim = virtClaim(terrainCounts, (deltaTime - newDeltaTime), landIndex, dailyProductionByPiece) | |
892 | + | let whKey = keyWarehouseByLand(c._2) | |
893 | + | let infraLevel = valueOrElse(getInteger(keyInfraLevelByAssetId(c._2)), 0) | |
894 | + | let currentWh = getWarehouse(whKey, landIndex, infraLevel) | |
895 | + | let currWhResVol = getWarehouseCurrResVolume(currentWh) | |
896 | + | let currWhMatVol = getWarehouseCurrMatVolume(currentWh) | |
897 | + | let currWhGoodsVol = getWarehouseCurrGoodsVolume(currentWh) | |
898 | + | let currWhLockedVol = parseIntValue(currentWh[whIdxLockedVol]) | |
899 | + | let whSpaceLeft = ((((getWarehouseVolume(currentWh[whIdxVol]) - currWhResVol) - currWhMatVol) - currWhGoodsVol) - currWhLockedVol) | |
900 | + | if (if ((claimMode == claimModeWh)) | |
901 | + | then (amount > whSpaceLeft) | |
902 | + | else false) | |
903 | + | then throw((("Only " + toString(whSpaceLeft)) + " space left in warehouse")) | |
904 | + | else { | |
905 | + | let bpKey = keyBackpackByDuck(c._1) | |
906 | + | let currentPack = getBackpack(bpKey) | |
907 | + | let currentPackRes = split(currentPack[bpIdxRes], "_") | |
908 | + | let currentWhRes = split(currentWh[whIdxRes], "_") | |
909 | + | let $t02681727320 = if ((claimMode == claimModeWh)) | |
910 | + | then $Tuple2(addRes(currentWhRes, terrainCounts, (deltaTime - newDeltaTime), landIndex, dailyProductionByPiece), currentPack[bpIdxRes]) | |
911 | + | else if ((claimMode == claimModeDuck)) | |
912 | + | then $Tuple2(currentWh[whIdxRes], addRes(currentPackRes, terrainCounts, (deltaTime - newDeltaTime), landIndex, dailyProductionByPiece)) | |
913 | + | else distributeRes(currentWhRes, currentPackRes, resToClaim, whSpaceLeft) | |
914 | + | let whRes = $t02681727320._1 | |
915 | + | let bpRes = $t02681727320._2 | |
916 | + | $Tuple5([IntegerEntry(keyStakedTimeByAssetId(c._2), newTimestamp), IntegerEntry(keyStakedTimeByTypeAssetIdAndOwner(LANDPREFIX, c._2, addr), newTimestamp)], bpKey, [currentPack[bpIdxLevel], bpRes, currentPack[bpIdxMat], currentPack[bpIdxProd]], whKey, [currentWh[whIdxVol], whRes, currentWh[whIdxMat], currentWh[whIdxProd], currentWh[whIdxLockedVol]]) | |
917 | + | } | |
918 | + | } | |
919 | + | } | |
920 | + | } | |
921 | + | ||
922 | + | ||
923 | + | func claimAll (addr,landAssetId,pieces,claimMode) = { | |
924 | + | let timeKey = keyStakedTimeByAssetId(landAssetId) | |
925 | + | let savedTime = value(getInteger(timeKey)) | |
926 | + | let availRes = (fraction((lastBlock.timestamp - savedTime), applyBonuses(landAssetId, pieces), DAYMILLIS) * pieces) | |
927 | + | claimResInternal(addr, availRes, claimMode, landAssetId) | |
928 | + | } | |
929 | + | ||
930 | + | ||
931 | + | func upInfraCommon (shouldUseMat,caller,paymentAmount,landAssetId) = { | |
932 | + | let addr = toString(caller) | |
933 | + | let c = checkClaimConditions(addr, claimModeWhThenDuck, landAssetId) | |
934 | + | let pieces = numPiecesBySize(c._3[recLandSize]) | |
935 | + | let infraKey = keyInfraLevelByAssetId(c._2) | |
936 | + | let curLevel = valueOrElse(getInteger(infraKey), 0) | |
937 | + | if ((curLevel >= 3)) | |
938 | + | then throw("Currently max infrastructure level = 3") | |
939 | + | else { | |
940 | + | let newLevel = (curLevel + 1) | |
941 | + | let cost = fraction(InfraUpgradeCostSUsdn, (pieces * newLevel), SSIZE) | |
942 | + | if (if (!(shouldUseMat)) | |
943 | + | then (paymentAmount != cost) | |
944 | + | else false) | |
945 | + | then throw(("Payment attached should be " + toString(cost))) | |
946 | + | else { | |
947 | + | let bpKey = keyBackpackByDuck(c._1) | |
948 | + | let currentPack = getBackpack(bpKey) | |
949 | + | let mList = split(currentPack[bpIdxMat], "_") | |
950 | + | let newMat = makeString(subtractMaterials(shouldUseMat, mList, fraction(InfraUpgradeCostS, (pieces * newLevel), SSIZE)), "_") | |
951 | + | let claimResult = claimAll(addr, c._2, pieces, claimModeWhThenDuck) | |
952 | + | let whData = claimResult._5 | |
953 | + | let newVolData = makeString([split(whData[whIdxVol], "_")[0], toString(newLevel)], "_") | |
954 | + | $Tuple2(([IntegerEntry(infraKey, newLevel), IntegerEntry(keyInfraLevelByAssetIdAndOwner(c._2, addr), newLevel), StringEntry(bpKey, makeString([currentPack[bpIdxLevel], claimResult._3[bpIdxRes], newMat, currentPack[bpIdxProd]], ":")), StringEntry(claimResult._4, makeString([newVolData, whData[whIdxRes], whData[whIdxMat], whData[whIdxProd], whData[whIdxLockedVol]], ":"))] ++ claimResult._1), newLevel) | |
955 | + | } | |
956 | + | } | |
957 | + | } | |
958 | + | ||
959 | + | ||
960 | + | func activatePresaleArt (addr,landAssetIdIn) = { | |
961 | + | let c = checkClaimConditions(addr, claimModeWhThenDuck, landAssetIdIn) | |
962 | + | let landAssetId = c._2 | |
963 | + | let activationKey = keyPresaleArtActivatedByAssetId(landAssetId) | |
964 | + | if (valueOrElse(getBoolean(activationKey), false)) | |
965 | + | then throw("Presale artifact is already activated") | |
966 | + | else if ((parseIntValue(c._3[recLandNum]) > PRESALENUMLANDS)) | |
967 | + | then throw((((LANDPREFIX + " ") + landAssetId) + " is not eligible for presale artifact")) | |
968 | + | else { | |
969 | + | let pieces = numPiecesBySize(c._3[recLandSize]) | |
970 | + | let claimResult = claimAll(addr, landAssetId, pieces, claimModeWhThenDuck) | |
971 | + | ((((((claimResult._1 :+ BooleanEntry(activationKey, true)) :+ BooleanEntry(keyPresaleArtActivatedByAssetIdAndOwner(landAssetId, addr), true)) :+ IntegerEntry(keyLandArtStatusByTypeAndAssetId(ARTPRESALE, landAssetId), pieces)) :+ IntegerEntry(keyLandArtStatusByTypeAssetIdAndOwner(ARTPRESALE, landAssetId, addr), pieces)) :+ StringEntry(claimResult._2, makeString(claimResult._3, ":"))) :+ StringEntry(claimResult._4, makeString(claimResult._5, ":"))) | |
972 | + | } | |
973 | + | } | |
974 | + | ||
975 | + | ||
976 | + | func mergeInternal (newLandSize,newLevel,formula,addr,landAssetIds,txId,needMat) = { | |
977 | + | let duckAssetId = valueOrErrorMessage(getString(keyStakedDuckByOwner(addr)), "You don't have a duck staked") | |
978 | + | func checkMerge (acc,landAssetId) = { | |
979 | + | let asset = value(assetInfo(fromBase58String(landAssetId))) | |
980 | + | let timeKey = keyStakedTimeByAssetId(landAssetId) | |
981 | + | let savedTime = valueOrErrorMessage(getInteger(timeKey), (("NFT " + asset.name) + " is not staked")) | |
982 | + | let owner = valueOrErrorMessage(getString(keyLandAssetIdToOwner(landAssetId)), (("NFT " + asset.name) + " is orphaned")) | |
983 | + | if ((owner != addr)) | |
984 | + | then throw((LANDPREFIX + " is not yours")) | |
985 | + | else { | |
986 | + | let d = split(asset.description, "_") | |
987 | + | let continent = d[recContinent] | |
988 | + | if (if ((acc._3 != "")) | |
989 | + | then (acc._3 != continent) | |
990 | + | else false) | |
991 | + | then throw("Lands should be on the same continent to merge") | |
992 | + | else { | |
993 | + | let landSize = d[recLandSize] | |
994 | + | let sizesIn = acc._1 | |
995 | + | let i = valueOrErrorMessage(indexOf(sizesIn, landSize), "You haven't passed all the lands needed") | |
996 | + | let sizesOut = (take(sizesIn, i) + drop(sizesIn, (i + 1))) | |
997 | + | let pieces = numPiecesBySize(landSize) | |
998 | + | let arts = (acc._2 + valueOrElse(getInteger(keyLandArtStatusByTypeAndAssetId(ARTPRESALE, landAssetId)), if (valueOrElse(getBoolean(keyPresaleArtActivatedByAssetId(landAssetId)), false)) | |
999 | + | then pieces | |
1000 | + | else 0)) | |
1001 | + | let infraLevel = valueOrElse(getInteger(keyInfraLevelByAssetId(landAssetId)), 0) | |
1002 | + | let reqLevel = match landSize { | |
1003 | + | case _ => | |
1004 | + | if (("S" == $match0)) | |
1005 | + | then 3 | |
1006 | + | else if (("M" == $match0)) | |
1007 | + | then 4 | |
1008 | + | else if (("L" == $match0)) | |
1009 | + | then 5 | |
1010 | + | else if (("XL" == $match0)) | |
1011 | + | then 6 | |
1012 | + | else throw("Only S, M, L, XL can merge") | |
1013 | + | } | |
1014 | + | if ((infraLevel != reqLevel)) | |
1015 | + | then throw("All lands should be maxed to merge") | |
1016 | + | else { | |
1017 | + | let landNum = d[recLandNum] | |
1018 | + | let terrainCounts = countTerrains(d[recTerrains]) | |
1019 | + | let deltaTime = (lastBlock.timestamp - savedTime) | |
1020 | + | if ((0 > deltaTime)) | |
1021 | + | then throw(((("Saved timestamp is in future, saved = " + toString(savedTime)) + ", current = ") + toString(lastBlock.timestamp))) | |
1022 | + | else { | |
1023 | + | let dailyProductionByPiece = applyBonuses(landAssetId, pieces) | |
1024 | + | let landIndex = (pieces / SSIZE) | |
1025 | + | let bpRes = addRes(split(acc._4, "_"), terrainCounts, deltaTime, landIndex, dailyProductionByPiece) | |
1026 | + | let props = updateProportionsInternal(split(acc._6, "_"), terrainCounts, landIndex, -1) | |
1027 | + | let lands = acc._7 | |
1028 | + | let idx = indexOf(lands, landAssetId) | |
1029 | + | if (!(isDefined(idx))) | |
1030 | + | then throw(("Your staked lands don't contain " + landAssetId)) | |
1031 | + | else $Tuple7(sizesOut, arts, continent, bpRes, ((((((((((((((acc._5 :+ DeleteEntry(keyStakedTimeByAssetId(landAssetId))) :+ DeleteEntry(keyStakedTimeByTypeAssetIdAndOwner(LANDPREFIX, landAssetId, addr))) :+ DeleteEntry(keyLandToAssetId(landNum))) :+ DeleteEntry(keyNftName(landNum, landSize))) :+ DeleteEntry(keyLandAssetIdToOwner(landAssetId))) :+ DeleteEntry(keyInfraLevelByAssetId(landAssetId))) :+ DeleteEntry(keyInfraLevelByAssetIdAndOwner(landAssetId, addr))) :+ DeleteEntry(keyPresaleArtActivatedByAssetId(landAssetId))) :+ DeleteEntry(keyPresaleArtActivatedByAssetIdAndOwner(landAssetId, addr))) :+ DeleteEntry(keyLandArtStatusByTypeAndAssetId(ARTPRESALE, landAssetId))) :+ DeleteEntry(keyLandArtStatusByTypeAssetIdAndOwner(ARTPRESALE, landAssetId, addr))) :+ DeleteEntry(keyLandNumToOwner(landNum))) :+ DeleteEntry(keyWarehouseByLand(landAssetId))) :+ Burn(fromBase58String(landAssetId), 1)), props, removeByIndex(lands, value(idx))) | |
1032 | + | } | |
1033 | + | } | |
1034 | + | } | |
1035 | + | } | |
1036 | + | } | |
1037 | + | ||
1038 | + | let bpKey = keyBackpackByDuck(duckAssetId) | |
1039 | + | let currentPack = getBackpack(bpKey) | |
1040 | + | let propStr = valueOrElse(getString(keyResProportions()), "0_0_0_0_0_0") | |
1041 | + | let landsKey = keyStakedLandsByOwner(addr) | |
1042 | + | let landsStr = getString(landsKey) | |
1043 | + | let landsIn = if (isDefined(landsStr)) | |
1044 | + | then split_51C(value(landsStr), "_") | |
1045 | + | else nil | |
1046 | + | let r = { | |
1047 | + | let $l = landAssetIds | |
1048 | + | let $s = size($l) | |
1049 | + | let $acc0 = $Tuple7(formula, 0, "", currentPack[bpIdxRes], nil, propStr, landsIn) | |
1050 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
1051 | + | then $a | |
1052 | + | else checkMerge($a, $l[$i]) | |
1053 | + | ||
1054 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
1055 | + | then $a | |
1056 | + | else throw("List size exceeds 5") | |
1057 | + | ||
1058 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
1059 | + | } | |
1060 | + | let continent = r._3 | |
1061 | + | let continentIdx = valueOrErrorMessage(indexOf(continents, continent), ("Unknown continent: " + continent)) | |
1062 | + | let terrains = genTerrains(abs(toBigInt(txId)), continentIdx) | |
1063 | + | let freeNum = valueOrElse(getInteger(keyNextFreeLandNum()), (PRESALENUMLANDS + 1)) | |
1064 | + | let newLandNum = toString(freeNum) | |
1065 | + | let issue = Issue(keyNftName(newLandNum, newLandSize), makeString([newLandNum, newLandSize, terrains, continent], "_"), 1, 0, false) | |
1066 | + | let assetId = calculateAssetId(issue) | |
1067 | + | let newLandAssetId = toBase58String(assetId) | |
1068 | + | let newMat = makeString(subtractMaterials((needMat > 0), split(currentPack[bpIdxMat], "_"), needMat), "_") | |
1069 | + | $Tuple2(((((((((((((((r._5 :+ (if ((size(r._7) > 0)) | |
1070 | + | then StringEntry(landsKey, makeString_11C(r._7, "_")) | |
1071 | + | else DeleteEntry(landsKey))) :+ IntegerEntry(keyNextFreeLandNum(), (freeNum + 1))) :+ issue) :+ StringEntry(keyLandToAssetId(newLandNum), newLandAssetId)) :+ StringEntry(keyLandAssetIdToOwner(newLandAssetId), addr)) :+ StringEntry(keyLandNumToOwner(newLandNum), addr)) :+ IntegerEntry(keyLandArtStatusByTypeAndAssetId(ARTPRESALE, newLandAssetId), r._2)) :+ IntegerEntry(keyLandArtStatusByTypeAssetIdAndOwner(ARTPRESALE, newLandAssetId, addr), r._2)) :+ IntegerEntry(keyInfraLevelByAssetId(newLandAssetId), newLevel)) :+ IntegerEntry(keyInfraLevelByAssetIdAndOwner(newLandAssetId, addr), newLevel)) :+ StringEntry(bpKey, makeString([currentPack[bpIdxLevel], r._4, newMat, currentPack[bpIdxProd]], ":"))) :+ StringEntry(keyResProportions(), r._6)) :+ StringEntry(keyDuckLocation(duckAssetId), makeString([continent, "L", newLandAssetId], "_"))) :+ ScriptTransfer(addressFromStringValue(addr), 1, assetId)), newLandAssetId) | |
1072 | + | } | |
1073 | + | ||
1074 | + | ||
1075 | + | func s2m (addr,landAssetIds,txId) = mergeInternal("M", 3, "SSSS", addr, landAssetIds, txId, 0) | |
1076 | + | ||
1077 | + | ||
1078 | + | func m2l (addr,landAssetIds,txId,shouldUseMat,paymentAmount) = { | |
1079 | + | let cost = (InfraUpgradeCostSUsdn * 4) | |
1080 | + | if (if (!(shouldUseMat)) | |
1081 | + | then (paymentAmount != cost) | |
1082 | + | else false) | |
1083 | + | then throw(("Payment attached should be " + toString(cost))) | |
1084 | + | else mergeInternal("L", 4, "SMM", addr, landAssetIds, txId, (InfraUpgradeCostS * 4)) | |
1085 | + | } | |
1086 | + | ||
1087 | + | ||
1088 | + | func l2xl (addr,landAssetIds,txId,shouldUseMat,paymentAmount) = { | |
1089 | + | let cost = (InfraUpgradeCostSUsdn * 47) | |
1090 | + | if (if (!(shouldUseMat)) | |
1091 | + | then (paymentAmount != cost) | |
1092 | + | else false) | |
1093 | + | then throw(("Payment attached should be " + toString(cost))) | |
1094 | + | else mergeInternal("XL", 5, "SSSML", addr, landAssetIds, txId, (InfraUpgradeCostS * 47)) | |
1095 | + | } | |
1096 | + | ||
1097 | + | ||
1098 | + | func xl2xxl (addr,landAssetIds,txId,shouldUseMat,paymentAmount) = { | |
1099 | + | let cost = (InfraUpgradeCostSUsdn * 54) | |
1100 | + | if (if (!(shouldUseMat)) | |
1101 | + | then (paymentAmount != cost) | |
1102 | + | else false) | |
1103 | + | then throw(("Payment attached should be " + toString(cost))) | |
1104 | + | else mergeInternal("XXL", 6, "LXL", addr, landAssetIds, txId, (InfraUpgradeCostS * 54)) | |
1105 | + | } | |
1106 | + | ||
1107 | + | ||
1108 | + | func mergeCommon (shouldUseMat,addr,paymentAmount,landAssetIds,txId) = { | |
1109 | + | let mergeResult = match size(landAssetIds) { | |
1110 | + | case _ => | |
1111 | + | if ((4 == $match0)) | |
1112 | + | then s2m(addr, landAssetIds, txId) | |
1113 | + | else if ((3 == $match0)) | |
1114 | + | then m2l(addr, landAssetIds, txId, shouldUseMat, paymentAmount) | |
1115 | + | else if ((5 == $match0)) | |
1116 | + | then l2xl(addr, landAssetIds, txId, shouldUseMat, paymentAmount) | |
1117 | + | else if ((2 == $match0)) | |
1118 | + | then xl2xxl(addr, landAssetIds, txId, shouldUseMat, paymentAmount) | |
1119 | + | else throw("Unknown merge") | |
1120 | + | } | |
1121 | + | mergeResult | |
1122 | + | } | |
1123 | + | ||
1124 | + | ||
1125 | + | func prolog (i) = if (if ((i.originCaller != restContract)) | |
1126 | + | then valueOrElse(getBoolean(keyBlocked()), false) | |
1127 | + | else false) | |
1128 | + | then throw("Contracts are under maintenance") | |
1129 | + | else StringEntry(keyLastTxIdByUser(toString(i.originCaller)), toBase58String(i.transactionId)) | |
1130 | + | ||
1131 | + | ||
283 | 1132 | @Callable(i) | |
284 | - | func constructorV1 ( | |
285 | - | then throw(" | |
286 | - | else [StringEntry( | |
1133 | + | func constructorV1 (restAddr) = if ((i.caller != this)) | |
1134 | + | then throw("Permission denied") | |
1135 | + | else [StringEntry(keyRestAddress(), restAddr)] | |
287 | 1136 | ||
288 | 1137 | ||
289 | 1138 | ||
290 | 1139 | @Callable(i) | |
291 | - | func walletInfoREADONLY (userAddressOpt) = $Tuple2(nil, walletInternal(userAddressOpt)) | |
1140 | + | func setBlocked (isBlocked) = if ((i.caller != this)) | |
1141 | + | then throw("permission denied") | |
1142 | + | else [BooleanEntry(keyBlocked(), isBlocked)] | |
292 | 1143 | ||
293 | 1144 | ||
294 | 1145 | ||
295 | 1146 | @Callable(i) | |
296 | - | func duckInfoREADONLY (duckAssetId,userAddressOpt) = { | |
297 | - | let addr = addressFromString(userAddressOpt) | |
298 | - | let duckAsset = fromBase58String(duckAssetId) | |
299 | - | if ((duckAssetId == "")) | |
300 | - | then throw("duckAssetId is required") | |
1147 | + | func stakeLand () = { | |
1148 | + | let prologAction = prolog(i) | |
1149 | + | if ((size(i.payments) != 1)) | |
1150 | + | then throw("Exactly one payment required") | |
301 | 1151 | else { | |
302 | - | let duckOwner = getString(stakingContract, keyDuckIdToOwner(duckAssetId)) | |
303 | - | let owner = if (isDefined(duckOwner)) | |
304 | - | then value(duckOwner) | |
305 | - | else if (if (isDefined(addr)) | |
306 | - | then (assetBalance(value(addr), duckAsset) == 1) | |
307 | - | else false) | |
308 | - | then userAddressOpt | |
309 | - | else "" | |
310 | - | $Tuple2(nil, $Tuple2(duckInfoArray(duckAssetId, owner, duckInfoTuple(duckAssetId)), walletInternal(userAddressOpt))) | |
1152 | + | let pmt = value(i.payments[0]) | |
1153 | + | let assetId = value(pmt.assetId) | |
1154 | + | let address = toString(i.caller) | |
1155 | + | if ((pmt.amount != 1)) | |
1156 | + | then throw((("NFT " + LANDPREFIX) + " token should be attached as payment")) | |
1157 | + | else { | |
1158 | + | let asset = value(assetInfo(assetId)) | |
1159 | + | if ((asset.issuer != this)) | |
1160 | + | then throw("Unknown issuer of token") | |
1161 | + | else if (!(contains(asset.name, LANDPREFIX))) | |
1162 | + | then throw((("Only NFT " + LANDPREFIX) + " tokens are accepted")) | |
1163 | + | else { | |
1164 | + | let landNumSize = drop(asset.name, 4) | |
1165 | + | let landNum = if (contains(landNumSize, "XXL")) | |
1166 | + | then dropRight(landNumSize, 3) | |
1167 | + | else if (contains(landNumSize, "XL")) | |
1168 | + | then dropRight(landNumSize, 2) | |
1169 | + | else dropRight(landNumSize, 1) | |
1170 | + | if (!(isDefined(parseInt(landNum)))) | |
1171 | + | then throw(("Cannot parse land number from " + asset.name)) | |
1172 | + | else { | |
1173 | + | let landAssetId = toBase58String(assetId) | |
1174 | + | let timeKey = keyStakedTimeByAssetId(landAssetId) | |
1175 | + | if (isDefined(getInteger(timeKey))) | |
1176 | + | then throw((("NFT " + asset.name) + " is already staked")) | |
1177 | + | else { | |
1178 | + | let d = split(asset.description, "_") | |
1179 | + | let terrainCounts = countTerrains(d[recTerrains]) | |
1180 | + | let props = updateProportions(terrainCounts, (numPiecesBySize(d[recLandSize]) / SSIZE), 1) | |
1181 | + | let landsStr = getString(keyStakedLandsByOwner(address)) | |
1182 | + | let lands = if (isDefined(landsStr)) | |
1183 | + | then split_51C(value(landsStr), "_") | |
1184 | + | else nil | |
1185 | + | if (containsElement(lands, landAssetId)) | |
1186 | + | then throw(("Your staked lands already contain " + landAssetId)) | |
1187 | + | else [IntegerEntry(timeKey, lastBlock.timestamp), IntegerEntry(keyStakedTimeByTypeAssetIdAndOwner(LANDPREFIX, landAssetId, address), lastBlock.timestamp), StringEntry(keyStakedLandsByOwner(address), makeString_11C((lands :+ landAssetId), "_")), StringEntry(keyLandAssetIdToOwner(landAssetId), address), StringEntry(keyLandNumToOwner(landNum), address), StringEntry(keyResProportions(), props), prologAction] | |
1188 | + | } | |
1189 | + | } | |
1190 | + | } | |
1191 | + | } | |
311 | 1192 | } | |
312 | 1193 | } | |
313 | 1194 | ||
314 | 1195 | ||
315 | 1196 | ||
316 | 1197 | @Callable(i) | |
317 | - | func landInfoREADONLY (landAssetId,userAddressOpt) = { | |
318 | - | let addr = addressFromString(userAddressOpt) | |
319 | - | let landAsset = fromBase58String(landAssetId) | |
320 | - | if ((landAssetId == "")) | |
321 | - | then throw("landAssetId is required") | |
1198 | + | func unstakeLand (landAssetIdIn) = { | |
1199 | + | let prologAction = prolog(i) | |
1200 | + | if ((size(i.payments) != 0)) | |
1201 | + | then throw("unstake doesn't require any payments") | |
322 | 1202 | else { | |
323 | - | let stakedTime = valueOrElse(getInteger(stakingContract, keyStakedTimeByAssetId(landAssetId)), 0) | |
324 | - | let owner = if ((stakedTime > 0)) | |
325 | - | then value(getString(stakingContract, keyLandAssetIdToOwner(landAssetId))) | |
326 | - | else if (if (isDefined(addr)) | |
327 | - | then (assetBalance(value(addr), landAsset) == 1) | |
328 | - | else false) | |
329 | - | then userAddressOpt | |
330 | - | else "" | |
331 | - | let stakedDuck = getString(stakingContract, keyStakedDuckByOwner(userAddressOpt)) | |
332 | - | let duckInf = if (if (isDefined(addr)) | |
333 | - | then isDefined(stakedDuck) | |
334 | - | else false) | |
335 | - | then { | |
336 | - | let duckAssetId = value(stakedDuck) | |
337 | - | $Tuple2(duckAssetId, duckInfoTuple(duckAssetId)) | |
1203 | + | let addr = toString(i.caller) | |
1204 | + | let c = checkClaimConditions(addr, claimModeDuck, landAssetIdIn) | |
1205 | + | let landAssetId = c._2 | |
1206 | + | let landsKey = keyStakedLandsByOwner(addr) | |
1207 | + | let terrainCounts = countTerrains(c._3[recTerrains]) | |
1208 | + | let pieces = numPiecesBySize(c._3[recLandSize]) | |
1209 | + | let props = updateProportions(terrainCounts, (pieces / SSIZE), -1) | |
1210 | + | let claimResult = claimAll(addr, landAssetId, pieces, claimModeDuck) | |
1211 | + | let lands = split_51C(valueOrElse(getString(landsKey), ""), "_") | |
1212 | + | let idx = indexOf(lands, landAssetId) | |
1213 | + | if (!(isDefined(idx))) | |
1214 | + | then throw(("Your staked lands don't contain " + landAssetId)) | |
1215 | + | else { | |
1216 | + | let t = value(blockInfoByHeight(height)).timestamp | |
1217 | + | let releaseTime = valueOrElse(getInteger(govContract, keyUserGwlReleaseTime(addr)), 0) | |
1218 | + | if ((releaseTime >= t)) | |
1219 | + | then throw(("Your gWL are taking part in voting, cannot unstake until " + toString(releaseTime))) | |
1220 | + | else [ScriptTransfer(i.caller, 1, fromBase58String(landAssetId)), DeleteEntry(keyStakedTimeByAssetId(landAssetId)), DeleteEntry(keyStakedTimeByTypeAssetIdAndOwner(LANDPREFIX, landAssetId, addr)), StringEntry(keyResProportions(), props), StringEntry(claimResult._2, makeString(claimResult._3, ":")), if ((size(lands) > 1)) | |
1221 | + | then StringEntry(landsKey, makeString_11C(removeByIndex(lands, value(idx)), "_")) | |
1222 | + | else DeleteEntry(landsKey), prologAction] | |
338 | 1223 | } | |
339 | - | else $Tuple2("", $Tuple5(-1, "", "", -1, "")) | |
340 | - | $Tuple2(nil, $Tuple3(landInfoArray(landAssetId, owner, stakedTime), duckInfoArray(duckInf._1, userAddressOpt, duckInf._2), walletInternal(userAddressOpt))) | |
341 | 1224 | } | |
342 | 1225 | } | |
343 | 1226 | ||
344 | 1227 | ||
345 | 1228 | ||
346 | 1229 | @Callable(i) | |
347 | - | func stakedLandsInfoREADONLY (myAddress,landOwnerAddress) = if ((landOwnerAddress == "")) | |
348 | - | then throw("landOwnerAddress is required") | |
349 | - | else { | |
350 | - | let myAddr = addressFromString(myAddress) | |
351 | - | let landsStr = getString(stakingContract, keyStakedLandsByOwner(landOwnerAddress)) | |
352 | - | let lands = if (isDefined(landsStr)) | |
353 | - | then split_51C(value(landsStr), "_") | |
354 | - | else nil | |
355 | - | func oneLand (acc,landAssetId) = { | |
356 | - | let landAsset = fromBase58String(landAssetId) | |
357 | - | if ((landAssetId == "")) | |
358 | - | then throw("landAssetId is required") | |
1230 | + | func stakeDuck () = { | |
1231 | + | let prologAction = prolog(i) | |
1232 | + | if ((size(i.payments) != 1)) | |
1233 | + | then throw("Exactly one payment required") | |
1234 | + | else { | |
1235 | + | let pmt = value(i.payments[0]) | |
1236 | + | let assetId = value(pmt.assetId) | |
1237 | + | let address = toString(i.caller) | |
1238 | + | if ((pmt.amount != 1)) | |
1239 | + | then throw((("NFT " + DUCKPREFIX) + " token should be attached as payment")) | |
359 | 1240 | else { | |
360 | - | let stakedTime = valueOrElse(getInteger(stakingContract, keyStakedTimeByAssetId(landAssetId)), 0) | |
361 | - | let descr = value(assetInfo(landAsset)).description | |
362 | - | let d = split(descr, "_") | |
363 | - | let pieces = numPiecesBySize(d[recLandSize]) | |
364 | - | let productivity = applyBonuses(landAssetId, pieces) | |
365 | - | let deltaTime = (lastBlock.timestamp - stakedTime) | |
366 | - | let availRes = fraction(deltaTime, (productivity._3 * pieces), DAYMILLIS) | |
367 | - | (acc :+ [("%s%s__landAssetId__" + landAssetId), ("%s%d__stakedTime__" + toString(stakedTime)), ("%s%s__description__" + descr), ("%s%d__infraLevel__" + toString(productivity._1)), makeString(["%s%s", "landArtefacts", ("PRESALE:" + toString(productivity._2))], SEP), ("%s%s__availRes__" + toString(availRes))]) | |
1241 | + | let asset = value(assetInfo(assetId)) | |
1242 | + | if (if ((asset.issuer != incubatorAddr)) | |
1243 | + | then (asset.issuer != breederAddr) | |
1244 | + | else false) | |
1245 | + | then throw((("Unknown issuer of " + DUCKPREFIX) + " token")) | |
1246 | + | else if (!(contains(asset.name, DUCKPREFIX))) | |
1247 | + | then throw((("Only NFT " + DUCKPREFIX) + " tokens are accepted")) | |
1248 | + | else { | |
1249 | + | let assetIdStr = toBase58String(assetId) | |
1250 | + | let timeKey = keyStakedTimeByAssetId(assetIdStr) | |
1251 | + | if (isDefined(getInteger(timeKey))) | |
1252 | + | then throw((("NFT " + asset.name) + " is already staked")) | |
1253 | + | else if (isDefined(getString(keyStakedDuckByOwner(address)))) | |
1254 | + | then throw(("You already staked one duck: " + asset.name)) | |
1255 | + | else { | |
1256 | + | let locKey = keyDuckLocation(assetIdStr) | |
1257 | + | let location = getString(locKey) | |
1258 | + | let bpKey = keyBackpackByDuck(assetIdStr) | |
1259 | + | let backpack = getString(bpKey) | |
1260 | + | ([IntegerEntry(timeKey, lastBlock.timestamp), IntegerEntry(keyStakedTimeByTypeAssetIdAndOwner(DUCKPREFIX, toBase58String(assetId), address), lastBlock.timestamp), StringEntry(keyDuckIdToOwner(assetIdStr), address), StringEntry(keyStakedDuckByOwner(address), assetIdStr)] ++ (if (isDefined(location)) | |
1261 | + | then nil | |
1262 | + | else ([StringEntry(locKey, DEFAULTLOCATION)] ++ (if (isDefined(backpack)) | |
1263 | + | then nil | |
1264 | + | else (([StringEntry(bpKey, "0:0_0_0_0_0_0:0_0_0_0_0_0:")] :+ IntegerEntry(keyDuckHealth(assetIdStr), 100)) :+ prologAction))))) | |
1265 | + | } | |
1266 | + | } | |
368 | 1267 | } | |
369 | 1268 | } | |
1269 | + | } | |
370 | 1270 | ||
371 | - | let r = { | |
372 | - | let $l = lands | |
373 | - | let $s = size($l) | |
374 | - | let $acc0 = nil | |
375 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
376 | - | then $a | |
377 | - | else oneLand($a, $l[$i]) | |
378 | 1271 | ||
379 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
380 | - | then $a | |
381 | - | else throw("List size exceeds 100") | |
382 | 1272 | ||
383 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50), 51), 52), 53), 54), 55), 56), 57), 58), 59), 60), 61), 62), 63), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99), 100) | |
1273 | + | @Callable(i) | |
1274 | + | func unstakeDuck (assetIdStr) = { | |
1275 | + | let prologAction = prolog(i) | |
1276 | + | if ((size(i.payments) != 0)) | |
1277 | + | then throw("unstake doesn't require any payments") | |
1278 | + | else { | |
1279 | + | let assetId = fromBase58String(assetIdStr) | |
1280 | + | let address = toString(i.caller) | |
1281 | + | let asset = value(assetInfo(assetId)) | |
1282 | + | let timeKey = keyStakedTimeByAssetId(toBase58String(assetId)) | |
1283 | + | if (!(isDefined(getInteger(timeKey)))) | |
1284 | + | then throw((("NFT " + asset.name) + " is not staked")) | |
1285 | + | else if (!(isDefined(getString(keyStakedDuckByOwner(address))))) | |
1286 | + | then throw((("The duck " + asset.name) + " is not staked")) | |
1287 | + | else { | |
1288 | + | let owner = valueOrErrorMessage(getString(keyDuckIdToOwner(toBase58String(assetId))), (("NFT " + asset.name) + " is orphaned")) | |
1289 | + | if ((owner != address)) | |
1290 | + | then throw("Staked NFT is not yours") | |
1291 | + | else { | |
1292 | + | let keyHealth = keyDuckHealth(assetIdStr) | |
1293 | + | let health = valueOrElse(getInteger(keyHealth), 100) | |
1294 | + | if ((health != 100)) | |
1295 | + | then throw("Please heal your duck before unstaking") | |
1296 | + | else [ScriptTransfer(i.caller, 1, assetId), DeleteEntry(timeKey), DeleteEntry(keyHealth), DeleteEntry(keyDuckLocation(assetIdStr)), DeleteEntry(keyDuckIdToOwner(assetIdStr)), DeleteEntry(keyStakedTimeByTypeAssetIdAndOwner(DUCKPREFIX, assetIdStr, address)), DeleteEntry(keyStakedDuckByOwner(address)), prologAction] | |
1297 | + | } | |
1298 | + | } | |
384 | 1299 | } | |
385 | - | let stakedDuck = getString(stakingContract, keyStakedDuckByOwner(myAddress)) | |
386 | - | let duckInf = if (if (isDefined(myAddr)) | |
387 | - | then isDefined(stakedDuck) | |
388 | - | else false) | |
389 | - | then { | |
390 | - | let duckAssetId = value(stakedDuck) | |
391 | - | $Tuple2(duckAssetId, duckInfoTuple(duckAssetId)) | |
1300 | + | } | |
1301 | + | ||
1302 | + | ||
1303 | + | ||
1304 | + | @Callable(i) | |
1305 | + | func claimRes (amount,landAssetIdStr) = { | |
1306 | + | let prologAction = prolog(i) | |
1307 | + | if ((size(i.payments) != 0)) | |
1308 | + | then throw("claimRes doesn't require any payments") | |
1309 | + | else { | |
1310 | + | let addr = toString(i.originCaller) | |
1311 | + | let result = claimResInternal(addr, amount, claimModeDuck, landAssetIdStr) | |
1312 | + | $Tuple2((((result._1 :+ StringEntry(result._2, makeString(result._3, ":"))) :+ StringEntry(result._4, makeString(result._5, ":"))) :+ prologAction), result._3[bpIdxRes]) | |
1313 | + | } | |
1314 | + | } | |
1315 | + | ||
1316 | + | ||
1317 | + | ||
1318 | + | @Callable(i) | |
1319 | + | func claimResToWH (amount,landAssetIdStr) = { | |
1320 | + | let prologAction = prolog(i) | |
1321 | + | if ((size(i.payments) != 0)) | |
1322 | + | then throw("claimRes doesn't require any payments") | |
1323 | + | else { | |
1324 | + | let addr = toString(i.originCaller) | |
1325 | + | let result = claimResInternal(addr, amount, claimModeWh, landAssetIdStr) | |
1326 | + | $Tuple2((((result._1 :+ StringEntry(result._2, makeString(result._3, ":"))) :+ StringEntry(result._4, makeString(result._5, ":"))) :+ prologAction), result._5[whIdxRes]) | |
1327 | + | } | |
1328 | + | } | |
1329 | + | ||
1330 | + | ||
1331 | + | ||
1332 | + | @Callable(i) | |
1333 | + | func flight (message,sig) = { | |
1334 | + | let prologAction = prolog(i) | |
1335 | + | if (!(sigVerify_8Kb(message, sig, pub))) | |
1336 | + | then throw("signature does not match") | |
1337 | + | else if ((size(i.payments) != 0)) | |
1338 | + | then throw("flight doesn't require any payments") | |
1339 | + | else { | |
1340 | + | let parts = split(toUtf8String(message), ";") | |
1341 | + | let hp = split(split(parts[0], "|")[0], "_") | |
1342 | + | let curHP = parseIntValue(hp[0]) | |
1343 | + | let newHP = parseIntValue(hp[1]) | |
1344 | + | let newLocAndTime = split(parts[1], ":") | |
1345 | + | let newLocation = newLocAndTime[0] | |
1346 | + | let time = parseIntValue(newLocAndTime[1]) | |
1347 | + | if (if ((time > (lastBlock.timestamp + FIVEMINUTESMILLIS))) | |
1348 | + | then true | |
1349 | + | else ((lastBlock.timestamp - FIVEMINUTESMILLIS) > time)) | |
1350 | + | then throw("signature outdated") | |
1351 | + | else { | |
1352 | + | let duckAssetId = valueOrErrorMessage(getString(keyStakedDuckByOwner(toString(i.caller))), "You don't have a duck staked") | |
1353 | + | let keyHealth = keyDuckHealth(duckAssetId) | |
1354 | + | let oldFromState = valueOrElse(getInteger(keyHealth), 100) | |
1355 | + | if ((oldFromState != curHP)) | |
1356 | + | then throw(((("oldHealth=" + toString(valueOrElse(getInteger(keyHealth), 100))) + " from state does not match one from flight log=") + toString(curHP))) | |
1357 | + | else if ((0 >= curHP)) | |
1358 | + | then throw("You can't fly with zero health") | |
1359 | + | else { | |
1360 | + | let locKey = keyDuckLocation(duckAssetId) | |
1361 | + | let curLocation = valueOrElse(getString(locKey), DEFAULTLOCATION) | |
1362 | + | if ((newLocation == curLocation)) | |
1363 | + | then throw("You can't fly to the same location") | |
1364 | + | else $Tuple2([StringEntry(locKey, if ((newHP > 0)) | |
1365 | + | then newLocation | |
1366 | + | else curLocation), IntegerEntry(keyHealth, newHP), prologAction], unit) | |
1367 | + | } | |
1368 | + | } | |
392 | 1369 | } | |
393 | - | else $Tuple2("", $Tuple5(-1, "", "", -1, "")) | |
394 | - | $Tuple2(nil, $Tuple3(r, duckInfoArray(duckInf._1, myAddress, duckInf._2), walletInternal(myAddress))) | |
1370 | + | } | |
1371 | + | ||
1372 | + | ||
1373 | + | ||
1374 | + | @Callable(i) | |
1375 | + | func setHealth (health,duckAssetId) = { | |
1376 | + | let prologAction = prolog(i) | |
1377 | + | if (if ((0 > health)) | |
1378 | + | then true | |
1379 | + | else (health > 100)) | |
1380 | + | then throw("HP should be within 0..100") | |
1381 | + | else [IntegerEntry(keyDuckHealth(duckAssetId), health), prologAction] | |
1382 | + | } | |
1383 | + | ||
1384 | + | ||
1385 | + | ||
1386 | + | @Callable(i) | |
1387 | + | func heal (matType,amount) = { | |
1388 | + | let prologAction = prolog(i) | |
1389 | + | if (if ((0 > matType)) | |
1390 | + | then true | |
1391 | + | else (matType >= NUMRES)) | |
1392 | + | then throw(("Unknown material: " + toString(matType))) | |
1393 | + | else if ((0 >= amount)) | |
1394 | + | then throw(("Amount should be positive! " + toString(amount))) | |
1395 | + | else { | |
1396 | + | let duckAssetId = valueOrErrorMessage(getString(keyStakedDuckByOwner(toString(i.caller))), "You don't have a duck staked") | |
1397 | + | let keyHealth = keyDuckHealth(duckAssetId) | |
1398 | + | let oldHealth = valueOrElse(getInteger(keyHealth), 100) | |
1399 | + | if ((oldHealth >= 100)) | |
1400 | + | then throw("HP should be < 100 to heal") | |
1401 | + | else { | |
1402 | + | let bpKey = keyBackpackByDuck(duckAssetId) | |
1403 | + | let currentPack = getBackpack(bpKey) | |
1404 | + | let mList = split(currentPack[bpIdxMat], "_") | |
1405 | + | let currentAmount = parseIntValue(mList[matType]) | |
1406 | + | let deltaHealth = min([(amount / HEALCOST), (100 - oldHealth)]) | |
1407 | + | let spendAmount = (deltaHealth * HEALCOST) | |
1408 | + | if ((spendAmount > currentAmount)) | |
1409 | + | then throw(((((("You need " + toString(spendAmount)) + " of ") + matTypes[matType]) + " to heal, but you backpack contains ") + toString(currentAmount))) | |
1410 | + | else { | |
1411 | + | let newMat = subOneInList(mList, matType, spendAmount) | |
1412 | + | [IntegerEntry(keyHealth, (oldHealth + deltaHealth)), StringEntry(bpKey, makeString([currentPack[bpIdxLevel], currentPack[bpIdxRes], newMat, currentPack[bpIdxProd]], ":")), prologAction] | |
1413 | + | } | |
1414 | + | } | |
1415 | + | } | |
1416 | + | } | |
1417 | + | ||
1418 | + | ||
1419 | + | ||
1420 | + | @Callable(i) | |
1421 | + | func updateBackpack (duckAssetId,newPack) = { | |
1422 | + | let prologAction = prolog(i) | |
1423 | + | if ((i.caller != economyContract)) | |
1424 | + | then throw("permission denied") | |
1425 | + | else $Tuple2([StringEntry(keyBackpackByDuck(duckAssetId), newPack), prologAction], newPack) | |
1426 | + | } | |
1427 | + | ||
1428 | + | ||
1429 | + | ||
1430 | + | @Callable(i) | |
1431 | + | func buySLand () = if ((i.caller != this)) | |
1432 | + | then throw("Permission denied") | |
1433 | + | else { | |
1434 | + | let prologAction = prolog(i) | |
1435 | + | if ((size(i.payments) != 1)) | |
1436 | + | then throw("Exactly one payment required") | |
1437 | + | else { | |
1438 | + | let pmt = value(i.payments[0]) | |
1439 | + | if ((pmt.assetId != usdnAssetId)) | |
1440 | + | then throw("Allowed USDN payment only!") | |
1441 | + | else if ((pmt.amount != EXPUSDN)) | |
1442 | + | then throw(("Payment attached should be " + toString(EXPUSDN))) | |
1443 | + | else { | |
1444 | + | let result = expeditionInternal(i.caller, i.transactionId) | |
1445 | + | $Tuple2(((result._1 :+ ScriptTransfer(economyContract, pmt.amount, usdnAssetId)) :+ prologAction), result._2._1) | |
1446 | + | } | |
1447 | + | } | |
395 | 1448 | } | |
396 | 1449 | ||
397 | 1450 | ||
398 | 1451 | ||
399 | 1452 | @Callable(i) | |
400 | - | func duckByOwnerInfoREADONLY (userAddress) = { | |
401 | - | let stakedDuck = getString(stakingContract, keyStakedDuckByOwner(userAddress)) | |
402 | - | $Tuple2(nil, if (if (isDefined(addressFromString(userAddress))) | |
403 | - | then isDefined(stakedDuck) | |
404 | - | else false) | |
405 | - | then { | |
406 | - | let duckAssetId = value(stakedDuck) | |
407 | - | duckInfoArray(duckAssetId, userAddress, duckInfoTuple(duckAssetId)) | |
1453 | + | func expedition (message,sig) = { | |
1454 | + | let prologAction = prolog(i) | |
1455 | + | if ((size(i.payments) != 0)) | |
1456 | + | then throw("expedition doesn't require any payments") | |
1457 | + | else { | |
1458 | + | let result = expeditionCommon(true, i.caller, i.transactionId, message, sig) | |
1459 | + | $Tuple2((result._1 :+ prologAction), result._2) | |
408 | 1460 | } | |
409 | - | else duckInfoArray("", userAddress, $Tuple5(-1, "", "", -1, ""))) | |
410 | 1461 | } | |
411 | 1462 | ||
412 | 1463 | ||
413 | 1464 | ||
414 | 1465 | @Callable(i) | |
415 | - | func duckByAssetIdInfoREADONLY (duckAssetId) = { | |
416 | - | let owner = getString(stakingContract, keyDuckIdToOwner(duckAssetId)) | |
417 | - | let duckInf = duckInfoTuple(duckAssetId) | |
418 | - | $Tuple2(nil, duckInfoArray(duckAssetId, if (isDefined(owner)) | |
419 | - | then value(owner) | |
420 | - | else "", duckInfoTuple(duckAssetId))) | |
1466 | + | func upgradeInfra (landAssetId) = { | |
1467 | + | let prologAction = prolog(i) | |
1468 | + | if ((size(i.payments) != 0)) | |
1469 | + | then throw("Infrastructure upgrade doesn't require any payments") | |
1470 | + | else { | |
1471 | + | let result = upInfraCommon(true, i.caller, 0, landAssetId) | |
1472 | + | $Tuple2((result._1 :+ prologAction), result._2) | |
1473 | + | } | |
421 | 1474 | } | |
422 | 1475 | ||
423 | 1476 | ||
424 | 1477 | ||
425 | 1478 | @Callable(i) | |
426 | - | func | |
427 | - | then throw(" | |
1479 | + | func upgradeInfraUsdn (landAssetId) = if ((i.caller != this)) | |
1480 | + | then throw("Permission denied") | |
428 | 1481 | else { | |
429 | - | let stakedTime = valueOrElse(getInteger(stakingContract, keyStakedTimeByAssetId(landAssetId)), -1) | |
430 | - | let owner = if ((stakedTime > 0)) | |
431 | - | then value(getString(stakingContract, keyLandAssetIdToOwner(landAssetId))) | |
432 | - | else "" | |
433 | - | $Tuple2(nil, landInfoArray(landAssetId, owner, stakedTime)) | |
1482 | + | let prologAction = prolog(i) | |
1483 | + | if ((size(i.payments) != 1)) | |
1484 | + | then throw("Exactly one payment required") | |
1485 | + | else { | |
1486 | + | let pmt = value(i.payments[0]) | |
1487 | + | if ((pmt.assetId != usdnAssetId)) | |
1488 | + | then throw("Allowed USDN payment only!") | |
1489 | + | else { | |
1490 | + | let result = upInfraCommon(false, i.caller, pmt.amount, landAssetId) | |
1491 | + | $Tuple2(((result._1 :+ ScriptTransfer(economyContract, pmt.amount, usdnAssetId)) :+ prologAction), result._2) | |
1492 | + | } | |
1493 | + | } | |
434 | 1494 | } | |
435 | 1495 | ||
436 | 1496 | ||
437 | 1497 | ||
438 | 1498 | @Callable(i) | |
439 | - | func stakedLandsByOwnerInfoREADONLY (landOwnerAddress) = if ((landOwnerAddress == "")) | |
440 | - | then throw("landOwnerAddress is required") | |
441 | - | else { | |
442 | - | let landsStr = getString(stakingContract, keyStakedLandsByOwner(landOwnerAddress)) | |
443 | - | let lands = if (isDefined(landsStr)) | |
444 | - | then split_51C(value(landsStr), "_") | |
445 | - | else nil | |
446 | - | func oneLand (acc,landAssetId) = if ((landAssetId == "")) | |
447 | - | then throw("landAssetId is required") | |
448 | - | else { | |
449 | - | let stakedTime = valueOrElse(getInteger(stakingContract, keyStakedTimeByAssetId(landAssetId)), -1) | |
450 | - | (acc :+ landInfoArray(landAssetId, landOwnerAddress, stakedTime)) | |
451 | - | } | |
452 | - | ||
453 | - | let r = { | |
454 | - | let $l = lands | |
455 | - | let $s = size($l) | |
456 | - | let $acc0 = nil | |
457 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
458 | - | then $a | |
459 | - | else oneLand($a, $l[$i]) | |
460 | - | ||
461 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
462 | - | then $a | |
463 | - | else throw("List size exceeds 100") | |
464 | - | ||
465 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50), 51), 52), 53), 54), 55), 56), 57), 58), 59), 60), 61), 62), 63), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99), 100) | |
1499 | + | func activateArtifact (artName,landAssetId) = { | |
1500 | + | let prologAction = prolog(i) | |
1501 | + | if ((size(i.payments) != 0)) | |
1502 | + | then throw("Artifact activation doesn't require any payments") | |
1503 | + | else { | |
1504 | + | let result = match artName { | |
1505 | + | case _ => | |
1506 | + | if (("PRESALE" == $match0)) | |
1507 | + | then activatePresaleArt(toString(i.caller), landAssetId) | |
1508 | + | else throw("Unknown artifact") | |
466 | 1509 | } | |
467 | - | $Tuple2(nil, r) | |
468 | - | } | |
469 | - | ||
470 | - | ||
471 | - | ||
472 | - | @Callable(i) | |
473 | - | func landsByIdsInfoREADONLY (landAssetIds) = { | |
474 | - | func oneLand (acc,landAssetId) = if ((landAssetId == "")) | |
475 | - | then throw("landAssetId is required") | |
476 | - | else { | |
477 | - | let stakedTime = valueOrElse(getInteger(stakingContract, keyStakedTimeByAssetId(landAssetId)), -1) | |
478 | - | let owner = if ((stakedTime > 0)) | |
479 | - | then value(getString(stakingContract, keyLandAssetIdToOwner(landAssetId))) | |
480 | - | else "" | |
481 | - | (acc :+ landInfoArray(landAssetId, owner, stakedTime)) | |
1510 | + | (result :+ prologAction) | |
482 | 1511 | } | |
483 | - | ||
484 | - | let r = { | |
485 | - | let $l = landAssetIds | |
486 | - | let $s = size($l) | |
487 | - | let $acc0 = nil | |
488 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
489 | - | then $a | |
490 | - | else oneLand($a, $l[$i]) | |
491 | - | ||
492 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
493 | - | then $a | |
494 | - | else throw("List size exceeds 100") | |
495 | - | ||
496 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50), 51), 52), 53), 54), 55), 56), 57), 58), 59), 60), 61), 62), 63), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99), 100) | |
497 | - | } | |
498 | - | $Tuple2(nil, r) | |
499 | 1512 | } | |
500 | 1513 | ||
501 | 1514 | ||
502 | 1515 | ||
503 | 1516 | @Callable(i) | |
504 | - | func warehouseOrderByAssetIdInfoREADONLY (landAssetId) = if ((landAssetId == "")) | |
505 | - | then throw("landAssetId is required") | |
506 | - | else { | |
507 | - | let stakedTime = valueOrElse(getInteger(stakingContract, keyStakedTimeByAssetId(landAssetId)), -1) | |
508 | - | let owner = if ((stakedTime > 0)) | |
509 | - | then value(getString(stakingContract, keyLandAssetIdToOwner(landAssetId))) | |
510 | - | else "" | |
511 | - | $Tuple2(nil, landOrderInfoArray(landAssetId, owner)) | |
512 | - | } | |
513 | - | ||
514 | - | ||
515 | - | ||
516 | - | @Callable(i) | |
517 | - | func ordersByLandIdsInfoREADONLY (landAssetIds) = { | |
518 | - | func oneLand (acc,landAssetId) = if ((landAssetId == "")) | |
519 | - | then throw("landAssetId is required") | |
1517 | + | func mergeLands (landAssetIds) = { | |
1518 | + | let prologAction = prolog(i) | |
1519 | + | if ((size(i.payments) != 0)) | |
1520 | + | then throw("Lands merging doesn't require any payments") | |
520 | 1521 | else { | |
521 | - | let stakedTime = valueOrElse(getInteger(stakingContract, keyStakedTimeByAssetId(landAssetId)), -1) | |
522 | - | let owner = if ((stakedTime > 0)) | |
523 | - | then value(getString(stakingContract, keyLandAssetIdToOwner(landAssetId))) | |
524 | - | else "" | |
525 | - | (acc :+ landOrderInfoArray(landAssetId, owner)) | |
1522 | + | let result = mergeCommon(true, toString(i.caller), 0, landAssetIds, i.transactionId) | |
1523 | + | $Tuple2((result._1 :+ prologAction), result._2) | |
526 | 1524 | } | |
527 | - | ||
528 | - | let r = { | |
529 | - | let $l = landAssetIds | |
530 | - | let $s = size($l) | |
531 | - | let $acc0 = nil | |
532 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
533 | - | then $a | |
534 | - | else oneLand($a, $l[$i]) | |
535 | - | ||
536 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
537 | - | then $a | |
538 | - | else throw("List size exceeds 100") | |
539 | - | ||
540 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50), 51), 52), 53), 54), 55), 56), 57), 58), 59), 60), 61), 62), 63), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99), 100) | |
541 | - | } | |
542 | - | $Tuple2(nil, r) | |
543 | 1525 | } | |
544 | 1526 | ||
545 | 1527 | ||
546 | 1528 | ||
547 | 1529 | @Callable(i) | |
548 | - | func cancelWarehouseOrders (landAssetIds) = if ((i.caller != this)) | |
549 | - | then throw("permission denied") | |
550 | - | else { | |
551 | - | let blocked = getBoolean(stakingContract, keyBlocked()) | |
552 | - | if (if (!(isDefined(blocked))) | |
553 | - | then true | |
554 | - | else (value(blocked) == false)) | |
555 | - | then throw("Contracts should be blocked before canceling orders") | |
556 | - | else { | |
557 | - | func oneLand (a,landAssetId) = if ((landAssetId == "")) | |
558 | - | then throw("landAssetId is required") | |
559 | - | else { | |
560 | - | let c = asBoolean(invoke(economyContract, "setWarehouseOrder", ["0@0_0@0_0@0_0@0_0@0_0@0:0@0_0@0_0@0_0@0_0@0_0@0:", landAssetId], nil)) | |
561 | - | if (if (a) | |
562 | - | then true | |
563 | - | else c) | |
564 | - | then !(if (a) | |
565 | - | then c | |
566 | - | else false) | |
567 | - | else false | |
568 | - | } | |
1530 | + | func mergeLandsUsdn (landAssetIds) = { | |
1531 | + | let prologAction = prolog(i) | |
1532 | + | if ((size(i.payments) != 1)) | |
1533 | + | then throw("Exactly one payment required") | |
1534 | + | else { | |
1535 | + | let pmt = value(i.payments[0]) | |
1536 | + | if ((pmt.assetId != usdnAssetId)) | |
1537 | + | then throw("Allowed USDN payment only!") | |
1538 | + | else { | |
1539 | + | let result = mergeCommon(false, toString(i.caller), pmt.amount, landAssetIds, i.transactionId) | |
1540 | + | $Tuple2(((result._1 :+ ScriptTransfer(economyContract, pmt.amount, usdnAssetId)) :+ prologAction), result._2) | |
1541 | + | } | |
1542 | + | } | |
1543 | + | } | |
569 | 1544 | ||
570 | - | let r = { | |
571 | - | let $l = landAssetIds | |
572 | - | let $s = size($l) | |
573 | - | let $acc0 = false | |
574 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
575 | - | then $a | |
576 | - | else oneLand($a, $l[$i]) | |
577 | 1545 | ||
578 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
579 | - | then $a | |
580 | - | else throw("List size exceeds 30") | |
581 | 1546 | ||
582 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30) | |
1547 | + | @Callable(i) | |
1548 | + | func cargoExchange (cargoListStr,landAssetId) = { | |
1549 | + | let prologAction = prolog(i) | |
1550 | + | let cargoParts = split_4C(cargoListStr, ":") | |
1551 | + | let addr = toString(i.originCaller) | |
1552 | + | let asset = value(assetInfo(fromBase58String(landAssetId))) | |
1553 | + | let timeKey = keyStakedTimeByAssetId(landAssetId) | |
1554 | + | if (!(isDefined(getInteger(timeKey)))) | |
1555 | + | then throw((asset.name + " is not staked")) | |
1556 | + | else { | |
1557 | + | let owner = valueOrErrorMessage(getString(keyLandAssetIdToOwner(landAssetId)), (("NFT " + asset.name) + " is orphaned")) | |
1558 | + | if ((owner != addr)) | |
1559 | + | then throw((LANDPREFIX + " is not yours")) | |
1560 | + | else { | |
1561 | + | let landIndex = (numPiecesBySize(split(asset.description, "_")[recLandSize]) / SSIZE) | |
1562 | + | let infraLevel = valueOrElse(getInteger(keyInfraLevelByAssetId(landAssetId)), 0) | |
1563 | + | let duckAssetId = valueOrErrorMessage(getString(keyStakedDuckByOwner(addr)), "You don't have a duck staked") | |
1564 | + | let curLocation = valueOrElse(getString(keyDuckLocation(duckAssetId)), DEFAULTLOCATION) | |
1565 | + | let loc = split(value(curLocation), "_") | |
1566 | + | if ((loc[locIdxType] != "L")) | |
1567 | + | then throw((("Duck location type is " + loc[locIdxType]) + ", but should be L")) | |
1568 | + | else if ((loc[locIdxId] != landAssetId)) | |
1569 | + | then throw(("Duck should be on the land " + landAssetId)) | |
1570 | + | else { | |
1571 | + | let whKey = keyWarehouseByLand(landAssetId) | |
1572 | + | let currentWh = getWarehouse(whKey, landIndex, infraLevel) | |
1573 | + | let bpKey = keyBackpackByDuck(duckAssetId) | |
1574 | + | let currentPack = getBackpack(bpKey) | |
1575 | + | let result = moveStuff(cargoParts, currentWh, currentPack) | |
1576 | + | [StringEntry(bpKey, makeString([currentPack[bpIdxLevel], result._4, result._5, result._6], ":")), StringEntry(whKey, makeString([currentWh[whIdxVol], result._1, result._2, result._3, currentWh[whIdxLockedVol]], ":")), prologAction] | |
1577 | + | } | |
583 | 1578 | } | |
584 | - | $Tuple2(nil, r) | |
585 | - | } | |
586 | - | } | |
1579 | + | } | |
1580 | + | } | |
1581 | + | ||
1582 | + | ||
1583 | + | ||
1584 | + | @Callable(i) | |
1585 | + | func saveWarehouse (whStr,landAssetId) = { | |
1586 | + | let prologAction = prolog(i) | |
1587 | + | if ((i.caller != economyContract)) | |
1588 | + | then throw("Access denied") | |
1589 | + | else { | |
1590 | + | let whKey = keyWarehouseByLand(landAssetId) | |
1591 | + | if ((size(split_4C(whStr, ":")) != 5)) | |
1592 | + | then throw("warehouse string should contain 4 ':' separators") | |
1593 | + | else $Tuple2([StringEntry(whKey, whStr), prologAction], whStr) | |
1594 | + | } | |
1595 | + | } | |
1596 | + | ||
1597 | + | ||
1598 | + | ||
1599 | + | @Callable(i) | |
1600 | + | func splitByGlobalWeightsREADONLY (amount) = $Tuple2(nil, getNeededMaterials(amount)) | |
1601 | + | ||
1602 | + | ||
1603 | + | ||
1604 | + | @Callable(i) | |
1605 | + | func splitByGlobalAndLocalWeightsREADONLY (matAmount,resAmount,terrains) = { | |
1606 | + | let terrainCounts = countTerrains(terrains) | |
1607 | + | $Tuple2(nil, $Tuple2(getNeededMaterials(matAmount), distributeByWeights(resAmount, terrainCounts))) | |
1608 | + | } | |
1609 | + | ||
1610 | + | ||
1611 | + | ||
1612 | + | @Callable(i) | |
1613 | + | func getBackpackREADONLY (duckAssetId) = $Tuple2(nil, makeString(getBackpack(keyBackpackByDuck(duckAssetId)), ":")) | |
1614 | + | ||
1615 | + | ||
1616 | + | ||
1617 | + | @Callable(i) | |
1618 | + | func getWarehouseREADONLY (landAssetId) = { | |
1619 | + | let asset = value(assetInfo(fromBase58String(landAssetId))) | |
1620 | + | let landIndex = (numPiecesBySize(split(asset.description, "_")[recLandSize]) / SSIZE) | |
1621 | + | let infraLevel = valueOrElse(getInteger(keyInfraLevelByAssetId(landAssetId)), 0) | |
1622 | + | $Tuple2(nil, makeString_2C(getWarehouse(keyWarehouseByLand(landAssetId), landIndex, infraLevel), ":")) | |
1623 | + | } | |
587 | 1624 | ||
588 | 1625 |
github/deemru/w8io/169f3d6 183.07 ms ◑