tx · CyTgVDAzhF9f1SfbEcttXUVfn6c4BnekdPZh161sFzW1

3N7HtrKeFFLz5oy6PfGv1Lg3GwPk4gCPdGy:  -0.01500000 Waves

2023.08.06 20:22 [2699023] smart account 3N7HtrKeFFLz5oy6PfGv1Lg3GwPk4gCPdGy > SELF 0.00000000 Waves

{ "type": 13, "id": "CyTgVDAzhF9f1SfbEcttXUVfn6c4BnekdPZh161sFzW1", "fee": 1500000, "feeAssetId": null, "timestamp": 1691342694088, "version": 2, "chainId": 84, "sender": "3N7HtrKeFFLz5oy6PfGv1Lg3GwPk4gCPdGy", "senderPublicKey": "FsR18761ZAsUqsTd7TK3XmR6bhihs1UXVmpHYxz5JzQ1", "proofs": [ "2tEG9Fr9SX2pM1vqmHzMaJpetS9gkCX2GgNXXgAH96BqBCyA73u3bdYd5PqJdtAMgQWSoynEFR8BDP4RpW7YJHMo" ], "script": "base64:BgIbCAISBgoECAgICBIDCgEBEgMKAQESABIDCgEIWAACTTYAwIQ9AAJNOACAwtcvAAhNSUxMSU9ONgCAgOmDsd4WAA5NQVJLRVRJTkdTSEFSRQCgjQYACVRFQU1TSEFSRQDAmgwADUFDVElWSVRZU0hBUkUAoI0GAAtQTEFZRVJTSEFSRQCAtRgACllFQVJNSUxMSVMAgIbrx3UACUNIRUNLVElNRQCAyeCrsAEAA0RBWQCAuJkpABBtYXJrZXRpbmdBZGRyS2V5Ag1tYXJrZXRpbmdBZGRyAAt0ZWFtQWRkcktleQIIdGVhbUFkZHIAFGxhc3RNYXJrZXRpbmdUaW1lS2V5AhlsYXN0Q2xhaW1lZFRpbWVfbWFya2V0aW5nABZtYXJrZXRpbmdBbW91bnRMZWZ0S2V5AhNtYXJrZXRpbmdBbW91bnRMZWZ0AA9sYXN0VGVhbVRpbWVLZXkCFGxhc3RDbGFpbWVkVGltZV90ZWFtABF0ZWFtQW1vdW50TGVmdEtleQIOdGVhbUFtb3VudExlZnQAFWxhc3RBY3Rpdml0aWVzVGltZUtleQIabGFzdENsYWlt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udHMAAAkAAgECFE5vIHBheW1lbnRzIHJlcXVpcmVkBAdhY3Rpb25zCAkBDWNsYWltSW50ZXJuYWwBCQClCAEIBQFpBmNhbGxlcgJfMQkAlAoCBQdhY3Rpb25zBQxwcm9sb2dSZXN1bHQBaQESb25TdGFrZVVuc3Rha2VMYW5kAQRhZGRyAwkBAiE9AggFAWkGY2FsbGVyBQ9zdGFraW5nQ29udHJhY3QJAAIBAhFQZXJtaXNzaW9uIGRlbmllZAkBDWNsYWltSW50ZXJuYWwBBQRhZGRyAI1hySM=", "height": 2699023, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GtEuLs37Jn9PsBnEw44251korqSR7EFyYMXFz332XE29 Next: AZpenSdpDEr3T6NYRLJeAx6biDs47JvLuB2kCBBssEHQ Diff:
OldNewDifferences
159159 }
160160
161161
162-let KSALLOWWLGOLD = true
163-
164162 let chain = take(drop(this.bytes, 1), 1)
165163
166164 let usdtAssetId = match chain {
319317 }
320318
321319
322-func claimInternal (addr) = if (!(KSALLOWWLGOLD))
323- then $Tuple2(nil, 0)
324- else {
325- let caller = addressFromStringValue(addr)
326- let curStats = getWlgStats(addr, [restContract, stakingContract, economyContract, govContract, wlgContract, puzzlePoolContract, investFundContract], usdtAssetId, 0)
327- let now = lastBlock.timestamp
328- let issueTime = curStats[idxWlgIssueTime]
329- let marketingAmountLeft = curStats[idxWlgMarketingAmLeft]
330- let marketingAmount = curStats[idxWlgMarketingAmAvailNow]
331- let teamAmountLeft = curStats[idxWlgTeamAmLeft]
332- let teamAmount = curStats[idxWlgTeamAmAvailNow]
333- let actAmountLeft = curStats[idxWlgActAmLeft]
334- let actAmount = curStats[idxWlgActAmAvailNow]
335- if (((now - issueTime) > CHECKTIME))
336- then throw("Please modify contract for next 1.5 years, according to stats")
337- else {
338- let userAmount = curStats[idxWlgUserAmAvailNow]
339- let userKey = keyStakersAmountPaidUser(addr)
340- $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, (curStats[idxWlgAmLeftTotal] - userAmount)), IntegerEntry(marketingAmountLeftKey, (marketingAmountLeft - marketingAmount)), IntegerEntry(lastMarketingTimeKey, now), IntegerEntry(teamAmountLeftKey, (teamAmountLeft - teamAmount)), IntegerEntry(lastTeamTimeKey, now), IntegerEntry(actAmountLeftKey, (actAmountLeft - actAmount)), IntegerEntry(lastActivitiesTimeKey, now), IntegerEntry(keyLastClaimedTimeByUser(addr), now)], userAmount)
341- }
342- }
320+func claimInternal (addr) = {
321+ let caller = addressFromStringValue(addr)
322+ let curStats = getWlgStats(addr, [restContract, stakingContract, economyContract, govContract, wlgContract, puzzlePoolContract, investFundContract], usdtAssetId, 0)
323+ let now = lastBlock.timestamp
324+ let issueTime = curStats[idxWlgIssueTime]
325+ let marketingAmountLeft = curStats[idxWlgMarketingAmLeft]
326+ let marketingAmount = curStats[idxWlgMarketingAmAvailNow]
327+ let teamAmountLeft = curStats[idxWlgTeamAmLeft]
328+ let teamAmount = curStats[idxWlgTeamAmAvailNow]
329+ let actAmountLeft = curStats[idxWlgActAmLeft]
330+ let actAmount = curStats[idxWlgActAmAvailNow]
331+ if (((now - issueTime) > CHECKTIME))
332+ then throw("Please modify contract for next 1.5 years, according to stats")
333+ else {
334+ let userAmount = curStats[idxWlgUserAmAvailNow]
335+ let userKey = keyStakersAmountPaidUser(addr)
336+ $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, (curStats[idxWlgAmLeftTotal] - userAmount)), IntegerEntry(marketingAmountLeftKey, (marketingAmountLeft - marketingAmount)), IntegerEntry(lastMarketingTimeKey, now), IntegerEntry(teamAmountLeftKey, (teamAmountLeft - teamAmount)), IntegerEntry(lastTeamTimeKey, now), IntegerEntry(actAmountLeftKey, (actAmountLeft - actAmount)), IntegerEntry(lastActivitiesTimeKey, now), IntegerEntry(keyLastClaimedTimeByUser(addr), now)], userAmount)
337+ }
338+ }
343339
344340
345341 @Callable(i)
357353
358354
359355 @Callable(i)
360-func buyWlg (minAmount) = if (!(KSALLOWWLGOLD))
361- then $Tuple2(nil, 0)
362- else {
363- let prologResult = prolog()
364- if ((size(i.payments) != 1))
365- then throw("exactly 1 payment must be attached")
366- else {
367- let pmt = i.payments[0]
368- let usdtAmt = pmt.amount
369- let pmtAssetId = valueOrErrorMessage(pmt.assetId, "USDT payments only!")
370- if ((pmtAssetId != usdtAssetId))
371- then throw("USDT payments only!")
372- else {
373- let caller = i.caller
374- let addr = toString(caller)
375- let maxUsdt = getSwapLimit(addr)
376- if ((usdtAmt > maxUsdt))
377- then throw((("You can spend max " + fixedPoint(maxUsdt, 6)) + " USDT"))
378- else if ((MINSHOPPAYMENT > usdtAmt))
379- then throw((("You can trade min " + fixedPoint(MINSHOPPAYMENT, 6)) + " USDT"))
380- else {
381- let curStats = getWlgStats("", [restContract, stakingContract, economyContract, govContract, wlgContract, puzzlePoolContract, investFundContract], usdtAssetId, usdtAmt)
382- let curWlgAmount = curStats[idxWlgAmount]
383- let fundsUsd = curStats[idxWlgFunds]
384- let wlgPrice = fraction(fundsUsd, MULT8, curWlgAmount)
385- let buyPrice = fraction(wlgPrice, 6, 5)
386- let wlgAmount = fraction(usdtAmt, MULT8, buyPrice)
387- if ((minAmount > wlgAmount))
388- then throw("Price changed during operation, please try again")
389- else {
390- let profitAmount = (usdtAmt / 6)
391- let deltaFunds = (usdtAmt - profitAmount)
392- let reissued = fraction(curWlgAmount, deltaFunds, fundsUsd)
393- $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)
394- }
395- }
396- }
397- }
398- }
356+func buyWlg (minAmount) = {
357+ let prologResult = prolog()
358+ if ((size(i.payments) != 1))
359+ then throw("exactly 1 payment must be attached")
360+ else {
361+ let pmt = i.payments[0]
362+ let usdtAmt = pmt.amount
363+ let pmtAssetId = valueOrErrorMessage(pmt.assetId, "USDT payments only!")
364+ if ((pmtAssetId != usdtAssetId))
365+ then throw("USDT payments only!")
366+ else {
367+ let caller = i.caller
368+ let addr = toString(caller)
369+ let maxUsdt = getSwapLimit(addr)
370+ if ((usdtAmt > maxUsdt))
371+ then throw((("You can spend max " + fixedPoint(maxUsdt, 6)) + " USDT"))
372+ else if ((MINSHOPPAYMENT > usdtAmt))
373+ then throw((("You can trade min " + fixedPoint(MINSHOPPAYMENT, 6)) + " USDT"))
374+ else {
375+ let curStats = getWlgStats("", [restContract, stakingContract, economyContract, govContract, wlgContract, puzzlePoolContract, investFundContract], usdtAssetId, usdtAmt)
376+ let curWlgAmount = curStats[idxWlgAmount]
377+ let fundsUsd = curStats[idxWlgFunds]
378+ let wlgPrice = fraction(fundsUsd, MULT8, curWlgAmount)
379+ let buyPrice = fraction(wlgPrice, 6, 5)
380+ let wlgAmount = fraction(usdtAmt, MULT8, buyPrice)
381+ if ((minAmount > wlgAmount))
382+ then throw("Price changed during operation, please try again")
383+ else {
384+ let profitAmount = (usdtAmt / 6)
385+ let deltaFunds = (usdtAmt - profitAmount)
386+ let reissued = fraction(curWlgAmount, deltaFunds, fundsUsd)
387+ $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)
388+ }
389+ }
390+ }
391+ }
392+ }
399393
400394
401395
402396 @Callable(i)
403-func sellWlg (minAmount) = if (!(KSALLOWWLGOLD))
404- then $Tuple2(nil, 0)
405- else {
406- let prologResult = prolog()
407- if ((size(i.payments) != 1))
408- then throw("exactly 1 payment must be attached")
409- else {
410- let pmt = i.payments[0]
411- let wlgAmt = pmt.amount
412- let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WLGOLD payments only!")
413- if ((pmtAssetId != wlgAssetId))
414- then throw("WLGOLD payments only!")
415- else {
416- let caller = i.caller
417- let addr = toString(caller)
418- let maxUsdt = getSwapLimit(addr)
419- let curStats = getWlgStats("", [restContract, stakingContract, economyContract, govContract, wlgContract, puzzlePoolContract, investFundContract], usdtAssetId, 0)
420- let curWlgAmount = curStats[idxWlgAmount]
421- let sellPrice = fraction(curStats[idxWlgPrice], 4, 5)
422- let usdtAmt = fraction(wlgAmt, sellPrice, MULT8)
423- if ((usdtAmt > maxUsdt))
424- then throw((("You can get max " + fixedPoint(maxUsdt, 6)) + " USDT"))
425- else if ((MINSHOPPAYMENT > usdtAmt))
426- then throw((("You can trade min " + fixedPoint(MINSHOPPAYMENT, 6)) + " USDT"))
427- else if ((minAmount > usdtAmt))
428- then throw("Price changed during operation, please try again")
429- else {
430- let profitAmount = (usdtAmt / 4)
431- let burned = fraction((usdtAmt + profitAmount), curWlgAmount, curStats[idxWlgFunds])
432- $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)
433- }
434- }
435- }
436- }
397+func sellWlg (minAmount) = {
398+ let prologResult = prolog()
399+ if ((size(i.payments) != 1))
400+ then throw("exactly 1 payment must be attached")
401+ else {
402+ let pmt = i.payments[0]
403+ let wlgAmt = pmt.amount
404+ let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WLGOLD payments only!")
405+ if ((pmtAssetId != wlgAssetId))
406+ then throw("WLGOLD payments only!")
407+ else {
408+ let caller = i.caller
409+ let addr = toString(caller)
410+ let maxUsdt = getSwapLimit(addr)
411+ let curStats = getWlgStats("", [restContract, stakingContract, economyContract, govContract, wlgContract, puzzlePoolContract, investFundContract], usdtAssetId, 0)
412+ let curWlgAmount = curStats[idxWlgAmount]
413+ let sellPrice = fraction(curStats[idxWlgPrice], 4, 5)
414+ let usdtAmt = fraction(wlgAmt, sellPrice, MULT8)
415+ if ((usdtAmt > maxUsdt))
416+ then throw((("You can get max " + fixedPoint(maxUsdt, 6)) + " USDT"))
417+ else if ((MINSHOPPAYMENT > usdtAmt))
418+ then throw((("You can trade min " + fixedPoint(MINSHOPPAYMENT, 6)) + " USDT"))
419+ else if ((minAmount > usdtAmt))
420+ then throw("Price changed during operation, please try again")
421+ else {
422+ let profitAmount = (usdtAmt / 4)
423+ let burned = fraction((usdtAmt + profitAmount), curWlgAmount, curStats[idxWlgFunds])
424+ $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)
425+ }
426+ }
427+ }
428+ }
437429
438430
439431
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let M6 = 1000000
55
66 let M8 = 100000000
77
88 let MILLION6 = 100000000000000
99
1010 let MARKETINGSHARE = 100000
1111
1212 let TEAMSHARE = 200000
1313
1414 let ACTIVITYSHARE = 100000
1515
1616 let PLAYERSHARE = 400000
1717
1818 let YEARMILLIS = 31557600000
1919
2020 let CHECKTIME = 47336400000
2121
2222 let DAY = 86400000
2323
2424 let marketingAddrKey = "marketingAddr"
2525
2626 let teamAddrKey = "teamAddr"
2727
2828 let lastMarketingTimeKey = "lastClaimedTime_marketing"
2929
3030 let marketingAmountLeftKey = "marketingAmountLeft"
3131
3232 let lastTeamTimeKey = "lastClaimedTime_team"
3333
3434 let teamAmountLeftKey = "teamAmountLeft"
3535
3636 let lastActivitiesTimeKey = "lastClaimedTime_activities"
3737
3838 let actAmountLeftKey = "activitiesAmountLeft"
3939
4040 let stakersAmountLeftKey = "stakersAmountLeft"
4141
4242 func keyLastClaimedTimeByUser (addr) = ("lastClaimedTimeUser_" + addr)
4343
4444
4545 func keyLastArbTimeByUser (addr) = ("lastArbTimeUser_" + addr)
4646
4747
4848 func distributionByPeriod (period) = fraction(MILLION6, (PLAYERSHARE * (period + 1)), (6 * M6))
4949
5050
5151 let wlgIssueTimeKey = "wlg_issueTime"
5252
5353 let wlgIssuedAmountKey = "wlg_issuedAmount"
5454
5555 let zbIssuedAmountKey = "zbill_issuedAmount"
5656
5757 let idxWlgAmount = 0
5858
5959 let idxWlgPrice = 1
6060
6161 let idxWlgFunds = 2
6262
6363 let idxWlgIssueTime = 7
6464
6565 let idxWlgMarketingAmLeft = 10
6666
6767 let idxWlgMarketingAmAvailNow = 11
6868
6969 let idxWlgTeamAmLeft = 14
7070
7171 let idxWlgTeamAmAvailNow = 15
7272
7373 let idxWlgActAmLeft = 18
7474
7575 let idxWlgActAmAvailNow = 19
7676
7777 let idxWlgAmLeftTotal = 22
7878
7979 let idxWlgUserAmAvailNow = 25
8080
8181 let dappRest = 0
8282
8383 let dappStaking = 1
8484
8585 let dappEconomy = 2
8686
8787 let dappWlg = 4
8888
8989 let dappPuzzle = 5
9090
9191 let dappInvestFund = 6
9292
9393 func getPieces (userAddrStrOrEmpty,stakingContract) = {
9494 let props = split(valueOrElse(getString(stakingContract, "resTypesProportions"), "0_0_0_0_0_0"), "_")
9595 func adder (acc,item) = (acc + parseIntValue(item))
9696
9797 let totalPower = {
9898 let $l = props
9999 let $s = size($l)
100100 let $acc0 = 0
101101 func $f0_1 ($a,$i) = if (($i >= $s))
102102 then $a
103103 else adder($a, $l[$i])
104104
105105 func $f0_2 ($a,$i) = if (($i >= $s))
106106 then $a
107107 else throw("List size exceeds 6")
108108
109109 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6)
110110 }
111111 let usersPower = valueOrElse(getInteger(stakingContract, ("stakedPiecesByOwner_" + userAddrStrOrEmpty)), 0)
112112 [totalPower, usersPower]
113113 }
114114
115115
116116 func getWlgStats (userAddrOpt,contracts,usdtId,usdtBalanceCorrection) = {
117117 let issuedAmount = valueOrErrorMessage(getInteger(contracts[dappWlg], wlgIssuedAmountKey), "WLGOLD is not issued yet")
118118 let economyUsd = assetBalance(contracts[dappEconomy], usdtId)
119119 let restUsd = assetBalance(contracts[dappRest], usdtId)
120120 let wlgUsd = (assetBalance(contracts[dappWlg], usdtId) - usdtBalanceCorrection)
121121 let puzzleUsd = assetBalance(contracts[dappPuzzle], usdtId)
122122 let investFundContract = contracts[dappInvestFund]
123123 let investFundTotal = (assetBalance(investFundContract, usdtId) + valueOrElse(getInteger(investFundContract, zbIssuedAmountKey), 0))
124124 let totalFundsUsd = ((economyUsd + wlgUsd) + investFundTotal)
125125 let wlgId = valueOrErrorMessage(getBinary(contracts[dappWlg], "wlg_assetId"), "Not initialized yet")
126126 let now = lastBlock.timestamp
127127 let issueTime = valueOrErrorMessage(getInteger(contracts[dappWlg], wlgIssueTimeKey), "Not initialized")
128128 let marketingTotal = fraction(MILLION6, MARKETINGSHARE, M6)
129129 let marketingAmountLeft = valueOrElse(getInteger(contracts[dappWlg], marketingAmountLeftKey), marketingTotal)
130130 let lastMarketingTime = valueOrElse(getInteger(contracts[dappWlg], lastMarketingTimeKey), issueTime)
131131 let marketingAddr = addressFromStringValue(value(getString(contracts[dappWlg], marketingAddrKey)))
132132 let marketingAmountAvailableNow = min([fraction(marketingTotal, (now - lastMarketingTime), YEARMILLIS), marketingAmountLeft])
133133 let marketingWlgold = assetBalance(marketingAddr, wlgId)
134134 let teamTotal = fraction(MILLION6, TEAMSHARE, M6)
135135 let teamAmountLeft = valueOrElse(getInteger(contracts[dappWlg], teamAmountLeftKey), teamTotal)
136136 let lastTeamTime = valueOrElse(getInteger(contracts[dappWlg], lastTeamTimeKey), issueTime)
137137 let teamAddr = addressFromStringValue(value(getString(contracts[dappWlg], teamAddrKey)))
138138 let teamAmountAvailableNow = min([fraction(teamTotal, (now - lastTeamTime), (3 * YEARMILLIS)), teamAmountLeft])
139139 let teamWlgold = assetBalance(teamAddr, wlgId)
140140 let actTotal = fraction(MILLION6, ACTIVITYSHARE, M6)
141141 let actAmountLeft = valueOrElse(getInteger(contracts[dappWlg], actAmountLeftKey), actTotal)
142142 let lastActivitiesTime = valueOrElse(getInteger(contracts[dappWlg], lastActivitiesTimeKey), issueTime)
143143 let actAmountAvailableNow = min([fraction(actTotal, (now - lastActivitiesTime), (3 * YEARMILLIS)), actAmountLeft])
144144 let actWlgold = assetBalance(contracts[dappRest], wlgId)
145145 let lastUserTime = valueOrElse(getInteger(contracts[dappWlg], keyLastClaimedTimeByUser(userAddrOpt)), issueTime)
146146 let lastUserPeriod = ((lastUserTime - issueTime) / YEARMILLIS)
147147 let nowLimited = min([now, (issueTime + (3 * YEARMILLIS))])
148148 let curPeriod = min([((now - issueTime) / YEARMILLIS), 2])
149149 let eff = getPieces(userAddrOpt, contracts[dappStaking])
150150 let curPeriodDistribution = distributionByPeriod(curPeriod)
151151 let userAmount = fraction(if ((lastUserPeriod == curPeriod))
152152 then fraction(curPeriodDistribution, (nowLimited - lastUserTime), YEARMILLIS)
153153 else if ((lastUserPeriod == (curPeriod - 1)))
154154 then (fraction(distributionByPeriod((curPeriod - 1)), ((issueTime + (YEARMILLIS * curPeriod)) - lastUserTime), YEARMILLIS) + fraction(curPeriodDistribution, (nowLimited - (issueTime + (YEARMILLIS * curPeriod))), YEARMILLIS))
155155 else ((fraction(distributionByPeriod((curPeriod - 2)), ((issueTime + (YEARMILLIS * (curPeriod - 1))) - lastUserTime), YEARMILLIS) + distributionByPeriod((curPeriod - 1))) + fraction(curPeriodDistribution, (nowLimited - (issueTime + (YEARMILLIS * curPeriod))), YEARMILLIS)), eff[1], eff[0])
156156 let sLandDailyAmount = fraction(fraction(curPeriodDistribution, DAY, YEARMILLIS), 25, eff[0])
157157 let amountLeftTotal = valueOrElse(getInteger(contracts[dappWlg], stakersAmountLeftKey), 0)
158158 [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, sLandDailyAmount, investFundTotal]
159159 }
160160
161161
162-let KSALLOWWLGOLD = true
163-
164162 let chain = take(drop(this.bytes, 1), 1)
165163
166164 let usdtAssetId = match chain {
167165 case _ =>
168166 if ((base58'2W' == $match0))
169167 then base58'9wc3LXNA4TEBsXyKtoLE9mrbDD7WMHXvXrCjZvabLAsi'
170168 else if ((base58'2T' == $match0))
171169 then base58'6mWwf9mZBjVgkC54idpyaZLQfAosD914wT8fGf2iiY63'
172170 else throw("Unknown chain")
173171 }
174172
175173 let defaultRestAddressStr = match chain {
176174 case _ =>
177175 if ((base58'2W' == $match0))
178176 then "3PQCuvFbvh4LkPUnrnU1z3jnbA1p9m3WNhv"
179177 else if ((base58'2T' == $match0))
180178 then "3MumkGGztCKAXpWDqxkddofqXSUbqQkvSJy"
181179 else throw("Unknown chain")
182180 }
183181
184182 let arbitrageDelay = match chain {
185183 case _ =>
186184 if ((base58'2W' == $match0))
187185 then 600000
188186 else if ((base58'2T' == $match0))
189187 then 60000
190188 else throw("Unknown chain")
191189 }
192190
193191 let SEP = "__"
194192
195193 let MULT6 = 1000000
196194
197195 let MULT8 = 100000000
198196
199197 let MINSHOPPAYMENT = 100000
200198
201199 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
202200
203201
204202 let IdxCfgStakingDapp = 1
205203
206204 let IdxCfgEconomyDapp = 2
207205
208206 let IdxCfgGovernanceDapp = 3
209207
210208 let IdxCfgWlgDapp = 4
211209
212210 let IdxCfgPuzzlePoolDapp = 5
213211
214212 let IdxCfgInvestFundDapp = 6
215213
216214 func keyRestCfg () = "%s__restConfig"
217215
218216
219217 func keyRestAddress () = "%s__restAddr"
220218
221219
222220 func readRestCfgOrFail (rest) = split_4C(getStringOrFail(rest, keyRestCfg()), SEP)
223221
224222
225223 func getContractAddressOrFail (restCfg,idx) = valueOrErrorMessage(addressFromString(restCfg[idx]), ("Rest cfg doesn't contain address at index " + toString(idx)))
226224
227225
228226 let restContract = addressFromStringValue(valueOrElse(getString(this, keyRestAddress()), defaultRestAddressStr))
229227
230228 let restCfg = readRestCfgOrFail(restContract)
231229
232230 let stakingContract = getContractAddressOrFail(restCfg, IdxCfgStakingDapp)
233231
234232 let economyContract = getContractAddressOrFail(restCfg, IdxCfgEconomyDapp)
235233
236234 let govContract = getContractAddressOrFail(restCfg, IdxCfgGovernanceDapp)
237235
238236 let wlgContract = getContractAddressOrFail(restCfg, IdxCfgWlgDapp)
239237
240238 let puzzlePoolContract = getContractAddressOrFail(restCfg, IdxCfgPuzzlePoolDapp)
241239
242240 let investFundContract = getContractAddressOrFail(restCfg, IdxCfgInvestFundDapp)
243241
244242 let wlgAssetIdKey = "wlg_assetId"
245243
246244 let wlgAssetId = valueOrErrorMessage(getBinary(wlgContract, wlgAssetIdKey), "Not initialized yet")
247245
248246 let IdxEffUser = 1
249247
250248 func keyResProportions () = "resTypesProportions"
251249
252250
253251 func keyStakedPiecesByOwner (ownerAddr) = ("stakedPiecesByOwner_" + ownerAddr)
254252
255253
256254 func asInt (v) = match v {
257255 case n: Int =>
258256 n
259257 case _ =>
260258 throw("fail to cast into Int")
261259 }
262260
263261
264262 func getVotingPower (userAddrStrOrEmpty) = {
265263 let props = split(valueOrElse(getString(stakingContract, keyResProportions()), "0_0_0_0_0_0"), "_")
266264 func adder (acc,item) = (acc + parseIntValue(item))
267265
268266 let totalPower = {
269267 let $l = props
270268 let $s = size($l)
271269 let $acc0 = 0
272270 func $f0_1 ($a,$i) = if (($i >= $s))
273271 then $a
274272 else adder($a, $l[$i])
275273
276274 func $f0_2 ($a,$i) = if (($i >= $s))
277275 then $a
278276 else throw("List size exceeds 6")
279277
280278 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6)
281279 }
282280 let usersPower = valueOrElse(getInteger(stakingContract, keyStakedPiecesByOwner(userAddrStrOrEmpty)), 0)
283281 [totalPower, usersPower]
284282 }
285283
286284
287285 func fixedPoint (val,decimals) = {
288286 let tenPow = pow(10, 0, decimals, 0, 0, DOWN)
289287 let lowPart = toString((val % tenPow))
290288 let zeroes = drop(toString(tenPow), (1 + size(lowPart)))
291289 (((toString((val / tenPow)) + ".") + zeroes) + lowPart)
292290 }
293291
294292
295293 let A6 = 100000000
296294
297295 let B8 = 50000000
298296
299297 let profitAddrKey = "profitAddr"
300298
301299 let stakersAmountPaidTotalKey = "stakersAmountPaidTotal"
302300
303301 func keyStakersAmountPaidUser (addr) = ("stakersAmountPaidUser_" + addr)
304302
305303
306304 func prolog () = asInt(invoke(stakingContract, "saveLastTx", nil, nil))
307305
308306
309307 func getSwapLimit (addr) = {
310308 let lastTime = valueOrElse(getInteger(keyLastArbTimeByUser(addr)), 0)
311309 let now = lastBlock.timestamp
312310 if ((arbitrageDelay > (now - lastTime)))
313311 then throw((("Arbitrages are possible once a " + toString((arbitrageDelay / 60000))) + "min"))
314312 else {
315313 let pieces = getVotingPower(addr)[IdxEffUser]
316314 let pow8 = pow(pieces, 0, B8, 8, 8, CEILING)
317315 fraction(A6, pow8, MULT8)
318316 }
319317 }
320318
321319
322-func claimInternal (addr) = if (!(KSALLOWWLGOLD))
323- then $Tuple2(nil, 0)
324- else {
325- let caller = addressFromStringValue(addr)
326- let curStats = getWlgStats(addr, [restContract, stakingContract, economyContract, govContract, wlgContract, puzzlePoolContract, investFundContract], usdtAssetId, 0)
327- let now = lastBlock.timestamp
328- let issueTime = curStats[idxWlgIssueTime]
329- let marketingAmountLeft = curStats[idxWlgMarketingAmLeft]
330- let marketingAmount = curStats[idxWlgMarketingAmAvailNow]
331- let teamAmountLeft = curStats[idxWlgTeamAmLeft]
332- let teamAmount = curStats[idxWlgTeamAmAvailNow]
333- let actAmountLeft = curStats[idxWlgActAmLeft]
334- let actAmount = curStats[idxWlgActAmAvailNow]
335- if (((now - issueTime) > CHECKTIME))
336- then throw("Please modify contract for next 1.5 years, according to stats")
337- else {
338- let userAmount = curStats[idxWlgUserAmAvailNow]
339- let userKey = keyStakersAmountPaidUser(addr)
340- $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, (curStats[idxWlgAmLeftTotal] - userAmount)), IntegerEntry(marketingAmountLeftKey, (marketingAmountLeft - marketingAmount)), IntegerEntry(lastMarketingTimeKey, now), IntegerEntry(teamAmountLeftKey, (teamAmountLeft - teamAmount)), IntegerEntry(lastTeamTimeKey, now), IntegerEntry(actAmountLeftKey, (actAmountLeft - actAmount)), IntegerEntry(lastActivitiesTimeKey, now), IntegerEntry(keyLastClaimedTimeByUser(addr), now)], userAmount)
341- }
342- }
320+func claimInternal (addr) = {
321+ let caller = addressFromStringValue(addr)
322+ let curStats = getWlgStats(addr, [restContract, stakingContract, economyContract, govContract, wlgContract, puzzlePoolContract, investFundContract], usdtAssetId, 0)
323+ let now = lastBlock.timestamp
324+ let issueTime = curStats[idxWlgIssueTime]
325+ let marketingAmountLeft = curStats[idxWlgMarketingAmLeft]
326+ let marketingAmount = curStats[idxWlgMarketingAmAvailNow]
327+ let teamAmountLeft = curStats[idxWlgTeamAmLeft]
328+ let teamAmount = curStats[idxWlgTeamAmAvailNow]
329+ let actAmountLeft = curStats[idxWlgActAmLeft]
330+ let actAmount = curStats[idxWlgActAmAvailNow]
331+ if (((now - issueTime) > CHECKTIME))
332+ then throw("Please modify contract for next 1.5 years, according to stats")
333+ else {
334+ let userAmount = curStats[idxWlgUserAmAvailNow]
335+ let userKey = keyStakersAmountPaidUser(addr)
336+ $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, (curStats[idxWlgAmLeftTotal] - userAmount)), IntegerEntry(marketingAmountLeftKey, (marketingAmountLeft - marketingAmount)), IntegerEntry(lastMarketingTimeKey, now), IntegerEntry(teamAmountLeftKey, (teamAmountLeft - teamAmount)), IntegerEntry(lastTeamTimeKey, now), IntegerEntry(actAmountLeftKey, (actAmountLeft - actAmount)), IntegerEntry(lastActivitiesTimeKey, now), IntegerEntry(keyLastClaimedTimeByUser(addr), now)], userAmount)
337+ }
338+ }
343339
344340
345341 @Callable(i)
346342 func constructorV1 (restAddr,marketingAddr,teamAddr,profitAddr) = if ((i.caller != this))
347343 then throw("Permission denied")
348344 else if (isDefined(getBinary(wlgAssetIdKey)))
349345 then throw("Already initialized")
350346 else {
351347 let issuedAmount = MILLION6
352348 let issue = Issue("WLGOLD", "WavesLands Gold investment token", issuedAmount, 8, true, unit, 0)
353349 let assetId = calculateAssetId(issue)
354350 [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)]
355351 }
356352
357353
358354
359355 @Callable(i)
360-func buyWlg (minAmount) = if (!(KSALLOWWLGOLD))
361- then $Tuple2(nil, 0)
362- else {
363- let prologResult = prolog()
364- if ((size(i.payments) != 1))
365- then throw("exactly 1 payment must be attached")
366- else {
367- let pmt = i.payments[0]
368- let usdtAmt = pmt.amount
369- let pmtAssetId = valueOrErrorMessage(pmt.assetId, "USDT payments only!")
370- if ((pmtAssetId != usdtAssetId))
371- then throw("USDT payments only!")
372- else {
373- let caller = i.caller
374- let addr = toString(caller)
375- let maxUsdt = getSwapLimit(addr)
376- if ((usdtAmt > maxUsdt))
377- then throw((("You can spend max " + fixedPoint(maxUsdt, 6)) + " USDT"))
378- else if ((MINSHOPPAYMENT > usdtAmt))
379- then throw((("You can trade min " + fixedPoint(MINSHOPPAYMENT, 6)) + " USDT"))
380- else {
381- let curStats = getWlgStats("", [restContract, stakingContract, economyContract, govContract, wlgContract, puzzlePoolContract, investFundContract], usdtAssetId, usdtAmt)
382- let curWlgAmount = curStats[idxWlgAmount]
383- let fundsUsd = curStats[idxWlgFunds]
384- let wlgPrice = fraction(fundsUsd, MULT8, curWlgAmount)
385- let buyPrice = fraction(wlgPrice, 6, 5)
386- let wlgAmount = fraction(usdtAmt, MULT8, buyPrice)
387- if ((minAmount > wlgAmount))
388- then throw("Price changed during operation, please try again")
389- else {
390- let profitAmount = (usdtAmt / 6)
391- let deltaFunds = (usdtAmt - profitAmount)
392- let reissued = fraction(curWlgAmount, deltaFunds, fundsUsd)
393- $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)
394- }
395- }
396- }
397- }
398- }
356+func buyWlg (minAmount) = {
357+ let prologResult = prolog()
358+ if ((size(i.payments) != 1))
359+ then throw("exactly 1 payment must be attached")
360+ else {
361+ let pmt = i.payments[0]
362+ let usdtAmt = pmt.amount
363+ let pmtAssetId = valueOrErrorMessage(pmt.assetId, "USDT payments only!")
364+ if ((pmtAssetId != usdtAssetId))
365+ then throw("USDT payments only!")
366+ else {
367+ let caller = i.caller
368+ let addr = toString(caller)
369+ let maxUsdt = getSwapLimit(addr)
370+ if ((usdtAmt > maxUsdt))
371+ then throw((("You can spend max " + fixedPoint(maxUsdt, 6)) + " USDT"))
372+ else if ((MINSHOPPAYMENT > usdtAmt))
373+ then throw((("You can trade min " + fixedPoint(MINSHOPPAYMENT, 6)) + " USDT"))
374+ else {
375+ let curStats = getWlgStats("", [restContract, stakingContract, economyContract, govContract, wlgContract, puzzlePoolContract, investFundContract], usdtAssetId, usdtAmt)
376+ let curWlgAmount = curStats[idxWlgAmount]
377+ let fundsUsd = curStats[idxWlgFunds]
378+ let wlgPrice = fraction(fundsUsd, MULT8, curWlgAmount)
379+ let buyPrice = fraction(wlgPrice, 6, 5)
380+ let wlgAmount = fraction(usdtAmt, MULT8, buyPrice)
381+ if ((minAmount > wlgAmount))
382+ then throw("Price changed during operation, please try again")
383+ else {
384+ let profitAmount = (usdtAmt / 6)
385+ let deltaFunds = (usdtAmt - profitAmount)
386+ let reissued = fraction(curWlgAmount, deltaFunds, fundsUsd)
387+ $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)
388+ }
389+ }
390+ }
391+ }
392+ }
399393
400394
401395
402396 @Callable(i)
403-func sellWlg (minAmount) = if (!(KSALLOWWLGOLD))
404- then $Tuple2(nil, 0)
405- else {
406- let prologResult = prolog()
407- if ((size(i.payments) != 1))
408- then throw("exactly 1 payment must be attached")
409- else {
410- let pmt = i.payments[0]
411- let wlgAmt = pmt.amount
412- let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WLGOLD payments only!")
413- if ((pmtAssetId != wlgAssetId))
414- then throw("WLGOLD payments only!")
415- else {
416- let caller = i.caller
417- let addr = toString(caller)
418- let maxUsdt = getSwapLimit(addr)
419- let curStats = getWlgStats("", [restContract, stakingContract, economyContract, govContract, wlgContract, puzzlePoolContract, investFundContract], usdtAssetId, 0)
420- let curWlgAmount = curStats[idxWlgAmount]
421- let sellPrice = fraction(curStats[idxWlgPrice], 4, 5)
422- let usdtAmt = fraction(wlgAmt, sellPrice, MULT8)
423- if ((usdtAmt > maxUsdt))
424- then throw((("You can get max " + fixedPoint(maxUsdt, 6)) + " USDT"))
425- else if ((MINSHOPPAYMENT > usdtAmt))
426- then throw((("You can trade min " + fixedPoint(MINSHOPPAYMENT, 6)) + " USDT"))
427- else if ((minAmount > usdtAmt))
428- then throw("Price changed during operation, please try again")
429- else {
430- let profitAmount = (usdtAmt / 4)
431- let burned = fraction((usdtAmt + profitAmount), curWlgAmount, curStats[idxWlgFunds])
432- $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)
433- }
434- }
435- }
436- }
397+func sellWlg (minAmount) = {
398+ let prologResult = prolog()
399+ if ((size(i.payments) != 1))
400+ then throw("exactly 1 payment must be attached")
401+ else {
402+ let pmt = i.payments[0]
403+ let wlgAmt = pmt.amount
404+ let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WLGOLD payments only!")
405+ if ((pmtAssetId != wlgAssetId))
406+ then throw("WLGOLD payments only!")
407+ else {
408+ let caller = i.caller
409+ let addr = toString(caller)
410+ let maxUsdt = getSwapLimit(addr)
411+ let curStats = getWlgStats("", [restContract, stakingContract, economyContract, govContract, wlgContract, puzzlePoolContract, investFundContract], usdtAssetId, 0)
412+ let curWlgAmount = curStats[idxWlgAmount]
413+ let sellPrice = fraction(curStats[idxWlgPrice], 4, 5)
414+ let usdtAmt = fraction(wlgAmt, sellPrice, MULT8)
415+ if ((usdtAmt > maxUsdt))
416+ then throw((("You can get max " + fixedPoint(maxUsdt, 6)) + " USDT"))
417+ else if ((MINSHOPPAYMENT > usdtAmt))
418+ then throw((("You can trade min " + fixedPoint(MINSHOPPAYMENT, 6)) + " USDT"))
419+ else if ((minAmount > usdtAmt))
420+ then throw("Price changed during operation, please try again")
421+ else {
422+ let profitAmount = (usdtAmt / 4)
423+ let burned = fraction((usdtAmt + profitAmount), curWlgAmount, curStats[idxWlgFunds])
424+ $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)
425+ }
426+ }
427+ }
428+ }
437429
438430
439431
440432 @Callable(i)
441433 func claim () = {
442434 let prologResult = prolog()
443435 if ((size(i.payments) != 0))
444436 then throw("No payments required")
445437 else {
446438 let actions = claimInternal(toString(i.caller))._1
447439 $Tuple2(actions, prologResult)
448440 }
449441 }
450442
451443
452444
453445 @Callable(i)
454446 func onStakeUnstakeLand (addr) = if ((i.caller != stakingContract))
455447 then throw("Permission denied")
456448 else claimInternal(addr)
457449
458450

github/deemru/w8io/026f985 
53.72 ms