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