tx · HfWA1qkGy3M7f9EkekCsFJRPjZPD3P6P3wVDAkygCXaJ 3N7HtrKeFFLz5oy6PfGv1Lg3GwPk4gCPdGy: -0.01200000 Waves 2023.07.04 14:51 [2651119] smart account 3N7HtrKeFFLz5oy6PfGv1Lg3GwPk4gCPdGy > SELF 0.00000000 Waves
{ "type": 13, "id": "HfWA1qkGy3M7f9EkekCsFJRPjZPD3P6P3wVDAkygCXaJ", "fee": 1200000, "feeAssetId": null, "timestamp": 1688471531715, "version": 2, "chainId": 84, "sender": "3N7HtrKeFFLz5oy6PfGv1Lg3GwPk4gCPdGy", "senderPublicKey": "FsR18761ZAsUqsTd7TK3XmR6bhihs1UXVmpHYxz5JzQ1", "proofs": [ "4pjdPSZhFA5rrPyzxan5EFgKM2agPSmVTgwbRHaLqVXQxdZAdfZpzn9EkcJmbqqfuMv4xqnnaq4wX4ZtDssHvgRK" ], "script": "base64:BgIgCAISBgoECAgICBIDCgEBEgMKAQESABIDCgEIEgMKAQhGAQprZXlCbG9ja2VkAAIQY29udHJhY3RzQmxvY2tlZAALSWR4RWZmVG90YWwAAAAKSWR4RWZmVXNlcgABAAVjaGFpbgkAyQECCQDKAQIIBQR0aGlzBWJ5dGVzAAEAAQALdXNkdEFzc2V0SWQEByRtYXRjaDAFBWNoYWluAwkAAAIBAVcFByRtYXRjaDABIITaerIIAz9O0bvKju6Lk7zJgt0LXfoHlqjUI/moD/+5AwkAAAIBAVQFByRtYXRjaDABIFWx2J9yh4Lv5eNbjawFq2XemkOhLxa7BfMat4el8cUYCQACAQINVW5rbm93biBjaGFpbgAVZGVmYXVsdFJlc3RBZGRyZXNzU3RyBAckbWF0Y2gwBQVjaGFpbgMJAAACAQFXBQckbWF0Y2gwAiMzUFFDdXZGYnZoNExrUFVucm5VMXozam5iQTFwOW0zV05odgMJAAACAQFUBQckbWF0Y2gwAiMzTXVta0dHenRDS0FYcFdEcXhrZGRvZnFYU1VicVFrdlNKeQkAAgECDVVua25vd24gY2hhaW4ADmFy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YWxsZXIFB3VzZHRBbXQFC3VzZHRBc3NldElkBQNuaWwFDHByb2xvZ1Jlc3VsdAFpAQVjbGFpbQAEDHByb2xvZ1Jlc3VsdAkBBnByb2xvZwAEB2FjdGlvbnMICQENY2xhaW1JbnRlcm5hbAEJAKUIAQgFAWkGY2FsbGVyAl8xCQCUCgIFB2FjdGlvbnMFDHByb2xvZ1Jlc3VsdAFpAQtvblN0YWtlTGFuZAEEYWRkcgMJAQIhPQIIBQFpBmNhbGxlcgUPc3Rha2luZ0NvbnRyYWN0CQACAQIRUGVybWlzc2lvbiBkZW5pZWQJAQ1jbGFpbUludGVybmFsAQUEYWRkcgFpAQ1vblVuc3Rha2VMYW5kAQRhZGRyAwkBAiE9AggFAWkGY2FsbGVyBQ9zdGFraW5nQ29udHJhY3QJAAIBAhFQZXJtaXNzaW9uIGRlbmllZAkBDWNsYWltSW50ZXJuYWwBBQRhZGRyAG09hp8=", "height": 2651119, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4pvsduSPPvkq6HsBcFiGA9Gzbw1pTbTHKadj2MupEw9c Next: 6csyRHykhTHwkEVvRH573VLHdhuuuFSQkC8wsP9bxiUv Diff:
Old | New | Differences | |
---|---|---|---|
264 | 264 | } | |
265 | 265 | ||
266 | 266 | ||
267 | - | func claimInternal ( | |
268 | - | let | |
267 | + | func claimInternal (addr) = { | |
268 | + | let caller = addressFromStringValue(addr) | |
269 | 269 | let now = lastBlock.timestamp | |
270 | 270 | let issueTime = valueOrErrorMessage(getInteger(wlgIssueTimeKey), "Not initialized") | |
271 | 271 | let lastMarketingTime = valueOrElse(getInteger(lastMarketingTimeKey), issueTime) | |
280 | 280 | if ((curPeriod > (MAXPERIOD / 2))) | |
281 | 281 | then throw("Please modify contract for next 1.5 years, according to stats") | |
282 | 282 | else { | |
283 | - | let eff = getVotingPower( | |
283 | + | let eff = getVotingPower(addr) | |
284 | 284 | let totalPieces = eff[IdxEffTotal] | |
285 | 285 | let amountLeftTotal = valueOrElse(getInteger(stakersAmountLeftKey), 0) | |
286 | 286 | let curPeriodDistribution = fraction(amountLeftTotal, (2 * totalPieces), (totalPieces + (max([100000, totalPieces]) * (MAXPERIOD - curPeriod)))) | |
287 | - | let userTimeKey = keyLastClaimedTimeByUser( | |
287 | + | let userTimeKey = keyLastClaimedTimeByUser(addr) | |
288 | 288 | let lastUserTime = valueOrElse(getInteger(userTimeKey), issueTime) | |
289 | 289 | let userAmount = fraction(fraction(curPeriodDistribution, eff[IdxEffUser], totalPieces), (now - lastUserTime), (3 * YEARMILLIS)) | |
290 | - | let userKey = keyStakersAmountPaidUser( | |
290 | + | let userKey = keyStakersAmountPaidUser(addr) | |
291 | 291 | $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)], userAmount) | |
292 | 292 | } | |
293 | 293 | } | |
387 | 387 | @Callable(i) | |
388 | 388 | func claim () = { | |
389 | 389 | let prologResult = prolog() | |
390 | - | let actions = claimInternal(i.caller)._1 | |
390 | + | let actions = claimInternal(toString(i.caller))._1 | |
391 | 391 | $Tuple2(actions, prologResult) | |
392 | 392 | } | |
393 | 393 | ||
396 | 396 | @Callable(i) | |
397 | 397 | func onStakeLand (addr) = if ((i.caller != stakingContract)) | |
398 | 398 | then throw("Permission denied") | |
399 | - | else claimInternal( | |
399 | + | else claimInternal(addr) | |
400 | 400 | ||
401 | 401 | ||
402 | 402 | ||
403 | 403 | @Callable(i) | |
404 | 404 | func onUnstakeLand (addr) = if ((i.caller != stakingContract)) | |
405 | 405 | then throw("Permission denied") | |
406 | - | else claimInternal( | |
406 | + | else claimInternal(addr) | |
407 | 407 | ||
408 | 408 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func keyBlocked () = "contractsBlocked" | |
5 | 5 | ||
6 | 6 | ||
7 | 7 | let IdxEffTotal = 0 | |
8 | 8 | ||
9 | 9 | let IdxEffUser = 1 | |
10 | 10 | ||
11 | 11 | let chain = take(drop(this.bytes, 1), 1) | |
12 | 12 | ||
13 | 13 | let usdtAssetId = match chain { | |
14 | 14 | case _ => | |
15 | 15 | if ((base58'2W' == $match0)) | |
16 | 16 | then base58'9wc3LXNA4TEBsXyKtoLE9mrbDD7WMHXvXrCjZvabLAsi' | |
17 | 17 | else if ((base58'2T' == $match0)) | |
18 | 18 | then base58'6mWwf9mZBjVgkC54idpyaZLQfAosD914wT8fGf2iiY63' | |
19 | 19 | else throw("Unknown chain") | |
20 | 20 | } | |
21 | 21 | ||
22 | 22 | let defaultRestAddressStr = match chain { | |
23 | 23 | case _ => | |
24 | 24 | if ((base58'2W' == $match0)) | |
25 | 25 | then "3PQCuvFbvh4LkPUnrnU1z3jnbA1p9m3WNhv" | |
26 | 26 | else if ((base58'2T' == $match0)) | |
27 | 27 | then "3MumkGGztCKAXpWDqxkddofqXSUbqQkvSJy" | |
28 | 28 | else throw("Unknown chain") | |
29 | 29 | } | |
30 | 30 | ||
31 | 31 | let arbitrageDelay = match chain { | |
32 | 32 | case _ => | |
33 | 33 | if ((base58'2W' == $match0)) | |
34 | 34 | then 600000 | |
35 | 35 | else if ((base58'2T' == $match0)) | |
36 | 36 | then 60000 | |
37 | 37 | else throw("Unknown chain") | |
38 | 38 | } | |
39 | 39 | ||
40 | 40 | let SEP = "__" | |
41 | 41 | ||
42 | 42 | let MULT6 = 1000000 | |
43 | 43 | ||
44 | 44 | let MULT8 = 100000000 | |
45 | 45 | ||
46 | 46 | let SSIZE = 25 | |
47 | 47 | ||
48 | 48 | let MSIZE = 100 | |
49 | 49 | ||
50 | 50 | let LSIZE = 225 | |
51 | 51 | ||
52 | 52 | let XLSIZE = 400 | |
53 | 53 | ||
54 | 54 | let XXLSIZE = 625 | |
55 | 55 | ||
56 | 56 | let MINSHOPPAYMENT = 100000 | |
57 | 57 | ||
58 | 58 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
59 | 59 | ||
60 | 60 | ||
61 | 61 | let IdxCfgStakingDapp = 1 | |
62 | 62 | ||
63 | 63 | let IdxCfgEconomyDapp = 2 | |
64 | 64 | ||
65 | 65 | let IdxCfgWlgDapp = 4 | |
66 | 66 | ||
67 | 67 | let IdxCfgPuzzlePoolDapp = 5 | |
68 | 68 | ||
69 | 69 | func keyRestCfg () = "%s__restConfig" | |
70 | 70 | ||
71 | 71 | ||
72 | 72 | func keyRestAddress () = "%s__restAddr" | |
73 | 73 | ||
74 | 74 | ||
75 | 75 | func readRestCfgOrFail (rest) = split_4C(getStringOrFail(rest, keyRestCfg()), SEP) | |
76 | 76 | ||
77 | 77 | ||
78 | 78 | func getContractAddressOrFail (restCfg,idx) = valueOrErrorMessage(addressFromString(restCfg[idx]), ("Rest cfg doesn't contain address at index " + toString(idx))) | |
79 | 79 | ||
80 | 80 | ||
81 | 81 | let restContract = addressFromStringValue(valueOrElse(getString(this, keyRestAddress()), defaultRestAddressStr)) | |
82 | 82 | ||
83 | 83 | let restCfg = readRestCfgOrFail(restContract) | |
84 | 84 | ||
85 | 85 | let stakingContract = getContractAddressOrFail(restCfg, IdxCfgStakingDapp) | |
86 | 86 | ||
87 | 87 | let economyContract = getContractAddressOrFail(restCfg, IdxCfgEconomyDapp) | |
88 | 88 | ||
89 | 89 | let wlgContract = getContractAddressOrFail(restCfg, IdxCfgWlgDapp) | |
90 | 90 | ||
91 | 91 | let puzzlePoolContract = getContractAddressOrFail(restCfg, IdxCfgPuzzlePoolDapp) | |
92 | 92 | ||
93 | 93 | let recLandSize = 1 | |
94 | 94 | ||
95 | 95 | func keyResProportions () = "resTypesProportions" | |
96 | 96 | ||
97 | 97 | ||
98 | 98 | func keyStakedLandsByOwner (ownerAddr) = ("stakedLandsByOwner_" + ownerAddr) | |
99 | 99 | ||
100 | 100 | ||
101 | 101 | let wlgIssuedAmountKey = "wlg_issuedAmount" | |
102 | 102 | ||
103 | 103 | let wlgAssetIdKey = "wlg_assetId" | |
104 | 104 | ||
105 | 105 | let wlgAssetId = valueOrErrorMessage(getBinary(wlgContract, wlgAssetIdKey), "Not initialized yet") | |
106 | 106 | ||
107 | 107 | let idxWlgAmount = 0 | |
108 | 108 | ||
109 | 109 | let idxWlgPrice = 1 | |
110 | 110 | ||
111 | 111 | let idxWlgFunds = 2 | |
112 | 112 | ||
113 | 113 | func asInt (v) = match v { | |
114 | 114 | case n: Int => | |
115 | 115 | n | |
116 | 116 | case _ => | |
117 | 117 | throw("fail to cast into Int") | |
118 | 118 | } | |
119 | 119 | ||
120 | 120 | ||
121 | 121 | func numPiecesBySize (landSize) = match landSize { | |
122 | 122 | case _ => | |
123 | 123 | if (("S" == $match0)) | |
124 | 124 | then SSIZE | |
125 | 125 | else if (("M" == $match0)) | |
126 | 126 | then MSIZE | |
127 | 127 | else if (("L" == $match0)) | |
128 | 128 | then LSIZE | |
129 | 129 | else if (("XL" == $match0)) | |
130 | 130 | then XLSIZE | |
131 | 131 | else if (("XXL" == $match0)) | |
132 | 132 | then XXLSIZE | |
133 | 133 | else throw("Unknown land size") | |
134 | 134 | } | |
135 | 135 | ||
136 | 136 | ||
137 | 137 | func getVotingPower (userAddrStrOrEmpty) = { | |
138 | 138 | let props = split(valueOrElse(getString(stakingContract, keyResProportions()), "0_0_0_0_0_0"), "_") | |
139 | 139 | func adder (acc,item) = (acc + parseIntValue(item)) | |
140 | 140 | ||
141 | 141 | let totalPower = { | |
142 | 142 | let $l = props | |
143 | 143 | let $s = size($l) | |
144 | 144 | let $acc0 = 0 | |
145 | 145 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
146 | 146 | then $a | |
147 | 147 | else adder($a, $l[$i]) | |
148 | 148 | ||
149 | 149 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
150 | 150 | then $a | |
151 | 151 | else throw("List size exceeds 6") | |
152 | 152 | ||
153 | 153 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
154 | 154 | } | |
155 | 155 | let usersPower = if ((userAddrStrOrEmpty == "")) | |
156 | 156 | then 0 | |
157 | 157 | else { | |
158 | 158 | let landsStr = getString(stakingContract, keyStakedLandsByOwner(userAddrStrOrEmpty)) | |
159 | 159 | let lands = if (isDefined(landsStr)) | |
160 | 160 | then split_51C(value(landsStr), "_") | |
161 | 161 | else nil | |
162 | 162 | func oneLand (acc,landAssetId) = { | |
163 | 163 | let asset = value(assetInfo(fromBase58String(landAssetId))) | |
164 | 164 | let landSize = split(asset.description, "_")[recLandSize] | |
165 | 165 | (acc + numPiecesBySize(landSize)) | |
166 | 166 | } | |
167 | 167 | ||
168 | 168 | let $l = lands | |
169 | 169 | let $s = size($l) | |
170 | 170 | let $acc0 = 0 | |
171 | 171 | func $f1_1 ($a,$i) = if (($i >= $s)) | |
172 | 172 | then $a | |
173 | 173 | else oneLand($a, $l[$i]) | |
174 | 174 | ||
175 | 175 | func $f1_2 ($a,$i) = if (($i >= $s)) | |
176 | 176 | then $a | |
177 | 177 | else throw("List size exceeds 100") | |
178 | 178 | ||
179 | 179 | $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) | |
180 | 180 | } | |
181 | 181 | [totalPower, usersPower] | |
182 | 182 | } | |
183 | 183 | ||
184 | 184 | ||
185 | 185 | func getWlgStats () = { | |
186 | 186 | let issuedAmount = valueOrErrorMessage(getInteger(wlgContract, wlgIssuedAmountKey), "WLGOLD is not issued yet") | |
187 | 187 | let economyUsd = assetBalance(economyContract, usdtAssetId) | |
188 | 188 | let restUsd = assetBalance(restContract, usdtAssetId) | |
189 | 189 | let wlgUsd = assetBalance(wlgContract, usdtAssetId) | |
190 | 190 | let puzzleUsd = assetBalance(puzzlePoolContract, usdtAssetId) | |
191 | 191 | let totalFundsUsd = ((economyUsd + restUsd) + wlgUsd) | |
192 | 192 | [issuedAmount, fraction(totalFundsUsd, MULT8, issuedAmount), totalFundsUsd, economyUsd, restUsd, wlgUsd, puzzleUsd] | |
193 | 193 | } | |
194 | 194 | ||
195 | 195 | ||
196 | 196 | func fixedPoint (val,decimals) = { | |
197 | 197 | let tenPow = pow(10, 0, decimals, 0, 0, DOWN) | |
198 | 198 | ((toString((val / tenPow)) + ".") + toString((val % tenPow))) | |
199 | 199 | } | |
200 | 200 | ||
201 | 201 | ||
202 | 202 | let MULT14 = 100000000000000 | |
203 | 203 | ||
204 | 204 | let MARKETINGSHARE = 100000 | |
205 | 205 | ||
206 | 206 | let TEAMSHARE = 200000 | |
207 | 207 | ||
208 | 208 | let ACTIVITYSHARE = 100000 | |
209 | 209 | ||
210 | 210 | let PLAYERSHARE = 400000 | |
211 | 211 | ||
212 | 212 | let YEARMILLIS = 31557600000 | |
213 | 213 | ||
214 | 214 | let WEEKMILLIS = 604800000 | |
215 | 215 | ||
216 | 216 | let MAXPERIOD = 156 | |
217 | 217 | ||
218 | 218 | let A6 = 100000000 | |
219 | 219 | ||
220 | 220 | let B8 = 50000000 | |
221 | 221 | ||
222 | 222 | let wlgIssueTimeKey = "wlg_issueTime" | |
223 | 223 | ||
224 | 224 | let marketingAddrKey = "marketingAddr" | |
225 | 225 | ||
226 | 226 | let teamAddrKey = "teamAddr" | |
227 | 227 | ||
228 | 228 | let profitAddrKey = "profitAddr" | |
229 | 229 | ||
230 | 230 | let lastMarketingTimeKey = "lastClaimedTime_marketing" | |
231 | 231 | ||
232 | 232 | let lastTeamTimeKey = "lastClaimedTime_team" | |
233 | 233 | ||
234 | 234 | let lastActivitiesTimeKey = "lastClaimedTime_activities" | |
235 | 235 | ||
236 | 236 | func keyLastClaimedTimeByUser (addr) = ("lastClaimedTimeUser_" + addr) | |
237 | 237 | ||
238 | 238 | ||
239 | 239 | func keyLastArbTimeByUser (addr) = ("lastArbTimeUser_" + addr) | |
240 | 240 | ||
241 | 241 | ||
242 | 242 | let stakersAmountLeftKey = "stakersAmountLeft" | |
243 | 243 | ||
244 | 244 | let stakersAmountPaidTotalKey = "stakersAmountPaidTotal" | |
245 | 245 | ||
246 | 246 | func keyStakersAmountPaidUser (addr) = ("stakersAmountPaidUser_" + addr) | |
247 | 247 | ||
248 | 248 | ||
249 | 249 | func prolog () = if (valueOrElse(getBoolean(stakingContract, keyBlocked()), false)) | |
250 | 250 | then throw("Contracts are under maintenance") | |
251 | 251 | else asInt(invoke(stakingContract, "saveLastTx", nil, nil)) | |
252 | 252 | ||
253 | 253 | ||
254 | 254 | func getSwapLimit (addr) = { | |
255 | 255 | let lastTime = valueOrElse(getInteger(keyLastArbTimeByUser(addr)), 0) | |
256 | 256 | let now = lastBlock.timestamp | |
257 | 257 | if ((arbitrageDelay > (now - lastTime))) | |
258 | 258 | then throw((("Arbitrages are possible once a " + toString((arbitrageDelay / 60000))) + "min")) | |
259 | 259 | else { | |
260 | 260 | let pieces = getVotingPower(addr)[IdxEffUser] | |
261 | 261 | let pow8 = pow(pieces, 0, B8, 8, 8, CEILING) | |
262 | 262 | fraction(A6, pow8, MULT8) | |
263 | 263 | } | |
264 | 264 | } | |
265 | 265 | ||
266 | 266 | ||
267 | - | func claimInternal ( | |
268 | - | let | |
267 | + | func claimInternal (addr) = { | |
268 | + | let caller = addressFromStringValue(addr) | |
269 | 269 | let now = lastBlock.timestamp | |
270 | 270 | let issueTime = valueOrErrorMessage(getInteger(wlgIssueTimeKey), "Not initialized") | |
271 | 271 | let lastMarketingTime = valueOrElse(getInteger(lastMarketingTimeKey), issueTime) | |
272 | 272 | let marketingAddr = addressFromStringValue(value(getString(marketingAddrKey))) | |
273 | 273 | let marketingAmount = fraction(fraction(MULT14, MARKETINGSHARE, MULT6), (now - lastMarketingTime), YEARMILLIS) | |
274 | 274 | let lastTeamTime = valueOrElse(getInteger(lastTeamTimeKey), issueTime) | |
275 | 275 | let teamAddr = addressFromStringValue(value(getString(teamAddrKey))) | |
276 | 276 | let teamAmount = fraction(fraction(MULT14, TEAMSHARE, MULT6), (now - lastTeamTime), (3 * YEARMILLIS)) | |
277 | 277 | let lastActivitiesTime = valueOrElse(getInteger(lastActivitiesTimeKey), issueTime) | |
278 | 278 | let actAmount = fraction(fraction(MULT14, ACTIVITYSHARE, MULT6), (now - lastActivitiesTime), (3 * YEARMILLIS)) | |
279 | 279 | let curPeriod = ((now - issueTime) / WEEKMILLIS) | |
280 | 280 | if ((curPeriod > (MAXPERIOD / 2))) | |
281 | 281 | then throw("Please modify contract for next 1.5 years, according to stats") | |
282 | 282 | else { | |
283 | - | let eff = getVotingPower( | |
283 | + | let eff = getVotingPower(addr) | |
284 | 284 | let totalPieces = eff[IdxEffTotal] | |
285 | 285 | let amountLeftTotal = valueOrElse(getInteger(stakersAmountLeftKey), 0) | |
286 | 286 | let curPeriodDistribution = fraction(amountLeftTotal, (2 * totalPieces), (totalPieces + (max([100000, totalPieces]) * (MAXPERIOD - curPeriod)))) | |
287 | - | let userTimeKey = keyLastClaimedTimeByUser( | |
287 | + | let userTimeKey = keyLastClaimedTimeByUser(addr) | |
288 | 288 | let lastUserTime = valueOrElse(getInteger(userTimeKey), issueTime) | |
289 | 289 | let userAmount = fraction(fraction(curPeriodDistribution, eff[IdxEffUser], totalPieces), (now - lastUserTime), (3 * YEARMILLIS)) | |
290 | - | let userKey = keyStakersAmountPaidUser( | |
290 | + | let userKey = keyStakersAmountPaidUser(addr) | |
291 | 291 | $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)], userAmount) | |
292 | 292 | } | |
293 | 293 | } | |
294 | 294 | ||
295 | 295 | ||
296 | 296 | @Callable(i) | |
297 | 297 | func constructorV1 (restAddr,marketingAddr,teamAddr,profitAddr) = if ((i.caller != this)) | |
298 | 298 | then throw("Permission denied") | |
299 | 299 | else if (isDefined(getBinary(wlgAssetIdKey))) | |
300 | 300 | then throw("Already initialized") | |
301 | 301 | else { | |
302 | 302 | let issuedAmount = MULT14 | |
303 | 303 | let issue = Issue("WLGOLD", "WavesLands Gold investment token", issuedAmount, 8, true, unit, 0) | |
304 | 304 | let assetId = calculateAssetId(issue) | |
305 | 305 | [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), StringEntry(profitAddrKey, profitAddr)] | |
306 | 306 | } | |
307 | 307 | ||
308 | 308 | ||
309 | 309 | ||
310 | 310 | @Callable(i) | |
311 | 311 | func buyWlg (minAmount) = { | |
312 | 312 | let prologResult = prolog() | |
313 | 313 | if ((size(i.payments) != 1)) | |
314 | 314 | then throw("exactly 1 payment must be attached") | |
315 | 315 | else { | |
316 | 316 | let pmt = i.payments[0] | |
317 | 317 | let usdtAmt = pmt.amount | |
318 | 318 | let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WAVES can't be used as payment") | |
319 | 319 | if ((pmtAssetId != usdtAssetId)) | |
320 | 320 | then throw("USDT payments only!") | |
321 | 321 | else { | |
322 | 322 | let caller = i.caller | |
323 | 323 | let addr = toString(caller) | |
324 | 324 | let maxUsdt = getSwapLimit(addr) | |
325 | 325 | if ((usdtAmt > maxUsdt)) | |
326 | 326 | then throw((("You can spend max " + fixedPoint(maxUsdt, 6)) + " USDT")) | |
327 | 327 | else if ((MINSHOPPAYMENT > usdtAmt)) | |
328 | 328 | then throw((("You can trade min " + fixedPoint(MINSHOPPAYMENT, 6)) + " USDT")) | |
329 | 329 | else { | |
330 | 330 | let curStats = getWlgStats() | |
331 | 331 | let curWlgAmount = curStats[idxWlgAmount] | |
332 | 332 | let oldFundsUsd = (curStats[idxWlgFunds] - usdtAmt) | |
333 | 333 | let wlgPrice = fraction(oldFundsUsd, MULT8, curWlgAmount) | |
334 | 334 | let buyPrice = fraction(wlgPrice, 6, 5) | |
335 | 335 | let wlgAmount = fraction(usdtAmt, MULT8, buyPrice) | |
336 | 336 | if ((minAmount > wlgAmount)) | |
337 | 337 | then throw("Price changed during operation, please try again") | |
338 | 338 | else { | |
339 | 339 | let profitAmount = (usdtAmt / 6) | |
340 | 340 | let deltaFunds = (usdtAmt - profitAmount) | |
341 | 341 | let reissued = fraction(curWlgAmount, deltaFunds, oldFundsUsd) | |
342 | 342 | $Tuple2([Reissue(wlgAssetId, reissued, true), IntegerEntry(wlgIssuedAmountKey, (curWlgAmount + reissued)), IntegerEntry(keyLastArbTimeByUser(addr), lastBlock.timestamp), ScriptTransfer(addressFromStringValue(value(getString(profitAddrKey))), profitAmount, usdtAssetId), ScriptTransfer(caller, wlgAmount, wlgAssetId)], prologResult) | |
343 | 343 | } | |
344 | 344 | } | |
345 | 345 | } | |
346 | 346 | } | |
347 | 347 | } | |
348 | 348 | ||
349 | 349 | ||
350 | 350 | ||
351 | 351 | @Callable(i) | |
352 | 352 | func sellWlg (minAmount) = { | |
353 | 353 | let prologResult = prolog() | |
354 | 354 | if ((size(i.payments) != 1)) | |
355 | 355 | then throw("exactly 1 payment must be attached") | |
356 | 356 | else { | |
357 | 357 | let pmt = i.payments[0] | |
358 | 358 | let wlgAmt = pmt.amount | |
359 | 359 | let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WAVES can't be used as payment") | |
360 | 360 | if ((pmtAssetId != wlgAssetId)) | |
361 | 361 | then throw("WLGOLD payments only!") | |
362 | 362 | else { | |
363 | 363 | let caller = i.caller | |
364 | 364 | let addr = toString(caller) | |
365 | 365 | let maxUsdt = getSwapLimit(addr) | |
366 | 366 | let curStats = getWlgStats() | |
367 | 367 | let curWlgAmount = curStats[idxWlgAmount] | |
368 | 368 | let sellPrice = fraction(curStats[idxWlgPrice], 4, 5) | |
369 | 369 | let usdtAmt = fraction(wlgAmt, sellPrice, MULT8) | |
370 | 370 | if ((usdtAmt > maxUsdt)) | |
371 | 371 | then throw((("You can get max " + fixedPoint(maxUsdt, 6)) + " USDT")) | |
372 | 372 | else if ((MINSHOPPAYMENT > usdtAmt)) | |
373 | 373 | then throw((("You can trade min " + fixedPoint(MINSHOPPAYMENT, 6)) + " USDT")) | |
374 | 374 | else if ((minAmount > usdtAmt)) | |
375 | 375 | then throw("Price changed during operation, please try again") | |
376 | 376 | else { | |
377 | 377 | let profitAmount = (usdtAmt / 4) | |
378 | 378 | let burned = fraction((usdtAmt + profitAmount), curWlgAmount, curStats[idxWlgFunds]) | |
379 | 379 | $Tuple2([Burn(wlgAssetId, burned), IntegerEntry(wlgIssuedAmountKey, (curWlgAmount - burned)), IntegerEntry(keyLastArbTimeByUser(addr), lastBlock.timestamp), ScriptTransfer(addressFromStringValue(value(getString(profitAddrKey))), profitAmount, usdtAssetId), ScriptTransfer(caller, usdtAmt, usdtAssetId)], prologResult) | |
380 | 380 | } | |
381 | 381 | } | |
382 | 382 | } | |
383 | 383 | } | |
384 | 384 | ||
385 | 385 | ||
386 | 386 | ||
387 | 387 | @Callable(i) | |
388 | 388 | func claim () = { | |
389 | 389 | let prologResult = prolog() | |
390 | - | let actions = claimInternal(i.caller)._1 | |
390 | + | let actions = claimInternal(toString(i.caller))._1 | |
391 | 391 | $Tuple2(actions, prologResult) | |
392 | 392 | } | |
393 | 393 | ||
394 | 394 | ||
395 | 395 | ||
396 | 396 | @Callable(i) | |
397 | 397 | func onStakeLand (addr) = if ((i.caller != stakingContract)) | |
398 | 398 | then throw("Permission denied") | |
399 | - | else claimInternal( | |
399 | + | else claimInternal(addr) | |
400 | 400 | ||
401 | 401 | ||
402 | 402 | ||
403 | 403 | @Callable(i) | |
404 | 404 | func onUnstakeLand (addr) = if ((i.caller != stakingContract)) | |
405 | 405 | then throw("Permission denied") | |
406 | - | else claimInternal( | |
406 | + | else claimInternal(addr) | |
407 | 407 | ||
408 | 408 |
github/deemru/w8io/026f985 78.78 ms ◑