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