tx · 4t1JDHitYd8g9E5n4PB6XJiAiBmtW72kvkRfrf3U1MiL 3N7HtrKeFFLz5oy6PfGv1Lg3GwPk4gCPdGy: -0.02000000 Waves 2023.10.07 01:57 [2787403] smart account 3N7HtrKeFFLz5oy6PfGv1Lg3GwPk4gCPdGy > SELF 0.00000000 Waves
{ "type": 13, "id": "4t1JDHitYd8g9E5n4PB6XJiAiBmtW72kvkRfrf3U1MiL", "fee": 2000000, "feeAssetId": null, "timestamp": 1696633095023, "version": 2, "chainId": 84, "sender": "3N7HtrKeFFLz5oy6PfGv1Lg3GwPk4gCPdGy", "senderPublicKey": "FsR18761ZAsUqsTd7TK3XmR6bhihs1UXVmpHYxz5JzQ1", "proofs": [ "5sCUWzHBoSvsJcxDuaxXUXwHeKtggDpKWAr95SDzAgGLzQfH1bsbRK4dEFTEZRiPZvFZQ4Azbc7UMNakcnRyFpzJ" ], "script": "base64:BgIzCAISBgoECAgICBIDCgEBEgMKAQESABIDCgEIEgUKAwgIARIAEgMKAQESAwoBCBIDCgEIbQACTTYAwIQ9AAJNOACAwtcvAAhNSUxMSU9ONgCAgOmDsd4WAA5NQVJLRVRJTkdTSEFSRQCgjQYACVRFQU1TSEFSRQDAmgwADUFDVElWSVRZU0hBUkUAoI0GAAtQTEFZRVJTSEFSRQCAtRgACllFQVJNSUxMSVMAgIbrx3UACUNIRUNLVElNRQCAyeCrsAEACURBWU1JTExJUwCAuJkpABBtYXJrZXRpbmdBZGRyS2V5Ag1tYXJrZXRpbmdBZGRyAAt0ZWFtQWRkcktleQIIdGVhbUFkZHIAFGxhc3RNYXJrZXRpbmdUaW1lS2V5AhlsYXN0Q2xhaW1lZFRpbWVfbWFya2V0aW5nABZtYXJrZXRpbmdBbW91bnRMZWZ0S2V5AhNtYXJrZXRpbmdBbW91bnRMZWZ0AA9sYXN0VGVhbVRpbWVLZXkCFGxhc3RDbGFpbWVkVGltZV90ZWFtABF0ZWFtQW1vdW50TGVmdEtleQIOdGVhbUFtb3VudExlZn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VsdAkBBWFzSW50AQkA/AcEBQ9zdGFraW5nQ29udHJhY3QCDnVwZGF0ZUFjY1N0YXRzCQDMCAIFBGFkZHIJAMwIAgUCeHAFA25pbAUDbmlsCQCUCgIFB2FjdGlvbnMJAJQKAgUMcHJvbG9nUmVzdWx0BQ5hY2NTdGF0c1Jlc3VsdAFpAQl0YWtlV2xnWHABBGFkZHIDCQECIT0CCAUBaQZjYWxsZXIFD3N0YWtpbmdDb250cmFjdAkAAgECEVBlcm1pc3Npb24gZGVuaWVkBA0kdDAxMDk1NjEwOTk5CQEOdGFrZVhwSW50ZXJuYWwCBQRhZGRyAAAEB2FjdGlvbnMIBQ0kdDAxMDk1NjEwOTk5Al8xBAJ4cAgFDSR0MDEwOTU2MTA5OTkCXzIJAJQKAgUHYWN0aW9ucwUCeHABaQESY2hlY2tXbGdYcFJFQURPTkxZAQRhZGRyBA0kdDAxMTA3NjExMTI0CQEOdGFrZVhwSW50ZXJuYWwCBQRhZGRyAAAEB2lnbm9yZWQIBQ0kdDAxMTA3NjExMTI0Al8xBAdkZWx0YVhQCAUNJHQwMTEwNzYxMTEyNAJfMgQGbHZsS2V5CQEMa2V5VXNlckxldmVsAQUEYWRkcgQFeHBLZXkJAQlrZXlVc2VyWFABBQRhZGRyBAJ4cAkBC3ZhbHVlT3JFbHNlAgkAmggCBQ9zdGFraW5nQ29udHJhY3QFBXhwS2V5AAAEBW5ld1hQCQBkAgUCeHAFB2RlbHRhWFAECWx2bFBvaW50cwkBB2xldmVsVXACCQELdmFsdWVPckVsc2UCCQCaCAIFD3N0YWtpbmdDb250cmFjdAUGbHZsS2V5AAAFBW5ld1hQCQCUCgIFA25pbAUJbHZsUG9pbnRzAF1ozNU=", "height": 2787403, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: B5qhKauRHBTzKGVMBsvE3fnnNe6Gt15BH6kwyt863i7D Next: D4X9oU19yFxnnFszRKAoPbZ8eu6UWbxLLU1yshMNdVXx Diff:
Old | New | Differences | |
---|---|---|---|
59 | 59 | ||
60 | 60 | let acresStakedTotalKey = "acresStakedAmountTotal" | |
61 | 61 | ||
62 | - | ||
62 | + | func keyWlgStakedAmountByUser (addr) = ("wlgStakedAmountByUser_" + addr) | |
63 | 63 | ||
64 | - | let idxWlgPrice = 1 | |
65 | 64 | ||
66 | - | let | |
65 | + | let wlgStakedTotalKey = "wlgStakedAmountTotal" | |
67 | 66 | ||
68 | - | ||
67 | + | func keyWlgStakedTimeByUser (addr) = ("wlgStakedTimeByUser_" + addr) | |
69 | 68 | ||
70 | - | let idxWlgMarketingAmLeft = 10 | |
71 | - | ||
72 | - | let idxWlgMarketingAmAvailNow = 11 | |
73 | - | ||
74 | - | let idxWlgTeamAmLeft = 14 | |
75 | - | ||
76 | - | let idxWlgTeamAmAvailNow = 15 | |
77 | - | ||
78 | - | let idxWlgActAmLeft = 18 | |
79 | - | ||
80 | - | let idxWlgActAmAvailNow = 19 | |
81 | - | ||
82 | - | let idxWlgAmLeftTotal = 22 | |
83 | - | ||
84 | - | let idxWlgUserAmAvailNow = 25 | |
85 | - | ||
86 | - | let idxWlgUserTotalAvail = 28 | |
87 | - | ||
88 | - | let idxWlgEffUserTime = 29 | |
89 | 69 | ||
90 | 70 | let dappRest = 0 | |
91 | 71 | ||
211 | 191 | } | |
212 | 192 | ||
213 | 193 | ||
194 | + | let SCALE8 = 100000000 | |
195 | + | ||
196 | + | let xpLevelScale = 3200 | |
197 | + | ||
198 | + | let xpLevelRecipPow = 4000 | |
199 | + | ||
200 | + | let numPointsOnLevelUp = 3 | |
201 | + | ||
202 | + | let wlgBaseAmountXp = 100000000000 | |
203 | + | ||
204 | + | func keyUserXP (addr) = ("userXP_" + addr) | |
205 | + | ||
206 | + | ||
207 | + | func keyUserLevel (addr) = ("userLevel_" + addr) | |
208 | + | ||
209 | + | ||
210 | + | let xpWlg = 10000 | |
211 | + | ||
212 | + | func levelByXP (xp) = fraction(xpLevelScale, pow(xp, 4, xpLevelRecipPow, 4, 4, DOWN), SCALE8) | |
213 | + | ||
214 | + | ||
215 | + | func levelUp (currLevel,newXP) = { | |
216 | + | let newLevel = levelByXP(newXP) | |
217 | + | [newLevel, (numPointsOnLevelUp * (newLevel - currLevel))] | |
218 | + | } | |
219 | + | ||
220 | + | ||
214 | 221 | let chain = take(drop(this.bytes, 1), 1) | |
215 | 222 | ||
216 | 223 | let usdtAssetId = match chain { | |
294 | 301 | let wlgAssetIdKey = "wlg_assetId" | |
295 | 302 | ||
296 | 303 | let wlgAssetId = valueOrErrorMessage(getBinary(wlgContract, wlgAssetIdKey), "WLGOLD is not issued yet") | |
304 | + | ||
305 | + | let idxWlgAmount = 0 | |
306 | + | ||
307 | + | let idxWlgPrice = 1 | |
308 | + | ||
309 | + | let idxWlgFunds = 2 | |
310 | + | ||
311 | + | let idxWlgIssueTime = 7 | |
312 | + | ||
313 | + | let idxWlgMarketingAmLeft = 10 | |
314 | + | ||
315 | + | let idxWlgMarketingAmAvailNow = 11 | |
316 | + | ||
317 | + | let idxWlgTeamAmLeft = 14 | |
318 | + | ||
319 | + | let idxWlgTeamAmAvailNow = 15 | |
320 | + | ||
321 | + | let idxWlgActAmLeft = 18 | |
322 | + | ||
323 | + | let idxWlgActAmAvailNow = 19 | |
324 | + | ||
325 | + | let idxWlgAmLeftTotal = 22 | |
326 | + | ||
327 | + | let idxWlgUserAmAvailNow = 25 | |
328 | + | ||
329 | + | let idxWlgUserTotalAvail = 28 | |
330 | + | ||
331 | + | let idxWlgEffUserTime = 29 | |
297 | 332 | ||
298 | 333 | let IdxEffUser = 1 | |
299 | 334 | ||
388 | 423 | } | |
389 | 424 | ||
390 | 425 | ||
426 | + | func takeXpInternal (addr,delta) = { | |
427 | + | let now = lastBlock.timestamp | |
428 | + | let timeKey = keyWlgStakedTimeByUser(addr) | |
429 | + | let amountKey = keyWlgStakedAmountByUser(addr) | |
430 | + | let lastTime = valueOrElse(getInteger(timeKey), 0) | |
431 | + | let oldUser = valueOrElse(getInteger(amountKey), 0) | |
432 | + | let oldTotal = valueOrElse(getInteger(wlgStakedTotalKey), 0) | |
433 | + | let xp = fraction(fraction(xpWlg, oldUser, wlgBaseAmountXp), (lastTime - now), DAYMILLIS) | |
434 | + | $Tuple3([IntegerEntry(timeKey, now), IntegerEntry(amountKey, (oldUser + delta)), IntegerEntry(wlgStakedTotalKey, (oldTotal + delta))], xp, oldUser) | |
435 | + | } | |
436 | + | ||
437 | + | ||
391 | 438 | @Callable(i) | |
392 | 439 | func constructorV1 (restAddr,marketingAddr,teamAddr,profitAddr) = if ((i.caller != this)) | |
393 | 440 | then throw("Permission denied") | |
410 | 457 | else { | |
411 | 458 | let pmt = i.payments[0] | |
412 | 459 | let usdtAmt = pmt.amount | |
413 | - | let pmtAssetId = valueOrErrorMessage(pmt.assetId, "USDT payments only!") | |
414 | - | if ((pmtAssetId != usdtAssetId)) | |
460 | + | if (if (!(isDefined(pmt.assetId))) | |
461 | + | then true | |
462 | + | else (value(pmt.assetId) != usdtAssetId)) | |
415 | 463 | then throw("USDT payments only!") | |
416 | 464 | else { | |
417 | 465 | let caller = i.caller | |
456 | 504 | let maxWlg = getSwapLimitWlg(addr) | |
457 | 505 | if ((wlgAmt > maxWlg)) | |
458 | 506 | then throw((("You can spend max " + fixedPoint(maxWlg, 8)) + " WLGOLD")) | |
459 | - | else { | |
460 | - | let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WLGOLD payments only!") | |
461 | - | if ((pmtAssetId != wlgAssetId)) | |
462 | - | then throw("WLGOLD payments only!") | |
463 | - | else { | |
464 | - | let curStats = getWlgStats("", [restContract, stakingContract, economyContract, wlgContract, puzzlePoolContract, investFundContract, acresContract], usdtAssetId, 0, MULT6) | |
465 | - | let curWlgAmount = curStats[idxWlgAmount] | |
466 | - | let sellPrice = fraction(curStats[idxWlgPrice], 4, 5) | |
467 | - | let usdtAmt = fraction(wlgAmt, sellPrice, MULT8) | |
468 | - | if ((MINSHOPPAYMENT > usdtAmt)) | |
469 | - | then throw((("You can trade min " + fixedPoint(MINSHOPPAYMENT, 6)) + " USDT")) | |
470 | - | else if ((minAmount > usdtAmt)) | |
471 | - | then throw("Price changed during operation, please try again") | |
472 | - | else { | |
473 | - | let profitAmount = (usdtAmt / 4) | |
474 | - | let burned = fraction((usdtAmt + profitAmount), curWlgAmount, curStats[idxWlgFunds]) | |
475 | - | $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) | |
476 | - | } | |
477 | - | } | |
478 | - | } | |
507 | + | else if (if (!(isDefined(pmt.assetId))) | |
508 | + | then true | |
509 | + | else (value(pmt.assetId) != wlgAssetId)) | |
510 | + | then throw("WLGOLD payments only!") | |
511 | + | else { | |
512 | + | let curStats = getWlgStats("", [restContract, stakingContract, economyContract, wlgContract, puzzlePoolContract, investFundContract, acresContract], usdtAssetId, 0, MULT6) | |
513 | + | let curWlgAmount = curStats[idxWlgAmount] | |
514 | + | let sellPrice = fraction(curStats[idxWlgPrice], 4, 5) | |
515 | + | let usdtAmt = fraction(wlgAmt, sellPrice, MULT8) | |
516 | + | if ((MINSHOPPAYMENT > usdtAmt)) | |
517 | + | then throw((("You can trade min " + fixedPoint(MINSHOPPAYMENT, 6)) + " USDT")) | |
518 | + | else if ((minAmount > usdtAmt)) | |
519 | + | then throw("Price changed during operation, please try again") | |
520 | + | else { | |
521 | + | let profitAmount = (usdtAmt / 4) | |
522 | + | let burned = fraction((usdtAmt + profitAmount), curWlgAmount, curStats[idxWlgFunds]) | |
523 | + | $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) | |
524 | + | } | |
525 | + | } | |
479 | 526 | } | |
480 | 527 | } | |
481 | 528 | ||
517 | 564 | } | |
518 | 565 | ||
519 | 566 | ||
567 | + | ||
568 | + | @Callable(i) | |
569 | + | func stakeWlgold () = { | |
570 | + | let prologResult = prolog() | |
571 | + | if ((size(i.payments) != 1)) | |
572 | + | then throw("exactly 1 payment must be attached") | |
573 | + | else { | |
574 | + | let pmt = i.payments[0] | |
575 | + | let amt = pmt.amount | |
576 | + | let addr = toString(i.caller) | |
577 | + | if (if (!(isDefined(pmt.assetId))) | |
578 | + | then true | |
579 | + | else (value(pmt.assetId) != wlgAssetId)) | |
580 | + | then throw("WLGOLD payments only!") | |
581 | + | else { | |
582 | + | let $t01003810083 = takeXpInternal(addr, amt) | |
583 | + | let actions = $t01003810083._1 | |
584 | + | let xp = $t01003810083._2 | |
585 | + | let accStatsResult = asInt(invoke(stakingContract, "updateAccStats", [addr, xp], nil)) | |
586 | + | $Tuple2(actions, $Tuple2(prologResult, accStatsResult)) | |
587 | + | } | |
588 | + | } | |
589 | + | } | |
590 | + | ||
591 | + | ||
592 | + | ||
593 | + | @Callable(i) | |
594 | + | func unstakeWlgold (amount) = { | |
595 | + | let prologResult = prolog() | |
596 | + | if ((size(i.payments) != 0)) | |
597 | + | then throw("No payments required") | |
598 | + | else if ((0 >= amount)) | |
599 | + | then throw("Amount should be positive") | |
600 | + | else { | |
601 | + | let addr = toString(i.caller) | |
602 | + | let $t01046710525 = takeXpInternal(addr, -(amount)) | |
603 | + | let actions = $t01046710525._1 | |
604 | + | let xp = $t01046710525._2 | |
605 | + | let oldUser = $t01046710525._3 | |
606 | + | if ((amount > oldUser)) | |
607 | + | then throw(((("You have only " + fixedPoint(oldUser, 8)) + " WLGOLD staked, tried to unstake ") + fixedPoint(amount, 8))) | |
608 | + | else { | |
609 | + | let accStatsResult = asInt(invoke(stakingContract, "updateAccStats", [addr, xp], nil)) | |
610 | + | $Tuple2(actions, $Tuple2(prologResult, accStatsResult)) | |
611 | + | } | |
612 | + | } | |
613 | + | } | |
614 | + | ||
615 | + | ||
616 | + | ||
617 | + | @Callable(i) | |
618 | + | func takeWlgXp (addr) = if ((i.caller != stakingContract)) | |
619 | + | then throw("Permission denied") | |
620 | + | else { | |
621 | + | let $t01095610999 = takeXpInternal(addr, 0) | |
622 | + | let actions = $t01095610999._1 | |
623 | + | let xp = $t01095610999._2 | |
624 | + | $Tuple2(actions, xp) | |
625 | + | } | |
626 | + | ||
627 | + | ||
628 | + | ||
629 | + | @Callable(i) | |
630 | + | func checkWlgXpREADONLY (addr) = { | |
631 | + | let $t01107611124 = takeXpInternal(addr, 0) | |
632 | + | let ignored = $t01107611124._1 | |
633 | + | let deltaXP = $t01107611124._2 | |
634 | + | let lvlKey = keyUserLevel(addr) | |
635 | + | let xpKey = keyUserXP(addr) | |
636 | + | let xp = valueOrElse(getInteger(stakingContract, xpKey), 0) | |
637 | + | let newXP = (xp + deltaXP) | |
638 | + | let lvlPoints = levelUp(valueOrElse(getInteger(stakingContract, lvlKey), 0), newXP) | |
639 | + | $Tuple2(nil, lvlPoints) | |
640 | + | } | |
641 | + | ||
642 | + |
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 CHECKTIME = 47336400000 | |
21 | 21 | ||
22 | 22 | let DAYMILLIS = 86400000 | |
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 | func keyLastArbTimeByUser (addr) = ("lastArbTimeUser_" + addr) | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | func distributionByPeriod (period) = fraction(MILLION6, (PLAYERSHARE * (period + 1)), (6 * M6)) | |
49 | 49 | ||
50 | 50 | ||
51 | 51 | let wlgIssueTimeKey = "wlg_issueTime" | |
52 | 52 | ||
53 | 53 | let wlgIssuedAmountKey = "wlg_issuedAmount" | |
54 | 54 | ||
55 | 55 | let zbIssuedAmountKey = "zbill_issuedAmount" | |
56 | 56 | ||
57 | 57 | func keyAcresStakedAmountByUser (addr) = ("acresStakedAmountByUser_" + addr) | |
58 | 58 | ||
59 | 59 | ||
60 | 60 | let acresStakedTotalKey = "acresStakedAmountTotal" | |
61 | 61 | ||
62 | - | ||
62 | + | func keyWlgStakedAmountByUser (addr) = ("wlgStakedAmountByUser_" + addr) | |
63 | 63 | ||
64 | - | let idxWlgPrice = 1 | |
65 | 64 | ||
66 | - | let | |
65 | + | let wlgStakedTotalKey = "wlgStakedAmountTotal" | |
67 | 66 | ||
68 | - | ||
67 | + | func keyWlgStakedTimeByUser (addr) = ("wlgStakedTimeByUser_" + addr) | |
69 | 68 | ||
70 | - | let idxWlgMarketingAmLeft = 10 | |
71 | - | ||
72 | - | let idxWlgMarketingAmAvailNow = 11 | |
73 | - | ||
74 | - | let idxWlgTeamAmLeft = 14 | |
75 | - | ||
76 | - | let idxWlgTeamAmAvailNow = 15 | |
77 | - | ||
78 | - | let idxWlgActAmLeft = 18 | |
79 | - | ||
80 | - | let idxWlgActAmAvailNow = 19 | |
81 | - | ||
82 | - | let idxWlgAmLeftTotal = 22 | |
83 | - | ||
84 | - | let idxWlgUserAmAvailNow = 25 | |
85 | - | ||
86 | - | let idxWlgUserTotalAvail = 28 | |
87 | - | ||
88 | - | let idxWlgEffUserTime = 29 | |
89 | 69 | ||
90 | 70 | let dappRest = 0 | |
91 | 71 | ||
92 | 72 | let dappStaking = 1 | |
93 | 73 | ||
94 | 74 | let dappEconomy = 2 | |
95 | 75 | ||
96 | 76 | let dappWlg = 3 | |
97 | 77 | ||
98 | 78 | let dappPuzzle = 4 | |
99 | 79 | ||
100 | 80 | let dappInvestFund = 5 | |
101 | 81 | ||
102 | 82 | let dappAcres = 6 | |
103 | 83 | ||
104 | 84 | func getLands (userAddrStrOrEmpty,stakingContract,acresContract) = { | |
105 | 85 | let props = split(valueOrElse(getString(stakingContract, "resTypesProportions"), "0_0_0_0_0_0"), "_") | |
106 | 86 | func adder (acc,item) = (acc + parseIntValue(item)) | |
107 | 87 | ||
108 | 88 | let totalPieces = { | |
109 | 89 | let $l = props | |
110 | 90 | let $s = size($l) | |
111 | 91 | let $acc0 = 0 | |
112 | 92 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
113 | 93 | then $a | |
114 | 94 | else adder($a, $l[$i]) | |
115 | 95 | ||
116 | 96 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
117 | 97 | then $a | |
118 | 98 | else throw("List size exceeds 6") | |
119 | 99 | ||
120 | 100 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
121 | 101 | } | |
122 | 102 | let userPieces = valueOrElse(getInteger(stakingContract, ("stakedPiecesByOwner_" + userAddrStrOrEmpty)), 0) | |
123 | 103 | let totalAcres = valueOrElse(getInteger(acresContract, acresStakedTotalKey), 0) | |
124 | 104 | let userAcres = valueOrElse(getInteger(acresContract, keyAcresStakedAmountByUser(userAddrStrOrEmpty)), 0) | |
125 | 105 | [totalPieces, userPieces, totalAcres, userAcres] | |
126 | 106 | } | |
127 | 107 | ||
128 | 108 | ||
129 | 109 | let idxTotalPieces = 0 | |
130 | 110 | ||
131 | 111 | let idxUserPieces = 1 | |
132 | 112 | ||
133 | 113 | let idxTotalAcres = 2 | |
134 | 114 | ||
135 | 115 | let idxUserAcres = 3 | |
136 | 116 | ||
137 | 117 | func getWlgStats (userAddrOpt,contracts,usdtId,usdtBalanceCorrection,userProportion6) = { | |
138 | 118 | let issuedAmount = valueOrErrorMessage(getInteger(contracts[dappWlg], wlgIssuedAmountKey), "WLGOLD is not issued yet") | |
139 | 119 | let economyUsd = assetBalance(contracts[dappEconomy], usdtId) | |
140 | 120 | let restUsd = assetBalance(contracts[dappRest], usdtId) | |
141 | 121 | let wlgUsd = (assetBalance(contracts[dappWlg], usdtId) - usdtBalanceCorrection) | |
142 | 122 | let puzzleUsd = assetBalance(contracts[dappPuzzle], usdtId) | |
143 | 123 | let investFundContract = contracts[dappInvestFund] | |
144 | 124 | let investFundTotal = (assetBalance(investFundContract, usdtId) + valueOrElse(getInteger(investFundContract, zbIssuedAmountKey), 0)) | |
145 | 125 | let totalFundsUsd = ((economyUsd + wlgUsd) + investFundTotal) | |
146 | 126 | let wlgId = valueOrErrorMessage(getBinary(contracts[dappWlg], "wlg_assetId"), "Not initialized yet") | |
147 | 127 | let now = lastBlock.timestamp | |
148 | 128 | let issueTime = valueOrErrorMessage(getInteger(contracts[dappWlg], wlgIssueTimeKey), "Not initialized") | |
149 | 129 | let marketingTotal = fraction(MILLION6, MARKETINGSHARE, M6) | |
150 | 130 | let marketingAmountLeft = valueOrElse(getInteger(contracts[dappWlg], marketingAmountLeftKey), marketingTotal) | |
151 | 131 | let lastMarketingTime = valueOrElse(getInteger(contracts[dappWlg], lastMarketingTimeKey), issueTime) | |
152 | 132 | let marketingAddr = addressFromStringValue(value(getString(contracts[dappWlg], marketingAddrKey))) | |
153 | 133 | let marketingAmountAvailableNow = min([fraction(marketingTotal, (now - lastMarketingTime), YEARMILLIS), marketingAmountLeft]) | |
154 | 134 | let marketingWlgold = assetBalance(marketingAddr, wlgId) | |
155 | 135 | let teamTotal = fraction(MILLION6, TEAMSHARE, M6) | |
156 | 136 | let teamAmountLeft = valueOrElse(getInteger(contracts[dappWlg], teamAmountLeftKey), teamTotal) | |
157 | 137 | let lastTeamTime = valueOrElse(getInteger(contracts[dappWlg], lastTeamTimeKey), issueTime) | |
158 | 138 | let teamAddr = addressFromStringValue(value(getString(contracts[dappWlg], teamAddrKey))) | |
159 | 139 | let teamAmountAvailableNow = min([fraction(teamTotal, (now - lastTeamTime), (3 * YEARMILLIS)), teamAmountLeft]) | |
160 | 140 | let teamWlgold = assetBalance(teamAddr, wlgId) | |
161 | 141 | let actTotal = fraction(MILLION6, ACTIVITYSHARE, M6) | |
162 | 142 | let actAmountLeft = valueOrElse(getInteger(contracts[dappWlg], actAmountLeftKey), actTotal) | |
163 | 143 | let lastActivitiesTime = valueOrElse(getInteger(contracts[dappWlg], lastActivitiesTimeKey), issueTime) | |
164 | 144 | let actAmountAvailableNow = min([fraction(actTotal, (now - lastActivitiesTime), (3 * YEARMILLIS)), actAmountLeft]) | |
165 | 145 | let actWlgold = assetBalance(contracts[dappRest], wlgId) | |
166 | 146 | let lastUserTime = valueOrElse(getInteger(contracts[dappWlg], keyLastClaimedTimeByUser(userAddrOpt)), issueTime) | |
167 | 147 | let lastUserPeriod = ((lastUserTime - issueTime) / YEARMILLIS) | |
168 | 148 | let nowLimited = min([now, (issueTime + (3 * YEARMILLIS))]) | |
169 | 149 | let curPeriod = min([((now - issueTime) / YEARMILLIS), 2]) | |
170 | 150 | let eff = getLands(userAddrOpt, contracts[dappStaking], contracts[dappAcres]) | |
171 | 151 | let curPeriodDistribution = distributionByPeriod(curPeriod) | |
172 | 152 | let $t079142 = if ((lastUserPeriod == curPeriod)) | |
173 | 153 | then { | |
174 | 154 | let a0 = fraction(curPeriodDistribution, (nowLimited - lastUserTime), YEARMILLIS) | |
175 | 155 | let userPart = fraction(a0, userProportion6, M6) | |
176 | 156 | let effTime = (lastUserTime + fraction((nowLimited - lastUserTime), userProportion6, M6)) | |
177 | 157 | $Tuple3(userPart, a0, effTime) | |
178 | 158 | } | |
179 | 159 | else if ((lastUserPeriod == (curPeriod - 1))) | |
180 | 160 | then { | |
181 | 161 | let a1 = fraction(distributionByPeriod((curPeriod - 1)), ((issueTime + (YEARMILLIS * curPeriod)) - lastUserTime), YEARMILLIS) | |
182 | 162 | let a0 = fraction(curPeriodDistribution, (nowLimited - (issueTime + (YEARMILLIS * curPeriod))), YEARMILLIS) | |
183 | 163 | let avail = (a1 + a0) | |
184 | 164 | let userPart = fraction(avail, userProportion6, M6) | |
185 | 165 | let effTime = if ((a1 >= userPart)) | |
186 | 166 | then (lastUserTime + fraction(YEARMILLIS, userPart, distributionByPeriod((curPeriod - 1)))) | |
187 | 167 | else ((issueTime + (YEARMILLIS * curPeriod)) + fraction(YEARMILLIS, (userPart - a1), curPeriodDistribution)) | |
188 | 168 | $Tuple3(userPart, avail, effTime) | |
189 | 169 | } | |
190 | 170 | else { | |
191 | 171 | let a2 = fraction(distributionByPeriod((curPeriod - 2)), ((issueTime + (YEARMILLIS * (curPeriod - 1))) - lastUserTime), YEARMILLIS) | |
192 | 172 | let a1 = distributionByPeriod((curPeriod - 1)) | |
193 | 173 | let a0 = fraction(curPeriodDistribution, (nowLimited - (issueTime + (YEARMILLIS * curPeriod))), YEARMILLIS) | |
194 | 174 | let avail = ((a2 + a1) + a0) | |
195 | 175 | let userPart = fraction(avail, userProportion6, M6) | |
196 | 176 | let effTime = if ((a2 >= userPart)) | |
197 | 177 | then (lastUserTime + fraction(YEARMILLIS, userPart, distributionByPeriod((curPeriod - 2)))) | |
198 | 178 | else if (((a2 + a1) >= userPart)) | |
199 | 179 | then ((issueTime + (YEARMILLIS * (curPeriod - 1))) + fraction(YEARMILLIS, (userPart - a2), distributionByPeriod((curPeriod - 1)))) | |
200 | 180 | else ((issueTime + (YEARMILLIS * curPeriod)) + fraction(YEARMILLIS, ((userPart - a2) - a1), curPeriodDistribution)) | |
201 | 181 | $Tuple3(userPart, avail, effTime) | |
202 | 182 | } | |
203 | 183 | let userAmount = $t079142._1 | |
204 | 184 | let userAvailable = $t079142._2 | |
205 | 185 | let effLastTime = $t079142._3 | |
206 | 186 | let sLandDailyAmount = fraction(fraction(curPeriodDistribution, DAYMILLIS, YEARMILLIS), 25, eff[idxTotalPieces]) | |
207 | 187 | let amountLeftTotal = valueOrElse(getInteger(contracts[dappWlg], stakersAmountLeftKey), 0) | |
208 | 188 | let robbedUser = fraction(userAmount, ((eff[idxUserPieces] * M8) + eff[idxUserAcres]), ((eff[idxTotalPieces] * M8) + eff[idxTotalAcres])) | |
209 | 189 | let unrobbedUser = fraction(userAvailable, ((eff[idxUserPieces] * M8) + eff[idxUserAcres]), ((eff[idxTotalPieces] * M8) + eff[idxTotalAcres])) | |
210 | 190 | [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, robbedUser, sLandDailyAmount, investFundTotal, unrobbedUser, effLastTime] | |
211 | 191 | } | |
212 | 192 | ||
213 | 193 | ||
194 | + | let SCALE8 = 100000000 | |
195 | + | ||
196 | + | let xpLevelScale = 3200 | |
197 | + | ||
198 | + | let xpLevelRecipPow = 4000 | |
199 | + | ||
200 | + | let numPointsOnLevelUp = 3 | |
201 | + | ||
202 | + | let wlgBaseAmountXp = 100000000000 | |
203 | + | ||
204 | + | func keyUserXP (addr) = ("userXP_" + addr) | |
205 | + | ||
206 | + | ||
207 | + | func keyUserLevel (addr) = ("userLevel_" + addr) | |
208 | + | ||
209 | + | ||
210 | + | let xpWlg = 10000 | |
211 | + | ||
212 | + | func levelByXP (xp) = fraction(xpLevelScale, pow(xp, 4, xpLevelRecipPow, 4, 4, DOWN), SCALE8) | |
213 | + | ||
214 | + | ||
215 | + | func levelUp (currLevel,newXP) = { | |
216 | + | let newLevel = levelByXP(newXP) | |
217 | + | [newLevel, (numPointsOnLevelUp * (newLevel - currLevel))] | |
218 | + | } | |
219 | + | ||
220 | + | ||
214 | 221 | let chain = take(drop(this.bytes, 1), 1) | |
215 | 222 | ||
216 | 223 | let usdtAssetId = match chain { | |
217 | 224 | case _ => | |
218 | 225 | if ((base58'2W' == $match0)) | |
219 | 226 | then base58'9wc3LXNA4TEBsXyKtoLE9mrbDD7WMHXvXrCjZvabLAsi' | |
220 | 227 | else if ((base58'2T' == $match0)) | |
221 | 228 | then base58'6mWwf9mZBjVgkC54idpyaZLQfAosD914wT8fGf2iiY63' | |
222 | 229 | else throw("Unknown chain") | |
223 | 230 | } | |
224 | 231 | ||
225 | 232 | let defaultRestAddressStr = match chain { | |
226 | 233 | case _ => | |
227 | 234 | if ((base58'2W' == $match0)) | |
228 | 235 | then "3PQCuvFbvh4LkPUnrnU1z3jnbA1p9m3WNhv" | |
229 | 236 | else if ((base58'2T' == $match0)) | |
230 | 237 | then "3MumkGGztCKAXpWDqxkddofqXSUbqQkvSJy" | |
231 | 238 | else throw("Unknown chain") | |
232 | 239 | } | |
233 | 240 | ||
234 | 241 | let arbitrageDelay = match chain { | |
235 | 242 | case _ => | |
236 | 243 | if ((base58'2W' == $match0)) | |
237 | 244 | then 86400000 | |
238 | 245 | else if ((base58'2T' == $match0)) | |
239 | 246 | then 60000 | |
240 | 247 | else throw("Unknown chain") | |
241 | 248 | } | |
242 | 249 | ||
243 | 250 | let SEP = "__" | |
244 | 251 | ||
245 | 252 | let MULT6 = 1000000 | |
246 | 253 | ||
247 | 254 | let MULT8 = 100000000 | |
248 | 255 | ||
249 | 256 | let MINSHOPPAYMENT = 100000 | |
250 | 257 | ||
251 | 258 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
252 | 259 | ||
253 | 260 | ||
254 | 261 | let IdxCfgStakingDapp = 1 | |
255 | 262 | ||
256 | 263 | let IdxCfgEconomyDapp = 2 | |
257 | 264 | ||
258 | 265 | let IdxCfgWlgDapp = 4 | |
259 | 266 | ||
260 | 267 | let IdxCfgPuzzlePoolDapp = 5 | |
261 | 268 | ||
262 | 269 | let IdxCfgInvestFundDapp = 6 | |
263 | 270 | ||
264 | 271 | let IdxCfgAcresDapp = 8 | |
265 | 272 | ||
266 | 273 | func keyRestCfg () = "%s__restConfig" | |
267 | 274 | ||
268 | 275 | ||
269 | 276 | func keyRestAddress () = "%s__restAddr" | |
270 | 277 | ||
271 | 278 | ||
272 | 279 | func readRestCfgOrFail (rest) = split_4C(getStringOrFail(rest, keyRestCfg()), SEP) | |
273 | 280 | ||
274 | 281 | ||
275 | 282 | func getContractAddressOrFail (restCfg,idx) = valueOrErrorMessage(addressFromString(restCfg[idx]), ("Rest cfg doesn't contain address at index " + toString(idx))) | |
276 | 283 | ||
277 | 284 | ||
278 | 285 | let restContract = addressFromStringValue(valueOrElse(getString(this, keyRestAddress()), defaultRestAddressStr)) | |
279 | 286 | ||
280 | 287 | let restCfg = readRestCfgOrFail(restContract) | |
281 | 288 | ||
282 | 289 | let stakingContract = getContractAddressOrFail(restCfg, IdxCfgStakingDapp) | |
283 | 290 | ||
284 | 291 | let economyContract = getContractAddressOrFail(restCfg, IdxCfgEconomyDapp) | |
285 | 292 | ||
286 | 293 | let wlgContract = getContractAddressOrFail(restCfg, IdxCfgWlgDapp) | |
287 | 294 | ||
288 | 295 | let puzzlePoolContract = getContractAddressOrFail(restCfg, IdxCfgPuzzlePoolDapp) | |
289 | 296 | ||
290 | 297 | let investFundContract = getContractAddressOrFail(restCfg, IdxCfgInvestFundDapp) | |
291 | 298 | ||
292 | 299 | let acresContract = getContractAddressOrFail(restCfg, IdxCfgAcresDapp) | |
293 | 300 | ||
294 | 301 | let wlgAssetIdKey = "wlg_assetId" | |
295 | 302 | ||
296 | 303 | let wlgAssetId = valueOrErrorMessage(getBinary(wlgContract, wlgAssetIdKey), "WLGOLD is not issued yet") | |
304 | + | ||
305 | + | let idxWlgAmount = 0 | |
306 | + | ||
307 | + | let idxWlgPrice = 1 | |
308 | + | ||
309 | + | let idxWlgFunds = 2 | |
310 | + | ||
311 | + | let idxWlgIssueTime = 7 | |
312 | + | ||
313 | + | let idxWlgMarketingAmLeft = 10 | |
314 | + | ||
315 | + | let idxWlgMarketingAmAvailNow = 11 | |
316 | + | ||
317 | + | let idxWlgTeamAmLeft = 14 | |
318 | + | ||
319 | + | let idxWlgTeamAmAvailNow = 15 | |
320 | + | ||
321 | + | let idxWlgActAmLeft = 18 | |
322 | + | ||
323 | + | let idxWlgActAmAvailNow = 19 | |
324 | + | ||
325 | + | let idxWlgAmLeftTotal = 22 | |
326 | + | ||
327 | + | let idxWlgUserAmAvailNow = 25 | |
328 | + | ||
329 | + | let idxWlgUserTotalAvail = 28 | |
330 | + | ||
331 | + | let idxWlgEffUserTime = 29 | |
297 | 332 | ||
298 | 333 | let IdxEffUser = 1 | |
299 | 334 | ||
300 | 335 | func keyResProportions () = "resTypesProportions" | |
301 | 336 | ||
302 | 337 | ||
303 | 338 | func keyStakedPiecesByOwner (ownerAddr) = ("stakedPiecesByOwner_" + ownerAddr) | |
304 | 339 | ||
305 | 340 | ||
306 | 341 | func asInt (v) = match v { | |
307 | 342 | case n: Int => | |
308 | 343 | n | |
309 | 344 | case _ => | |
310 | 345 | throw("fail to cast into Int") | |
311 | 346 | } | |
312 | 347 | ||
313 | 348 | ||
314 | 349 | func getVotingPower (userAddrStrOrEmpty) = { | |
315 | 350 | let props = split(valueOrElse(getString(stakingContract, keyResProportions()), "0_0_0_0_0_0"), "_") | |
316 | 351 | func adder (acc,item) = (acc + parseIntValue(item)) | |
317 | 352 | ||
318 | 353 | let totalPower = { | |
319 | 354 | let $l = props | |
320 | 355 | let $s = size($l) | |
321 | 356 | let $acc0 = 0 | |
322 | 357 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
323 | 358 | then $a | |
324 | 359 | else adder($a, $l[$i]) | |
325 | 360 | ||
326 | 361 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
327 | 362 | then $a | |
328 | 363 | else throw("List size exceeds 6") | |
329 | 364 | ||
330 | 365 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
331 | 366 | } | |
332 | 367 | let usersPower = valueOrElse(getInteger(stakingContract, keyStakedPiecesByOwner(userAddrStrOrEmpty)), 0) | |
333 | 368 | [totalPower, usersPower] | |
334 | 369 | } | |
335 | 370 | ||
336 | 371 | ||
337 | 372 | func fixedPoint (val,decimals) = { | |
338 | 373 | let tenPow = pow(10, 0, decimals, 0, 0, DOWN) | |
339 | 374 | let lowPart = toString((val % tenPow)) | |
340 | 375 | let zeroes = drop(toString(tenPow), (1 + size(lowPart))) | |
341 | 376 | (((toString((val / tenPow)) + ".") + zeroes) + lowPart) | |
342 | 377 | } | |
343 | 378 | ||
344 | 379 | ||
345 | 380 | let profitAddrKey = "profitAddr" | |
346 | 381 | ||
347 | 382 | let stakersAmountPaidTotalKey = "stakersAmountPaidTotal" | |
348 | 383 | ||
349 | 384 | func keyStakersAmountPaidUser (addr) = ("stakersAmountPaidUser_" + addr) | |
350 | 385 | ||
351 | 386 | ||
352 | 387 | func prolog () = asInt(invoke(stakingContract, "saveLastTx", nil, nil)) | |
353 | 388 | ||
354 | 389 | ||
355 | 390 | func getSwapLimitWlg (addr) = { | |
356 | 391 | let lastTime = valueOrElse(getInteger(keyLastArbTimeByUser(addr)), 0) | |
357 | 392 | let now = lastBlock.timestamp | |
358 | 393 | if ((arbitrageDelay > (now - lastTime))) | |
359 | 394 | then throw((("Arbitrages are possible once a " + toString((arbitrageDelay / 60000))) + "min")) | |
360 | 395 | else { | |
361 | 396 | let pieces = getVotingPower(addr)[IdxEffUser] | |
362 | 397 | let acresAmount = valueOrElse(getInteger(acresContract, keyAcresStakedAmountByUser(addr)), 0) | |
363 | 398 | ((pieces * MULT8) + acresAmount) | |
364 | 399 | } | |
365 | 400 | } | |
366 | 401 | ||
367 | 402 | ||
368 | 403 | func claimInternal (addr,proportion6) = { | |
369 | 404 | let caller = addressFromStringValue(addr) | |
370 | 405 | let curStats = getWlgStats(addr, [restContract, stakingContract, economyContract, wlgContract, puzzlePoolContract, investFundContract, acresContract], usdtAssetId, 0, proportion6) | |
371 | 406 | let now = lastBlock.timestamp | |
372 | 407 | let issueTime = curStats[idxWlgIssueTime] | |
373 | 408 | let marketingAmountLeft = curStats[idxWlgMarketingAmLeft] | |
374 | 409 | let marketingAmount = curStats[idxWlgMarketingAmAvailNow] | |
375 | 410 | let teamAmountLeft = curStats[idxWlgTeamAmLeft] | |
376 | 411 | let teamAmount = curStats[idxWlgTeamAmAvailNow] | |
377 | 412 | let actAmountLeft = curStats[idxWlgActAmLeft] | |
378 | 413 | let actAmount = curStats[idxWlgActAmAvailNow] | |
379 | 414 | if (((now - issueTime) > CHECKTIME)) | |
380 | 415 | then throw("Please modify contract for next 1.5 years, according to stats") | |
381 | 416 | else { | |
382 | 417 | let userAmount = curStats[idxWlgUserAmAvailNow] | |
383 | 418 | let userKey = keyStakersAmountPaidUser(addr) | |
384 | 419 | let userTotal = curStats[idxWlgUserTotalAvail] | |
385 | 420 | let userEffTime = curStats[idxWlgEffUserTime] | |
386 | 421 | $Tuple2([ScriptTransfer(addressFromStringValue(value(getString(marketingAddrKey))), marketingAmount, wlgAssetId), ScriptTransfer(addressFromStringValue(value(getString(teamAddrKey))), teamAmount, wlgAssetId), ScriptTransfer(restContract, actAmount, wlgAssetId), IntegerEntry(userKey, (valueOrElse(getInteger(userKey), 0) + userAmount)), IntegerEntry(stakersAmountPaidTotalKey, (valueOrElse(getInteger(stakersAmountPaidTotalKey), 0) + userTotal)), IntegerEntry(stakersAmountLeftKey, (curStats[idxWlgAmLeftTotal] - userTotal)), IntegerEntry(marketingAmountLeftKey, (marketingAmountLeft - marketingAmount)), IntegerEntry(lastMarketingTimeKey, now), IntegerEntry(teamAmountLeftKey, (teamAmountLeft - teamAmount)), IntegerEntry(lastTeamTimeKey, now), IntegerEntry(actAmountLeftKey, (actAmountLeft - actAmount)), IntegerEntry(lastActivitiesTimeKey, now), IntegerEntry(keyLastClaimedTimeByUser(addr), userEffTime)], $Tuple2(userAmount, userTotal)) | |
387 | 422 | } | |
388 | 423 | } | |
389 | 424 | ||
390 | 425 | ||
426 | + | func takeXpInternal (addr,delta) = { | |
427 | + | let now = lastBlock.timestamp | |
428 | + | let timeKey = keyWlgStakedTimeByUser(addr) | |
429 | + | let amountKey = keyWlgStakedAmountByUser(addr) | |
430 | + | let lastTime = valueOrElse(getInteger(timeKey), 0) | |
431 | + | let oldUser = valueOrElse(getInteger(amountKey), 0) | |
432 | + | let oldTotal = valueOrElse(getInteger(wlgStakedTotalKey), 0) | |
433 | + | let xp = fraction(fraction(xpWlg, oldUser, wlgBaseAmountXp), (lastTime - now), DAYMILLIS) | |
434 | + | $Tuple3([IntegerEntry(timeKey, now), IntegerEntry(amountKey, (oldUser + delta)), IntegerEntry(wlgStakedTotalKey, (oldTotal + delta))], xp, oldUser) | |
435 | + | } | |
436 | + | ||
437 | + | ||
391 | 438 | @Callable(i) | |
392 | 439 | func constructorV1 (restAddr,marketingAddr,teamAddr,profitAddr) = if ((i.caller != this)) | |
393 | 440 | then throw("Permission denied") | |
394 | 441 | else if (isDefined(getBinary(wlgAssetIdKey))) | |
395 | 442 | then throw("Already initialized") | |
396 | 443 | else { | |
397 | 444 | let issuedAmount = MILLION6 | |
398 | 445 | let issue = Issue("WLGOLD", "WavesLands Gold investment token", issuedAmount, 8, true, unit, 0) | |
399 | 446 | let assetId = calculateAssetId(issue) | |
400 | 447 | [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)] | |
401 | 448 | } | |
402 | 449 | ||
403 | 450 | ||
404 | 451 | ||
405 | 452 | @Callable(i) | |
406 | 453 | func buyWlg (minAmount) = { | |
407 | 454 | let prologResult = prolog() | |
408 | 455 | if ((size(i.payments) != 1)) | |
409 | 456 | then throw("exactly 1 payment must be attached") | |
410 | 457 | else { | |
411 | 458 | let pmt = i.payments[0] | |
412 | 459 | let usdtAmt = pmt.amount | |
413 | - | let pmtAssetId = valueOrErrorMessage(pmt.assetId, "USDT payments only!") | |
414 | - | if ((pmtAssetId != usdtAssetId)) | |
460 | + | if (if (!(isDefined(pmt.assetId))) | |
461 | + | then true | |
462 | + | else (value(pmt.assetId) != usdtAssetId)) | |
415 | 463 | then throw("USDT payments only!") | |
416 | 464 | else { | |
417 | 465 | let caller = i.caller | |
418 | 466 | let addr = toString(caller) | |
419 | 467 | if ((MINSHOPPAYMENT > usdtAmt)) | |
420 | 468 | then throw((("You can trade min " + fixedPoint(MINSHOPPAYMENT, 6)) + " USDT")) | |
421 | 469 | else { | |
422 | 470 | let curStats = getWlgStats("", [restContract, stakingContract, economyContract, wlgContract, puzzlePoolContract, investFundContract, acresContract], usdtAssetId, usdtAmt, MULT6) | |
423 | 471 | let curWlgAmount = curStats[idxWlgAmount] | |
424 | 472 | let fundsUsd = curStats[idxWlgFunds] | |
425 | 473 | let wlgPrice = fraction(fundsUsd, MULT8, curWlgAmount) | |
426 | 474 | let buyPrice = fraction(wlgPrice, 6, 5) | |
427 | 475 | let wlgAmount = fraction(usdtAmt, MULT8, buyPrice) | |
428 | 476 | let maxWlg = getSwapLimitWlg(addr) | |
429 | 477 | if ((wlgAmount > maxWlg)) | |
430 | 478 | then throw((("You can get max " + fixedPoint(maxWlg, 8)) + " WLGOLD")) | |
431 | 479 | else if ((minAmount > wlgAmount)) | |
432 | 480 | then throw("Price changed during operation, please try again") | |
433 | 481 | else { | |
434 | 482 | let profitAmount = (usdtAmt / 6) | |
435 | 483 | let deltaFunds = (usdtAmt - profitAmount) | |
436 | 484 | let reissued = fraction(curWlgAmount, deltaFunds, fundsUsd) | |
437 | 485 | $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) | |
438 | 486 | } | |
439 | 487 | } | |
440 | 488 | } | |
441 | 489 | } | |
442 | 490 | } | |
443 | 491 | ||
444 | 492 | ||
445 | 493 | ||
446 | 494 | @Callable(i) | |
447 | 495 | func sellWlg (minAmount) = { | |
448 | 496 | let prologResult = prolog() | |
449 | 497 | if ((size(i.payments) != 1)) | |
450 | 498 | then throw("exactly 1 payment must be attached") | |
451 | 499 | else { | |
452 | 500 | let pmt = i.payments[0] | |
453 | 501 | let wlgAmt = pmt.amount | |
454 | 502 | let caller = i.caller | |
455 | 503 | let addr = toString(caller) | |
456 | 504 | let maxWlg = getSwapLimitWlg(addr) | |
457 | 505 | if ((wlgAmt > maxWlg)) | |
458 | 506 | then throw((("You can spend max " + fixedPoint(maxWlg, 8)) + " WLGOLD")) | |
459 | - | else { | |
460 | - | let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WLGOLD payments only!") | |
461 | - | if ((pmtAssetId != wlgAssetId)) | |
462 | - | then throw("WLGOLD payments only!") | |
463 | - | else { | |
464 | - | let curStats = getWlgStats("", [restContract, stakingContract, economyContract, wlgContract, puzzlePoolContract, investFundContract, acresContract], usdtAssetId, 0, MULT6) | |
465 | - | let curWlgAmount = curStats[idxWlgAmount] | |
466 | - | let sellPrice = fraction(curStats[idxWlgPrice], 4, 5) | |
467 | - | let usdtAmt = fraction(wlgAmt, sellPrice, MULT8) | |
468 | - | if ((MINSHOPPAYMENT > usdtAmt)) | |
469 | - | then throw((("You can trade min " + fixedPoint(MINSHOPPAYMENT, 6)) + " USDT")) | |
470 | - | else if ((minAmount > usdtAmt)) | |
471 | - | then throw("Price changed during operation, please try again") | |
472 | - | else { | |
473 | - | let profitAmount = (usdtAmt / 4) | |
474 | - | let burned = fraction((usdtAmt + profitAmount), curWlgAmount, curStats[idxWlgFunds]) | |
475 | - | $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) | |
476 | - | } | |
477 | - | } | |
478 | - | } | |
507 | + | else if (if (!(isDefined(pmt.assetId))) | |
508 | + | then true | |
509 | + | else (value(pmt.assetId) != wlgAssetId)) | |
510 | + | then throw("WLGOLD payments only!") | |
511 | + | else { | |
512 | + | let curStats = getWlgStats("", [restContract, stakingContract, economyContract, wlgContract, puzzlePoolContract, investFundContract, acresContract], usdtAssetId, 0, MULT6) | |
513 | + | let curWlgAmount = curStats[idxWlgAmount] | |
514 | + | let sellPrice = fraction(curStats[idxWlgPrice], 4, 5) | |
515 | + | let usdtAmt = fraction(wlgAmt, sellPrice, MULT8) | |
516 | + | if ((MINSHOPPAYMENT > usdtAmt)) | |
517 | + | then throw((("You can trade min " + fixedPoint(MINSHOPPAYMENT, 6)) + " USDT")) | |
518 | + | else if ((minAmount > usdtAmt)) | |
519 | + | then throw("Price changed during operation, please try again") | |
520 | + | else { | |
521 | + | let profitAmount = (usdtAmt / 4) | |
522 | + | let burned = fraction((usdtAmt + profitAmount), curWlgAmount, curStats[idxWlgFunds]) | |
523 | + | $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) | |
524 | + | } | |
525 | + | } | |
479 | 526 | } | |
480 | 527 | } | |
481 | 528 | ||
482 | 529 | ||
483 | 530 | ||
484 | 531 | @Callable(i) | |
485 | 532 | func claim () = { | |
486 | 533 | let prologResult = prolog() | |
487 | 534 | if ((size(i.payments) != 0)) | |
488 | 535 | then throw("No payments required") | |
489 | 536 | else { | |
490 | 537 | let r = claimInternal(toString(i.caller), MULT6) | |
491 | 538 | let actions = r._1 | |
492 | 539 | $Tuple2((actions :+ ScriptTransfer(i.caller, r._2._1, wlgAssetId)), prologResult) | |
493 | 540 | } | |
494 | 541 | } | |
495 | 542 | ||
496 | 543 | ||
497 | 544 | ||
498 | 545 | @Callable(i) | |
499 | 546 | func onStakeUnstakeLand (addr) = if (if ((i.caller != stakingContract)) | |
500 | 547 | then (i.caller != acresContract) | |
501 | 548 | else false) | |
502 | 549 | then throw("Permission denied") | |
503 | 550 | else { | |
504 | 551 | let r = claimInternal(addr, MULT6) | |
505 | 552 | let actions = r._1 | |
506 | 553 | $Tuple2((actions :+ ScriptTransfer(addressFromStringValue(addr), r._2._1, wlgAssetId)), r._2) | |
507 | 554 | } | |
508 | 555 | ||
509 | 556 | ||
510 | 557 | ||
511 | 558 | @Callable(i) | |
512 | 559 | func claimRob (owner,robber,ownerProportion6) = if ((i.caller != stakingContract)) | |
513 | 560 | then throw("Permission denied") | |
514 | 561 | else { | |
515 | 562 | let r = claimInternal(owner, ownerProportion6) | |
516 | 563 | $Tuple2((r._1 :+ ScriptTransfer(addressFromStringValue(robber), (r._2._2 - r._2._1), wlgAssetId)), r._2) | |
517 | 564 | } | |
518 | 565 | ||
519 | 566 | ||
567 | + | ||
568 | + | @Callable(i) | |
569 | + | func stakeWlgold () = { | |
570 | + | let prologResult = prolog() | |
571 | + | if ((size(i.payments) != 1)) | |
572 | + | then throw("exactly 1 payment must be attached") | |
573 | + | else { | |
574 | + | let pmt = i.payments[0] | |
575 | + | let amt = pmt.amount | |
576 | + | let addr = toString(i.caller) | |
577 | + | if (if (!(isDefined(pmt.assetId))) | |
578 | + | then true | |
579 | + | else (value(pmt.assetId) != wlgAssetId)) | |
580 | + | then throw("WLGOLD payments only!") | |
581 | + | else { | |
582 | + | let $t01003810083 = takeXpInternal(addr, amt) | |
583 | + | let actions = $t01003810083._1 | |
584 | + | let xp = $t01003810083._2 | |
585 | + | let accStatsResult = asInt(invoke(stakingContract, "updateAccStats", [addr, xp], nil)) | |
586 | + | $Tuple2(actions, $Tuple2(prologResult, accStatsResult)) | |
587 | + | } | |
588 | + | } | |
589 | + | } | |
590 | + | ||
591 | + | ||
592 | + | ||
593 | + | @Callable(i) | |
594 | + | func unstakeWlgold (amount) = { | |
595 | + | let prologResult = prolog() | |
596 | + | if ((size(i.payments) != 0)) | |
597 | + | then throw("No payments required") | |
598 | + | else if ((0 >= amount)) | |
599 | + | then throw("Amount should be positive") | |
600 | + | else { | |
601 | + | let addr = toString(i.caller) | |
602 | + | let $t01046710525 = takeXpInternal(addr, -(amount)) | |
603 | + | let actions = $t01046710525._1 | |
604 | + | let xp = $t01046710525._2 | |
605 | + | let oldUser = $t01046710525._3 | |
606 | + | if ((amount > oldUser)) | |
607 | + | then throw(((("You have only " + fixedPoint(oldUser, 8)) + " WLGOLD staked, tried to unstake ") + fixedPoint(amount, 8))) | |
608 | + | else { | |
609 | + | let accStatsResult = asInt(invoke(stakingContract, "updateAccStats", [addr, xp], nil)) | |
610 | + | $Tuple2(actions, $Tuple2(prologResult, accStatsResult)) | |
611 | + | } | |
612 | + | } | |
613 | + | } | |
614 | + | ||
615 | + | ||
616 | + | ||
617 | + | @Callable(i) | |
618 | + | func takeWlgXp (addr) = if ((i.caller != stakingContract)) | |
619 | + | then throw("Permission denied") | |
620 | + | else { | |
621 | + | let $t01095610999 = takeXpInternal(addr, 0) | |
622 | + | let actions = $t01095610999._1 | |
623 | + | let xp = $t01095610999._2 | |
624 | + | $Tuple2(actions, xp) | |
625 | + | } | |
626 | + | ||
627 | + | ||
628 | + | ||
629 | + | @Callable(i) | |
630 | + | func checkWlgXpREADONLY (addr) = { | |
631 | + | let $t01107611124 = takeXpInternal(addr, 0) | |
632 | + | let ignored = $t01107611124._1 | |
633 | + | let deltaXP = $t01107611124._2 | |
634 | + | let lvlKey = keyUserLevel(addr) | |
635 | + | let xpKey = keyUserXP(addr) | |
636 | + | let xp = valueOrElse(getInteger(stakingContract, xpKey), 0) | |
637 | + | let newXP = (xp + deltaXP) | |
638 | + | let lvlPoints = levelUp(valueOrElse(getInteger(stakingContract, lvlKey), 0), newXP) | |
639 | + | $Tuple2(nil, lvlPoints) | |
640 | + | } | |
641 | + | ||
642 | + |
github/deemru/w8io/026f985 64.17 ms ◑