tx · EzSzww8dnq91LsQU6U4E6YKet1JSnCsbBML4KAYcgyzA 3N7HtrKeFFLz5oy6PfGv1Lg3GwPk4gCPdGy: -0.01500000 Waves 2023.06.20 21:04 [2631298] smart account 3N7HtrKeFFLz5oy6PfGv1Lg3GwPk4gCPdGy > SELF 0.00000000 Waves
{ "type": 13, "id": "EzSzww8dnq91LsQU6U4E6YKet1JSnCsbBML4KAYcgyzA", "fee": 1500000, "feeAssetId": null, "timestamp": 1687284343235, "version": 2, "chainId": 84, "sender": "3N7HtrKeFFLz5oy6PfGv1Lg3GwPk4gCPdGy", "senderPublicKey": "FsR18761ZAsUqsTd7TK3XmR6bhihs1UXVmpHYxz5JzQ1", "proofs": [ "5aFZhYWBcCQKQP36Nag5YBDT2hT4FHTwWXDDpxLusNfZi4GGwsTZCgtHVmaAE1FJyeoVovPwgTnJkpnLQJJmmP9S" ], "script": "base64:BgIPCAISBQoDCAgIEgASABIAkwEABWNoYWluCQDJAQIJAMoBAggFBHRoaXMFYnl0ZXMAAQABAAt1c2R0QXNzZXRJZAQHJG1hdGNoMAUFY2hhaW4DCQAAAgEBVwUHJG1hdGNoMAEghNp6sggDP07Ru8qO7ouTvMmC3Qtd+geWqNQj+agP/7kDCQAAAgEBVAUHJG1hdGNoMAEgVbHYn3KHgu/l41uNrAWrZd6aQ6EvFrsF8xq3h6XxxRgJAAIBAg1Vbmtub3duIGNoYWluABVkZWZhdWx0UmVzdEFkZHJlc3NTdHIEByRtYXRjaDAFBWNoYWluAwkAAAIBAVcFByRtYXRjaDACIzNQUUN1dkZidmg0TGtQVW5yblUxejNqbmJBMXA5bTNXTmh2AwkAAAIBAVQFByRtYXRjaDACIzNNdW1rR0d6dENLQVhwV0RxeGtkZG9mcVhTVWJxUWt2U0p5CQACAQINVW5rbm93biBjaGFpbgARSW5mcmFVcGdyYWRlQ29zdFMEByRtYXRjaDAFBWNoYWluAwkAAAIBAVcFByRtYXRjaDAAgMivoCUDCQAAAgEBVAUHJG1hdGNoMACA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QELdmFsdWVPckVsc2UCCQCfCAEFB3VzZXJLZXkAAAUKdXNlckFtb3VudAkAzAgCCQEMSW50ZWdlckVudHJ5AgUZc3Rha2Vyc0Ftb3VudFBhaWRUb3RhbEtleQkAZAIJAQt2YWx1ZU9yRWxzZQIJAJ8IAQUZc3Rha2Vyc0Ftb3VudFBhaWRUb3RhbEtleQAABQp1c2VyQW1vdW50CQDMCAIJAQxJbnRlZ2VyRW50cnkCBRRzdGFrZXJzQW1vdW50TGVmdEtleQkAZQIFD2Ftb3VudExlZnRUb3RhbAUKdXNlckFtb3VudAkAzAgCCQEMSW50ZWdlckVudHJ5AgUUbGFzdE1hcmtldGluZ1RpbWVLZXkFA25vdwkAzAgCCQEMSW50ZWdlckVudHJ5AgUPbGFzdFRlYW1UaW1lS2V5BQNub3cJAMwIAgkBDEludGVnZXJFbnRyeQIFFWxhc3RBY3Rpdml0aWVzVGltZUtleQUDbm93CQDMCAIJAQxJbnRlZ2VyRW50cnkCBQt1c2VyVGltZUtleQUDbm93BQNuaWwFDHByb2xvZ1Jlc3VsdADIQGBN", "height": 2631298, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: ButLAkeJDdpehchQ3czV3PWrdeoC1MXvUhvUh1xcaMZX Next: 466abnDDzXoaujQ9XYrdQ9f4BnXDSkkWyCUSpdmVPBGp Diff:
Old | New | Differences | |
---|---|---|---|
531 | 531 | let maxUsdt = getSwapLimit(addr) | |
532 | 532 | let curStats = getWlgStats() | |
533 | 533 | let curAmount = (curStats[idxWlgAmount] - wlgAmt) | |
534 | - | let curPrice = curStats[idxWlgPrice] | |
535 | - | let sellPrice = (curPrice - (curPrice / 5)) | |
534 | + | let sellPrice = fraction(curStats[idxWlgPrice], 4, 5) | |
536 | 535 | let usdtAmount = fraction(wlgAmt, sellPrice, MULT8) | |
537 | 536 | if ((usdtAmount > maxUsdt)) | |
538 | 537 | then throw((("You can get max " + toString(maxUsdt)) + " USDT")) |
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 usdtAssetId = match chain { | |
7 | 7 | case _ => | |
8 | 8 | if ((base58'2W' == $match0)) | |
9 | 9 | then base58'9wc3LXNA4TEBsXyKtoLE9mrbDD7WMHXvXrCjZvabLAsi' | |
10 | 10 | else if ((base58'2T' == $match0)) | |
11 | 11 | then base58'6mWwf9mZBjVgkC54idpyaZLQfAosD914wT8fGf2iiY63' | |
12 | 12 | else throw("Unknown chain") | |
13 | 13 | } | |
14 | 14 | ||
15 | 15 | let defaultRestAddressStr = match chain { | |
16 | 16 | case _ => | |
17 | 17 | if ((base58'2W' == $match0)) | |
18 | 18 | then "3PQCuvFbvh4LkPUnrnU1z3jnbA1p9m3WNhv" | |
19 | 19 | else if ((base58'2T' == $match0)) | |
20 | 20 | then "3MumkGGztCKAXpWDqxkddofqXSUbqQkvSJy" | |
21 | 21 | else throw("Unknown chain") | |
22 | 22 | } | |
23 | 23 | ||
24 | 24 | let InfraUpgradeCostS = match chain { | |
25 | 25 | case _ => | |
26 | 26 | if ((base58'2W' == $match0)) | |
27 | 27 | then 10000000000 | |
28 | 28 | else if ((base58'2T' == $match0)) | |
29 | 29 | then 100000000 | |
30 | 30 | else throw("Unknown chain") | |
31 | 31 | } | |
32 | 32 | ||
33 | 33 | let SEP = "__" | |
34 | 34 | ||
35 | 35 | let MULT6 = 1000000 | |
36 | 36 | ||
37 | 37 | let MULT7 = 10000000 | |
38 | 38 | ||
39 | 39 | let MULT8 = 100000000 | |
40 | 40 | ||
41 | 41 | let MULT10 = 10000000000 | |
42 | 42 | ||
43 | 43 | let LANDPREFIX = "LAND" | |
44 | 44 | ||
45 | 45 | let DUCKPREFIX = "DUCK" | |
46 | 46 | ||
47 | 47 | let ARTPRESALE = "PRESALE" | |
48 | 48 | ||
49 | 49 | let NUMRES = 6 | |
50 | 50 | ||
51 | 51 | let SSIZE = 25 | |
52 | 52 | ||
53 | 53 | let MSIZE = 100 | |
54 | 54 | ||
55 | 55 | let LSIZE = 225 | |
56 | 56 | ||
57 | 57 | let XLSIZE = 400 | |
58 | 58 | ||
59 | 59 | let XXLSIZE = 625 | |
60 | 60 | ||
61 | 61 | let DAILYRESBYPIECE = 3456000 | |
62 | 62 | ||
63 | 63 | let DAYMILLIS = 86400000 | |
64 | 64 | ||
65 | 65 | let WHMULTIPLIER = 10000000000 | |
66 | 66 | ||
67 | 67 | let DEFAULTLOCATION = "Africa_F_Africa" | |
68 | 68 | ||
69 | 69 | let RESOURCEPRICEMIN = 39637 | |
70 | 70 | ||
71 | 71 | let ESMAXPACKAGES = 3 | |
72 | 72 | ||
73 | 73 | let ESBUYCOEF = 4 | |
74 | 74 | ||
75 | 75 | let ESSELLCOEF = 10 | |
76 | 76 | ||
77 | 77 | let MAXHP = 100 | |
78 | 78 | ||
79 | 79 | let resTypes = ["Oil", "Ore", "Wood", "Sand", "Clay", "Organic"] | |
80 | 80 | ||
81 | 81 | let matTypes = ["Fuel", "Metal", "Plank", "Glass", "Plastic", "Protein"] | |
82 | 82 | ||
83 | 83 | let prodTypes = ["First Aid Kit L1", "First Aid Kit L2", "First Aid Kit L3", "Backpack L1", "Backpack L2", "Backpack L3", "Food Ration L1", "Food Ration L2", "Food Ration L3", "Jet Pack L1", "Jet Pack L2", "Jet Pack L3", "Shield L1", "Shield L2", "Shield L3"] | |
84 | 84 | ||
85 | 85 | let continents = ["Americas", "Europe", "Asia", "Africa", "Oceania"] | |
86 | 86 | ||
87 | 87 | let productionMatrix = ["1_1_1_2_2_5_1_10_0", "2_2_2_4_4_10_1_10_0", "3_3_3_6_6_15_1_10_0", "2_5_5_2_7_5_2_100_1", "4_10_10_4_14_10_2_100_1", "6_15_15_6_21_15_2_100_1", "1_1_1_1_1_8_1_10_2", "2_2_2_2_2_16_1_10_2", "3_3_3_3_3_24_1_10_2", "9_9_1_5_5_1_5_100_3", "18_18_2_10_10_2_5_100_3", "27_27_3_15_15_3_5_100_3", "2_2_1_2_2_2_1_10_4", "4_4_2_4_4_4_1_10_4", "6_6_3_6_6_6_1_10_4"] | |
88 | 88 | ||
89 | 89 | let contIdxAmericas = 0 | |
90 | 90 | ||
91 | 91 | let contIdxEurope = 1 | |
92 | 92 | ||
93 | 93 | let contIdxAsia = 2 | |
94 | 94 | ||
95 | 95 | let contIdxAfrica = 3 | |
96 | 96 | ||
97 | 97 | let contIdxOceania = 4 | |
98 | 98 | ||
99 | 99 | let recipeIdxFuel = 0 | |
100 | 100 | ||
101 | 101 | let recipeIdxMetal = 1 | |
102 | 102 | ||
103 | 103 | let recipeIdxPlank = 2 | |
104 | 104 | ||
105 | 105 | let recipeIdxGlass = 3 | |
106 | 106 | ||
107 | 107 | let recipeIdxPlastic = 4 | |
108 | 108 | ||
109 | 109 | let recipeIdxProtein = 5 | |
110 | 110 | ||
111 | 111 | let recipeIdxWeight = 6 | |
112 | 112 | ||
113 | 113 | let recipeIdxPacksize = 7 | |
114 | 114 | ||
115 | 115 | let recipeIdxContinent = 8 | |
116 | 116 | ||
117 | 117 | let recLandNum = 0 | |
118 | 118 | ||
119 | 119 | let recLandSize = 1 | |
120 | 120 | ||
121 | 121 | let recTerrains = 2 | |
122 | 122 | ||
123 | 123 | let recContinent = 3 | |
124 | 124 | ||
125 | 125 | let whIdxLevels = 0 | |
126 | 126 | ||
127 | 127 | let whIdxRes = 1 | |
128 | 128 | ||
129 | 129 | let whIdxMat = 2 | |
130 | 130 | ||
131 | 131 | let whIdxProd = 3 | |
132 | 132 | ||
133 | 133 | let whIdxLOFT = 4 | |
134 | 134 | ||
135 | 135 | let volLocked = 0 | |
136 | 136 | ||
137 | 137 | let volOccupied = 1 | |
138 | 138 | ||
139 | 139 | let volFree = 2 | |
140 | 140 | ||
141 | 141 | let volTotal = 3 | |
142 | 142 | ||
143 | 143 | let bpIdxLevel = 0 | |
144 | 144 | ||
145 | 145 | let bpIdxRes = 1 | |
146 | 146 | ||
147 | 147 | let bpIdxMat = 2 | |
148 | 148 | ||
149 | 149 | let bpIdxProd = 3 | |
150 | 150 | ||
151 | 151 | func getPkgSize (prodIdx) = parseIntValue(split(productionMatrix[prodIdx], "_")[recipeIdxPacksize]) | |
152 | 152 | ||
153 | 153 | ||
154 | 154 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
155 | 155 | ||
156 | 156 | ||
157 | 157 | func getIntOrElse (key,defaultVal) = valueOrElse(getInteger(this, key), defaultVal) | |
158 | 158 | ||
159 | 159 | ||
160 | 160 | let IdxCfgStakingDapp = 1 | |
161 | 161 | ||
162 | 162 | let IdxCfgEconomyDapp = 2 | |
163 | 163 | ||
164 | 164 | let IdxCfgGovernanceDapp = 3 | |
165 | 165 | ||
166 | 166 | let IdxCfgWlgDapp = 4 | |
167 | 167 | ||
168 | 168 | func keyRestCfg () = "%s__restConfig" | |
169 | 169 | ||
170 | 170 | ||
171 | 171 | func keyRestAddress () = "%s__restAddr" | |
172 | 172 | ||
173 | 173 | ||
174 | 174 | func readRestCfgOrFail (rest) = split_4C(getStringOrFail(rest, keyRestCfg()), SEP) | |
175 | 175 | ||
176 | 176 | ||
177 | 177 | func getContractAddressOrFail (restCfg,idx) = valueOrErrorMessage(addressFromString(restCfg[idx]), ("Rest cfg doesn't contain address at index " + toString(idx))) | |
178 | 178 | ||
179 | 179 | ||
180 | 180 | let restContract = addressFromStringValue(valueOrElse(getString(this, keyRestAddress()), defaultRestAddressStr)) | |
181 | 181 | ||
182 | 182 | let restCfg = readRestCfgOrFail(restContract) | |
183 | 183 | ||
184 | 184 | let stakingContract = getContractAddressOrFail(restCfg, IdxCfgStakingDapp) | |
185 | 185 | ||
186 | 186 | let economyContract = getContractAddressOrFail(restCfg, IdxCfgEconomyDapp) | |
187 | 187 | ||
188 | 188 | let govContract = getContractAddressOrFail(restCfg, IdxCfgGovernanceDapp) | |
189 | 189 | ||
190 | 190 | let wlgContract = getContractAddressOrFail(restCfg, IdxCfgWlgDapp) | |
191 | 191 | ||
192 | 192 | func keyLastTxIdByUser (addr) = ("lastTxIdByUser_" + addr) | |
193 | 193 | ||
194 | 194 | ||
195 | 195 | func keyLandAssetIdToOwner (assetId) = ("nftOwner_" + assetId) | |
196 | 196 | ||
197 | 197 | ||
198 | 198 | func keyLandAssetIdToCustomName (assetId) = ("landCustomNameByAssetId_" + assetId) | |
199 | 199 | ||
200 | 200 | ||
201 | 201 | func keyStakedTimeByAssetId (assetId) = ("stakedTime_" + assetId) | |
202 | 202 | ||
203 | 203 | ||
204 | 204 | func keyInfraLevelByAssetId (assetId) = ("infraLevel_" + assetId) | |
205 | 205 | ||
206 | 206 | ||
207 | 207 | func keyLandArtStatusByTypeAndAssetId (type,assetId) = makeString(["landArtStatus", type, assetId], "_") | |
208 | 208 | ||
209 | 209 | ||
210 | 210 | func keyStakedTimeByTypeAssetIdAndOwner (nftType,assetId,ownerAddr) = ((((("stakedTimeByTypeAssetIdAndOwner_" + nftType) + "_") + assetId) + "_") + ownerAddr) | |
211 | 211 | ||
212 | 212 | ||
213 | 213 | func keyWarehouseByLand (landAssetId) = ("wareHouse_" + landAssetId) | |
214 | 214 | ||
215 | 215 | ||
216 | 216 | func keyStakedLandsByOwner (ownerAddr) = ("stakedLandsByOwner_" + ownerAddr) | |
217 | 217 | ||
218 | 218 | ||
219 | 219 | func keyStakedPiecesByOwner (ownerAddr) = ("stakedPiecesByOwner_" + ownerAddr) | |
220 | 220 | ||
221 | 221 | ||
222 | 222 | func keyDuckAssetIdToCustomName (assetId) = ("duckCustomNameByAssetId_" + assetId) | |
223 | 223 | ||
224 | 224 | ||
225 | 225 | func keyAddressToCustomName (addr) = ("accountCustomNameByAddr_" + addr) | |
226 | 226 | ||
227 | 227 | ||
228 | 228 | func keyAddressRefBy (addr) = ("accRefBy_" + addr) | |
229 | 229 | ||
230 | 230 | ||
231 | 231 | func keyAddressReferrals (addr) = ("accReferrals_" + addr) | |
232 | 232 | ||
233 | 233 | ||
234 | 234 | func keyDuckIdToOwner (assetId) = ("duckOwner_" + assetId) | |
235 | 235 | ||
236 | 236 | ||
237 | 237 | func keyStakedDuckByOwner (ownerAddr) = ("stakedDuckByOwner_" + ownerAddr) | |
238 | 238 | ||
239 | 239 | ||
240 | 240 | func keyBackpackByDuck (duckAssetId) = ("backPack_" + duckAssetId) | |
241 | 241 | ||
242 | 242 | ||
243 | 243 | func keyDuckLocation (duckAssetId) = ("duckLocation_" + duckAssetId) | |
244 | 244 | ||
245 | 245 | ||
246 | 246 | func keyDuckHealth (duckAssetId) = ("duckHealth_" + duckAssetId) | |
247 | 247 | ||
248 | 248 | ||
249 | 249 | func keyResProportions () = "resTypesProportions" | |
250 | 250 | ||
251 | 251 | ||
252 | 252 | func keyBlocked () = "contractsBlocked" | |
253 | 253 | ||
254 | 254 | ||
255 | 255 | func keyUserGwlReleaseTime (userAddr) = ("%s%s__userGwlReleaseTime__" + userAddr) | |
256 | 256 | ||
257 | 257 | ||
258 | 258 | func keyOrderByLand (landAssetId) = ("landOrder_" + landAssetId) | |
259 | 259 | ||
260 | 260 | ||
261 | 261 | func keyEsWarehouse () = "emergencyWarehouseProducts" | |
262 | 262 | ||
263 | 263 | ||
264 | 264 | let locIdxContinent = 0 | |
265 | 265 | ||
266 | 266 | let locIdxType = 1 | |
267 | 267 | ||
268 | 268 | let locIdxId = 2 | |
269 | 269 | ||
270 | 270 | func asString (v) = match v { | |
271 | 271 | case s: String => | |
272 | 272 | s | |
273 | 273 | case _ => | |
274 | 274 | throw("fail to cast into String") | |
275 | 275 | } | |
276 | 276 | ||
277 | 277 | ||
278 | 278 | func asInt (v) = match v { | |
279 | 279 | case n: Int => | |
280 | 280 | n | |
281 | 281 | case _ => | |
282 | 282 | throw("fail to cast into Int") | |
283 | 283 | } | |
284 | 284 | ||
285 | 285 | ||
286 | 286 | func asAnyList (v) = match v { | |
287 | 287 | case l: List[Any] => | |
288 | 288 | l | |
289 | 289 | case _ => | |
290 | 290 | throw("fail to cast into List[Any]") | |
291 | 291 | } | |
292 | 292 | ||
293 | 293 | ||
294 | 294 | func asBoolean (v) = match v { | |
295 | 295 | case s: Boolean => | |
296 | 296 | s | |
297 | 297 | case _ => | |
298 | 298 | throw("fail to cast into Boolean") | |
299 | 299 | } | |
300 | 300 | ||
301 | 301 | ||
302 | 302 | func numPiecesBySize (landSize) = match landSize { | |
303 | 303 | case _ => | |
304 | 304 | if (("S" == $match0)) | |
305 | 305 | then SSIZE | |
306 | 306 | else if (("M" == $match0)) | |
307 | 307 | then MSIZE | |
308 | 308 | else if (("L" == $match0)) | |
309 | 309 | then LSIZE | |
310 | 310 | else if (("XL" == $match0)) | |
311 | 311 | then XLSIZE | |
312 | 312 | else if (("XXL" == $match0)) | |
313 | 313 | then XXLSIZE | |
314 | 314 | else throw("Unknown land size") | |
315 | 315 | } | |
316 | 316 | ||
317 | 317 | ||
318 | 318 | let IdxEffTotal = 0 | |
319 | 319 | ||
320 | 320 | let IdxEffUser = 1 | |
321 | 321 | ||
322 | 322 | func getVotingPower (userAddrStrOrEmpty) = { | |
323 | 323 | let props = split(valueOrElse(getString(stakingContract, keyResProportions()), "0_0_0_0_0_0"), "_") | |
324 | 324 | func adder (acc,item) = (acc + parseIntValue(item)) | |
325 | 325 | ||
326 | 326 | let totalPower = { | |
327 | 327 | let $l = props | |
328 | 328 | let $s = size($l) | |
329 | 329 | let $acc0 = 0 | |
330 | 330 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
331 | 331 | then $a | |
332 | 332 | else adder($a, $l[$i]) | |
333 | 333 | ||
334 | 334 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
335 | 335 | then $a | |
336 | 336 | else throw("List size exceeds 6") | |
337 | 337 | ||
338 | 338 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
339 | 339 | } | |
340 | 340 | let usersPower = if ((userAddrStrOrEmpty == "")) | |
341 | 341 | then 0 | |
342 | 342 | else { | |
343 | 343 | let landsStr = getString(stakingContract, keyStakedLandsByOwner(userAddrStrOrEmpty)) | |
344 | 344 | let lands = if (isDefined(landsStr)) | |
345 | 345 | then split_51C(value(landsStr), "_") | |
346 | 346 | else nil | |
347 | 347 | func oneLand (acc,landAssetId) = { | |
348 | 348 | let asset = value(assetInfo(fromBase58String(landAssetId))) | |
349 | 349 | let landSize = split(asset.description, "_")[recLandSize] | |
350 | 350 | (acc + numPiecesBySize(landSize)) | |
351 | 351 | } | |
352 | 352 | ||
353 | 353 | let $l = lands | |
354 | 354 | let $s = size($l) | |
355 | 355 | let $acc0 = 0 | |
356 | 356 | func $f1_1 ($a,$i) = if (($i >= $s)) | |
357 | 357 | then $a | |
358 | 358 | else oneLand($a, $l[$i]) | |
359 | 359 | ||
360 | 360 | func $f1_2 ($a,$i) = if (($i >= $s)) | |
361 | 361 | then $a | |
362 | 362 | else throw("List size exceeds 100") | |
363 | 363 | ||
364 | 364 | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_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) | |
365 | 365 | } | |
366 | 366 | [totalPower, usersPower] | |
367 | 367 | } | |
368 | 368 | ||
369 | 369 | ||
370 | 370 | func getRecipeMaterials (recipe) = { | |
371 | 371 | func addMat (ac,j) = (ac + parseIntValue(recipe[j])) | |
372 | 372 | ||
373 | 373 | let $l = [0, 1, 2, 3, 4, 5] | |
374 | 374 | let $s = size($l) | |
375 | 375 | let $acc0 = 0 | |
376 | 376 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
377 | 377 | then $a | |
378 | 378 | else addMat($a, $l[$i]) | |
379 | 379 | ||
380 | 380 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
381 | 381 | then $a | |
382 | 382 | else throw("List size exceeds 6") | |
383 | 383 | ||
384 | 384 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
385 | 385 | } | |
386 | 386 | ||
387 | 387 | ||
388 | 388 | let MULT14 = 100000000000000 | |
389 | 389 | ||
390 | 390 | let MARKETINGSHARE = 100000 | |
391 | 391 | ||
392 | 392 | let TEAMSHARE = 200000 | |
393 | 393 | ||
394 | 394 | let ACTIVITYSHARE = 100000 | |
395 | 395 | ||
396 | 396 | let PLAYERSHARE = 400000 | |
397 | 397 | ||
398 | 398 | let YEARMILLIS = 31557600000 | |
399 | 399 | ||
400 | 400 | let WEEKMILLIS = 604800000 | |
401 | 401 | ||
402 | 402 | let MAXPERIOD = 156 | |
403 | 403 | ||
404 | 404 | let TENMINUTESMILLIS = 600000 | |
405 | 405 | ||
406 | 406 | let A6 = 100000000 | |
407 | 407 | ||
408 | 408 | let B8 = 50000000 | |
409 | 409 | ||
410 | 410 | let wlgAssetIdKey = "wlg_assetId" | |
411 | 411 | ||
412 | 412 | let wlgIssueTimeKey = "wlg_issueTime" | |
413 | 413 | ||
414 | 414 | let wlgIssuedAmountKey = "wlg_issuedAmount" | |
415 | 415 | ||
416 | 416 | let marketingAddrKey = "marketingAddr" | |
417 | 417 | ||
418 | 418 | let teamAddrKey = "teamAddr" | |
419 | 419 | ||
420 | 420 | let lastMarketingTimeKey = "lastClaimedTime_marketing" | |
421 | 421 | ||
422 | 422 | let lastTeamTimeKey = "lastClaimedTime_team" | |
423 | 423 | ||
424 | 424 | let lastActivitiesTimeKey = "lastClaimedTime_activities" | |
425 | 425 | ||
426 | 426 | func keyLastClaimedTimeByUser (addr) = ("lastClaimedTimeUser_" + addr) | |
427 | 427 | ||
428 | 428 | ||
429 | 429 | func keyLastArbTimeByUser (addr) = ("lastArbTimeUser_" + addr) | |
430 | 430 | ||
431 | 431 | ||
432 | 432 | let stakersAmountLeftKey = "stakersAmountLeft" | |
433 | 433 | ||
434 | 434 | let stakersAmountPaidTotalKey = "stakersAmountPaidTotal" | |
435 | 435 | ||
436 | 436 | func keyStakersAmountPaidUser (addr) = ("stakersAmountPaidUser_" + addr) | |
437 | 437 | ||
438 | 438 | ||
439 | 439 | let idxWlgAmount = 0 | |
440 | 440 | ||
441 | 441 | let idxWlgPrice = 1 | |
442 | 442 | ||
443 | 443 | let idxWlgFunds = 2 | |
444 | 444 | ||
445 | 445 | let wlgAssetId = valueOrErrorMessage(getBinary(wlgAssetIdKey), "Not initialized yet") | |
446 | 446 | ||
447 | 447 | func prolog () = if (valueOrElse(getBoolean(stakingContract, keyBlocked()), false)) | |
448 | 448 | then throw("Contracts are under maintenance") | |
449 | 449 | else asInt(invoke(stakingContract, "saveLastTx", nil, nil)) | |
450 | 450 | ||
451 | 451 | ||
452 | 452 | func getWlgStats () = { | |
453 | 453 | let issuedAmount = valueOrErrorMessage(getInteger(wlgIssuedAmountKey), "WLGOLD is not issued yet") | |
454 | 454 | let funds = ((assetBalance(economyContract, usdtAssetId) + assetBalance(restContract, usdtAssetId)) + assetBalance(wlgContract, usdtAssetId)) | |
455 | 455 | [issuedAmount, fraction(funds, MULT8, issuedAmount), funds] | |
456 | 456 | } | |
457 | 457 | ||
458 | 458 | ||
459 | 459 | func getSwapLimit (addr) = { | |
460 | 460 | let lastTime = valueOrElse(getInteger(keyLastArbTimeByUser(addr)), 0) | |
461 | 461 | let now = lastBlock.timestamp | |
462 | 462 | if ((TENMINUTESMILLIS > (now - lastTime))) | |
463 | 463 | then throw("Arbitrages are possible once a 10 minutes") | |
464 | 464 | else { | |
465 | 465 | let pieces = getVotingPower(addr)[IdxEffUser] | |
466 | 466 | let pow8 = pow(pieces, 0, B8, 8, 8, CEILING) | |
467 | 467 | fraction(A6, pow8, MULT8) | |
468 | 468 | } | |
469 | 469 | } | |
470 | 470 | ||
471 | 471 | ||
472 | 472 | @Callable(i) | |
473 | 473 | func constructorV1 (restAddr,marketingAddr,teamAddr) = if ((i.caller != this)) | |
474 | 474 | then throw("Permission denied") | |
475 | 475 | else if (isDefined(getBinary(wlgAssetIdKey))) | |
476 | 476 | then throw("Already initialized") | |
477 | 477 | else { | |
478 | 478 | let issuedAmount = MULT14 | |
479 | 479 | let issue = Issue("WLGOLD", "WavesLands Gold investment token", issuedAmount, 8, true, unit, 0) | |
480 | 480 | let assetId = calculateAssetId(issue) | |
481 | 481 | [issue, IntegerEntry(wlgIssueTimeKey, lastBlock.timestamp), IntegerEntry(wlgIssuedAmountKey, issuedAmount), IntegerEntry(stakersAmountPaidTotalKey, 0), IntegerEntry(stakersAmountLeftKey, fraction(MULT14, PLAYERSHARE, MULT6)), BinaryEntry(wlgAssetIdKey, assetId), StringEntry(keyRestAddress(), restAddr), StringEntry(marketingAddrKey, marketingAddr), StringEntry(teamAddrKey, teamAddr)] | |
482 | 482 | } | |
483 | 483 | ||
484 | 484 | ||
485 | 485 | ||
486 | 486 | @Callable(i) | |
487 | 487 | func buyWlg () = { | |
488 | 488 | let prologResult = prolog() | |
489 | 489 | if ((size(i.payments) != 1)) | |
490 | 490 | then throw("exactly 1 payment must be attached") | |
491 | 491 | else { | |
492 | 492 | let pmt = i.payments[0] | |
493 | 493 | let usdtAmt = pmt.amount | |
494 | 494 | let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WAVES can't be used as payment") | |
495 | 495 | if ((pmtAssetId != usdtAssetId)) | |
496 | 496 | then throw("USDT payments only!") | |
497 | 497 | else { | |
498 | 498 | let caller = i.caller | |
499 | 499 | let addr = toString(caller) | |
500 | 500 | let maxUsdt = getSwapLimit(addr) | |
501 | 501 | if ((usdtAmt > maxUsdt)) | |
502 | 502 | then throw((("You can spend max " + toString(maxUsdt)) + " USDT")) | |
503 | 503 | else { | |
504 | 504 | let curStats = getWlgStats() | |
505 | 505 | let curAmount = curStats[idxWlgAmount] | |
506 | 506 | let buyPrice = fraction(curStats[idxWlgPrice], 6, 5) | |
507 | 507 | let wlgAmount = fraction(usdtAmt, MULT8, buyPrice) | |
508 | 508 | let reissued = fraction(usdtAmt, curAmount, (curStats[idxWlgFunds] - usdtAmt)) | |
509 | 509 | $Tuple2([Reissue(wlgAssetId, reissued, true), IntegerEntry(wlgIssuedAmountKey, (curAmount + reissued)), IntegerEntry(keyLastArbTimeByUser(addr), lastBlock.timestamp), ScriptTransfer(caller, wlgAmount, wlgAssetId)], prologResult) | |
510 | 510 | } | |
511 | 511 | } | |
512 | 512 | } | |
513 | 513 | } | |
514 | 514 | ||
515 | 515 | ||
516 | 516 | ||
517 | 517 | @Callable(i) | |
518 | 518 | func sellWlg () = { | |
519 | 519 | let prologResult = prolog() | |
520 | 520 | if ((size(i.payments) != 1)) | |
521 | 521 | then throw("exactly 1 payment must be attached") | |
522 | 522 | else { | |
523 | 523 | let pmt = i.payments[0] | |
524 | 524 | let wlgAmt = pmt.amount | |
525 | 525 | let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WAVES can't be used as payment") | |
526 | 526 | if ((pmtAssetId != wlgAssetId)) | |
527 | 527 | then throw("WLGOLD payments only!") | |
528 | 528 | else { | |
529 | 529 | let caller = i.caller | |
530 | 530 | let addr = toString(caller) | |
531 | 531 | let maxUsdt = getSwapLimit(addr) | |
532 | 532 | let curStats = getWlgStats() | |
533 | 533 | let curAmount = (curStats[idxWlgAmount] - wlgAmt) | |
534 | - | let curPrice = curStats[idxWlgPrice] | |
535 | - | let sellPrice = (curPrice - (curPrice / 5)) | |
534 | + | let sellPrice = fraction(curStats[idxWlgPrice], 4, 5) | |
536 | 535 | let usdtAmount = fraction(wlgAmt, sellPrice, MULT8) | |
537 | 536 | if ((usdtAmount > maxUsdt)) | |
538 | 537 | then throw((("You can get max " + toString(maxUsdt)) + " USDT")) | |
539 | 538 | else { | |
540 | 539 | let burned = fraction(usdtAmount, curAmount, curStats[idxWlgFunds]) | |
541 | 540 | $Tuple2([Burn(wlgAssetId, burned), IntegerEntry(wlgIssuedAmountKey, (curAmount - burned)), IntegerEntry(keyLastArbTimeByUser(addr), lastBlock.timestamp), ScriptTransfer(caller, usdtAmount, usdtAssetId)], prologResult) | |
542 | 541 | } | |
543 | 542 | } | |
544 | 543 | } | |
545 | 544 | } | |
546 | 545 | ||
547 | 546 | ||
548 | 547 | ||
549 | 548 | @Callable(i) | |
550 | 549 | func claim () = { | |
551 | 550 | let prologResult = prolog() | |
552 | 551 | let caller = i.caller | |
553 | 552 | let callerAddr = toString(caller) | |
554 | 553 | let now = lastBlock.timestamp | |
555 | 554 | let issueTime = valueOrErrorMessage(getInteger(wlgIssueTimeKey), "Not initialized") | |
556 | 555 | let lastMarketingTime = valueOrElse(getInteger(lastMarketingTimeKey), issueTime) | |
557 | 556 | let marketingAddr = addressFromStringValue(value(getString(marketingAddrKey))) | |
558 | 557 | let marketingAmount = fraction(fraction(MULT14, MARKETINGSHARE, MULT6), (now - lastMarketingTime), YEARMILLIS) | |
559 | 558 | let lastTeamTime = valueOrElse(getInteger(lastTeamTimeKey), issueTime) | |
560 | 559 | let teamAddr = addressFromStringValue(value(getString(teamAddrKey))) | |
561 | 560 | let teamAmount = fraction(fraction(MULT14, TEAMSHARE, MULT6), (now - lastTeamTime), (3 * YEARMILLIS)) | |
562 | 561 | let lastActivitiesTime = valueOrElse(getInteger(lastActivitiesTimeKey), issueTime) | |
563 | 562 | let actAmount = fraction(fraction(MULT14, ACTIVITYSHARE, MULT6), (now - lastActivitiesTime), (3 * YEARMILLIS)) | |
564 | 563 | let curPeriod = ((now - issueTime) / WEEKMILLIS) | |
565 | 564 | if ((curPeriod > (MAXPERIOD / 2))) | |
566 | 565 | then throw("Please modify contract for next 1.5 years, according to stats") | |
567 | 566 | else { | |
568 | 567 | let eff = getVotingPower(callerAddr) | |
569 | 568 | let totalPieces = eff[IdxEffTotal] | |
570 | 569 | let amountLeftTotal = valueOrElse(getInteger(stakersAmountLeftKey), 0) | |
571 | 570 | let curPeriodDistribution = fraction(amountLeftTotal, (2 * totalPieces), (totalPieces + (max([100000, totalPieces]) * (MAXPERIOD - curPeriod)))) | |
572 | 571 | let userTimeKey = keyLastClaimedTimeByUser(callerAddr) | |
573 | 572 | let lastUserTime = valueOrElse(getInteger(userTimeKey), issueTime) | |
574 | 573 | let userAmount = fraction(fraction(curPeriodDistribution, eff[IdxEffUser], totalPieces), (now - lastUserTime), (3 * YEARMILLIS)) | |
575 | 574 | let userKey = keyStakersAmountPaidUser(callerAddr) | |
576 | 575 | $Tuple2([ScriptTransfer(marketingAddr, marketingAmount, wlgAssetId), ScriptTransfer(teamAddr, teamAmount, wlgAssetId), ScriptTransfer(restContract, actAmount, wlgAssetId), ScriptTransfer(caller, userAmount, wlgAssetId), IntegerEntry(userKey, (valueOrElse(getInteger(userKey), 0) + userAmount)), IntegerEntry(stakersAmountPaidTotalKey, (valueOrElse(getInteger(stakersAmountPaidTotalKey), 0) + userAmount)), IntegerEntry(stakersAmountLeftKey, (amountLeftTotal - userAmount)), IntegerEntry(lastMarketingTimeKey, now), IntegerEntry(lastTeamTimeKey, now), IntegerEntry(lastActivitiesTimeKey, now), IntegerEntry(userTimeKey, now)], prologResult) | |
577 | 576 | } | |
578 | 577 | } | |
579 | 578 | ||
580 | 579 |
github/deemru/w8io/03bedc9 65.82 ms ◑![]()