tx · 2gMXPUhHd9EYANm6KQ5hd9dVFQniBYQFjfNBWHurPhUq 3N7dQeENwSgKPp9Ki4aEHhRWWKVjn1DE9Qg: -0.01300000 Waves 2023.11.19 22:36 [2850697] smart account 3N7dQeENwSgKPp9Ki4aEHhRWWKVjn1DE9Qg > SELF 0.00000000 Waves
{ "type": 13, "id": "2gMXPUhHd9EYANm6KQ5hd9dVFQniBYQFjfNBWHurPhUq", "fee": 1300000, "feeAssetId": null, "timestamp": 1700422634051, "version": 2, "chainId": 84, "sender": "3N7dQeENwSgKPp9Ki4aEHhRWWKVjn1DE9Qg", "senderPublicKey": "5BN6FQeKuMm2XJYToUZvbBX4UELGpE3Z47P4q6sP46PG", "proofs": [ "2QhM2NGpGjGGAaFj7PYWcNjDRs4DjsdsrFjVeU63nYqn3Azh44oxmb4APjLfWNesrL5tJZHjcMExTUPSoSMjbRR9" ], "script": "base64:BgIqCAISBAoCCAESAwoBARIAEgASBAoCCAESBQoDCAEBEgMKAQESABIDCgEINQAITUlMTElPTjYAgIDpg7HeFgAJREFZTUlMTElTAIC4mSkBGmtleUFjcmVzU3Rha2VkQW1vdW50QnlVc2VyAQRhZGRyCQCsAgICGGFjcmVzU3Rha2VkQW1vdW50QnlVc2VyXwUEYWRkcgEaa2V5QWNyZXNMb2NrZWRBbW91bnRCeVVzZXIBBGFkZHIJAKwCAgIYYWNyZXNMb2NrZWRBbW91bnRCeVVzZXJfBQRhZGRyARdrZXlBY3Jlc0xvY2tlZEV0YUJ5VXNlcgEEYWRkcgkArAICAhVhY3Jlc0xvY2tlZEV0YUJ5VXNlcl8FBGFkZHIAE2FjcmVzU3Rha2VkVG90YWxLZXkCFmFjcmVzU3Rha2VkQW1vdW50VG90YWwACnhwTmV3U0xhbmQAwJaxAgAPREFJTFlSRVNCWVBJRUNFAID40gEAFVVTRFQyQUNSRVNfTVVMVElQTElFUgAKAAVjaGFpbgkAyQECCQDKAQIIBQR0aGlzBWJ5dGVzAAEAAQALdXNkdEFzc2V0S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XRpbWVzdGFtcAkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCAUBaQZjYWxsZXIFDGNsYWltZWRBY3JlcwUMYWNyZXNBc3NldElkBQNuaWwJAJQKAgUMcHJvbG9nUmVzdWx0BQl3bGdSZXN1bHQJAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4BaQESY2xhaW1BY3Jlc1JFQURPTkxZAQdhZGRyZXNzBAd0aW1lS2V5CQEYa2V5QWNyZXNTdGFrZWRUaW1lQnlVc2VyAQUHYWRkcmVzcwQJYW1vdW50S2V5CQEaa2V5QWNyZXNTdGFrZWRBbW91bnRCeVVzZXIBBQdhZGRyZXNzBAthY3Jlc0Ftb3VudAkBC3ZhbHVlT3JFbHNlAgkAnwgBBQlhbW91bnRLZXkAAAQIbGFzdFRpbWUJAQt2YWx1ZU9yRWxzZQIJAJ8IAQUHdGltZUtleQAABAxjbGFpbWVkQWNyZXMJARJjbGFpbUFjcmVzSW50ZXJuYWwDBQdhZGRyZXNzBQthY3Jlc0Ftb3VudAUIbGFzdFRpbWUJAJQKAgUDbmlsCQDMCAIFDGNsYWltZWRBY3JlcwkAzAgCBQhsYXN0VGltZQUDbmlsANEFNkY=", "height": 2850697, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FQmE36qNwo3eacM5XEnJRiL3NK8U3FRYCrnBo23SdLbD Next: 37ceU5SKy3UcK963jaVgVEpCz9sWKXnLtqfQug7kvvpv Diff:
Old | New | Differences | |
---|---|---|---|
41 | 41 | then "3MumkGGztCKAXpWDqxkddofqXSUbqQkvSJy" | |
42 | 42 | else throw("Unknown chain") | |
43 | 43 | } | |
44 | + | ||
45 | + | let promo2MapKey = "promo2Map" | |
44 | 46 | ||
45 | 47 | let SEP = "__" | |
46 | 48 | ||
178 | 180 | else throw("Unknown chain") | |
179 | 181 | } | |
180 | 182 | ||
181 | - | let promo2MapKey = "promo2Map" | |
182 | - | ||
183 | 183 | func isBlacklistedPromo1 (addr) = contains(BLACKLISTED1, addr) | |
184 | 184 | ||
185 | 185 | ||
238 | 238 | ||
239 | 239 | ||
240 | 240 | @Callable(i) | |
241 | - | func stakeAcres () = if ((i.caller != this)) | |
242 | - | then throw("Temporarily disabled during promo action") | |
243 | - | else { | |
244 | - | let prologResult = prolog() | |
245 | - | if ((prologResult == prologResult)) | |
246 | - | then { | |
247 | - | let address = toString(i.caller) | |
248 | - | if ((size(i.payments) != 1)) | |
249 | - | then throw("exactly 1 payment must be attached") | |
250 | - | else { | |
251 | - | let pmt = i.payments[0] | |
252 | - | let amt = pmt.amount | |
253 | - | if (if (!(isDefined(pmt.assetId))) | |
254 | - | then true | |
255 | - | else (value(pmt.assetId) != acresAssetId)) | |
256 | - | then throw("ACRES payments only!") | |
257 | - | else { | |
258 | - | let timeKey = keyAcresStakedTimeByUser(address) | |
259 | - | let amountKey = keyAcresStakedAmountByUser(address) | |
260 | - | let oldAcresAmount = valueOrElse(getInteger(amountKey), 0) | |
261 | - | let oldTotal = valueOrElse(getInteger(acresStakedTotalKey), 0) | |
262 | - | let wlgResult = invoke(wlgContract, "onStakeUnstakeLand", [address], nil) | |
263 | - | let claimedAcres = claimInternal(address, oldAcresAmount, valueOrElse(getInteger(timeKey), 0)) | |
264 | - | $Tuple2(((((if ((claimedAcres == 0)) | |
265 | - | then nil | |
266 | - | else [ScriptTransfer(i.caller, claimedAcres, acresAssetId)]) :+ IntegerEntry(timeKey, lastBlock.timestamp)) :+ IntegerEntry(amountKey, (oldAcresAmount + amt))) :+ IntegerEntry(acresStakedTotalKey, (oldTotal + amt))), $Tuple2(prologResult, wlgResult)) | |
267 | - | } | |
268 | - | } | |
269 | - | } | |
270 | - | else throw("Strict value is not equal to itself.") | |
271 | - | } | |
272 | - | ||
273 | - | ||
274 | - | ||
275 | - | @Callable(i) | |
276 | 241 | func unstakeAcres (amount) = { | |
277 | 242 | let prologResult = prolog() | |
278 | 243 | if ((prologResult == prologResult)) | |
314 | 279 | ||
315 | 280 | ||
316 | 281 | @Callable(i) | |
317 | - | func | |
282 | + | func stakeAcres () = { | |
318 | 283 | let prologResult = prolog() | |
319 | 284 | if ((prologResult == prologResult)) | |
320 | 285 | then { | |
328 | 293 | then true | |
329 | 294 | else (value(pmt.assetId) != acresAssetId)) | |
330 | 295 | then throw("ACRES payments only!") | |
331 | - | else if ((MIN_ACRES_AMOUNT_DURING_PROMO > amt)) | |
332 | - | then throw((("Min staked amount during promo action should be at least " + fixedPoint(MIN_ACRES_AMOUNT_DURING_PROMO, 8)) + " ACRES")) | |
333 | - | else { | |
334 | - | let now = lastBlock.timestamp | |
335 | - | if ((PROMO_2_START_TIMESTAMP > now)) | |
336 | - | then throw("Promo2 is not started yet") | |
337 | - | else if ((now > PROMO_2_END_TIMESTAMP)) | |
338 | - | then throw("Promo2 is already finished") | |
339 | - | else { | |
340 | - | let wlgResult = invoke(wlgContract, "onStakeUnstakeLand", [address], nil) | |
341 | - | if ((wlgResult == wlgResult)) | |
342 | - | then { | |
343 | - | let stakeResult = invoke(this, "sendLockedAcres", [address, amt, 30], nil) | |
344 | - | let promo2Map = valueOrElse(getString(promo2MapKey), "") | |
345 | - | let newMap2 = if (contains(promo2Map, address)) | |
346 | - | then { | |
347 | - | let parts = split_51C(promo2Map, address) | |
348 | - | let oldAmount = parseIntValue(take(drop(parts[1], 1), 14)) | |
349 | - | ((((parts[0] + address) + ":") + padL((oldAmount + amt), 14)) + drop(parts[1], 15)) | |
350 | - | } | |
351 | - | else { | |
352 | - | let finalPart = ((address + ":") + padL(amt, 14)) | |
353 | - | if ((promo2Map == "")) | |
354 | - | then finalPart | |
355 | - | else ((promo2Map + "_") + finalPart) | |
356 | - | } | |
357 | - | $Tuple2([StringEntry(promo2MapKey, newMap2)], $Tuple3(prologResult, wlgResult, stakeResult)) | |
358 | - | } | |
359 | - | else throw("Strict value is not equal to itself.") | |
296 | + | else { | |
297 | + | let wlgResult = invoke(wlgContract, "onStakeUnstakeLand", [address], nil) | |
298 | + | if ((wlgResult == wlgResult)) | |
299 | + | then { | |
300 | + | let now = lastBlock.timestamp | |
301 | + | if (if ((PROMO_2_START_TIMESTAMP > now)) | |
302 | + | then true | |
303 | + | else (now > PROMO_2_END_TIMESTAMP)) | |
304 | + | then { | |
305 | + | let timeKey = keyAcresStakedTimeByUser(address) | |
306 | + | let amountKey = keyAcresStakedAmountByUser(address) | |
307 | + | let oldAcresAmount = valueOrElse(getInteger(amountKey), 0) | |
308 | + | let oldTotal = valueOrElse(getInteger(acresStakedTotalKey), 0) | |
309 | + | let claimedAcres = claimInternal(address, oldAcresAmount, valueOrElse(getInteger(timeKey), 0)) | |
310 | + | $Tuple2(((((if ((claimedAcres == 0)) | |
311 | + | then nil | |
312 | + | else [ScriptTransfer(i.caller, claimedAcres, acresAssetId)]) :+ IntegerEntry(timeKey, lastBlock.timestamp)) :+ IntegerEntry(amountKey, (oldAcresAmount + amt))) :+ IntegerEntry(acresStakedTotalKey, (oldTotal + amt))), $Tuple2(prologResult, wlgResult)) | |
360 | 313 | } | |
361 | - | } | |
314 | + | else if ((MIN_ACRES_AMOUNT_DURING_PROMO > amt)) | |
315 | + | then throw((("Min staked amount during promo action should be at least " + fixedPoint(MIN_ACRES_AMOUNT_DURING_PROMO, 8)) + " ACRES")) | |
316 | + | else { | |
317 | + | let stakeResult = invoke(this, "sendLockedAcres", [address, amt, 30], nil) | |
318 | + | let promo2Map = valueOrElse(getString(promo2MapKey), "") | |
319 | + | let newMap2 = if (contains(promo2Map, address)) | |
320 | + | then { | |
321 | + | let parts = split_51C(promo2Map, address) | |
322 | + | let oldAmount = parseIntValue(take(drop(parts[1], 1), 14)) | |
323 | + | ((((parts[0] + address) + ":") + padL((oldAmount + amt), 14)) + drop(parts[1], 15)) | |
324 | + | } | |
325 | + | else { | |
326 | + | let finalPart = ((address + ":") + padL(amt, 14)) | |
327 | + | if ((promo2Map == "")) | |
328 | + | then finalPart | |
329 | + | else ((promo2Map + "_") + finalPart) | |
330 | + | } | |
331 | + | $Tuple2([StringEntry(promo2MapKey, newMap2)], $Tuple3(prologResult, wlgResult, stakeResult)) | |
332 | + | } | |
333 | + | } | |
334 | + | else throw("Strict value is not equal to itself.") | |
335 | + | } | |
362 | 336 | } | |
363 | 337 | } | |
364 | 338 | else throw("Strict value is not equal to itself.") |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let MILLION6 = 100000000000000 | |
5 | 5 | ||
6 | 6 | let DAYMILLIS = 86400000 | |
7 | 7 | ||
8 | 8 | func keyAcresStakedAmountByUser (addr) = ("acresStakedAmountByUser_" + addr) | |
9 | 9 | ||
10 | 10 | ||
11 | 11 | func keyAcresLockedAmountByUser (addr) = ("acresLockedAmountByUser_" + addr) | |
12 | 12 | ||
13 | 13 | ||
14 | 14 | func keyAcresLockedEtaByUser (addr) = ("acresLockedEtaByUser_" + addr) | |
15 | 15 | ||
16 | 16 | ||
17 | 17 | let acresStakedTotalKey = "acresStakedAmountTotal" | |
18 | 18 | ||
19 | 19 | let xpNewSLand = 5000000 | |
20 | 20 | ||
21 | 21 | let DAILYRESBYPIECE = 3456000 | |
22 | 22 | ||
23 | 23 | let USDT2ACRES_MULTIPLIER = 10 | |
24 | 24 | ||
25 | 25 | let chain = take(drop(this.bytes, 1), 1) | |
26 | 26 | ||
27 | 27 | let usdtAssetId = match chain { | |
28 | 28 | case _ => | |
29 | 29 | if ((base58'2W' == $match0)) | |
30 | 30 | then base58'9wc3LXNA4TEBsXyKtoLE9mrbDD7WMHXvXrCjZvabLAsi' | |
31 | 31 | else if ((base58'2T' == $match0)) | |
32 | 32 | then base58'6mWwf9mZBjVgkC54idpyaZLQfAosD914wT8fGf2iiY63' | |
33 | 33 | else throw("Unknown chain") | |
34 | 34 | } | |
35 | 35 | ||
36 | 36 | let defaultRestAddressStr = match chain { | |
37 | 37 | case _ => | |
38 | 38 | if ((base58'2W' == $match0)) | |
39 | 39 | then "3PQCuvFbvh4LkPUnrnU1z3jnbA1p9m3WNhv" | |
40 | 40 | else if ((base58'2T' == $match0)) | |
41 | 41 | then "3MumkGGztCKAXpWDqxkddofqXSUbqQkvSJy" | |
42 | 42 | else throw("Unknown chain") | |
43 | 43 | } | |
44 | + | ||
45 | + | let promo2MapKey = "promo2Map" | |
44 | 46 | ||
45 | 47 | let SEP = "__" | |
46 | 48 | ||
47 | 49 | let MULT6 = 1000000 | |
48 | 50 | ||
49 | 51 | let MULT8 = 100000000 | |
50 | 52 | ||
51 | 53 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
52 | 54 | ||
53 | 55 | ||
54 | 56 | let IdxCfgStakingDapp = 1 | |
55 | 57 | ||
56 | 58 | let IdxCfgEconomyDapp = 2 | |
57 | 59 | ||
58 | 60 | let IdxCfgWlgDapp = 4 | |
59 | 61 | ||
60 | 62 | let IdxCfgAcresDapp = 8 | |
61 | 63 | ||
62 | 64 | func keyRestCfg () = "%s__restConfig" | |
63 | 65 | ||
64 | 66 | ||
65 | 67 | func keyRestAddress () = "%s__restAddr" | |
66 | 68 | ||
67 | 69 | ||
68 | 70 | func readRestCfgOrFail (rest) = split_4C(getStringOrFail(rest, keyRestCfg()), SEP) | |
69 | 71 | ||
70 | 72 | ||
71 | 73 | func getContractAddressOrFail (restCfg,idx) = valueOrErrorMessage(addressFromString(restCfg[idx]), ("Rest cfg doesn't contain address at index " + toString(idx))) | |
72 | 74 | ||
73 | 75 | ||
74 | 76 | let restContract = addressFromStringValue(valueOrElse(getString(this, keyRestAddress()), defaultRestAddressStr)) | |
75 | 77 | ||
76 | 78 | let restCfg = readRestCfgOrFail(restContract) | |
77 | 79 | ||
78 | 80 | let stakingContract = getContractAddressOrFail(restCfg, IdxCfgStakingDapp) | |
79 | 81 | ||
80 | 82 | let economyContract = getContractAddressOrFail(restCfg, IdxCfgEconomyDapp) | |
81 | 83 | ||
82 | 84 | let wlgContract = getContractAddressOrFail(restCfg, IdxCfgWlgDapp) | |
83 | 85 | ||
84 | 86 | let acresContract = getContractAddressOrFail(restCfg, IdxCfgAcresDapp) | |
85 | 87 | ||
86 | 88 | let acresIssuedAmountKey = "acresIssuedAmount" | |
87 | 89 | ||
88 | 90 | let acresAssetIdKey = "acresAssetId" | |
89 | 91 | ||
90 | 92 | let acresAssetId = valueOrErrorMessage(getBinary(acresContract, acresAssetIdKey), "ACRES is not issued yet") | |
91 | 93 | ||
92 | 94 | func keyAcresStakedTimeByUser (addr) = ("acresStakedTimeByUser_" + addr) | |
93 | 95 | ||
94 | 96 | ||
95 | 97 | let IdxEffTotal = 0 | |
96 | 98 | ||
97 | 99 | func keyResProportions () = "resTypesProportions" | |
98 | 100 | ||
99 | 101 | ||
100 | 102 | func keyStakedPiecesByOwner (ownerAddr) = ("stakedPiecesByOwner_" + ownerAddr) | |
101 | 103 | ||
102 | 104 | ||
103 | 105 | func asInt (v) = match v { | |
104 | 106 | case n: Int => | |
105 | 107 | n | |
106 | 108 | case _ => | |
107 | 109 | throw("fail to cast into Int") | |
108 | 110 | } | |
109 | 111 | ||
110 | 112 | ||
111 | 113 | func asTwoIntsTuple (val) = match val { | |
112 | 114 | case t2: (Int, Int) => | |
113 | 115 | t2 | |
114 | 116 | case _ => | |
115 | 117 | throw("fail to cast into (Int, Int)") | |
116 | 118 | } | |
117 | 119 | ||
118 | 120 | ||
119 | 121 | func getVotingPower (userAddrStrOrEmpty) = { | |
120 | 122 | let props = split(valueOrElse(getString(stakingContract, keyResProportions()), "0_0_0_0_0_0"), "_") | |
121 | 123 | func adder (acc,item) = (acc + parseIntValue(item)) | |
122 | 124 | ||
123 | 125 | let totalPower = { | |
124 | 126 | let $l = props | |
125 | 127 | let $s = size($l) | |
126 | 128 | let $acc0 = 0 | |
127 | 129 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
128 | 130 | then $a | |
129 | 131 | else adder($a, $l[$i]) | |
130 | 132 | ||
131 | 133 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
132 | 134 | then $a | |
133 | 135 | else throw("List size exceeds 6") | |
134 | 136 | ||
135 | 137 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
136 | 138 | } | |
137 | 139 | let usersPower = valueOrElse(getInteger(stakingContract, keyStakedPiecesByOwner(userAddrStrOrEmpty)), 0) | |
138 | 140 | [totalPower, usersPower] | |
139 | 141 | } | |
140 | 142 | ||
141 | 143 | ||
142 | 144 | func fixedPoint (val,decimals) = { | |
143 | 145 | let tenPow = pow(10, 0, decimals, 0, 0, DOWN) | |
144 | 146 | let lowPart = toString((val % tenPow)) | |
145 | 147 | let zeroes = drop(toString(tenPow), (1 + size(lowPart))) | |
146 | 148 | (((toString((val / tenPow)) + ".") + zeroes) + lowPart) | |
147 | 149 | } | |
148 | 150 | ||
149 | 151 | ||
150 | 152 | func padL (val,len) = { | |
151 | 153 | let valS = toString(val) | |
152 | 154 | let zeroes = drop(toString(pow(10, 0, (len - size(valS)), 0, 0, DOWN)), 1) | |
153 | 155 | (zeroes + valS) | |
154 | 156 | } | |
155 | 157 | ||
156 | 158 | ||
157 | 159 | let MIN_ACRES_AMOUNT_DURING_PROMO = 10000000 | |
158 | 160 | ||
159 | 161 | let BLACKLISTED1 = "3P2NGX4Q5nge1MCauwQW5aqYLdkccSGj1Ep_3P2xFAHW9yhyNohYozWd4HFhEXZu3bsNSoR_3P2yKaZ2gvn9Xe5tti81a7P9LZhHgjvToV9_3P37zQ3cf2ecu55RmJqEiGSivdzN9avt3m9_3P4az6dtzsvGCWFAxa94UdevKzXyEwxEiFG_3P4kZU6X3TTLFcSUe55JSy8BySqitcPgMBz_3P5hCxBEh3NgNizZhNBreyBSqtbhJYLkKPD_3P7HLvucy11yxyMJUwjzXFHHKMEDwi1EwfC_3P8JuaqH9PTQAv8D5HBGgQfKauLTYt2NQft_3P9gTDB4rtDEVbpX3asU63H4Zinh2EnTmZE_3P9iN3qrtfJicUVy7amZeVsetVD3vUMk8be_3PCa2BsAa6JBLirszQfV5r9fJrujfhwtwfP_3PD3i4XN8KtygcFx4ry5M7UGqdfH8VYvtRT_3PDEMnnJNc2kx9cPEmvVvhXUr8SvhANKhsa_3PDGE9tKQizaeZFeDDq5aYSv89nwYbfirpZ_3PDMKQTCrUPZECVXEJJ8m1sHtutSu1naSf1_3PGh2Qu6Yvx8GTCRRVNvBUVZLdaidYSaxo5_3PKkmAtbSK5D2hQdo1RfEg8eXyMbDcRUc92_3PLMnbxzssP8W8E8XjJ1RLBBg8UZL8Cz3P2_3PMuxo4PCAox9s4a7R1eszh4iqqu8gS7jHv_3PNrMtEQChw87WZU1JAJ7aGHykCa8TjnDNK_3PPuBXfWoBy3EEory7c7vgi9Usjka7o5tBj_3PQwyeyEhT4Y6aGAL6tg73aQWJtV1zRt3nR_3PRGDShuMGb84MJtTJvtTg8qDfswkYWcm3e" | |
160 | 162 | ||
161 | 163 | let PROMO1_AMOUNT = 4970178 | |
162 | 164 | ||
163 | 165 | let PROMO_2_START_TIMESTAMP = match chain { | |
164 | 166 | case _ => | |
165 | 167 | if ((base58'2W' == $match0)) | |
166 | 168 | then 1700524800000 | |
167 | 169 | else if ((base58'2T' == $match0)) | |
168 | 170 | then 1700420400000 | |
169 | 171 | else throw("Unknown chain") | |
170 | 172 | } | |
171 | 173 | ||
172 | 174 | let PROMO_2_END_TIMESTAMP = match chain { | |
173 | 175 | case _ => | |
174 | 176 | if ((base58'2W' == $match0)) | |
175 | 177 | then 1701043199999 | |
176 | 178 | else if ((base58'2T' == $match0)) | |
177 | 179 | then 1700496000000 | |
178 | 180 | else throw("Unknown chain") | |
179 | 181 | } | |
180 | 182 | ||
181 | - | let promo2MapKey = "promo2Map" | |
182 | - | ||
183 | 183 | func isBlacklistedPromo1 (addr) = contains(BLACKLISTED1, addr) | |
184 | 184 | ||
185 | 185 | ||
186 | 186 | func prolog () = asInt(reentrantInvoke(stakingContract, "saveLastTx", nil, nil)) | |
187 | 187 | ||
188 | 188 | ||
189 | 189 | func claimAcresInternal (addr,acresAmount,lastClaimTime) = { | |
190 | 190 | let deltaTime = (lastBlock.timestamp - lastClaimTime) | |
191 | 191 | let availRes = fraction(deltaTime, (DAILYRESBYPIECE * acresAmount), (DAYMILLIS * MULT8)) | |
192 | 192 | let canGetUsdt = asInt(invoke(economyContract, "sellResourcesWorldREADONLY", [availRes], nil)) | |
193 | 193 | let gotUsdt = max([0, canGetUsdt]) | |
194 | 194 | (gotUsdt * USDT2ACRES_MULTIPLIER) | |
195 | 195 | } | |
196 | 196 | ||
197 | 197 | ||
198 | 198 | func claimInternal (addr,acresAmount,lastClaimTime) = { | |
199 | 199 | let deltaTime = (lastBlock.timestamp - lastClaimTime) | |
200 | 200 | if ((0 > deltaTime)) | |
201 | 201 | then throw(((("Saved timestamp is in future, saved = " + toString(lastClaimTime)) + ", current = ") + toString(lastBlock.timestamp))) | |
202 | 202 | else { | |
203 | 203 | let availRes = fraction(deltaTime, (DAILYRESBYPIECE * acresAmount), (DAYMILLIS * MULT8)) | |
204 | 204 | let canGetUsdt = asInt(invoke(economyContract, "sellResourcesWorldREADONLY", [availRes], nil)) | |
205 | 205 | let gotUsdt = if ((0 >= canGetUsdt)) | |
206 | 206 | then 0 | |
207 | 207 | else asTwoIntsTuple(invoke(economyContract, "sellResourcesWorld", [addr, availRes], nil))._1 | |
208 | 208 | (gotUsdt * USDT2ACRES_MULTIPLIER) | |
209 | 209 | } | |
210 | 210 | } | |
211 | 211 | ||
212 | 212 | ||
213 | 213 | func mergeLocked (oldAmount,oldETA,newAmount,newETA) = { | |
214 | 214 | let now = lastBlock.timestamp | |
215 | 215 | let dt1 = max([0, (oldETA - now)]) | |
216 | 216 | let dt2 = max([0, (newETA - now)]) | |
217 | 217 | let sum = (oldAmount + newAmount) | |
218 | 218 | let dt = if ((sum == 0)) | |
219 | 219 | then 0 | |
220 | 220 | else (fraction(dt1, oldAmount, sum) + fraction(dt2, newAmount, sum)) | |
221 | 221 | (now + dt) | |
222 | 222 | } | |
223 | 223 | ||
224 | 224 | ||
225 | 225 | @Callable(i) | |
226 | 226 | func constructorV1 (restAddr,unstakedPieces) = if ((i.caller != this)) | |
227 | 227 | then throw("Permission denied") | |
228 | 228 | else if (isDefined(getBinary(acresAssetIdKey))) | |
229 | 229 | then throw("Already initialized") | |
230 | 230 | else { | |
231 | 231 | let nftAcres = (getVotingPower("")[IdxEffTotal] + unstakedPieces) | |
232 | 232 | let issuedAmount = (MILLION6 - (nftAcres * MULT8)) | |
233 | 233 | let issue = Issue("ACRES", "WavesLands land acres investment token", issuedAmount, 8, false, unit, 0) | |
234 | 234 | let assetId = calculateAssetId(issue) | |
235 | 235 | [issue, IntegerEntry(acresIssuedAmountKey, issuedAmount), BinaryEntry(acresAssetIdKey, assetId), StringEntry(keyRestAddress(), restAddr)] | |
236 | 236 | } | |
237 | 237 | ||
238 | 238 | ||
239 | 239 | ||
240 | 240 | @Callable(i) | |
241 | - | func stakeAcres () = if ((i.caller != this)) | |
242 | - | then throw("Temporarily disabled during promo action") | |
243 | - | else { | |
244 | - | let prologResult = prolog() | |
245 | - | if ((prologResult == prologResult)) | |
246 | - | then { | |
247 | - | let address = toString(i.caller) | |
248 | - | if ((size(i.payments) != 1)) | |
249 | - | then throw("exactly 1 payment must be attached") | |
250 | - | else { | |
251 | - | let pmt = i.payments[0] | |
252 | - | let amt = pmt.amount | |
253 | - | if (if (!(isDefined(pmt.assetId))) | |
254 | - | then true | |
255 | - | else (value(pmt.assetId) != acresAssetId)) | |
256 | - | then throw("ACRES payments only!") | |
257 | - | else { | |
258 | - | let timeKey = keyAcresStakedTimeByUser(address) | |
259 | - | let amountKey = keyAcresStakedAmountByUser(address) | |
260 | - | let oldAcresAmount = valueOrElse(getInteger(amountKey), 0) | |
261 | - | let oldTotal = valueOrElse(getInteger(acresStakedTotalKey), 0) | |
262 | - | let wlgResult = invoke(wlgContract, "onStakeUnstakeLand", [address], nil) | |
263 | - | let claimedAcres = claimInternal(address, oldAcresAmount, valueOrElse(getInteger(timeKey), 0)) | |
264 | - | $Tuple2(((((if ((claimedAcres == 0)) | |
265 | - | then nil | |
266 | - | else [ScriptTransfer(i.caller, claimedAcres, acresAssetId)]) :+ IntegerEntry(timeKey, lastBlock.timestamp)) :+ IntegerEntry(amountKey, (oldAcresAmount + amt))) :+ IntegerEntry(acresStakedTotalKey, (oldTotal + amt))), $Tuple2(prologResult, wlgResult)) | |
267 | - | } | |
268 | - | } | |
269 | - | } | |
270 | - | else throw("Strict value is not equal to itself.") | |
271 | - | } | |
272 | - | ||
273 | - | ||
274 | - | ||
275 | - | @Callable(i) | |
276 | 241 | func unstakeAcres (amount) = { | |
277 | 242 | let prologResult = prolog() | |
278 | 243 | if ((prologResult == prologResult)) | |
279 | 244 | then if ((0 >= amount)) | |
280 | 245 | then throw("Amount should be positive") | |
281 | 246 | else { | |
282 | 247 | let address = toString(i.caller) | |
283 | 248 | if ((size(i.payments) != 0)) | |
284 | 249 | then throw("No payments required") | |
285 | 250 | else { | |
286 | 251 | let timeKey = keyAcresStakedTimeByUser(address) | |
287 | 252 | let amountKey = keyAcresStakedAmountByUser(address) | |
288 | 253 | let oldAcresAmount = valueOrElse(getInteger(amountKey), 0) | |
289 | 254 | if ((amount > oldAcresAmount)) | |
290 | 255 | then throw(((("You have only " + fixedPoint(oldAcresAmount, 8)) + " ACRES staked, tried to unstake ") + fixedPoint(amount, 8))) | |
291 | 256 | else { | |
292 | 257 | let lockedAmount = valueOrElse(getInteger(keyAcresLockedAmountByUser(address)), 0) | |
293 | 258 | let lockedETA = valueOrElse(getInteger(keyAcresLockedEtaByUser(address)), 0) | |
294 | 259 | let now = lastBlock.timestamp | |
295 | 260 | let unstakableAmount = if (isBlacklistedPromo1(address)) | |
296 | 261 | then ((oldAcresAmount - lockedAmount) - PROMO1_AMOUNT) | |
297 | 262 | else (oldAcresAmount - lockedAmount) | |
298 | 263 | if (if ((lockedETA > now)) | |
299 | 264 | then (amount > unstakableAmount) | |
300 | 265 | else false) | |
301 | 266 | then throw(((("Only " + fixedPoint(unstakableAmount, 8)) + " ACRES can be unstaked now, wait until ") + toString(lockedETA))) | |
302 | 267 | else { | |
303 | 268 | let oldTotal = valueOrElse(getInteger(acresStakedTotalKey), 0) | |
304 | 269 | let wlgResult = invoke(wlgContract, "onStakeUnstakeLand", [address], nil) | |
305 | 270 | let claimedAcres = claimInternal(address, oldAcresAmount, valueOrElse(getInteger(timeKey), 0)) | |
306 | 271 | $Tuple2([IntegerEntry(timeKey, lastBlock.timestamp), IntegerEntry(amountKey, (oldAcresAmount - amount)), IntegerEntry(acresStakedTotalKey, (oldTotal - amount)), ScriptTransfer(i.caller, (amount + claimedAcres), acresAssetId)], $Tuple2(prologResult, wlgResult)) | |
307 | 272 | } | |
308 | 273 | } | |
309 | 274 | } | |
310 | 275 | } | |
311 | 276 | else throw("Strict value is not equal to itself.") | |
312 | 277 | } | |
313 | 278 | ||
314 | 279 | ||
315 | 280 | ||
316 | 281 | @Callable(i) | |
317 | - | func | |
282 | + | func stakeAcres () = { | |
318 | 283 | let prologResult = prolog() | |
319 | 284 | if ((prologResult == prologResult)) | |
320 | 285 | then { | |
321 | 286 | let address = toString(i.caller) | |
322 | 287 | if ((size(i.payments) != 1)) | |
323 | 288 | then throw("exactly 1 payment must be attached") | |
324 | 289 | else { | |
325 | 290 | let pmt = i.payments[0] | |
326 | 291 | let amt = pmt.amount | |
327 | 292 | if (if (!(isDefined(pmt.assetId))) | |
328 | 293 | then true | |
329 | 294 | else (value(pmt.assetId) != acresAssetId)) | |
330 | 295 | then throw("ACRES payments only!") | |
331 | - | else if ((MIN_ACRES_AMOUNT_DURING_PROMO > amt)) | |
332 | - | then throw((("Min staked amount during promo action should be at least " + fixedPoint(MIN_ACRES_AMOUNT_DURING_PROMO, 8)) + " ACRES")) | |
333 | - | else { | |
334 | - | let now = lastBlock.timestamp | |
335 | - | if ((PROMO_2_START_TIMESTAMP > now)) | |
336 | - | then throw("Promo2 is not started yet") | |
337 | - | else if ((now > PROMO_2_END_TIMESTAMP)) | |
338 | - | then throw("Promo2 is already finished") | |
339 | - | else { | |
340 | - | let wlgResult = invoke(wlgContract, "onStakeUnstakeLand", [address], nil) | |
341 | - | if ((wlgResult == wlgResult)) | |
342 | - | then { | |
343 | - | let stakeResult = invoke(this, "sendLockedAcres", [address, amt, 30], nil) | |
344 | - | let promo2Map = valueOrElse(getString(promo2MapKey), "") | |
345 | - | let newMap2 = if (contains(promo2Map, address)) | |
346 | - | then { | |
347 | - | let parts = split_51C(promo2Map, address) | |
348 | - | let oldAmount = parseIntValue(take(drop(parts[1], 1), 14)) | |
349 | - | ((((parts[0] + address) + ":") + padL((oldAmount + amt), 14)) + drop(parts[1], 15)) | |
350 | - | } | |
351 | - | else { | |
352 | - | let finalPart = ((address + ":") + padL(amt, 14)) | |
353 | - | if ((promo2Map == "")) | |
354 | - | then finalPart | |
355 | - | else ((promo2Map + "_") + finalPart) | |
356 | - | } | |
357 | - | $Tuple2([StringEntry(promo2MapKey, newMap2)], $Tuple3(prologResult, wlgResult, stakeResult)) | |
358 | - | } | |
359 | - | else throw("Strict value is not equal to itself.") | |
296 | + | else { | |
297 | + | let wlgResult = invoke(wlgContract, "onStakeUnstakeLand", [address], nil) | |
298 | + | if ((wlgResult == wlgResult)) | |
299 | + | then { | |
300 | + | let now = lastBlock.timestamp | |
301 | + | if (if ((PROMO_2_START_TIMESTAMP > now)) | |
302 | + | then true | |
303 | + | else (now > PROMO_2_END_TIMESTAMP)) | |
304 | + | then { | |
305 | + | let timeKey = keyAcresStakedTimeByUser(address) | |
306 | + | let amountKey = keyAcresStakedAmountByUser(address) | |
307 | + | let oldAcresAmount = valueOrElse(getInteger(amountKey), 0) | |
308 | + | let oldTotal = valueOrElse(getInteger(acresStakedTotalKey), 0) | |
309 | + | let claimedAcres = claimInternal(address, oldAcresAmount, valueOrElse(getInteger(timeKey), 0)) | |
310 | + | $Tuple2(((((if ((claimedAcres == 0)) | |
311 | + | then nil | |
312 | + | else [ScriptTransfer(i.caller, claimedAcres, acresAssetId)]) :+ IntegerEntry(timeKey, lastBlock.timestamp)) :+ IntegerEntry(amountKey, (oldAcresAmount + amt))) :+ IntegerEntry(acresStakedTotalKey, (oldTotal + amt))), $Tuple2(prologResult, wlgResult)) | |
360 | 313 | } | |
361 | - | } | |
314 | + | else if ((MIN_ACRES_AMOUNT_DURING_PROMO > amt)) | |
315 | + | then throw((("Min staked amount during promo action should be at least " + fixedPoint(MIN_ACRES_AMOUNT_DURING_PROMO, 8)) + " ACRES")) | |
316 | + | else { | |
317 | + | let stakeResult = invoke(this, "sendLockedAcres", [address, amt, 30], nil) | |
318 | + | let promo2Map = valueOrElse(getString(promo2MapKey), "") | |
319 | + | let newMap2 = if (contains(promo2Map, address)) | |
320 | + | then { | |
321 | + | let parts = split_51C(promo2Map, address) | |
322 | + | let oldAmount = parseIntValue(take(drop(parts[1], 1), 14)) | |
323 | + | ((((parts[0] + address) + ":") + padL((oldAmount + amt), 14)) + drop(parts[1], 15)) | |
324 | + | } | |
325 | + | else { | |
326 | + | let finalPart = ((address + ":") + padL(amt, 14)) | |
327 | + | if ((promo2Map == "")) | |
328 | + | then finalPart | |
329 | + | else ((promo2Map + "_") + finalPart) | |
330 | + | } | |
331 | + | $Tuple2([StringEntry(promo2MapKey, newMap2)], $Tuple3(prologResult, wlgResult, stakeResult)) | |
332 | + | } | |
333 | + | } | |
334 | + | else throw("Strict value is not equal to itself.") | |
335 | + | } | |
362 | 336 | } | |
363 | 337 | } | |
364 | 338 | else throw("Strict value is not equal to itself.") | |
365 | 339 | } | |
366 | 340 | ||
367 | 341 | ||
368 | 342 | ||
369 | 343 | @Callable(i) | |
370 | 344 | func buyAcres () = { | |
371 | 345 | let prologResult = prolog() | |
372 | 346 | if ((prologResult == prologResult)) | |
373 | 347 | then { | |
374 | 348 | let address = toString(i.caller) | |
375 | 349 | if ((size(i.payments) != 1)) | |
376 | 350 | then throw("exactly 1 payment must be attached") | |
377 | 351 | else { | |
378 | 352 | let pmt = i.payments[0] | |
379 | 353 | let amt = pmt.amount | |
380 | 354 | if (if (!(isDefined(pmt.assetId))) | |
381 | 355 | then true | |
382 | 356 | else (value(pmt.assetId) != usdtAssetId)) | |
383 | 357 | then throw("USDT payments only!") | |
384 | 358 | else if ((MULT6 > amt)) | |
385 | 359 | then throw((("Min payment should be " + fixedPoint(MULT6, 6)) + " USDT")) | |
386 | 360 | else { | |
387 | 361 | let acresAmount = (amt * USDT2ACRES_MULTIPLIER) | |
388 | 362 | let accStatsResult = asInt(invoke(stakingContract, "updateAccStats", [address, fraction(xpNewSLand, acresAmount, (25 * MULT8))], nil)) | |
389 | 363 | $Tuple2([ScriptTransfer(economyContract, amt, usdtAssetId), ScriptTransfer(i.caller, acresAmount, acresAssetId)], $Tuple2(prologResult, accStatsResult)) | |
390 | 364 | } | |
391 | 365 | } | |
392 | 366 | } | |
393 | 367 | else throw("Strict value is not equal to itself.") | |
394 | 368 | } | |
395 | 369 | ||
396 | 370 | ||
397 | 371 | ||
398 | 372 | @Callable(i) | |
399 | 373 | func sendAcres (addr,amount) = if ((i.caller != economyContract)) | |
400 | 374 | then throw("Permission denied") | |
401 | 375 | else $Tuple2([ScriptTransfer(addressFromStringValue(addr), amount, acresAssetId)], amount) | |
402 | 376 | ||
403 | 377 | ||
404 | 378 | ||
405 | 379 | @Callable(i) | |
406 | 380 | func sendLockedAcres (addr,amount,lockDays) = if (if ((i.caller != this)) | |
407 | 381 | then (i.caller != restContract) | |
408 | 382 | else false) | |
409 | 383 | then throw("Permission denied") | |
410 | 384 | else { | |
411 | 385 | let now = lastBlock.timestamp | |
412 | 386 | let timeKey = keyAcresStakedTimeByUser(addr) | |
413 | 387 | let amountKey = keyAcresStakedAmountByUser(addr) | |
414 | 388 | let oldAcresAmount = valueOrElse(getInteger(amountKey), 0) | |
415 | 389 | let oldTotal = valueOrElse(getInteger(acresStakedTotalKey), 0) | |
416 | 390 | let oldTime = valueOrElse(getInteger(timeKey), now) | |
417 | 391 | let etaKey = keyAcresLockedEtaByUser(addr) | |
418 | 392 | let lockedAmountKey = keyAcresLockedAmountByUser(addr) | |
419 | 393 | let oldLockedAmount = valueOrElse(getInteger(lockedAmountKey), 0) | |
420 | 394 | let oldLockedETA = valueOrElse(getInteger(etaKey), 0) | |
421 | 395 | let mergedETA = mergeLocked(oldLockedAmount, oldLockedETA, amount, (now + (lockDays * DAYMILLIS))) | |
422 | 396 | $Tuple2([IntegerEntry(timeKey, oldTime), IntegerEntry(amountKey, (oldAcresAmount + amount)), IntegerEntry(acresStakedTotalKey, (oldTotal + amount)), IntegerEntry(etaKey, mergedETA), IntegerEntry(lockedAmountKey, (oldLockedAmount + amount))], amount) | |
423 | 397 | } | |
424 | 398 | ||
425 | 399 | ||
426 | 400 | ||
427 | 401 | @Callable(i) | |
428 | 402 | func burnAcres (amount) = if ((i.caller != stakingContract)) | |
429 | 403 | then throw("Permission denied") | |
430 | 404 | else { | |
431 | 405 | let amountLeft = (valueOrElse(getInteger(acresIssuedAmountKey), 0) - amount) | |
432 | 406 | if ((0 > amountLeft)) | |
433 | 407 | then throw("Attempt to burn more ACRES, than exists") | |
434 | 408 | else $Tuple2([Burn(acresAssetId, amount), IntegerEntry(acresIssuedAmountKey, amountLeft)], amount) | |
435 | 409 | } | |
436 | 410 | ||
437 | 411 | ||
438 | 412 | ||
439 | 413 | @Callable(i) | |
440 | 414 | func claimAcres () = { | |
441 | 415 | let prologResult = prolog() | |
442 | 416 | if ((prologResult == prologResult)) | |
443 | 417 | then { | |
444 | 418 | let address = toString(i.caller) | |
445 | 419 | if ((size(i.payments) != 0)) | |
446 | 420 | then throw("No payments required") | |
447 | 421 | else { | |
448 | 422 | let timeKey = keyAcresStakedTimeByUser(address) | |
449 | 423 | let amountKey = keyAcresStakedAmountByUser(address) | |
450 | 424 | let acresAmount = valueOrElse(getInteger(amountKey), 0) | |
451 | 425 | let wlgResult = invoke(wlgContract, "onStakeUnstakeLand", [address], nil) | |
452 | 426 | let claimedAcres = claimInternal(address, acresAmount, valueOrElse(getInteger(timeKey), 0)) | |
453 | 427 | $Tuple2([IntegerEntry(timeKey, lastBlock.timestamp), ScriptTransfer(i.caller, claimedAcres, acresAssetId)], $Tuple2(prologResult, wlgResult)) | |
454 | 428 | } | |
455 | 429 | } | |
456 | 430 | else throw("Strict value is not equal to itself.") | |
457 | 431 | } | |
458 | 432 | ||
459 | 433 | ||
460 | 434 | ||
461 | 435 | @Callable(i) | |
462 | 436 | func claimAcresREADONLY (address) = { | |
463 | 437 | let timeKey = keyAcresStakedTimeByUser(address) | |
464 | 438 | let amountKey = keyAcresStakedAmountByUser(address) | |
465 | 439 | let acresAmount = valueOrElse(getInteger(amountKey), 0) | |
466 | 440 | let lastTime = valueOrElse(getInteger(timeKey), 0) | |
467 | 441 | let claimedAcres = claimAcresInternal(address, acresAmount, lastTime) | |
468 | 442 | $Tuple2(nil, [claimedAcres, lastTime]) | |
469 | 443 | } | |
470 | 444 | ||
471 | 445 |
github/deemru/w8io/169f3d6 48.66 ms ◑